コード例 #1
0
ファイル: WpsOption.php プロジェクト: yarwalker/ecobyt
 static function deleteOption($name, $blogID = 1)
 {
     if (wpsIsMultisite()) {
         return delete_blog_option($blogID, $name);
     }
     return delete_option($name);
 }
コード例 #2
0
function vaa_uninstall($blog_id = false)
{
    // Delete all View Admin As options
    $option_keys = array('vaa_view_admin_as', 'vaa_role_defaults');
    if ($blog_id) {
        if ($blog_id == 'site') {
            foreach ($option_keys as $option_key) {
                delete_site_option($option_key);
            }
        } else {
            foreach ($option_keys as $option_key) {
                delete_blog_option($blog_id, $option_key);
            }
        }
    } else {
        foreach ($option_keys as $option_key) {
            delete_option($option_key);
        }
        // Delete all View Admin As user metadata
        $user_meta_keys = array('vaa-view-admin-as');
        // Older (not used anymore) keys
        $user_meta_keys[] = 'view-admin-as';
        global $wpdb;
        $all_users = $wpdb->get_results("SELECT ID FROM {$wpdb->users}");
        foreach ($all_users as $user) {
            foreach ($user_meta_keys as $user_meta_key) {
                delete_user_meta($user->ID, $user_meta_key);
            }
        }
    }
}
コード例 #3
0
 /** Delete plugin options */
 function pp_delete_multisite_option($blog_id = '')
 {
     // remove uer moderation "pending" role
     remove_role('pending_users');
     delete_blog_option($blog_id, 'pp_settings_data');
     delete_site_option('pp_plugin_lite_activated');
     delete_site_option('pp_version');
     delete_site_option('pp_db_ver');
 }
コード例 #4
0
function popmake_delete_site_option($key)
{
    global $blog_id;
    if (function_exists('is_multisite') && is_multisite() && $blog_id) {
        return delete_blog_option($blog_id, $key);
    } else {
        return delete_site_option($key);
    }
}
コード例 #5
0
ファイル: Options.php プロジェクト: themexpand/xpand-buddy
 public static function reset()
 {
     if (is_multisite()) {
         delete_blog_option(BLOG_ID_CURRENT_SITE, self::$_optionName);
     } else {
         delete_option(self::$_optionName);
     }
     self::setDefault();
 }
コード例 #6
0
 /**
  * Delete 'mucd_duplicable' option for all sites
  * @since 0.2.0
  */
 public static function delete_duplicable_option()
 {
     $network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
     foreach ($network_blogs as $blog) {
         $blog_id = $blog['blog_id'];
         delete_blog_option($blog_id, 'mucd_duplicable');
     }
     delete_site_option('mucd_duplicables');
 }
コード例 #7
0
ファイル: API.php プロジェクト: phongvan212/tuanh
 /**
  * Delete Blog Option
  *
  * @param string $option
  * @param int    $blog_id
  * 
  * @return bool
  *
  * @access public
  * @static
  */
 public static function deleteOption($option, $blog_id = null)
 {
     if (is_multisite()) {
         $blog = is_null($blog_id) ? get_current_blog_id() : $blog_id;
         $response = delete_blog_option($blog, $option);
     } else {
         $response = delete_option($option);
     }
     return $response;
 }
コード例 #8
0
function mytheme_add_admin()
{
    global $themename, $shortname, $options, $blog_id;
    $page = '';
    if (isset($_GET["page"]) && !empty($_GET["page"])) {
        $page = $_GET["page"];
    }
    if ($page == basename(__FILE__)) {
        $action = '';
        if (isset($_REQUEST["action"]) && !empty($_REQUEST["action"])) {
            $action = $_REQUEST["action"];
        }
        if ('save' == $action) {
            check_admin_referer('thematic-theme-options');
            foreach ($options as $value) {
                if (THEMATIC_MB) {
                    if (isset($_REQUEST[$value['id']])) {
                        update_blog_option($blog_id, $value['id'], $_REQUEST[$value['id']]);
                    } else {
                        update_blog_option($blog_id, $value['id'], $value['std']);
                    }
                } else {
                    if (isset($_REQUEST[$value['id']])) {
                        update_option($value['id'], $_REQUEST[$value['id']]);
                    } else {
                        update_option($value['id'], $value['std']);
                    }
                }
            }
            header("Location: themes.php?page=theme-options.php&saved=true");
            die;
        } else {
            if ('reset' == $action) {
                check_admin_referer('thematic-reset');
                foreach ($options as $value) {
                    if (THEMATIC_MB) {
                        delete_blog_option($blog_id, $value['id']);
                    } else {
                        delete_option($value['id']);
                    }
                }
                header("Location: themes.php?page=theme-options.php&reset=true");
                die;
            } else {
                if ('resetwidgets' == $action) {
                    check_admin_referer('thematic-reset-widgets');
                    update_option('sidebars_widgets', NULL);
                    header("Location: themes.php?page=theme-options.php&resetwidgets=true");
                    die;
                }
            }
        }
    }
    add_theme_page($themename . " Options", "Thematic Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
コード例 #9
0
 /**
  * Activation hook
  *
  * @see register_activation_hook()
  */
 function registerActivationHook()
 {
     // Prevent overwriting customizations if Pressbooks has been disabled
     if (!get_site_option('pressbooks-activated')) {
         // Insert Pressbooks description on root blog
         update_blog_option(1, 'blogdescription', 'Simple Book Publishing');
         // Configure theme and remove widgets from root blog
         update_blog_option(1, 'template', 'pressbooks-publisher');
         update_blog_option(1, 'stylesheet', 'pressbooks-publisher');
         delete_blog_option(1, 'sidebars_widgets');
         // Add "activated" key to enable check above
         add_site_option('pressbooks-activated', true);
     }
 }
コード例 #10
0
ファイル: multisite.php プロジェクト: ssaki/wp-super-cache
function wp_super_cache_blogs_field($name, $blog_id)
{
    if ($name != 'wp_super_cache') {
        return false;
    }
    if (isset($_GET['id']) && $blog_id == $_GET['id']) {
        $valid_nonce = isset($_GET['_wpnonce']) ? wp_verify_nonce($_GET['_wpnonce'], 'wp-cache' . $_GET['id']) : false;
        if ($valid_nonce && isset($_GET['action']) && $_GET['action'] == 'disable_cache') {
            add_blog_option($_GET['id'], 'wp_super_cache_disabled', 1);
        } elseif ($valid_nonce && isset($_GET['action']) && $_GET['action'] == 'enable_cache') {
            delete_blog_option($_GET['id'], 'wp_super_cache_disabled');
        }
    }
    if (get_blog_option($blog_id, 'wp_super_cache_disabled') == 1) {
        echo "<a href='" . wp_nonce_url(add_query_arg(array('action' => 'enable_cache', 'id' => $blog_id)), 'wp-cache' . $blog_id) . "'>" . __('Enable', 'wp-super-cache') . "</a>";
    } else {
        echo "<a href='" . wp_nonce_url(add_query_arg(array('action' => 'disable_cache', 'id' => $blog_id)), 'wp-cache' . $blog_id) . "'>" . __('Disable', 'wp-super-cache') . "</a>";
    }
}
コード例 #11
0
function ocs_uninstall($blog_id = false)
{
    // Delete all options
    $option_keys = array('off_canvas_sidebars_options');
    if ($blog_id) {
        if ($blog_id == 'site') {
            foreach ($option_keys as $option_key) {
                delete_site_option($option_key);
            }
        } else {
            foreach ($option_keys as $option_key) {
                delete_blog_option($blog_id, $option_key);
            }
        }
    } else {
        foreach ($option_keys as $option_key) {
            delete_option($option_key);
        }
    }
}
コード例 #12
0
 function create_site_admin_menu_entry()
 {
     if (@$_POST && isset($_POST['option_page']) && 'wdpv' == @$_POST['option_page']) {
         if (isset($_POST['wdpv'])) {
             $this->data->set_options($_POST['wdpv']);
         }
         if (WP_NETWORK_ADMIN && $this->data->get_option('disable_siteadmin_changes')) {
             // Flush per-blog settings
             $blogs = $this->model->get_blog_ids();
             foreach ($blogs as $blog) {
                 delete_blog_option($blog['blog_id'], "wdpv");
             }
         }
         $goback = add_query_arg('settings-updated', 'true', wp_get_referer());
         wp_redirect($goback);
         die;
     }
     add_submenu_page('settings.php', 'Post Voting', 'Post Voting', 'manage_network_options', 'wdpv', array($this, 'create_admin_page'));
     add_dashboard_page('Voting Stats', 'Voting Stats', 'manage_network_options', 'wdpv_stats', array($this, 'create_stats_page'));
 }
コード例 #13
0
 /**
  * Move site relationships from separate options to network table.
  *
  * @return void
  */
 private function import_site_relations()
 {
     /** @var Mlp_Site_Relations_Interface $db */
     $relations = $this->plugin_data->get('site_relations');
     $option_name = 'inpsyde_multilingual_blog_relationship';
     $inserted = 0;
     foreach ($this->all_sites as $site) {
         $linked = get_blog_option($site['blog_id'], $option_name, array());
         if (!empty($linked)) {
             $inserted += $relations->set_relation($site['blog_id'], $linked);
         }
         delete_blog_option($site['blog_id'], $option_name);
     }
 }
コード例 #14
0
ファイル: functions.php プロジェクト: cumi/pressbooks
function pressbooks_publisher_update_catalog()
{
    $blog_id = absint($_POST['book_id']);
    $in_catalog = $_POST['in_catalog'];
    if (current_user_can('manage_network') && check_ajax_referer('pressbooks-publisher-admin')) {
        if ($in_catalog == 'true') {
            update_blog_option($blog_id, 'pressbooks_publisher_in_catalog', 1);
        } else {
            delete_blog_option($blog_id, 'pressbooks_publisher_in_catalog');
        }
    }
}
コード例 #15
0
/**
 * Delete an option.
 *
 * This is a wrapper for {@link delete_blog_option()}, which in turn deletes
 * settings data (such as bp-pages) on the appropriate blog, given your current
 * setup.
 *
 * @since BuddyPress (1.5.0)
 *
 * @uses bp_get_root_blog_id()
 *
 * @param string $option_name The option key to be deleted.
 * @return bool True on success, false on failure.
 */
function bp_delete_option($option_name)
{
    return delete_blog_option(bp_get_root_blog_id(), $option_name);
}
コード例 #16
0
/**
 * Move a blog from one network to another
 *
 * @since 1.3
 *
 * @param integer $site_id ID of blog to move
 * @param integer $new_network_id ID of destination network
 */
function move_site($site_id, $new_network_id)
{
    global $wpdb;
    $site_id = (int) $site_id;
    // Sanity checks
    $site = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d", $site_id));
    // Bail if site does not exist
    if (empty($site)) {
        return new WP_Error('blog_not_exist', __('Site does not exist.', 'wp-multi-network'));
    }
    // Return early if site does not need to be moved
    if ((int) $new_network_id == $site->site_id) {
        return true;
    }
    // Store the old network ID for using later
    $old_network_id = $site->site_id;
    // Allow 0 network?
    if (ENABLE_NETWORK_ZERO && 0 == $site->site_id) {
        $old_network->domain = 'holding.blogs.local';
        $old_network->path = '/';
        $old_network->id = 0;
        // Make sure old network exists
    } else {
        $old_network = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id = %d", $site->site_id));
        if (empty($old_network)) {
            return new WP_Error('network_not_exist', __('Network does not exist.', 'wp-multi-network'));
        }
    }
    // Allow 0 network?
    if (ENABLE_NETWORK_ZERO && 0 == $new_network_id) {
        $new_network->domain = 'holding.blogs.local';
        $new_network->path = '/';
        $new_network->id = 0;
        // Make sure destination network exists
    } else {
        $new_network = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id = %d", $new_network_id));
        if (empty($new_network)) {
            return new WP_Error('network_not_exist', __('Network does not exist.', 'wp-multi-network'));
        }
    }
    // Tweak the domain and path as needed
    // If the site domain is the same as the network domain on a subdomain install, don't prepend old "hostname"
    if (is_subdomain_install() && $site->domain != $old_network->domain) {
        $ex_dom = substr($site->domain, 0, strpos($site->domain, '.') + 1);
        $domain = $ex_dom . $new_network->domain;
    } else {
        $domain = $new_network->domain;
    }
    $path = $new_network->path . substr($site->path, strlen($old_network->path));
    // Move the site
    $update = array('site_id' => $new_network->id, 'domain' => $domain, 'path' => $path);
    $where = array('blog_id' => $site->blog_id);
    $update_result = $wpdb->update($wpdb->blogs, $update, $where);
    // Bail if site could not be moved
    if (empty($update_result)) {
        return new WP_Error('blog_not_moved', __('Site could not be moved.', 'wp-multi-network'));
    }
    // Change relevant blog options
    $options_table = $wpdb->get_blog_prefix($site->blog_id) . 'options';
    $old_domain = $old_network->domain . $old_network->path;
    $new_domain = $new_network->domain . $new_network->path;
    // Update all site options
    foreach (network_options_list() as $option_name) {
        $option = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$options_table} WHERE option_name = %s", $option_name));
        $new_value = str_replace($old_domain, $new_domain, $option->option_value);
        update_blog_option($site->blog_id, $option_name, $new_value);
    }
    // Delete rewrite rules for site at old URL
    delete_blog_option($site_id, 'rewrite_rules');
    do_action('move_site', $site_id, $old_network_id, $new_network_id);
}
コード例 #17
0
ファイル: core.class.php プロジェクト: juslee/e27
 /**
  * Deletes options for communication with master
  * 
  */
 function uninstall($deactivate = false)
 {
     global $current_user, $wpdb, $_wp_using_ext_object_cache;
     $_wp_using_ext_object_cache = false;
     if ($this->mmb_multisite != false) {
         $network_blogs = $wpdb->get_col($wpdb->prepare("select `blog_id` from `{$wpdb->blogs}`"));
         if (!empty($network_blogs)) {
             if (is_network_admin()) {
                 if ($deactivate) {
                     delete_option('mmb_network_admin_install');
                     foreach ($network_blogs as $blog_id) {
                         delete_blog_option($blog_id, 'mmb_network_admin_install');
                         delete_blog_option($blog_id, '_worker_nossl_key');
                         delete_blog_option($blog_id, '_worker_public_key');
                         delete_blog_option($blog_id, '_action_message_id');
                         delete_blog_option($blog_id, 'mwp_maintenace_mode');
                         //delete_blog_option($blog_id, 'mwp_backup_tasks');
                         delete_blog_option($blog_id, 'mwp_notifications');
                         delete_blog_option($blog_id, 'mwp_worker_brand');
                         delete_blog_option($blog_id, 'mwp_pageview_alerts');
                         delete_blog_option($blog_id, 'mwp_pageview_alerts');
                     }
                 }
             } else {
                 if ($deactivate) {
                     delete_option('mmb_network_admin_install');
                 }
                 delete_option('_worker_nossl_key');
                 delete_option('_worker_public_key');
                 delete_option('_action_message_id');
             }
         }
     } else {
         delete_option('_worker_nossl_key');
         delete_option('_worker_public_key');
         delete_option('_action_message_id');
     }
     //Delete options
     delete_option('mwp_maintenace_mode');
     //delete_option('mwp_backup_tasks');
     delete_option('mwp_notifications');
     delete_option('mwp_worker_brand');
     delete_option('mwp_pageview_alerts');
     wp_clear_scheduled_hook('mwp_backup_tasks');
     wp_clear_scheduled_hook('mwp_notifications');
     wp_clear_scheduled_hook('mwp_datasend');
 }
コード例 #18
0
/**
 * Move a blog from one network to another
 *
 * @since 1.3
 *
 * @param integer $site_id ID of blog to move
 * @param integer $new_network_id ID of destination network
 */
function move_site($site_id, $new_network_id)
{
    global $wpdb;
    // Get the site
    $site = get_blog_details($site_id);
    // Bail if site does not exist
    if (empty($site)) {
        return new WP_Error('blog_not_exist', __('Site does not exist.', 'wp-multi-network'));
    }
    // Main sites cannot be moved, to prevent breakage
    if (is_main_site_for_network($site->blog_id)) {
        return true;
    }
    // Cast new network ID
    $new_network_id = (int) $new_network_id;
    // Return early if site does not need to be moved
    if ($new_network_id === (int) $site->site_id) {
        return true;
    }
    // Store the old network ID for using later
    $old_network_id = (int) $site->site_id;
    $old_network = wp_get_network($old_network_id);
    // No change
    if ($old_network_id === $new_network_id) {
        return new WP_Error('blog_not_moved', __('Site was not moved.', 'wp-multi-network'));
    }
    // New network is not zero
    if (0 !== $new_network_id) {
        $new_network = wp_get_network($new_network_id);
        if (empty($new_network)) {
            return new WP_Error('network_not_exist', __('Network does not exist.', 'wp-multi-network'));
        }
        // Tweak the domain and path if needed
        // If the site domain is the same as the network domain on a subdomain
        // install, don't prepend old "hostname"
        if (is_subdomain_install() && $site->domain !== $old_network->domain) {
            $ex_dom = substr($site->domain, 0, strpos($site->domain, '.') + 1);
            $domain = $ex_dom . $new_network->domain;
        } else {
            $domain = $new_network->domain;
        }
        $path = substr($site->path, strlen($old_network->path));
        // New network is zero (orphan)
    } else {
        // Mock a zero network object
        $new_network = new WP_Network((object) array('domain' => 'network.zero', 'path' => '/', 'id' => '0'));
        // Set domain & path to that of the current site
        $domain = $site->domain;
        $path = $site->path;
    }
    // Move the site is the blogs table
    $where = array('blog_id' => $site->blog_id);
    $update = array('site_id' => $new_network->id, 'domain' => $domain, 'path' => $path);
    $update_result = $wpdb->update($wpdb->blogs, $update, $where);
    // Bail if site could not be moved
    if (empty($update_result)) {
        return new WP_Error('blog_not_moved', __('Site could not be moved.', 'wp-multi-network'));
    }
    // Update old network count
    if (0 !== $old_network_id) {
        switch_to_network($old_network_id);
        wp_update_network_site_counts();
        restore_current_network();
    }
    // Update new network count
    if (0 !== $new_network_id) {
        switch_to_network($new_network_id);
        wp_update_network_site_counts();
        restore_current_network();
    }
    // Change relevant blog options
    $options_table = $wpdb->get_blog_prefix($site->blog_id) . 'options';
    $old_domain = $old_network->domain . $old_network->path;
    $new_domain = $new_network->domain . $new_network->path;
    // Update all site options
    foreach (network_options_list() as $option_name) {
        $sql = "SELECT * FROM {$options_table} WHERE option_name = %s";
        $prep = $wpdb->prepare($sql, $option_name);
        $option = $wpdb->get_row($prep);
        // No value, so skip it
        if (empty($option)) {
            continue;
        }
        $new_value = str_replace($old_domain, $new_domain, $option->option_value);
        update_blog_option($site->blog_id, $option_name, $new_value);
    }
    // Delete rewrite rules for site at old URL
    delete_blog_option($site_id, 'rewrite_rules');
    // Site moved
    do_action('move_site', $site_id, $old_network_id, $new_network_id);
}
コード例 #19
0
/**
 * Database update methods based on version numbers
 *
 * @since BuddyPress (1.7)
 */
function bp_update_to_1_6()
{
    // Delete possible site options
    delete_site_option('bp-db-version');
    delete_site_option('_bp_db_version');
    delete_site_option('bp-core-db-version');
    delete_site_option('_bp-core-db-version');
    // Delete possible blog options
    delete_blog_option(bp_get_root_blog_id(), 'bp-db-version');
    delete_blog_option(bp_get_root_blog_id(), 'bp-core-db-version');
    delete_site_option(bp_get_root_blog_id(), '_bp-core-db-version');
    delete_site_option(bp_get_root_blog_id(), '_bp_db_version');
}
コード例 #20
0
ファイル: client-dashboard.php プロジェクト: jimlongo56/rdiv
 /**
  * Clear the cache of our admin_menu and dashboard metaboxes from the whole
  * network (site...ugh) by deleting the option from each site (blog...ugh again)
  */
 public function clear_cache_network()
 {
     // Get the current site and only clear options from blogs in this site
     $site = get_current_site();
     // Site = Network? Ugh.
     if ($site && isset($site->id)) {
         global $wpdb;
         $query = $wpdb->prepare("SELECT `blog_id` FROM {$wpdb->blogs} WHERE `site_id`=%d", absint($site->id));
         $users = get_users(array('blog_id' => 0, 'fields' => array('ID')));
         foreach ($wpdb->get_col($query) as $blog_id) {
             delete_blog_option($blog_id, 'ithemes-sync-admin_menu');
             delete_blog_option($blog_id, 'ithemes-sync-dashboard-metaboxes');
             $meta_key = 'ithemes-sync-admin-bar-items-' . $blog_id;
             foreach ($users as $user) {
                 delete_user_meta($user->ID, $meta_key);
             }
         }
     }
 }
コード例 #21
0
ファイル: functions.php プロジェクト: hscale/webento
function M_delete_option($key)
{
    if (defined('MEMBERSHIP_GLOBAL_TABLES') && MEMBERSHIP_GLOBAL_TABLES === true) {
        if (function_exists('delete_blog_option')) {
            return delete_blog_option(MEMBERSHIP_GLOBAL_MAINSITE, $key);
        } else {
            return delete_option($key);
        }
    } else {
        return delete_option($key);
    }
}
コード例 #22
0
 public static function flush()
 {
     self::$_cache = array();
     if (is_multisite()) {
         delete_blog_option(NULL, self::$_name);
     } else {
         delete_option(self::$_name);
     }
 }
コード例 #23
0
 function test_with_another_site()
 {
     global $current_site, $base;
     $domain = 'blogoptiontest';
     if (is_subdomain_install()) {
         $newdomain = $domain . '.' . preg_replace('|^www\\.|', '', $current_site->domain);
         $path = $base;
     } else {
         $newdomain = $current_site->domain;
         $path = $base . $domain . '/';
     }
     $email = '*****@*****.**';
     $password = wp_generate_password(12, false);
     $user_id = wpmu_create_user($domain, $password, $email);
     $this->assertInternalType('integer', $user_id);
     $blog_id = wpmu_create_blog($newdomain, $path, $title, $user_id, array('public' => 1), $current_site->id);
     $this->assertInternalType('integer', $blog_id);
     $key = rand_str();
     $key2 = rand_str();
     $value = rand_str();
     $value2 = rand_str();
     $this->assertFalse(get_blog_option($blog_id, 'doesnotexist'));
     //$this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
     $this->assertTrue(add_blog_option($blog_id, $key, $value));
     // Assert all values of $blog_id that means the current or main blog (the same here).
     $this->assertEquals($value, get_blog_option($blog_id, $key));
     $this->assertEquals($value, get_blog_option("{$blog_id}", $key));
     //$this->assertEquals( $value, get_option( $key ) ); // check get_option()
     $this->assertFalse(add_blog_option($blog_id, $key, $value));
     // Already exists
     $this->assertFalse(update_blog_option($blog_id, $key, $value));
     // Value is the same
     $this->assertTrue(update_blog_option($blog_id, $key, $value2));
     $this->assertEquals($value2, get_blog_option($blog_id, $key));
     //$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
     $this->assertFalse(add_blog_option($blog_id, $key, $value));
     $this->assertEquals($value2, get_blog_option($blog_id, $key));
     //$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
     $this->assertTrue(delete_blog_option($blog_id, $key));
     $this->assertFalse(get_blog_option($blog_id, $key));
     //$this->assertFalse( get_option( $key ) ); // check get_option()
     $this->assertFalse(delete_blog_option($blog_id, $key));
     $this->assertTrue(update_blog_option($blog_id, $key2, $value2));
     $this->assertEquals($value2, get_blog_option($blog_id, $key2));
     //$this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
     $this->assertTrue(delete_blog_option($blog_id, $key2));
     $this->assertFalse(get_blog_option($blog_id, $key2));
     //$this->assertFalse( get_option( $key2 ) ); // check get_option()
 }
コード例 #24
0
 function mycred_delete_option($option_id)
 {
     if (is_multisite()) {
         if (mycred_override_settings()) {
             delete_blog_option(1, $option_id);
         } else {
             delete_blog_option($GLOBALS['blog_id'], $option_id);
         }
     } else {
         delete_option($option_id);
     }
 }
コード例 #25
0
 /**
  * HideMyWP::admin_notices()
  * Displays necessary information in admin panel
  *
  * @return
  */
 function admin_notices()
 {
     global $current_user;
     $this->h->update_pp_important_messages();
     $options_file = is_multisite() ? 'network/settings.php' : 'options-general.php';
     $page_url = admin_url(add_query_arg('page', self::slug, $options_file));
     $show_access_message = true;
     //Update hmw_all_plugins list whenever a theme or plugin activate
     if (isset($_GET['page']) && $_GET['page'] == self::slug || isset($_GET['deactivate']) || isset($_GET['activate']) || isset($_GET['activated']) || isset($_GET['activate-multi'])) {
         update_option('hmw_all_plugins', array_keys(get_plugins()));
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && function_exists('bulletproof_security_load_plugin_textdomain')) {
         echo __('<div class="error"><p>You use BulletProof security plugin. To make it work correctly you need to configure Hide My WP manually. Click on <strong>"Manual Configuration"</strong> in Start tab. (If you did that ignore this message).', self::slug) . '</p></div>';
         $show_access_message = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['new_admin_action']) && $_GET['new_admin_action'] == 'configured') {
         if (is_multisite()) {
             $opts = get_blog_option(BLOG_ID_CURRENT_SITE, self::slug);
             $opts['new_admin_path'] = get_option('hmwp_temp_admin_path');
             update_blog_option(BLOG_ID_CURRENT_SITE, self::slug, $opts);
         } else {
             $opts = get_option(self::slug);
             $opts['new_admin_path'] = get_option('hmwp_temp_admin_path');
             update_option(self::slug, $opts);
         }
         wp_redirect(add_query_arg('new_admin_action', 'redirect_to_new', $page_url));
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['new_admin_action']) && $_GET['new_admin_action'] == 'redirect_to_new') {
         wp_logout();
         wp_redirect(wp_login_url());
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['new_admin_action']) && $_GET['new_admin_action'] == "abort") {
         update_option('hmwp_temp_admin_path', $this->opt('new_admin_path'));
         wp_redirect(add_query_arg('new_admin_action', 'aborted_msg', $page_url));
     }
     $current_cookie = str_replace(SITECOOKIEPATH, '', ADMIN_COOKIE_PATH);
     //For non-sudomain and with pathes mu:
     if (!$current_cookie) {
         $current_cookie = 'wp-admin';
     }
     if (!trim(get_option('hmwp_temp_admin_path'), ' /') || trim(get_option('hmwp_temp_admin_path'), ' /') == 'wp-admin') {
         $new_admin_path = 'wp-admin';
     } else {
         $new_admin_path = trim(get_option('hmwp_temp_admin_path'), ' /');
     }
     $admin_rule = '';
     if ($new_admin_path && $new_admin_path != 'wp-admin') {
         $admin_rule = 'RewriteRule ^' . $new_admin_path . '/(.*) /' . $this->sub_folder . 'wp-admin/$1 [QSA,L]' . "\n";
     }
     //   if (is_multisite() && $this->is_subdir_mu)
     //       $admin_rule = 'RewriteRule ^([_0-9a-zA-Z-]+/)?' . $new_admin_path . '/(.*) /' . $this->sub_folder . 'wp-admin/$1 [QSA,L]' . "\n";
     //RewriteRule ^([_0-9a-zA-Z-]+/)?panel/(.*) $1wp-admin/$2 [QSA,L] you also need to change wp-includes/ms-default-contsant line 69
     $multi_site_rule = '';
     if (true || is_multisite()) {
         $multi_site_rule = "You also need to update your .htaccess file by adding following line  before 'RewriteCond REQUEST_FILENAME} !-f': <br><code>{$admin_rule}</code><br><br>";
     }
     //echo $current_cookie . ' sss '.$new_admin_path;
     if ($current_cookie != $new_admin_path && is_super_admin()) {
         if ($new_admin_path == 'wp-admin') {
             echo sprintf(__('<div class="error"><p><strong><span style="color: #ee0000">You MUST edit /wp-config.php to retun default admin path: </span></strong><br>  Open wp-config.php using FTP and <span style="color: #ee0000"><strong>DELETE or comment (//)</strong></span> line which start with: <br><code>define("ADMIN_COOKIE_PATH",  "...</code><br><br> <a class="button button-primary" href="%3$s">I don\'t know (Abort)</a> | <a class="button" href="%2$s">I did it! Login to new dashboard</a> </strong></p></div>', self::slug), '', add_query_arg(array('new_admin_action' => 'configured'), $page_url), add_query_arg(array('new_admin_action' => 'abort'), $page_url));
         } else {
             echo sprintf(__('<div class="error"><p><strong><span style="color: #ee0000">You MUST edit /wp-config.php to make new admin path work: </span><br>  Open wp-config.php using FTP and add following line somewhere before require_once(...) (or update it with new value): <br><code>define("ADMIN_COOKIE_PATH",  "%1$s");</code><br><br>%4$s<a class="button button-primary" href="%3$s">I don\'t know (Abort)</a> | <a class="button" href="%2$s">I did it! Login to new dashboard</a> </strong></p></div>', self::slug), preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/') . $new_admin_path, add_query_arg(array('new_admin_action' => 'configured'), $page_url), add_query_arg(array('new_admin_action' => 'abort'), $page_url), $multi_site_rule);
         }
     }
     //Good place to flush! We really need this.
     if (is_super_admin() && !function_exists('bulletproof_security_load_plugin_textdomain') && !$this->opt('customized_htaccess')) {
         flush_rewrite_rules(true);
     }
     if (is_multisite() && is_network_admin()) {
         global $wpdb;
         $sites = $wpdb->get_results("SELECT blog_id, domain FROM {$wpdb->blogs} WHERE archived = '0' AND spam = '0' AND deleted = '0' ORDER BY blog_id");
         //Loop through them
         foreach ($sites as $site) {
             global $wp_rewrite;
             //switch_to_blog($site->blog_id);
             delete_blog_option($site->blog_id, 'rewrite_rules');
             //$wp_rewrite->init();
             //$wp_rewrite->flush_rules();
         }
         //restore_current_blog();
         //flush_rewrite_rules(true);
         //$wp_rewrite->init();
     }
     $home_path = get_home_path();
     if (!file_exists($home_path . '.htaccess') && is_writable($home_path) || is_writable($home_path . '.htaccess')) {
         $writable = true;
     } else {
         $writable = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && !$this->is_permalink()) {
         if (!is_multisite()) {
             echo '<div class="error"><p>' . __('Your <a href="options-permalink.php">permalink structure</a> is off. In order to get all features of this plugin please enable it.', self::slug) . '</p></div>';
         } else {
             echo '<div class="error"><p>' . __('Please enable WP permalink structure (Settings -> Permalink ) in your sites.', self::slug) . '</p></div>';
         }
         $show_access_message = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && (isset($_GET['settings-updated']) || isset($_GET['settings-imported'])) && is_multisite()) {
         echo '<div class="error"><p>' . __('You enabled Multisite! You need to (re)configure Hide My WP almost after each change. Go to start tab, click on Multisite Configuration and follow documentation', self::slug) . '</p></div>';
         $show_access_message = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['settings-updated']) && (stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') || stristr($_SERVER['SERVER_SOFTWARE'], 'wpengine'))) {
         echo '<div class="error"><p>' . __('Your web server is Nginx! You need to (re)configure Hide My WP almost after each change. Go to start tab, click on Nginx Configuration and follow documentation', self::slug) . '</p></div>';
         $show_access_message = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && stristr($_SERVER['SERVER_SOFTWARE'], 'iis') || stristr($_SERVER['SERVER_SOFTWARE'], 'Windows')) {
         echo '<div class="error"><p>' . __('Your web server is Windows (IIS)! You need to (re)configure Hide My WP almost after each change. Go to start tab, click on Windows Configuration and follow documentation', self::slug) . '</p></div>';
         $show_access_message = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['undo_config']) && $_GET['undo_config']) {
         echo '<div class="updated fade"><p>' . __('Previous settings has been restored!', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && !$writable && !function_exists('bulletproof_security_load_plugin_textdomain')) {
         echo '<div class="error"><p>' . __('It seems there is no writable htaccess file in your WP directory. In order to get all features of this plugin please change permission of your htaccess file.', self::slug) . '</p></div>';
         $show_access_message = false;
     }
     if (basename($_SERVER['PHP_SELF']) == 'options-permalink.php' && $this->is_permalink() && isset($_POST['permalink_structure'])) {
         echo '<div class="updated"><p>' . sprintf(__('We are refreshing this page in order to implement changes. %s', self::slug), '<a href="options-permalink.php">Manual Refresh</a>') . '<script type="text/JavaScript"><!--  setTimeout("window.location = \'options-permalink.php\';", 5000);   --></script></p> </div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == "w3tc_minify") {
         echo '<div class="error"><p>' . __('In order to enable minify beside Hide My WP you need a small change in W3 Total Cache. If you already did it ignore this message. <a target="_blank" href="http://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158/faqs/17774">Read more</a>', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && (isset($_GET['settings-updated']) || isset($_GET['settings-imported'])) && $show_access_message && !$this->access_test()) {
         echo '<div class="error"><p>' . __('HMWP guesses it broke your site. If it doesn\'t ignore this messsage otherwise read <a href="http://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158/faqs/18136" target="_blank"><strong>this FAQ</strong></a> to solve the problem or rest settings to default.', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && (isset($_GET['settings-updated']) || isset($_GET['settings-imported'])) && (WP_CACHE || function_exists('hyper_cache_sanitize_uri') || class_exists('WpFastestCache') || defined('WPCACHEHOME') || defined('QUICK_CACHE_ENABLE') || defined('CACHIFY_FILE') || defined('WP_ROCKET_VERSION'))) {
         echo '<div class="updated"><p>' . __('It seems you use a caching plugin alongside Hide My WP. Great, just please make sure to flush it to see changes! (cosider browser cache, too!)', self::slug) . '</p></div>';
     }
 }
コード例 #26
0
ファイル: mu.php プロジェクト: joelglennwright/agencypress
function wpmu_get_blog_allowedthemes($blog_id = 0)
{
    $themes = get_themes();
    if ($blog_id == 0) {
        $blog_allowed_themes = get_option("allowedthemes");
    } else {
        $blog_allowed_themes = get_blog_option($blog_id, "allowedthemes");
    }
    if (!is_array($blog_allowed_themes) || empty($blog_allowed_themes)) {
        // convert old allowed_themes to new allowedthemes
        if ($blog_id == 0) {
            $blog_allowed_themes = get_option("allowed_themes");
        } else {
            $blog_allowed_themes = get_blog_option($blog_id, "allowed_themes");
        }
        if (is_array($blog_allowed_themes)) {
            foreach ((array) $themes as $key => $theme) {
                $theme_key = wp_specialchars($theme['Stylesheet']);
                if (isset($blog_allowed_themes[$key]) == true) {
                    $blog_allowedthemes[$theme_key] = 1;
                }
            }
            $blog_allowed_themes = $blog_allowedthemes;
            if ($blog_id == 0) {
                add_option("allowedthemes", $blog_allowed_themes);
                delete_option("allowed_themes");
            } else {
                add_blog_option($blog_id, "allowedthemes", $blog_allowed_themes);
                delete_blog_option($blog_id, "allowed_themes");
            }
        }
    }
    return $blog_allowed_themes;
}
コード例 #27
0
ファイル: uninstall.php プロジェクト: bulats/chef
<?php

require_once 'wordpress-https.php';
if (!defined('WP_UNINSTALL_PLUGIN')) {
    die;
}
$options = array('wordpress-https_external_urls', 'wordpress-https_secure_external_urls', 'wordpress-https_unsecure_external_urls', 'wordpress-https_ssl_host', 'wordpress-https_ssl_host_diff', 'wordpress-https_ssl_port', 'wordpress-https_exclusive_https', 'wordpress-https_frontpage', 'wordpress-https_ssl_login', 'wordpress-https_ssl_admin', 'wordpress-https_ssl_proxy', 'wordpress-https_ssl_host_subdomain', 'wordpress-https_version', 'wordpress-https_debug', 'wordpress-https_admin_menu', 'wordpress-https_secure_filter', 'wordpress-https_ssl_host_mapping');
global $wpdb;
if (is_multisite() && is_network_admin()) {
    $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM " . $wpdb->blogs, NULL));
} else {
    $blogs = array($wpdb->blogid);
}
// Delete WordPress HTTPS options
foreach ($blogs as $blog_id) {
    foreach ($options as $option) {
        if (is_multisite()) {
            delete_blog_option($blog_id, $option);
        } else {
            delete_option($option);
        }
    }
}
// Delete force_ssl custom_field from posts and pages
delete_metadata('post', null, 'force_ssl', null, true);
コード例 #28
0
ファイル: hide-my-wp.php プロジェクト: roycocup/enclothed
 /**
  * HideMyWP::admin_notices() 
  * Displays necessary information in admin panel
  * 
  * @return
  */
 function admin_notices()
 {
     global $current_user;
     $this->h->update_pp_important_messages();
     $options_file = is_multisite() ? 'ms-options.php' : 'options-general.php';
     $page_url = admin_url(add_query_arg('page', self::slug, $options_file));
     //Update hmw_all_plugins list whenever a theme or plugin activate
     if (isset($_GET['page']) && $_GET['page'] == self::slug || isset($_GET['deactivate']) || isset($_GET['activate']) || isset($_GET['activated']) || isset($_GET['activate-multi'])) {
         update_option('hmw_all_plugins', array_keys(get_plugins()));
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && function_exists('bulletproof_security_load_plugin_textdomain')) {
         echo __('<div class="error"><p>You use BulletProof security plugin. To make it work correctly you need to configure Hide My WP manually. Click on <strong>"Manual Configuration"</strong> in Start tab. (If you did that ignore this message).', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['new_admin_action']) && $_GET['new_admin_action'] == 'configured') {
         if (is_multisite()) {
             $opts = get_blog_option(BLOG_ID_CURRENT_SITE, self::slug);
             $opts['new_admin_path'] = get_option('hmwp_temp_admin_path');
             update_blog_option(BLOG_ID_CURRENT_SITE, self::slug, $opts);
         } else {
             $opts = get_option(self::slug);
             $opts['new_admin_path'] = get_option('hmwp_temp_admin_path');
             update_option(self::slug, $opts);
         }
         wp_redirect(add_query_arg('new_admin_action', 'redirect_to_new', $page_url));
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['new_admin_action']) && $_GET['new_admin_action'] == 'redirect_to_new') {
         wp_logout();
         wp_redirect(wp_login_url());
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['new_admin_action']) && $_GET['new_admin_action'] == "abort") {
         update_option('hmwp_temp_admin_path', $this->opt('new_admin_path'));
         wp_redirect(add_query_arg('new_admin_action', 'aborted_msg', $page_url));
     }
     $current_cookie = str_replace(SITECOOKIEPATH, '', ADMIN_COOKIE_PATH);
     if (!trim(get_option('hmwp_temp_admin_path'), ' /') || trim(get_option('hmwp_temp_admin_path'), ' /') == 'wp-admin') {
         $new_admin_path = 'wp-admin';
     } else {
         $new_admin_path = trim(get_option('hmwp_temp_admin_path'), ' /');
     }
     if ($current_cookie != $new_admin_path) {
         if ($new_admin_path == 'wp-admin') {
             echo sprintf(__('<div class="error"><p><strong><span style="color: #ee0000">You MUST edit /wp-config.php to retun default admin path: </span></strong><br>  Open wp-config.php using FTP and <strong>DELETE or comment (//)</strong> line that start with: <br><code>define("ADMIN_COOKIE_PATH",  "...</code><br><br> <a class="button button-primary" href="%3$s">I don\'t know (Abort)</a> | <a class="button" href="%2$s">I did it! Login to new dashboard</a> </strong></p></div>', self::slug), '', add_query_arg(array('new_admin_action' => 'configured'), $page_url), add_query_arg(array('new_admin_action' => 'abort'), $page_url));
         } else {
             echo sprintf(__('<div class="error"><p><strong><span style="color: #ee0000">You MUST edit /wp-config.php to make new admin path work: </span><br>  Open wp-config.php using FTP and add following line somewhere before require_once(...) (or update it with new value): <br><code>define("ADMIN_COOKIE_PATH",  "%1$s");</code><br><br> <a class="button button-primary" href="%3$s">I don\'t know (Abort)</a> | <a class="button" href="%2$s">I did it! Login to new dashboard</a> </strong></p></div>', self::slug), preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/') . $new_admin_path, add_query_arg(array('new_admin_action' => 'configured'), $page_url), add_query_arg(array('new_admin_action' => 'abort'), $page_url));
         }
     }
     //Good place to flush! We really need this.
     if (is_super_admin() && !function_exists('bulletproof_security_load_plugin_textdomain') && !$this->opt('customized_htaccess')) {
         flush_rewrite_rules(true);
     }
     if (is_multisite() && is_network_admin()) {
         global $wpdb;
         $sites = $wpdb->get_results($wpdb->prepare("SELECT blog_id, domain FROM wp_blogs WHERE archived = '0' AND spam = '0' AND deleted = '0' ORDER BY blog_id", ''));
         //Loop through them
         foreach ($sites as $site) {
             global $wp_rewrite;
             //switch_to_blog($site->blog_id);
             delete_blog_option($site->blog_id, 'rewrite_rules');
             //$wp_rewrite->init();
             //$wp_rewrite->flush_rules();
         }
         //restore_current_blog();
         //flush_rewrite_rules(true);
         //$wp_rewrite->init();
     }
     $home_path = get_home_path();
     if (!file_exists($home_path . '.htaccess') && is_writable($home_path) || is_writable($home_path . '.htaccess')) {
         $writable = true;
     } else {
         $writable = false;
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && !$this->is_permalink()) {
         if (!is_multisite()) {
             echo '<div class="error"><p>' . __('Your <a href="options-permalink.php">permalink structure</a> is off. In order to get all features of this plugin please enable it.', self::slug) . '</p></div>';
         } else {
             echo '<div class="error"><p>' . __('Please enable WP permalink structure (Settings -> Permalink ) in your sites.', self::slug) . '</p></div>';
         }
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && (isset($_GET['settings-updated']) || isset($_GET['settings-imported'])) && is_multisite()) {
         echo '<div class="error"><p>' . __('You enabled Multisite! You need to (re)configure Hide My WP almost after each change. Go to start tab, click on Multisite Configuration and follow documentation', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && isset($_GET['settings-updated']) && (stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') || stristr($_SERVER['SERVER_SOFTWARE'], 'wpengine'))) {
         echo '<div class="error"><p>' . __('Your web server is Nginx! You need to (re)configure Hide My WP almost after each change. Go to start tab, click on Nginx Configuration and follow documentation', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && stristr($_SERVER['SERVER_SOFTWARE'], 'iis') || stristr($_SERVER['SERVER_SOFTWARE'], 'Windows')) {
         echo '<div class="error"><p>' . __('It seems you use Windows web server! Hide My WP doesn\'t offically support IIS but you may still make it work! Read the <a target="_blank" href="http://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158/faqs/16072">FAQ</a>', self::slug) . '</p></div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == self::slug && !$writable && !function_exists('bulletproof_security_load_plugin_textdomain')) {
         echo '<div class="error"><p>' . __('It seems there is no writable htaccess file in your WP directory. In order to get all features of this plugin please change permission of your htaccess file.', self::slug) . '</p></div>';
     }
     if (basename($_SERVER['PHP_SELF']) == 'options-permalink.php' && $this->is_permalink() && isset($_POST['permalink_structure'])) {
         echo '<div class="updated"><p>' . sprintf(__('We are refreshing this page in order to fully implement changes. %s', self::slug), '<a href="options-permalink.php">Manual Refresh</a>') . '<script type="text/JavaScript"><!--  setTimeout("window.location = \\"options-permalink.php\\";", 5000);   --></script></p> </div>';
     }
     if (isset($_GET['page']) && $_GET['page'] == "w3tc_minify") {
         echo '<div class="error"><p>' . __('In order to enable minify beside Hide My WP you need a small change in W3 Total Cache. If you already did it ignore this message. <a target="_blank" href="http://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158/faqs/17774">Read more</a>', self::slug) . '</p></div>';
     }
 }
コード例 #29
0
 /**
  * Returns array of stylesheet names of themes allowed on the site.
  *
  * @since 3.4.0
  * @access public
  *
  * @param int $blog_id Optional. Defaults to current blog.
  * @return array Array of stylesheet names.
  */
 public static function get_allowed_on_site($blog_id = null)
 {
     static $allowed_themes = array();
     if (!$blog_id) {
         $blog_id = get_current_blog_id();
     }
     if (isset($allowed_themes[$blog_id])) {
         return $allowed_themes[$blog_id];
     }
     $current = $blog_id == get_current_blog_id();
     if ($current) {
         $allowed_themes[$blog_id] = get_option('allowedthemes');
     } else {
         $allowed_themes[$blog_id] = get_blog_option($blog_id, 'allowedthemes');
     }
     // This is all super old MU back compat joy.
     // 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
     if (false === $allowed_themes[$blog_id]) {
         if ($current) {
             $allowed_themes[$blog_id] = get_option('allowed_themes');
         } else {
             $allowed_themes[$blog_id] = get_blog_option($blog_id, 'allowed_themes');
         }
         if (!is_array($allowed_themes[$blog_id]) || empty($allowed_themes[$blog_id])) {
             $allowed_themes[$blog_id] = array();
         } else {
             $converted = array();
             $themes = wp_get_themes();
             foreach ($themes as $stylesheet => $theme_data) {
                 if (isset($allowed_themes[$blog_id][$theme_data->get('Name')])) {
                     $converted[$stylesheet] = true;
                 }
             }
             $allowed_themes[$blog_id] = $converted;
         }
         // Set the option so we never have to go through this pain again.
         if (is_admin() && $allowed_themes[$blog_id]) {
             if ($current) {
                 update_option('allowedthemes', $allowed_themes[$blog_id]);
                 delete_option('allowed_themes');
             } else {
                 update_blog_option($blog_id, 'allowedthemes', $allowed_themes[$blog_id]);
                 delete_blog_option($blog_id, 'allowed_themes');
             }
         }
     }
     return $allowed_themes[$blog_id];
 }
コード例 #30
0
 /**
  * Reset all options for a specific multisite blog to their default values based upon a
  * specified default blog if one was chosen on the network page or the plugin defaults if it was not
  *
  * @static
  *
  * @param  int|string $blog_id Blog id of the blog for which to reset the options
  *
  * @return  void
  */
 public static function reset_ms_blog($blog_id)
 {
     if (is_multisite()) {
         $options = get_site_option('wpseo_ms');
         $option_names = self::get_option_names();
         if (is_array($option_names) && $option_names !== array()) {
             $base_blog_id = $blog_id;
             if ($options['defaultblog'] !== '' && $options['defaultblog'] != 0) {
                 $base_blog_id = $options['defaultblog'];
             }
             foreach ($option_names as $option_name) {
                 delete_blog_option($blog_id, $option_name);
                 $new_option = get_blog_option($base_blog_id, $option_name);
                 /* Remove sensitive, theme dependent and site dependent info */
                 if (isset(self::$option_instances[$option_name]) && self::$option_instances[$option_name]->ms_exclude !== array()) {
                     foreach (self::$option_instances[$option_name]->ms_exclude as $key) {
                         unset($new_option[$key]);
                     }
                 }
                 if ($option_name === 'wpseo') {
                     $new_option['ms_defaults_set'] = true;
                 }
                 update_blog_option($blog_id, $option_name, $new_option);
             }
         }
     }
 }