Skip to content

Commit b938577

Browse files
Update logs
1 parent e33f63d commit b938577

2 files changed

Lines changed: 67 additions & 60 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
CHANGELOG
22
==============
33

4+
2.1.7
5+
-----------------
6+
* Update logs
7+
48
2.1.6
59
-----------------
610
* Updated

src/CmsSeoComponent.php

Lines changed: 63 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
use yii\web\NotFoundHttpException;
2626
use yii\web\View;
2727
use yii\widgets\ActiveForm;
28-
use yii\widgets\BaseListView;
29-
use yii\widgets\LinkPager;
3028
use yii\widgets\ListView;
3129

3230
/**
@@ -55,7 +53,6 @@ class CmsSeoComponent extends Component implements BootstrapInterface
5553
public $enableKeywordsGenerator = true;
5654

5755

58-
5956
/**
6057
* @var string
6158
*/
@@ -98,11 +95,11 @@ class CmsSeoComponent extends Component implements BootstrapInterface
9895
*/
9996
public $keywordsPriority = [
10097
"title" => 8,
101-
"h1" => 6,
102-
"h2" => 4,
103-
"h3" => 3,
104-
"h5" => 2,
105-
"h6" => 2,
98+
"h1" => 6,
99+
"h2" => 4,
100+
"h3" => 3,
101+
"h5" => 2,
102+
"h6" => 2,
106103
//"b" => 2,
107104
//"strong" => 2,
108105
]; //Учитывать следующие типы разделов
@@ -133,8 +130,6 @@ class CmsSeoComponent extends Component implements BootstrapInterface
133130
public $isRedirectNotFoundHttpException = true;
134131

135132

136-
137-
138133
/**
139134
* Можно задать название и описание компонента
140135
* @return array
@@ -161,28 +156,28 @@ public function attributeLabels()
161156
{
162157
return ArrayHelper::merge(parent::attributeLabels(), [
163158
'enableKeywordsGenerator' => \Yii::t('skeeks/seo', 'Automatic generation of keywords'),
164-
'minKeywordLenth' => \Yii::t('skeeks/seo', 'The minimum length of the keyword'),
165-
'maxKeywordsLength' => \Yii::t('skeeks/seo', 'Length keywords'),
166-
'robotsContent' => 'Robots.txt',
167-
'countersContent' => \Yii::t('skeeks/seo', 'Codes counters'),
168-
'activeTree' => \Yii::t('skeeks/seo', 'Active flag to tree'),
169-
'activeContentElem' => \Yii::t('skeeks/seo', 'Active flag to contents element'),
170-
'contentIds' => \Yii::t('skeeks/cms', 'Elements of content'),
171-
'sitemap_min_date' => \Yii::t('skeeks/seo', 'Минимальная дата обновления ссылки'),
172-
'treeTypeIds' => \Yii::t('skeeks/seo', 'Types of tree'),
159+
'minKeywordLenth' => \Yii::t('skeeks/seo', 'The minimum length of the keyword'),
160+
'maxKeywordsLength' => \Yii::t('skeeks/seo', 'Length keywords'),
161+
'robotsContent' => 'Robots.txt',
162+
'countersContent' => \Yii::t('skeeks/seo', 'Codes counters'),
163+
'activeTree' => \Yii::t('skeeks/seo', 'Active flag to tree'),
164+
'activeContentElem' => \Yii::t('skeeks/seo', 'Active flag to contents element'),
165+
'contentIds' => \Yii::t('skeeks/cms', 'Elements of content'),
166+
'sitemap_min_date' => \Yii::t('skeeks/seo', 'Минимальная дата обновления ссылки'),
167+
'treeTypeIds' => \Yii::t('skeeks/seo', 'Types of tree'),
173168
]);
174169
}
175170

176171
public function attributeHints()
177172
{
178173
return ArrayHelper::merge(parent::attributeHints(), [
179174
'enableKeywordsGenerator' => \Yii::t('skeeks/seo', 'If the page is not specified keywords, they will generate is for her, according to certain rules automatically'),
180-
'minKeywordLenth' => \Yii::t('skeeks/seo', 'The minimum length of the keyword, which is listed by the key (automatic generation)'),
181-
'maxKeywordsLength' => \Yii::t('skeeks/seo', 'The maximum length of the string of keywords (automatic generation)'),
182-
'robotsContent' => \Yii::t('skeeks/seo', 'This value is added to the automatically generated file robots.txt, in the case where it is not physically created on the server'),
183-
'contentIds' => \Yii::t('skeeks/seo', 'If nothing is selected, then all'),
184-
'treeTypeIds' => \Yii::t('skeeks/seo', 'If nothing is selected, then all'),
185-
'sitemap_min_date' => \Yii::t('skeeks/exportShopYandexMarket',
175+
'minKeywordLenth' => \Yii::t('skeeks/seo', 'The minimum length of the keyword, which is listed by the key (automatic generation)'),
176+
'maxKeywordsLength' => \Yii::t('skeeks/seo', 'The maximum length of the string of keywords (automatic generation)'),
177+
'robotsContent' => \Yii::t('skeeks/seo', 'This value is added to the automatically generated file robots.txt, in the case where it is not physically created on the server'),
178+
'contentIds' => \Yii::t('skeeks/seo', 'If nothing is selected, then all'),
179+
'treeTypeIds' => \Yii::t('skeeks/seo', 'If nothing is selected, then all'),
180+
'sitemap_min_date' => \Yii::t('skeeks/exportShopYandexMarket',
186181
'Если будет задан этот параметр, то ни в одной ссылке не будет указано даты обновления меньше этой. Используется для переиндексации всех страниц.'),
187182

188183
]);
@@ -238,7 +233,6 @@ public function init()
238233
}
239234

240235

241-
242236
public function bootstrap($application)
243237
{
244238
if (!$application instanceof \yii\web\Application) {
@@ -265,15 +259,15 @@ public function bootstrap($application)
265259
*/
266260
if ($this->registerLinkTags) {
267261
\Yii::$container->set('yii\widgets\LinkPager', [
268-
'registerLinkTags' => true
262+
'registerLinkTags' => true,
269263
]);
270264
}
271265

272266
/**
273267
* Убирает page=1, делает чистый урл в постричной новигации на первую страницу
274268
*/
275269
\Yii::$container->set('yii\data\Pagination', [
276-
'forcePageParam' => $this->forcePageParam
270+
'forcePageParam' => $this->forcePageParam,
277271
]);
278272
});
279273

@@ -316,7 +310,8 @@ public function bootstrap($application)
316310
});
317311
}
318312

319-
protected function _initDefaultCanUrl() {
313+
protected function _initDefaultCanUrl()
314+
{
320315

321316
/**
322317
* Канурл может быть отключен вовсе
@@ -341,7 +336,7 @@ protected function _initDefaultCanUrl() {
341336

342337

343338
if (\Yii::$app->requestedRoute) {
344-
$requestedUrl = Url::to(ArrayHelper::merge(["/" . \Yii::$app->requestedRoute],
339+
$requestedUrl = Url::to(ArrayHelper::merge(["/".\Yii::$app->requestedRoute],
345340
(array)\Yii::$app->request->queryParams));
346341
$autoPath = ArrayHelper::getValue(parse_url($requestedUrl), 'path');
347342
$this->canUrl->path = $autoPath;
@@ -356,7 +351,7 @@ protected function _initDefaultCanUrl() {
356351

357352
Event::on(ListView::class, Widget::EVENT_AFTER_RUN, [$this, '_addCanurlParams']);
358353
Event::on(GridView::class, Widget::EVENT_AFTER_RUN, [$this, '_addCanurlParams']);
359-
354+
360355
}
361356

362357
public function _addCanurlParams(WidgetEvent $e)
@@ -366,24 +361,27 @@ public function _addCanurlParams(WidgetEvent $e)
366361
'cms/tree',
367362
'cms/content-element',
368363
'savedFilters/saved-filters',
369-
])) {
364+
])
365+
) {
370366
return true;
371367
}
372-
368+
373369
$this->canUrl->ADDimportant_pnames(['ProductFilters']);
374370
$this->canUrl->ADDimportant_pnames(['SearchProductsModel']);
375371
$this->canUrl->ADDimportant_pnames(['SearchRelatedPropertiesModel']);
376-
372+
377373
/**
378374
* @var $sender ListView|GridView
379375
*/
380376
$sender = $e->sender;
381377
$r = new \ReflectionClass($sender);
382-
383-
\Yii::info('_addCanurlParams: ' . $r->getName());
384-
378+
379+
if (YII_DEBUG === true) {
380+
\Yii::info('_addCanurlParams: '.$r->getName());
381+
}
382+
385383
if ($pagination = $sender->dataProvider->getPagination()) {
386-
384+
387385
if ($pagination->pageCount > 1) {
388386
$pageParam = $pagination->pageParam;
389387
$this->canUrl->ADDimportant_params([$pagination->pageSizeParam => null]);
@@ -393,31 +391,33 @@ public function _addCanurlParams(WidgetEvent $e)
393391
if ($currentPage = \Yii::$app->request->get($pageParam)) {
394392
if ($currentPage > $pagination->pageCount && $currentPage != 1) {
395393
$this->canUrl->ADDimportant_params([$pagination->pageParam => $pagination->pageCount]);
396-
} elseif($currentPage != 1) {
394+
} elseif ($currentPage != 1) {
397395
$this->canUrl->ADDimportant_params([$pagination->pageParam => null]);
398396
}
399397
} else {
400-
$this->canUrl->ADDimportant_params([$pagination->pageParam => null]);
398+
$this->canUrl->ADDimportant_params([$pagination->pageParam => null]);
401399
}
402400
}
403-
404-
405-
406-
\Yii::info('_addCanurlParams: totalCount ' . $pagination->totalCount);
407-
\Yii::info('_addCanurlParams: pageParam ' . $pagination->pageParam);
408-
\Yii::info('_addCanurlParams: pageCount ' . $pagination->pageCount);
409-
401+
402+
403+
if (YII_DEBUG === true) {
404+
\Yii::info('_addCanurlParams: totalCount '.$pagination->totalCount);
405+
\Yii::info('_addCanurlParams: pageParam '.$pagination->pageParam);
406+
\Yii::info('_addCanurlParams: pageCount '.$pagination->pageCount);
407+
408+
}
410409
}
411-
410+
412411
}
413412

414413
public function _isTrigerEventCanUrl()
415414
{
416415
if (\Yii::$app->controller && in_array(\Yii::$app->controller->uniqueId, [
417-
'cms/tree',
418-
'cms/content-element',
419-
'savedFilters/saved-filters',
420-
])) {
416+
'cms/tree',
417+
'cms/content-element',
418+
'savedFilters/saved-filters',
419+
])
420+
) {
421421
return true;
422422
}
423423

@@ -430,8 +430,8 @@ protected function _generateBeforeOutputPage(\yii\web\View $view)
430430

431431
if (!isset($view->metaTags['keywords'])) {
432432
$view->registerMetaTag([
433-
"name" => 'keywords',
434-
"content" => $this->_getKeywordsByContent($content)
433+
"name" => 'keywords',
434+
"content" => $this->_getKeywordsByContent($content),
435435
], 'keywords');
436436
}
437437

@@ -459,7 +459,7 @@ public function getCanUrl()
459459

460460
if (is_array($this->_canUrl)) {
461461
$this->_canUrl = ArrayHelper::merge([
462-
'class' => 'skeeks\cms\seo\vendor\CanUrl'
462+
'class' => 'skeeks\cms\seo\vendor\CanUrl',
463463
], $this->_canUrl);
464464
$this->_canUrl = \Yii::createObject($this->_canUrl);
465465
}
@@ -507,13 +507,16 @@ protected function _getKeywordsByContent($content = "")
507507

508508
$count = 0;
509509
foreach ($words as $word) {
510-
if (strlen($result) > $this->maxKeywordsLength) break;
510+
if (strlen($result) > $this->maxKeywordsLength) {
511+
break;
512+
}
511513

512514
$count++;
513515
if ($count > 1) {
514-
$result .= ', ' . StringHelper::strtolower($word);
515-
} else
516+
$result .= ', '.StringHelper::strtolower($word);
517+
} else {
516518
$result .= StringHelper::strtolower($word);
519+
}
517520
}
518521
}
519522
return $result;
@@ -541,13 +544,13 @@ protected function _processPriority($content = "")
541544

542545
if ($contentNew) {
543546
for ($i = 1; $i <= $prioryty; $i++) {
544-
$contentNewResult .= " " . $contentNew;
547+
$contentNewResult .= " ".$contentNew;
545548
}
546549
}
547550
}
548551
}
549552

550-
return $contentNewResult . $content;
553+
return $contentNewResult.$content;
551554
}
552555

553556
}

0 commit comments

Comments
 (0)