Not signed in (Sign In)

Categories

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
  1.  # 1
    is there any extension that allows youtube videos to be posted in my vanilla forum?
  2.  # 2
    i think object and embed tags are stripped. All you have to do is allow them. In Sirnot's html formatter there is this code
    $Html_DisallowedTags = array('link', 'iframe', 'frame', 'frameset', 'object', 'embed', 'style', 'applet', 'meta');

    remove object and embed from it
    •  
      CommentAuthorDinoboff
    • CommentTimeOct 3rd 2006 edited
     # 3
    Don't allow these tags.

    here is a solution, it is for the BBcode parser, but it could work with any formatter:
    http://lussumo.com/community/discussion/2199/#Item_44
    (read the following post too)
    •  
      CommentAuthorBergamot
    • CommentTimeOct 3rd 2006 edited
     # 4
    Yeah, the important line is

    $String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', $String);
  3.  # 5
    thanks everyone for the posts.

    I downloaded and tweaked better bbcode as suggested above.

    but despite clicking the bbcode button below my message box, my youtube video does not display - instead i just see gobblygook code.

    I am posting under the name 'Pillars', three posts up from the bottom at:
    http://www.love2escape.com/chat/discussion/109/new-zealand/
    •  
      CommentAuthorjimw
    • CommentTimeOct 3rd 2006
     # 6
    I've had success with embedding something like the following:

    <object type="application/x-shockwave-flash" data="http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/dewplayer.swf?son=http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/the_thrill.mp3" width="200" height="20"><param name="movie" value="http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/dewplayer.swf?son=http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/the_thrill.mp3" />
    </object>

    It looks similar. Where did you get the code script you used?
  4.  # 7
    Jim, I followed the tip above, and downloaded earlier today, Better BBCode extension at
    http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=31

    I then tweaked the code, as mentioned by Dinoboff above (at the url he mentions)

    I'm probably doing something stupid.
    • CommentAuthorithcy
    • CommentTimeOct 3rd 2006 edited
     # 8
    $String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', $String);
    this won't work. the second argument to preg_replace() needs to be in double quotes, otherwise variable interpolation is turned off and $1 won't be replaced with the youtube ID.

    in other words:
    $String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/$1\"></param><embed src=\"http://www.youtube.com/v/$1\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"350\"></embed></object>", $String);
    this may not be the only problem though.
    • CommentAuthorSirNot
    • CommentTimeOct 3rd 2006 edited
     # 9
    the second argument to preg_replace() needs to be in double quotes

    No it dosn't.

    @Bergamot: I would recommend against using a wildcard to test for the youtube ID, as people could exploit it and insert malicious js into the page. Maybe something like this... (I don't think you needed to escape '<' and '>')preg_replace('/<youtube>([\d\w-_]+)<\/youtube>/i', .....);although I'm not exactly sure what characters can be in a youtube video ID
  5.  # 10
    itchy, thanks for trying

    still no workie :(

    http://www.love2escape.com/chat/discussion/109/new-zealand/
  6.  # 11
    SirNot, should i use

    preg_replace('/<youtube>([\d\w-_]+)<\/youtube>/i', .....);

    on that line instead?
    • CommentAuthorSirNot
    • CommentTimeOct 3rd 2006 edited
     # 12
    it appears that it's converting the youtube video id before it changes instances of '<', '>' and '&' to their html equivelents. where are you inserting the call to preg_replace?

    EDIT: nevermind, just read the link
  7.  # 13
    forgive my coding ignorance here, but what should i change/add?
  8.  # 14
    oops sorry, just after seeing your second sentence above.

    in the default.php of that extension i have

    $parser = new HTML_BBCodeParser();

    if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
    {
    $String = $this->ProtectString($String);
    $String = $parser->qparse($String);
    $String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/$1\"></param><embed src=\"http://www.youtube.com/v/$1\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"350\"></embed></object>", $String);
    return $String;
    }
    else
    return $String;

    NOTE - the above contains Itchy's suggested replace line....will need to change that back maybe - after what you said above.
    • CommentAuthorSirNot
    • CommentTimeOct 3rd 2006 edited
     # 15
    well if you apply the mod correctly, then it should work. However, I would suggest modifying the function in default.php like so:
       function Parse($String, $Object, $FormatPurpose)
    {
    $parser = new HTML_BBCodeParser();

    if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
    {
    $String = $this->ProtectString($String);
    $String = $parser->qparse($String);
    return preg_replace('/<youtube>([\d\w-_]+)<\/youtube>/i',
    '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param>
    <embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed>
    </object>', $String);
    }
    else
    return $String;
    }
    rather than what Bergamot originally posted, as youtube video ids can have underscores and hyphens in them.
  9.  # 16
    reverting back to the original, the code i have is:


    $parser = new HTML_BBCodeParser();

    if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
    {
    $String = $this->ProtectString($String);
    $String = $parser->qparse($String);
    $String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', $String);
    return $String;
    }
    else
    return $String;
    }
  10.  # 17
    thanks SirNot, i will try your suggestion now on my site
  11.  # 18
    nope, still not working :(
    • CommentAuthorSirNot
    • CommentTimeOct 3rd 2006 edited
     # 19
    And you are using the Better BB-Code 1.0 extension? No other modifications? What other formatters have you installed? This may sound stupid, but you have selected bbcode as your formatting option, and used the bbcode tags [youtube]vid id[/youtube] to post it, right?

    It's really strange, because I just downloaded/modified the extension and it's working fine for me.
  12.  # 20
    yes, I am using Better BB-Code 1.0 (downloaded it this morning)

    I haven't modified it apart from what was recommended above in Dinoboff's post/link http://lussumo.com/community/discussion/3942/embed-youtube/#Item_3

    and then I editted again a few mins ago, using your code above.

    yes, I always click the bbcode button for my formatting option, when i try to post the youtube video. :)

    as for the bbcode tags, i am unsure what you mean.

    I just post the embed code that i copy/paste from the youtube site

    eg

    <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/PcWrB9B485s"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/PcWrB9B485s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
  13.  # 21
    as for what other formatters have installed

    I am not clear here what they might be

    lesseee

    looking at my extensions here, i have:

    Account Pictures 1.0
    Atom Feed 1.0
    Attachments 2.0
    Better BB Code 1.0
    Discussion Filters 1.0
    Extended Text Formatter 1.0
    Html Formatter 1.6
    Inline Images 1.0
    Page Management 2.3
    Quotations 1.5
    Vanillacons 1.1
    • CommentAuthorithcy
    • CommentTimeOct 3rd 2006
     # 22
    sirnot, you realize that single quoted strings are string literals in php, right? they are not interpreted by php.
    • CommentAuthorithcy
    • CommentTimeOct 3rd 2006
     # 23
    (of course it could be somehow different with preg_replace and i've just never noticed)
  14.  # 24
    wonderin why it doesn't work for me :(

    boo hoo. I'm off to open my red wine.
    • CommentAuthoraddicted
    • CommentTimeOct 3rd 2006
     # 25
    It would be a great idea for an extension maybe using some kindof Ajaxy thing so the video wouldn't take up much space.
  15.  # 26
    FCKeditor, tinymce and dojo editor all are using kses,
    now how do I allow youtube in kses.
    Any idea
    • CommentAuthorSirNot
    • CommentTimeOct 4th 2006 edited
     # 27
    >sirnot, you realize that single quoted strings are string literals in php, right? they are not interpreted by php.

    I am fully aware of that. The $1 is not meant to be replaced by PHP; heck, I don't think variables can even begin with a number. From php.net/preg_replace:
    Replacement may contain references of the form \\n or (since PHP 4.0.4) $n, with the latter form being the preferred one. Every such reference will be replaced by the text captured by the n'th parenthesized pattern. n can be from 0 to 99, and \\0 or $0 refers to the text matched by the whole pattern. Opening parentheses are counted from left to right (starting from 1) to obtain the number of the capturing subpattern.


    @strawberries: I'm not in a position to test anything at the moment, but the extended text formatter may be what's causing this. Try disabling it and see if anything changes. I'll be more helpful when I get home. EDIT: nope, nevermind...
    • CommentAuthorithcy
    • CommentTimeOct 4th 2006
     # 28
    i know all about regexes and capturing, i just didn't think it could be done inside string literals. but now i know. thank you for enlightening me.
  16.  # 29
    SirNot, thanks for trying......I tried the suggestion of disabling the Extended Text Formatter. But the change made no difference :(

    On a wider perspective, we really do need a YouTube Extension. Every non-vanilla forum I am in these days has youtube videos posted.
  17.  # 30
    And you think that's a reason to add it to vanilla?

    *makes the sign of the cross
    • CommentAuthorithcy
    • CommentTimeOct 4th 2006
     # 31
    "every myspace profile i am in these days has glittery star graphics and bright green text"
  18.  # 32
    LOL

    I know we vanilla folks are different from the others.....but the ability to post a youtube video would be nice, mini.

    eg at the minute, i am trying to describe how beautiful a location is in New Zealand to Merikan friends on my board, when it is so much easier if i can post a few youtube videos on the area and let them see for themselves.
    •  
      CommentAuthorWanderer
    • CommentTimeOct 4th 2006
     # 33
    On a slightly sideways note...

    I'm able to post YouTube videos on my Vanilla setup, (I have allowed iFrames).

    My question is; being that the video file is hosted on YouTube, does the bandwidth used get registered against my server in any way?

    That is, does it go directly from YouTube to the viewer's browser or is it routed via my server?
    •  
      CommentAuthorDinoboff
    • CommentTimeOct 4th 2006
     # 34
    Your users don't use your bandwidth...
    But allowing them to use iframes is a bad idea since anything can be loaded on your pages.
    •  
      CommentAuthorWanderer
    • CommentTimeOct 5th 2006
     # 35
    Thanks Dinoboff, but my users have problems loading the forum on my pages let alone a malicious attack via an iFrame! :-)
Add your comments
    Username Password
  • Format comments as