@@ -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; |
@@ -34,12 +34,12 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function make() |
| 36 | 36 | { |
| 37 | - $archive = $this->name . '.zip'; |
|
| 37 | + $archive = $this->name.'.zip'; |
|
| 38 | 38 | // download archive |
| 39 | - File::saveFromUrl($this->url, '/' . $archive); |
|
| 39 | + File::saveFromUrl($this->url, '/'.$archive); |
|
| 40 | 40 | // extract archive |
| 41 | 41 | $zip = new \ZipArchive(); |
| 42 | - if ($zip->open(root . '/' . $archive) === true) { |
|
| 42 | + if ($zip->open(root.'/'.$archive) === true) { |
|
| 43 | 43 | $zip->extractTo(root); |
| 44 | 44 | $zip->close(); |
| 45 | 45 | // cleanup cache |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | // check if SAPI client == cli (php built-in dev server) |
| 15 | 15 | if (php_sapi_name() === 'cli-server') { |
| 16 | - $path = root . DIRECTORY_SEPARATOR . ltrim($uriRequest, '/'); |
|
| 16 | + $path = root.DIRECTORY_SEPARATOR.ltrim($uriRequest, '/'); |
|
| 17 | 17 | // if static file exist |
| 18 | 18 | if (is_file($path)) { |
| 19 | 19 | // check if it looks like standalone php script |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | // get configs to prepare posible route to switch environment |
| 30 | -$configs = require(root . '/Private/Config/Default.php'); |
|
| 30 | +$configs = require(root.'/Private/Config/Default.php'); |
|
| 31 | 31 | // remove base path |
| 32 | 32 | $uriRequest = substr($uriRequest, strlen($configs['basePath'])); |
| 33 | 33 | $uriArray = explode('/', $uriRequest); |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | $uriLoader = ucfirst(strtolower(str_replace('.', '', $uriLoader))); |
| 39 | 39 | |
| 40 | 40 | // if loader of interface is available - require it |
| 41 | -if (in_array($uriLoader, $loaderList, true) && file_exists(root . '/Loader/' . $uriLoader . '/index.php')) { |
|
| 42 | - require_once (root . '/Loader/' . $uriLoader . '/index.php'); |
|
| 41 | +if (in_array($uriLoader, $loaderList, true) && file_exists(root.'/Loader/'.$uriLoader.'/index.php')) { |
|
| 42 | + require_once (root.'/Loader/'.$uriLoader.'/index.php'); |
|
| 43 | 43 | } else { // else - try to load default interface |
| 44 | - require_once (root . '/Loader/Front/index.php'); |
|
| 44 | + require_once (root.'/Loader/Front/index.php'); |
|
| 45 | 45 | } |
| 46 | 46 | \ No newline at end of file |
@@ -45,10 +45,10 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | public static function check($user1, $user2) |
| 47 | 47 | { |
| 48 | - $query = self::where(function ($query) use ($user1, $user2) { |
|
| 48 | + $query = self::where(function($query) use ($user1, $user2) { |
|
| 49 | 49 | $query->where('user_id', '=', $user1) |
| 50 | 50 | ->where('target_id', '=', $user2); |
| 51 | - })->orWhere(function ($query) use ($user1, $user2) { |
|
| 51 | + })->orWhere(function($query) use ($user1, $user2) { |
|
| 52 | 52 | $query->where('user_id', '=', $user2) |
| 53 | 53 | ->where('target_id', '=', $user1); |
| 54 | 54 | }); |
@@ -86,15 +86,15 @@ |
||
| 86 | 86 | public function getAnswerCount() |
| 87 | 87 | { |
| 88 | 88 | // check if count is cached |
| 89 | - if (MainApp::$Memory->get('commentpost.answer.count.' . $this->id) !== null) { |
|
| 90 | - return MainApp::$Memory->get('commentpost.answer.count.' . $this->id); |
|
| 89 | + if (MainApp::$Memory->get('commentpost.answer.count.'.$this->id) !== null) { |
|
| 90 | + return MainApp::$Memory->get('commentpost.answer.count.'.$this->id); |
|
| 91 | 91 | } |
| 92 | 92 | // get count from db |
| 93 | 93 | $count = CommentAnswer::where('comment_id', '=', $this->id) |
| 94 | 94 | ->where('moderate', '=', 0) |
| 95 | 95 | ->count(); |
| 96 | 96 | // save in cache |
| 97 | - MainApp::$Memory->set('commentpost.answer.count.' . $this->id, $count); |
|
| 97 | + MainApp::$Memory->set('commentpost.answer.count.'.$this->id, $count); |
|
| 98 | 98 | return $count; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // check in cache |
| 64 | - if (MainApp::$Memory->get('profile.object.cache.' . $userId) !== null) { |
|
| 65 | - return MainApp::$Memory->get('profile.object.cache.' . $userId); |
|
| 64 | + if (MainApp::$Memory->get('profile.object.cache.'.$userId) !== null) { |
|
| 65 | + return MainApp::$Memory->get('profile.object.cache.'.$userId); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // find row |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $object = $profile->first(); |
| 77 | 77 | |
| 78 | - MainApp::$Memory->set('profile.object.cache.' . $userId, $object); |
|
| 78 | + MainApp::$Memory->set('profile.object.cache.'.$userId, $object); |
|
| 79 | 79 | return $object; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getAvatarUrl($type = 'small') |
| 88 | 88 | { |
| 89 | - $default = '/upload/user/avatar/' . $type . '/default.jpg'; |
|
| 89 | + $default = '/upload/user/avatar/'.$type.'/default.jpg'; |
|
| 90 | 90 | if (!Arr::in($type, ['small', 'big', 'medium'])) { |
| 91 | - return MainApp::$Alias->scriptUrl . $default; |
|
| 91 | + return MainApp::$Alias->scriptUrl.$default; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $route = '/upload/user/avatar/' . $type . '/' . $this->user_id . '.jpg'; |
|
| 94 | + $route = '/upload/user/avatar/'.$type.'/'.$this->user_id.'.jpg'; |
|
| 95 | 95 | if (File::exist($route)) { |
| 96 | - return MainApp::$Alias->scriptUrl . $route . '?mtime=' . File::mTime($route); |
|
| 96 | + return MainApp::$Alias->scriptUrl.$route.'?mtime='.File::mTime($route); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return MainApp::$Alias->scriptUrl . $default; |
|
| 99 | + return MainApp::$Alias->scriptUrl.$default; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $userNick = $this->nick; |
| 109 | 109 | if ($userNick === null || Str::likeEmpty($userNick)) { |
| 110 | - $userNick = 'id' . $this->id; |
|
| 110 | + $userNick = 'id'.$this->id; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $userNick; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function all($columns = ['*']) |
| 45 | 45 | { |
| 46 | - $cacheName = 'activercord.app.all.' . implode('.', $columns); |
|
| 46 | + $cacheName = 'activercord.app.all.'.implode('.', $columns); |
|
| 47 | 47 | $records = MemoryObject::instance()->get($cacheName); |
| 48 | 48 | if ($records === null) { |
| 49 | 49 | $records = parent::all($columns); |
@@ -181,15 +181,15 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function getScriptVersion() |
| 183 | 183 | { |
| 184 | - $class = 'Apps\Controller\Admin\\' . $this->sys_name; |
|
| 184 | + $class = 'Apps\Controller\Admin\\'.$this->sys_name; |
|
| 185 | 185 | if (!class_exists($class)) { |
| 186 | 186 | return false; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - if (!defined($class . '::VERSION')) { |
|
| 189 | + if (!defined($class.'::VERSION')) { |
|
| 190 | 190 | return false; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - return constant($class . '::VERSION'); |
|
| 193 | + return constant($class.'::VERSION'); |
|
| 194 | 194 | } |
| 195 | 195 | } |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // check if id is looks like integer |
| 53 | - if (!Any::isInt($id) || (int)$id < 1) { |
|
| 53 | + if (!Any::isInt($id) || (int) $id < 1) { |
|
| 54 | 54 | return null; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // check in memory cache object |
| 58 | - if (MainApp::$Memory->get('user.object.cache.' . $id) !== null) { |
|
| 59 | - return MainApp::$Memory->get('user.object.cache.' . $id); |
|
| 58 | + if (MainApp::$Memory->get('user.object.cache.'.$id) !== null) { |
|
| 59 | + return MainApp::$Memory->get('user.object.cache.'.$id); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // not founded in memory? lets make query |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ->find($id); |
| 65 | 65 | |
| 66 | 66 | // store cache and return object |
| 67 | - MainApp::$Memory->set('user.object.cache.' . $user->id, $user); |
|
| 67 | + MainApp::$Memory->set('user.object.cache.'.$user->id, $user); |
|
| 68 | 68 | return $user; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getId(): ?int |
| 76 | 76 | { |
| 77 | - return (int)$this->id; |
|
| 77 | + return (int) $this->id; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public static function isAuth(): bool |
| 96 | 96 | { |
| 97 | 97 | // get data from session |
| 98 | - $sessionUserId = (int)MainApp::$Session->get('ff_user_id', 0); |
|
| 98 | + $sessionUserId = (int) MainApp::$Session->get('ff_user_id', 0); |
|
| 99 | 99 | |
| 100 | 100 | // check if session contains user id data |
| 101 | 101 | if ($sessionUserId < 1) { |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $find = MainApp::$Memory->get('user.counter.cache.' . $id); |
|
| 131 | + $find = MainApp::$Memory->get('user.counter.cache.'.$id); |
|
| 132 | 132 | if (!$find) { |
| 133 | 133 | $find = self::where('id', $id)->count(); |
| 134 | - MainApp::$Memory->set('user.counter.cache.' . $id, $find); |
|
| 134 | + MainApp::$Memory->set('user.counter.cache.'.$id, $find); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | return $find === 1; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function inBlacklist(?string $target = null): bool |
| 233 | 233 | { |
| 234 | - if ($target === null || (int)$target < 1) { |
|
| 234 | + if ($target === null || (int) $target < 1) { |
|
| 235 | 235 | return false; |
| 236 | 236 | } |
| 237 | 237 | |