@@ -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([ |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | <div class="col-md-6"> |
| 30 | 30 | <?php |
| 31 | 31 | if ($type === 'trash') { |
| 32 | - echo Url::a(['content/clear'], '<i class="fa fa-minus"></i> ' . __('Remove all'), ['class' => 'btn btn-danger', 'html' => true]); |
|
| 32 | + echo Url::a(['content/clear'], '<i class="fa fa-minus"></i> '.__('Remove all'), ['class' => 'btn btn-danger', 'html' => true]); |
|
| 33 | 33 | } else { |
| 34 | - echo Url::a(['content/update'], '<i class="fa fa-plus"></i> ' . __('Add content'), ['class' => 'btn btn-primary', 'html' => true]); |
|
| 34 | + echo Url::a(['content/update'], '<i class="fa fa-plus"></i> '.__('Add content'), ['class' => 'btn btn-primary', 'html' => true]); |
|
| 35 | 35 | } |
| 36 | 36 | ?> |
| 37 | 37 | </div> |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | <i class="fa fa-filter"></i> <?= __('Filters') ?> |
| 55 | 55 | </button> |
| 56 | 56 | <div class="dropdown-menu" aria-labelledby="btnCategories"> |
| 57 | - <?= Url::a(['content/index', null, ['type' => 'all']], '<i class="fa fa-list"></i> ' . __('All'), ['class' => 'dropdown-item', 'html' => true]) ?> |
|
| 58 | - <?= Url::a(['content/index', null, ['type' => 'moderate']], '<i class="fa fa-exclamation"></i> ' . __('Moderate'), ['class' => 'dropdown-item', 'html' => true]) ?> |
|
| 59 | - <?= Url::a(['content/index', null, ['type' => 'trash']], '<i class="fa fa-trash"></i> ' . __('Trash'), ['class' => 'dropdown-item', 'html' => true]) ?> |
|
| 57 | + <?= Url::a(['content/index', null, ['type' => 'all']], '<i class="fa fa-list"></i> '.__('All'), ['class' => 'dropdown-item', 'html' => true]) ?> |
|
| 58 | + <?= Url::a(['content/index', null, ['type' => 'moderate']], '<i class="fa fa-exclamation"></i> '.__('Moderate'), ['class' => 'dropdown-item', 'html' => true]) ?> |
|
| 59 | + <?= Url::a(['content/index', null, ['type' => 'trash']], '<i class="fa fa-trash"></i> '.__('Trash'), ['class' => 'dropdown-item', 'html' => true]) ?> |
|
| 60 | 60 | </div> |
| 61 | 61 | </div> |
| 62 | 62 | </div> |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | if (!$content->category) { |
| 86 | 86 | continue; |
| 87 | 87 | } |
| 88 | - $frontLink = \App::$Alias->scriptUrl . '/content/read'; |
|
| 88 | + $frontLink = \App::$Alias->scriptUrl.'/content/read'; |
|
| 89 | 89 | if (!Str::likeEmpty($content->category->path)) { |
| 90 | - $frontLink .= '/' . $content->category->path; |
|
| 90 | + $frontLink .= '/'.$content->category->path; |
|
| 91 | 91 | } |
| 92 | - $frontLink .= '/' . $content->path; |
|
| 92 | + $frontLink .= '/'.$content->path; |
|
| 93 | 93 | |
| 94 | 94 | $actionMenu = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm', 'dropdown' => ['class' => 'btn-group btn-group-sm']], 2); |
| 95 | - if (!(bool)$content->display) { |
|
| 95 | + if (!(bool) $content->display) { |
|
| 96 | 96 | $actionMenu->add('<i class="fa fa-eye-slash" style="color: #ff0000;"></i>', ['content/display', [$content->id], ['status' => 1]], [ |
| 97 | 97 | 'html' => true, |
| 98 | 98 | 'class' => 'btn btn-light', |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ]); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (!(bool)$content->important) { |
|
| 111 | + if (!(bool) $content->important) { |
|
| 112 | 112 | $actionMenu->add('<i class="fa fa-star-o"></i>', ['content/important', [$content->id], ['status' => 1]], [ |
| 113 | 113 | 'html' => true, |
| 114 | 114 | 'class' => 'btn btn-light', |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $hiddenExist = true; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $contentInfo = '<div>' . Url::a(['content/update', [$content->id]], $content->getLocaled('title')) . '</div>'; |
|
| 141 | + $contentInfo = '<div>'.Url::a(['content/update', [$content->id]], $content->getLocaled('title')).'</div>'; |
|
| 142 | 142 | $contentInfo .= '<div class="small">'; |
| 143 | 143 | $contentInfo .= __('Category: <a href="%url%">%name%</a>', ['name' => $content->category->getLocaled('title'), 'url' => Url::to('content/categoryupdate', [$content->category_id])]); |
| 144 | 144 | $contentInfo .= '</div>'; |
@@ -54,8 +54,8 @@ |
||
| 54 | 54 | $table->row([ |
| 55 | 55 | ['text' => $row->id], |
| 56 | 56 | ['text' => $row->getLocaled('name')], |
| 57 | - ['text' => '<span class="' . $labelClass . '">' . $row->type . '</span>', 'html' => true], |
|
| 58 | - ['text' => '<code>' . ($row->reg_cond == 0 ? '!' : null) . 'preg_match("' . $row->reg_exp . '", input)' . '</code>', 'html' => true], |
|
| 57 | + ['text' => '<span class="'.$labelClass.'">'.$row->type.'</span>', 'html' => true], |
|
| 58 | + ['text' => '<code>'.($row->reg_cond == 0 ? '!' : null).'preg_match("'.$row->reg_exp.'", input)'.'</code>', 'html' => true], |
|
| 59 | 59 | ['text' => $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']) |
| 60 | 60 | ->add('<i class="fa fa-pencil"></i>', ['profile/fieldupdate', [$row->id]], ['class' => 'btn btn-primary', 'html' => true]) |
| 61 | 61 | ->add('<i class="fa fa-trash-o"></i>', ['profile/fielddelete', [$row->id]], ['class' => 'btn btn-danger', 'html' => true]) |