Skip to content

Commit 910e107

Browse files
dev
1 parent 1ea0a7e commit 910e107

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

src/CmsSeoComponent.php

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@
3131
/**
3232
*
3333
* 'seo' => [
34-
'canUrl' => [
35-
'scheme' => 'https',
36-
'host' => 'skeeks-travel.ru',
37-
],
38-
],
34+
* 'canUrl' => [
35+
* 'scheme' => 'https',
36+
* 'host' => 'skeeks-travel.ru',
37+
* ],
38+
* ],
3939
*
4040
* 'seo' => [
41-
'canUrl' => [
42-
'scheme' => CmsSeoComponent::CANURL_DATA_FROM_MAIN_DOMAIN,
43-
'host' => CmsSeoComponent::CANURL_DATA_FROM_MAIN_DOMAIN,
44-
],
45-
],
41+
* 'canUrl' => [
42+
* 'scheme' => CmsSeoComponent::CANURL_DATA_FROM_MAIN_DOMAIN,
43+
* 'host' => CmsSeoComponent::CANURL_DATA_FROM_MAIN_DOMAIN,
44+
* ],
45+
* ],
4646
*
4747
* @property CanUrl $canUrl;
48-
* @property array $utms;
48+
* @property array $utms;
4949
*
5050
* @author Semenov Alexander <[email protected]>
5151
*/
@@ -322,7 +322,7 @@ public function bootstrap($application)
322322
'forcePageParam' => $this->forcePageParam,
323323
]);
324324

325-
325+
326326
if (\Yii::$app->request->queryParams) {
327327
$utms = [];
328328
foreach (\Yii::$app->request->queryParams as $paramName => $paramValue) {
@@ -419,7 +419,7 @@ public function getUtms()
419419
$created_at = ArrayHelper::getValue($utms, 'created_at');
420420

421421
//Если с момента создания утм прошло более 24 часов то
422-
if (time() - $created_at >= 3600*24) {
422+
if (time() - $created_at >= 3600 * 24) {
423423
$utms = [];
424424
}
425425
}
@@ -488,11 +488,7 @@ protected function _initDefaultCanUrl()
488488
public function _addCanurlParams(WidgetEvent $e)
489489
{
490490
//Только для этих действий
491-
if (!in_array(\Yii::$app->controller->uniqueId, [
492-
'cms/tree',
493-
'cms/content-element',
494-
'savedFilters/saved-filters',
495-
])
491+
if (!in_array(\Yii::$app->controller->uniqueId, $this->canUrlEnableDefaultControllers)
496492
) {
497493
return true;
498494
}
@@ -541,13 +537,16 @@ public function _addCanurlParams(WidgetEvent $e)
541537

542538
}
543539

540+
public $canUrlEnableDefaultControllers = [
541+
'cms/tree',
542+
'cms/content-element',
543+
'savedFilters/saved-filters',
544+
];
545+
544546
public function _isTrigerEventCanUrl()
545547
{
546-
if (\Yii::$app->urlManager->enablePrettyUrl && \Yii::$app->controller && in_array(\Yii::$app->controller->uniqueId, [
547-
'cms/tree',
548-
'cms/content-element',
549-
'savedFilters/saved-filters',
550-
])
548+
if (
549+
\Yii::$app->urlManager->enablePrettyUrl && \Yii::$app->controller && in_array(\Yii::$app->controller->uniqueId, $this->canUrlEnableDefaultControllers)
551550
) {
552551
return true;
553552
}

0 commit comments

Comments
 (0)