Closed (won't fix)
Project:
Googtube
Version:
4.7.x-1.x-dev
Component:
code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2007 at 14:59 UTC
Updated:
13 Mar 2009 at 00:25 UTC
Hi,
i made some modifications to remove anchor tags from YouTube and GoogleVideo links if present. This is especially needed if you are using TinyMCE, because TinyMCE automatically appends anchor tags to all links in Internet Explorer.
i just added two preg_replace functions to remove a tags
case 'process':
$text = ' ' . $text . ' ';
//remove anchor tags if present
$text = preg_replace('!(<a.+?href\="(http://www\.youtube\.com/watch[?]v=[^\[\]()<.,\s\n\t\r]+)"(?=[>\s]).*?>.+?</a>)!i', "$2 ", $text);
$text = preg_replace('!(<a.+?href\="(http://video\.google\.(com|ca)/videoplay[?]docid=[^\[\]()<.,\s\n\t\r]+)"(?=[>\s]).*?>.+?</a>)!i', "$2 ", $text);
//youtube regex
$text = preg_replace_callback('!(((http://)?)|(^./))(((www.)?)|(^./))youtube\.com/watch[?]v=([^\[\]()<.,\s\n\t\r]+)!i', 'googtube_youtube', $text);
//google video regex
$text = preg_replace_callback('!(((http://)?)|(^./))(((www.)?)|(^./))video\.google\.(com|ca)(\.[a-z]+)?/videoplay[?]docid=([^\[\]()<.,\s\n\t\r]+)!i', 'googtube_google', $text);
Comments
Comment #1
alexandreracine commentedVersion 4.7 is not supported anymore.