Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
AD Gallery 46
SyntaxHighlighte... 48
Newsletters v4.03 108
Facebook Like Box 123
Newsletters v4.02 56
Metro 158
Facebook Connect 168
Shoutbox Panel 125
Redactor for PHP... 104
MI Floating Side... 107
Facebook Login/R... 151
Avatar Studio v2.03 177
Relationship Sta... 96
Sexual Orientati... 113
Fisherman 142
Popular Addons
iTheme2 5797
Arise 5786
User Control v1.23 4617
Event Calendar 4049
Photowidget panel 3885
Radio-Theme red2... 3352
Highslide Gallery 3312
CSS/JavaScript D... 3224
Facebook Connect... 2980
Dynamic Menu 2889
Slideshow Lightb... 2719
L-AMANT 2657
Enigma 2630
2Dark 2603
Black 2572
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Ideas for 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
<?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);
?>


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
ankurthakur.co.cc/images/freelancer.png
 
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
 
http://www.fusiontube.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
[BBCode]How to make LATEX BBcode Code Snippet and functions 7 04-04-2013 15:35
Youtube sub panel Content Administration 3 01-04-2013 08:14
integrate youtube in fusion General Discussion 3 03-03-2013 18:52
BBCODE onclick , onfocus and ... Panels and Infusions 4 04-01-2013 14:57
BBcode overview page Code Snippet and functions 5 17-12-2012 10:39
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 byVenue