@@ -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', |
@@ -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 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $extension = Imaging::getExtension($newFileSrc); |
44 | 44 | |
45 | 45 | if (!$extension) { |
46 | - throw new \yii\base\Exception("Extension not found: ".$newFileSrc); |
|
46 | + throw new \yii\base\Exception("Extension not found: " . $newFileSrc); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -53,31 +53,31 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | $newFile = File::object($newFileSrc); |
56 | - $strposFilter = strpos($newFileSrc, "/".Imaging::THUMBNAIL_PREFIX); |
|
56 | + $strposFilter = strpos($newFileSrc, "/" . Imaging::THUMBNAIL_PREFIX); |
|
57 | 57 | if (!$strposFilter) { |
58 | - throw new NotFoundHttpException("This is not a filter thumbnail: ".$newFileSrc); |
|
58 | + throw new NotFoundHttpException("This is not a filter thumbnail: " . $newFileSrc); |
|
59 | 59 | } |
60 | 60 | |
61 | - $originalFileSrc = substr($newFileSrc, 0, $strposFilter).".".$newFile->getExtension(); |
|
61 | + $originalFileSrc = substr($newFileSrc, 0, $strposFilter) . "." . $newFile->getExtension(); |
|
62 | 62 | |
63 | 63 | //TODO: hardcode delete it in the future |
64 | 64 | $webRoot = \Yii::getAlias('@webroot'); |
65 | 65 | |
66 | - $originalFileRoot = $webRoot.DIRECTORY_SEPARATOR.$originalFileSrc; |
|
67 | - $newFileRoot = $webRoot.DIRECTORY_SEPARATOR.$newFileSrc; |
|
68 | - $newFileRootDefault = $webRoot.DIRECTORY_SEPARATOR.str_replace($newFile->getBaseName(), |
|
69 | - Imaging::DEFAULT_THUMBNAIL_FILENAME.".".$extension, $newFileSrc); |
|
66 | + $originalFileRoot = $webRoot . DIRECTORY_SEPARATOR . $originalFileSrc; |
|
67 | + $newFileRoot = $webRoot . DIRECTORY_SEPARATOR . $newFileSrc; |
|
68 | + $newFileRootDefault = $webRoot . DIRECTORY_SEPARATOR . str_replace($newFile->getBaseName(), |
|
69 | + Imaging::DEFAULT_THUMBNAIL_FILENAME . "." . $extension, $newFileSrc); |
|
70 | 70 | |
71 | 71 | $originalFile = new File($originalFileRoot); |
72 | 72 | |
73 | 73 | if (!$originalFile->isExist()) { |
74 | - throw new NotFoundHttpException("The original file is not found: ".$newFileSrc); |
|
74 | + throw new NotFoundHttpException("The original file is not found: " . $newFileSrc); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | //Проверено наличие оригинального файла, есть пути к оригиналу, и результирующему файлу. |
78 | 78 | //Отслось собрать фильтр, и проверить наличие параметров. А так же проверить разрешены ли эти параметры, для этого в строке есть захэшированный ключь |
79 | 79 | |
80 | - $filterSting = substr($newFileSrc, ($strposFilter + strlen(DIRECTORY_SEPARATOR.Imaging::THUMBNAIL_PREFIX)), |
|
80 | + $filterSting = substr($newFileSrc, ($strposFilter + strlen(DIRECTORY_SEPARATOR . Imaging::THUMBNAIL_PREFIX)), |
|
81 | 81 | strlen($newFileSrc)); |
82 | 82 | $filterCode = explode("/", $filterSting); |
83 | 83 | $filterCode = $filterCode[0]; //Код фильтра |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | if ($params = \Yii::$app->request->get()) { |
87 | 87 | $pramsCheckArray = explode(DIRECTORY_SEPARATOR, $filterSting); |
88 | 88 | if (count($pramsCheckArray) < 3) { |
89 | - throw new \yii\base\Exception("the control line not found: ".$newFileSrc); |
|
89 | + throw new \yii\base\Exception("the control line not found: " . $newFileSrc); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $string = $imaging->getParamsCheckString($params); |
93 | 93 | if ($pramsCheckArray[1] != $string) { |
94 | - throw new \yii\base\Exception("Parameters invalid: ".$newFileSrc); |
|
94 | + throw new \yii\base\Exception("Parameters invalid: " . $newFileSrc); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | |
101 | 101 | if (!class_exists($filterClass)) { |
102 | - throw new \ErrorException("Filter class is not created: ".$newFileSrc); |
|
102 | + throw new \ErrorException("Filter class is not created: " . $newFileSrc); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | $filter = new $filterClass((array)$params); |
109 | 109 | if (!is_subclass_of($filter, Filter::className())) { |
110 | - throw new NotFoundHttpException("No child filter class: ".$newFileSrc); |
|
110 | + throw new NotFoundHttpException("No child filter class: " . $newFileSrc); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | try { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - $url = \Yii::$app->request->getUrl().($params ? |
|
131 | + $url = \Yii::$app->request->getUrl() . ($params ? |
|
132 | 132 | ""//"?" . http_build_query($params) . '&sx-refresh' |
133 | 133 | : '?sx-refresh'); |
134 | 134 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | $hidden = $widget->items; |
15 | 15 | $visible = []; |
16 | -$values = (array) $widget->model->{$widget->attribute}; |
|
16 | +$values = (array)$widget->model->{$widget->attribute}; |
|
17 | 17 | |
18 | 18 | foreach ($values as $value) |
19 | 19 | { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'hiddenLabel' => \Yii::t('skeeks/cms', 'Hidden columns'), |
94 | 94 | ], |
95 | 95 | //'multiple' => true, |
96 | - 'on beforeRender' => function ($e) { |
|
96 | + 'on beforeRender' => function($e) { |
|
97 | 97 | /** |
98 | 98 | * @var $gridView GridView |
99 | 99 | */ |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ['caption', 'string'], |
132 | 132 | ], |
133 | 133 | ], |
134 | - ], (array) $this->configBehaviorData), |
|
134 | + ], (array)$this->configBehaviorData), |
|
135 | 135 | ]); |
136 | 136 | } |
137 | 137 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | if ($result && in_array($label, array_values($result))) { |
179 | - $result[$code] = $label." ({$code})"; |
|
179 | + $result[$code] = $label . " ({$code})"; |
|
180 | 180 | } else { |
181 | 181 | $result[$code] = $label; |
182 | 182 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->_autoColumns[(string)$name] = [ |
266 | 266 | 'attribute' => $name, |
267 | 267 | 'format' => 'raw', |
268 | - 'value' => function ($model, $key, $index) use ($name) { |
|
268 | + 'value' => function($model, $key, $index) use ($name) { |
|
269 | 269 | if (is_array($model->{$name})) { |
270 | 270 | return implode(",", $model->{$name}); |
271 | 271 | } else { |