From 764be9b11df91ab05999a67bd576a92e5eb70445 Mon Sep 17 00:00:00 2001 From: 3xs <31252669+my-3xs@users.noreply.github.com> Date: Mon, 27 Apr 2020 09:09:40 +0800 Subject: [PATCH] Update index.php --- index.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index b7ab004..6bc0aec 100644 --- a/index.php +++ b/index.php @@ -16,6 +16,14 @@ WP_CHINA_YES::init(); class WP_CHINA_YES { public static function init() { + add_filter('pre_http_request', array( + __CLASS__, + 'pre_http_request' + ), 10, 3); + $post_action = isset($_POST['action']) ? sanitize_text_field(trim($_POST['action'])) : ' '; + if( defined( 'DOING_AJAX' ) && DOING_AJAX && !in_array($post_action,array('wpcy_set_config','wpcy_get_config'))){ + return; + } if (is_admin()) { register_activation_hook(WP_CHINA_YES_BASE_FILE, array( __CLASS__, @@ -25,10 +33,6 @@ class WP_CHINA_YES { __CLASS__, 'wp_china_yes_deactivate' )); - add_filter('pre_http_request', array( - __CLASS__, - 'pre_http_request' - ), 10, 3); add_filter('plugin_row_meta', array( __CLASS__, 'plugin_row_meta' @@ -208,4 +212,4 @@ EOT; $options['custom_download_server'] = $custom_download_server; update_option("wp_china_yes_options", $options); } -} \ No newline at end of file +}