/** * Checks if the plugin caches correctly and shows notice when it does not * * @since 2.2.7 */ public static function check_if_plugin_caches() { $sg_cachepress_options = new SG_CachePress_Options(); $urlToCheck = get_home_url(); if ($sg_cachepress_options->is_enabled('enable_cache')) { if (SG_CachePress_Supercacher::return_cache_result($urlToCheck) == 0) { if (SG_CachePress_Supercacher::return_cache_result($urlToCheck) == 0) { $sg_cachepress_options->enable_option('show_notice'); return false; } else { $sg_cachepress_options->disable_option('show_notice'); return true; } } else { $sg_cachepress_options->disable_option('show_notice'); return true; } } else { $sg_cachepress_options->disable_option('show_notice'); return true; } }
/** * This make test if the cache is on returning the value of the x-proxy-cache header from the desired page by $_POST['url'] parameter * * @since 2.2.7 */ function cache_test_callback() { $urlToCheck = get_site_url() . "/" . $_POST['url']; $result = SG_CachePress_Supercacher::return_cache_result($urlToCheck); if ($result == 1 && empty($_POST['url'])) { $options = new SG_CachePress_Options(); $options->disable_option('show_notice'); } echo $result; wp_die(); }
/** * This make test if the cache is on returning the value of the x-proxy-cache header from the desired page by $_POST['url'] parameter * * @since 2.2.7 */ function cache_test_callback() { $urlToCheck = get_home_url() . "/" . $_POST['url']; if (SG_CachePress_Supercacher::return_cache_result($urlToCheck)) { $result = 1; } else { $result = 0; } echo $result; wp_die(); }