public static function clear_on_theme_changes() { static $once = false; /* Only clear once. */ global $pagenow; /* Holds the current page filename. */ global $current_site, $current_blog; /* Need these for Multisite details. */ /**/ do_action("ws_plugin__qcache_before_clear_on_theme_changes", get_defined_vars()); /**/ if (c_ws_plugin__qcache_utils_conds::is_blog_admin() && in_array($pagenow, $pages = array("themes.php"))) { if (!$once && ($once = true)) { if (is_multisite() && is_object($current_blog) && $current_blog->blog_id) { c_ws_plugin__qcache_purging_routines::schedule_cache_dir_purge($current_blog); /**/ if (!is_multisite() || !c_ws_plugin__qcache_utils_conds::is_multisite_farm() || is_main_site()) { $notice = 'Blog# <code>' . esc_html($current_blog->blog_id) . '</code> : Quick Cache reset automatically to avoid conflicts :-)'; c_ws_plugin__qcache_admin_notices::enqueue_admin_notice($notice, $pages); } } else { c_ws_plugin__qcache_purging_routines::schedule_cache_dir_purge(); /**/ if (!is_multisite() || !c_ws_plugin__qcache_utils_conds::is_multisite_farm() || is_main_site()) { $notice = 'Quick Cache reset automatically to avoid conflicts :-)'; c_ws_plugin__qcache_admin_notices::enqueue_admin_notice($notice, $pages); } } /**/ do_action("ws_plugin__qcache_during_clear_on_theme_changes", get_defined_vars()); } } /**/ do_action("ws_plugin__qcache_after_clear_on_theme_changes", get_defined_vars()); /**/ return; /* Return for uniformity. */ }
public static function admin_notices() { global $pagenow; /* This holds the current page filename. */ /**/ do_action("ws_plugin__qcache_before_admin_notices", get_defined_vars()); /**/ if (is_admin() && is_array($notices = get_option("ws_plugin__qcache_notices")) && !empty($notices)) { $a = c_ws_plugin__qcache_utils_conds::is_blog_admin() ? "blog" : $a; $a = c_ws_plugin__qcache_utils_conds::is_user_admin() ? "user" : $a; $a = c_ws_plugin__qcache_utils_conds::is_network_admin() ? "network" : $a; $a = !$a ? "blog" : $a; /* Default Blog Admin. */ /**/ foreach ($notices as $i => $notice) { /* Check several things about each Notice. */ foreach (!$notice["on_pages"] ? array("*") : (array) $notice["on_pages"] as $page) { if (!preg_match("/^(.+?)\\:/", $page)) { /* NO prefix? */ $page = "blog:" . ltrim($page, ":"); } /* `blog:` */ /**/ $adms = preg_split("/\\|/", preg_replace("/\\:(.*)\$/i", "", $page)); $page = preg_replace("/^([^\\:]*)\\:/i", "", $page); /**/ if (empty($adms) || in_array("*", $adms) || in_array($a, $adms) || !version_compare(get_bloginfo("version"), "3.1-RC", ">=")) { if (!$page || "*" === $page || $pagenow === $page || $_GET["page"] === $page) { if (strtotime("now") >= (int) $notice["time"]) { eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action("ws_plugin__qcache_during_admin_notices_before_display", get_defined_vars()); unset($__refs, $__v); /* Unset defined __refs, __v. */ /**/ if (!$notice["dismiss"] || $_GET["ws-plugin--qcache-dismiss-admin-notice"] === md5($notice["notice"])) { unset($notices[$i]); } /* Clear this administrative notice now? */ /**/ if (!$notice["dismiss"] || $_GET["ws-plugin--qcache-dismiss-admin-notice"] !== md5($notice["notice"])) { c_ws_plugin__qcache_admin_notices::display_admin_notice($notice["notice"], $notice["error"], $notice["dismiss"]); } /**/ do_action("ws_plugin__qcache_during_admin_notices_after_display", get_defined_vars()); } /**/ continue 2; /* This Notice processed; continue to next. */ } } } } /**/ $notices = array_merge($notices); /* Re-index array. */ /**/ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action("ws_plugin__qcache_during_admin_notices", get_defined_vars()); unset($__refs, $__v); /* Unset defined __refs, __v. */ /**/ update_option("ws_plugin__qcache_notices", $notices); } /**/ do_action("ws_plugin__qcache_after_admin_notices", get_defined_vars()); /**/ return; /* Return for uniformity. */ }