本文整理汇总了PHP中update_blog_option函数的典型用法代码示例。如果您正苦于以下问题:PHP update_blog_option函数的具体用法?PHP update_blog_option怎么用?PHP update_blog_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_blog_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateOption
static function updateOption($name, $value, $blogID = 1)
{
if (wpsIsMultisite()) {
return update_blog_option($blogID, $name, $value);
}
return update_option($name, $value);
}
示例2: update_flag
/**
* Updates flag url for given blog.
*
* @param int $blog_id
* @param string $flag_url
*
* @return bool
*/
public static function update_flag($blog_id, $flag_url)
{
$flag_url = empty($flag_url) ? '' : $flag_url;
if ($blog_id > 0) {
return update_blog_option($blog_id, 'inpsyde_multilingual_flag_url', $flag_url);
}
return FALSE;
}
示例3: save
/**
* Validate and save user input
*
* @param array $data User input
* @return bool
*/
public function save(array $data)
{
if (!$this->nonce->is_valid()) {
return false;
}
$id = $this->get_current_blog_id($data, get_current_blog_id());
$value = $this->get_sent_value($data);
return update_blog_option($id, $this->option_name, $value);
}
示例4: popmake_update_site_option
function popmake_update_site_option($key, $value)
{
global $blog_id;
if (function_exists('is_multisite') && is_multisite() && $blog_id) {
return update_blog_option($blog_id, $key, $value);
} else {
return update_site_option($key, $value);
}
}
示例5: updateOption
/**
* Update Blog Option
*
* @param string $option
* @param mixed $data
* @param int $blog_id
*
* @return bool
*
* @access public
* @static
*/
public static function updateOption($option, $data, $blog_id = null)
{
if (is_multisite()) {
$blog = is_null($blog_id) ? get_current_blog_id() : $blog_id;
$response = update_blog_option($blog, $option, $data);
} else {
$response = update_option($option, $data);
}
return $response;
}
示例6: setOptions
/**
* @param array $options
* @param int $blog ID of the blog to be set in multisite env.
*/
public static function setOptions($options, $blog = null)
{
if (is_null($blog)) {
global $dg_options;
update_option(DG_OPTION_NAME, $options);
$dg_options = $options;
} else {
update_blog_option($blog, DG_OPTION_NAME, $options);
}
}
示例7: update_test_options
/**
* A wrapper for updating theme options on the test install
*
* @param string $option_name The option name
* @param array The options array to update
* @return bool True on success, false on failure.
*/
function update_test_options($option_name, $options_array)
{
if (defined('WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE) {
global $blog_id;
$options = update_blog_option($blog_id, $option_name, $options_array);
} else {
$options = update_option($option_name, $options_array);
}
return $options;
}
示例8: mytheme_add_admin
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: set_duplicable_option
/**
* Set 'mucd_duplicable' option to "yes" for the list of blogs, other to "no"
* @since 0.2.0
* @param array $blogs list of blogs we want the option set to "yes"
*/
public static function set_duplicable_option($blogs)
{
$network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
foreach ($network_blogs as $blog) {
if (in_array($blog['blog_id'], $blogs)) {
update_blog_option($blog['blog_id'], 'mucd_duplicable', "yes");
} else {
update_blog_option($blog['blog_id'], 'mucd_duplicable', "no");
}
}
}
示例10: login_radius_update_old_blogs
public function login_radius_update_old_blogs($oldConfig)
{
global $loginradius_api_settings;
if (isset($loginradius_api_settings['multisite_config']) && $loginradius_api_settings['multisite_config'] == '1') {
$settings = get_option('LoginRadius_share_settings');
$blogs = wp_get_sites();
foreach ($blogs as $blog) {
update_blog_option($blog['blog_id'], 'LoginRadius_share_settings', $settings);
}
}
}
示例11: oss_update_old_blogs
public function oss_update_old_blogs($oldConfig)
{
global $oss_api_settings;
if (isset($oss_api_settings['multisite_config']) && $oss_api_settings['multisite_config'] == '1') {
$settings = get_option('OpenSocialShare_share_settings');
$blogs = wp_get_sites();
foreach ($blogs as $blog) {
update_blog_option($blog['blog_id'], 'OpenSocialShare_share_settings', $settings);
}
}
}
示例12: updateAddress
public static function updateAddress($optionsToUpdate)
{
$countAddress = 1;
while (isset($optionsToUpdate['_gmsites_address' . $countAddress])) {
if ($countAddress <= GMSITES_PERSISTENCE_LIMIT) {
$key = '_gmsites_address' . $countAddress;
$value = $optionsToUpdate['_gmsites_address' . $countAddress];
update_blog_option(self::getBlogID(), $key, $value);
$countAddress++;
}
}
}
示例13: _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);
}
}
示例14: registerActivationHook
/**
* 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);
}
}
示例15: bfox_bp_option_sanitize
/**
* Sanitize the BP options
*
* We don't want to save BP options to any blog other than the BP_ROOT_BLOG
*
* @param string $new_value
* @param mixed $option
* @return string $new_value
*/
function bfox_bp_option_sanitize($new_value, $option = '')
{
global $blog_id;
// We don't want to save BP options to any blog other than the BP_ROOT_BLOG
if (BP_ROOT_BLOG != $blog_id) {
if (!$option) {
$option = substr(current_filter(), strlen('sanitize_option_'));
}
// Save the option to the BP_ROOT_BLOG
update_blog_option(BP_ROOT_BLOG, $option, $new_value);
// Since we really want to save to the BP_ROOT_BLOG, let's not change the value in this blog
$new_value = get_option($option);
}
return $new_value;
}