public function onContentPrepare($context, &$article, &$params, $limitstart)
 {
     $option = JRequest::getCmd('option', '');
     if ($option === 'com_search' or $option === "com_finder") {
         return;
     }
     $oldtext = $article->text;
     if (strpos($article->text, '{noembedvideo}') !== FALSE) {
         $article->text = str_ireplace('{noembedvideo}', '', $article->text);
         return;
     }
     $fpwidth = $this->params->get('fpwidth');
     $fpheight = $this->params->get('fpheight');
     $width = $this->params->get('width');
     $height = $this->params->get('height');
     EasyEmbedVideoHelper::setFPWidth($fpwidth);
     EasyEmbedVideoHelper::setFPHeight($fpheight);
     EasyEmbedVideoHelper::setWidth($width);
     EasyEmbedVideoHelper::setHeight($height);
     if ($this->params->get('youtube') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiertube_content($article->text, $context);
     }
     if ($this->params->get('google') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiergoogle_content($article->text, $context);
     }
     if ($this->params->get('ustream') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierustream_content($article->text, $context);
     }
     if ($this->params->get('myspace') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiermyspace_content($article->text, $context);
     }
     if ($this->params->get('vimeo') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiervimeo_content($article->text, $context);
     }
     if ($this->params->get('mybreak') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierbreak_content($article->text, $context);
     }
     if ($this->params->get('mpora') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiermpora_content($article->text, $context);
     }
     if ($this->params->get('youku') == "YES") {
         $article->text = EasyEmbedVideoHelper::easieryouku_content($article->text, $context);
     }
     if ($this->params->get('fivtysix') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierfivtysix_content($article->text, $context);
     }
     if ($this->params->get('kusix') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierkusix_content($article->text, $context);
     }
     if ($this->params->get('kick') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierkick_content($article->text, $context);
     }
     if ($this->params->get('daily') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierdaily_content($article->text, $context);
     }
     if ($this->params->get('meta') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiermeta_content($article->text, $context);
     }
     if ($this->params->get('veoh') == "YES") {
         $article->text = EasyEmbedVideoHelper::easierveoh_content($article->text, $context);
     }
     if ($this->params->get('video123') == "YES") {
         $article->text = EasyEmbedVideoHelper::easiervideo123_content($article->text, $context);
     }
     if ($article->text != $oldtext && $this->params->get('copyrights') != 'no') {
         $article->text .= '<div style="color:gray;font-size:small;margin-top:1em;">embed video plugin powered by <a href="http://union-d.ru">Union Development</a></div>';
     }
 }
 public static function easiervideo123_content($text, $context = 'com_content.article')
 {
     $regex = '/(<[^a]*a[^h]*href\\s*=\\s*"|\')?http:\\/\\/(www\\.|v\\.)?123video.nl\\/playvideos.asp\\?MovieID=([0-9]+)[^\\n\\s\'"<>\\[\\]\\\\$]*([^<]+<\\/a>)?/i';
     preg_match_all($regex, $text, $matches);
     for ($x = 0; $x < count($matches[0]); $x++) {
         $vid = $matches[3][$x];
         if ($context == 'com_content.featured' || $context == 'text') {
             $replace = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="123movie_' . $vid . '" width="' . EasyEmbedVideoHelper::$fpwidth . '" height="' . EasyEmbedVideoHelper::$fpheight . '"><param name="movie" value="http://www.123video.nl/123video_emb.swf?mediaSrc=' . $vid . '" /><param name="quality" value="high" /><param name="allowScriptAccess" value="always"/> <param name="allowFullScreen" value="true"></param><embed src="http://www.123video.nl/123video_emb.swf?mediaSrc=' . $vid . '" quality="high" width="' . EasyEmbedVideoHelper::$fpwidth . '" height="' . EasyEmbedVideoHelper::$fpheight . '" allowfullscreen="true" type="application/x-shockwave-flash"  allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
         } else {
             $replace = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="123movie_' . $vid . '" width="' . EasyEmbedVideoHelper::$width . '" height="' . EasyEmbedVideoHelper::$height . '"><param name="movie" value="http://www.123video.nl/123video_emb.swf?mediaSrc=' . $vid . '" /><param name="quality" value="high" /><param name="allowScriptAccess" value="always"/> <param name="allowFullScreen" value="true"></param><embed src="http://www.123video.nl/123video_emb.swf?mediaSrc=' . $vid . '" quality="high" width="' . EasyEmbedVideoHelper::$width . '" height="' . EasyEmbedVideoHelper::$height . '" allowfullscreen="true" type="application/x-shockwave-flash"  allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
         }
         $text = EasyEmbedVideoHelper::str_replace_once($matches[0][$x], $replace, $text);
         //JCE doubles link fix
         $text = str_replace($replace . $replace, $replace, $text);
     }
     return $text;
 }