| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | use WPIDE\App\Services\Auth\AuthInterface; |
| 16 | 16 | use WPIDE\App\Services\Transient\Transient; |
| 17 | 17 | use WPIDE\App\Services\Storage\Filesystem; |
| 18 | 18 | use WPIDE\App\Services\Storage\LocalFileSystem; |
| 19 | -use const WPIDE\Constants\WP_PATH; | |
| 19 | +use const WPIDE\Constants\CONTENT_DIR; | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * |
| @@ -98,17 +98,12 @@ | ||
| 98 | 98 | public function getDirectory(Request $request, Response $response) |
| 99 | 99 | { |
| 100 | 100 | $path = $request->input('dir', $this->transient->get(self::SESSION_CWD, $this->separator)); |
| 101 | 101 | $root = $request->input('root', false); |
| 102 | - $filter = $request->enumInput('filter', ['image']); | |
| 103 | 102 | |
| 104 | - if($root) { | |
| 105 | - $storage = LocalFileSystem::load(WP_PATH); | |
| 106 | - }else{ | |
| 107 | - $storage = $this->storage; | |
| 108 | - } | |
| 103 | + $storage = $root ? LocalFileSystem::load(CONTENT_DIR) : $this->storage; | |
| 109 | 104 | |
| 110 | - $content = $storage->getDirectoryCollection($path, false, $filter); | |
| 105 | + $content = $storage->getDirectoryCollection($path); | |
| 111 | 106 | |
| 112 | 107 | return $response->json($content); |
| 113 | 108 | } |
| 114 | 109 | |
| @@ -284,10 +279,9 @@ | ||
| 284 | 279 | |
| 285 | 280 | if ($item->ext === 'php') { |
| 286 | 281 | try { |
| 287 | 282 | PhpValidator::validate($content); |
| 288 | - } catch (Error | Exception $error) { | |
| 289 | - | |
| 283 | + } catch (Error $error) { | |
| 290 | 284 | $message = "Parse error: {$error->getMessage()}\n"; |
| 291 | 285 | return $response->json($message, 422); |
| 292 | 286 | } |
| 293 | 287 | } |
| @@ -311,9 +305,7 @@ | ||
| 311 | 305 | |
| 312 | 306 | return $response->json(__('Failed saving file!', 'wpide'), 422); |
| 313 | 307 | } |
| 314 | 308 | |
| 315 | - return $response->json([ | |
| 316 | - 'success' => true | |
| 317 | - ]); | |
| 309 | + return $response->json(true); | |
| 318 | 310 | } |
| 319 | 311 | } |