PluginProbe
WPIDE – File Manager & Code Editor / trunk
WPIDE – File Manager & Code Editor vtrunk
3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 3.4 All 54 releases
← All changes | App/Controllers/FileManager/FileController.php +13 -5 3.4trunk View file →
@@ -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\CONTENT_DIR;
19 +use const WPIDE\Constants\WP_PATH;
20 20
21 21
22 22 /**
23 23 *
@@ -98,12 +98,17 @@
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']);
102 103
103 - $storage = $root ? LocalFileSystem::load(CONTENT_DIR) : $this->storage;
104 + if($root) {
105 + $storage = LocalFileSystem::load(WP_PATH);
106 + }else{
107 + $storage = $this->storage;
108 + }
104 109
105 - $content = $storage->getDirectoryCollection($path);
110 + $content = $storage->getDirectoryCollection($path, false, $filter);
106 111
107 112 return $response->json($content);
108 113 }
109 114
@@ -279,9 +284,10 @@
279 284
280 285 if ($item->ext === 'php') {
281 286 try {
282 287 PhpValidator::validate($content);
283 - } catch (Error $error) {
288 + } catch (Error | Exception $error) {
289 +
284 290 $message = "Parse error: {$error->getMessage()}\n";
285 291 return $response->json($message, 422);
286 292 }
287 293 }
@@ -305,7 +311,9 @@
305 311
306 312 return $response->json(__('Failed saving file!', 'wpide'), 422);
307 313 }
308 314
309 - return $response->json(true);
315 + return $response->json([
316 + 'success' => true
317 + ]);
310 318 }
311 319 }