@@ -6,6 +6,6 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function __construct() |
| 8 | 8 | { |
| 9 | - $this->message = trans('laravel-filemanager::lfm.error-file-size', ['max' => ini_get('upload_max_filesize')]); |
|
| 9 | + $this->message = trans('laravel-filemanager::lfm.error-file-size', [ 'max' => ini_get('upload_max_filesize') ]); |
|
| 10 | 10 | } |
| 11 | 11 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | { |
| 66 | 66 | $mimetype = $this->file->getMimeType(); |
| 67 | 67 | |
| 68 | - $excutable = ['text/x-php']; |
|
| 68 | + $excutable = [ 'text/x-php' ]; |
|
| 69 | 69 | |
| 70 | 70 | if (in_array($mimetype, $excutable)) { |
| 71 | 71 | throw new ExcutableFileException(); |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function getErrors() |
| 48 | 48 | { |
| 49 | - $arr_errors = []; |
|
| 49 | + $arr_errors = [ ]; |
|
| 50 | 50 | |
| 51 | - if (! extension_loaded('gd') && ! extension_loaded('imagick')) { |
|
| 51 | + if (!extension_loaded('gd') && !extension_loaded('imagick')) { |
|
| 52 | 52 | array_push($arr_errors, trans('laravel-filemanager::lfm.message-extension_not_found')); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (! extension_loaded('exif')) { |
|
| 55 | + if (!extension_loaded('exif')) { |
|
| 56 | 56 | array_push($arr_errors, 'EXIF extension not found.'); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (! extension_loaded('fileinfo')) { |
|
| 59 | + if (!extension_loaded('fileinfo')) { |
|
| 60 | 60 | array_push($arr_errors, 'Fileinfo extension not found.'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | . $this->helper->currentLfmType() |
| 65 | 65 | . '.valid_mime'; |
| 66 | 66 | |
| 67 | - if (! is_array(config($mine_config_key))) { |
|
| 67 | + if (!is_array(config($mine_config_key))) { |
|
| 68 | 68 | array_push($arr_errors, 'Config : ' . $mine_config_key . ' is not a valid array.'); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function applyIniOverrides() |
| 80 | 80 | { |
| 81 | - $overrides = config('lfm.php_ini_overrides', []); |
|
| 81 | + $overrides = config('lfm.php_ini_overrides', [ ]); |
|
| 82 | 82 | |
| 83 | 83 | if ($overrides && is_array($overrides) && count($overrides) === 0) { |
| 84 | 84 | return; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | parent::__construct(); |
| 18 | - $this->errors = []; |
|
| 18 | + $this->errors = [ ]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | public function upload() |
| 29 | 29 | { |
| 30 | 30 | $uploaded_files = request()->file('upload'); |
| 31 | - $error_bag = []; |
|
| 31 | + $error_bag = [ ]; |
|
| 32 | 32 | $new_filename = null; |
| 33 | 33 | |
| 34 | - foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) { |
|
| 34 | + foreach (is_array($uploaded_files) ? $uploaded_files : [ $uploaded_files ] as $file) { |
|
| 35 | 35 | try { |
| 36 | 36 | $this->lfm->validateUploadedFile($file); |
| 37 | 37 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } else { // upload via ckeditor5 expects json responses |
| 52 | 52 | if (is_null($new_filename)) { |
| 53 | 53 | $response = [ |
| 54 | - 'error' => [ 'message' => $error_bag[0] ] |
|
| 54 | + 'error' => [ 'message' => $error_bag[ 0 ] ] |
|
| 55 | 55 | ]; |
| 56 | 56 | } else { |
| 57 | 57 | $url = $this->lfm->setName($new_filename)->url(); |
@@ -12,26 +12,25 @@ discard block |
||
| 12 | 12 | private $isDirectory; |
| 13 | 13 | private $mimeType = null; |
| 14 | 14 | |
| 15 | - private $columns = []; |
|
| 16 | - public $attributes = []; |
|
| 15 | + private $columns = [ ]; |
|
| 16 | + public $attributes = [ ]; |
|
| 17 | 17 | |
| 18 | 18 | public function __construct(LfmPath $lfm, Lfm $helper, $isDirectory = false) |
| 19 | 19 | { |
| 20 | 20 | $this->lfm = $lfm->thumb(false); |
| 21 | 21 | $this->helper = $helper; |
| 22 | 22 | $this->isDirectory = $isDirectory; |
| 23 | - $this->columns = $helper->config('item_columns') ?: |
|
| 24 | - ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url']; |
|
| 23 | + $this->columns = $helper->config('item_columns') ?: [ 'name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url' ]; |
|
| 25 | 24 | } |
| 26 | 25 | |
| 27 | 26 | public function __get($var_name) |
| 28 | 27 | { |
| 29 | 28 | if (!array_key_exists($var_name, $this->attributes)) { |
| 30 | 29 | $function_name = Str::camel($var_name); |
| 31 | - $this->attributes[$var_name] = $this->$function_name(); |
|
| 30 | + $this->attributes[ $var_name ] = $this->$function_name(); |
|
| 32 | 31 | } |
| 33 | 32 | |
| 34 | - return $this->attributes[$var_name]; |
|
| 33 | + return $this->attributes[ $var_name ]; |
|
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | public function fill() |
@@ -60,7 +59,7 @@ discard block |
||
| 60 | 59 | |
| 61 | 60 | public function isFile() |
| 62 | 61 | { |
| 63 | - return ! $this->isDirectory(); |
|
| 62 | + return !$this->isDirectory(); |
|
| 64 | 63 | } |
| 65 | 64 | |
| 66 | 65 | /** |
@@ -175,7 +174,7 @@ discard block |
||
| 175 | 174 | return false; |
| 176 | 175 | } |
| 177 | 176 | |
| 178 | - if (in_array($this->mimeType(), ['image/gif', 'image/svg+xml'])) { |
|
| 177 | + if (in_array($this->mimeType(), [ 'image/gif', 'image/svg+xml' ])) { |
|
| 179 | 178 | return false; |
| 180 | 179 | } |
| 181 | 180 | |
@@ -196,9 +195,9 @@ discard block |
||
| 196 | 195 | */ |
| 197 | 196 | public function humanFilesize($bytes, $decimals = 2) |
| 198 | 197 | { |
| 199 | - $size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
|
| 198 | + $size = [ 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; |
|
| 200 | 199 | $factor = floor((strlen($bytes) - 1) / 3); |
| 201 | 200 | |
| 202 | - return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[$factor]); |
|
| 201 | + return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[ $factor ]); |
|
| 203 | 202 | } |
| 204 | 203 | } |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | public function folders() |
| 99 | 99 | { |
| 100 | - $all_folders = array_map(function ($directory_path) { |
|
| 100 | + $all_folders = array_map(function($directory_path) { |
|
| 101 | 101 | return $this->pretty($directory_path, true); |
| 102 | 102 | }, $this->storage->directories()); |
| 103 | 103 | |
| 104 | - $folders = array_filter($all_folders, function ($directory) { |
|
| 104 | + $folders = array_filter($all_folders, function($directory) { |
|
| 105 | 105 | return $directory->name !== $this->helper->getThumbFolderName(); |
| 106 | 106 | }); |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function files() |
| 112 | 112 | { |
| 113 | - $files = array_map(function ($file_path) { |
|
| 113 | + $files = array_map(function($file_path) { |
|
| 114 | 114 | return $this->pretty($file_path); |
| 115 | 115 | }, $this->storage->files()); |
| 116 | 116 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $working_dir = $this->path('working_dir'); |
| 156 | 156 | $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/')); |
| 157 | 157 | |
| 158 | - $parent_directories = array_map(function ($directory_path) { |
|
| 158 | + $parent_directories = array_map(function($directory_path) { |
|
| 159 | 159 | return app(static::class)->translateToLfmPath($directory_path); |
| 160 | 160 | }, app(static::class)->dir($parent_dir)->directories()); |
| 161 | 161 | |
@@ -201,20 +201,20 @@ discard block |
||
| 201 | 201 | public function sortByColumn($arr_items) |
| 202 | 202 | { |
| 203 | 203 | $sort_by = $this->helper->input('sort_type'); |
| 204 | - if (in_array($sort_by, ['name', 'time'])) { |
|
| 204 | + if (in_array($sort_by, [ 'name', 'time' ])) { |
|
| 205 | 205 | $key_to_sort = $sort_by; |
| 206 | 206 | } else { |
| 207 | 207 | $key_to_sort = 'name'; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - uasort($arr_items, function ($a, $b) use ($key_to_sort) { |
|
| 210 | + uasort($arr_items, function($a, $b) use ($key_to_sort) { |
|
| 211 | 211 | return strcasecmp($a->{$key_to_sort}, $b->{$key_to_sort}); |
| 212 | 212 | }); |
| 213 | 213 | |
| 214 | 214 | return $arr_items; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - public function error($error_type, $variables = []) |
|
| 217 | + public function error($error_type, $variables = [ ]) |
|
| 218 | 218 | { |
| 219 | 219 | throw new \Exception($this->helper->error($error_type, $variables)); |
| 220 | 220 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | //----- Rezise image |
| 235 | 235 | $original_image = $this->pretty($new_file_name); |
| 236 | - $image = Image::make($original_image->get())->resize(800, 600,function ($constraint) { |
|
| 236 | + $image = Image::make($original_image->get())->resize(800, 600, function($constraint) { |
|
| 237 | 237 | $constraint->aspectRatio(); |
| 238 | 238 | }); |
| 239 | 239 | $this->setName($new_file_name)->storage->put($image->stream()); |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | $file_name_without_extentions = $new_file_name; |
| 295 | 295 | while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) { |
| 296 | 296 | if (config('lfm.alphanumeric_filename') === true) { |
| 297 | - $suffix = '_'.$counter; |
|
| 297 | + $suffix = '_' . $counter; |
|
| 298 | 298 | } else { |
| 299 | 299 | $suffix = " ({$counter})"; |
| 300 | 300 | } |
| 301 | - $new_file_name = $file_name_without_extentions.$suffix; |
|
| 301 | + $new_file_name = $file_name_without_extentions . $suffix; |
|
| 302 | 302 | |
| 303 | 303 | if ($extension) { |
| 304 | 304 | $new_file_name_with_extention = $new_file_name . '.' . $extension; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | $new_name = Str::slug($new_name, '_'); |
| 40 | 40 | |
| 41 | - if (! $is_directory) { |
|
| 41 | + if (!$is_directory) { |
|
| 42 | 42 | $extension = $old_file->extension(); |
| 43 | 43 | if ($extension) { |
| 44 | 44 | $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension; |