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

alexandreracine’s picture

Status: Needs review » Closed (won't fix)

Version 4.7 is not supported anymore.