@@ -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 |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | { |
34 | 34 | $cfg = $this->getConfigs(); |
35 | 35 | // check cache is defined |
36 | - if (!$this->cache|| !Any::isInt($this->cache)) { |
|
37 | - $this->cache = (int)$cfg['cache']; |
|
36 | + if (!$this->cache || !Any::isInt($this->cache)) { |
|
37 | + $this->cache = (int) $cfg['cache']; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // check tag count is defined |
41 | 41 | if (!$this->count || !Any::isInt($this->count)) { |
42 | - $this->count = (int)$cfg['count']; |
|
42 | + $this->count = (int) $cfg['count']; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $this->_lang = App::$Request->getLanguage(); |
46 | - $this->_cacheName = 'widget.contenttag.' . $this->createStringClassSnapshotHash(); |
|
46 | + $this->_cacheName = 'widget.contenttag.'.$this->createStringClassSnapshotHash(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } else { |
61 | 61 | $cache = App::$Cache->getItem($this->_cacheName); |
62 | 62 | if (!$cache->isHit()) { |
63 | - $cache->set($this->makeQuery())->expiresAfter((int)$this->cache); |
|
63 | + $cache->set($this->makeQuery())->expiresAfter((int) $this->cache); |
|
64 | 64 | App::$Cache->save($cache); |
65 | 65 | } |
66 | 66 | $records = $cache->get(); |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $user = App::$User->identity(); |
93 | 93 | // user is not authed ? |
94 | 94 | if (!$user || !App::$User->isAuth()) { |
95 | - $redirectUrl = App::$Alias->scriptUrl . '/user/login'; |
|
95 | + $redirectUrl = App::$Alias->scriptUrl.'/user/login'; |
|
96 | 96 | App::$Response->redirect($redirectUrl, true); |
97 | 97 | exit(); |
98 | 98 | } |
99 | 99 | |
100 | - $permission = env_name . '/' . App::$Request->getController() . '/' . App::$Request->getAction(); |
|
100 | + $permission = env_name.'/'.App::$Request->getController().'/'.App::$Request->getAction(); |
|
101 | 101 | // doesn't have permission? get the f*ck out |
102 | 102 | if (!$user->role->can($permission)) { |
103 | 103 | throw new ForbiddenException(__('You got no access rights to this page')); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function getConfigs(): ?array |
149 | 149 | { |
150 | - $configs = $this->type === 'widget' ? (array)$this->widget->configs : (array)$this->application->configs; |
|
150 | + $configs = $this->type === 'widget' ? (array) $this->widget->configs : (array) $this->application->configs; |
|
151 | 151 | foreach ($configs as $cfg => $value) { |
152 | 152 | if (Any::isInt($value)) { |
153 | 153 | $configs[$cfg] = $value; |
@@ -25,9 +25,9 @@ |
||
25 | 25 | */ |
26 | 26 | public function deleteRoute(): ?string |
27 | 27 | { |
28 | - $type = (string)$this->request->query->get('type'); |
|
29 | - $loader = (string)$this->request->query->get('loader'); |
|
30 | - $source = Str::lowerCase((string)$this->request->query->get('path')); |
|
28 | + $type = (string) $this->request->query->get('type'); |
|
29 | + $loader = (string) $this->request->query->get('loader'); |
|
30 | + $source = Str::lowerCase((string) $this->request->query->get('path')); |
|
31 | 31 | |
32 | 32 | $model = new EntityDeleteRoute($type, $loader, $source); |
33 | 33 | if ($model->send() && $model->validate()) { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | public function files(): ?string |
25 | 25 | { |
26 | 26 | return $this->view->render('main/files', [ |
27 | - 'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . $this->request->getLanguage() |
|
27 | + 'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.$this->request->getLanguage() |
|
28 | 28 | ]); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $search = \Apps\ActiveRecord\App::getItem('widget', $controller); |
83 | 83 | |
84 | 84 | // check what we got |
85 | - if (!$search || (int)$search->id < 1) { |
|
85 | + if (!$search || (int) $search->id < 1) { |
|
86 | 86 | throw new NotFoundException('Widget is not founded'); |
87 | 87 | } |
88 | 88 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ->first(); |
118 | 118 | |
119 | 119 | // check if widget admin controller exists |
120 | - if (!$record || (int)$record->id < 1) { |
|
120 | + if (!$record || (int) $record->id < 1) { |
|
121 | 121 | throw new ForbiddenException('Widget is not founded'); |
122 | 122 | } |
123 | 123 |