@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | |
96 | 96 | public function folders() |
97 | 97 | { |
98 | - $all_folders = array_map(function ($directory_path) { |
|
98 | + $all_folders = array_map(function($directory_path) { |
|
99 | 99 | return $this->pretty($directory_path); |
100 | 100 | }, $this->storage->directories()); |
101 | 101 | |
102 | - $folders = array_filter($all_folders, function ($directory) { |
|
102 | + $folders = array_filter($all_folders, function($directory) { |
|
103 | 103 | return $directory->name !== $this->helper->getThumbFolderName(); |
104 | 104 | }); |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | public function files() |
110 | 110 | { |
111 | - $files = array_map(function ($file_path) { |
|
111 | + $files = array_map(function($file_path) { |
|
112 | 112 | return $this->pretty($file_path); |
113 | 113 | }, $this->storage->files()); |
114 | 114 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $working_dir = $this->path('working_dir'); |
153 | 153 | $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/')); |
154 | 154 | |
155 | - $parent_directories = array_map(function ($directory_path) { |
|
155 | + $parent_directories = array_map(function($directory_path) { |
|
156 | 156 | return app(static::class)->translateToLfmPath($directory_path); |
157 | 157 | }, app(static::class)->dir($parent_dir)->directories()); |
158 | 158 | |
@@ -196,20 +196,20 @@ discard block |
||
196 | 196 | public function sortByColumn($arr_items) |
197 | 197 | { |
198 | 198 | $sort_by = $this->helper->input('sort_type'); |
199 | - if (in_array($sort_by, ['name', 'time'])) { |
|
199 | + if (in_array($sort_by, [ 'name', 'time' ])) { |
|
200 | 200 | $key_to_sort = $sort_by; |
201 | 201 | } else { |
202 | 202 | $key_to_sort = 'name'; |
203 | 203 | } |
204 | 204 | |
205 | - uasort($arr_items, function ($a, $b) use ($key_to_sort) { |
|
205 | + uasort($arr_items, function($a, $b) use ($key_to_sort) { |
|
206 | 206 | return strcmp($a->{$key_to_sort}, $b->{$key_to_sort}); |
207 | 207 | }); |
208 | 208 | |
209 | 209 | return $arr_items; |
210 | 210 | } |
211 | 211 | |
212 | - public function error($error_type, $variables = []) |
|
212 | + public function error($error_type, $variables = [ ]) |
|
213 | 213 | { |
214 | 214 | return $this->helper->error($error_type, $variables); |
215 | 215 | } |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | { |
239 | 239 | if (empty($file)) { |
240 | 240 | return $this->error('file-empty'); |
241 | - } elseif (! $file instanceof UploadedFile) { |
|
241 | + } elseif (!$file instanceof UploadedFile) { |
|
242 | 242 | return $this->error('instance'); |
243 | 243 | } elseif ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
244 | - return $this->error('file-size', ['max' => ini_get('upload_max_filesize')]); |
|
244 | + return $this->error('file-size', [ 'max' => ini_get('upload_max_filesize') ]); |
|
245 | 245 | } elseif ($file->getError() != UPLOAD_ERR_OK) { |
246 | 246 | throw new \Exception('File failed to upload. Error code: ' . $file->getError()); |
247 | 247 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | private function checkDefaultFolderExists($type = 'share') |
29 | 29 | { |
30 | - if (! $this->helper->allowFolderType($type)) { |
|
30 | + if (!$this->helper->allowFolderType($type)) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | if ($previous_dir == null) { |
24 | 24 | $request->merge(compact('working_dir')); |
25 | - } elseif (! $this->validDir($previous_dir)) { |
|
25 | + } elseif (!$this->validDir($previous_dir)) { |
|
26 | 26 | $request->replace(compact('working_dir')); |
27 | 27 | } |
28 | 28 | } |
@@ -17,28 +17,28 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function boot() |
19 | 19 | { |
20 | - $this->loadTranslationsFrom(__DIR__.'/lang', 'laravel-filemanager'); |
|
20 | + $this->loadTranslationsFrom(__DIR__ . '/lang', 'laravel-filemanager'); |
|
21 | 21 | |
22 | - $this->loadViewsFrom(__DIR__.'/views', 'laravel-filemanager'); |
|
22 | + $this->loadViewsFrom(__DIR__ . '/views', 'laravel-filemanager'); |
|
23 | 23 | |
24 | 24 | $this->publishes([ |
25 | 25 | __DIR__ . '/config/lfm.php' => base_path('config/lfm.php'), |
26 | 26 | ], 'lfm_config'); |
27 | 27 | |
28 | 28 | $this->publishes([ |
29 | - __DIR__.'/../public' => public_path('vendor/laravel-filemanager'), |
|
29 | + __DIR__ . '/../public' => public_path('vendor/laravel-filemanager'), |
|
30 | 30 | ], 'lfm_public'); |
31 | 31 | |
32 | 32 | $this->publishes([ |
33 | - __DIR__.'/views' => base_path('resources/views/vendor/laravel-filemanager'), |
|
33 | + __DIR__ . '/views' => base_path('resources/views/vendor/laravel-filemanager'), |
|
34 | 34 | ], 'lfm_view'); |
35 | 35 | |
36 | 36 | $this->publishes([ |
37 | - __DIR__.'/Handlers/LfmConfigHandler.php' => base_path('app/Handlers/LfmConfigHandler.php'), |
|
37 | + __DIR__ . '/Handlers/LfmConfigHandler.php' => base_path('app/Handlers/LfmConfigHandler.php'), |
|
38 | 38 | ], 'lfm_handler'); |
39 | 39 | |
40 | 40 | if (config('lfm.use_package_routes')) { |
41 | - Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'auth']], function () { |
|
41 | + Route::group([ 'prefix' => 'laravel-filemanager', 'middleware' => [ 'web', 'auth' ] ], function() { |
|
42 | 42 | \UniSharp\LaravelFilemanager\Lfm::routes(); |
43 | 43 | }); |
44 | 44 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function register() |
53 | 53 | { |
54 | - $this->app->singleton('laravel-filemanager', function () { |
|
54 | + $this->app->singleton('laravel-filemanager', function() { |
|
55 | 55 | return true; |
56 | 56 | }); |
57 | 57 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $storage = Storage::disk($this->helper->config('disk')); |
12 | 12 | |
13 | - if (! $storage->exists($file_path)) { |
|
13 | + if (!$storage->exists($file_path)) { |
|
14 | 14 | abort(404); |
15 | 15 | } |
16 | 16 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function __construct() |
15 | 15 | { |
16 | 16 | parent::__construct(); |
17 | - $this->errors = []; |
|
17 | + $this->errors = [ ]; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -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 | $new_filename = $this->lfm->upload($file); |
35 | 35 | } catch (\Exception $e) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $response = count($error_bag) > 0 ? $error_bag : parent::$success_response; |
47 | 47 | } else { // upload via ckeditor 'Upload' tab |
48 | 48 | if (is_null($new_filename)) { |
49 | - $response = $error_bag[0]; |
|
49 | + $response = $error_bag[ 0 ]; |
|
50 | 50 | } else { |
51 | 51 | $response = view(Lfm::PACKAGE_NAME . '::use') |
52 | 52 | ->withFile($this->lfm->setName($new_filename)->url()); |
@@ -31,9 +31,9 @@ |
||
31 | 31 | $image_path = $this->lfm->setName($image_name)->path('absolute'); |
32 | 32 | $crop_path = $image_path; |
33 | 33 | |
34 | - if (! $overWrite) { |
|
34 | + if (!$overWrite) { |
|
35 | 35 | $fileParts = explode('.', $image_name); |
36 | - $fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_cropped_' . time(); |
|
36 | + $fileParts[ count($fileParts) - 2 ] = $fileParts[ count($fileParts) - 2 ] . '_cropped_' . time(); |
|
37 | 37 | $crop_path = $this->lfm->setName(implode('.', $fileParts))->path('absolute'); |
38 | 38 | } |
39 | 39 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function getItems() |
18 | 18 | { |
19 | 19 | return [ |
20 | - 'items' => array_map(function ($item) { |
|
20 | + 'items' => array_map(function($item) { |
|
21 | 21 | return $item->fill()->attributes; |
22 | 22 | }, array_merge($this->lfm->folders(), $this->lfm->files())), |
23 | 23 | 'display' => $this->helper->getDisplayMode(), |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | public function move() |
29 | 29 | { |
30 | 30 | $items = request('items'); |
31 | - $folder_types = array_filter(['user', 'share'], function ($type) { |
|
31 | + $folder_types = array_filter([ 'user', 'share' ], function($type) { |
|
32 | 32 | return $this->helper->allowFolderType($type); |
33 | 33 | }); |
34 | 34 | return view('laravel-filemanager::move') |
35 | 35 | ->with([ |
36 | - 'root_folders' => array_map(function ($type) use ($folder_types) { |
|
36 | + 'root_folders' => array_map(function($type) use ($folder_types) { |
|
37 | 37 | $path = $this->lfm->dir($this->helper->getRootFolder($type)); |
38 | 38 | |
39 | 39 | return (object) [ |
40 | 40 | 'name' => trans('laravel-filemanager::lfm.title-' . $type), |
41 | 41 | 'url' => $path->path('working_dir'), |
42 | 42 | 'children' => $path->folders(), |
43 | - 'has_next' => ! ($type == end($folder_types)), |
|
43 | + 'has_next' => !($type == end($folder_types)), |
|
44 | 44 | ]; |
45 | 45 | }, $folder_types), |
46 | 46 | ]) |
@@ -33,7 +33,7 @@ |
||
33 | 33 | return parent::error('rename'); |
34 | 34 | } |
35 | 35 | |
36 | - if (! $is_directory) { |
|
36 | + if (!$is_directory) { |
|
37 | 37 | $extension = $old_file->extension(); |
38 | 38 | if ($extension) { |
39 | 39 | $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension; |