@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Magic method before example |
|
| 30 | - */ |
|
| 29 | + * Magic method before example |
|
| 30 | + */ |
|
| 31 | 31 | public function before() |
| 32 | 32 | { |
| 33 | 33 | $this->name = $this->_role->name; |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Example of usage magic labels for future form helper usage |
|
| 41 | - */ |
|
| 40 | + * Example of usage magic labels for future form helper usage |
|
| 41 | + */ |
|
| 42 | 42 | public function labels() |
| 43 | 43 | { |
| 44 | 44 | return [ |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * Example of usage magic rules for future usage in condition $model->validate() |
|
| 52 | - */ |
|
| 51 | + * Example of usage magic rules for future usage in condition $model->validate() |
|
| 52 | + */ |
|
| 53 | 53 | public function rules() |
| 54 | 54 | { |
| 55 | 55 | return [ |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Load configs from app data |
|
| 23 | - */ |
|
| 22 | + * Load configs from app data |
|
| 23 | + */ |
|
| 24 | 24 | public function before() |
| 25 | 25 | { |
| 26 | 26 | foreach ($this->_config as $property => $value) { |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | - * Example of usage magic labels for future form helper usage |
|
| 35 | - */ |
|
| 34 | + * Example of usage magic labels for future form helper usage |
|
| 35 | + */ |
|
| 36 | 36 | public function labels() |
| 37 | 37 | { |
| 38 | 38 | return [ |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * Example of usage magic rules for future usage in condition $model->validate() |
|
| 47 | - */ |
|
| 46 | + * Example of usage magic rules for future usage in condition $model->validate() |
|
| 47 | + */ |
|
| 48 | 48 | public function rules() |
| 49 | 49 | { |
| 50 | 50 | return [ |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Load user data on before method |
|
| 39 | - */ |
|
| 38 | + * Load user data on before method |
|
| 39 | + */ |
|
| 40 | 40 | public function before() |
| 41 | 41 | { |
| 42 | 42 | foreach ($this->getAllProperties() as $property => $old_data) { |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Example of usage magic rules for future usage in condition $model->validate() |
|
| 68 | - */ |
|
| 67 | + * Example of usage magic rules for future usage in condition $model->validate() |
|
| 68 | + */ |
|
| 69 | 69 | public function rules() |
| 70 | 70 | { |
| 71 | 71 | return [ |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | if ($this->newpassword !== null && Str::length($this->newpassword) >= 3) { |
| 99 | 99 | $this->_user->password = App::$Security->password_hash($this->newpassword); |
| 100 | 100 | } |
| 101 | - } elseif($property === 'approve_token') { |
|
| 101 | + } elseif ($property === 'approve_token') { |
|
| 102 | 102 | if ($value == "1") { |
| 103 | 103 | $this->_user->approve_token = '0'; |
| 104 | 104 | } else { |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | /** |
| 58 | 58 | * Prepare model attributes from passed objects |
| 59 | 59 | * @throws ForbiddenException |
| 60 | - */ |
|
| 60 | + */ |
|
| 61 | 61 | public function before() |
| 62 | 62 | { |
| 63 | 63 | $this->title = Serialize::getDecodeLocale($this->_content->title); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $this->source = $this->_content->source; |
| 98 | - $this->views = $this->_content->views+1; |
|
| 98 | + $this->views = $this->_content->views + 1; |
|
| 99 | 99 | // check for dependence, add '' for general cat, ex: general/depend1/depend2/.../depend-n |
| 100 | 100 | $catNestingArray = Arr::merge([0 => ''], explode('/', $this->catPath)); |
| 101 | 101 | if ($catNestingArray > 1) { |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | ]; |
| 128 | 128 | |
| 129 | 129 | // get gallery images and poster data |
| 130 | - $galleryPath = '/upload/gallery/' . $this->_content->id; |
|
| 130 | + $galleryPath = '/upload/gallery/'.$this->_content->id; |
|
| 131 | 131 | // check if gallery folder is exist |
| 132 | 132 | if (Directory::exist($galleryPath)) { |
| 133 | - $originImages = File::listFiles($galleryPath . '/orig/', ['.jpg', '.png', '.gif', '.jpeg', '.bmp', '.webp'], true); |
|
| 133 | + $originImages = File::listFiles($galleryPath.'/orig/', ['.jpg', '.png', '.gif', '.jpeg', '.bmp', '.webp'], true); |
|
| 134 | 134 | // generate poster data |
| 135 | 135 | if (Arr::in($this->_content->poster, $originImages)) { |
| 136 | 136 | // original poster |
| 137 | 137 | $posterName = $this->_content->poster; |
| 138 | - $this->posterFull = $galleryPath . '/orig/' . $posterName; |
|
| 138 | + $this->posterFull = $galleryPath.'/orig/'.$posterName; |
|
| 139 | 139 | if (!File::exist($this->posterFull)) { |
| 140 | 140 | $this->posterFull = null; |
| 141 | 141 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $posterSplit = explode('.', $posterName); |
| 144 | 144 | array_pop($posterSplit); |
| 145 | 145 | $posterCleanName = implode('.', $posterSplit); |
| 146 | - $this->posterThumb = $galleryPath . '/thumb/' . $posterCleanName . '.jpg'; |
|
| 146 | + $this->posterThumb = $galleryPath.'/thumb/'.$posterCleanName.'.jpg'; |
|
| 147 | 147 | if (!File::exist($this->posterThumb)) { |
| 148 | 148 | $this->posterThumb = null; |
| 149 | 149 | } |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | if (Str::startsWith($imageClearName, $this->_content->poster)) { |
| 159 | 159 | continue; |
| 160 | 160 | } |
| 161 | - $thumbPath = $galleryPath . '/thumb/' . $imageClearName . '.jpg'; |
|
| 161 | + $thumbPath = $galleryPath.'/thumb/'.$imageClearName.'.jpg'; |
|
| 162 | 162 | if (File::exist($thumbPath)) { |
| 163 | - $this->galleryItems[$thumbPath] = $galleryPath . '/orig/' . $image; |
|
| 163 | + $this->galleryItems[$thumbPath] = $galleryPath.'/orig/'.$image; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->rating = $this->_content->rating; |
| 170 | 170 | $ignoredRate = App::$Session->get('content.rate.ignore'); |
| 171 | 171 | $this->canRate = true; |
| 172 | - if (Obj::isArray($ignoredRate) && Arr::in((string)$this->id, $ignoredRate)) { |
|
| 172 | + if (Obj::isArray($ignoredRate) && Arr::in((string) $this->id, $ignoredRate)) { |
|
| 173 | 173 | $this->canRate = false; |
| 174 | 174 | } |
| 175 | 175 | if (!App::$User->isAuth()) { |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | const COMPRESS_QUALITY = 90; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * Example of usage magic labels for future form helper usage |
|
| 20 | - */ |
|
| 19 | + * Example of usage magic labels for future form helper usage |
|
| 20 | + */ |
|
| 21 | 21 | public function labels() |
| 22 | 22 | { |
| 23 | 23 | return [ |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Example of usage magic rules for future usage in condition $model->validate() |
|
| 30 | - */ |
|
| 29 | + * Example of usage magic rules for future usage in condition $model->validate() |
|
| 30 | + */ |
|
| 31 | 31 | public function rules() |
| 32 | 32 | { |
| 33 | 33 | return [ |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function copyFile(iUser $user) |
| 48 | 48 | { |
| 49 | 49 | // move file to original folder |
| 50 | - $upload = $this->file->move(root . '/upload/user/avatar/original/', $user->id . '.' . $this->file->guessExtension()); |
|
| 50 | + $upload = $this->file->move(root.'/upload/user/avatar/original/', $user->id.'.'.$this->file->guessExtension()); |
|
| 51 | 51 | |
| 52 | 52 | try { |
| 53 | 53 | // big image |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $image = new Image(); |
| 85 | - $image->setCacheDir(root . '/Private/Cache/images'); |
|
| 85 | + $image->setCacheDir(root.'/Private/Cache/images'); |
|
| 86 | 86 | |
| 87 | 87 | $image->open($original->getPathname()) |
| 88 | 88 | ->cropResize($sizeConvert[$size][0], $sizeConvert[$size][1]) |
| 89 | - ->save(root . '/upload/user/avatar/' . $size . '/' . $user_id . '.jpg', 'jpg', static::COMPRESS_QUALITY); |
|
| 89 | + ->save(root.'/upload/user/avatar/'.$size.'/'.$user_id.'.jpg', 'jpg', static::COMPRESS_QUALITY); |
|
| 90 | 90 | |
| 91 | 91 | return null; |
| 92 | 92 | } |
@@ -33,8 +33,8 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * Validation rules |
|
| 37 | - */ |
|
| 36 | + * Validation rules |
|
| 37 | + */ |
|
| 38 | 38 | public function rules() |
| 39 | 39 | { |
| 40 | 40 | return [ |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | public function save() |
| 53 | 53 | { |
| 54 | 54 | // check if target is myself or always exist in block list |
| 55 | - if ($this->_user->getId() === (int)$this->id || Blacklist::have($this->_user->getId(), $this->id)) { |
|
| 55 | + if ($this->_user->getId() === (int) $this->id || Blacklist::have($this->_user->getId(), $this->id)) { |
|
| 56 | 56 | return false; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Set default data |
|
| 34 | - */ |
|
| 33 | + * Set default data |
|
| 34 | + */ |
|
| 35 | 35 | public function before() |
| 36 | 36 | { |
| 37 | 37 | $profile = $this->_user->getProfile()->toArray(); // object to array (property's is protected of access) |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Labels |
|
| 56 | - */ |
|
| 55 | + * Labels |
|
| 56 | + */ |
|
| 57 | 57 | public function labels() |
| 58 | 58 | { |
| 59 | 59 | $labels = [ |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Rules for validation |
|
| 79 | - */ |
|
| 78 | + * Rules for validation |
|
| 79 | + */ |
|
| 80 | 80 | public function rules() |
| 81 | 81 | { |
| 82 | 82 | $rules = [ |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function labels() |
| 58 | 58 | { |
| 59 | - $labels = [ |
|
| 59 | + $labels = [ |
|
| 60 | 60 | 'nick' => __('Nickname'), |
| 61 | 61 | 'sex' => __('Sex'), |
| 62 | 62 | 'birthday' => __('Birthday'), |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | // labels for custom fields |
| 70 | 70 | foreach (ProfileField::getAll() as $custom) { |
| 71 | - $labels['custom_data.' . $custom->id] = Serialize::getDecodeLocale($custom->name); |
|
| 71 | + $labels['custom_data.'.$custom->id] = Serialize::getDecodeLocale($custom->name); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $labels; |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | // custom profile fields |
| 94 | 94 | foreach (ProfileField::getAll() as $custom) { |
| 95 | 95 | $rules[] = [ |
| 96 | - 'custom_data.' . $custom->id, |
|
| 96 | + 'custom_data.'.$custom->id, |
|
| 97 | 97 | 'used' |
| 98 | 98 | ]; |
| 99 | 99 | $rules[] = [ |
| 100 | - 'custom_data.' . $custom->id, |
|
| 101 | - (int)$custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
| 100 | + 'custom_data.'.$custom->id, |
|
| 101 | + (int) $custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
| 102 | 102 | $custom->reg_exp |
| 103 | 103 | ]; |
| 104 | 104 | } |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * Set post id based on post active record |
|
| 24 | - */ |
|
| 23 | + * Set post id based on post active record |
|
| 24 | + */ |
|
| 25 | 25 | public function before() |
| 26 | 26 | { |
| 27 | 27 | $this->id = $this->_post->id; |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Pseudo-rules, here is not required |
|
| 33 | - */ |
|
| 32 | + * Pseudo-rules, here is not required |
|
| 33 | + */ |
|
| 34 | 34 | public function rules() |
| 35 | 35 | { |
| 36 | 36 | return []; |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | public $captcha; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * Labels |
|
| 21 | - */ |
|
| 20 | + * Labels |
|
| 21 | + */ |
|
| 22 | 22 | public function labels() |
| 23 | 23 | { |
| 24 | 24 | return [ |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * Validation rules |
|
| 32 | - */ |
|
| 31 | + * Validation rules |
|
| 32 | + */ |
|
| 33 | 33 | public function rules() |
| 34 | 34 | { |
| 35 | 35 | return [ |