From 7b0c8d587a96dc41fc8ceb5596838073c8cf2069 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 21 Jun 2017 12:53:42 +0300 Subject: [PATCH] -Show real robots in layout (didn't worked) --- widgets/Seo.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/widgets/Seo.php b/widgets/Seo.php index 21d7b38..a5ff8d6 100755 --- a/widgets/Seo.php +++ b/widgets/Seo.php @@ -26,6 +26,7 @@ class Seo extends Widget public static $optionsList; protected static $check_url; protected static $check_url_bool; + protected static $robots_string = ''; const SEO_TEXT = 'seo_text'; @@ -185,6 +186,7 @@ class Seo extends Widget 'name' => 'robots', 'content' => 'noindex,nofollow' ]); + self::$robots_string = 'noindex,nofollow'; break; } if (strpos(\Yii::$app->request->url, 'per-page=') !== false) { @@ -192,6 +194,7 @@ class Seo extends Widget 'name' => 'robots', 'content' => 'noindex,follow' ]); + self::$robots_string = 'noindex,follow'; break; } @@ -204,6 +207,7 @@ class Seo extends Widget 'name' => 'robots', 'content' => $metaGroup->meta_robots ]); + self::$robots_string = $metaGroup->meta_robots; break; } } @@ -216,14 +220,14 @@ class Seo extends Widget 'name' => 'robots', 'content' => $meta ]); - + self::$robots_string = $meta; } else if(!empty($filter['special'])){ $this->getView()->registerMetaTag([ 'name' => 'robots', 'content' => 'noindex,nofollow' ]); - + self::$robots_string = 'noindex,nofollow'; } else if ( isset($filter['brands']) && count($filter['brands']) > 1 || isset($filter) && $this->checkFilter($filter) @@ -234,6 +238,7 @@ class Seo extends Widget 'name' => 'robots', 'content' => 'noindex,nofollow' ]); + self::$robots_string = 'noindex,nofollow'; } else if ( isset($filter['brands']) && count($filter['brands']) > 1 && isset($filter) && count($filter, COUNT_RECURSIVE) >= 2 @@ -245,18 +250,23 @@ class Seo extends Widget 'name' => 'robots', 'content' => 'noindex,nofollow' ]); + self::$robots_string = 'noindex,nofollow'; + } else if(!empty($this->{Seo::META})){ $this->getView()->registerMetaTag([ 'name' => 'robots', 'content' => $this->{Seo::META} ]); + self::$robots_string = $this->{Seo::META}; + } else { $this->getView()->registerMetaTag([ 'name' => 'robots', 'content' => 'index,follow' ]); + self::$robots_string = 'index,follow'; } @@ -268,6 +278,11 @@ class Seo extends Widget } + public static function getRobotsString() + { + return self::$robots_string; + } + /** * @param $str * @return mixed -- libgit2 0.21.4