@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | foreach ($records as $item) { |
47 | 47 | $message = Text::cut(\App::$Security->strip_tags($item->message), 0, 75); |
48 | 48 | |
49 | - $moderate = (bool)$item->moderate; |
|
49 | + $moderate = (bool) $item->moderate; |
|
50 | 50 | // if even one moderate item is found - change global flag to true |
51 | 51 | if ($moderate) { |
52 | 52 | $moderateIsFound = true; |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | $table->row([ |
67 | 67 | ['text' => $item->id], |
68 | 68 | ['text' => Url::a(['comments/read', [$item->id]], $message), 'html' => true], |
69 | - ['text' => '<span class="badge badge-light">' . $item->getAnswerCount() . '</span>', 'html' => true], |
|
70 | - ['text' => Simplify::parseUserLink((int)$item->user_id, $item->guest_name, 'user/update'), 'html' => true], |
|
71 | - ['text' => '<a href="'.Url::stringUrl($item->app_name . '/comments/' . $item->app_relation_id).'" target="_blank">' . $item->app_name . '/' . $item->app_relation_id . '</a>', 'html' => true], |
|
69 | + ['text' => '<span class="badge badge-light">'.$item->getAnswerCount().'</span>', 'html' => true], |
|
70 | + ['text' => Simplify::parseUserLink((int) $item->user_id, $item->guest_name, 'user/update'), 'html' => true], |
|
71 | + ['text' => '<a href="'.Url::stringUrl($item->app_name.'/comments/'.$item->app_relation_id).'" target="_blank">'.$item->app_name.'/'.$item->app_relation_id.'</a>', 'html' => true], |
|
72 | 72 | ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)], |
73 | 73 | ['text' => $btngrp->display(), 'html' => true |
74 | 74 | ], |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | foreach ($records as $item) { |
46 | 46 | /** @var \Apps\ActiveRecord\CommentAnswer $item */ |
47 | 47 | $message = Text::cut(\App::$Security->strip_tags($item->message), 0, 75); |
48 | - $moderate = (bool)$item->moderate; |
|
48 | + $moderate = (bool) $item->moderate; |
|
49 | 49 | if ($moderate) { |
50 | 50 | $moderateIsFound = true; |
51 | 51 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | |
62 | 62 | $table->row([ |
63 | 63 | ['text' => $item->id], |
64 | - ['text' => '<div>' . Url::a(['comments/read', [$item->comment_id]], $message) . '</div><small class="text-muted">→' . Text::snippet(\App::$Security->strip_tags($item->post->message), 50) . '</small>' , 'html' => true], |
|
65 | - ['text' => Simplify::parseUserLink((int)$item->user_id, $item->guest_name, 'user/update'), 'html' => true], |
|
64 | + ['text' => '<div>'.Url::a(['comments/read', [$item->comment_id]], $message).'</div><small class="text-muted">→'.Text::snippet(\App::$Security->strip_tags($item->post->message), 50).'</small>', 'html' => true], |
|
65 | + ['text' => Simplify::parseUserLink((int) $item->user_id, $item->guest_name, 'user/update'), 'html' => true], |
|
66 | 66 | ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)], |
67 | 67 | ['text' => $btngrp->display(), 'html' => true |
68 | 68 | ] |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $author = Url::a(['user/update', [$record->user_id]], $author); |
32 | 32 | } |
33 | 33 | ?> |
34 | - <?= $author . ', ' . Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR) ?> |
|
34 | + <?= $author.', '.Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR) ?> |
|
35 | 35 | <div class="pull-right"> |
36 | 36 | <?php |
37 | 37 | $btngrp = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ?> |
45 | 45 | </div> |
46 | 46 | </div> |
47 | - <div class="card-body<?= ((bool)$record->moderate ? ' text-warning' : null) ?>"> |
|
47 | + <div class="card-body<?= ((bool) $record->moderate ? ' text-warning' : null) ?>"> |
|
48 | 48 | <?= $record->message ?> |
49 | 49 | </div> |
50 | 50 | </div> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <?php |
65 | 65 | $answerAuthor = Simplify::parseUserLink($answer->user_id, $answer->guest_name, 'user/update'); |
66 | 66 | ?> |
67 | - <?= $answerAuthor . ', ' . Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR) ?> |
|
67 | + <?= $answerAuthor.', '.Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR) ?> |
|
68 | 68 | <div class="pull-right"> |
69 | 69 | <?php |
70 | 70 | $btngrp = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ?> |
78 | 78 | </div> |
79 | 79 | </div> |
80 | - <div class="card-body<?= ((bool)$answer->moderate ? ' text-warning' : null)?>"> |
|
80 | + <div class="card-body<?= ((bool) $answer->moderate ? ' text-warning' : null)?>"> |
|
81 | 81 | <?= $answer->message ?> |
82 | 82 | </div> |
83 | 83 | </div> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (!$this->_content->id) { |
65 | 65 | $this->_new = true; |
66 | 66 | if (!$this->galleryFreeId) { |
67 | - $this->galleryFreeId = '_tmp_' . Str::randomLatin(mt_rand(16, 32)); |
|
67 | + $this->galleryFreeId = '_tmp_'.Str::randomLatin(mt_rand(16, 32)); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if (!$this->authorId) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->categoryId = 1; |
76 | 76 | } |
77 | 77 | if (!$this->path) { |
78 | - $this->path = Integer::random(8) . '-' . date('d-m-Y'); |
|
78 | + $this->path = Integer::random(8).'-'.date('d-m-Y'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if ($this->cloneId > 0) { |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | public function rules(): array |
114 | 114 | { |
115 | 115 | $res = [ |
116 | - ['title.' . App::$Request->getLanguage(), 'required'], |
|
117 | - ['text.' . App::$Request->getLanguage(), 'required'], |
|
116 | + ['title.'.App::$Request->getLanguage(), 'required'], |
|
117 | + ['text.'.App::$Request->getLanguage(), 'required'], |
|
118 | 118 | ['text', 'used'], |
119 | 119 | ['path', 'reverse_match', '/[\/\'~`\!@#\$%\^&\*\(\)+=\{\}\[\]\|;:"\<\>,\?\\\]/'], |
120 | 120 | [['path', 'categoryId', 'authorId', 'display', 'galleryFreeId', 'title', 'important'], 'required'], |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | ]; |
128 | 128 | |
129 | 129 | foreach (App::$Properties->get('languages') as $lang) { |
130 | - $res[] = ['title.' . $lang, 'length_max', 120, null, true, true]; |
|
131 | - $res[] = ['keywords.' . $lang, 'length_max', 150]; |
|
132 | - $res[] = ['description.' . $lang, 'length_max', 250]; |
|
130 | + $res[] = ['title.'.$lang, 'length_max', 120, null, true, true]; |
|
131 | + $res[] = ['keywords.'.$lang, 'length_max', 150]; |
|
132 | + $res[] = ['description.'.$lang, 'length_max', 250]; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $res; |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | $this->_content->meta_keywords = $this->metaKeywords; |
186 | 186 | $this->_content->meta_description = $this->metaDescription; |
187 | 187 | $this->_content->source = $this->source; |
188 | - $this->_content->important = (int)$this->important; |
|
188 | + $this->_content->important = (int) $this->important; |
|
189 | 189 | // check if rating is changed |
190 | - if ((int)$this->addRating !== 0) { |
|
191 | - $this->_content->rating += (int)$this->addRating; |
|
190 | + if ((int) $this->addRating !== 0) { |
|
191 | + $this->_content->rating += (int) $this->addRating; |
|
192 | 192 | } |
193 | 193 | // check if special comment hash is exist |
194 | 194 | if ($this->_new || Str::length($this->_content->comment_hash) < 32) { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | // save poster data |
204 | - $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster; |
|
204 | + $posterPath = '/upload/gallery/'.$this->galleryFreeId.'/orig/'.$this->poster; |
|
205 | 205 | if (File::exist($posterPath)) { |
206 | 206 | $this->_content->poster = $this->poster; |
207 | 207 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | // move files |
238 | 238 | if ($tmpGalleryId !== $this->_content->id) { |
239 | - Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id); |
|
239 | + Directory::rename('/upload/gallery/'.$tmpGalleryId, $this->_content->id); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $search = \Apps\ActiveRecord\App::getItem('app', $controller); |
85 | 85 | |
86 | 86 | // check what we got |
87 | - if ($search === null || (int)$search->id < 1) { |
|
87 | + if ($search === null || (int) $search->id < 1) { |
|
88 | 88 | throw new NotFoundException('App is not founded'); |
89 | 89 | } |
90 | 90 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $search = \Apps\ActiveRecord\App::where('sys_name', $controllerName) |
117 | 117 | ->where('type', 'app') |
118 | 118 | ->first(); |
119 | - if (!$search || (int)$search->id < 1) { |
|
119 | + if (!$search || (int) $search->id < 1) { |
|
120 | 120 | throw new ForbiddenException('App is not founded'); |
121 | 121 | } |
122 | 122 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | public function tryAuth(): bool |
71 | 71 | { |
72 | 72 | /** @var User $user */ |
73 | - $user = App::$User->where(function ($q) { |
|
73 | + $user = App::$User->where(function($q) { |
|
74 | 74 | $q->where('login', $this->login) |
75 | 75 | ->orWhere('email', $this->login); |
76 | 76 | })->first(); |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | // build sitemap items using iteration - 5000 rows per each one |
42 | - $iterations = (int)($contentCount / self::$contentRowsEachRun); |
|
42 | + $iterations = (int) ($contentCount / self::$contentRowsEachRun); |
|
43 | 43 | for ($i = 0; $i <= $iterations; $i++) { |
44 | 44 | // check if lifetime is expired for current sitemap index |
45 | - $xmlTime = File::mTime('/upload/sitemap/content.' . $i . '.' . $langs[0] . '.xml'); |
|
45 | + $xmlTime = File::mTime('/upload/sitemap/content.'.$i.'.'.$langs[0].'.xml'); |
|
46 | 46 | $updateDelay = self::$updateSitemapDelay * 60; |
47 | 47 | $updateDelay += mt_rand(0, 1800); // +- 0-30 rand min for caching update |
48 | 48 | // do not process if cache time is not expired |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** @var \Apps\ActiveRecord\Content $content */ |
63 | 63 | $uri = '/content/read/'; |
64 | 64 | if (!Str::likeEmpty($content->category->path)) { |
65 | - $uri .= $content->category->path . '/'; |
|
65 | + $uri .= $content->category->path.'/'; |
|
66 | 66 | } |
67 | 67 | $uri .= $content->path; |
68 | 68 | $sitemap->add($uri, $content->created_at, 'weekly', 0.7); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | // add categories |
71 | 71 | $categories = ContentCategory::all(); |
72 | 72 | foreach ($categories as $item) { |
73 | - if ((bool)$item->getProperty('showCategory')) { |
|
74 | - $uri = '/content/list/' . $item->path; |
|
73 | + if ((bool) $item->getProperty('showCategory')) { |
|
74 | + $uri = '/content/list/'.$item->path; |
|
75 | 75 | $sitemap->add($uri, date('c'), 'daily', 0.9); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | // save data to xml file |
79 | - $sitemap->save('content.' . $i); |
|
79 | + $sitemap->save('content.'.$i); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -30,14 +30,14 @@ |
||
30 | 30 | // check if search query passed |
31 | 31 | $query = $this->request->query->get('search', null); |
32 | 32 | if ($query && Any::isStr($query) && Str::length($query) > 1) { |
33 | - $record = $record->where(function ($db) use ($query) { |
|
34 | - $db->where('login', 'like', '%' . $query . '%') |
|
35 | - ->orWhere('email', 'like', '%' . $query . '%'); |
|
33 | + $record = $record->where(function($db) use ($query) { |
|
34 | + $db->where('login', 'like', '%'.$query.'%') |
|
35 | + ->orWhere('email', 'like', '%'.$query.'%'); |
|
36 | 36 | }); |
37 | 37 | } |
38 | 38 | |
39 | 39 | // set current page num and offset |
40 | - $page = (int)$this->request->query->get('page', 0); |
|
40 | + $page = (int) $this->request->query->get('page', 0); |
|
41 | 41 | $offset = $page * self::ITEM_PER_PAGE; |
42 | 42 | |
43 | 43 | // prepare pagination data |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!$this->count) { |
39 | - $this->count = (int)$cfg['count']; |
|
39 | + $this->count = (int) $cfg['count']; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if (!$this->cache) { |
43 | - $this->cache = (int)$cfg['cache']; |
|
43 | + $this->cache = (int) $cfg['cache']; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if (!$this->lang) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | - $this->_cacheName = 'widget.newcomment.' . $this->createStringClassSnapshotHash(); |
|
51 | + $this->_cacheName = 'widget.newcomment.'.$this->createStringClassSnapshotHash(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | { |
62 | 62 | // work with cache and make query |
63 | 63 | $records = null; |
64 | - if ((int)$this->cache > 0) { |
|
64 | + if ((int) $this->cache > 0) { |
|
65 | 65 | // process caching data |
66 | 66 | $cache = App::$Cache->getItem($this->_cacheName); |
67 | 67 | if (!$cache->isHit()) { |
68 | 68 | $cache->set($this->makeQuery()); |
69 | - $cache->expiresAfter((int)$this->cache); |
|
69 | + $cache->expiresAfter((int) $this->cache); |
|
70 | 70 | App::$Cache->save($cache); |
71 | 71 | } |
72 | 72 |