Advertisement:

Author Topic: [Deprecated, use Aeva] YouTube BBCode v2.6  (Read 197786 times)

Offline Nao 尚

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,928
  • Gender: Male
    • wedgebook on Facebook
    • Wedge
[Deprecated, use Aeva] YouTube BBCode v2.6
« on: September 27, 2007, 05:51:05 PM »
Link to Mod


THIS MOD IS DEPRECATED. USE AEVA INSTEAD.

YOUTUBE BBCODE v2.6
Updated by Nao
Created By Karl Benson

Support Topic | Donate

Compatibility
For SMF 1.1.x and SMF 2.x (MySQL only)

Introduction
Embed Youtube videos into posts with the use of [youtube][/youtube] bbcode.

It's the ultimate friendly YouTube mod for BBCode addicts, supporting various link formats (including Playlist links), safely and securely parsing the information for the piece of mind of forum admins.
It is, however, severely outdated when compared with its successor, Aeva, which has support for many more video websites and many more options.

So, if you want to be able to directly post YouTube URLs without tags and still have them embedded, I would recommend upgrading to Aeva or Aeva Media. Check its package file to find a conversion script inside it. It also converts tags from many other older mods such as [ytplaylist] or Google Video BBCode, etc.
Just extract the conversion script via FTP to your directory where SMF runs from. Put your forum in maintenance mode, and then point to it in your browser.

Features
o Adds a BBCode Button to Insert [youtube][/youtube] bbcode.
o Supports standard YouTube videos and YouTube playlists
- Standard: eg http://www.youtube.com/watch?v=FJ2UzCZiKgT
- Playlist: eg http://www.youtube.com/view_play_list?p=595A40209CB17411
o Supports links from YouTube's global site, and several localized sites (if you need support for all localised sites, use Aeva instead)
 > Global (with or without www.) | Brasil | France | India | Ireland | Israel | Italia | Japan | Nederland | Polska | Espana | United Kingdom
 > Australia | Hong Kong | Mexico | New Zealand | Deutsche | Canada | Russia | Taiwan | South Korea
o Supports various formats
- YouTube Page url
- Direct Embed url
- ID only
o Specify sizes (Optional)
- eg [youtube=425,350][/youtube]
- Defaulting to default YouTube sizes if not specified
- Size Protection to prevent embedding videos larger than 780px or less than 100px
o Safe from a security standpoint
- Properly validates/sanitizes/parses the video id before including it in the url
- Disables script access (allowScriptAccess="never")
o Alternative link and/or text provided for
- Invalid video id/links
- Printer friendly versions
- Disabled bbcoded
- Disabled flash
o Supports the following languages (both in ISO and UTF modes)
- English, British, Brazilian, French, German, Italian, Polish, Portuguese, Spanish, Swedish and Turkish.

Installation

Any previous versions of this mod need to be uninstalled prior to installing this version.

Installation slightly varies depending on SMF version.

SMF 1.1.1 to 1.1.4 & SMF 2.0 Beta 1
Installing the mod will only fully install the mod on the SMF Default Core Theme.
For all other themes which have a custom Post.template.php a manual edit will be required to add the BBCode Button.
(SMF 2.0 Beta 1 Only) You can choose to have the SMF Package Manager attempt* to perform the manual edit on all themes.

FIND
Code: [Select]
'flash' => array('code' => 'flash',ADD BEFORE
Code: [Select]
'youtube' => array('code' => 'youtube', 'before' => '[youtube]', 'after' => '[/youtube]', 'description' => $txt['youtube']),
You will also need to place a copy of the youtube.gif in each of your themes bbc image folders (eg Themes/{themename}/images/bbc)

If you're using a language different than the ones supported this mod (listed above), then you will need to add the following to the Modifications.{language}.php for each theme (The language folder can be found eg Themes/{themename}/languages/)

FIND
Code: [Select]
?>ADD BEFORE (and translate as necessary the language strings)
Code: [Select]
$txt['youtube'] = 'YouTube';
$txt['youtube_invalid'] = '#Invalid YouTube Link#';

SMF 2.0 Beta 2 / Beta 3 / Beta 3 Public / RC 1
Since SMF 2.0 Beta 2, the BBCode buttons have been moved from the templates and into the source files.
Therefore no manual edits will normally be required. Installing the mod will automatically install it on ALL themes.

However you will still need to place a copy of the youtube.gif in each of your themes bbc image folders (eg Themes/{themename}/images/bbc)

And if your using a language different than the ones supported this mod (listed above), then you will need to add the following to the Modifications.{language}.php for each theme (The language folder can be found eg Themes/{themename}/languages/)

FIND
Code: [Select]
?>ADD BEFORE (and translate as necessary the language strings)
Code: [Select]
$txt['youtube'] = 'YouTube';
$txt['youtube_invalid'] = '#Invalid YouTube Link#';

Useful Links
Manual Installation Of Mods
How Do I Modify Files?

Support
Please use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)

Changelog
2.6 - 5th February 2010
o Ownership given to Nao
o Updated readme and description
o Added French Language (translated by Nao)
o Added support for SMF 2.0 RC2 (eh, finally...?)
2.5 - 24th April 2009
o Ownership given to Runic
o Added Dutch Language (translated by Tom Te Selle)
2.4 - 5th October 2008
o Ensured compatible with SMF 2.0 Beta 4 and SMF 1.1.6
o Added YouTube FullScreen parameter (so player shows full screen button)
o Fixed encoded ampersands as &
o Added Support for YouTube India (in), South Korea (kr) and Israel (il)
o Moved all language strings into a single file [languagestrings.xml] (save repetition) in the package
2.3 - 18th March 2008
o Ensured compatible with SMF 2.0 Beta 3 Public
o Added Polish language strings (Thanks to Nolt)
2.2 - 21st February 2008
o Added &rel=1 to all embed links as YouTube seesm to require it now.
2.1 - 31st January 2008
o Support for YouTube Playlist links
o Optimized preg and rewrote regex
o Changed max size supported to 780px
o Now builds the object based on browser
« Last Edit: March 28, 2010, 03:30:10 AM by Nao »
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #1 on: September 29, 2007, 09:48:36 PM »
Troubleshooting

Blank Button - The Icon is Missing
Are you using the SMF default core theme? If the answer is NO.
You will also need to place a copy of the youtube.gif in each of your themes bbc image folders (eg Themes/{themename}/images/bbc)

No YouTube Button whatsoever
Are you using the SMF default core theme? If the answer is NO.
This mod only installs onto the SMF default core theme (and any theme without a custom Post.template.php)
You need to perform a manual edits listed by the mod (listed under Manual Edits)

Text is Appearing at the top of the page
The language strings were not inserted correctly by SMF due to a possiblel issue with the language file.
Its easy to fix.
open Themes/default/languages/Modifications.english.php

Move ?> to the very bottom (nothing below, not even a newline or space)
Move <?php to the very top (nothing above, not even a newline or space)

(make sure there are no spaces or new lines before or after those bits)
If your using utf8 language set you may also need to do it for Themes/default/languages/Modifications.english-utf8.php

"The message body was left empty." Error Message
Note: Due to a problem/bug in SMF.  If you make a post with only a [youtube] video in it, you will get an "empty message" error because there is no actual content to the post.
However I have posted a Mod to Fix the issue for ALL other video clip embed/type mods.

Already have an old YouTube mod installed?
If you currently use the old YouTube mods by Yakuza, Marlon, Gantman or Daniel Marquard, you are recommended to uninstall those and install this mod instead because those older mods have a 'potential' xss vulnerabilty as they don't validate/parse the data.
Most likely until that old mod is uninstalled, it will prevent this mod automatically installing via the package manager.

Undefined index: youtube
You are missing the language strings for that theme and/or language.

You need to add to your Modifications.{language}.php in each Themes language files
Code: [Select]
$txt['youtube'] = 'YouTube';
$txt['youtube_invalid'] = '#Invalid YouTube Link#';
If your using utf8, you may also need to add the strings to Modifications.{language}-utf8.php
« Last Edit: November 18, 2007, 12:48:16 PM by karlbenson »

Offline Sakae

  • Full Member
  • ***
  • Posts: 483
  • Gender: Male
    • TigreLOG
Re: YouTube BBCode
« Reply #2 on: September 30, 2007, 03:24:08 PM »
Wonderful job, Karl. Running great in my SMF 1.1.4.

This mod does exactly what a Youtube BBCode should do - no numbers at bbcode ("youtube,420,510" or something like that - I never paid attention at those numbers) and works with http://br.youtube.com.

Here's the translation to brazilian-utf8.

Code: [Select]
$txt['youtube'] = 'YouTube';
$txt['youtube_invalid'] = '#Link do Youtube inv&aacute;lido!#';

Also portuguese and brazilian:

Code: [Select]
$txt['youtube'] = 'YouTube';
$txt['youtube_invalid'] = '#Link Youtube inválido!#';

Best regards
http://www.tigrelog.com.br
l: simple p: machines

Offline Haunted

  • Newbie
  • *
  • Posts: 3
Re: YouTube BBCode
« Reply #3 on: October 02, 2007, 04:31:24 PM »
EXCELLENT mod!  Thank you!

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #4 on: October 05, 2007, 04:59:21 PM »
Dpenst work for me. Installs OK, but when I use the tag, I just get an "empty" player. If I click the player, it tkaes me to youtube and says video not availanle. I I press reply, Iget the previre pciture of the vidfeo - immediately. Cannot play it thogh.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #5 on: October 05, 2007, 05:02:43 PM »
I believe this happens when the youtube video has been removed/deleted.

Do you have the url of the youtube video your trying to add?

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #6 on: October 05, 2007, 05:41:55 PM »
Yes it is my own video, and it works in my blog.

Strangely enough, the video works when I add the size-parameters to the youtube-tag.

edit: Ok it only worked because I have the video-url hardcoded in the Subs for debuggin purpose.

If I look at the html-source (I have modeed the youtube-tag in subs, because the original code is a little broken also), it looks just like the source in my blog. But it doesn't play.
« Last Edit: October 05, 2007, 05:45:57 PM by tsmalmbe »
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #7 on: October 05, 2007, 05:51:10 PM »
My subs. Moved all the html-code to one row, because it was not being printed to the html-page. Also ripped the parameters straight from my blog, because I know for sure the exact URL works there. This has to be the wierdest thing.

1. I open the blogpage, view the source, copy the URL, paste it in a new tab, and the video is shown fullsized in the browser
2. I open the forumpost, view the source, verify that it is EXACLTY the smae as the one in the blog (using Ultraedit), paste it in a new tab, and the video is not shown.

Code: [Select]
array(
'tag' => 'youtube',
'type' => 'unparsed_content',
'content' => '<object type="application/x-shockwave-flash" width="450" height="350" data="http://www.youtube.com/v/$1" id="ltVideoYouTube"><param name="movie" value="http://www.youtube.com/v/$1" /><param name="wmode" value="transparent" /><param name="allowScriptAcess" value="sameDomain" /><param name="quality" value="best" /><param name="bgcolor" value="#FFFFFF" /><param name="FlashVars" value="playerMode=embedded" /></object>',
'validate' => create_function('&$tag, &$data, $disabled', '
// JUST A VIDEO ID?
if (preg_match(\'#^([0-9A-Za-z-_]{11})#i\', trim($data), $matches)) {
$data = $matches[1];
} else {
// FULL URL? MATCH A VALID STORE
if (preg_match(\'#^http://(www.|uk.|fr.|ie.|it.|jp.|pl.|es.|nl.|br.|)youtube.com/(watch\?v=|v/)([0-9A-Za-z-_]{11})(.*?)#i\', trim($data), $matches)) {
$data = $matches[3];
} else {
global $txt;
$tag[\'content\'] = $txt[\'youtube_invalid\'];
return;
}
}
'),
'disabled_content' => '<a href="$1" target="_blank">$1</a>',
            ),


..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #8 on: October 05, 2007, 05:54:23 PM »
This is the URL generated byu my blogpage:
<object type="application/x-shockwave-flash" width="450" height="350" data="http://www.youtube.com/v/nns_37mxLV8" id="ltVideoYouTube"><param name="movie" value="http://www.youtube.com/v/nns_37mxLV8" /><param name="wmode" value="transparent" /><param name="allowScriptAcess" value="sameDomain" /><param name="quality" value="best" /><param name="bgcolor" value="#FFFFFF" /><param name="FlashVars" value="playerMode=embedded" /></object>


This is the URL generated by the youtube-tag:
<object type="application/x-shockwave-flash" width="450" height="350" data="http://www.youtube.com/v/nnS_37mxLV8" id="ltVideoYouTube"><param name="movie" value="http://www.youtube.com/v/nnS_37mxLV8" /><param name="wmode" value="transparent" /><param name="allowScriptAcess" value="sameDomain" /><param name="quality" value="best" /><param name="bgcolor" value="#FFFFFF" /><param name="FlashVars" value="playerMode=embedded" /></object>
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #9 on: October 05, 2007, 05:58:01 PM »
that video doesnt work at all in my browser.
(direct link in the browser)

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #10 on: October 05, 2007, 06:05:19 PM »
But: if you look at the video from here

http://blog.kontrollrummet.com/tsmalmbes-blog/live/2007/09/07/jethro-tull-live

you can see it, exactly with the URL i posted above.

I've tested this with Mozilla and IE6.

If you load my blogpage, and then retrieve the URL from there, and paste it - it will work.

Here it is: http://www.youtube.com/v/nnS_37mxLV8

Do you see a difference?
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #11 on: October 05, 2007, 07:03:33 PM »
I'll do some testing.

Although when I made the I did test in IE6/IE7/Opera and Firefox.

Offline asdas2

  • Jr. Member
  • **
  • Posts: 177
  • Gender: Male
    • CHILL PARADISE
Re: YouTube BBCode
« Reply #12 on: October 05, 2007, 10:55:19 PM »
can i request for a same mod for Metacafe please
www.metacafe.com
www.chillparadise.com

for all desi people .... get everything u ever wanted.... log in to view hidden stuff.

Offline Krysia

  • Jr. Member
  • **
  • Posts: 377
  • Gender: Female
    • KRYSIA'S WEB
Re: YouTube BBCode
« Reply #13 on: October 05, 2007, 11:51:34 PM »
Do you have a screenshot available to upload of the BBC code tag graphic(s) and how it would appear in a post?



Offline Krysia

  • Jr. Member
  • **
  • Posts: 377
  • Gender: Female
    • KRYSIA'S WEB
Re: YouTube BBCode
« Reply #14 on: October 05, 2007, 11:56:10 PM »
Also, is there a setting with this mod to determine which groups (for example) would be permitted to use the BBC code for embedding YouTube vids?



Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #15 on: October 06, 2007, 09:59:37 AM »
No, there is not a setting to determine which groups can embed youtube vids.

Its either enable or disable the bbcode.
I'll add a screenshot later.

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #16 on: October 07, 2007, 10:41:36 AM »
I was able to find one prob. It was with the ANTI-SHOUT mod that breaks links. I've removed that mod now. Now I get a preview-picture of the video, but still am not able to play it, for some really really peculiar reason.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #17 on: October 07, 2007, 01:07:55 PM »
@asdas2 ~ I have started/nearly finished a metacafe one, however it will be a while before its approved (maybe weeks)

@ tsmalmbe ~ Does the play button appear.  The youtube flash player button is sometimes a bit dodgy and you have to click it more than once to get it to play.

@ Krysia ~ Sorry for not posting before now, I've tested and tested and still am not able to reproduce the bug you report.  However I have tweaked the flash code and fixed a minor issue with sizes and hope to upload version 1.2 later tonight.

Offline tsmalmbe

  • Jr. Member
  • **
  • Posts: 188
  • Gender: Male
    • Kontrollrummet
Re: YouTube BBCode
« Reply #18 on: October 07, 2007, 01:14:31 PM »
@ tsmalmbe ~ Does the play button appear.  The youtube flash player button is sometimes a bit dodgy and you have to click it more than once to get it to play.

Several hours of tedious debugging... I have now found that the problem goes away if I comment out the following line:
<link rel="stylesheet" type="text/css" href="http://forum.malmberg.fi/smf/Themes/Musiconica/style.css?fin11" />

Also, if I remove the DIV that the OBJECT is inside, the problem goes away.

I use the Musiconica-template...
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,584
  • Gender: Male
    • @mortonssols on Twitter
    • Criminal Solicitors
Re: YouTube BBCode
« Reply #19 on: October 07, 2007, 01:24:01 PM »
the div isnt added by the youtube mod.

Probably smf itself, so i don't think i'd be able to remove that myself.