image; $retina = $preview->getUrl(Image::SIZE_HD,"jpg"); $normal = $preview->getUrl(Image::SIZE_1040x586,"webp"); $bad = $preview->getUrl(Image::SIZE_680x383,'jpg'); //$bad = $bad?$bad:'/images/default.jpg'; if( $normal === false ){ $normal = $bad; } if( $retina === false ){ $retina = $normal; } $normal .= "?v=".$model->rev; $retina .= "?v=".$model->rev; $bad .= "?v=".$model->rev; $picture = $normal; if( $model->show_author == 'Y' ) { $author = Authors::getAuthor( $model->author ); $authorName = $author->name; }else{ $authorName = 'ИА Амител'; } $title = Html::encode( ( trim($model->meta_title) == '' )?$model->title:$model->meta_title ); $this->title = $title; $this->registerLinkTag([ 'rel' => 'canonical', 'href' => $model->getUrl(true)], 'canonical'); $lid = Html::encode( ($model->lid && trim($model->lid) <> '')?$model->lid:mb_substr( trim($model->text) ,0,150)."..." ); //$ampProducer = new AmpProducer(['model'=>$model]); $converter = new Converter([ 'image_base_url' => 'https://www.amic.ru', 'image_timeout' => 5 ]); //Чистка $s = preg_replace( '/]+)>/i', '

', $model->text ); $sa = explode( '+++', $s ); $s = $sa[0]; $pattern = array( '/]*>[^>]*>/i', '/<\/?font[^>]*>/i', '/sp_eventWasSet="on"/i' ); $s = preg_replace( $pattern, '', $s ); $s = preg_replace( '/]+)>/i', '

', $s ); $s = preg_replace( '/<\/lj>/i', '

', $s ); $s = preg_replace( '/]*)>/i', '

', $s ); $s = preg_replace( '/<\/asid>/i', '

', $s ); $s = preg_replace( '/]*)>/i', '
', $s ); $s = preg_replace( '/]*)>/i', '', $s ); $s = preg_replace( '/<\/em>/i', '', $s ); $s = preg_replace( '/]+)>/i', '

', $s ); $s = preg_replace( '/<\/hc>/i', '

', $s ); $s = preg_replace( '/]+)>/i', '', $s ); $s = preg_replace( '/<\/col>/i', '', $s ); $s = preg_replace( '/]+)>/i', '', $s ); $s = preg_replace( '/<\/st1>/i', '', $s ); $s = preg_replace( '/]+)>/i', '

', $s ); $s = preg_replace( '/<\/form>/i', '

', $s ); $s = preg_replace( '//i', '

', $s ); $s = preg_replace( '/<\/noindex>/i', '

', $s ); $s = preg_replace( '//i', '', $s ); $s = preg_replace( '/<\/pl>/i', '', $s ); $s = preg_replace( '//i', '

', $s ); $s = preg_replace( '/<\/index>/i', '

', $s ); $s = preg_replace( '//i', '

', $s ); $s = preg_replace( '/<\/hypernews>/i', '

', $s ); $s = preg_replace( '//i', '

', $s ); $s = preg_replace( '/<\/content>/i', '

', $s ); $s = preg_replace( '/]+)>/i', '', $s ); $s = preg_replace( '/<\/tspan>/i', '', $s ); $s = preg_replace( '/]+)>/i', '

', $s ); $s = preg_replace( '/<\/text>/i', '

', $s ); $s = preg_replace( '/\]*)\>/iux', 'span', $s ); $s = preg_replace( '/metricconverter/iu', 'span', $s ); $s = preg_replace( '/]+)>/ix', '', $s ); $s = preg_replace( '/<\/pre>/i', '', $s ); $s = preg_replace( '/]*)>/ix', '', $s ); $s = preg_replace( '/<\/tmp>/i', '', $s ); $s = preg_replace( '/]*)>/ix', '', $s ); $s = preg_replace( '/<\/nowiki>/i', '', $s ); $s = preg_replace( '/]+)>/ix', ' ', $s ); $s = preg_replace( '/<\/foreach>/i', ' ', $s ); $s = preg_replace( '/]+)>/ix', '', $s ); $s = preg_replace( '/<\/link>/i', '', $s ); $s = str_replace( '', '/h3> ', $s ); $s = str_replace( 'xmlns:fn', 'uri ', $s ); $s = str_replace( 'publib/gimage.php?image=/', '', $s ); // $converter->loadDefaultConverters(); $converter->addConverter(new AMPDiv()); $converter->addConverter(new AMPSpan()); $converter->addConverter(new AMPAhref()); $converter->addConverter(new AMPP()); $content = $converter->convert($s); $content = str_replace( 'src="/', 'src="https://www.amic.ru/', $content ); //?? $content = str_replace( 'http://', 'https://', $content ); $content = str_replace('
 
','', $content); $amp_scripts = $converter->getScripts(); $yurl = $model->getYoutubeEmbedLink(); $shortUrlRegex = '/youtu.be\/([a-zA-Z0-9_-]+)\??/i'; $longUrlRegex = '/youtube.com\/((?:embed)|(?:watch))((?:\?v\=)|(?:\/))([a-zA-Z0-9_-]+)/i'; $youtube_key = false; if (preg_match($longUrlRegex, $yurl, $matches)) { $youtube_key = $matches[count($matches) - 1]; } if (preg_match($shortUrlRegex, $yurl, $matches)) { $youtube_key = $matches[count($matches) - 1]; } if( $youtube_key ){ $amp_scripts[] =''; } $re = '/##_gallery-(\d+)##/mU'; if( preg_match($re, $content) ){ $content = processGalleriesInjects($content, $model); $amp_scripts[] =''; } $this->context->scripts = ''; foreach( array_unique($amp_scripts) as $p_scripts ){ $this->context->scripts .= $p_scripts."\n"; } $text = trim($content); $text = str_replace(["\n","\r"," "],'',$text); $text = str_replace([" "],' ',$text); $text = addslashes( strip_tags( $text ) ); ?>

title ?>

photo_include == 'Y') : ?>
photo_title; ?>
embed_url)) : ?>
lid; ?>
Читайте полную версию на сайте
inscription == 2)?'':''?> inscription == 1)?'
Имеются противопоказания, необходима консультация специалиста':''?> inscription == 3)?'':''?>
render('@app/views/_etc/banners/amp1')?>
ArrayHelper::getValue($matches,1)]); if($gallery instanceof \app\models\front\Gallery) { return \Yii::$app->view->render("/news/view/amp-gallery",["gallery"=>$gallery]); } else { return ""; } },$body); return $res; }