|
Youtube BBCODE
|
| miskith |
Posted on 01-07-2011 15:36
|

Member

Posts: 119
Joined: 28/07/2010
|
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. |
| |
|
|
| PolarFox |
Posted on 02-07-2011 06:34
|

Admin

Posts: 1480
Joined: 26/08/2008
|
I see it's a new utube code.
Is this code better and if so - why better?
|
| |
|
|
| Ankur |
Posted on 02-07-2011 06:39
|

Admin

Posts: 1291
Joined: 02/11/2010
|
Ok ! So I just tested it with all of them and It worked Very Nicely... 
Good Work
|
| |
|
|
| miskith |
Posted on 02-07-2011 09:48
|

Member

Posts: 119
Joined: 28/07/2010
|
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 . |
| |
|
|
| PolarFox |
Posted on 02-07-2011 15:48
|

Admin

Posts: 1480
Joined: 26/08/2008
|
Very good.
|
| |
|
|
| Craig |
Posted on 02-07-2011 16:02
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Thanks!
|
| |
|
|
| miskith |
Posted on 05-07-2011 21:40
|

Member

Posts: 119
Joined: 28/07/2010
|
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]
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.
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
|
| |
|