Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Youtube BBCODE

Asked Modified Viewed 3,825 times
M
miskith
M
My projects:
PHP-Fusion Czech | miskith portfolio | theConnex (In preparation) | Online game (Future project)
  • Member, joined since
  • Contributed 117 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
asked
Member

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 PHPFusion. I think that it would be good, if you would add this modification in the PHPFusion 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
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| 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/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION"wink) {die("Access Denied"wink;}

//$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.
0 replies

6 posts

P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

I see it's a new utube code.

Is this code better and if so - why better?
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Ok ! So I just tested it with all of them and It worked Very Nicely... :D

Good Work ;)
0 replies
M
miskith
M
My projects:
PHP-Fusion Czech | miskith portfolio | theConnex (In preparation) | Online game (Future project)
  • Member, joined since
  • Contributed 117 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Member

Quote

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 .
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Very good.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Thanks! :)
0 replies
M
miskith
M
My projects:
PHP-Fusion Czech | miskith portfolio | theConnex (In preparation) | Online game (Future project)
  • Member, joined since
  • Contributed 117 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Member

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]

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| 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/licenses/agpl.html. 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.
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| 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/licenses/agpl.html. 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 22:48,
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
M
M
My projects:
PHP-Fusion Czech | miskith portfolio | theConnex (In preparation) | Online game (Future project)
  • Member, joined since
  • Contributed 117 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet