Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Follow us on Facebook
Follow us on Google+
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Modifications and Requests
Who is here? 1 guest(s)
 Print Thread
Youtube BBCODE
miskith
Hi,
I'm sorry, if this is the wrong forum (cat) for this modification.

I am leader of the Czech official support and we had a problem that I solved modifying PHP-Fusion. I think that it would be good, if you would add this modification in the PHP-Fusion package.

It's improvements for YouTube BBCode. Now, you can write (without white space):
[ youtube]http://www.youtube.com/watch?v=C89Kb2JU4eE[/youtube]
[ youtube]http://youtu.be/C89Kb2JU4eE[/youtube]
[ youtube]C89Kb2JU4eE[/youtube]

Commented = Flash (old) version
Uncommented = Iframe (new) version
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: youtube_bbcode_include.php
| Author: Wooya
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) {die("Access Denied");}

//$text = preg_replace('#\[youtube\](http:\/\/www.youtube\.com\/watch\?v=|http:\/\/youtu\.be\/)?(.*?)\[/youtube\]#si', '<strong>'.$locale['bb_youtube'].'</strong><br /><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\2"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\2" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $text);
$text = preg_replace('#\[youtube\](http:\/\/www.youtube\.com\/watch\?v=|http:\/\/youtu\.be\/)?(.*?)\[/youtube\]#si', '<strong>'.$locale['bb_youtube'].'</strong><br /><iframe width="425" height="350" src="http://www.youtube.com/v/\2" frameborder="0"></iframe>', $text);
?>[/syntaxhighlighter]

And... I would like to ask you if I should share some improvements at this support.

PS: I'm sorry for my English.
 
http://www.theconnex.com
PolarFox
I see it's a new utube code.

Is this code better and if so - why better?
 
http://unlogic.info
Ankur
Ok ! So I just tested it with all of them and It worked Very Nicely... Grin

Good Work Wink
Hi! Its me, Ankur Thakur! Smile
 
http://ankurthakur.in/
miskith
PolarFox wrote:

I see it's a new utube code.

Is this code better and if so - why better?

Iframe code is a new way to share YouTube videos.
Advantages:
- 100% valid HTML
- Functionality in all browsers
- It should have more features
But I don't know if YouTube also uses a secure protocol (https). If uses, I can update the script for HTTP and HTTPS compatibility .
 
http://www.theconnex.com
PolarFox
Very good.
 
http://unlogic.info
Craig
Thanks! Smile
Regards
 
http://www.phpfusionmods.co.uk/
miskith
Nobody answered at my question, so I tried it and youtube uses also a secure protocol (https). So, there you have a new version:
Now Support (without white space):
[ youtube]http://www.youtube.com/watch?v=C89Kb2JU4eE[/youtube]
[ youtube]http://youtu.be/C89Kb2JU4eE[/youtube]
[ youtube]https://www.youtube.com/watch?v=C89Kb2JU4eE[/youtube]
[ youtube]https://youtu.be/C89Kb2JU4eE[/youtube]
[ youtube]C89Kb2JU4eE[/youtube]

Download source  Code
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: youtube_bbcode_include.php
| Author: Wooya
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) {die("Access Denied");}

//$text = preg_replace('#\[youtube\](http:|https:)?(\/\/www.youtube\.com\/watch\?v=|\/\/youtu\.be\/)?(.*?)\[/youtube\]#si', '<strong>'.$locale['bb_youtube'].'</strong><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\3"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\3" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $text);
$text = preg_replace('#\[youtube\](http:|https:)?(\/\/www.youtube\.com\/watch\?v=|\/\/youtu\.be\/)?(.*?)\[/youtube\]#si', '<strong>'.$locale['bb_youtube'].'</strong><iframe width="425" height="350" src="http://www.youtube.com/v/\3" frameborder="0"></iframe>', $text);
?>




EDITED:
Of course, you can use this modification for "movie_bbcode_include.php" too.
Download source  Code
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: movie_bbcode_include.php
| Author: Wooya
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

//$text = preg_replace('#\[movie=youtube\](http:|https:)?(\/\/www.youtube\.com\/watch\?v=|\/\/youtu\.be\/)?(.*?)\[/movie\]#si', '<strong>'.$locale['bb_movie_youtube'].'</strong><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\3"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\3" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $text);
$text = preg_replace('#\[movie=youtube\](http:|https:)?(\/\/www.youtube\.com\/watch\?v=|\/\/youtu\.be\/)?(.*?)\[/movie\]#si', '<strong>'.$locale['bb_movie_youtube'].'</strong><iframe width="425" height="350" src="http://www.youtube.com/v/\3" frameborder="0"></iframe>', $text);
$text = preg_replace('#\[movie=google\](.*?)\[/movie\]#si', '<strong>'.$locale['bb_movie_googlevideo'].':</strong><br /><object width="425" height="350"><param name="movie" value="http://video.google.com/googleplayer.swf?docId=\1"></param><param name="wmode" value="transparent"></param><embed src="http://video.google.com/googleplayer.swf?docId=\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $text);
?>



Edited by miskith on 05-07-2011 21:48
My projects:
PHP-Fusion Czech | miskith portfolio | theConnex (In preparation) | Online game (Future project)
 
http://www.theconnex.com
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Youtube BBcode not work on mobile Site & Forum Issues 3 30-03-2014 14:09
What's the deal with YouTube BBCode? System Administration 1 05-03-2014 19:29
BBcode on articles Panels and Infusions 5 20-02-2014 16:21
[img] BBCode https:// Not Parsing Roadmap 2 16-02-2014 14:34
Easier BBCode Sorting Modifications and Requests 8 09-02-2014 01:59
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel fromVenue