@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use Ffcms\Core\App; |
| 10 | 10 | use Ffcms\Core\Exception\SyntaxException; |
| 11 | 11 | use Ffcms\Core\Helper\FileSystem\File; |
| 12 | -use Ffcms\Core\Helper\Type\Arr; |
|
| 13 | 12 | use Ffcms\Core\Helper\Type\Integer; |
| 14 | 13 | use Ffcms\Core\Helper\Type\Str; |
| 15 | 14 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function actionIndex() |
| 39 | 39 | { |
| 40 | 40 | // set current page and offset |
| 41 | - $page = (int)App::$Request->query->get('page'); |
|
| 41 | + $page = (int) App::$Request->query->get('page'); |
|
| 42 | 42 | $offset = $page * self::ITEM_PER_PAGE; |
| 43 | 43 | |
| 44 | 44 | $query = null; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | if ($type === 'trash') { |
| 48 | 48 | $query = ContentEntity::onlyTrashed(); |
| 49 | 49 | } elseif (Obj::isLikeInt($type)) { // sounds like category id ;) |
| 50 | - $query = ContentEntity::where('category_id', '=', (int)$type); |
|
| 50 | + $query = ContentEntity::where('category_id', '=', (int) $type); |
|
| 51 | 51 | } else { |
| 52 | 52 | $query = new ContentEntity(); |
| 53 | 53 | $type = 'all'; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if ($model->send() && $model->validate()) { |
| 194 | 194 | // remove all trashed items |
| 195 | 195 | foreach ($records->get() as $item) { |
| 196 | - $galleryPath = '/upload/gallery/' . (int)$item->id; |
|
| 196 | + $galleryPath = '/upload/gallery/'.(int) $item->id; |
|
| 197 | 197 | if (Directory::exist($galleryPath)) { |
| 198 | 198 | Directory::remove($galleryPath); |
| 199 | 199 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | public function actionCategoryupdate($id = null) |
| 266 | 266 | { |
| 267 | 267 | // get owner id for new rows |
| 268 | - $parentId = (int)App::$Request->query->get('parent'); |
|
| 268 | + $parentId = (int) App::$Request->query->get('parent'); |
|
| 269 | 269 | |
| 270 | 270 | // get relation and pass to model |
| 271 | 271 | $record = ContentCategory::findOrNew($id); |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | /** |
| 124 | 124 | * Get current extension active record |
| 125 | 125 | * @param string|null $type |
| 126 | - * @return mixed |
|
| 126 | + * @return AppRecord |
|
| 127 | 127 | */ |
| 128 | 128 | public function getTypeItem($type = null) |
| 129 | 129 | { |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | $user = App::$User->identity(); |
| 87 | 87 | // user is not authed ? |
| 88 | 88 | if ($user === null || !App::$User->isAuth()) { |
| 89 | - $redirectUrl = App::$Alias->scriptUrl . '/user/login'; |
|
| 89 | + $redirectUrl = App::$Alias->scriptUrl.'/user/login'; |
|
| 90 | 90 | App::$Response->redirect($redirectUrl, true); |
| 91 | 91 | exit(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $permission = env_name . '/' . App::$Request->getController() . '/' . App::$Request->getAction(); |
|
| 94 | + $permission = env_name.'/'.App::$Request->getController().'/'.App::$Request->getAction(); |
|
| 95 | 95 | |
| 96 | 96 | // doesn't have permission? get the f*ck out |
| 97 | 97 | if (!$user->getRole()->can($permission)) { |
| 98 | 98 | App::$Session->invalidate(); |
| 99 | 99 | |
| 100 | - $redirectUrl = App::$Alias->scriptUrl . '/user/login'; |
|
| 100 | + $redirectUrl = App::$Alias->scriptUrl.'/user/login'; |
|
| 101 | 101 | App::$Response->redirect($redirectUrl, true); |
| 102 | 102 | exit(); |
| 103 | 103 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function getConfigs() |
| 146 | 146 | { |
| 147 | - return $this->type === 'widget' ? (array)Serialize::decode($this->widget->configs) : (array)Serialize::decode($this->application->configs); |
|
| 147 | + return $this->type === 'widget' ? (array) Serialize::decode($this->widget->configs) : (array) Serialize::decode($this->application->configs); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -1,6 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use Ffcms\Core\Helper\Date; |
|
| 4 | 3 | use Ffcms\Core\Helper\HTML\Form; |
| 5 | 4 | use Ffcms\Core\Helper\Type\Str; |
| 6 | 5 | use Ffcms\Core\Helper\Url; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $search = \Apps\ActiveRecord\App::getItem('app', $controller); |
| 72 | 72 | |
| 73 | 73 | // check what we got |
| 74 | - if ($search === null || (int)$search->id < 1) { |
|
| 74 | + if ($search === null || (int) $search->id < 1) { |
|
| 75 | 75 | throw new ForbiddenException('App is not founded'); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $search = \Apps\ActiveRecord\App::where('sys_name', '=', $controllerName)->where('type', '=', 'app')->first(); |
| 98 | 98 | |
| 99 | - if ($search === null || (int)$search->id < 1) { |
|
| 99 | + if ($search === null || (int) $search->id < 1) { |
|
| 100 | 100 | throw new ForbiddenException('App is not founded'); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | * Get single row by defined type and sys_name with query caching |
| 60 | 60 | * @param string $type |
| 61 | 61 | * @param string $sys_name |
| 62 | - * @return mixed|null |
|
| 62 | + * @return App |
|
| 63 | 63 | * @throws SyntaxException |
| 64 | 64 | */ |
| 65 | 65 | public static function getItem($type, $sys_name) |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $scriptVersion = $this->getScriptVersion(); |
| 150 | 150 | |
| 151 | - return $scriptVersion === (float)$this->version; |
|
| 151 | + return $scriptVersion === (float) $this->version; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function getScriptVersion() |
| 159 | 159 | { |
| 160 | - $class = 'Apps\Controller\Admin\\' . $this->sys_name; |
|
| 160 | + $class = 'Apps\Controller\Admin\\'.$this->sys_name; |
|
| 161 | 161 | if (!class_exists($class)) { |
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (!defined($class . '::VERSION')) { |
|
| 165 | + if (!defined($class.'::VERSION')) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - return (float)constant($class . '::VERSION'); |
|
| 169 | + return (float) constant($class.'::VERSION'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | \ No newline at end of file |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Apps\ActiveRecord\App as AppRecord; |
| 6 | 6 | use Ffcms\Core\Arch\Model; |
| 7 | 7 | use Ffcms\Core\Exception\ForbiddenException; |
| 8 | -use Ffcms\Core\Exception\NativeException; |
|
| 9 | 8 | use Ffcms\Core\Exception\NotFoundException; |
| 10 | 9 | use Ffcms\Core\Helper\Date; |
| 11 | 10 | |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * Magic method before |
|
| 32 | - */ |
|
| 31 | + * Magic method before |
|
| 32 | + */ |
|
| 33 | 33 | public function before() |
| 34 | 34 | { |
| 35 | 35 | // get full name of update object |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function before() |
| 34 | 34 | { |
| 35 | 35 | // get full name of update object |
| 36 | - $class = 'Apps\Controller\Admin\\' . $this->_record->sys_name; |
|
| 36 | + $class = 'Apps\Controller\Admin\\'.$this->_record->sys_name; |
|
| 37 | 37 | if (class_exists($class)) { |
| 38 | 38 | $this->_callback = $class; |
| 39 | 39 | } else { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $status = $object->disabled; |
| 14 | 14 | |
| 15 | - $object->disabled = (int)!$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0 |
|
| 15 | + $object->disabled = (int) !$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0 |
|
| 16 | 16 | $object->save(); |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | [['text' => __('Name')], ['text' => $widget->getLocaleName()]], |
| 32 | 32 | [['text' => __('System name')], ['text' => $widget->sys_name]], |
| 33 | 33 | [['text' => __('Last update')], ['text' => Date::convertToDatetime($widget->updated_at, DATE::FORMAT_TO_SECONDS)]], |
| 34 | - [['text' => __('Status')], ['text' => ((int)$widget->disabled === 0) ? 'On' : 'Off'], 'property' => ['class' => ((int)$widget->disabled === 0) ? 'alert-success' : 'alert-danger']] |
|
| 34 | + [['text' => __('Status')], ['text' => ((int) $widget->disabled === 0) ? 'On' : 'Off'], 'property' => ['class' => ((int) $widget->disabled === 0) ? 'alert-success' : 'alert-danger']] |
|
| 35 | 35 | ] |
| 36 | 36 | ] |
| 37 | 37 | ]); ?> |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $search = \Apps\ActiveRecord\App::getItem('app', $controller); |
| 72 | 72 | |
| 73 | 73 | // check what we got |
| 74 | - if ($search === null || (int)$search->id < 1) { |
|
| 74 | + if ($search === null || (int) $search->id < 1) { |
|
| 75 | 75 | throw new ForbiddenException('App is not founded'); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $search = \Apps\ActiveRecord\App::where('sys_name', '=', $controllerName)->where('type', '=', 'app')->first(); |
| 98 | 98 | |
| 99 | - if ($search === null || (int)$search->id < 1) { |
|
| 99 | + if ($search === null || (int) $search->id < 1) { |
|
| 100 | 100 | throw new ForbiddenException('App is not founded'); |
| 101 | 101 | } |
| 102 | 102 | |