css as $item ){ echo ''; } foreach( $obj->js as $item ){ echo ''; } echo ''; ?> image; $retina = $preview->getUrl(Image::SIZE_1040x586,"jpg"); $normal = $preview->getUrl(Image::SIZE_841x473,"webp"); $bad = $preview->getUrl(Image::SIZE_680x383,'jpg'); $bad = $bad?$bad:'/images/default.jpg'; if( $retina === false || $normal === false ){ $normal = $bad; $retina = $bad; } $normal .= "?v=".$model->rev; $retina .= "?v=".$model->rev; $bad .= "?v=".$model->rev; /* После этой даты не выводить фото до подтверждения юриста if( isset( $model->dt_pub ) && strtotime( $model->dt_pub ) < strtotime('2015-01-01 00:00:00') ){ $bad = '/images/default.jpg'; $normal = $bad; $retina = $bad; }; */ $txt_date = date( "[Y-m-d] ", strtotime( $model->dt_pub ) ); $body_text = strip_tags( preg_replace('/<(script|style)\b[^>]*>(.*?)<\/(script|style)>/is', "", $html) ); Yii::$app->og->title =($model->meta_title)?$model->meta_title:$model->title; Yii::$app->og->description = ($model->lid && trim($model->lid) <> '')?str_replace( '"', """, strip_tags($model->lid) ):$txt_date.trim(str_replace( '"',"'",substr(strip_tags( $body_text ),0,150)))."..."; if( $model->active == 'N' || $model->dt_pub > date("Y-m-d H:i:s") || $model->noindex == 'Y' ){ Yii::$app->og->noindex = 'Y'; }else{ \Yii::$app->og->canonical = $model->getUrl(true); \Yii::$app->og->amp = Url::base('https').'/amp/news/'.$model->id; \Yii::$app->og->og_url = $model->getUrl(true); \Yii::$app->og->og_image = $model->image->url; \Yii::$app->og->og_type = "article"; \Yii::$app->og->og_title = htmlspecialchars(($model->meta_title)?strip_tags(str_replace( '"',""",$model->meta_title)):strip_tags(str_replace( '"',""",$model->title))); \Yii::$app->og->og_description = ($model->lid && trim($model->lid) <> '')?str_replace( '"',""",strip_tags($model->lid)):$txt_date.trim(str_replace( '"',""",substr(strip_tags( $body_text ),0,150)))."..."; \Yii::$app->og->dtpub = date( "r", strtotime( $model->dt_pub ) ); } jsonLD::addAmicORG(); jsonLD::news( $model->title, preg_replace('/\s+/', ' ', str_replace( ["\n","\r"],' ',Yii::$app->og->description)), $model->image->url, $model->dt_pub, $model->getUrl(), $model->uid, $body_text, $model->meta_title); jsonLD::addfaq($body_text, $model->title); $story = new \app\models\base\Story(); $this->params['breadcrumbs'] = [ [ "text"=>"НОВОСТИ", "url"=>"/news" ] ]; $this->params['context'] = "post-view"; //$topic = ArrayHelper::getValue($model->topics,0); $topic = Yii::$app->cache->getOrSet('topic-news-'.$model->id, function () use($model){ return $model->getTopics()->andWhere(['show'=>"Y","active"=>1])->orderBy('order asc')->one(); }, News::$keysCache['topic-news-##']); if($topic instanceof \app\models\base\NewsTopic){ $this->params['breadcrumbs'][] = [ "text"=>$topic->title, "url"=>"/news/".mb_strtolower($topic->url) ]; } $i = 1; foreach($this->params['breadcrumbs'] as $el){ jsonLD::addBreadcrumb($i, $el['url'], $el['text']); $i++; } if( $model->show_author == 'Y' ) { $author = Authors::getAuthor( $model->author ); $authorName = $author->name; \Yii::$app->og->author =$authorName; jsonLD::author( $authorName ); }else{ $authorName = 'ИА Амител'; jsonLD::author( $authorName, false ); } $GLOBALS['type_long'] = ($model->type == 6); //лонгрид echo $html;