PluginProbe
WPIDE – File Manager & Code Editor / 3.4
WPIDE – File Manager & Code Editor v3.4
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 +11 -12 3.03.4 View file →
@@ -12,9 +12,9 @@
12 12 use WPIDE\App\Kernel\Request;
13 13 use WPIDE\App\Kernel\Response;
14 14 use WPIDE\App\Services\Archiver\ArchiverInterface;
15 15 use WPIDE\App\Services\Auth\AuthInterface;
16 -use WPIDE\App\Services\Session\SessionStorageInterface as Session;
16 +use WPIDE\App\Services\Transient\Transient;
17 17 use WPIDE\App\Services\Storage\Filesystem;
18 18 use WPIDE\App\Services\Storage\LocalFileSystem;
19 19 use const WPIDE\Constants\CONTENT_DIR;
20 20
@@ -29,11 +29,11 @@
29 29 */
30 30 const SESSION_CWD = 'current_path';
31 31
32 32 /**
33 - * @var Session
33 + * @var Transient
34 34 */
35 - protected $session;
35 + protected $transient;
36 36
37 37 /**
38 38 * @var AuthInterface
39 39 */
@@ -55,15 +55,15 @@
55 55 protected $separator;
56 56
57 57 /**
58 58 * @param Config $config
59 - * @param Session $session
59 + * @param Transient $transient
60 60 * @param AuthInterface $auth
61 61 * @param Filesystem $storage
62 62 */
63 - public function __construct(Config $config, Session $session, AuthInterface $auth, Filesystem $storage)
63 + public function __construct(Config $config, Transient $transient, AuthInterface $auth, Filesystem $storage)
64 64 {
65 - $this->session = $session;
65 + $this->transient = $transient;
66 66 $this->config = $config;
67 67 $this->auth = $auth;
68 68
69 69 $user = $this->auth->user() ?: $this->auth->getGuest();
@@ -83,9 +83,9 @@
83 83 public function changeDirectory(Request $request, Response $response)
84 84 {
85 85 $path = $request->input('to', $this->separator);
86 86
87 - $this->session->set(self::SESSION_CWD, $path);
87 + $this->transient->set(self::SESSION_CWD, $path);
88 88
89 89 return $response->json($this->storage->getDirectoryCollection($path));
90 90 }
91 91
@@ -96,9 +96,9 @@
96 96 * @throws Exception
97 97 */
98 98 public function getDirectory(Request $request, Response $response)
99 99 {
100 - $path = $request->input('dir', $this->session->get(self::SESSION_CWD, $this->separator));
100 + $path = $request->input('dir', $this->transient->get(self::SESSION_CWD, $this->separator));
101 101 $root = $request->input('root', false);
102 102
103 103 $storage = $root ? LocalFileSystem::load(CONTENT_DIR) : $this->storage;
104 104
@@ -114,9 +114,9 @@
114 114 * @throws Exception
115 115 */
116 116 public function getDirectorySize(Request $request, Response $response)
117 117 {
118 - $path = $request->input('dir', $this->session->get(self::SESSION_CWD, $this->separator));
118 + $path = $request->input('dir', $this->transient->get(self::SESSION_CWD, $this->separator));
119 119
120 120 $size = $this->storage->getDirSize($path);
121 121
122 122 return $response->json($size);
@@ -130,9 +130,9 @@
130 130 public function createNew(Request $request, Response $response)
131 131 {
132 132 $type = $request->input('type', 'file');
133 133 $name = $request->input('name');
134 - $path = $this->session->get(self::SESSION_CWD, $this->separator);
134 + $path = $request->input('destination', $this->transient->get(self::SESSION_CWD, $this->separator));
135 135
136 136 if(empty($name)) {
137 137 return $response->json(sprintf(__('%s name cannot be empty!', 'wpide'), ucfirst($type)), 422);
138 138 }
@@ -210,9 +210,8 @@
210 210 public function unzipItem(Request $request, Response $response, ArchiverInterface $archiver)
211 211 {
212 212 $source = $request->input('item');
213 213 $destination = $request->input('destination', $this->separator);
214 -
215 214 $archiver->uncompress($source, $destination, $this->storage);
216 215
217 216 return $response->json(true);
218 217 }
@@ -265,9 +264,9 @@
265 264
266 265 $item = $request->input('item');
267 266 $content = $request->input('content');
268 267
269 - $dir = !empty($item->dir) ? $item->dir : $this->session->get(self::SESSION_CWD, $this->separator);
268 + $dir = !empty($item->dir) ? $item->dir : $this->transient->get(self::SESSION_CWD, $this->separator);
270 269
271 270 $isImage = false;
272 271
273 272 // Check if data uri encoded image