@@ -168,7 +168,7 @@ |
||
| 168 | 168 | /** |
| 169 | 169 | * Get user person like a object via email |
| 170 | 170 | * @param string|null $email |
| 171 | - * @return null|self |
|
| 171 | + * @return null|ActiveModel |
|
| 172 | 172 | */ |
| 173 | 173 | public static function getIdentityViaEmail(?string $email = null) |
| 174 | 174 | { |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ffcms\Core\App as MainApp; |
| 6 | 6 | use Ffcms\Core\Arch\ActiveModel; |
| 7 | 7 | use Ffcms\Core\Helper\Type\Any; |
| 8 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 9 | 8 | use Ffcms\Core\Helper\Type\Str; |
| 10 | 9 | use Ffcms\Core\Interfaces\iUser; |
| 11 | 10 | |
@@ -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 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | |
| 6 | 6 | use Ffcms\Console\Command; |
| 7 | 7 | use Ffcms\Core\Helper\FileSystem\File; |
| 8 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 9 | 8 | use Ffcms\Core\Helper\Type\Str; |
| 10 | 9 | use Symfony\Component\Console\Input\InputArgument; |
| 11 | 10 | use Symfony\Component\Console\Input\InputInterface; |
@@ -58,9 +58,9 @@ |
||
| 58 | 58 | // work with migration template: read & parse & save |
| 59 | 59 | $tpl = File::read('/Private/Carcase/Migration.tphp'); |
| 60 | 60 | $classContent = Str::replace(['%class%', '%table%'], [$name, $table], $tpl); |
| 61 | - $fullPath = $dir . $name . '-' . $suffix . '.php'; |
|
| 61 | + $fullPath = $dir.$name.'-'.$suffix.'.php'; |
|
| 62 | 62 | File::write($fullPath, $classContent); |
| 63 | 63 | // show success msg |
| 64 | - $output->write('New migration is created: ' . $fullPath); |
|
| 64 | + $output->write('New migration is created: '.$fullPath); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -5,10 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | use Apps\ActiveRecord\Migration; |
| 7 | 7 | use Ffcms\Console\Command; |
| 8 | -use Ffcms\Core\Helper\FileSystem\File; |
|
| 9 | 8 | use Ffcms\Core\Helper\Type\Any; |
| 10 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 11 | -use Ffcms\Core\Helper\Type\Str; |
|
| 12 | 9 | use Ffcms\Core\Managers\MigrationsManager; |
| 13 | 10 | use Symfony\Component\Console\Input\InputArgument; |
| 14 | 11 | use Symfony\Component\Console\Input\InputInterface; |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | // list found migrations and ask to revert each one |
| 52 | 52 | $fired = false; |
| 53 | 53 | foreach ($search as $migration) { |
| 54 | - if (!$this->confirm('Are you sure to revert: ' . $migration)) { |
|
| 54 | + if (!$this->confirm('Are you sure to revert: '.$migration)) { |
|
| 55 | 55 | continue; |
| 56 | 56 | } |
| 57 | 57 | // run down migration |
@@ -3,13 +3,8 @@ |
||
| 3 | 3 | namespace Apps\Console; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | -use Apps\ActiveRecord\Migration; |
|
| 7 | 6 | use Ffcms\Console\Command; |
| 8 | -use Ffcms\Core\Helper\FileSystem\File; |
|
| 9 | 7 | use Ffcms\Core\Helper\Type\Any; |
| 10 | -use Ffcms\Core\Helper\Type\Arr; |
|
| 11 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 12 | -use Ffcms\Core\Helper\Type\Str; |
|
| 13 | 8 | use Ffcms\Core\Managers\MigrationsManager; |
| 14 | 9 | use Symfony\Component\Console\Input\InputArgument; |
| 15 | 10 | use Symfony\Component\Console\Input\InputInterface; |
@@ -51,11 +51,11 @@ |
||
| 51 | 51 | // require confirmation from user each ever migration file |
| 52 | 52 | $fired = false; |
| 53 | 53 | foreach ($search as $migration) { |
| 54 | - if (!$this->confirm('Are you sure to apply migration: ' . $migration, true)) { |
|
| 54 | + if (!$this->confirm('Are you sure to apply migration: '.$migration, true)) { |
|
| 55 | 55 | continue; |
| 56 | 56 | } |
| 57 | 57 | $manager->makeUp($migration); |
| 58 | - $fired = true; |
|
| 58 | + $fired = true; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if ($fired) { |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | use Ffcms\Core\Helper\FileSystem\Directory; |
| 12 | 12 | use Ffcms\Core\Helper\FileSystem\File; |
| 13 | 13 | use Ffcms\Core\Helper\Type\Any; |
| 14 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 15 | 14 | use Ffcms\Core\Helper\Type\Str; |
| 16 | 15 | |
| 17 | 16 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if ($this->_content->id === null) { |
| 60 | 60 | $this->_new = true; |
| 61 | 61 | if (!$this->galleryFreeId) { |
| 62 | - $this->galleryFreeId = '_tmp_' . Str::randomLatin(mt_rand(16, 32)); |
|
| 62 | + $this->galleryFreeId = '_tmp_'.Str::randomLatin(mt_rand(16, 32)); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$this->authorId) { |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | public function rules(): array |
| 95 | 95 | { |
| 96 | 96 | $res = [ |
| 97 | - ['title.' . App::$Request->getLanguage(), 'required'], |
|
| 98 | - ['text.' . App::$Request->getLanguage(), 'required'], |
|
| 97 | + ['title.'.App::$Request->getLanguage(), 'required'], |
|
| 98 | + ['text.'.App::$Request->getLanguage(), 'required'], |
|
| 99 | 99 | ['text', 'used'], |
| 100 | 100 | ['path', 'reverse_match', '/[\/\'~`\!@#\$%\^&\*\(\)+=\{\}\[\]\|;:"\<\>,\?\\\]/'], |
| 101 | 101 | [['path', 'categoryId', 'authorId', 'display', 'galleryFreeId', 'title', 'important'], 'required'], |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | ]; |
| 109 | 109 | |
| 110 | 110 | foreach (App::$Properties->get('languages') as $lang) { |
| 111 | - $res[] = ['title.' . $lang, 'length_max', 120, null, true, true]; |
|
| 112 | - $res[] = ['keywords.' . $lang, 'length_max', 150]; |
|
| 113 | - $res[] = ['description.' . $lang, 'length_max', 250]; |
|
| 111 | + $res[] = ['title.'.$lang, 'length_max', 120, null, true, true]; |
|
| 112 | + $res[] = ['keywords.'.$lang, 'length_max', 150]; |
|
| 113 | + $res[] = ['description.'.$lang, 'length_max', 250]; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | return $res; |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | $this->_content->meta_keywords = $this->metaKeywords; |
| 167 | 167 | $this->_content->meta_description = $this->metaDescription; |
| 168 | 168 | $this->_content->source = $this->source; |
| 169 | - $this->_content->important = (int)$this->important; |
|
| 169 | + $this->_content->important = (int) $this->important; |
|
| 170 | 170 | // check if rating is changed |
| 171 | - if ((int)$this->addRating !== 0) { |
|
| 172 | - $this->_content->rating += (int)$this->addRating; |
|
| 171 | + if ((int) $this->addRating !== 0) { |
|
| 172 | + $this->_content->rating += (int) $this->addRating; |
|
| 173 | 173 | } |
| 174 | 174 | // check if special comment hash is exist |
| 175 | 175 | if ($this->_new || Str::length($this->_content->comment_hash) < 32) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // save poster data |
| 185 | - $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster; |
|
| 185 | + $posterPath = '/upload/gallery/'.$this->galleryFreeId.'/orig/'.$this->poster; |
|
| 186 | 186 | if (File::exist($posterPath)) { |
| 187 | 187 | $this->_content->poster = $this->poster; |
| 188 | 188 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | // move files |
| 219 | 219 | if ($tmpGalleryId !== $this->_content->id) { |
| 220 | - Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id); |
|
| 220 | + Directory::rename('/upload/gallery/'.$tmpGalleryId, $this->_content->id); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Apps\ActiveRecord\System; |
| 6 | 6 | use Ffcms\Core\Arch\Model; |
| 7 | -use Ffcms\Core\Helper\FileSystem\File; |
|
| 8 | 7 | use Ffcms\Core\Helper\Type\Str; |
| 9 | 8 | use Ffcms\Core\Managers\MigrationsManager; |
| 10 | 9 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $name = Str::firstIn($fullName, '-'); |
| 44 | 44 | // get update version number from migration name |
| 45 | 45 | list($type, $obj, $version) = explode('_', $name); |
| 46 | - $intVersion = (int)Str::replace('.', '', $this->dbVersion); |
|
| 46 | + $intVersion = (int) Str::replace('.', '', $this->dbVersion); |
|
| 47 | 47 | // if migration version > db version - implement it |
| 48 | 48 | if ($version > $intVersion) { |
| 49 | 49 | $this->updateQueries[] = $file; |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Ffcms\Core\App; |
| 9 | 9 | use Ffcms\Core\Arch\Model; |
| 10 | 10 | use Ffcms\Core\Helper\Type\Any; |
| 11 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 12 | 11 | use Ffcms\Core\Helper\Type\Str; |
| 13 | 12 | use Ffcms\Core\Interfaces\iUser; |
| 14 | 13 | |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Ffcms\Core\Helper\FileSystem\File; |
| 13 | 13 | use Ffcms\Core\Helper\Type\Any; |
| 14 | 14 | use Ffcms\Core\Helper\Type\Arr; |
| 15 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 16 | 15 | use Ffcms\Core\Helper\Type\Str; |
| 17 | 16 | |
| 18 | 17 | /** |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | /** |
| 67 | 67 | * Prepare model attributes from passed objects |
| 68 | 68 | * @throws ForbiddenException |
| 69 | - */ |
|
| 69 | + */ |
|
| 70 | 70 | public function before() |
| 71 | 71 | { |
| 72 | 72 | $this->id = $this->_content->id; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->id = $this->_content->id; |
| 73 | 73 | $this->title = $this->_content->getLocaled('title'); |
| 74 | 74 | $this->text = $this->_content->getLocaled('text'); |
| 75 | - $this->display = (bool)$this->_content->display; |
|
| 75 | + $this->display = (bool) $this->_content->display; |
|
| 76 | 76 | |
| 77 | 77 | // check if title and text are exists |
| 78 | 78 | if (Str::length($this->title) < 1 || Str::length($this->text) < 1) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $this->source = $this->_content->source; |
| 105 | - $this->views = $this->_content->views+1; |
|
| 105 | + $this->views = $this->_content->views + 1; |
|
| 106 | 106 | // check for dependence, add '' for general cat, ex: general/depend1/depend2/.../depend-n |
| 107 | 107 | $catNestingArray = Arr::merge([0 => ''], explode('/', $this->catPath)); |
| 108 | 108 | if ($catNestingArray > 1) { |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | ]; |
| 135 | 135 | |
| 136 | 136 | // get gallery images and poster data |
| 137 | - $galleryPath = '/upload/gallery/' . $this->_content->id; |
|
| 137 | + $galleryPath = '/upload/gallery/'.$this->_content->id; |
|
| 138 | 138 | // check if gallery folder is exist |
| 139 | 139 | if (Directory::exist($galleryPath)) { |
| 140 | - $originImages = File::listFiles($galleryPath . '/orig/', ['.jpg', '.png', '.gif', '.jpeg', '.bmp', '.webp'], true); |
|
| 140 | + $originImages = File::listFiles($galleryPath.'/orig/', ['.jpg', '.png', '.gif', '.jpeg', '.bmp', '.webp'], true); |
|
| 141 | 141 | // generate poster data |
| 142 | 142 | if (Arr::in($this->_content->poster, $originImages)) { |
| 143 | 143 | // original poster |
| 144 | 144 | $posterName = $this->_content->poster; |
| 145 | - $this->posterFull = $galleryPath . '/orig/' . $posterName; |
|
| 145 | + $this->posterFull = $galleryPath.'/orig/'.$posterName; |
|
| 146 | 146 | if (!File::exist($this->posterFull)) { |
| 147 | 147 | $this->posterFull = null; |
| 148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $posterSplit = explode('.', $posterName); |
| 152 | 152 | array_pop($posterSplit); |
| 153 | 153 | $posterCleanName = implode('.', $posterSplit); |
| 154 | - $this->posterThumb = $galleryPath . '/thumb/' . $posterCleanName . '.jpg'; |
|
| 154 | + $this->posterThumb = $galleryPath.'/thumb/'.$posterCleanName.'.jpg'; |
|
| 155 | 155 | if (!File::exist($this->posterThumb)) { |
| 156 | 156 | $this->posterThumb = null; |
| 157 | 157 | } |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | continue; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - $thumbPath = $galleryPath . '/thumb/' . $imageClearName . '.jpg'; |
|
| 170 | + $thumbPath = $galleryPath.'/thumb/'.$imageClearName.'.jpg'; |
|
| 171 | 171 | if (File::exist($thumbPath)) { |
| 172 | - $this->galleryItems[$thumbPath] = $galleryPath . '/orig/' . $image; |
|
| 172 | + $this->galleryItems[$thumbPath] = $galleryPath.'/orig/'.$image; |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $this->rating = $this->_content->rating; |
| 179 | 179 | $ignoredRate = App::$Session->get('content.rate.ignore'); |
| 180 | 180 | $this->canRate = true; |
| 181 | - if (Any::isArray($ignoredRate) && Arr::in((string)$this->id, $ignoredRate)) { |
|
| 181 | + if (Any::isArray($ignoredRate) && Arr::in((string) $this->id, $ignoredRate)) { |
|
| 182 | 182 | $this->canRate = false; |
| 183 | 183 | } |
| 184 | 184 | if (!App::$User->isAuth()) { |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | /** |
| 33 | 33 | * EntityContentSearch constructor. Pass search terms (query string) to model and used items to skip it by id. |
| 34 | 34 | * @param $terms |
| 35 | - * @param int|array $skipIds |
|
| 35 | + * @param integer $skipIds |
|
| 36 | 36 | * @param int|null $categoryId |
| 37 | 37 | */ |
| 38 | 38 | public function __construct($terms, $skipIds = 0, $categoryId = null) |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Ffcms\Core\Exception\NotFoundException; |
| 9 | 9 | use Ffcms\Core\Helper\Text; |
| 10 | 10 | use Ffcms\Core\Helper\Type\Any; |
| 11 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 12 | 11 | use Ffcms\Core\Helper\Type\Str; |
| 13 | 12 | |
| 14 | 13 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $index = implode('-', $this->_skip); |
| 63 | 63 | // try to get this slow query from cache |
| 64 | - $cache = App::$Cache->getItem('entity.content.search.index.' . $index); |
|
| 64 | + $cache = App::$Cache->getItem('entity.content.search.index.'.$index); |
|
| 65 | 65 | if (!$cache->isHit()) { |
| 66 | 66 | $cache->set($this->makeSearch()); |
| 67 | 67 | $cache->expiresAfter(static::CACHE_TIME); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $this->items[] = [ |
| 95 | 95 | 'title' => $item->getLocaled('title'), |
| 96 | 96 | 'snippet' => Text::snippet($text), |
| 97 | - 'uri' => '/content/read/' . $item->getPath(), |
|
| 97 | + 'uri' => '/content/read/'.$item->getPath(), |
|
| 98 | 98 | 'thumb' => $item->getPosterThumbUri() |
| 99 | 99 | ]; |
| 100 | 100 | } |