@@ -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), |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Apps\Model\Admin\Feedback; |
| 4 | 4 | |
| 5 | 5 | use Apps\ActiveRecord\FeedbackAnswer; |
| 6 | -use Apps\ActiveRecord\FeedbackPost; |
|
| 7 | 6 | use Apps\Model\Front\Feedback\FormAnswerAdd as FrontAnswer; |
| 8 | 7 | use Apps\Model\Front\Profile\EntityAddNotification; |
| 9 | 8 | use Ffcms\Core\App; |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * Load configs from app data |
|
| 31 | - */ |
|
| 30 | + * Load configs from app data |
|
| 31 | + */ |
|
| 32 | 32 | public function before() |
| 33 | 33 | { |
| 34 | 34 | if ($this->_config === null) { |
@@ -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 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | { |
| 71 | 71 | $password = App::$Security->password_hash($this->password); |
| 72 | 72 | |
| 73 | - $search = App::$User->where('password', '=', $password)->where(function ($query) { |
|
| 73 | + $search = App::$User->where('password', '=', $password)->where(function($query) { |
|
| 74 | 74 | $query->where('login', '=', $this->login) |
| 75 | 75 | ->orWhere('email', '=', $this->login); |
| 76 | 76 | }); |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Apps\Controller\Front; |
| 4 | 4 | |
| 5 | -use Apps\ActiveRecord\Content as ContentEntity; |
|
| 6 | 5 | use Apps\ActiveRecord\Content as ContentRecord; |
| 7 | 6 | use Apps\ActiveRecord\ContentCategory; |
| 8 | 7 | use Apps\Model\Front\Content\EntityCategoryList; |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $path = $this->request->getPathWithoutControllerAction(); |
| 59 | 59 | $configs = $this->getConfigs(); |
| 60 | - $page = (int)$this->request->query->get('page', 0); |
|
| 61 | - $sort = (string)$this->request->query->get('sort', 'newest'); |
|
| 62 | - $itemCount = (int)$configs['itemPerCategory']; |
|
| 60 | + $page = (int) $this->request->query->get('page', 0); |
|
| 61 | + $sort = (string) $this->request->query->get('sort', 'newest'); |
|
| 62 | + $itemCount = (int) $configs['itemPerCategory']; |
|
| 63 | 63 | |
| 64 | 64 | // build special model with content list and category list information |
| 65 | 65 | $model = new EntityCategoryList($path, $configs, $page, $sort); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $model = new EntityContentRead($categoryRecord, $contentRecord->first()); |
| 140 | 140 | $search = null; |
| 141 | 141 | // check if similar search is enabled for item category |
| 142 | - if ((int)$model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) { |
|
| 142 | + if ((int) $model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) { |
|
| 143 | 143 | $search = new EntityContentSearch($model->title, $model->id, $model->getCategory()->id); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // get equal rows order by creation date |
| 178 | - $records = ContentEntity::where('meta_keywords', 'like', '%' . $tagName . '%') |
|
| 178 | + $records = ContentEntity::where('meta_keywords', 'like', '%'.$tagName.'%') |
|
| 179 | 179 | ->orderBy('created_at', 'DESC') |
| 180 | 180 | ->take(self::TAG_PER_PAGE); |
| 181 | 181 | // check if result is not empty |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $this->layout = null; |
| 212 | 212 | |
| 213 | 213 | // check if rss display allowed for this category |
| 214 | - if ((int)$model->category['configs']['showRss'] !== 1) { |
|
| 214 | + if ((int) $model->category['configs']['showRss'] !== 1) { |
|
| 215 | 215 | throw new ForbiddenException(__('Rss feed is disabled for this category')); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | // set channel data |
| 226 | 226 | $channel->title($model->category['title']) |
| 227 | 227 | ->description($model->category['description']) |
| 228 | - ->url(App::$Alias->baseUrl . '/content/list/' . $model->category['path']) |
|
| 228 | + ->url(App::$Alias->baseUrl.'/content/list/'.$model->category['path']) |
|
| 229 | 229 | ->appendTo($feed); |
| 230 | 230 | |
| 231 | 231 | // add content data |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | // add title, short text, url |
| 236 | 236 | $item->title($row['title']) |
| 237 | 237 | ->description($row['text']) |
| 238 | - ->url(App::$Alias->baseUrl . $row['uri']); |
|
| 238 | + ->url(App::$Alias->baseUrl.$row['uri']); |
|
| 239 | 239 | // add poster |
| 240 | 240 | if ($row['thumb'] !== null) { |
| 241 | - $item->enclosure(App::$Alias->scriptUrl . $row['thumb'], $row['thumbSize'], 'image/jpeg'); |
|
| 241 | + $item->enclosure(App::$Alias->scriptUrl.$row['thumb'], $row['thumbSize'], 'image/jpeg'); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // append response to channel |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | // check if user add enabled |
| 274 | 274 | $configs = $this->getConfigs(); |
| 275 | - if (!(bool)$configs['userAdd']) { |
|
| 275 | + if (!(bool) $configs['userAdd']) { |
|
| 276 | 276 | throw new NotFoundException(__('User add is disabled')); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // prepare query |
| 280 | - $page = (int)$this->request->query->get('page', 0); |
|
| 280 | + $page = (int) $this->request->query->get('page', 0); |
|
| 281 | 281 | $offset = $page * 10; |
| 282 | 282 | $query = ContentRecord::where('author_id', '=', App::$User->identity()->getId()); |
| 283 | 283 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | // check if user add enabled |
| 318 | 318 | $configs = $this->getConfigs(); |
| 319 | - if (!(bool)$configs['userAdd']) { |
|
| 319 | + if (!(bool) $configs['userAdd']) { |
|
| 320 | 320 | throw new NotFoundException(__('User add is disabled')); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $new = $record->id === null; |
| 326 | 326 | |
| 327 | 327 | // reject edit published items and items from other authors |
| 328 | - if (($new === false && (int)$record->author_id !== App::$User->identity()->getId()) || (int)$record->display === 1) { |
|
| 328 | + if (($new === false && (int) $record->author_id !== App::$User->identity()->getId()) || (int) $record->display === 1) { |
|
| 329 | 329 | throw new ForbiddenException(__('You have no permissions to edit this content')); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -370,10 +370,10 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // build sitemap items using iteration - 5000 rows per each one |
| 373 | - $iterations = (int)($contentCount / static::SITEMAP_CONTENT_COUNT_ITERATION); |
|
| 373 | + $iterations = (int) ($contentCount / static::SITEMAP_CONTENT_COUNT_ITERATION); |
|
| 374 | 374 | for ($i = 0; $i <= $iterations; $i++) { |
| 375 | 375 | // check if lifetime is expired for current sitemap index |
| 376 | - $xmlTime = File::mTime('/upload/sitemap/content.' . $i . '.' . $langs[0] . '.xml'); |
|
| 376 | + $xmlTime = File::mTime('/upload/sitemap/content.'.$i.'.'.$langs[0].'.xml'); |
|
| 377 | 377 | $updateDelay = static::SITEMAP_UPDATE_DELAY * 60; |
| 378 | 378 | $updateDelay += mt_rand(0, 1800); // +- 0-30 rand min for caching update |
| 379 | 379 | // do not process if cache time is not expired |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $category = $content->getCategory(); |
| 392 | 392 | $uri = '/content/read/'; |
| 393 | 393 | if (!Str::likeEmpty($category->path)) { |
| 394 | - $uri .= $category->path . '/'; |
|
| 394 | + $uri .= $category->path.'/'; |
|
| 395 | 395 | } |
| 396 | 396 | $uri .= $content->path; |
| 397 | 397 | $sitemap->add($uri, $content->created_at, 'weekly', 0.7); |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | // add categories |
| 400 | 400 | $categories = ContentCategory::all(); |
| 401 | 401 | foreach ($categories as $item) { |
| 402 | - if ((bool)$item->getProperty('showCategory')) { |
|
| 403 | - $uri = '/content/list/' . $item->path; |
|
| 402 | + if ((bool) $item->getProperty('showCategory')) { |
|
| 403 | + $uri = '/content/list/'.$item->path; |
|
| 404 | 404 | $sitemap->add($uri, date('c'), 'daily', 0.9); |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | // save data to xml file |
| 408 | - $sitemap->save('content.' . $i); |
|
| 408 | + $sitemap->save('content.'.$i); |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -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 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public static function all($columns = ['*']) |
| 36 | 36 | { |
| 37 | - $cacheName = 'activerecord.contentcategory.all.' . implode('.', $columns); |
|
| 37 | + $cacheName = 'activerecord.contentcategory.all.'.implode('.', $columns); |
|
| 38 | 38 | $records = MemoryObject::instance()->get($cacheName); |
| 39 | 39 | if ($records === null) { |
| 40 | 40 | $records = parent::all($columns); |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public static function getByPath($path = '') |
| 52 | 52 | { |
| 53 | - if (MainApp::$Memory->get('cache.content.category.path.' . $path) !== null) { |
|
| 54 | - return MainApp::$Memory->get('cache.content.category.path.' . $path); |
|
| 53 | + if (MainApp::$Memory->get('cache.content.category.path.'.$path) !== null) { |
|
| 54 | + return MainApp::$Memory->get('cache.content.category.path.'.$path); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $record = self::where('path', '=', $path)->first(); |
| 58 | - MainApp::$Memory->set('cache.content.category.path.' . $path, $record); |
|
| 58 | + MainApp::$Memory->set('cache.content.category.path.'.$path, $record); |
|
| 59 | 59 | return $record; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public static function getById($id) |
| 68 | 68 | { |
| 69 | - if (MainApp::$Memory->get('cache.content.category.id.' . $id) !== null) { |
|
| 70 | - return MainApp::$Memory->get('cache.content.category.id.' . $id); |
|
| 69 | + if (MainApp::$Memory->get('cache.content.category.id.'.$id) !== null) { |
|
| 70 | + return MainApp::$Memory->get('cache.content.category.id.'.$id); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $record = self::find($id); |
| 74 | - MainApp::$Memory->set('cache.content.category.id.' . $id, $record); |
|
| 74 | + MainApp::$Memory->set('cache.content.category.id.'.$id, $record); |
|
| 75 | 75 | return $record; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | } else { |
| 100 | 100 | // set level marker based on slashes count in pathway |
| 101 | 101 | $slashCount = Str::entryCount($path, '/'); |
| 102 | - for ($i=-1; $i <= $slashCount; $i++) { |
|
| 102 | + for ($i = -1; $i <= $slashCount; $i++) { |
|
| 103 | 103 | $title .= '--'; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | // add canonical title from db |
| 107 | - $title .= ' ' . $data->getLocaled('title'); |
|
| 107 | + $title .= ' '.$data->getLocaled('title'); |
|
| 108 | 108 | // set response as array [id => title, ... ] |
| 109 | 109 | $response[$data->id] = $title; |
| 110 | 110 | } |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | } |
| 13 | 13 | $title = Text::snippet($title, 50); |
| 14 | 14 | $date = Date::humanize($record->created_at); |
| 15 | - $categoryUrl = \App::$Alias->baseUrl . '/content/list/' . $record->cpath; |
|
| 16 | - $categoryLink = '<a href="' . $categoryUrl . '">' . \App::$Translate->getLocaleText($record->ctitle) . '</a>'; |
|
| 17 | - $newsLink = \App::$Alias->baseUrl . '/content/read/' . $record->cpath; |
|
| 18 | - $newsLink = rtrim($newsLink, '/') . '/' . $record->path; |
|
| 15 | + $categoryUrl = \App::$Alias->baseUrl.'/content/list/'.$record->cpath; |
|
| 16 | + $categoryLink = '<a href="'.$categoryUrl.'">'.\App::$Translate->getLocaleText($record->ctitle).'</a>'; |
|
| 17 | + $newsLink = \App::$Alias->baseUrl.'/content/read/'.$record->cpath; |
|
| 18 | + $newsLink = rtrim($newsLink, '/').'/'.$record->path; |
|
| 19 | 19 | |
| 20 | 20 | echo '<div class="row"><div class="col-md-12">'; |
| 21 | - echo '<a href="' . $newsLink . '">→ ' . $title . '</a><br />'; |
|
| 22 | - echo '<small class="pull-left">' . $categoryLink . '</small>'; |
|
| 23 | - echo '<small class="pull-right">' . $date . '</small>'; |
|
| 21 | + echo '<a href="'.$newsLink.'">→ '.$title.'</a><br />'; |
|
| 22 | + echo '<small class="pull-left">'.$categoryLink.'</small>'; |
|
| 23 | + echo '<small class="pull-right">'.$date.'</small>'; |
|
| 24 | 24 | echo '</div></div>'; |
| 25 | 25 | echo '<hr class="pretty" />'; |
| 26 | 26 | } |
@@ -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; |