public static function update_all_options($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE, $request_refresh = FALSE) { do_action("ws_widget__super_tags_before_update_all_options", get_defined_vars()); /* If you use this Hook, be sure to use `wp_verify_nonce()`. */ /**/ if ($verified || ($nonce = $_POST["ws_widget__super_tags_options_save"]) && wp_verify_nonce($nonce, "ws-widget--super-tags-options-save")) { $options = $GLOBALS["WS_WIDGET__"]["super_tags"]["o"]; /* Here we get all of the existing options. */ $new_options = is_array($new_options) ? $new_options : (array) $_POST; /* Force array. */ $new_options = c_ws_widget__super_tags_utils_strings::trim_deep(stripslashes_deep($new_options)); /**/ foreach ((array) $new_options as $key => $value) { /* Looking for relevant keys. */ if (preg_match("/^" . preg_quote("ws_widget__super_tags_", "/") . "/", $key)) { /**/ if ($key === "ws_widget__super_tags_configured") { update_option("ws_widget__super_tags_configured", $value); $GLOBALS["WS_WIDGET__"]["super_tags"]["c"]["configured"] = $value; } else { is_array($value) ? array_shift($value) : null; /* Arrays should be padded. */ $key = preg_replace("/^" . preg_quote("ws_widget__super_tags_", "/") . "/", "", $key); $options[$key] = $value; /* Overriding a possible existing option. */ } } } /**/ $options["options_version"] = (string) ($options["options_version"] + 0.001); $options = ws_widget__super_tags_configure_options_and_their_defaults($options); /**/ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action("ws_widget__super_tags_during_update_all_options", get_defined_vars()); unset($__refs, $__v); /* Unset defined __refs, __v. */ /**/ update_option("ws_widget__super_tags_options", $options); /**/ if (($display_notices === true || in_array("success", (array) $display_notices)) && ($notice = '<strong>Options saved.' . ($request_refresh ? ' Please <a href="' . esc_attr($_SERVER["REQUEST_URI"]) . '">refresh</a>.' : '') . '</strong>')) { $enqueue_notices === true || in_array("success", (array) $enqueue_notices) ? c_ws_widget__super_tags_admin_notices::enqueue_admin_notice($notice, "*:*") : c_ws_widget__super_tags_admin_notices::display_admin_notice($notice); } /**/ $updated_all_options = true; /* Flag indicating this routine was indeed processed. */ } /**/ do_action("ws_widget__super_tags_after_update_all_options", get_defined_vars()); /**/ return $updated_all_options; /* Return status update. */ }
public static function admin_notices() { global $pagenow; /* This holds the current page filename. */ /**/ do_action("ws_widget__super_tags_before_admin_notices", get_defined_vars()); /**/ if (is_admin() && is_array($notices = get_option("ws_widget__super_tags_notices")) && !empty($notices)) { $a = is_blog_admin() ? "blog" : $a; $a = is_user_admin() ? "user" : $a; $a = 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)) { 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_widget__super_tags_during_admin_notices_before_display", get_defined_vars()); unset($__refs, $__v); /* Unset defined __refs, __v. */ /**/ if (!$notice["dismiss"] || $_GET["ws-widget--super-tags-dismiss-admin-notice"] === md5($notice["notice"])) { unset($notices[$i]); } /* Clear this administrative notice now? */ /**/ if (!$notice["dismiss"] || $_GET["ws-widget--super-tags-dismiss-admin-notice"] !== md5($notice["notice"])) { c_ws_widget__super_tags_admin_notices::display_admin_notice($notice["notice"], $notice["error"], $notice["dismiss"]); } /**/ do_action("ws_widget__super_tags_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_widget__super_tags_during_admin_notices", get_defined_vars()); unset($__refs, $__v); /* Unset defined __refs, __v. */ /**/ update_option("ws_widget__super_tags_notices", $notices); } /**/ do_action("ws_widget__super_tags_after_admin_notices", get_defined_vars()); /**/ return; /* Return for uniformity. */ }