Adult SEO |
11-14-2006 07:44 AM |
Hi!
The plugin itself contains a bug, the code is sometimes already parsed and available in $parsedtext instead of $text.
This code will fix it.
One other bug, Google video is available on multiple domains also on video.google.nl or co.uk etc. Also fixed with this code.
I didn't test YouTube however.
PHP Code:
$viper_patterns = array(
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)&(.*?)\[/youtube\]#si',
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)\[/youtube\]#si',
'#docid=http://video.google.[^/
]+/videoplay\?docid=(\d+)[^"]+?"#si',
);
$viper_patterns2 = array(
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)&(.*?)\[/youtube\]#si',
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)\[/youtube\]#si',
'#\[googlevideo\]http://video.google.[^/
]+/videoplay\?docid=(\d+)[^\]]+?\[/googlevideo\]#si',
);
$viper_replacements = array(
'[YOUTUBE]$2[/YOUTUBE]',
'[YOUTUBE]$2[/YOUTUBE]',
'docid=$1"',
);
$viper_replacements2 = array(
'[YOUTUBE]$2[/YOUTUBE]',
'[YOUTUBE]$2[/YOUTUBE]',
'[GOOGLEVIDEO]$1[/GOOGLEVIDEO]',
);
if (!empty($parsedtext)) {
$parsedtext = preg_replace($viper_patterns, $viper_replacements, $parsedtext);
} else {
$text = preg_replace($viper_patterns2, $viper_replacements2, $text);
}
|