if ($smartphone_detected) {
if (!$config['allow_smart_format']) {
$row['full__story'] = strip_tags( $row['full__story'], '<p><br><a>' );
} else {
if ( !$config['allow_smart_images'] ) {
$row['full__story'] = preg_replace( "#<!--TBegin-->(.+?)<!--TEnd-->#is", "", $row['full__story'] );
$row['full__story'] = preg_replace( "#<img(.+?)>#is", "", $row['full__story'] );
}
if ( !$config['allow_smart_video'] ) {
$row['full__story'] = preg_replace( "#<!--dle_video_begin(.+?)<!--dle_video_end-->#is", "", $row['full__story'] );
$row['full__story'] = preg_replace( "#<!--dle_audio_begin(.+?)<!--dle_audio_end-->#is", "", $row['full__story'] );
}
}
}
$row['full__story'] = stripslashes( $row['full__story'] );
if( $user_group[$member_id['user_group']]['allow_hide'] ) $row['full__story'] = str_ireplace( "[hide]", "", str_ireplace( "[/hide]", "", $row['full__story']) );
else $row['full__story'] = preg_replace ( "#\[hide\](.+?)\[/hide\]#ims", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $row['full__story'] );
if (stripos ( $tpl->copy_template, "{image-" ) !== false) {
$images = array();
preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['full__story'], $media);
$data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]);
foreach($data as $url) {
$info = pathinfo($url);
if (isset($info['extension'])) {
if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-plus" ) continue;
$info['extension'] = strtolower($info['extension']);
if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url);
}
}
if ( count($images) ) {
$i=0;
foreach($images as $url) {
$i++;
$tpl->copy_template = str_replace( '{image-'.$i.'}', $url, $tpl->copy_template );
$tpl->copy_template = str_replace( '[image-'.$i.']', "", $tpl->copy_template );
$tpl->copy_template = str_replace( '[/image-'.$i.']', "", $tpl->copy_template );
}
}
$tpl->copy_template = preg_replace( "#\[image-(.+?)\](.+?)\[/image-(.+?)\]#is", "", $tpl->copy_template );
$tpl->copy_template = preg_replace( "#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template );
}
$tpl->set( '{full-story}', $row['full__story'] );
if ( preg_match( "#\\{full-story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches ) ) {
$count= intval($matches[1]);
$row['full__story'] = str_replace( "</p><p>", " ", $row['full__story'] );
$row['full__story'] = strip_tags( $row['full__story'], "<br>" );
$row['full__story'] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $row['full__story'] ) ) ) ));
if( $count AND dle_strlen( $row['full__story'], $config['charset'] ) > $count ) {
$row['full__story'] = dle_substr( $row['full__story'], 0, $count, $config['charset'] );
if( ($temp_dmax = dle_strrpos( $row['full__story'], ' ', $config['charset'] )) ) $row['full__story'] = dle_substr( $row['full__story'], 0, $temp_dmax, $config['charset'] );
}
$tpl->set( $matches[0], $row['full__story']);
}