@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function all($columns = ['*']) |
40 | 40 | { |
41 | - $cacheName = 'activerecord.contentcategory.all.' . implode('.', $columns); |
|
41 | + $cacheName = 'activerecord.contentcategory.all.'.implode('.', $columns); |
|
42 | 42 | $records = MemoryObject::instance()->get($cacheName); |
43 | 43 | if (!$records) { |
44 | 44 | $records = parent::all($columns); |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public static function getByPath($path = '') |
56 | 56 | { |
57 | - if (MainApp::$Memory->get('cache.content.category.path.' . $path) !== null) { |
|
58 | - return MainApp::$Memory->get('cache.content.category.path.' . $path); |
|
57 | + if (MainApp::$Memory->get('cache.content.category.path.'.$path) !== null) { |
|
58 | + return MainApp::$Memory->get('cache.content.category.path.'.$path); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $record = self::where('path', $path)->first(); |
62 | - MainApp::$Memory->set('cache.content.category.path.' . $path, $record); |
|
62 | + MainApp::$Memory->set('cache.content.category.path.'.$path, $record); |
|
63 | 63 | return $record; |
64 | 64 | } |
65 | 65 | |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function getById($id) |
72 | 72 | { |
73 | - if (MainApp::$Memory->get('cache.content.category.id.' . $id) !== null) { |
|
74 | - return MainApp::$Memory->get('cache.content.category.id.' . $id); |
|
73 | + if (MainApp::$Memory->get('cache.content.category.id.'.$id) !== null) { |
|
74 | + return MainApp::$Memory->get('cache.content.category.id.'.$id); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $record = self::find($id); |
78 | - MainApp::$Memory->set('cache.content.category.id.' . $id, $record); |
|
78 | + MainApp::$Memory->set('cache.content.category.id.'.$id, $record); |
|
79 | 79 | return $record; |
80 | 80 | } |
81 | 81 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | } else { |
95 | 95 | // set level marker based on slashes count in pathway |
96 | 96 | $slashCount = Str::entryCount($path, '/'); |
97 | - for ($i=-1; $i <= $slashCount; $i++) { |
|
97 | + for ($i = -1; $i <= $slashCount; $i++) { |
|
98 | 98 | $title .= '--'; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | // add canonical title from db |
102 | - $title .= ' ' . $data->getLocaled('title'); |
|
102 | + $title .= ' '.$data->getLocaled('title'); |
|
103 | 103 | // set response as array [id => title, ... ] |
104 | 104 | $response[$data->id] = $title; |
105 | 105 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function all($columns = ['*']) |
35 | 35 | { |
36 | - $cacheName = 'activerecords.role.all.' . implode('.', $columns); |
|
36 | + $cacheName = 'activerecords.role.all.'.implode('.', $columns); |
|
37 | 37 | $records = MemoryObject::instance()->get($cacheName); |
38 | 38 | if ($records === null) { |
39 | 39 | $records = parent::all($columns); |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function get($roleId) |
52 | 52 | { |
53 | - $role = MainApp::$Memory->get('user.role.cache.' . $roleId); |
|
53 | + $role = MainApp::$Memory->get('user.role.cache.'.$roleId); |
|
54 | 54 | |
55 | 55 | // not founded in cache |
56 | 56 | if ($role === null) { |
57 | 57 | $role = self::find($roleId); |
58 | - MainApp::$Memory->set('user.role.cache.' . $roleId, $role); |
|
58 | + MainApp::$Memory->set('user.role.cache.'.$roleId, $role); |
|
59 | 59 | } |
60 | 60 | return $role; |
61 | 61 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function __construct($record, $calcAnswers = true) |
31 | 31 | { |
32 | 32 | $this->_record = $record; |
33 | - $this->_calcAnswers = (bool)$calcAnswers; |
|
33 | + $this->_calcAnswers = (bool) $calcAnswers; |
|
34 | 34 | if ($this->_record instanceof CommentPost) { |
35 | 35 | $this->_type = 'post'; |
36 | 36 | } elseif ($this->_record instanceof CommentAnswer) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | // build user data |
55 | 55 | $userName = __('Unknown'); |
56 | - $userAvatar = App::$Alias->scriptUrl . '/upload/user/avatar/small/default.jpg'; |
|
56 | + $userAvatar = App::$Alias->scriptUrl.'/upload/user/avatar/small/default.jpg'; |
|
57 | 57 | $userColor = 0; |
58 | 58 | if ($this->_record->user && $this->_record->user->id > 0) { |
59 | 59 | $userName = $this->_record->user->profile->getNickname(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'date' => Date::convertToDatetime($this->_record->created_at, Date::FORMAT_TO_HOUR), |
74 | 74 | 'app_name' => $this->_record->app_name, |
75 | 75 | 'app_id' => $this->_record->app_relation_id, |
76 | - 'moderate' => (int)$this->_record->moderate, |
|
76 | + 'moderate' => (int) $this->_record->moderate, |
|
77 | 77 | 'user' => [ |
78 | 78 | 'id' => $this->_record->user_id, |
79 | 79 | 'name' => $userName, |
@@ -32,7 +32,7 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | // build full path |
35 | - $path = '/content/read/' . $content->getPath() . '#comments-list'; |
|
35 | + $path = '/content/read/'.$content->getPath().'#comments-list'; |
|
36 | 36 | |
37 | 37 | // redirect to comment. todo: load all comments and scroll to target by id |
38 | 38 | $this->response->redirect($path); |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | // build sitemap items using iteration - 5000 rows per each one |
43 | - $iterations = (int)($contentCount / self::$contentRowsEachRun); |
|
43 | + $iterations = (int) ($contentCount / self::$contentRowsEachRun); |
|
44 | 44 | for ($i = 0; $i <= $iterations; $i++) { |
45 | 45 | // check if lifetime is expired for current sitemap index |
46 | - $xmlTime = File::mTime('/upload/sitemap/content.' . $i . '.' . $langs[0] . '.xml'); |
|
46 | + $xmlTime = File::mTime('/upload/sitemap/content.'.$i.'.'.$langs[0].'.xml'); |
|
47 | 47 | $updateDelay = self::$updateSitemapDelay * 60; |
48 | 48 | $updateDelay += mt_rand(0, 1800); // +- 0-30 rand min for caching update |
49 | 49 | // do not process if cache time is not expired |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** @var \Apps\ActiveRecord\Content $content */ |
64 | 64 | $uri = '/content/read/'; |
65 | 65 | if (!Str::likeEmpty($content->category->path)) { |
66 | - $uri .= $content->category->path . '/'; |
|
66 | + $uri .= $content->category->path.'/'; |
|
67 | 67 | } |
68 | 68 | $uri .= $content->path; |
69 | 69 | $sitemap->add($uri, $content->created_at, 'weekly', 0.7); |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | // add categories |
72 | 72 | $categories = ContentCategory::all(); |
73 | 73 | foreach ($categories as $item) { |
74 | - if ((bool)$item->getProperty('showCategory')) { |
|
75 | - $uri = '/content/list/' . $item->path; |
|
74 | + if ((bool) $item->getProperty('showCategory')) { |
|
75 | + $uri = '/content/list/'.$item->path; |
|
76 | 76 | $sitemap->add($uri, date('c'), 'daily', 0.9); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | // save data to xml file |
80 | - $sitemap->save('content.' . $i); |
|
80 | + $sitemap->save('content.'.$i); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -25,13 +25,13 @@ |
||
25 | 25 | */ |
26 | 26 | public function display(string $id): void |
27 | 27 | { |
28 | - $status = (bool)$this->request->query->get('status', 0); |
|
28 | + $status = (bool) $this->request->query->get('status', 0); |
|
29 | 29 | $content = \Apps\ActiveRecord\Content::find($id); |
30 | 30 | if (!$content) { |
31 | 31 | throw new NotFoundException(__('Content {%id%} are not exist', ['id' => $id])); |
32 | 32 | } |
33 | 33 | // make update query if status is different than required |
34 | - if ((bool)$content->display !== $status) { |
|
34 | + if ((bool) $content->display !== $status) { |
|
35 | 35 | $content->display = $status; |
36 | 36 | $content->save(); |
37 | 37 | } |
@@ -24,13 +24,13 @@ |
||
24 | 24 | */ |
25 | 25 | public function important(string $id): void |
26 | 26 | { |
27 | - $status = (bool)$this->request->query->get('status', 0); |
|
27 | + $status = (bool) $this->request->query->get('status', 0); |
|
28 | 28 | $content = \Apps\ActiveRecord\Content::find($id); |
29 | 29 | if (!$content) { |
30 | 30 | throw new NotFoundException(__('Content {%id%} are not exist', ['id' => $id])); |
31 | 31 | } |
32 | 32 | |
33 | - if ((bool)$content->important !== $status) { |
|
33 | + if ((bool) $content->important !== $status) { |
|
34 | 34 | $content->important = $status; |
35 | 35 | $content->save(); |
36 | 36 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $actionMenu .= Url::a(['user/delete', [$user->id]], ' <i class="fa fa-trash-o"></i>', ['html' => true, 'class' => 'btn btn-sm btn-danger']); |
61 | 61 | $actionMenu .= '</div>'; |
62 | 62 | |
63 | - $roleHtml = $user->role->color ? '<span class="badge badge-light" style="color: ' . $user->role->color . '">' . $user->role->name . '</span>' : $user->role->name; |
|
63 | + $roleHtml = $user->role->color ? '<span class="badge badge-light" style="color: '.$user->role->color.'">'.$user->role->name.'</span>' : $user->role->name; |
|
64 | 64 | |
65 | 65 | $table->row([ |
66 | 66 | ['text' => $user->id], |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_DAY)], |
71 | 71 | ['text' => $actionMenu, |
72 | 72 | 'properties' => ['class' => 'text-center'], 'html' => true], |
73 | - 'properties' => ['class' => 'checkbox-row' . ($user->approve_token !== null ? ' bg-warning' : null)] |
|
73 | + 'properties' => ['class' => 'checkbox-row'.($user->approve_token !== null ? ' bg-warning' : null)] |
|
74 | 74 | |
75 | 75 | ]); |
76 | 76 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ?> |
33 | 33 | |
34 | 34 | <?php |
35 | -foreach($records as $role) { |
|
35 | +foreach ($records as $role) { |
|
36 | 36 | $permissions = explode(';', $role->permissions); |
37 | 37 | $permissionsLabel = null; |
38 | 38 | foreach ($permissions as $perm) { |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | } else { |
45 | 45 | $labelMark = 'badge-secondary'; |
46 | 46 | } |
47 | - $permissionsLabel .= '<span class="badge ' . $labelMark . '">' . $perm . '</span> '; |
|
47 | + $permissionsLabel .= '<span class="badge '.$labelMark.'">'.$perm.'</span> '; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $roleColor = '-'; |
51 | 51 | if ($role->color) { |
52 | - $roleColor = '<span class="badge badge-light" style="color: ' . $role->color . '">' . $role->color . '</span>'; |
|
52 | + $roleColor = '<span class="badge badge-light" style="color: '.$role->color.'">'.$role->color.'</span>'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $table->row([ |