芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/public_html/wp-content/plugins/compressx/includes/display/class-compressx-cdn.php
output_nav(); $this->output_header(); $this->output_cdn(); $this->output_footer(); ?>
>
>
My Profile > API Tokens > Global API Key.','compressx')?>
The website overview > API section.','compressx')?>
ajax_check_security('compressx-can-use-cdn'); if(isset($_POST['setting'])&&!empty($_POST['setting'])) { $json_setting = sanitize_text_field($_POST['setting']); $json_setting = stripslashes($json_setting); $setting = json_decode($json_setting, true); if (is_null($setting)) { $ret['result']='failed'; $ret['error']='json decode failed'; echo wp_json_encode($ret); die(); } if($this->need_test($setting)) { include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; $cdn=new CompressX_CloudFlare_CDN($setting); $ret=$cdn->purge_cache(); if($ret['result']!='success') { echo wp_json_encode($ret); die(); } } $options=CompressX_Options::get_option('compressx_general_settings',array()); $options['cf_cdn']['zone_id']=$setting['zone_id']; $options['cf_cdn']['email']=$setting['email']; $options['cf_cdn']['api_key']=$setting['api_key']; if(isset($setting['auto_purge_cache'])) { $options['cf_cdn']['auto_purge_cache']=$setting['auto_purge_cache']; } else { $options['cf_cdn']['auto_purge_cache']=false; } if(isset($setting['auto_purge_cache_after_manual'])) { $options['cf_cdn']['auto_purge_cache_after_manual']=$setting['auto_purge_cache_after_manual']; } else { $options['cf_cdn']['auto_purge_cache_after_manual']=false; } CompressX_Options::update_option('compressx_general_settings',$options); $ret['result']='success'; echo wp_json_encode($ret); die(); } else { die(); } } public function need_test($setting) { if(isset($setting['auto_purge_cache'])&&$setting['auto_purge_cache']) { return true; } if(isset($setting['auto_purge_cache_after_manual'])&&$setting['auto_purge_cache_after_manual']) { return true; } return false; } public function purge_cache() { global $compressx; $compressx->ajax_check_security('compressx-can-use-cdn'); if(isset($_POST['setting'])&&!empty($_POST['setting'])) { $json_setting = sanitize_text_field($_POST['setting']); $json_setting = stripslashes($json_setting); $setting = json_decode($json_setting, true); if (is_null($setting)) { $ret['result']='failed'; $ret['error']='json decode failed'; echo wp_json_encode($ret); die(); } include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; $cdn=new CompressX_CloudFlare_CDN($setting); $ret=$cdn->purge_cache(); echo wp_json_encode($ret); die(); } else { include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; $options=CompressX_Options::get_option('compressx_general_settings',array()); $setting=$options['cf_cdn']; $cdn=new CompressX_CloudFlare_CDN($setting); $ret=$cdn->purge_cache(); echo wp_json_encode($ret); die(); } } }