PluginProbe
WPIDE – File Manager & Code Editor / 3.4.1
WPIDE – File Manager & Code Editor v3.4.1
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/App.php +47 -20 3.23.4.1 View file →
@@ -21,13 +21,14 @@
21 21 use const WPIDE\Constants\TMP_DIR;
22 22 use const WPIDE\Constants\URL;
23 23 use const WPIDE\Constants\ASSETS_URL;
24 24 use const WPIDE\Constants\FATAL_ERROR_DROPIN;
25 +use const WPIDE\Constants\FATAL_ERROR_DROPIN_VERSION;
26 +use const WPIDE\Constants\FATAL_ERROR_DROPIN_VERSION_OPT;
25 27 use const WPIDE\Constants\NAME;
26 28 use const WPIDE\Constants\SLUG;
27 29 use const WPIDE\Constants\PLUGIN_URL;
28 30 use const WPIDE\Constants\VERSION;
29 -use const WPIDE\Constants\REQUIRED_PHP_VERSION;
30 31
31 32 class App
32 33 {
33 34 public static $_instance;
@@ -85,16 +86,34 @@
85 86 {
86 87 return SLUG . (!empty($suffix) ? '_' . $suffix : '');
87 88 }
88 89
90 + public function isLatestDropIn(): bool
91 + {
92 +
93 + $currentVersion = get_option(FATAL_ERROR_DROPIN_VERSION_OPT, null);
94 +
95 + return $currentVersion === FATAL_ERROR_DROPIN_VERSION;
96 + }
97 +
98 + public function dropInExists() {
99 +
100 + $fs = LocalFileSystem::load(CONTENT_DIR);
101 +
102 + return $fs->fileExists(FATAL_ERROR_DROPIN);
103 + }
104 +
89 105 public function installDropIn() {
90 106
91 107 $fs = LocalFileSystem::load(CONTENT_DIR);
92 108
93 - if(!$fs->fileExists(FATAL_ERROR_DROPIN)) {
109 + if($fs->fileExists(FATAL_ERROR_DROPIN)) {
110 + $this->unInstallDropIn();
111 + }
94 112
95 - $fs->copyFile('plugins/'.basename(DIR).'/wp-content/'.FATAL_ERROR_DROPIN, './');
96 - }
113 + $fs->copyFile('plugins/'.basename(DIR).'/wp-content/'.FATAL_ERROR_DROPIN, './');
114 +
115 + update_option(FATAL_ERROR_DROPIN_VERSION_OPT, FATAL_ERROR_DROPIN_VERSION);
97 116 }
98 117
99 118 public function unInstallDropIn() {
100 119
@@ -111,8 +130,12 @@
111 130 if(!$this->dependencyCheck() || !is_admin()) {
112 131 return;
113 132 }
114 133
134 + if(!$this->dropInExists() || !$this->isLatestDropIn()) {
135 + $this->installDropIn();
136 + }
137 +
115 138 $this->loadTextDomain();
116 139 $this->loadHooks();
117 140
118 141 Migrations::init();
@@ -135,22 +158,13 @@
135 158 if(!empty($this->dependencyNotice)) {
136 159 echo $this->dependencyNotice;
137 160 }
138 161
139 - if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) {
162 + // Perform checks here
163 + // $class = 'notice notice-error';
164 + // $message = '';
165 + // $this->dependencyNotice = sprintf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), $message);
140 166
141 - $class = 'notice notice-error';
142 -
143 - $message = sprintf(
144 - __( '%s minimum PHP version requirement is %s. You are using: %s', 'wpide' ),
145 - '<strong>'.NAME.'</strong>',
146 - '<strong>'.REQUIRED_PHP_VERSION.'</strong>',
147 - '<strong>'.PHP_VERSION.'</strong>'
148 - );
149 -
150 - $this->dependencyNotice = sprintf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), $message);
151 - }
152 -
153 167 if(!empty($this->dependencyNotice)) {
154 168 add_action('admin_notices', [$this, 'dependencyCheck']);
155 169 return false;
156 170 }
@@ -161,9 +175,9 @@
161 175 protected function loadHooks()
162 176 {
163 177
164 178 add_action('admin_menu', [$this, 'adminMenu' ]);
165 - add_action("wpide_ajax_request", [$this, "ajaxRequest"]);
179 + add_action("wp_ajax_wpide_request", [$this, "ajaxRequest"]);
166 180 add_action("admin_init", [$this, "registerTasks"]);
167 181 add_action('admin_enqueue_scripts', [ $this, 'enqueueCommonAssets' ]);
168 182
169 183 if($this->isPluginScreen()) {
@@ -169,8 +183,9 @@
169 183 if($this->isPluginScreen()) {
170 184
171 185 add_filter('admin_title', [$this, 'setAdminTitle']);
172 186 add_action('admin_head', [$this, 'addAdminFavicon']);
187 + add_action("admin_menu", [$this, "setCurrentScreen"], -1);
173 188 add_action('admin_menu', [Notices::class, 'init']);
174 189 add_filter('screen_options_show_screen', '__return_false');
175 190 add_filter('admin_body_class', [$this, 'bodyClasses'], 10, 1);
176 191 add_action('admin_enqueue_scripts', [ $this, 'deregisterWpStyles' ]);
@@ -181,8 +196,13 @@
181 196
182 197 //TestTask::register();
183 198 }
184 199
200 + public function setCurrentScreen() {
201 +
202 + set_current_screen(SLUG);
203 + }
204 +
185 205 public function canManage(): bool
186 206 {
187 207 return current_user_can('manage_options');
188 208 }
@@ -253,8 +273,11 @@
253 273 $this->container->set(StreamedResponse::class, $sresponse);
254 274
255 275 $this->services = [];
256 276 foreach ($services->get() as $key => $service) {
277 + if(empty($service['handler'])) {
278 + continue;
279 + }
257 280 $this->container->set($key, $this->container->get($service['handler']));
258 281 $this->container->get($key)->init(isset($service['config']) ? $service['config'] : []);
259 282 $this->services[$key] = $this->container->get($key);
260 283 }
@@ -349,11 +372,15 @@
349 372
350 373 return false;
351 374 }
352 375
353 - public function isFreemiusScreen(): bool
376 + public function isFreemiusScreen($section = null): bool
354 377 {
355 378
379 + if($section) {
380 + return $this->isPluginScreen($section);
381 + }
382 +
356 383 if(
357 384 $this->isPluginScreen('account') ||
358 385 $this->isPluginScreen('pricing') ||
359 386 $this->isPluginScreen('contact') ||
@@ -371,9 +398,9 @@
371 398 }
372 399
373 400 public function getAjaxUrl($req = ''): string
374 401 {
375 - return URL.'ajax.php?action=request&req='.$req;
402 + return admin_url('admin-ajax.php').'?action=wpide_request&req='.$req;
376 403 }
377 404
378 405 /**
379 406 * Get external url with utm campaign / content