@@ -15,6 +15,6 @@ |
||
| 15 | 15 | |
| 16 | 16 | use Filemanager\Common\Addons; |
| 17 | 17 | |
| 18 | - protected $path_full = (DIR_SYSTEM_CLASSES . 'Addons/'); |
|
| 18 | + protected $path_full = (DIR_SYSTEM_CLASSES.'Addons/'); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | |
| 16 | 16 | use Filemanager\Common\Templates; |
| 17 | 17 | |
| 18 | - protected $path_full = (DIR_SYSTEM_TEMPLATES . SECTION_SITE . '/'); |
|
| 18 | + protected $path_full = (DIR_SYSTEM_TEMPLATES.SECTION_SITE.'/'); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | # Set link |
| 30 | 30 | |
| 31 | - $query = (('' !== $this->parent->getPath()) ? ('?parent=' . $this->parent->getPath()) : ''); |
|
| 31 | + $query = (('' !== $this->parent->getPath()) ? ('?parent='.$this->parent->getPath()) : ''); |
|
| 32 | 32 | |
| 33 | - $bar->link = (INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
| 33 | + $bar->link = (INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
| 34 | 34 | |
| 35 | 35 | # Implement form |
| 36 | 36 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | private function getPaginationBlock() { |
| 47 | 47 | |
| 48 | - $query = (('' !== $this->parent->getPath()) ? ('?parent=' . $this->parent->getPath()) : ''); |
|
| 48 | + $query = (('' !== $this->parent->getPath()) ? ('?parent='.$this->parent->getPath()) : ''); |
|
| 49 | 49 | |
| 50 | - $url = new Url(INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
| 50 | + $url = new Url(INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
| 51 | 51 | |
| 52 | 52 | # ------------------------ |
| 53 | 53 | |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | if (isset($submitted)) { |
| 150 | 150 | |
| 151 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '?' . (('' !== |
|
| 151 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$origin.'?'.(('' !== |
|
| 152 | 152 | |
| 153 | - ($parent = $this->parent->getPath())) ? ('parent=' . $parent . '&') : '') . 'submitted=' . $submitted); |
|
| 153 | + ($parent = $this->parent->getPath())) ? ('parent='.$parent.'&') : '').'submitted='.$submitted); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | # Display success message |
@@ -64,7 +64,9 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | # Set parent |
| 66 | 66 | |
| 67 | - if (!$ajax) $contents->parent = $this->parent->getPath(); |
|
| 67 | + if (!$ajax) { |
|
| 68 | + $contents->parent = $this->parent->getPath(); |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | # Set origin and title |
| 70 | 72 | |
@@ -76,7 +78,9 @@ discard block |
||
| 76 | 78 | |
| 77 | 79 | # Process bar |
| 78 | 80 | |
| 79 | - if (!$ajax) $this->processBar($contents->getBlock('bar')); |
|
| 81 | + if (!$ajax) { |
|
| 82 | + $this->processBar($contents->getBlock('bar')); |
|
| 83 | + } |
|
| 80 | 84 | |
| 81 | 85 | # Set items |
| 82 | 86 | |
@@ -84,14 +88,18 @@ discard block |
||
| 84 | 88 | |
| 85 | 89 | foreach ($this->loader->getItems() as $entity) { |
| 86 | 90 | |
| 87 | - if ($entity->isDir()) $items->addItem(Lister\Dir::getBlock($entity, $ajax)); |
|
| 88 | - |
|
| 89 | - else $items->addItem(Lister\File::getBlock($entity, $ajax)); |
|
| 91 | + if ($entity->isDir()) { |
|
| 92 | + $items->addItem(Lister\Dir::getBlock($entity, $ajax)); |
|
| 93 | + } else { |
|
| 94 | + $items->addItem(Lister\File::getBlock($entity, $ajax)); |
|
| 95 | + } |
|
| 90 | 96 | } |
| 91 | 97 | |
| 92 | 98 | # Set pagination |
| 93 | 99 | |
| 94 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
| 100 | + if (!$ajax) { |
|
| 101 | + $contents->pagination = $this->getPaginationBlock(); |
|
| 102 | + } |
|
| 95 | 103 | |
| 96 | 104 | # ------------------------ |
| 97 | 105 | |
@@ -127,7 +135,9 @@ discard block |
||
| 127 | 135 | |
| 128 | 136 | protected function handle(bool $ajax = false) { |
| 129 | 137 | |
| 130 | - if ($ajax) return $this->handleAjax(); |
|
| 138 | + if ($ajax) { |
|
| 139 | + return $this->handleAjax(); |
|
| 140 | + } |
|
| 131 | 141 | |
| 132 | 142 | # Create parent |
| 133 | 143 | |
@@ -141,9 +151,11 @@ discard block |
||
| 141 | 151 | |
| 142 | 152 | if (static::$permissions['manage']) { |
| 143 | 153 | |
| 144 | - if (Uploader::handle('upload', $this->parent->getPathFull(), true)) $submitted = 'upload'; |
|
| 145 | - |
|
| 146 | - else if ($this->form->handle(new Filemanager\Controller\Create($this->parent), true)) $submitted = 'create'; |
|
| 154 | + if (Uploader::handle('upload', $this->parent->getPathFull(), true)) { |
|
| 155 | + $submitted = 'upload'; |
|
| 156 | + } else if ($this->form->handle(new Filemanager\Controller\Create($this->parent), true)) { |
|
| 157 | + $submitted = 'create'; |
|
| 158 | + } |
|
| 147 | 159 | } |
| 148 | 160 | |
| 149 | 161 | if (isset($submitted)) { |
@@ -155,9 +167,11 @@ discard block |
||
| 155 | 167 | |
| 156 | 168 | # Display success message |
| 157 | 169 | |
| 158 | - if (Request::get('submitted') === 'upload') Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_UPLOAD')); |
|
| 159 | - |
|
| 160 | - else if (Request::get('submitted') === 'create') Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_DIR_CREATE')); |
|
| 170 | + if (Request::get('submitted') === 'upload') { |
|
| 171 | + Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_UPLOAD')); |
|
| 172 | + } else if (Request::get('submitted') === 'create') { |
|
| 173 | + Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_DIR_CREATE')); |
|
| 174 | + } |
|
| 161 | 175 | |
| 162 | 176 | # Load items |
| 163 | 177 | |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $name = $entity->getName(); $path = $entity->getPath(); |
| 27 | 27 | |
| 28 | - $query = ('?parent=' . $parent->getPath() . '&name=' . $name); |
|
| 28 | + $query = ('?parent='.$parent->getPath().'&name='.$name); |
|
| 29 | 29 | |
| 30 | - $link = (INSTALL_PATH . '/admin/content/filemanager/' . $parent->getOrigin() . '/dir' . $query); |
|
| 30 | + $link = (INSTALL_PATH.'/admin/content/filemanager/'.$parent->getOrigin().'/dir'.$query); |
|
| 31 | 31 | |
| 32 | 32 | # Set data |
| 33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | # Set link |
| 37 | 37 | |
| 38 | - $view->link = (INSTALL_PATH . '/admin/content/filemanager/' . $parent->getOrigin() . '?parent=' . $path); |
|
| 38 | + $view->link = (INSTALL_PATH.'/admin/content/filemanager/'.$parent->getOrigin().'?parent='.$path); |
|
| 39 | 39 | |
| 40 | 40 | # Set buttons |
| 41 | 41 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $format = Filemanager\Utils\Mime::getFormat($entity->getExtension()); |
| 31 | 31 | |
| 32 | - $query = ('?parent=' . $parent->getPath() . '&name=' . $name); |
|
| 32 | + $query = ('?parent='.$parent->getPath().'&name='.$name); |
|
| 33 | 33 | |
| 34 | - $link = (INSTALL_PATH . '/admin/content/filemanager/' . $parent->getOrigin() . '/file' . $query); |
|
| 34 | + $link = (INSTALL_PATH.'/admin/content/filemanager/'.$parent->getOrigin().'/file'.$query); |
|
| 35 | 35 | |
| 36 | 36 | # Set data |
| 37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | # Set link |
| 41 | 41 | |
| 42 | - $view->link = ($permissions['browse'] ? (INSTALL_PATH . '/uploads/' . $path) : $link); |
|
| 42 | + $view->link = ($permissions['browse'] ? (INSTALL_PATH.'/uploads/'.$path) : $link); |
|
| 43 | 43 | |
| 44 | 44 | $view->target = ($permissions['browse'] ? '_blank' : '_self'); |
| 45 | 45 | |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function load(int $index = 0, int $display = 0) : Loader { |
| 37 | 37 | |
| 38 | - if (!(($index >= 0) && ($display >= 0))) return $this; |
|
| 38 | + if (!(($index >= 0) && ($display >= 0))) { |
|
| 39 | + return $this; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | $dirs = []; $files = []; |
| 41 | 43 | |
@@ -43,9 +45,15 @@ discard block |
||
| 43 | 45 | |
| 44 | 46 | foreach (Explorer::iterate($this->parent->getPathFull()) as $name) { |
| 45 | 47 | |
| 46 | - if (!($entity = new Entity($this->parent, $name))->isInited()) continue; |
|
| 48 | + if (!($entity = new Entity($this->parent, $name))->isInited()) { |
|
| 49 | + continue; |
|
| 50 | + } |
|
| 47 | 51 | |
| 48 | - if ($entity->isDir()) $dirs[] = $entity; else $files[] = $entity; |
|
| 52 | + if ($entity->isDir()) { |
|
| 53 | + $dirs[] = $entity; |
|
| 54 | + } else { |
|
| 55 | + $files[] = $entity; |
|
| 56 | + } |
|
| 49 | 57 | } |
| 50 | 58 | |
| 51 | 59 | # Sort arrays |
@@ -61,7 +69,9 @@ discard block |
||
| 61 | 69 | |
| 62 | 70 | $items = array_merge($dirs, $files); $total = count($items); |
| 63 | 71 | |
| 64 | - if (($index > 0) && ($display > 0)) $items = array_splice($items, (($index - 1) * $display), $display); |
|
| 72 | + if (($index > 0) && ($display > 0)) { |
|
| 73 | + $items = array_splice($items, (($index - 1) * $display), $display); |
|
| 74 | + } |
|
| 65 | 75 | |
| 66 | 76 | # Set properties |
| 67 | 77 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | if (!$this->entity->isInited()) { |
| 120 | 120 | |
| 121 | - $query = (('' !== $this->parent->getPath()) ? ('?parent=' . $this->parent->getPath()) : ''); |
|
| 121 | + $query = (('' !== $this->parent->getPath()) ? ('?parent='.$this->parent->getPath()) : ''); |
|
| 122 | 122 | |
| 123 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '/' . $query); |
|
| 123 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$origin.'/'.$query); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | # Create rename form |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | foreach ($this->forms as $name => $form) if ($form->handle($this->controllers[$name], true)) { |
| 144 | 144 | |
| 145 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '/' . static::$type . |
|
| 145 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$origin.'/'.static::$type. |
|
| 146 | 146 | |
| 147 | - '?parent=' . $this->parent->getPath() . '&name=' . $this->entity->getName() . '&submitted=' . $name); |
|
| 147 | + '?parent='.$this->parent->getPath().'&name='.$this->entity->getName().'&submitted='.$name); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | # Display success message |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | # Implement forms |
| 47 | 47 | |
| 48 | - foreach ($this->forms as $form) $form->implement($contents); |
|
| 48 | + foreach ($this->forms as $form) { |
|
| 49 | + $form->implement($contents); |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | # Process info block |
| 51 | 53 | |
@@ -104,7 +106,9 @@ discard block |
||
| 104 | 106 | |
| 105 | 107 | # Handle ajax request |
| 106 | 108 | |
| 107 | - if ($ajax) return $this->handleAjax(); |
|
| 109 | + if ($ajax) { |
|
| 110 | + return $this->handleAjax(); |
|
| 111 | + } |
|
| 108 | 112 | |
| 109 | 113 | # Create parent |
| 110 | 114 | |
@@ -140,18 +144,22 @@ discard block |
||
| 140 | 144 | |
| 141 | 145 | # Handle form |
| 142 | 146 | |
| 143 | - foreach ($this->forms as $name => $form) if ($form->handle($this->controllers[$name], true)) { |
|
| 147 | + foreach ($this->forms as $name => $form) { |
|
| 148 | + if ($form->handle($this->controllers[$name], true)) { |
|
| 144 | 149 | |
| 145 | 150 | Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '/' . static::$type . |
| 146 | 151 | |
| 147 | 152 | '?parent=' . $this->parent->getPath() . '&name=' . $this->entity->getName() . '&submitted=' . $name); |
| 148 | 153 | } |
| 154 | + } |
|
| 149 | 155 | |
| 150 | 156 | # Display success message |
| 151 | 157 | |
| 152 | - if (Request::get('submitted') === 'rename') Popup::set('positive', Language::get(static::$message_success_rename)); |
|
| 153 | - |
|
| 154 | - else if (Request::get('submitted') === 'edit') Popup::set('positive', Language::get(static::$message_success_edit)); |
|
| 158 | + if (Request::get('submitted') === 'rename') { |
|
| 159 | + Popup::set('positive', Language::get(static::$message_success_rename)); |
|
| 160 | + } else if (Request::get('submitted') === 'edit') { |
|
| 161 | + Popup::set('positive', Language::get(static::$message_success_edit)); |
|
| 162 | + } |
|
| 155 | 163 | |
| 156 | 164 | # ------------------------ |
| 157 | 165 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | $scheme = array_diff(preg_split('/[\/\\\\]+/', $path, -1, PREG_SPLIT_NO_EMPTY), ['.', '..']); |
| 27 | 27 | |
| 28 | - $path_full = ($this->path_full . (('' !== ($path = implode('/', $scheme))) ? ($path . '/') : '')); |
|
| 28 | + $path_full = ($this->path_full.(('' !== ($path = implode('/', $scheme))) ? ($path.'/') : '')); |
|
| 29 | 29 | |
| 30 | 30 | if (!Explorer::isDir($path_full)) return; |
| 31 | 31 | |
@@ -27,7 +27,9 @@ |
||
| 27 | 27 | |
| 28 | 28 | $path_full = ($this->path_full . (('' !== ($path = implode('/', $scheme))) ? ($path . '/') : '')); |
| 29 | 29 | |
| 30 | - if (!Explorer::isDir($path_full)) return; |
|
| 30 | + if (!Explorer::isDir($path_full)) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $this->scheme = $scheme; $this->path = $path; $this->path_full = $path_full; |
| 33 | 35 | } |
@@ -34,19 +34,33 @@ |
||
| 34 | 34 | |
| 35 | 35 | public static function getFormat(string $extension) { |
| 36 | 36 | |
| 37 | - if (self::isImage($extension)) return 'image'; |
|
| 37 | + if (self::isImage($extension)) { |
|
| 38 | + return 'image'; |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | - if (self::isAudio($extension)) return 'audio'; |
|
| 41 | + if (self::isAudio($extension)) { |
|
| 42 | + return 'audio'; |
|
| 43 | + } |
|
| 40 | 44 | |
| 41 | - if (self::isVideo($extension)) return 'video'; |
|
| 45 | + if (self::isVideo($extension)) { |
|
| 46 | + return 'video'; |
|
| 47 | + } |
|
| 42 | 48 | |
| 43 | - if (in_array($extension, ['doc', 'docx'], true)) return 'word'; |
|
| 49 | + if (in_array($extension, ['doc', 'docx'], true)) { |
|
| 50 | + return 'word'; |
|
| 51 | + } |
|
| 44 | 52 | |
| 45 | - if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel'; |
|
| 53 | + if (in_array($extension, ['xls', 'xlsx'], true)) { |
|
| 54 | + return 'excel'; |
|
| 55 | + } |
|
| 46 | 56 | |
| 47 | - if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint'; |
|
| 57 | + if (in_array($extension, ['ppt', 'pptx'], true)) { |
|
| 58 | + return 'powerpoint'; |
|
| 59 | + } |
|
| 48 | 60 | |
| 49 | - if ($extension === 'pdf') return 'pdf'; |
|
| 61 | + if ($extension === 'pdf') { |
|
| 62 | + return 'pdf'; |
|
| 63 | + } |
|
| 50 | 64 | |
| 51 | 65 | # ------------------------ |
| 52 | 66 | |