@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public static function all($columns = ['*']) |
| 30 | 30 | { |
| 31 | - $cacheName = 'activerecord.profilefield.all.' . implode('.', $columns); |
|
| 31 | + $cacheName = 'activerecord.profilefield.all.'.implode('.', $columns); |
|
| 32 | 32 | $records = MemoryObject::instance()->get($cacheName); |
| 33 | 33 | if ($records === null) { |
| 34 | 34 | $records = parent::all($columns); |
@@ -37,9 +37,9 @@ |
||
| 37 | 37 | $record->save(); |
| 38 | 38 | |
| 39 | 39 | // add user notification |
| 40 | - if ((int)$this->_post->user_id > 0 && $this->_userId !== (int)$this->_post->user_id) { |
|
| 41 | - $notify = new EntityAddNotification((int)$this->_post->user_id); |
|
| 42 | - $uri = '/feedback/read/' . $this->_post->id . '/' . $this->_post->hash . '#feedback-answer-' . $record->id; |
|
| 40 | + if ((int) $this->_post->user_id > 0 && $this->_userId !== (int) $this->_post->user_id) { |
|
| 41 | + $notify = new EntityAddNotification((int) $this->_post->user_id); |
|
| 42 | + $uri = '/feedback/read/'.$this->_post->id.'/'.$this->_post->hash.'#feedback-answer-'.$record->id; |
|
| 43 | 43 | |
| 44 | 44 | $notify->add($uri, EntityAddNotification::MSG_ADD_FEEDBACKANSWER, [ |
| 45 | 45 | 'snippet' => Text::snippet($this->message, 50), |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | { |
| 44 | 44 | // remove gallery files if exists |
| 45 | 45 | foreach ($this->_records->get() as $record) { |
| 46 | - $galleryPath = '/upload/gallery/' . (int)$record->id; |
|
| 46 | + $galleryPath = '/upload/gallery/'.(int) $record->id; |
|
| 47 | 47 | if (Directory::exist($galleryPath)) { |
| 48 | 48 | Directory::remove($galleryPath); |
| 49 | 49 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // labels for custom fields |
| 73 | 73 | foreach (ProfileField::all() as $custom) { |
| 74 | - $labels['custom_data.' . $custom->id] = $custom->getLocaled('name'); |
|
| 74 | + $labels['custom_data.'.$custom->id] = $custom->getLocaled('name'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $labels; |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | // custom profile fields |
| 98 | 98 | foreach (ProfileField::all() as $custom) { |
| 99 | 99 | $rules[] = [ |
| 100 | - 'custom_data.' . $custom->id, |
|
| 100 | + 'custom_data.'.$custom->id, |
|
| 101 | 101 | 'used' |
| 102 | 102 | ]; |
| 103 | 103 | $rules[] = [ |
| 104 | - 'custom_data.' . $custom->id, |
|
| 105 | - (int)$custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
| 104 | + 'custom_data.'.$custom->id, |
|
| 105 | + (int) $custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
| 106 | 106 | $custom->reg_exp |
| 107 | 107 | ]; |
| 108 | 108 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function before() |
| 44 | 44 | { |
| 45 | 45 | foreach ($this->_apps as $app) { |
| 46 | - $this->_definedControllers[] = (string)$app->sys_name; |
|
| 46 | + $this->_definedControllers[] = (string) $app->sys_name; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | parent::before(); |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | public function make() |
| 80 | 80 | { |
| 81 | 81 | $cName = ucfirst(Str::lowerCase($this->sysname)); |
| 82 | - $cPath = 'Apps\Controller\Admin\\' . $cName; |
|
| 82 | + $cPath = 'Apps\Controller\Admin\\'.$cName; |
|
| 83 | 83 | // if object class is not loaded - prevent install |
| 84 | - if (!class_exists($cPath) || !defined($cPath . '::VERSION')) { |
|
| 84 | + if (!class_exists($cPath) || !defined($cPath.'::VERSION')) { |
|
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // get ext version |
| 89 | - $cVersion = constant($cPath . '::VERSION'); |
|
| 89 | + $cVersion = constant($cPath.'::VERSION'); |
|
| 90 | 90 | if ($cVersion === null || Str::likeEmpty($cVersion)) { |
| 91 | 91 | $cVersion = '1.0.0'; |
| 92 | 92 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // callback to install method in extension |
| 104 | 104 | if (method_exists($cPath, 'install')) { |
| 105 | - call_user_func($cPath . '::install'); |
|
| 105 | + call_user_func($cPath.'::install'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return true; |
@@ -34,12 +34,12 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function make() |
| 36 | 36 | { |
| 37 | - $archive = $this->name . '.zip'; |
|
| 37 | + $archive = $this->name.'.zip'; |
|
| 38 | 38 | // download archive |
| 39 | - File::saveFromUrl($this->url, '/' . $archive); |
|
| 39 | + File::saveFromUrl($this->url, '/'.$archive); |
|
| 40 | 40 | // extract archive |
| 41 | 41 | $zip = new \ZipArchive(); |
| 42 | - if ($zip->open(root . '/' . $archive) === true) { |
|
| 42 | + if ($zip->open(root.'/'.$archive) === true) { |
|
| 43 | 43 | $zip->extractTo(root); |
| 44 | 44 | $zip->close(); |
| 45 | 45 | // cleanup cache |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $this->_content->save(); |
| 77 | 77 | |
| 78 | 78 | // update content author rating |
| 79 | - $authorId = (int)$this->_content->author_id; |
|
| 79 | + $authorId = (int) $this->_content->author_id; |
|
| 80 | 80 | if ($authorId > 0 && App::$User->isExist($authorId)) { |
| 81 | 81 | $authorObject = App::$User->identity($authorId); |
| 82 | 82 | if ($authorObject !== null) { |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | public function check() |
| 49 | 49 | { |
| 50 | 50 | // check if user is auth'd or guest name is defined |
| 51 | - if (!App::$User->isAuth() && ((int)$this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
| 51 | + if (!App::$User->isAuth() && ((int) $this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
| 52 | 52 | throw new JsonException(__('Guest name is not defined')); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // guest moderation |
| 56 | - if (!App::$User->isAuth() && (bool)$this->_configs['guestModerate']) { |
|
| 56 | + if (!App::$User->isAuth() && (bool) $this->_configs['guestModerate']) { |
|
| 57 | 57 | $captcha = App::$Request->request->get('captcha'); |
| 58 | 58 | if (!App::$Captcha->validate($captcha)) { |
| 59 | 59 | throw new JsonException(__('Captcha is incorrect! Click on image to refresh and try again')); |
@@ -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'], |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | $record->lang = App::$Request->getLanguage(); |
| 112 | 112 | $record->ip = $this->ip; |
| 113 | 113 | // check if premoderation is enabled and user is guest |
| 114 | - if ((bool)$this->_configs['guestModerate'] && $this->_userId < 1) { |
|
| 114 | + if ((bool) $this->_configs['guestModerate'] && $this->_userId < 1) { |
|
| 115 | 115 | $record->moderate = 1; |
| 116 | 116 | } |
| 117 | 117 | $record->save(); |
| 118 | 118 | |
| 119 | 119 | // add notification for comment post owner |
| 120 | 120 | $commentPost = $record->post; |
| 121 | - if ($commentPost !== null && (int)$commentPost->user_id !== 0 && (int)$commentPost->user_id !== $this->_userId) { |
|
| 122 | - $notify = new EntityAddNotification((int)$commentPost->user_id); |
|
| 121 | + if ($commentPost !== null && (int) $commentPost->user_id !== 0 && (int) $commentPost->user_id !== $this->_userId) { |
|
| 122 | + $notify = new EntityAddNotification((int) $commentPost->user_id); |
|
| 123 | 123 | $notify->add($commentPost->pathway, EntityAddNotification::MSG_ADD_COMMENTANSWER, [ |
| 124 | 124 | 'snippet' => Text::snippet($this->message, 50), |
| 125 | 125 | 'post' => Text::snippet($commentPost->message, 50) |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $this->_path = $path; |
| 60 | 60 | $this->_configs = $configs; |
| 61 | - $this->_page = (int)$offset; |
|
| 61 | + $this->_page = (int) $offset; |
|
| 62 | 62 | $this->_sort = $sort; |
| 63 | 63 | parent::__construct(); |
| 64 | 64 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function before() |
| 72 | 72 | { |
| 73 | 73 | // find one or more categories where we must looking for content items |
| 74 | - if ((int)$this->_configs['multiCategories'] === 1) { |
|
| 74 | + if ((int) $this->_configs['multiCategories'] === 1) { |
|
| 75 | 75 | $this->findCategories(); |
| 76 | 76 | } else { |
| 77 | 77 | $this->findCategory(); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function setItemLimit($limit) |
| 92 | 92 | { |
| 93 | - $this->_customItemLimit = (int)$limit; |
|
| 93 | + $this->_customItemLimit = (int) $limit; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | private function findCategories() |
| 119 | 119 | { |
| 120 | 120 | // get all categories for current path and child of it |
| 121 | - $query = ContentCategory::where('path', 'like', $this->_path . '%'); |
|
| 121 | + $query = ContentCategory::where('path', 'like', $this->_path.'%'); |
|
| 122 | 122 | if ($query->count() < 1) { |
| 123 | 123 | throw new NotFoundException(__('Category is not founded')); |
| 124 | 124 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // calculate selection offset |
| 154 | - $itemPerPage = (int)$this->_configs['itemPerCategory']; |
|
| 154 | + $itemPerPage = (int) $this->_configs['itemPerCategory']; |
|
| 155 | 155 | // check if custom itemlimit defined over model api |
| 156 | 156 | if ($this->_customItemLimit !== false) { |
| 157 | - $itemPerPage = (int)$this->_customItemLimit; |
|
| 157 | + $itemPerPage = (int) $this->_customItemLimit; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $offset = $this->_page * $itemPerPage; |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | $catConfigs = $this->_currentCategory->configs; |
| 198 | 198 | // prepare rss url link for current category if enabled |
| 199 | 199 | $rssUrl = false; |
| 200 | - if ((int)$this->_configs['rss'] === 1 && (int)$catConfigs['showRss'] === 1) { |
|
| 201 | - $rssUrl = App::$Alias->baseUrl . '/content/rss/' . $this->_currentCategory->path; |
|
| 200 | + if ((int) $this->_configs['rss'] === 1 && (int) $catConfigs['showRss'] === 1) { |
|
| 201 | + $rssUrl = App::$Alias->baseUrl.'/content/rss/'.$this->_currentCategory->path; |
|
| 202 | 202 | $rssUrl = rtrim($rssUrl, '/'); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // prepare sorting urls |
| 206 | 206 | $catSortParams = []; |
| 207 | 207 | if (App::$Request->query->get('page')) { |
| 208 | - $catSortParams['page'] = (int)App::$Request->query->get('page'); |
|
| 208 | + $catSortParams['page'] = (int) App::$Request->query->get('page'); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $catSortUrls = [ |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ]; |
| 226 | 226 | |
| 227 | 227 | // check if this category is hidden |
| 228 | - if (!(bool)$this->category['configs']['showCategory']) { |
|
| 228 | + if (!(bool) $this->category['configs']['showCategory']) { |
|
| 229 | 229 | throw new ForbiddenException(__('This category is not available to view')); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // check if current user can rate item |
| 279 | 279 | $ignoredRate = App::$Session->get('content.rate.ignore'); |
| 280 | 280 | $canRate = true; |
| 281 | - if (Any::isArray($ignoredRate) && Arr::in((string)$row->id, $ignoredRate)) { |
|
| 281 | + if (Any::isArray($ignoredRate) && Arr::in((string) $row->id, $ignoredRate)) { |
|
| 282 | 282 | $canRate = false; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | 'poster' => $row->getPosterUri(), |
| 300 | 300 | 'thumb' => $row->getPosterThumbUri(), |
| 301 | 301 | 'thumbSize' => File::size($row->getPosterThumbUri()), |
| 302 | - 'views' => (int)$row->views, |
|
| 303 | - 'rating' => (int)$row->rating, |
|
| 302 | + 'views' => (int) $row->views, |
|
| 303 | + 'rating' => (int) $row->rating, |
|
| 304 | 304 | 'canRate' => $canRate, |
| 305 | 305 | 'category' => $this->categories[$row->category_id], |
| 306 | - 'uri' => '/content/read/' . $itemPath, |
|
| 306 | + 'uri' => '/content/read/'.$itemPath, |
|
| 307 | 307 | 'tags' => $tags, |
| 308 | - 'important' => (bool)$row->important |
|
| 308 | + 'important' => (bool) $row->important |
|
| 309 | 309 | ]; |
| 310 | 310 | } |
| 311 | 311 | |