public static function trim_deep($value = FALSE, $chars = FALSE, $extra_chars = FALSE)
 {
     $chars = is_string($chars) ? $chars : " \t\n\r\v";
     $chars = is_string($extra_chars) ? $chars . $extra_chars : $chars;
     /**/
     if (is_array($value)) {
         foreach ($value as &$r) {
             /* Reference. */
             $r = c_ws_plugin__qcache_utils_strings::trim_deep($r, $chars);
         }
         return $value;
         /* Return modified array. */
     }
     return trim((string) $value, $chars);
 }
 public static function add_admin_header_controls()
 {
     do_action("ws_plugin__qcache_before_add_admin_header_controls", get_defined_vars());
     /**/
     if (!is_multisite() && current_user_can("edit_plugins") || is_multisite() && (is_super_admin() || apply_filters("ws_plugin__qcache_ms_user_can_see_admin_header_controls", false))) {
         echo '<form style="float:right; margin:11px 11px 0 11px;" onsubmit="return false;">' . "\n";
         echo '<input type="button" id="ws-plugin--qcache-ajax-clear" style="outline:none; min-width:115px; padding-left:22px; padding-right:5px; background-repeat:no-repeat; background-position:5px center; background-image:url(\'' . c_ws_plugin__qcache_utils_strings::esc_sq(esc_attr($GLOBALS["WS_PLUGIN__"]["qcache"]["c"]["dir_url"])) . '/images/ajax-clear.png\');" value="Clear Cache" title="Clear Cache Manually" onclick="jQuery (this).css (\'background-image\', \'url(\\\'' . c_ws_plugin__qcache_utils_strings::esc_sq(esc_attr($GLOBALS["WS_PLUGIN__"]["qcache"]["c"]["dir_url"])) . '/images/ajax-loader.gif\\\')\'); jQuery.post (ajaxurl, {action: \'ws_plugin__qcache_ajax_clear\', ws_plugin__qcache_ajax_clear: \'' . c_ws_plugin__qcache_utils_strings::esc_sq(esc_attr(wp_create_nonce("ws-plugin--qcache-ajax-clear"))) . '\'}, function (response){ eval (response); });" />' . "\n";
         echo '</form>';
         /**/
         do_action("ws_plugin__qcache_during_add_admin_header_controls", get_defined_vars());
     }
     /**/
     do_action("ws_plugin__qcache_after_add_admin_header_controls", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
 public static function ajax_clear()
 {
     global $current_site, $current_blog;
     /* Multisite details. */
     /**/
     do_action("ws_plugin__qcache_before_ajax_clear", get_defined_vars());
     /**/
     if (($nonce = $_POST["ws_plugin__qcache_ajax_clear"]) && wp_verify_nonce($nonce, "ws-plugin--qcache-ajax-clear")) {
         if (is_multisite() && !is_main_site() && is_object($current_blog) && $current_blog->blog_id) {
             c_ws_plugin__qcache_purging_routines::purge_cache_dir($current_blog);
             /**/
             header("Content-Type: text/plain; charset=utf-8");
             /**/
             $status = 'Cleared ( this blog )';
             /* Indicate "this blog" to the Super Admin. */
             /**/
             echo "jQuery ('input#ws-plugin--qcache-ajax-clear').css ('background-image', 'url(\\'" . c_ws_plugin__qcache_utils_strings::esc_sq($GLOBALS["WS_PLUGIN__"]["qcache"]["c"]["dir_url"]) . "/images/ajax-clear.png\\')');";
             echo "setTimeout (function (){ jQuery ('input#ws-plugin--qcache-ajax-clear').val ('Clear Cache'); }, 2000);";
             echo "jQuery ('input#ws-plugin--qcache-ajax-clear').val ('" . c_ws_plugin__qcache_utils_strings::esc_sq($status) . "');";
             echo "jQuery ('input#ws-plugin--qcache-ajax-clear').each (function (){ this.blur(); });";
         } else {
             c_ws_plugin__qcache_purging_routines::purge_cache_dir();
             /**/
             header("Content-Type: text/plain; charset=utf-8");
             /**/
             $status = is_multisite() ? 'Cleared ( all blogs )' : '( Cleared )';
             /**/
             echo "jQuery ('input#ws-plugin--qcache-ajax-clear').css ('background-image', 'url(\\'" . c_ws_plugin__qcache_utils_strings::esc_sq($GLOBALS["WS_PLUGIN__"]["qcache"]["c"]["dir_url"]) . "/images/ajax-clear.png\\')');";
             echo "setTimeout (function (){ jQuery ('input#ws-plugin--qcache-ajax-clear').val ('Clear Cache'); }, 2000);";
             echo "jQuery ('input#ws-plugin--qcache-ajax-clear').val ('" . c_ws_plugin__qcache_utils_strings::esc_sq($status) . "');";
             echo "jQuery ('input#ws-plugin--qcache-ajax-clear').each (function (){ this.blur(); });";
         }
         /**/
         do_action("ws_plugin__qcache_during_ajax_clear", get_defined_vars());
     }
     /**/
     do_action("ws_plugin__qcache_after_ajax_clear", get_defined_vars());
     /**/
     exit;
     /* Clean exit. */
 }
 public static function add_advanced()
 {
     do_action("ws_plugin__qcache_before_add_advanced", get_defined_vars());
     /**/
     if (!c_ws_plugin__qcache_advanced_cache::delete_advanced()) {
         return apply_filters("ws_plugin__qcache_add_advanced", false, get_defined_vars());
     } else {
         if (is_writable(WP_CONTENT_DIR) && (!file_exists(WP_CONTENT_DIR . "/advanced-cache.php") || is_writable(WP_CONTENT_DIR . "/advanced-cache.php")) && ($handler = file_get_contents(dirname(dirname(__FILE__)) . "/templates/handler.tpl.php"))) {
             $handler = preg_replace("/\"%%QUICK_CACHE_ENABLED%%\"/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["enabled"], $handler);
             $handler = preg_replace("/\"%%QUICK_CACHE_ENABLE_DEBUGGING%%\"/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["enable_debugging"], $handler);
             $handler = preg_replace("/\"%%QUICK_CACHE_DONT_CACHE_WHEN_LOGGED_IN%%\"/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["dont_cache_when_logged_in"], $handler);
             $handler = preg_replace("/\"%%QUICK_CACHE_DONT_CACHE_QUERY_STRING_REQUESTS%%\"/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["dont_cache_query_string_requests"], $handler);
             $handler = preg_replace("/\"%%QUICK_CACHE_EXPIRATION%%\"/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["expiration"], $handler);
             $handler = preg_replace("/\"%%QUICK_CACHE_ALLOW_BROWSER_CACHE%%\"/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["allow_browser_cache"], $handler);
             /**/
             $handler = preg_replace("/%%QUICK_CACHE_USE_FLOCK_OR_SEM%%/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["use_flock_or_sem"], $handler);
             /**/
             foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["dont_cache_these_uris"]) as $uri) {
                 if ($uri = trim($uri)) {
                     $uris .= "|" . preg_quote($uri, "/");
                 }
             }
             if ($uris = trim($uris, " \r\n\t\v|")) {
                 $uris = "/" . c_ws_plugin__qcache_utils_strings::esc_dq($uris) . "/";
             }
             $handler = preg_replace("/%%QUICK_CACHE_DONT_CACHE_THESE_URIS%%/", $uris, $handler);
             /**/
             foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["dont_cache_these_refs"]) as $ref) {
                 if ($ref = trim($ref)) {
                     $refs .= "|" . preg_quote($ref, "/");
                 }
             }
             if ($refs = trim($refs, " \r\n\t\v|")) {
                 $refs = "/" . c_ws_plugin__qcache_utils_strings::esc_dq($refs) . "/i";
             }
             $handler = preg_replace("/%%QUICK_CACHE_DONT_CACHE_THESE_REFS%%/", $refs, $handler);
             /**/
             foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["dont_cache_these_agents"]) as $agent) {
                 if ($agent = trim($agent)) {
                     $agents .= "|" . preg_quote($agent, "/");
                 }
             }
             if ($agents = trim($agents, " \r\n\t\v|")) {
                 $agents = "/" . c_ws_plugin__qcache_utils_strings::esc_dq($agents) . "/i";
             }
             $handler = preg_replace("/%%QUICK_CACHE_DONT_CACHE_THESE_AGENTS%%/", $agents, $handler);
             /**/
             if (strlen($GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["version_salt"])) {
                 if (file_put_contents(WP_CONTENT_DIR . "/qcache-salt-ok.php", '<?php error_reporting(0); $v = ' . $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["version_salt"] . '; echo "ok"; ?>')) {
                     $salt_ok = ($syntax_check = c_ws_plugin__qcache_utils_urls::remote(WP_CONTENT_URL . "/qcache-salt-ok.php")) === "ok" ? true : false;
                     if (!$salt_ok) {
                         /* If we could not validate the syntax of their salt, we need to notify them that it will not be used. */
                         c_ws_plugin__qcache_admin_notices::enqueue_admin_notice("<strong>Quick Cache:</strong> Your MD5 Version Salt may contain syntax errors. Please check it and try again. Otherwise, if you are unable to correct the problem, your Salt will simply be ignored. Quick Cache will continue to function properly using its default setting.", "blog|network:ws-plugin--qcache-options", true);
                     }
                     unlink(WP_CONTENT_DIR . "/qcache-salt-ok.php");
                 }
             }
             $handler = preg_replace("/\"%%QUICK_CACHE_VERSION_SALT%%\"/", $salt_ok ? $GLOBALS["WS_PLUGIN__"]["qcache"]["o"]["version_salt"] : '""', $handler);
             /**/
             eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
             do_action("ws_plugin__qcache_during_add_advanced", get_defined_vars());
             unset($__refs, $__v);
             /* Unset defined __refs, __v. */
             /**/
             file_put_contents(WP_CONTENT_DIR . "/advanced-cache.php", trim($handler));
             /**/
             return apply_filters("ws_plugin__qcache_add_advanced", true, get_defined_vars());
         } else {
             return apply_filters("ws_plugin__qcache_add_advanced", false, get_defined_vars());
         }
     }
 }