3133 - Отключение sitemap.xml страниц на анг.

parent 459e70dd
<?php <?php
namespace common\modules\blog\components; namespace common\modules\blog\components;
use Yii; use Yii;
...@@ -25,10 +26,8 @@ class TagBehavior extends Behavior ...@@ -25,10 +26,8 @@ class TagBehavior extends Behavior
private function clearPostTags() private function clearPostTags()
{ {
if($this->owner->postTagAssigns) if ($this->owner->postTagAssigns) {
{ foreach ($this->owner->postTagAssigns as $tag) {
foreach ($this->owner->postTagAssigns as $tag)
{
$tag->delete(); $tag->delete();
} }
} }
...@@ -36,15 +35,13 @@ class TagBehavior extends Behavior ...@@ -36,15 +35,13 @@ class TagBehavior extends Behavior
private function insertPostTags() private function insertPostTags()
{ {
if($this->tags) $tags = explode(',', $this->tags);
{ if (is_array($tags)) {
foreach ($this->tags as $tag) foreach ($tags as $tag) {
{
$tg = PostTag::find()->where(['name' => $tag])->one(); $tg = PostTag::find()->where(['name' => $tag])->one();
if(!$tg) if (!$tg) {
{
// Убрана возможность создавать новые теги // Убрана возможность создавать новые теги
return false; return false;
// $tg = new PostTag; // $tg = new PostTag;
// $tg->name = $tag; // $tg->name = $tag;
// $tg->save(); // $tg->save();
...@@ -60,7 +57,7 @@ class TagBehavior extends Behavior ...@@ -60,7 +57,7 @@ class TagBehavior extends Behavior
public function eventFind($event) public function eventFind($event)
{ {
$this->tags = array_keys(ArrayHelper::map($this->owner->postTags, 'name', 'id')); $this->tags = implode(',', array_keys(ArrayHelper::map($this->owner->postTags, 'name', 'id')));
} }
public function Save($event) public function Save($event)
......
...@@ -135,6 +135,10 @@ class PostController extends BaseController ...@@ -135,6 +135,10 @@ class PostController extends BaseController
public function actionView($url) public function actionView($url)
{ {
$model = $this->findModelByUrl($url); $model = $this->findModelByUrl($url);
if(!$model->lang || $model->lang->hidden) {
throw new NotFoundHttpException('Page not found!');
}
$this->meta_title = $model->metaTag->title; $this->meta_title = $model->metaTag->title;
$this->meta_description = $model->metaTag->description; $this->meta_description = $model->metaTag->description;
......
...@@ -24,7 +24,9 @@ class PageController extends \common\components\BaseController ...@@ -24,7 +24,9 @@ class PageController extends \common\components\BaseController
$model = $this->findDocumentModel($document); $model = $this->findDocumentModel($document);
$modelContent = $model->getLang()->one(); $modelContent = $model->getLang()->one();
if(!$model->lang || $model->lang->hidden) {
throw new NotFoundHttpException('Page not found!');
}
$documentation = $model->lang->html; $documentation = $model->lang->html;
$this->meta_title = $model->metaTag->title; $this->meta_title = $model->metaTag->title;
$this->meta_description = $model->metaTag->description; $this->meta_description = $model->metaTag->description;
......
...@@ -110,6 +110,10 @@ class FaqController extends BaseController ...@@ -110,6 +110,10 @@ class FaqController extends BaseController
{ {
$model = $this->findModelByUrl($url); $model = $this->findModelByUrl($url);
if(!$model->lang || $model->lang->hidden) {
throw new NotFoundHttpException('Page not found!');
}
$this->meta_title = $model->metaTag ? $model->metaTag->title : ' '; $this->meta_title = $model->metaTag ? $model->metaTag->title : ' ';
$this->meta_description = $model->metaTag ? $model->metaTag->description : ' '; $this->meta_description = $model->metaTag ? $model->metaTag->description : ' ';
$this->meta_keywords = $model->metaTag ? $model->metaTag->keywords : ' '; $this->meta_keywords = $model->metaTag ? $model->metaTag->keywords : ' ';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment