• I think this is bug – but before I enter it, if anyone has comments, enetering this in the forum first.

    functions-formatting.php was fixed to handle script/pre/code/style/kbd tags – as per this issue:
    http://trac.wordpress.org/ticket/2833

    But – it left out handling of

    <object classid...>
    <param>...
    <embed .... />
    </object>

    which is used to add Flash or other similar objects – the above code gets sprinkled with br and p tags, which breaks it. Even putting everything above in a single line did not work – I got one br sneak in in between a >< in the input.

    Since the script and other HTML tags were fixed, I think this should be trivial to fix.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The embed tag is a proprietary tag for Internet Explorer. As a result, pages that use them will not validate. I’m pretty sure WordPress will never support this tag as it is not valid html. There are plugins that make it easy to insert YouTube, Google and many more video formats though. The one I use is:

    http://www.viper007bond.com/wordpress-plugins/vipers-video-quicktags/

    If you do not want a plugin or would rather cut and paste code in as is, you can turn of the WYSIWYG editor before such a post.

    Thread Starter bwooster47

    (@bwooster47)

    1) HTML tags need not be “supported” by WordPress – why would that prevent from following correct parsing rules?

    2) The plugin – video-quicktags – is great for simplifying the act of adding the <object..> tags. But if you look at the source code of the video page at that site, you’ll see WordPress auto formatting has messed up the output HMTL – look at the object tag, and in between the start and end of the object tag, you’ll see a <br/>! And the plugin is trying to avoid this by making really long lines, even that is not fully able to work around the WordPress bug.

    If this issue can be fixed for script/code/kbd etc tags, it seems logical to have this fixed for all tags that encompass other tags – such as the <object> tag.

    i guess you should enter it in as bug then.

    Use the Text Control plugin 2.0b2 with my little fix documented here

    You can then turn off wptexturize for individual posts which will fix the formatting for embed and objects (and script and other tags like that).

    2) The plugin – video-quicktags – is great for simplifying the act of adding the <object..> tags. But if you look at the source code of the video page at that site, you’ll see WordPress auto formatting has messed up the output HMTL – look at the object tag, and in between the start and end of the object tag, you’ll see a <br/>! And the plugin is trying to avoid this by making really long lines, even that is not fully able to work around the WordPress bug.

    I’m not sure which “video” page you were looking at. I went to the front page of the site, viewed the source and did not see any elements within the object element. Here is the code I found for the first video on the site:

    <object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/BQECwm3erEs"><param name="movie" value="http://www.youtube.com/v/BQECwm3erEs" /><param name="wmode" value="transparent" /></object>

    Looks correct to me. The page also validated as XHTML 1.0 Transitional.

    http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.viper007bond.com%2F

    Thread Starter bwooster47

    (@bwooster47)

    Here’s the specific page I looked at, and the copy of what I see when I look at the source, it has the br tag inside object – I copied some extra lines for context. It does pass the W3C XHTML 1.0 Transitional test – but there is certainly a br tag inside the object tag:

    http://www.viper007bond.com/wordpress-plugins/vipers-video-quicktags/

    <p>Anyway, Episode Two will come bundled with two games — Team Fortress 2 (teaser trailer <a href="http://www.viper007bond.com/go.php?http://storefront.steampowered.com/v2/index.php?area=game&AppId=923&" title="[1 hit to this URL]">available here</a>), the sequel to the hugely popular Half-Life 1 mod Team Fortress, and a game called “Portal”. Portal is a puzzle game of sorts where you are given a gun that allows you to create portals that you can travel through. Frankly, it’s a bit hard to explain, so I suggest you watch the awesome trailer.</p>
    <p>You can either download a <a href="http://www.viper007bond.com/go.php?http://hl2p.com/videos/" title="[33 hits to this URL]">high resolution version</a> or watch this crappy YouTube quality version:</p>
    <p><object style="width:425px;height:350px" type="application/x-shockwave-flash" data="http://www.youtube.com/v/y0Jc6q5bdZw"><br />
    <param name="movie" value="http://www.youtube.com/v/y0Jc6q5bdZw" />
    <param name="wmode" value="transparent" /></object></p>

    I see what your saying. If you look at the code for the first three videos on that page, you will find no <br /> elements. These were posted with the most recent version of the plugin.

    I have the same issue.. when i embed flash.. i turn the rich editor off and use the embed tags. Its xhtml valid normally. Everything works perfect, except validating. I get an extra between my lines of code if you look at my source from the page.

    try..

    <object type=”application/x-shockwave-flash” data=”movie.swf” width=”300″ height=”200″>
    <!–[if IE]><param name=”movie” value=”movie.swf”><![endif]–>
    <img src=”noflash.png” alt=”You see this instead”>
    </object>

    works good.. thnx only close the img and param to get it valid too.. but the issue with the xtra code is gone

    This is a bug of sorts in wpautop() in the file /wp-includes/functions-formatting.php

    I patched it to work for Google Video embedded Flash player tags.

    The simple fix is as follows:

    In function wpautop($pee, $br = 1) {

    Add “object|” to three of the regular expressions.

    The expressions are the first two that begin:

    $pee = preg_replace('!(<(?:table|thead|tfoot|

    which, after inserting “object|” before “table” become:

    $pee = preg_replace('!(<(?:object|table|thead|tfoot|

    Next, find the line that begins:

    if ($br) $pee = preg_replace(

    And on the following line:

    $pee = preg_replace('!(</?(?:table|thead|

    insert “object|” before “table” so it becomes:

    $pee = preg_replace('!(</?(?:object|table|thead|

    You can apply the same principle to some other tags that are mangled by the auto-formatting.

    1) For any attempts to use valid object tags with Flash content see
    <http://www.alistapart.com/articles/flashsatay/&gt;
    or search alistapart for “satay”. There’s a bunch of stuff on there about the object tag and multi-media content.

    2) TJworld’s solution was the one that solved the problem, but running WordPress 2.0.5, I found that what worked for me was looking in “wp-includes/functions-formatting.php” and adding “object|” to any instance of
    preg_replace('!(</?(?:table|thead|tfoot|...

    This is very helpful, and I have one other issue related to this particular file. I use the follwing code to embed Flash within a post

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="600" height="469">
    <param name="movie" value="/video/WordpressDemo.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#FFFFFF" />
    <!--[if !IE]><-->
    <object data="/video/WordpressDemo.swf" width="600" height="469" type="application/x-shockwave-flash"><param name="quality" value="high" />
    <param name="bgcolor" value="#FFFFFF" />
    <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
    </object>
    <!--><![endif]-->
    </object>

    Worpdress is still placing line breaks after the <!–[if !IE]><–> and after the <!–><![endif]–>

    How would I prevent that?

    Thanks – Michael

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Bug? Formatting for object or embed tags’ is closed to new replies.