当前位置: 首页>>代码示例>>PHP>>正文


PHP add_blog_option函数代码示例

本文整理汇总了PHP中add_blog_option函数的典型用法代码示例。如果您正苦于以下问题:PHP add_blog_option函数的具体用法?PHP add_blog_option怎么用?PHP add_blog_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_blog_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public static function update($key, $value)
 {
     self::initialize();
     if (!empty(self::$_cache[$key]) && self::$_cache[$key] == $value) {
         return;
     }
     self::$_cache[$key] = $value;
     if (empty(self::$_cache)) {
         return;
     }
     if (self::$_empty) {
         if (is_multisite()) {
             add_blog_option(NULL, self::$_name, self::$_cache);
         } else {
             add_option(self::$_name, self::$_cache);
         }
         self::$_empty = FALSE;
     } else {
         if (is_multisite()) {
             update_blog_option(NULL, self::$_name, self::$_cache);
         } else {
             update_option(self::$_name, self::$_cache);
         }
     }
 }
开发者ID:simeont9,项目名称:stoneopen,代码行数:25,代码来源:class.pope_cache_drivers.php

示例2: addOption

 static function addOption($name, $value, $blogID = 1)
 {
     if (wpsIsMultisite()) {
         return add_blog_option($blogID, $name, $value);
     }
     return add_option($name, $value);
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:7,代码来源:WpsOption.php

示例3: init_duplicable_option

 /**
  * Init 'mucd_duplicable' options
  * @param string $blogs_value the value for blogs options
  * @param string $network_value the value for site option
  * @since 0.2.0
  */
 public static function init_duplicable_option($blogs_value = "no", $network_value = "all")
 {
     $network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
     foreach ($network_blogs as $blog) {
         $blog_id = $blog['blog_id'];
         add_blog_option($blog_id, 'mucd_duplicable', $blogs_value);
     }
     add_site_option('mucd_duplicables', $network_value);
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:15,代码来源:option.php

示例4: _archivesCalendar_activate

function _archivesCalendar_activate()
{
    global $wpdb;
    $default_options = array("css" => 1, "theme" => "calendrier", "js" => 1, "show_settings" => 1, "filter" => 0, "javascript" => "jQuery(document).ready(function(\$){\n\t\$('.calendar-archives').archivesCW();\n});");
    $default_custom_css = file_get_contents(plugins_url('/admin/default_custom.css', __FILE__));
    $default_themer_options = array("arw-theme1" => $default_custom_css, "arw-theme2" => '');
    if (!($options = get_option('archivesCalendar'))) {
        // if new installation copy default options into the DB
        $options = $default_options;
    } else {
        // if reactivation or after update: merge existing settings with the defaults in case if new options were added in the update
        array_merge($default_options, $options);
    }
    if (!($themer_options = get_option('archivesCalendarThemer'))) {
        $themer_options = $default_themer_options;
    }
    foreach ($themer_options as $ctheme => $css) {
        if ($css) {
            if (is_writable('../wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/themes/')) {
                if (isMU()) {
                    $old_blog = $wpdb->blogid;
                    $blogids = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs}");
                    foreach ($blogids as $blogid) {
                        $blog_id = $blogid->blog_id;
                        switch_to_blog($blog_id);
                        $filename = '../wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/themes/' . $ctheme . '-' . $wpdb->blogid . '.css';
                        $themefile = fopen($filename, "w") or die("Unable to open file!");
                        fwrite($themefile, $css);
                        fclose($themefile);
                    }
                    switch_to_blog($old_blog);
                } else {
                    $filename = '../wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/themes/' . $ctheme . '.css';
                    $themefile = fopen($filename, "w") or die("Unable to open file!");
                    fwrite($themefile, $css);
                    fclose($themefile);
                }
            } else {
                echo "<p>Can't write in `/wp-content/plugins/" . dirname(plugin_basename(__FILE__)) . "/themes/" . " </p>";
            }
        }
    }
    if (isMU()) {
        update_blog_option($wpdb->blogid, 'archivesCalendar', $options);
        add_blog_option($wpdb->blogid, 'archivesCalendar', $options);
        add_blog_option($wpdb->blogid, 'archivesCalendarThemer', $themer_options);
    } else {
        update_option('archivesCalendar', $options);
        add_option('archivesCalendar', $options);
        add_option('archivesCalendarThemer', $themer_options);
    }
}
开发者ID:durichitayat,项目名称:befolio-wp,代码行数:52,代码来源:arw-install.php

示例5: instance

 /** Save default plugin settings on activation */
 public static function instance()
 {
     $general_settings = array();
     $general_settings['set_log_out_url'] = 'current_view_page';
     $general_settings['set_login_redirect'] = 'dashboard';
     $general_settings['set_login_url'] = \pp_default_pages\Login::instance();
     $general_settings['set_registration_url'] = \pp_default_pages\Registration::instance();
     $general_settings['set_lost_password_url'] = \pp_default_pages\Password_Reset::instance();
     if (is_multisite()) {
         add_blog_option(null, 'pp_settings_data', $general_settings);
     } else {
         add_option('pp_settings_data', $general_settings);
     }
 }
开发者ID:pawandhillon,项目名称:ICTICT-project,代码行数:15,代码来源:base.php

示例6: add_blog_option

 /** RESTful endpoint for this multisite function.
  *
  * Get $_REQUEST options for this endpoint:
  *
  * u (optional) -- Username (if not logged in)
  * p (optional) -- Password (if not logged in)
  * nonce (required) -- the security nonce for this API function
  * blog_id (required) if not set then current site id is used
  * key (required) key of the blog option to add
  * value (required) value of the blog option
  *
  * Returns Success message or error
  */
 public function add_blog_option()
 {
     global $json_api;
     $this->_verify_admin();
     $this->_verify_nonce('add_blog_option');
     extract($_REQUEST);
     if (!isset($blog_id)) {
         $json_api->error(__("You must send the 'blog_id' parameter."));
     }
     if (!isset($key)) {
         $json_api->error(__("You must send the 'key' parameter."));
     }
     if (!isset($value)) {
         $json_api->error(__("You must send the 'value' parameter."));
     }
     add_blog_option($blog_id, $key, $value);
     return array("message" => __("You successfully added a blog option."));
 }
开发者ID:vccabral,项目名称:wp-json-api,代码行数:31,代码来源:multisite.php

示例7: set

 public static function set($_options)
 {
     if (is_multisite()) {
         if (!@get_blog_option(BLOG_ID_CURRENT_SITE, self::$_optionName)) {
             add_blog_option(BLOG_ID_CURRENT_SITE, self::$_optionName, $_options);
         } else {
             update_blog_option(BLOG_ID_CURRENT_SITE, self::$_optionName, $_options + @get_blog_option(BLOG_ID_CURRENT_SITE, self::$_optionName));
         }
         self::$_arrSettings = @get_blog_option(BLOG_ID_CURRENT_SITE, self::$_optionName);
     } else {
         if (!@get_option(self::$_optionName)) {
             add_option(self::$_optionName, $_options);
         } else {
             update_option(self::$_optionName, $_options + @get_option(self::$_optionName));
         }
         self::$_arrSettings = @get_option(self::$_optionName);
     }
 }
开发者ID:themexpand,项目名称:xpand-buddy,代码行数:18,代码来源:Options.php

示例8: wp_super_cache_blogs_field

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>";
    }
}
开发者ID:ssaki,项目名称:wp-super-cache,代码行数:19,代码来源:multisite.php

示例9: wpsNetworkActivate

function wpsNetworkActivate($networkwide = false)
{
    if (wpsIsMultisite()) {
        global $wpdb;
        if ($networkwide) {
            $old_blog = $wpdb->blogid;
            // Get all blog ids
            $blogIds = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
            foreach ($blogIds as $blog_id) {
                switch_to_blog($blog_id);
                update_blog_option($blog_id, 'WPS_PLUGIN_ACTIVATED', 1);
                delete_blog_option($blog_id, WpsSettings::PLUGIN_ERROR_NOTICE_OPTION);
            }
            switch_to_blog($old_blog);
            if (_wpsSiteActivate(true, $old_blog)) {
                add_blog_option($old_blog, 'WPS_KEEP_NUM_ENTRIES_LT', 500);
                add_blog_option($old_blog, 'WPS_REFRESH_RATE_AJAX_LT', 10);
                add_blog_option($old_blog, 'WPS_NETWORK_INSTALL', 1);
                add_blog_option($old_blog, 'WPS_PLUGIN_ACTIVATED', 1);
                add_blog_option($old_blog, WpsSettings::ENABLE_LIVE_TRAFFIC, 1);
            } else {
                $notices = get_blog_option($wpdb->blogid, WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, array());
                $notices[] = '<p><strong>' . WPS_PLUGIN_NAME . '</strong></p><p><strong>Error:</strong> An error has occurred while installing the plugin.</p>';
                update_site_option($wpdb->blogid, WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
            }
        } else {
            wp_redirect(network_admin_url('plugins.php'));
            exit;
        }
    } else {
        add_option('WPS_KEEP_NUM_ENTRIES_LT', 500);
        add_option('WPS_REFRESH_RATE_AJAX_LT', 10);
        add_option(WpsSettings::ENABLE_LIVE_TRAFFIC, 1);
        _wpsSiteActivate();
    }
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:36,代码来源:wss-functions.php

示例10: wpeo_add_blog_option

 function wpeo_add_blog_option($id, $option, $value)
 {
     $value = maybe_serialize($value);
     $value = WP_Encrypted_Options::encrypt($value);
     return add_blog_option($id, $option, $value);
 }
开发者ID:joshbetz,项目名称:wp-encrypted-options,代码行数:6,代码来源:wp-encrypted-options.php

示例11: setOption

 /**
  * Set an option's value related to a specific blog
  *
  * @param string $key
  *        	option key
  * @param int $blogID
  *        	blog ID (default: current blog)
  * @param string $value
  *        	new option value
  */
 public function setOption($key, $value, $blogID = null)
 {
     $this->settingsChanged = true;
     self::$wpPiwik->log('Changed option ' . $key . ': ' . $value);
     if ($this->checkNetworkActivation() && !empty($blogID)) {
         add_blog_option($blogID, 'wp-piwik-' . $key, $value);
     } else {
         $this->settings[$key] = $value;
     }
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:20,代码来源:Settings.php

示例12: networkActivate


//.........这里部分代码省略.........
         }
         // Get columns
         $query = "SHOW COLUMNS FROM {$table2}";
         $cols = $wpdb->get_results($query, ARRAY_A);
         $columns = array();
         if (empty($cols)) {
             wssLog("Could not retrieve columns from table: {$table2}");
             $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>. Error running query: <strong><pre>{$query}</pre></strong>. Please inform the plugin author about this error.";
             WpsOption::updateOption(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
             return false;
         }
         foreach ($cols as $i => $values) {
             if (isset($values['Field']) && !empty($values['Field'])) {
                 array_push($columns, $values['Field']);
             }
         }
         $entryCountryExists = $entryCityExists = $blogIdExists = false;
         if (in_array('entryCountry', $columns)) {
             $entryCountryExists = true;
         }
         if (in_array('entryCity', $columns)) {
             $entryCityExists = true;
         }
         if (in_array('blogId', $columns)) {
             $blogIdExists = true;
         }
         //## Check for column: entryCountry
         wssLog("Checking for column: entryCountry");
         if (!$entryCountryExists) {
             // alter table
             $q = "ALTER TABLE {$table2} ADD COLUMN `entryCountry` VARCHAR(125) NOT NULL DEFAULT '' AFTER `entryRequestedUrl`;";
             $result = @$wpdb->query($q);
             if ($result === false) {
                 //#! MySQL error
                 $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>. Error running query: <strong><pre>{$q}</pre></strong>.";
                 update_site_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
                 return false;
             }
         }
         //## Check for column: entryCity
         wssLog("Checking for column: entryCity");
         if (!$entryCityExists) {
             $q = "ALTER TABLE {$table2} ADD COLUMN `entryCity` VARCHAR(125) NOT NULL DEFAULT '' AFTER `entryCountry`;";
             $result = @$wpdb->query($q);
             if ($result === false) {
                 //#! MySQL error
                 $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>. Error running query: <strong><pre>{$q}</pre></strong>.";
                 update_site_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
                 return false;
             }
         }
         //## Check for column: blogId
         wssLog("Checking for column: blogid");
         if (!$blogIdExists) {
             $q = "ALTER TABLE {$table2} ADD COLUMN `blogId` INT(10) NOT NULL DEFAULT 1 AFTER `entryCity`;";
             $result = @$wpdb->query($q);
             if ($result === false) {
                 //#! MySQL error
                 $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>. Error running query: <strong><pre>{$q}</pre></strong>.";
                 update_site_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
                 return false;
             }
         }
         wssLog("{$table2} updated successfully");
     }
     if (!WsdUtil::tableExists($table3)) {
         wssLog("table not found: {$table3}");
         if (!$hasCreateRight) {
             $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>: The database user needs the '<strong>CREATE</strong>' right in order to install this plugin.";
             update_site_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
             return false;
         }
         $query3 = "CREATE TABLE IF NOT EXISTS {$table3} (\n                        `entryId` BIGINT NOT NULL AUTO_INCREMENT ,\n                        `scanId` INT NOT NULL ,\n                        `filePath` VARCHAR(1000) NOT NULL ,\n                        `dateModified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,\n                        `fileNotFound` TINYINT NOT NULL DEFAULT 0,\n                        PRIMARY KEY (`entryId`) ,\n                        UNIQUE INDEX `entryId_UNIQUE` (`entryId` ASC) ) {$charset_collate};";
         $result = @$wpdb->query($query3);
         if ($result === false) {
             //#! MySQL error
             $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>. Error running query: <strong><pre>{$query3}</pre></strong>.";
             update_site_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
             return false;
         }
     }
     if (!WsdUtil::tableExists($table4)) {
         wssLog("table not found: {$table4}");
         if (!$hasCreateRight) {
             $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>: The database user needs the '<strong>CREATE</strong>' right in order to install this plugin.";
             WpsOption::updateOption(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
             return false;
         }
         $query4 = "CREATE  TABLE {$table4} (\n                        `scanId` INT NOT NULL AUTO_INCREMENT ,\n                        `scanStartDate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n                        `scanEndDate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n                        `scanResult` INT NOT NULL DEFAULT 0,\n                        `failReason` VARCHAR(5000) NOT NULL DEFAULT '',\n                        `scanType` int(11) NOT NULL DEFAULT '0',\n                        PRIMARY KEY (`scanId`) ) {$charset_collate};";
         $result = @$wpdb->query($query4);
         if ($result === false) {
             //#! MySQL error
             $notices[] = '<strong>' . WPS_PLUGIN_NAME . "</strong>. Error running query: <strong><pre>{$query4}</pre></strong>.";
             update_site_option(WpsSettings::PLUGIN_ERROR_NOTICE_OPTION, $notices);
             return false;
         }
     }
     add_blog_option($wpdb->blogid, WpsSettings::CAN_RUN_TASKS_OPTION_NAME, 1);
     return true;
 }
开发者ID:prosenjit-itobuz,项目名称:upages,代码行数:101,代码来源:WsdPlugin.php

示例13: wpmu_new_blog

 /**
  * Creates default option and inserts it into the Options table on blog creation
  * 
  * @param int $blog_id Blog ID of the created blog
  * 
  * @since 1.0.0
  * 
  * @action
  * @event https://codex.wordpress.org/Plugin_API/Action_Reference/wpmu_new_blog
  * @in class-mcb-admin.php Mobile_Contact_Bar_Admin::plugins_loaded()
  * 
  * @uses https://codex.wordpress.org/Function_Reference/add_blog_option
  * @uses class-mcb-admin.php Mobile_Contact_Bar_Admin::get_default_option()
  * 
  */
 public static function wpmu_new_blog($blog_id)
 {
     add_blog_option($blog_id, 'mcb_option', self::get_default_option());
 }
开发者ID:bansaghi,项目名称:mobile-contact-bar,代码行数:19,代码来源:class-mcb-admin.php

示例14: the_champ_replicate_settings

 /**
  * replicate the options to the new blog created
  */
 function the_champ_replicate_settings($blogId)
 {
     global $theChampFacebookOptions, $theChampLoginOptions, $theChampSharingOptions;
     add_blog_option($blogId, 'the_champ_facebook', $theChampFacebookOptions);
     add_blog_option($blogId, 'the_champ_login', $theChampLoginOptions);
     add_blog_option($blogId, 'the_champ_sharing', $theChampSharingOptions);
 }
开发者ID:vanlong200880,项目名称:uni,代码行数:10,代码来源:helper.php

示例15: wpmu_get_blog_allowedthemes

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;
}
开发者ID:joelglennwright,项目名称:agencypress,代码行数:34,代码来源:mu.php


注:本文中的add_blog_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。