PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.14.23
Import WP – CSV & XML Import Export for WordPress v2.14.23
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
jc-importer / compatibility / importwp-compatibility.php

importwp-compatibility.php in Import WP – CSV & XML Import Export for WordPress 2.14.23, at compatibility/importwp-compatibility.php

46 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function iwp_compat_is_rest_request()
4 {
5 $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
6
7 if (preg_match('/iwp\/v1\/(?:importer|exporter)\/[\d]+\/(?:init|run|status)/', $request_uri) === 1) {
8 return true;
9 }
10
11 if (defined('IWP_CRON_TOKEN') && isset($_GET['iwp_cron_token']) && $_GET['iwp_cron_token'] === IWP_CRON_TOKEN) {
12 return true;
13 }
14
15 return false;
16 }
17
18 function iwp_compat_is_importer_request()
19 {
20 $rest_request = iwp_compat_is_rest_request();
21 if ($rest_request) {
22 return true;
23 }
24
25 return false;
26 }
27
28 add_filter('option_active_plugins', function ($plugins) {
29
30 if (!is_array($plugins) || empty($plugins) || !iwp_compat_is_importer_request()) {
31 return $plugins;
32 }
33
34 $blacklist = (array)get_option('iwp_compat_blacklist', []);
35
36 if (is_array($blacklist) && !empty($blacklist)) {
37 foreach ($plugins as $key => $plugin) {
38 if (in_array($plugin, $blacklist)) {
39 unset($plugins[$key]);
40 }
41 }
42 }
43
44 return $plugins;
45 });
46