@@ -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 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | $config = $this->disk->getConfig(); |
47 | 47 | |
48 | - if (key_exists('driver', $config) && $config['driver'] == 's3') { |
|
48 | + if (key_exists('driver', $config) && $config[ 'driver' ] == 's3') { |
|
49 | 49 | $duration = $this->helper->config('temporary_url_duration'); |
50 | 50 | return $this->disk->temporaryUrl($path, now()->addMinutes($duration)); |
51 | 51 | } else { |
@@ -18,9 +18,9 @@ |
||
18 | 18 | $disk = Storage::disk($this->helper->config('disk')); |
19 | 19 | $config = $disk->getConfig(); |
20 | 20 | |
21 | - if (key_exists('driver', $config) && $config['driver'] == 's3') { |
|
21 | + if (key_exists('driver', $config) && $config[ 'driver' ] == 's3') { |
|
22 | 22 | $duration = $this->helper->config('temporary_url_duration'); |
23 | - return response()->streamDownload(function () { |
|
23 | + return response()->streamDownload(function() { |
|
24 | 24 | echo file_get_contents($disk->temporaryUrl($file->path('storage'), now()->addMinutes($duration))); |
25 | 25 | }, $file_name); |
26 | 26 | } else { |
@@ -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; |
@@ -77,7 +77,7 @@ |
||
77 | 77 | { |
78 | 78 | $extension = strtolower($this->file->getClientOriginalExtension()); |
79 | 79 | |
80 | - $excutable_extensions = ['php', 'html']; |
|
80 | + $excutable_extensions = [ 'php', 'html' ]; |
|
81 | 81 | |
82 | 82 | if (in_array($extension, $excutable_extensions)) { |
83 | 83 | throw new ExcutableFileException(); |