@@ -3,9 +3,8 @@ |
||
| 3 | 3 | namespace Apps\Model\Front\Content; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | -use Apps\ActiveRecord\Content; |
|
| 7 | -use Apps\ActiveRecord\ContentCategory; |
|
| 8 | 6 | use Apps\ActiveRecord\Content as ContentRecord; |
| 7 | +use Apps\ActiveRecord\ContentCategory; |
|
| 9 | 8 | use Apps\ActiveRecord\User; |
| 10 | 9 | use Ffcms\Core\App; |
| 11 | 10 | use Ffcms\Core\Arch\Model; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $this->_path = $path; |
| 55 | 55 | $this->_configs = $configs; |
| 56 | - $this->_page = (int)$offset; |
|
| 56 | + $this->_page = (int) $offset; |
|
| 57 | 57 | parent::__construct(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function before() |
| 66 | 66 | { |
| 67 | 67 | // find one or more categories where we must looking for content items |
| 68 | - if ((int)$this->_configs['multiCategories'] === 1) { |
|
| 68 | + if ((int) $this->_configs['multiCategories'] === 1) { |
|
| 69 | 69 | $this->findCategories(); |
| 70 | 70 | } else { |
| 71 | 71 | $this->findCategory(); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // calculate selection offset |
| 138 | - $itemPerPage = (int)$this->_configs['itemPerCategory']; |
|
| 138 | + $itemPerPage = (int) $this->_configs['itemPerCategory']; |
|
| 139 | 139 | if ($itemPerPage < 1) { |
| 140 | 140 | $itemPerPage = 1; |
| 141 | 141 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ]; |
| 169 | 169 | |
| 170 | 170 | // check if this category is hidden |
| 171 | - if ((int)$this->category['configs']['showCategory'] !== 1) { |
|
| 171 | + if ((int) $this->category['configs']['showCategory'] !== 1) { |
|
| 172 | 172 | throw new ForbiddenException(__('This category is not available to view')); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | 'poster' => $row->getPosterUri(), |
| 219 | 219 | 'thumb' => $row->getPosterThumbUri(), |
| 220 | 220 | 'thumbSize' => File::size($row->getPosterThumbUri()), |
| 221 | - 'views' => (int)$row->views, |
|
| 222 | - 'rating' => (int)$row->rating, |
|
| 221 | + 'views' => (int) $row->views, |
|
| 222 | + 'rating' => (int) $row->rating, |
|
| 223 | 223 | 'category' => $this->categories[$row->category_id], |
| 224 | 224 | 'uri' => '/content/read/' . $itemPath, |
| 225 | 225 | 'tags' => $tags |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * EntityContentSearch constructor. Pass search terms (query string) to model and used items to skip it by id. |
| 27 | 27 | * @param $terms |
| 28 | - * @param int|array $skipIds |
|
| 28 | + * @param integer $skipIds |
|
| 29 | 29 | */ |
| 30 | 30 | public function __construct($terms, $skipIds = 0) |
| 31 | 31 | { |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php return [ |
| 2 | - 'Alias' => [ |
|
| 3 | - 'Front' => [ |
|
| 4 | - '/about' => '/content/read/page/about-page' |
|
| 5 | - ] |
|
| 6 | - ], |
|
| 7 | - 'Callback' => [ |
|
| 8 | - 'Front' => [ |
|
| 9 | - 'Demo' => '\Apps\Controller\Front\Main' |
|
| 10 | - ] |
|
| 11 | - ] |
|
| 2 | + 'Alias' => [ |
|
| 3 | + 'Front' => [ |
|
| 4 | + '/about' => '/content/read/page/about-page' |
|
| 5 | + ] |
|
| 6 | + ], |
|
| 7 | + 'Callback' => [ |
|
| 8 | + 'Front' => [ |
|
| 9 | + 'Demo' => '\Apps\Controller\Front\Main' |
|
| 10 | + ] |
|
| 11 | + ] |
|
| 12 | 12 | ]; |
| 13 | 13 | \ No newline at end of file |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Labels for form |
|
| 46 | - */ |
|
| 45 | + * Labels for form |
|
| 46 | + */ |
|
| 47 | 47 | public function labels() |
| 48 | 48 | { |
| 49 | 49 | return [ |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Validation rules for comments settings |
|
| 61 | - */ |
|
| 60 | + * Validation rules for comments settings |
|
| 61 | + */ |
|
| 62 | 62 | public function rules() |
| 63 | 63 | { |
| 64 | 64 | return [ |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | </li> |
| 55 | 55 | </ul> |
| 56 | 56 | |
| 57 | -<?php if ((int)$configs['guestAdd'] === 1 || \App::$User->isAuth()): ?> |
|
| 57 | +<?php if ((int) $configs['guestAdd'] === 1 || \App::$User->isAuth()): ?> |
|
| 58 | 58 | <!-- comment form --> |
| 59 | 59 | <form name="comment-add-form" action="" method="post" style="padding-top: 15px;" class="form-horizontal"> |
| 60 | 60 | <input type="hidden" name="replay-to" value="0" /> |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function check() |
| 57 | 57 | { |
| 58 | 58 | // check if user is auth'd or guest name is defined |
| 59 | - if (!App::$User->isAuth() && ((int)$this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
| 59 | + if (!App::$User->isAuth() && ((int) $this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
| 60 | 60 | throw new JsonException(__('Guest name is not defined')); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // check if message length is correct |
| 69 | - if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) { |
|
| 69 | + if (Str::length($this->message) < (int) $this->_configs['minLength'] || Str::length($this->message) > (int) $this->_configs['maxLength']) { |
|
| 70 | 70 | throw new JsonException(__('Message length is incorrect. Current: %cur% , min - %min%, max - %max%', [ |
| 71 | 71 | 'cur' => Str::length($this->message), |
| 72 | 72 | 'min' => $this->_configs['minLength'], |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function check() |
| 57 | 57 | { |
| 58 | 58 | // check if user is auth'd or guest name is defined |
| 59 | - if (!App::$User->isAuth() && ((int)$this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
| 59 | + if (!App::$User->isAuth() && ((int) $this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
| 60 | 60 | throw new JsonException(__('Guest name is not defined')); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // check if message length is correct |
| 69 | - if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) { |
|
| 69 | + if (Str::length($this->message) < (int) $this->_configs['minLength'] || Str::length($this->message) > (int) $this->_configs['maxLength']) { |
|
| 70 | 70 | throw new JsonException(__('Message length is incorrect. Current: %cur% , min - %min%, max - %max%', [ |
| 71 | 71 | 'cur' => Str::length($this->message), |
| 72 | 72 | 'min' => $this->_configs['minLength'], |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->setJsonHeader(); |
| 31 | 31 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
| 32 | 32 | |
| 33 | - $replayTo = (int)App::$Request->request->get('replay-to'); |
|
| 33 | + $replayTo = (int) App::$Request->request->get('replay-to'); |
|
| 34 | 34 | $model = null; |
| 35 | 35 | // check if its a answer (comment answer type) |
| 36 | 36 | if ($replayTo > 0) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // pass general comment params to model |
| 45 | - $model->message = App::$Security->secureHtml((string)App::$Request->request->get('message')); |
|
| 45 | + $model->message = App::$Security->secureHtml((string) App::$Request->request->get('message')); |
|
| 46 | 46 | $model->guestName = App::$Security->strip_tags(App::$Request->request->get('guest-name')); |
| 47 | 47 | |
| 48 | 48 | // check model conditions before add new row |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | // get configs |
| 75 | 75 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
| 76 | 76 | // items per page |
| 77 | - $perPage = (int)$configs['perPage']; |
|
| 77 | + $perPage = (int) $configs['perPage']; |
|
| 78 | 78 | // offset can be only integer |
| 79 | - $index = (int)$index; |
|
| 79 | + $index = (int) $index; |
|
| 80 | 80 | $offset = $perPage * $index; |
| 81 | 81 | // get comment target path and check |
| 82 | - $path = (string)App::$Request->query->get('path'); |
|
| 82 | + $path = (string) App::$Request->query->get('path'); |
|
| 83 | 83 | if (Str::likeEmpty($path)) { |
| 84 | 84 | throw new JsonException('Wrong path'); |
| 85 | 85 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $query = CommentPost::where('pathway', '=', $path); |
| 89 | 89 | |
| 90 | 90 | // check if comments is depend of language locale |
| 91 | - if ((int)$configs['onlyLocale'] === 1) { |
|
| 91 | + if ((int) $configs['onlyLocale'] === 1) { |
|
| 92 | 92 | $query = $query->where('lang', '=', App::$Request->getLanguage()); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function actionShowanswers($commentId) |
| 137 | 137 | { |
| 138 | 138 | // check input data |
| 139 | - if (!Obj::isLikeInt($commentId) || (int)$commentId < 1) { |
|
| 139 | + if (!Obj::isLikeInt($commentId) || (int) $commentId < 1) { |
|
| 140 | 140 | throw new JsonException('Input data is incorrect'); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // get data from db by comment id |
| 147 | 147 | $records = CommentAnswer::where('comment_id', '=', $commentId); |
| 148 | - if ((int)$configs['onlyLocale'] === 1) { |
|
| 148 | + if ((int) $configs['onlyLocale'] === 1) { |
|
| 149 | 149 | $records = $records->where('lang', '=', App::$Request->getLanguage()); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | foreach ($records as $item) { |
| 32 | 32 | $message = Text::cut(\App::$Security->strip_tags($item->message), 0, 75); |
| 33 | 33 | $userArr = []; |
| 34 | - if ((int)$item->user_id > 0 && \App::$User->isExist($item->user_id)) { |
|
| 34 | + if ((int) $item->user_id > 0 && \App::$User->isExist($item->user_id)) { |
|
| 35 | 35 | $userName = \App::$User->identity($item->user_id)->getProfile()->getNickname(); |
| 36 | 36 | $userArr = ['text' => Url::link(['user/update', $item->user_id], $userName), 'html' => true]; |
| 37 | 37 | } |