I installed the [2.0.19] Youtube Video BBCode and the [2.0.21] Google Video and everthing worked perfectly, until I tested the feature in my browser and got the following warning message:
This page contains both secure and nonsecure items.
Do you want to display the nonsecure items?
AHH! How annoying. So I went about looking for a workaround for this and finally came up with my own solution, that is very easy.
Open includes\bbcode.php
Find
- Code: Select all
// [email]user@domain.tld[/email] code..
$patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
$replacements[] = $bbcode_tpl['email'];
After Add
- Code: Select all
// [youtube]YouTube URL[/youtube] code..
$patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";
$replacements[] = $bbcode_tpl['youtube'];
// [GVideo]GVideo URL[/GVideo] code..
$patterns[] = "#\[GVideo\]http://video.google.com/googleplayer\.swf\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
$replacements[] = $bbcode_tpl['GVideo'];
// [GVideo]GVideo URL[/GVideo] code..
$patterns[] = "#\[GVideo\]http://video.google.com/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
$replacements[] = $bbcode_tpl['GVideo'];
Find
- Code: Select all
$text = preg_replace($patterns, $replacements, $text);
After Add
- Code: Select all
$text = str_replace("http://www.youtube.com/", "https://example.com/lounge/youtube/", $text);
$text = str_replace("http://video.google.com/videoplay", "https://example.com/lounge/googleplayer.swf", $text);
$text = str_replace("http://video.google.com/", "https://example.com/lounge/", $text);
Now heres the cool part, in your sites root web-accessible folder http://www.example.com/ add an .htaccess file with the following:
- Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^lounge/googleplayer\.swf(.*)$ http://video.google.com/googleplayer.swf$1 [L]
RewriteRule ^lounge/youtube/(.*)$ http://www.youtube.com/$1 [L]
and it worked!
But one caveat, this wouldn’t turn the warning messages off in IE < version 7, so I added some simple HTML to the head of all my pages that only shows up for people using IE < version 7.
- Code: Select all
<!--[if lt IE 7]>
<span id="ie7">Please Upgrade:
<a href="http://www.microsoft.com/windows/ie/downloads/default.mspx?mg_id=10013">IE 7!</a>
<a href="http://www.mozilla.com/en-US/">FF!</a></span>
<![endif]–>