@@ -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 | } |
@@ -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 | |
@@ -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 | |
@@ -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; |
@@ -11,20 +11,20 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function getFolders() |
| 13 | 13 | { |
| 14 | - $folder_types = array_filter(['user', 'share'], function ($type) { |
|
| 14 | + $folder_types = array_filter([ 'user', 'share' ], function($type) { |
|
| 15 | 15 | return $this->helper->allowFolderType($type); |
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | return view('laravel-filemanager::tree') |
| 19 | 19 | ->with([ |
| 20 | - 'root_folders' => array_map(function ($type) use ($folder_types) { |
|
| 20 | + 'root_folders' => array_map(function($type) use ($folder_types) { |
|
| 21 | 21 | $path = $this->lfm->dir($this->helper->getRootFolder($type)); |
| 22 | 22 | |
| 23 | 23 | return (object) [ |
| 24 | 24 | 'name' => trans('laravel-filemanager::lfm.title-' . $type), |
| 25 | 25 | 'url' => $path->path('working_dir'), |
| 26 | 26 | 'children' => $path->folders(), |
| 27 | - 'has_next' => ! ($type == end($folder_types)), |
|
| 27 | + 'has_next' => !($type == end($folder_types)), |
|
| 28 | 28 | ]; |
| 29 | 29 | }, $folder_types), |
| 30 | 30 | ]); |
@@ -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' => 'filemanager', 'middleware' => ['web', 'auth']], function () { |
|
| 41 | + Route::group([ 'prefix' => 'filemanager', 'middleware' => [ 'web', 'auth' ] ], function() { |
|
| 42 | 42 | \UniSharp\LaravelFilemanager\Lfm::routes(); |
| 43 | 43 | }); |
| 44 | 44 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $this->mergeConfigFrom(__DIR__ . '/config/lfm.php', 'lfm-config'); |
| 55 | 55 | |
| 56 | - $this->app->singleton('laravel-filemanager', function () { |
|
| 56 | + $this->app->singleton('laravel-filemanager', function() { |
|
| 57 | 57 | return true; |
| 58 | 58 | }); |
| 59 | 59 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function getDelete() |
| 17 | 17 | { |
| 18 | 18 | $item_names = request('items'); |
| 19 | - $errors = []; |
|
| 19 | + $errors = [ ]; |
|
| 20 | 20 | |
| 21 | 21 | foreach ($item_names as $name_to_delete) { |
| 22 | 22 | $file = $this->lfm->setName($name_to_delete); |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | continue; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if (! $this->lfm->setName($name_to_delete)->exists()) { |
|
| 39 | - array_push($errors, parent::error('folder-not-found', ['folder' => $file_path])); |
|
| 38 | + if (!$this->lfm->setName($name_to_delete)->exists()) { |
|
| 39 | + array_push($errors, parent::error('folder-not-found', [ 'folder' => $file_path ])); |
|
| 40 | 40 | continue; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ($this->lfm->setName($name_to_delete)->isDirectory()) { |
| 44 | - if (! $this->lfm->setName($name_to_delete)->directoryIsEmpty()) { |
|
| 44 | + if (!$this->lfm->setName($name_to_delete)->directoryIsEmpty()) { |
|
| 45 | 45 | array_push($errors, parent::error('delete-folder')); |
| 46 | 46 | continue; |
| 47 | 47 | } |
@@ -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 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function allowShareFolder() |
| 193 | 193 | { |
| 194 | - if (! $this->allowMultiUser()) { |
|
| 194 | + if (!$this->allowMultiUser()) { |
|
| 195 | 195 | return true; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param mixed $variables Variables the message needs. |
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | - public function error($error_type, $variables = []) |
|
| 248 | + public function error($error_type, $variables = [ ]) |
|
| 249 | 249 | { |
| 250 | 250 | throw new \Exception(trans(self::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables)); |
| 251 | 251 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $as = 'unisharp.lfm.'; |
| 262 | 262 | $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\'; |
| 263 | 263 | |
| 264 | - Route::group(compact('middleware', 'as', 'namespace'), function () { |
|
| 264 | + Route::group(compact('middleware', 'as', 'namespace'), function() { |
|
| 265 | 265 | |
| 266 | 266 | // display main layout |
| 267 | 267 | Route::get('/', [ |