コード例 #1
0
 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. */
 }
コード例 #2
0
 public function update($instance = FALSE, $old = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_widget__super_tags_class_before_widget_update", get_defined_vars(), $this);
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $instance = (array) c_ws_widget__super_tags_utils_strings::trim_deep(stripslashes_deep($instance));
     return ws_widget__super_tags_configure_options_and_their_defaults(false, $instance);
 }
コード例 #3
0
    */
    include_once dirname(__FILE__) . "/includes/hooks.inc.php";
    /*
    Hook after system config & hooks are loaded.
    */
    do_action("ws_widget__super_tags_config_hooks_loaded");
    /*
    Load a possible Pro module, if/when available.
    */
    if (apply_filters("ws_widget__super_tags_load_pro", true) && file_exists(dirname(__FILE__) . "-pro/pro-module.php")) {
        include_once dirname(__FILE__) . "-pro/pro-module.php";
    }
    /*
    Configure options and their defaults now.
    */
    ws_widget__super_tags_configure_options_and_their_defaults();
    /*
    Function includes.
    */
    include_once dirname(__FILE__) . "/includes/funcs.inc.php";
    /*
    Hook after loaded.
    */
    do_action("ws_widget__super_tags_after_loaded");
} else {
    if (is_admin()) {
        if (!version_compare(PHP_VERSION, WS_WIDGET__SUPER_TAGS_MIN_PHP_VERSION, ">=")) {
            add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need PHP v\' . WS_WIDGET__SUPER_TAGS_MIN_PHP_VERSION . \'+ to use the Super Tags widget.</p></div>\';'));
        } else {
            if (!version_compare(get_bloginfo("version"), WS_WIDGET__SUPER_TAGS_MIN_WP_VERSION, ">=")) {
                add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need WordPress® v\' . WS_WIDGET__SUPER_TAGS_MIN_WP_VERSION . \'+ to use the Super Tags widget.</p></div>\';'));