function text_out($row, $aparams, $aroute) { $this->text_limited = 0; $text_out = ""; $img_out = ""; $text = ""; $video_out = ''; $intro_img = ''; /* if ( isset($row->text) ) { $text_field_name = 'text'; } elseif ( isset($row->fulltext) ) { $text_field_name = 'fulltext'; } elseif ( isset($row->introtext) ) { $text_field_name = 'introtext'; } else { // Unrecognized return false; } */ // $row->text = ""; $text = $row->text; // Code for displaying of individual items Intro Text switch ($this->params->get('show_text')) { case 0: if ($this->params->get('get_image') == 1 || $this->params->get('get_image') == 2) { $intro_img = $this->image_intro($row->images); } break; case 1: // $text = $row->introtext; if ($this->params->get('get_image') == 1 || $this->params->get('get_image') == 2) { $intro_img = $this->image_intro($row->images); } break; case 2: if ($aparams->get('show_intro', $this->globalConfig->get('show_intro'))) { // $text = $row->introtext.' '.$row->fulltext; if ($this->params->get('get_image') == 1 || $this->params->get('get_image') == 2) { $intro_img = $this->image_intro($row->images); } } else { // $text = $row->fulltext; if ($this->params->get('get_image') == 1 || $this->params->get('get_image') == 2) { $intro_img = $this->image_fulltext($row->images); } } break; } if ($this->params->get('get_image') < 2) { $text = preg_replace('/<img[^>]*>/i', '', $text); } $text = $intro_img . $text; if ($text != '') { $row->text = $text; // perform the replacement // $row->text = str_replace( $regex, '', $row->text ); // Removes instances of {mospagebreak} from being displayed $row->text = str_replace('{mospagebreak}', '', $row->text); $text = $row->text; if ($this->params->get('get_image') && $this->params->get("image_default", 0) && $this->params->get("image_default_file", "") && strpos($text, '<img') === false) { $text = '<img src="' . $this->params->get("image_default_file") . '">' . $text; } if ($this->params->get('get_image') && $this->params->get('image_scale') && !(!$this->params->get('image_width') && !$this->params->get('image_height'))) { $text = preg_replace('/(<img[^>]*)(\\s+width\\s*=\\s*["\']?\\w+["\']?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]*)(\\s+height\\s*=\\s*["\']?\\w+["\\?]?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]*\\s+style\\s*=\\s*".*)(\\s?width\\s*:\\s*\\w+\\s*[;]?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]*\\s+style\\s*=\\s*".*)(\\s?height\\s*:\\s*\\w+\\s*[;]?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace_callback('@(<img[^>]*\\s+)(src\\s*=\\s*["\']*)([^"\']+)(["\']*)([^>]*>)@i', create_function('$img', 'return $img[1]." ".modDisplayNewsHelper::imageResize($img[3],' . $this->params->get('image_width') . ',' . $this->params->get('image_height') . ',"' . $this->params->get('image_scale') . '","' . $this->params->get('image_bg', "#FFFFFF") . '","' . $this->params->get('image_type') . '")." ".$img[5];'), $text); // } } if ($this->params->get('get_image') && $this->params->get('image_align')) { $text = preg_replace('/(<img[^>]*)(\\s+align\\s*=\\s*["\']?\\w+["\']?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]*\\s+style\\s*=\\s*".*)(\\s?float\\s*:\\s*\\w+\\s*[;]?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]*\\s+style\\s*=\\s*".*)(\\s?align\\s*:\\s*\\w+\\s*[;]?)([^>]*>)/i', '$1 $3', $text); switch ($this->params->get('image_align')) { case 2: $align = "left"; break; case 3: $align = "right"; break; case 4: $align = "middle"; break; case 5: $align = "top"; break; case 6: $align = "bottom"; break; case 7: $align = $r % 2 ? "left" : "right"; break; case 8: $align = $r % 2 ? "right" : "left "; break; } if ($this->params->get('image_align') >= 2) { $text = preg_replace('@(<img\\s+[^>]*)(/>)|(<img\\s+[^>]*)(>)@i', '$1$3 align="' . $align . '" $2$4', $text); } } if ($this->params->get('get_image') && $this->params->get('image_margin') != "") { $text = preg_replace('/(<img[^>]*)(\\s+hspace\\s*=\\s*["\']?\\w+["\']?)([^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]* style\\s*=\\s*(["\'])[^\\2>]*)margin[^;\\2>]*[;]([^\\2>]*\\2[^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]* style\\s*=\\s*(["\'])[^\\2>]*)margin[^;\\2>]*[;]([^\\2>]*\\2[^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]* style\\s*=\\s*(["\'])[^\\2>]*)margin-left[^;\\2>]*[;]([^\\2>]*\\2[^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]* style\\s*=\\s*(["\'])[^\\2>]*)margin-top[^;\\2>]*[;]([^\\2>]*\\2[^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]* style\\s*=\\s*(["\'])[^\\2>]*)margin-right[^;\\2>]*[;]([^\\2>]*\\2[^>]*>)/i', '$1 $3', $text); $text = preg_replace('/(<img[^>]* style\\s*=\\s*(["\'])[^\\2>]*)margin-bottom[^;\\2>]*[;]([^\\2>]*\\2[^>]*>)/i', '$1 $3', $text); // $text = preg_replace( '/(<img[^>]*\s+)((style\s*=\s*")([^"]*)(["]))+(.*[^>]*>)/i', '$1 $3 $4 $5 ', $text ); $text = preg_replace('/((<img[^>]*)( style\\s*=\\s*(["\']))([^\\4>]*)\\4([^>]*>))|((<img\\s*)([^>]*>))/i', '$2$8 style=" margin: ' . $this->params->get('image_margin') . '; $5" $6$9', $text); /* $text = preg_replace( '/(<img[^>]*\s+)((style\s*=\s*["])([^"]*)(["]))([^>]*>)/', '$1 style="margin: '.$this->params->get('image_margin').'; $4 " $6', $text ); $text = preg_replace( '/(<img[^>]*\s+)((style\s*=\s*["])([^"]*)(["]))?([^>]*>)/', '$1 style="margin: '.$this->params->get('image_margin').'; $4 " $6', $text ); */ // '$1 AAA="margin:'.$image_margin.'; $4" $6', $text ); // $text = preg_replace( '/(<img\s+[^>]*)(>)/i', '${1} ; ${2}', $text ); } if ($this->params->get('get_image') && $this->params->get("image_class")) { switch ($this->params->get("image_class")) { case 1: // Remove $text = preg_replace('/(<img[^>]*\\s*)(class\\s*=\\s*(["\'])[^"\']*\\3)([^>]*>)/i', '$1 $4', $text); break; case 2: // Replace $text = preg_replace('@((<img[^>]*\\s*)(class\\s*=\\s*(["\'])([^"\']*)\\4)([^>]*>))|((<img\\s*)([^>]*>))@i', '$2$8 class="' . $this->params->get("image_class_name") . '" $6$9', $text); break; case 3: // Add $text = preg_replace('@((<img[^>]*)(class\\s*=\\s*(["\'])([^"\']*)\\4)([^>]*[/]?>))|((<img\\s*)([^>]*>))@i', '$2$8 class="$5' . $this->params->get("image_class_name") . '" $6$9', $text); break; } } if ($this->params->get('image_num')) { global $i; $i = 0; $text = preg_replace_callback('/<img[^>]*>/i', create_function('$img', 'global $i; $i ++; if ($i <= ' . $this->params->get('image_num') . ') return $img[0];'), $text); } if ($this->params->get('get_image') && $this->params->get('image') > 1) { preg_match_all('/(<img[^>]*>)/i', $text, $out); $i = 0; foreach ($out[0] as $val) { if ($this->params->get('link_image')) { $val = preg_replace('#title=(["\'])(.*?)\\1#i', '', $val); $img_out .= modDisplayNewsHelper::create_link($aroute, $val); } else { $img_out .= $val; } $i++; if ($this->params->get('image_num')) { if ($i >= $this->params->get('image_num') - 1) { break; } } } $text = preg_replace('/<img[^>]*>/i', '', $text); } if ($this->params->get('get_image') && $this->params->get('link_image') && !$this->params->get('link_text')) { $text = preg_replace_callback('/(<a href[^>]*><img[^>]*><\\/a[^>]*>)|(<img[^>]*)(title=(["\']).*?\\3)([^>]*>)/i', create_function('$img', 'return $img[1].$img[2].$img[5];'), $text); $text = preg_replace_callback('/(<a href[^>]*><img[^>]*><\\/a[^>]*>)|(<img[^>]*>)/i', create_function('$img', "return \"<a " . $this->target . " href='{$aroute}'>\".\$img[1].\$img[2].\"</a>\";"), $text); } // <iframe width="1280" height="720" src="http://www.youtube.com/embed/1Z7Ei-djYu0" frameborder="0" allowfullscreen></iframe> $after_allvideo = 0; if ($this->params->get('video') != "") { if (preg_match("#{(" . $this->grabTags . ")}#s", $row->text)) { // Simple performance check to determine whether plugin should process further if ($this->params->get('video') == 0) { $text = preg_replace('@{' . "({$this->grabTags})" . '}(.*){/' . "({$this->grabTags})" . '}@iU', '', $text); } if ($this->params->get('video') == 1) { if ($this->params->get('video_num')) { global $i; $i = 0; $text = preg_replace_callback("@({({$this->grabTags})}.*)(\\|.*){0,1}({/({$this->grabTags})})@iU", create_function('$video', 'global $i; $i ++; if ($i <= ' . $this->params->get('video_num') . ') return $video[1].$video[4];'), $text); } else { $text = preg_replace_callback("@({({$this->grabTags})}.*)(\\|.*){0,1}({/({$this->grabTags})})@iU", create_function('$video', 'return $video[1].$video[4];'), $text); } $tmp_row = $row; $tmp_row->text = $text; $this->plgAllvideos->renderAllVideos($tmp_row, $this->jw_allvideos_params); // $this->plgAllvideos->renderAllVideos($tmp_row, $aparams); $text = $tmp_row->text; } if ($this->params->get('video') == 2) { preg_match_all("@({({$this->grabTags})}.*)(\\|.*){0,1}({/({$this->grabTags})})@iU", $text, $out); // $i = 0; foreach ($out[0] as $i => $val) { $video_out .= $out[1][$i] . $out[4][$i]; // $i++; if ($this->params->get('video_num')) { if ($i >= $this->params->get('video_num') - 1) { break; } } } $text = preg_replace('@{' . "({$this->grabTags})" . '}(.*){/' . "({$this->grabTags})" . '}@iU', '', $text); $tmp_row->text = $video_out; $this->plgAllvideos->onContentPrepare('com_content.article', $tmp_row, $this->jw_allvideos_params); $video_out = $tmp_row->text; } if ($video_out != '') { $after_allvideo = 1; } } } if ($this->params->get('youtube') != "") { if ($after_allvideo) { $tmp_text = $video_out; $video_out = ""; } else { $tmp_text = $text; } if ($this->params->get('youtube') == 0) { $video_out = preg_replace('@<iframe[^>]*src="http[s]*://www.youtube.com/[^>]*>@i', '', $tmp_text); } if ($this->params->get('youtube')) { if ($this->params->get('youtube_width')) { $tmp_text = preg_replace('@(<iframe[^>]*) width="[^"]*"[^>]* (src="http[s]*://www.youtube.com/[^>]*>)@i', '$1 $2', $tmp_text); } if ($this->params->get('youtube_height')) { $tmp_text = preg_replace('@(<iframe[^>]*) height="[^"]*"[^>]* (src="http[s]*://www.youtube.com/[^>]*>)@i', '$1 $2', $tmp_text); } $tmp_text = preg_replace('@(<iframe[^>]* src="http[s]*://www.youtube.com/[^"?]*)[?]*([^"?]*"[^>]*>)@i', '$1?$2', $tmp_text); if ($this->params->get('youtube_loop')) { $tmp_text = preg_replace('@(<iframe[^>]* src="http[s]*://www.youtube.com/embed/)([^?]*)([?]*)([^"?]*["][^>]*>)@i', '$1$2$3&playlist=$2&$4', $tmp_text); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'loop', $this->params->get('youtube_loop')); } $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'autohide', $this->params->get('youtube_autohide')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'autoplay', $this->params->get('youtube_autoplay')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'border', $this->params->get('youtube_border')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'cc_load_policy', $this->params->get('cc_load_policy')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'color', $this->params->get('youtube_color')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'color1', $this->params->get('youtube_color1')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'color2', $this->params->get('youtube_color2')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'controls', $this->params->get('youtube_controls')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'disablekb', $this->params->get('youtube_disablekb')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'egm', $this->params->get('youtube_egm')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'fs', $this->params->get('youtube_fs')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'hd', $this->params->get('youtube_hd')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'iv_load_policy', $this->params->get('youtube_iv_load_policy')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'modestbranding', $this->params->get('youtube_modestbranding')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'playlist', $this->params->get('youtube_playlist')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'rel', $this->params->get('youtube_rel')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'showinfo', $this->params->get('youtube_showinfo')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'showsearch', $this->params->get('youtube_showsearch')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'showsearch', 0); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'start', $this->params->get('youtube_start')); $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'theme', $this->params->get('youtube_theme')); if ($this->params->get('youtube_player') == "HTML5") { $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'html5', 1); } if ($this->params->get('youtube_player') == "AS3") { $tmp_text = modDisplayNewsHelper::youtube_param($tmp_text, 'version', 3); } if ($this->params->get('youtube') == 2) { preg_match_all('@<iframe[^>]*src="http[s]*://www.youtube.com/[^>]*>(</iframe>){0,1}@i', $tmp_text, $out); $i = 0; foreach ($out[0] as $val) { $video_out .= $val; $i++; if ($this->params->get('youtube_num')) { if ($i >= $this->params->get('youtube_num') - 1) { break; } } } $tmp_text = preg_replace('@<iframe[^>]*src="http[s]*://www.youtube.com/[^>]*>(</iframe>){0,1}@i', '', $tmp_text); } } if ($after_allvideo) { $video_out = $tmp_text; } else { $text = $tmp_text; } } $text = JFilterOutput::ampReplace($text); if ($this->params->get('filter_text', 0)) { $text = modDisplayNewsHelper::dn_filter($text); } if ($this->params->get('limit_text')) { $this->text_limited = modDisplayNewsHelper::dn_limit($text, $this->params->get('limit_text'), $this->params->get('length_limit_text', 30), $this->params->get('truncate_ending', 1) ? $this->params->get('truncate_ending_sign', '...') : ''); } if ($this->params->get('link_text')) { $text_out .= modDisplayNewsHelper::create_link($aroute, preg_replace('/(<a\\s+[^>]*href\\s*=[^>]*>)|(<\\s*\\/a\\s*>)/i', "", $text), htmlspecialchars(modDisplayNewsHelper::dn_hovertext($this->params->get('text_hover_text'), preg_replace('/<a\\s+[^>]*href\\s*=[^>]*>|<\\s*\\/a\\s*>|<img[^>]*>/i', "", modDisplayNewsHelper::dn_filter($row->text))))); } else { $text_out .= $text; } } return array($text_out, $img_out, $video_out); }