@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | public function folders() |
| 98 | 98 | { |
| 99 | - $all_folders = array_map(function ($directory_path) { |
|
| 99 | + $all_folders = array_map(function($directory_path) { |
|
| 100 | 100 | return $this->pretty($directory_path, true); |
| 101 | 101 | }, $this->storage->directories()); |
| 102 | 102 | |
| 103 | - $folders = array_filter($all_folders, function ($directory) { |
|
| 103 | + $folders = array_filter($all_folders, function($directory) { |
|
| 104 | 104 | return $directory->name !== $this->helper->getThumbFolderName(); |
| 105 | 105 | }); |
| 106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | public function files() |
| 111 | 111 | { |
| 112 | - $files = array_map(function ($file_path) { |
|
| 112 | + $files = array_map(function($file_path) { |
|
| 113 | 113 | return $this->pretty($file_path); |
| 114 | 114 | }, $this->storage->files()); |
| 115 | 115 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $working_dir = $this->path('working_dir'); |
| 155 | 155 | $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/')); |
| 156 | 156 | |
| 157 | - $parent_directories = array_map(function ($directory_path) { |
|
| 157 | + $parent_directories = array_map(function($directory_path) { |
|
| 158 | 158 | return app(static::class)->translateToLfmPath($directory_path); |
| 159 | 159 | }, app(static::class)->dir($parent_dir)->directories()); |
| 160 | 160 | |
@@ -200,20 +200,20 @@ discard block |
||
| 200 | 200 | public function sortByColumn($arr_items) |
| 201 | 201 | { |
| 202 | 202 | $sort_by = $this->helper->input('sort_type'); |
| 203 | - if (in_array($sort_by, ['name', 'time'])) { |
|
| 203 | + if (in_array($sort_by, [ 'name', 'time' ])) { |
|
| 204 | 204 | $key_to_sort = $sort_by; |
| 205 | 205 | } else { |
| 206 | 206 | $key_to_sort = 'name'; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - uasort($arr_items, function ($a, $b) use ($key_to_sort) { |
|
| 209 | + uasort($arr_items, function($a, $b) use ($key_to_sort) { |
|
| 210 | 210 | return strcasecmp($a->{$key_to_sort}, $b->{$key_to_sort}); |
| 211 | 211 | }); |
| 212 | 212 | |
| 213 | 213 | return $arr_items; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - public function error($error_type, $variables = []) |
|
| 216 | + public function error($error_type, $variables = [ ]) |
|
| 217 | 217 | { |
| 218 | 218 | throw new \Exception($this->helper->error($error_type, $variables)); |
| 219 | 219 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $validator->nameIsNotDuplicate($this->getNewName($file), $this); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - $validator->isNotExcutable(config('lfm.disallowed_mimetypes', ['text/x-php', 'text/html', 'text/plain'])); |
|
| 256 | + $validator->isNotExcutable(config('lfm.disallowed_mimetypes', [ 'text/x-php', 'text/html', 'text/plain' ])); |
|
| 257 | 257 | |
| 258 | 258 | if (config('lfm.should_validate_mime', false)) { |
| 259 | 259 | $validator->mimeTypeIsValid($this->helper->availableMimeTypes()); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $validator->sizeIsLowerThanConfiguredMaximum($this->helper->maxUploadSize()); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - $validator->hasAllowedExtension(config('lfm.allowed_extensions', ['jpg', 'png', 'gif', 'jpeg'])); |
|
| 266 | + $validator->hasAllowedExtension(config('lfm.allowed_extensions', [ 'jpg', 'png', 'gif', 'jpeg' ])); |
|
| 267 | 267 | |
| 268 | 268 | return true; |
| 269 | 269 | } |
@@ -114,13 +114,13 @@ |
||
| 114 | 114 | 'over_write_on_duplicate' => false, |
| 115 | 115 | |
| 116 | 116 | // mimetypes of executables to prevent from uploading |
| 117 | - 'disallowed_mimetypes' => ['text/x-php', 'text/html', 'text/plain'], |
|
| 117 | + 'disallowed_mimetypes' => [ 'text/x-php', 'text/html', 'text/plain' ], |
|
| 118 | 118 | |
| 119 | 119 | // allowed file extensions |
| 120 | - 'allowed_extensions' => ['jpg', 'png', 'gif'], |
|
| 120 | + 'allowed_extensions' => [ 'jpg', 'png', 'gif' ], |
|
| 121 | 121 | |
| 122 | 122 | // Item Columns |
| 123 | - 'item_columns' => ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url'], |
|
| 123 | + 'item_columns' => [ 'name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url' ], |
|
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | 126 | |-------------------------------------------------------------------------- |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | 15 | parent::__construct(); |
| 16 | - $this->errors = []; |
|
| 16 | + $this->errors = [ ]; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | public function upload() |
| 27 | 27 | { |
| 28 | 28 | $uploaded_files = request()->file('upload'); |
| 29 | - $error_bag = []; |
|
| 29 | + $error_bag = [ ]; |
|
| 30 | 30 | $new_filename = null; |
| 31 | 31 | |
| 32 | - foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) { |
|
| 32 | + foreach (is_array($uploaded_files) ? $uploaded_files : [ $uploaded_files ] as $file) { |
|
| 33 | 33 | try { |
| 34 | 34 | $this->lfm->validateUploadedFile($file); |
| 35 | 35 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } else { // upload via ckeditor5 expects json responses |
| 50 | 50 | if (is_null($new_filename)) { |
| 51 | 51 | $response = [ |
| 52 | - 'error' => ['message' => $error_bag[0]] |
|
| 52 | + 'error' => [ 'message' => $error_bag[ 0 ] ] |
|
| 53 | 53 | ]; |
| 54 | 54 | } else { |
| 55 | 55 | $url = $this->lfm->setName($new_filename)->url(); |