本文整理汇总了PHP中get_network_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_network_option函数的具体用法?PHP get_network_option怎么用?PHP get_network_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_network_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_dashboard_blog
/**
* Get the "dashboard blog", the blog where users without a blog edit their profile data.
* Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
*
* @since MU
* @deprecated 3.1.0 Use get_blog_details()
* @see get_blog_details()
*
* @return int Current site ID.
*/
function get_dashboard_blog()
{
_deprecated_function(__FUNCTION__, '3.1');
if ($blog = get_network_option('dashboard_blog')) {
return get_blog_details($blog);
}
return get_blog_details($GLOBALS['current_site']->blog_id);
}
示例2: deactivate_plugins
/**
* Deactivates the given plugins network-wide.
*
* @since 3.0.0
*
* @param string[] $plugins Plugin base names (or partials). These will be matched against all active plugins.
*
* @return string[] An array with all plugins that were deactivated.
*/
public function deactivate_plugins(array $plugins)
{
$active_plugins = (array) get_network_option(null, NetworkPluginDeactivator::OPTION, []);
$plugins_to_deactivate = $this->get_plugins_to_deactivate(array_keys($active_plugins), $plugins);
if (!$plugins_to_deactivate) {
return $plugins_to_deactivate;
}
$active_plugins = array_diff_key($active_plugins, array_flip($plugins_to_deactivate));
update_site_option(NetworkPluginDeactivator::OPTION, $active_plugins);
return $plugins_to_deactivate;
}
示例3: get_locale
/**
* Retrieves the current locale.
*
* If the locale is set, then it will filter the locale in the {@see 'locale'}
* filter hook and return the value.
*
* If the locale is not set already, then the WPLANG constant is used if it is
* defined. Then it is filtered through the {@see 'locale'} filter hook and
* the value for the locale global set and the locale is returned.
*
* The process to get the locale should only be done once, but the locale will
* always be filtered using the {@see 'locale'} hook.
*
* @since 1.5.0
*
* @global string $locale
* @global string $wp_local_package
*
* @return string The locale of the blog or from the {@see 'locale'} hook.
*/
function get_locale()
{
global $locale, $wp_local_package;
if (isset($locale)) {
/**
* Filter WordPress install's locale ID.
*
* @since 1.5.0
*
* @param string $locale The locale ID.
*/
return apply_filters('locale', $locale);
}
if (isset($wp_local_package)) {
$locale = $wp_local_package;
}
// WPLANG was defined in wp-config.
if (defined('WPLANG')) {
$locale = WPLANG;
}
// If multisite, check options.
if (is_multisite()) {
// Don't check blog option when installing.
if (defined('WP_INSTALLING') || false === ($ms_locale = get_option('WPLANG'))) {
$ms_locale = get_network_option('WPLANG');
}
if ($ms_locale !== false) {
$locale = $ms_locale;
}
} else {
$db_locale = get_option('WPLANG');
if ($db_locale !== false) {
$locale = $db_locale;
}
}
if (empty($locale)) {
$locale = 'en_US';
}
/** This filter is documented in wp-includes/l10n.php */
return apply_filters('locale', $locale);
}
示例4: ms_upload_constants
/**
* Defines Multisite upload constants.
*
* Exists for backward compatibility with legacy file-serving through
* wp-includes/ms-files.php (wp-content/blogs.php in MU).
*
* @since 3.0.0
*
* @global wpdb $wpdb
*/
function ms_upload_constants()
{
global $wpdb;
// This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
add_filter('default_site_option_ms_files_rewriting', '__return_true');
if (!get_network_option('ms_files_rewriting')) {
return;
}
// Base uploads dir relative to ABSPATH
if (!defined('UPLOADBLOGSDIR')) {
define('UPLOADBLOGSDIR', 'wp-content/blogs.dir');
}
// Note, the main site in a post-MU network uses wp-content/uploads.
// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
if (!defined('UPLOADS')) {
define('UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/");
// Uploads dir relative to ABSPATH
if ('wp-content/blogs.dir' == UPLOADBLOGSDIR && !defined('BLOGUPLOADDIR')) {
define('BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/");
}
}
}
示例5: __invoke
/**
* Get/set sys version.
*
* @since 160531 Sys options.
*
* @param string $key Sys option key.
* @param mixed|null $value If setting value.
* @param bool $autoload Autoload option key?
*
* @return mixed|null Sys option value or `null`.
*/
public function __invoke(string $key, $value = null, bool $autoload = true)
{
$key = $this->App->Config->©brand['©var'] . '_' . $key;
if ($this->App->Config->§specs['§is_network_wide'] && $this->Wp->is_multisite) {
if (isset($value)) {
update_network_option(null, $key, $value);
}
if (($value = get_network_option(null, $key)) === null || $value === false) {
add_network_option(null, $key, ':null');
// Autoload impossible.
// These will not autoload and there is no way to change this.
}
} else {
// Default.
if (isset($value)) {
update_option($key, $value);
}
if (($value = get_option($key)) === null || $value === false) {
add_option($key, ':null', '', $autoload ? 'yes' : 'no');
}
}
return $value === null || $value === false || $value === ':null' ? null : $value;
}
示例6: wp_die
if (!is_multisite()) {
wp_die(__('Multisite support is not enabled.'));
}
if (!current_user_can('manage_network_themes')) {
wp_die(__('You do not have sufficient permissions to manage network themes.'));
}
$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$action = $wp_list_table->current_action();
$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
$temp_args = array('enabled', 'disabled', 'deleted', 'error');
$_SERVER['REQUEST_URI'] = remove_query_arg($temp_args, $_SERVER['REQUEST_URI']);
$referer = remove_query_arg($temp_args, wp_get_referer());
if ($action) {
$allowed_themes = get_network_option('allowedthemes');
switch ($action) {
case 'enable':
check_admin_referer('enable-theme_' . $_GET['theme']);
$allowed_themes[$_GET['theme']] = true;
update_network_option('allowedthemes', $allowed_themes);
if (false === strpos($referer, '/network/themes.php')) {
wp_redirect(network_admin_url('themes.php?enabled=1'));
} else {
wp_safe_redirect(add_query_arg('enabled', 1, $referer));
}
exit;
case 'disable':
check_admin_referer('disable-theme_' . $_GET['theme']);
unset($allowed_themes[$_GET['theme']]);
update_network_option('allowedthemes', $allowed_themes);
示例7: set_site_transient
/**
* Set/update the value of a site transient.
*
* You do not need to serialize values, if the value needs to be serialize, then
* it will be serialized before it is set.
*
* @since 2.9.0
*
* @see set_transient()
*
* @param string $transient Transient name. Expected to not be SQL-escaped. Must be
* 40 characters or fewer in length.
* @param mixed $value Transient value. Expected to not be SQL-escaped.
* @param int $expiration Optional. Time until expiration in seconds. Default 0.
* @return bool False if value was not set and true if value was set.
*/
function set_site_transient($transient, $value, $expiration = 0)
{
/**
* Filter the value of a specific site transient before it is set.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 3.0.0
* @since 4.4.0 The `$transient` parameter was added
*
* @param mixed $value Value of site transient.
* @param string $transient Transient name.
*/
$value = apply_filters('pre_set_site_transient_' . $transient, $value, $transient);
$expiration = (int) $expiration;
if (wp_using_ext_object_cache()) {
$result = wp_cache_set($transient, $value, 'site-transient', $expiration);
} else {
$transient_timeout = '_site_transient_timeout_' . $transient;
$option = '_site_transient_' . $transient;
if (false === get_network_option($option)) {
if ($expiration) {
add_network_option($transient_timeout, time() + $expiration);
}
$result = add_network_option($option, $value);
} else {
if ($expiration) {
update_network_option($transient_timeout, time() + $expiration);
}
$result = update_network_option($option, $value);
}
}
if ($result) {
/**
* Fires after the value for a specific site transient has been set.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 3.0.0
* @since 4.4.0 The `$transient` parameter was added
*
* @param mixed $value Site transient value.
* @param int $expiration Time until expiration in seconds. Default 0.
* @param string $transient Transient name.
*/
do_action('set_site_transient_' . $transient, $value, $expiration, $transient);
/**
* Fires after the value for a site transient has been set.
*
* @since 3.0.0
*
* @param string $transient The name of the site transient.
* @param mixed $value Site transient value.
* @param int $expiration Time until expiration in seconds. Default 0.
*/
do_action('setted_site_transient', $transient, $value, $expiration);
}
return $result;
}
示例8: test_get_network_option_network_id_parameter
/**
* @dataProvider data_network_id_parameter
*
* @param $network_id
* @param $expected_response
*/
function test_get_network_option_network_id_parameter($network_id, $expected_response)
{
$option = rand_str();
$this->assertEquals($expected_response, get_network_option($network_id, $option, true));
}
示例9: get_available_languages
<td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td>
</tr>
<?php
$languages = get_available_languages();
$translations = wp_get_available_translations();
if (!empty($languages) || !empty($translations)) {
?>
<tr class="form-field form-required">
<th scope="row"><label for="site-language"><?php
_e('Site Language');
?>
</label></th>
<td>
<?php
// Network default.
$lang = get_network_option('WPLANG');
// Use English if the default isn't available.
if (!in_array($lang, $languages)) {
$lang = '';
}
wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'site-language', 'selected' => $lang, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => wp_can_install_language_pack()));
?>
</td>
</tr>
<?php
}
// Languages.
?>
<tr class="form-field form-required">
<th scope="row"><label for="admin-email"><?php
_e('Admin Email');
示例10: script_concat_settings
/**
* Determine the concatenation and compression settings for scripts and styles.
*
* @since 2.8.0
*
* @global bool $concatenate_scripts
* @global bool $compress_scripts
* @global bool $compress_css
*/
function script_concat_settings()
{
global $concatenate_scripts, $compress_scripts, $compress_css;
$compressed_output = ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler');
if (!isset($concatenate_scripts)) {
$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
if (!is_admin() || defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
$concatenate_scripts = false;
}
}
if (!isset($compress_scripts)) {
$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
if ($compress_scripts && (!get_network_option('can_compress_scripts') || $compressed_output)) {
$compress_scripts = false;
}
}
if (!isset($compress_css)) {
$compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;
if ($compress_css && (!get_network_option('can_compress_scripts') || $compressed_output)) {
$compress_css = false;
}
}
}
示例11: get_super_admins
/**
* Retrieve a list of super admins.
*
* @since 3.0.0
*
* @global array $super_admins
*
* @return array List of super admin logins
*/
function get_super_admins()
{
global $super_admins;
if (isset($super_admins)) {
return $super_admins;
} else {
return get_network_option('site_admins', array('admin'));
}
}
示例12: network_step2
//.........这里部分代码省略.........
printf(__('These unique authentication keys are also missing from your %s file.'), '<code>wp-config.php</code>');
}
?>
<?php
_e('To make your installation more secure, you should also add:');
?>
</p>
<textarea class="code" readonly="readonly" cols="100" rows="<?php
echo $num_keys_salts;
?>
"><?php
echo esc_textarea($keys_salts_str);
?>
</textarea>
<?php
}
?>
</li>
<?php
if (iis7_supports_permalinks()) {
// IIS doesn't support RewriteBase, all your RewriteBase are belong to us
$iis_subdir_match = ltrim($base, '/') . $subdir_match;
$iis_rewrite_base = ltrim($base, '/') . $rewrite_base;
$iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';
$web_config_file = '<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^index\\.php$" ignoreCase="false" />
<action type="None" />
</rule>';
if (is_multisite() && get_network_option('ms_files_rewriting')) {
$web_config_file .= '
<rule name="WordPress Rule for Files" stopProcessing="true">
<match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
<action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
</rule>';
}
$web_config_file .= '
<rule name="WordPress Rule 2" stopProcessing="true">
<match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
<action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />
</rule>
<rule name="WordPress Rule 3" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="WordPress Rule 4" stopProcessing="true">
<match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" />
<action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" />
</rule>
<rule name="WordPress Rule 5" stopProcessing="true">
<match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\\.php)$" ignoreCase="false" />
<action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" />
</rule>
<rule name="WordPress Rule 6" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
示例13: check_admin_referer
check_admin_referer('edit-plugin_' . $file);
$newcontent = wp_unslash($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
$network_wide = is_plugin_active_for_network($file);
// Deactivate so we can test it.
if (is_plugin_active($file) || isset($_POST['phperror'])) {
if (is_plugin_active($file)) {
deactivate_plugins($file, true);
}
if (!is_network_admin()) {
update_option('recently_activated', array($file => time()) + (array) get_option('recently_activated'));
} else {
update_network_option('recently_activated', array($file => time()) + (array) get_network_option('recently_activated'));
}
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file={$file}&liveupdate=1&scrollto={$scrollto}&networkwide=" . $network_wide));
exit;
}
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&a=te&scrollto={$scrollto}"));
} else {
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&scrollto={$scrollto}"));
}
exit;
default:
if (isset($_GET['liveupdate'])) {
check_admin_referer('edit-plugin-test_' . $file);
$error = validate_plugin($file);
if (is_wp_error($error)) {
wp_die($error);
示例14: delete_blog
/**
* Remove deleted blog from 'inpsyde_multilingual' site option and clean up linked elements table.
*
* @wp-hook delete_blog
*
* @param int $blog_id ID of the deleted blog.
*
* @return void
*/
public function delete_blog($blog_id)
{
global $wpdb;
// Delete relations
$site_relations = $this->plugin_data->get('site_relations');
$site_relations->delete_relation($blog_id);
// Update network option.
$blogs = get_network_option(null, 'inpsyde_multilingual', []);
if (isset($blogs[$blog_id])) {
unset($blogs[$blog_id]);
update_site_option('inpsyde_multilingual', $blogs);
}
$table = $this->container['multilingualpress.content_relations_table']->name();
// Clean up linked elements table
$sql = "\n\t\t\tDELETE\n\t\t\tFROM {$table}\n\t\t\tWHERE ml_source_blogid = %d\n\t\t\t\tOR ml_blogid = %d";
$sql = $wpdb->prepare($sql, $blog_id, $blog_id);
$wpdb->query($sql);
}
示例15: _e
<li><p><?php
_e('Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.');
?>
</p></li>
<li><?php
printf(__('Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.'), $user_email);
?>
</li>
</ul>
</p>
<?php
/** This action is documented in wp-signup.php */
do_action('signup_finished');
}
// Main
$active_signup = get_network_option('registration', 'none');
/**
* Filter the type of site sign-up.
*
* @since 3.0.0
*
* @param string $active_signup String that returns registration type. The value can be
* 'all', 'none', 'blog', or 'user'.
*/
$active_signup = apply_filters('wpmu_active_signup', $active_signup);
// Make the signup type translatable.
$i18n_signup['all'] = _x('all', 'Multisite active signup type');
$i18n_signup['none'] = _x('none', 'Multisite active signup type');
$i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
$i18n_signup['user'] = _x('user', 'Multisite active signup type');
if (is_super_admin()) {