@@ -45,8 +45,7 @@ discard block |
||
| 45 | 45 | mkdir($path); |
| 46 | 46 | |
| 47 | 47 | file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Deny from all'); |
| 48 | - } |
|
| 49 | - else |
|
| 48 | + } else |
|
| 50 | 49 | { |
| 51 | 50 | $errors->add($this->id, "Unable to create %directory directory, its parent is not writable.", [ '%directory' => $path ]); |
| 52 | 51 | } |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | mkdir($path); |
| 68 | 67 | |
| 69 | 68 | file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Allow from all'); |
| 70 | - } |
|
| 71 | - else |
|
| 69 | + } else |
|
| 72 | 70 | { |
| 73 | 71 | $errors->add($this->id, "Unable to create %directory directory, its parent is not writable", [ '%directory' => $path ]); |
| 74 | 72 | } |
@@ -89,8 +87,7 @@ discard block |
||
| 89 | 87 | mkdir($path); |
| 90 | 88 | |
| 91 | 89 | file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Deny from all'); |
| 92 | - } |
|
| 93 | - else |
|
| 90 | + } else |
|
| 94 | 91 | { |
| 95 | 92 | $errors->add($this->id, 'Unable to create %directory directory, its parent is not writable', [ '%directory' => $path ]); |
| 96 | 93 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | # $repository/tmp |
| 35 | 35 | # |
| 36 | 36 | |
| 37 | - $path = $repository . 'tmp'; |
|
| 37 | + $path = $repository.'tmp'; |
|
| 38 | 38 | |
| 39 | 39 | if (!file_exists($path)) |
| 40 | 40 | { |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | mkdir($path); |
| 46 | 46 | |
| 47 | - file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Deny from all'); |
|
| 47 | + file_put_contents($path.DIRECTORY_SEPARATOR.'.htaccess', 'Deny from all'); |
|
| 48 | 48 | } |
| 49 | 49 | else |
| 50 | 50 | { |
| 51 | - $errors->add($this->id, "Unable to create %directory directory, its parent is not writable.", [ '%directory' => $path ]); |
|
| 51 | + $errors->add($this->id, "Unable to create %directory directory, its parent is not writable.", ['%directory' => $path]); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | # $repository/files |
| 57 | 57 | # |
| 58 | 58 | |
| 59 | - $path = $repository . 'files'; |
|
| 59 | + $path = $repository.'files'; |
|
| 60 | 60 | |
| 61 | 61 | if (!file_exists($path)) |
| 62 | 62 | { |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | mkdir($path); |
| 68 | 68 | |
| 69 | - file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Allow from all'); |
|
| 69 | + file_put_contents($path.DIRECTORY_SEPARATOR.'.htaccess', 'Allow from all'); |
|
| 70 | 70 | } |
| 71 | 71 | else |
| 72 | 72 | { |
| 73 | - $errors->add($this->id, "Unable to create %directory directory, its parent is not writable", [ '%directory' => $path ]); |
|
| 73 | + $errors->add($this->id, "Unable to create %directory directory, its parent is not writable", ['%directory' => $path]); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | # $repository/files-index |
| 79 | 79 | # |
| 80 | 80 | |
| 81 | - $path = $repository . 'files-index'; |
|
| 81 | + $path = $repository.'files-index'; |
|
| 82 | 82 | |
| 83 | 83 | if (!file_exists($path)) |
| 84 | 84 | { |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | mkdir($path); |
| 90 | 90 | |
| 91 | - file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Deny from all'); |
|
| 91 | + file_put_contents($path.DIRECTORY_SEPARATOR.'.htaccess', 'Deny from all'); |
|
| 92 | 92 | } |
| 93 | 93 | else |
| 94 | 94 | { |
| 95 | - $errors->add($this->id, 'Unable to create %directory directory, its parent is not writable', [ '%directory' => $path ]); |
|
| 95 | + $errors->add($this->id, 'Unable to create %directory directory, its parent is not writable', ['%directory' => $path]); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -118,22 +118,22 @@ discard block |
||
| 118 | 118 | # $repository/tmp |
| 119 | 119 | # |
| 120 | 120 | |
| 121 | - $path = $repository . 'tmp'; |
|
| 121 | + $path = $repository.'tmp'; |
|
| 122 | 122 | |
| 123 | 123 | if (!is_dir($path)) |
| 124 | 124 | { |
| 125 | - $errors->add($this->id, "The %directory directory is missing.", [ '%directory' => $path ]); |
|
| 125 | + $errors->add($this->id, "The %directory directory is missing.", ['%directory' => $path]); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | # |
| 129 | 129 | # $repository/files |
| 130 | 130 | # |
| 131 | 131 | |
| 132 | - $path = $repository . 'files'; |
|
| 132 | + $path = $repository.'files'; |
|
| 133 | 133 | |
| 134 | 134 | if (!is_dir($path)) |
| 135 | 135 | { |
| 136 | - $errors->add($this->id, "The %directory directory is missing.", [ '%directory' => $path ]); |
|
| 136 | + $errors->add($this->id, "The %directory directory is missing.", ['%directory' => $path]); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return parent::is_installed($errors); |
@@ -141,18 +141,18 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function clean_temporary_files($lifetime = 3600) |
| 143 | 143 | { |
| 144 | - $path = \ICanBoogie\REPOSITORY . 'tmp'; |
|
| 144 | + $path = \ICanBoogie\REPOSITORY.'tmp'; |
|
| 145 | 145 | |
| 146 | 146 | if (!is_dir($path)) |
| 147 | 147 | { |
| 148 | - \ICanBoogie\log_error('The directory %directory does not exists', [ '%directory' => $path ]); |
|
| 148 | + \ICanBoogie\log_error('The directory %directory does not exists', ['%directory' => $path]); |
|
| 149 | 149 | |
| 150 | 150 | return; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (!is_writable($path)) |
| 154 | 154 | { |
| 155 | - \ICanBoogie\log_error('The directory %directory is not writable', [ '%directory' => $path ]); |
|
| 155 | + \ICanBoogie\log_error('The directory %directory is not writable', ['%directory' => $path]); |
|
| 156 | 156 | |
| 157 | 157 | return; |
| 158 | 158 | } |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | namespace Icybee\Modules\Files; |
| 13 | 13 | |
| 14 | 14 | use Brickrouge\Element; |
| 15 | -use ICanBoogie\I18n; |
|
| 16 | 15 | |
| 17 | 16 | class FileUpload extends \Brickrouge\File |
| 18 | 17 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | foreach ($details as $detail) |
| 39 | 39 | { |
| 40 | - $rc .= '<li>' . $detail . '</li>'; |
|
| 40 | + $rc .= '<li>'.$detail.'</li>'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $rc .= '</ul>'; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | 'class' => "icon-download-alt", |
| 56 | 56 | 'href' => $path, |
| 57 | - 'title' => $this->t('download', [], [ 'scope' => 'fileupload.element' ]) |
|
| 57 | + 'title' => $this->t('download', [], ['scope' => 'fileupload.element']) |
|
| 58 | 58 | |
| 59 | 59 | ]); |
| 60 | 60 | } |
@@ -12,12 +12,10 @@ |
||
| 12 | 12 | namespace Icybee\Modules\Files\Routing; |
| 13 | 13 | |
| 14 | 14 | use ICanBoogie\HTTP\FileResponse; |
| 15 | -use ICanBoogie\HTTP\Request; |
|
| 16 | 15 | use ICanBoogie\Routing\Controller; |
| 17 | 16 | use ICanBoogie\Binding\Routing\ControllerBindings; |
| 18 | 17 | use ICanBoogie\Binding\Routing\ForwardUndefinedPropertiesToApplication; |
| 19 | 18 | use ICanBoogie\Module\ControllerBindings as ModuleBindings; |
| 20 | - |
|
| 21 | 19 | use Icybee\Modules\Files\Binding\CoreBindings; |
| 22 | 20 | use Icybee\Modules\Files\File; |
| 23 | 21 | |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | return new FileResponse($pathname, $this->request, [ |
| 80 | 80 | |
| 81 | 81 | FileResponse::OPTION_ETAG => $pathname->hash, |
| 82 | - FileResponse::OPTION_FILENAME => $record->title . $record->extension, |
|
| 82 | + FileResponse::OPTION_FILENAME => $record->title.$record->extension, |
|
| 83 | 83 | FileResponse::OPTION_MIME => $record->mime |
| 84 | 84 | |
| 85 | 85 | ]); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | foreach ($model->select("nid, path")->mode(\PDO::FETCH_NUM) as list($nid, $path)) |
| 64 | 64 | { |
| 65 | - $update('.' . pathinfo($path, PATHINFO_EXTENSION), $nid); |
|
| 65 | + $update('.'.pathinfo($path, PATHINFO_EXTENSION), $nid); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | foreach ($model->select("nid, uuid, path")->mode(\PDO::FETCH_NUM) as list($nid, $uuid, $path)) |
| 86 | 86 | { |
| 87 | - $path = $document_root . $path; |
|
| 87 | + $path = $document_root.$path; |
|
| 88 | 88 | |
| 89 | 89 | if (!file_exists($path)) |
| 90 | 90 | { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $hash = $storage->add($path)->hash; |
| 97 | - $index->add(IndexKey::from([ $nid, $uuid, $hash ])); |
|
| 97 | + $index->add(IndexKey::from([$nid, $uuid, $hash])); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $model->remove_column('path'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $error_message = $errors->add( |
| 97 | 97 | File::HTTP_FILE, |
| 98 | 98 | "Maximum file size is :size Mb", |
| 99 | - [ ':size' => round($max_file_size / 1024) ] |
|
| 99 | + [':size' => round($max_file_size / 1024)] |
|
| 100 | 100 | ); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $error_message = $errors->add( |
| 106 | 106 | File::HTTP_FILE, |
| 107 | 107 | "Only the following file types are accepted: %accepted.", |
| 108 | - [ '%accepted' => implode(', ', $this->accept) ] |
|
| 108 | + ['%accepted' => implode(', ', $this->accept)] |
|
| 109 | 109 | ); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | protected function create_temporary_file(HTTPFile $file) |
| 161 | 161 | { |
| 162 | - $pathname = \ICanBoogie\REPOSITORY . 'tmp' . DIRECTORY_SEPARATOR . \ICanBoogie\generate_v4_uuid() . $file->extension; |
|
| 162 | + $pathname = \ICanBoogie\REPOSITORY.'tmp'.DIRECTORY_SEPARATOR.\ICanBoogie\generate_v4_uuid().$file->extension; |
|
| 163 | 163 | |
| 164 | 164 | $file->move($pathname); |
| 165 | 165 | |
| 166 | - file_put_contents($pathname . '.info', json_encode($file->to_array())); |
|
| 166 | + file_put_contents($pathname.'.info', json_encode($file->to_array())); |
|
| 167 | 167 | |
| 168 | 168 | return $pathname; |
| 169 | 169 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | return static::from_pathname($pathname_or_parts); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - throw new \InvalidArgumentException("Expected an array or a string, got: " . gettype($pathname_or_parts) . "."); |
|
| 160 | + throw new \InvalidArgumentException("Expected an array or a string, got: ".gettype($pathname_or_parts)."."); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | static protected function from_parts(array $parts) |
| 175 | 175 | { |
| 176 | - list($root, $hash, $random) = $parts + [ 2 => null]; |
|
| 176 | + list($root, $hash, $random) = $parts + [2 => null]; |
|
| 177 | 177 | |
| 178 | 178 | $random = $random ?: self::random(); |
| 179 | 179 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | $ds = preg_quote(DIRECTORY_SEPARATOR); |
| 193 | 193 | |
| 194 | - if (!preg_match("#(.+{$ds})" . self::FILENAME_REGEX . '$#', $pathname, $matches)) |
|
| 194 | + if (!preg_match("#(.+{$ds})".self::FILENAME_REGEX.'$#', $pathname, $matches)) |
|
| 195 | 195 | { |
| 196 | 196 | throw new \InvalidArgumentException("Invalid hash pathname: $pathname."); |
| 197 | 197 | } |
@@ -218,6 +218,6 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function __toString() |
| 220 | 220 | { |
| 221 | - return $this->root . $this->filename; |
|
| 221 | + return $this->root.$this->filename; |
|
| 222 | 222 | } |
| 223 | 223 | } |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | { |
| 27 | 27 | parent::add_assets($document); |
| 28 | 28 | |
| 29 | - $document->css->add(Root\DIR . '/public/manage.css'); |
|
| 29 | + $document->css->add(Root\DIR.'/public/manage.css'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function __construct(Module $module, array $attributes) |
| 33 | 33 | { |
| 34 | 34 | parent::__construct($module, $attributes + [ |
| 35 | 35 | |
| 36 | - self::T_COLUMNS_ORDER => [ 'title', 'size', 'download', 'is_online', 'uid', 'mime', 'updated_at' ] |
|
| 36 | + self::T_COLUMNS_ORDER => ['title', 'size', 'download', 'is_online', 'uid', 'mime', 'updated_at'] |
|
| 37 | 37 | |
| 38 | 38 | ]); |
| 39 | 39 | } |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | |
| 14 | 14 | use ICanBoogie; |
| 15 | 15 | |
| 16 | -$hooks = Hooks::class . '::'; |
|
| 16 | +$hooks = Hooks::class.'::'; |
|
| 17 | 17 | |
| 18 | 18 | return [ |
| 19 | 19 | |
| 20 | - ICanBoogie\Core::class . '::lazy_get_file_storage_index' => $hooks . 'get_file_storage_index', |
|
| 21 | - ICanBoogie\Core::class . '::lazy_get_file_storage' => $hooks . 'get_file_storage' |
|
| 20 | + ICanBoogie\Core::class.'::lazy_get_file_storage_index' => $hooks.'get_file_storage_index', |
|
| 21 | + ICanBoogie\Core::class.'::lazy_get_file_storage' => $hooks.'get_file_storage' |
|
| 22 | 22 | |
| 23 | 23 | ]; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'files:show' => [ |
| 21 | 21 | |
| 22 | 22 | 'pattern' => '/files/<uuid:{:uuid:}><extension:[\.a-z]*>', |
| 23 | - 'controller' => FilesController::class . '#show', |
|
| 23 | + 'controller' => FilesController::class.'#show', |
|
| 24 | 24 | 'via' => Request::METHOD_GET |
| 25 | 25 | |
| 26 | 26 | ], |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'files:download' => [ |
| 29 | 29 | |
| 30 | 30 | 'pattern' => '/files/download/<uuid:{:uuid:}><extension:[\.a-z]*>', |
| 31 | - 'controller' => FilesController::class . '#download', |
|
| 31 | + 'controller' => FilesController::class.'#download', |
|
| 32 | 32 | 'via' => Request::METHOD_GET |
| 33 | 33 | |
| 34 | 34 | ], |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | 'files:protected:show' => [ |
| 37 | 37 | |
| 38 | 38 | 'pattern' => '/files/<nid:\d+><extension:[\.a-z]*>', |
| 39 | - 'controller' => FilesAdminController::class . '#show' |
|
| 39 | + 'controller' => FilesAdminController::class.'#show' |
|
| 40 | 40 | |
| 41 | 41 | ], |
| 42 | 42 | |
| 43 | 43 | 'files:protected:download' => [ |
| 44 | 44 | |
| 45 | 45 | 'pattern' => '/files/download/<nid:\d+><extension:[\.a-z]*>', |
| 46 | - 'controller' => FilesAdminController::class . '#download' |
|
| 46 | + 'controller' => FilesAdminController::class.'#download' |
|
| 47 | 47 | |
| 48 | 48 | ] |
| 49 | 49 | |