@@ -104,7 +104,7 @@ |
||
| 104 | 104 | $e->sender->formModels['dm'] = $dm; |
| 105 | 105 | }, |
| 106 | 106 | |
| 107 | - 'on beforeSave' => function (Event $e) { |
|
| 107 | + 'on beforeSave' => function(Event $e) { |
|
| 108 | 108 | /** |
| 109 | 109 | * @var $action BackendModelUpdateAction; |
| 110 | 110 | * @var $model CmsUser; |
@@ -315,12 +315,12 @@ |
||
| 315 | 315 | |
| 316 | 316 | protected function _run() |
| 317 | 317 | { |
| 318 | - $key = $this->getCacheKey().'run'; |
|
| 318 | + $key = $this->getCacheKey() . 'run'; |
|
| 319 | 319 | |
| 320 | 320 | $dependency = new TagDependency([ |
| 321 | 321 | 'tags' => |
| 322 | 322 | [ |
| 323 | - $this->className().(string)$this->namespace, |
|
| 323 | + $this->className() . (string)$this->namespace, |
|
| 324 | 324 | (new Tree())->getTableCacheTag(), |
| 325 | 325 | ], |
| 326 | 326 | ]); |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | $this->initDataProvider(); |
| 122 | 122 | |
| 123 | 123 | if ($this->createdBy) { |
| 124 | - $this->dataProvider->query->andWhere([$className::tableName().'.created_by' => $this->createdBy]); |
|
| 124 | + $this->dataProvider->query->andWhere([$className::tableName() . '.created_by' => $this->createdBy]); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if ($this->active) { |
| 128 | - $this->dataProvider->query->andWhere([$className::tableName().'.active' => $this->active]); |
|
| 128 | + $this->dataProvider->query->andWhere([$className::tableName() . '.active' => $this->active]); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if ($this->content_ids) { |
| 132 | - $this->dataProvider->query->andWhere([$className::tableName().'.content_id' => $this->content_ids]); |
|
| 132 | + $this->dataProvider->query->andWhere([$className::tableName() . '.content_id' => $this->content_ids]); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ($this->limit) { |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | $query->andWhere( |
| 179 | 179 | [ |
| 180 | 180 | 'or', |
| 181 | - [$className::tableName().'.tree_id' => $treeIds], |
|
| 182 | - [CmsContentElementTree::tableName().'.tree_id' => $treeIds], |
|
| 181 | + [$className::tableName() . '.tree_id' => $treeIds], |
|
| 182 | + [CmsContentElementTree::tableName() . '.tree_id' => $treeIds], |
|
| 183 | 183 | ] |
| 184 | 184 | ); |
| 185 | 185 | } else { |
| 186 | - $query->andWhere([$className::tableName().'.tree_id' => $treeIds]); |
|
| 186 | + $query->andWhere([$className::tableName() . '.tree_id' => $treeIds]); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | } |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if ($this->enabledActiveTime == Cms::BOOL_Y) { |
| 195 | 195 | $this->dataProvider->query->andWhere( |
| 196 | - ["<=", $className::tableName().'.published_at', \Yii::$app->formatter->asTimestamp(time())] |
|
| 196 | + ["<=", $className::tableName() . '.published_at', \Yii::$app->formatter->asTimestamp(time())] |
|
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | 199 | $this->dataProvider->query->andWhere( |
| 200 | 200 | [ |
| 201 | 201 | 'or', |
| 202 | - [">=", $className::tableName().'.published_to', \Yii::$app->formatter->asTimestamp(time())], |
|
| 203 | - [CmsContentElement::tableName().'.published_to' => null], |
|
| 202 | + [">=", $className::tableName() . '.published_to', \Yii::$app->formatter->asTimestamp(time())], |
|
| 203 | + [CmsContentElement::tableName() . '.published_to' => null], |
|
| 204 | 204 | ] |
| 205 | 205 | ); |
| 206 | 206 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $this->dataProvider->query->with($this->with); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $this->dataProvider->query->groupBy([$className::tableName().'.id']); |
|
| 215 | + $this->dataProvider->query->groupBy([$className::tableName() . '.id']); |
|
| 216 | 216 | |
| 217 | 217 | if ($this->activeQueryCallback && is_callable($this->activeQueryCallback)) { |
| 218 | 218 | $callback = $this->activeQueryCallback; |
@@ -516,12 +516,12 @@ discard block |
||
| 516 | 516 | } |
| 517 | 517 | protected function _run() |
| 518 | 518 | { |
| 519 | - $cacheKey = $this->getCacheKey().'run'; |
|
| 519 | + $cacheKey = $this->getCacheKey() . 'run'; |
|
| 520 | 520 | |
| 521 | 521 | $dependency = new TagDependency([ |
| 522 | 522 | 'tags' => |
| 523 | 523 | [ |
| 524 | - $this->className().(string)$this->namespace, |
|
| 524 | + $this->className() . (string)$this->namespace, |
|
| 525 | 525 | (new CmsContentElement())->getTableCacheTag(), |
| 526 | 526 | ], |
| 527 | 527 | ]); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | public function renderConfigForm(ActiveForm $form) |
| 143 | 143 | { |
| 144 | - echo \Yii::$app->view->renderFile(__DIR__.'/cms/_form.php', [ |
|
| 144 | + echo \Yii::$app->view->renderFile(__DIR__ . '/cms/_form.php', [ |
|
| 145 | 145 | 'form' => $form, |
| 146 | 146 | 'model' => $this, |
| 147 | 147 | ], $this); |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | $this->noImageUrl = CmsAsset::getAssetUrl('img/image-not-found.jpg'); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function (Event $e) { |
|
| 241 | + \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function(Event $e) { |
|
| 242 | 242 | if (!\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { |
| 243 | 243 | \Yii::$app->response->getHeaders()->setDefault('X-Powered-CMS', |
| 244 | - $this->descriptor->name." {$this->descriptor->homepage}"); |
|
| 244 | + $this->descriptor->name . " {$this->descriptor->homepage}"); |
|
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * @var $view View |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if (!isset($view->metaTags[self::$_huck])) { |
| 251 | 251 | $view->registerMetaTag([ |
| 252 | 252 | "name" => base64_decode(self::$_huck), |
| 253 | - "content" => $this->descriptor->name." — {$this->descriptor->homepage}", |
|
| 253 | + "content" => $this->descriptor->name . " — {$this->descriptor->homepage}", |
|
| 254 | 254 | ], self::$_huck); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | }); |
| 265 | 265 | |
| 266 | - \Yii::$app->user->on(\yii\web\User::EVENT_AFTER_LOGIN, function (UserEvent $e) { |
|
| 266 | + \Yii::$app->user->on(\yii\web\User::EVENT_AFTER_LOGIN, function(UserEvent $e) { |
|
| 267 | 267 | $e->identity->logged_at = \Yii::$app->formatter->asTimestamp(time()); |
| 268 | 268 | $e->identity->save(false); |
| 269 | 269 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | 'fields' => [ |
| 372 | 372 | 'access' => [ |
| 373 | 373 | 'class' => HtmlBlock::class, |
| 374 | - 'content' => function (HtmlBlock $htmlBlock) { |
|
| 374 | + 'content' => function(HtmlBlock $htmlBlock) { |
|
| 375 | 375 | $content = \yii\bootstrap\Alert::widget([ |
| 376 | 376 | 'options' => [ |
| 377 | 377 | 'class' => 'alert-warning', |
@@ -23,10 +23,11 @@ discard block |
||
| 23 | 23 | </button> |
| 24 | 24 | <small><?= \Yii::t('skeeks/cms', |
| 25 | 25 | 'The settings for this component are stored in the database. This option will erase them from the database, but the component, restore the default values. As they have in the code the developer.') ?></small> |
| 26 | - <?php else |
|
| 26 | + <?php else { |
|
| 27 | 27 | : ?> |
| 28 | 28 | <small><?= \Yii::t('skeeks/cms', 'These settings not yet saved in the database') ?></small> |
| 29 | 29 | <?php endif; |
| 30 | +} |
|
| 30 | 31 | ?> |
| 31 | 32 | </div> |
| 32 | 33 | |
@@ -45,9 +46,12 @@ discard block |
||
| 45 | 46 | ]))->render(); ?> |
| 46 | 47 | <? elseif ($formContent = $component->renderConfigForm($form)) : ?> |
| 47 | 48 | <?= $formContent; ?> |
| 48 | -<? else : ?> |
|
| 49 | +<? else { |
|
| 50 | + : ?> |
|
| 49 | 51 | Нет редактируемых настроек для данного компонента |
| 50 | -<? endif; ?> |
|
| 52 | +<? endif; |
|
| 53 | +} |
|
| 54 | +?> |
|
| 51 | 55 | |
| 52 | 56 | <?= $form->buttonsStandart($component); ?> |
| 53 | 57 | <?= $form->errorSummary(\yii\helpers\ArrayHelper::merge( |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | \Yii::$app->cmsToolbar->initEnabled(); |
| 84 | 84 | if (\Yii::$app->cmsToolbar->editWidgets == Cms::BOOL_Y && \Yii::$app->cmsToolbar->enabled) { |
| 85 | - $id = 'sx-infoblock-'.$this->id; |
|
| 85 | + $id = 'sx-infoblock-' . $this->id; |
|
| 86 | 86 | |
| 87 | 87 | return Html::beginTag('div', |
| 88 | 88 | [ |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | public function init() |
| 128 | 128 | { |
| 129 | - $this->_token = \Yii::t('skeeks/cms', 'Widget').': '.$this->id; |
|
| 130 | - \Yii::beginProfile("Cms Widget: ".$this->_token); |
|
| 129 | + $this->_token = \Yii::t('skeeks/cms', 'Widget') . ': ' . $this->id; |
|
| 130 | + \Yii::beginProfile("Cms Widget: " . $this->_token); |
|
| 131 | 131 | parent::init(); |
| 132 | - \Yii::endProfile("Cms Widget: ".$this->_token); |
|
| 132 | + \Yii::endProfile("Cms Widget: " . $this->_token); |
|
| 133 | 133 | } |
| 134 | 134 | /** |
| 135 | 135 | * @return string |
@@ -138,17 +138,17 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | if (YII_ENV == 'prod') { |
| 140 | 140 | try { |
| 141 | - \Yii::beginProfile("Run: ".$this->_token); |
|
| 141 | + \Yii::beginProfile("Run: " . $this->_token); |
|
| 142 | 142 | $content = $this->_run(); |
| 143 | - \Yii::endProfile("Run: ".$this->_token); |
|
| 143 | + \Yii::endProfile("Run: " . $this->_token); |
|
| 144 | 144 | } catch (\Exception $e) { |
| 145 | 145 | $content = \Yii::t('skeeks/cms', 'Error widget {class}', |
| 146 | - ['class' => $this->className()])." (".$this->descriptor->name."): ".$e->getMessage(); |
|
| 146 | + ['class' => $this->className()]) . " (" . $this->descriptor->name . "): " . $e->getMessage(); |
|
| 147 | 147 | } |
| 148 | 148 | } else { |
| 149 | - \Yii::beginProfile("Run: ".$this->_token); |
|
| 149 | + \Yii::beginProfile("Run: " . $this->_token); |
|
| 150 | 150 | $content = $this->_run(); |
| 151 | - \Yii::endProfile("Run: ".$this->_token); |
|
| 151 | + \Yii::endProfile("Run: " . $this->_token); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if ($this->_isBegin) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $result = ""; |
| 178 | 178 | |
| 179 | 179 | if (\Yii::$app->cmsToolbar->editWidgets == Cms::BOOL_Y && \Yii::$app->cmsToolbar->enabled) { |
| 180 | - $id = 'sx-infoblock-'.$this->id; |
|
| 180 | + $id = 'sx-infoblock-' . $this->id; |
|
| 181 | 181 | |
| 182 | 182 | $this->view->registerJs(<<<JS |
| 183 | 183 | new sx.classes.toolbar.EditViewBlock({'id' : '{$id}'}); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $this->_callAttributes = $this->attributes; |
| 188 | 188 | |
| 189 | - \Yii::beginProfile("Init: ".static::class); |
|
| 189 | + \Yii::beginProfile("Init: " . static::class); |
|
| 190 | 190 | |
| 191 | 191 | if (!\Yii::$app instanceof Application) { |
| 192 | 192 | if ($this->cmsSite === null && isset(\Yii::$app->currentSite) && \Yii::$app->currentSite->site) { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $this->trigger(self::EVENT_INIT); |
| 204 | 204 | |
| 205 | - \Yii::endProfile("Init: ".static::class); |
|
| 205 | + \Yii::endProfile("Init: " . static::class); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $this->_oldAttributes = $this->toArray($this->safeAttributes()); |
| 218 | 218 | } catch (\Exception $e) { |
| 219 | 219 | \Yii::error(\Yii::t('skeeks/cms', '{cms} component error load defaul settings', |
| 220 | - ['cms' => 'Cms']).': '.$e->getMessage()); |
|
| 220 | + ['cms' => 'Cms']) . ': ' . $e->getMessage()); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | return $this; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | if ($models = $this->getConfigFormModels()) { |
| 529 | 529 | foreach ($models as $key => $model) { |
| 530 | - $value[$key."Array"] = $model->attributes; |
|
| 530 | + $value[$key . "Array"] = $model->attributes; |
|
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | */ |
| 711 | 711 | public function getCallableId() |
| 712 | 712 | { |
| 713 | - return $this->settingsId.'-callable'; |
|
| 713 | + return $this->settingsId . '-callable'; |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | public function getSettingsId($autoGenerate = true) |
| 722 | 722 | { |
| 723 | 723 | if ($autoGenerate && $this->_settingsId === null) { |
| 724 | - $this->_settingsId = static::$autoSettingsIdPrefix.static::$counterSettings++; |
|
| 724 | + $this->_settingsId = static::$autoSettingsIdPrefix . static::$counterSettings++; |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | return $this->_settingsId; |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | if (isset($this->{$name})) { |
| 806 | 806 | $this->{$name} = $value; |
| 807 | 807 | } else { |
| 808 | - throw new InvalidParamException(get_class($this).' has no attribute named "'.$name.'".'); |
|
| 808 | + throw new InvalidParamException(get_class($this) . ' has no attribute named "' . $name . '".'); |
|
| 809 | 809 | } |
| 810 | 810 | } |
| 811 | 811 | |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | if (isset($this->_oldAttributes[$name]) || $this->hasAttribute($name)) { |
| 856 | 856 | $this->_oldAttributes[$name] = $value; |
| 857 | 857 | } else { |
| 858 | - throw new InvalidParamException(get_class($this).' has no attribute named "'.$name.'".'); |
|
| 858 | + throw new InvalidParamException(get_class($this) . ' has no attribute named "' . $name . '".'); |
|
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | 861 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | 'visibleColumns' => [ |
| 83 | 83 | 'class' => SelectField::class, |
| 84 | 84 | 'multiple' => true, |
| 85 | - 'on beforeRender' => function ($e) { |
|
| 85 | + 'on beforeRender' => function($e) { |
|
| 86 | 86 | /** |
| 87 | 87 | * @var $gridView GridView |
| 88 | 88 | */ |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ($result && in_array($label, array_values($result))) { |
| 162 | - $result[$code] = $label." ({$code})"; |
|
| 162 | + $result[$code] = $label . " ({$code})"; |
|
| 163 | 163 | } else { |
| 164 | 164 | $result[$code] = $label; |
| 165 | 165 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $this->_autoColumns[(string)$name] = [ |
| 250 | 250 | 'attribute' => $name, |
| 251 | 251 | 'format' => 'raw', |
| 252 | - 'value' => function ($model, $key, $index) use ($name) { |
|
| 252 | + 'value' => function($model, $key, $index) use ($name) { |
|
| 253 | 253 | if (is_array($model->{$name})) { |
| 254 | 254 | return implode(",", $model->{$name}); |
| 255 | 255 | } else { |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | public function init() |
| 95 | 95 | { |
| 96 | 96 | $defaultFiltersModel = [ |
| 97 | - 'class' => DynamicConfigModel::class, |
|
| 97 | + 'class' => DynamicConfigModel::class, |
|
| 98 | 98 | ]; |
| 99 | 99 | |
| 100 | 100 | $this->filtersModel = ArrayHelper::merge($defaultFiltersModel, (array) $this->filtersModel); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'visibleFilters' => [ |
| 61 | 61 | 'class' => SelectField::class, |
| 62 | 62 | 'multiple' => true, |
| 63 | - 'on beforeRender' => function ($e) { |
|
| 63 | + 'on beforeRender' => function($e) { |
|
| 64 | 64 | /** |
| 65 | 65 | * @var $gridView FiltersWidget |
| 66 | 66 | */ |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | 'class' => DynamicConfigModel::class, |
| 98 | 98 | ]; |
| 99 | 99 | |
| 100 | - $this->filtersModel = ArrayHelper::merge($defaultFiltersModel, (array) $this->filtersModel); |
|
| 100 | + $this->filtersModel = ArrayHelper::merge($defaultFiltersModel, (array)$this->filtersModel); |
|
| 101 | 101 | $this->filtersModel = \Yii::createObject($this->filtersModel); |
| 102 | 102 | $this->filtersModel->load(\Yii::$app->request->get()); |
| 103 | 103 | |