@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function getDelete() |
21 | 21 | { |
22 | 22 | $item_names = request('items'); |
23 | - $errors = []; |
|
23 | + $errors = [ ]; |
|
24 | 24 | |
25 | 25 | foreach ($item_names as $name_to_delete) { |
26 | 26 | $file = $this->lfm->setName($name_to_delete); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | - if (! $this->lfm->setName($name_to_delete)->exists()) { |
|
48 | - array_push($errors, parent::error('folder-not-found', ['folder' => $file_path])); |
|
47 | + if (!$this->lfm->setName($name_to_delete)->exists()) { |
|
48 | + array_push($errors, parent::error('folder-not-found', [ 'folder' => $file_path ])); |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 |
@@ -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,9 +253,9 @@ discard block |
||
253 | 253 | $validator->nameIsNotDuplicate($this->getNewName($file), $this); |
254 | 254 | } |
255 | 255 | |
256 | - $validator->mimetypeIsNotExcutable(config('lfm.disallowed_mimetypes', ['text/x-php', 'text/html', 'text/plain'])); |
|
256 | + $validator->mimetypeIsNotExcutable(config('lfm.disallowed_mimetypes', [ 'text/x-php', 'text/html', 'text/plain' ])); |
|
257 | 257 | |
258 | - $validator->extensionIsNotExcutable(config('lfm.disallowed_extensions', ['php', 'html'])); |
|
258 | + $validator->extensionIsNotExcutable(config('lfm.disallowed_extensions', [ 'php', 'html' ])); |
|
259 | 259 | |
260 | 260 | if (config('lfm.should_validate_mime', false)) { |
261 | 261 | $validator->mimeTypeIsValid($this->helper->availableMimeTypes()); |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $file_name_without_extentions = $new_file_name; |
292 | 292 | while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) { |
293 | 293 | if (config('lfm.alphanumeric_filename') === true) { |
294 | - $suffix = '_'.$counter; |
|
294 | + $suffix = '_' . $counter; |
|
295 | 295 | } else { |
296 | 296 | $suffix = " ({$counter})"; |
297 | 297 | } |
298 | - $new_file_name = $file_name_without_extentions.$suffix; |
|
298 | + $new_file_name = $file_name_without_extentions . $suffix; |
|
299 | 299 | |
300 | 300 | if ($extension) { |
301 | 301 | $new_file_name_with_extention = $new_file_name . '.' . $extension; |
@@ -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 | // extensions of executables to prevent from uploading |
120 | - 'disallowed_extensions' => ['php', 'html'], |
|
120 | + 'disallowed_extensions' => [ 'php', 'html' ], |
|
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 | |-------------------------------------------------------------------------- |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $path_parts = pathinfo($path); |
62 | 62 | } |
63 | 63 | |
64 | - return substr($path_parts[$part_name], 1); |
|
64 | + return substr($path_parts[ $part_name ], 1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function allowFolderType($type) |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $lfm_type = 'file'; |
91 | 91 | |
92 | 92 | $request_type = lcfirst(Str::singular($this->input('type') ?: '')); |
93 | - $available_types = array_keys($this->config->get('lfm.folder_categories') ?: []); |
|
93 | + $available_types = array_keys($this->config->get('lfm.folder_categories') ?: [ ]); |
|
94 | 94 | |
95 | 95 | if (in_array($request_type, $available_types)) { |
96 | 96 | $lfm_type = $request_type; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $view_type = 'grid'; |
108 | 108 | $target_display_type = $this->input('show_list') ?: $startup_view; |
109 | 109 | |
110 | - if (in_array($target_display_type, ['list', 'grid'])) { |
|
110 | + if (in_array($target_display_type, [ 'list', 'grid' ])) { |
|
111 | 111 | $view_type = $target_display_type; |
112 | 112 | } |
113 | 113 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function allowShareFolder() |
214 | 214 | { |
215 | - if (! $this->allowMultiUser()) { |
|
215 | + if (!$this->allowMultiUser()) { |
|
216 | 216 | return true; |
217 | 217 | } |
218 | 218 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param mixed $variables Variables the message needs. |
273 | 273 | * @return string |
274 | 274 | */ |
275 | - public function error($error_type, $variables = []) |
|
275 | + public function error($error_type, $variables = [ ]) |
|
276 | 276 | { |
277 | 277 | throw new \Exception(trans(self::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables)); |
278 | 278 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $as = 'unisharp.lfm.'; |
289 | 289 | $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\'; |
290 | 290 | |
291 | - Route::group(compact('middleware', 'as', 'namespace'), function () { |
|
291 | + Route::group(compact('middleware', 'as', 'namespace'), function() { |
|
292 | 292 | // display main layout |
293 | 293 | Route::get('/', [ |
294 | 294 | 'uses' => 'LfmController@show', |
@@ -58,9 +58,9 @@ |
||
58 | 58 | $image_path = $this->lfm->setName(request('img'))->path('absolute'); |
59 | 59 | $resize_path = $image_path; |
60 | 60 | |
61 | - if (! $overWrite) { |
|
61 | + if (!$overWrite) { |
|
62 | 62 | $fileParts = explode('.', $image_name); |
63 | - $fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_resized_' . time(); |
|
63 | + $fileParts[ count($fileParts) - 2 ] = $fileParts[ count($fileParts) - 2 ] . '_resized_' . time(); |
|
64 | 64 | $resize_path = $this->lfm->setName(implode('.', $fileParts))->path('absolute'); |
65 | 65 | } |
66 | 66 |
@@ -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 | private 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; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | // TODO: remove this after refactoring RenameController and DeleteController |
95 | - protected function error($error_type, $variables = []) |
|
95 | + protected function error($error_type, $variables = [ ]) |
|
96 | 96 | { |
97 | 97 | return trans(Lfm::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables); |
98 | 98 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | return response()->json(parent::error('rename'), 400); |
44 | 44 | } |
45 | 45 | |
46 | - if (! $is_directory) { |
|
46 | + if (!$is_directory) { |
|
47 | 47 | $extension = $old_file->extension(); |
48 | 48 | if ($extension) { |
49 | 49 | $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension; |