option_name); $aabcore_admin_cahe_email=get_option('admin_email'); $aabcore_api_key = ! empty($settings['aabcore_cache_api_key']) ? $settings['aabcore_cache_api_key'] : 'API Key'; $aabcore_email = ! empty($settings['aabcore_cache_email']) ? $settings['aabcore_cache_email'] : esc_attr($aabcore_admin_cahe_email); $aabcore_zone_id = ! empty($settings['aabcore_cache_zone_id']) ? $settings['aabcore_cache_zone_id'] : 'Zone ID'; ?>

Free Cloudflare CDN


  • Cloudflare Credentials
    Free Cloudflar CDN
    Connect your Cloudflare account to enable CDN features, Cloudflare significantly speeds up your website by leveraging a global network of servers to deliver content faster to your visitors.



    To get your API credentials: Documentation

    1. Log in to your Cloudflare account and click on "My Profile"
    2. Click on API Tokens and scroll to the bottom and click on "View beside Global API Key"
    3. Enter your Cloudflare login password and click on "View"
    4. Copy the API key and paste it in the form below


     





    Free CDN


  • Purge Specific URL
    Free Cloudflar CDN


     



    Purge Specific URL


  • Purge All URLs
    Free Cloudflar CDN


     



    Purge All URLs


option_name, [ 'aabcore_cache_api_key' => $aabcore_cache_cache_api_key, 'aabcore_cache_email' => $aabcore_cache_cache_email, 'aabcore_cache_zone_id' => $aabcore_cache_cache_zone_id, ]); $aabcore_url = esc_url_raw( "https://api.cloudflare.com/client/v4/zones/{$aabcore_cache_cache_zone_id}" ); // Validate credentials with Cloudflare $response = wp_remote_get( $aabcore_url, [ 'headers' => [ 'X-Auth-Email' => $aabcore_cache_cache_email, 'X-Auth-Key' => $aabcore_cache_cache_api_key ], 'timeout' => 15, ] ); if (is_wp_error($response)) { wp_send_json_error("⚠ Cannot connect to Cloudflare API."); } $aabcore_cache_cache_email_cache = sanitize_text_field( wp_unslash( $_POST['aabcore_cache_email'])); if (!filter_var($aabcore_cache_cache_email_cache, FILTER_VALIDATE_EMAIL)) { wp_send_json_error("❌ Invalid Email."); } $body = json_decode(wp_remote_retrieve_body($response), true); if (!$body['success']) { update_option( "aabcore_cache_for_cache_cdn_cache", "off" ); wp_send_json_error("❌ Invalid API Key, Email, or Zone ID."); } update_option( "aabcore_cache_for_cache_cdn_cache", "on" ); wp_send_json_success("✅ Cloudflare settings saved successfully!"); } /** * AJAX: PURGE URL */ public function aabcore_cache_jax_cache_url() { check_ajax_referer('aabcore_ajax_nonce'); $url= isset( $_POST['url'] ) ? sanitize_text_field( wp_unslash($_POST['url'] ) ) : ''; //$url = sanitize_text_field($_POST['url']); if (!filter_var($url, FILTER_VALIDATE_URL)) { wp_send_json_error("❌ Invalid URL."); } $settings = get_option($this->option_name); $aabcore_cache_l_cache_zone_id = ! empty( $settings['aabcore_cache_zone_id'] ) ? sanitize_text_field(wp_unslash( $settings['aabcore_cache_zone_id'] )) : ''; $aabcore_cache_l_cache_email = ! empty( $settings['aabcore_cache_email'] ) ? sanitize_email(wp_unslash( $settings['aabcore_cache_email'] )) : ''; $aabcore_cache_l_cache_api_key = ! empty( $settings['aabcore_cache_api_key'] ) ? sanitize_text_field(wp_unslash( $settings['aabcore_cache_api_key']) ) : ''; $aabcore_api_url = esc_url_raw( "https://api.cloudflare.com/client/v4/zones/{$aabcore_cache_l_cache_zone_id}/purge_cache" ); $response = wp_remote_post( $aabcore_api_url, [ 'headers' => [ 'X-Auth-Email' => $aabcore_cache_l_cache_email, 'X-Auth-Key' => $aabcore_cache_l_cache_api_key, 'Content-Type' => 'application/json' ], 'body' => json_encode(['files' => [$url]]), 'timeout' => 15, ] ); if (is_wp_error($response)) { wp_send_json_error("⚠ Could not reach Cloudflare API."); } $body = json_decode(wp_remote_retrieve_body($response), true); if (!$body['success']) { wp_send_json_error("❌ Cloudflare rejected this URL. Check your domain or settings."); } wp_send_json_success("✅ URL purged successfully!"); } public function aabcore_cache_jax_cache_urlall() { check_ajax_referer('aabcore_ajax_nonce'); $settings = get_option($this->option_name); $aabcore_cache_a_cache_zone_id = ! empty( $settings['aabcore_cache_zone_id'] ) ? sanitize_text_field(wp_unslash( $settings['aabcore_cache_zone_id']) ) : ''; $aabcore_cache_a_cache_email = ! empty( $settings['aabcore_cache_email'] ) ? sanitize_email(wp_unslash( $settings['aabcore_cache_email']) ) : ''; $aabcore_cache_a_cache_api_key = ! empty( $settings['aabcore_cache_api_key'] ) ? sanitize_text_field(wp_unslash( $settings['aabcore_cache_api_key']) ) : ''; $aabcore_cache_api_url = esc_url_raw( "https://api.cloudflare.com/client/v4/zones/{$aabcore_cache_a_cache_zone_id}/purge_cache" ); $response = wp_remote_post( $aabcore_cache_api_url, [ 'headers' => [ 'X-Auth-Email' => $aabcore_cache_a_cache_email, 'X-Auth-Key' => $aabcore_cache_a_cache_api_key, 'Content-Type' => 'application/json' ], 'body' => json_encode(['purge_everything' => true]), 'timeout' => 15, ] ); if (is_wp_error($response)) { wp_send_json_error("⚠ Could not reach Cloudflare API."); } $body = json_decode(wp_remote_retrieve_body($response), true); if (!$body['success']) { wp_send_json_error("❌ Cloudflare rejected all urls. Check your domain or settings."); } wp_send_json_success("✅ All urls purged successfully!"); } public function aabcore_cache_cs_cache_cdn() { check_ajax_referer('aabcore_ajax_nonce'); $count_cache_cache=new Aabcore_CACHE_Fa_Cache(); $cache_size= $count_cache_cache->aabcore_cache_sie_cache(); wp_send_json_success("✅ $cache_size - KB Cache Size."); } public function aabcore_cache_js_cache_cdn() { check_ajax_referer('aabcore_ajax_nonce'); $count_cache_cache=new Aabcore_CACHE_Fa_Cache(); $cache_count= $count_cache_cache->aabcore_cache_cout_cache(); wp_send_json_success("✅ $cache_count - Total files."); } public function aabcore_ajax_purge_my_cache() { check_ajax_referer('aabcore_ajax_nonce'); $url_cache= isset( $_POST['url'] ) ? sanitize_text_field( wp_unslash($_POST['url'] ) ) : ''; //$url_cache = sanitize_text_field( wp_unslash( $_POST['url'])); if (!filter_var($url_cache, FILTER_VALIDATE_URL)) { wp_send_json_error("❌ Invalid URL."); } $c_cache_cache=new Aabcore_CACHE_Fa_Cache(); $c_cache_cache->aabcore_d_cache_d($url_cache); wp_send_json_success("✅ ".$url_cache ." - URL has been purged."); } public function aabcore_ajax_purge_myall_cache() { check_ajax_referer('aabcore_ajax_nonce'); $c_cache_cache=new Aabcore_CACHE_Fa_Cache(); $c_cache_cache->aabcore_cache_de_cache(); wp_send_json_success("✅ All urls purged successfully!"); } }new Aabcore_rd_cache_Cdn_Cache();