本文整理汇总了PHP中Jetpack::is_multi_network方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::is_multi_network方法的具体用法?PHP Jetpack::is_multi_network怎么用?PHP Jetpack::is_multi_network使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::is_multi_network方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_sync_callable_whitelist
public function test_sync_callable_whitelist()
{
// $this->setSyncClientDefaults();
$callables = array('wp_max_upload_size' => wp_max_upload_size(), 'is_main_network' => Jetpack::is_multi_network(), 'is_multi_site' => is_multisite(), 'main_network_site' => Jetpack_Sync_Functions::main_network_site_url(), 'single_user_site' => Jetpack::is_single_user_site(), 'updates' => Jetpack::get_updates(), 'home_url' => Jetpack_Sync_Functions::home_url(), 'site_url' => Jetpack_Sync_Functions::site_url(), 'has_file_system_write_access' => Jetpack_Sync_Functions::file_system_write_access(), 'is_version_controlled' => Jetpack_Sync_Functions::is_version_controlled(), 'taxonomies' => Jetpack_Sync_Functions::get_taxonomies(), 'post_types' => Jetpack_Sync_Functions::get_post_types(), 'post_type_features' => Jetpack_Sync_Functions::get_post_type_features(), 'rest_api_allowed_post_types' => Jetpack_Sync_Functions::rest_api_allowed_post_types(), 'rest_api_allowed_public_metadata' => Jetpack_Sync_Functions::rest_api_allowed_public_metadata(), 'sso_is_two_step_required' => Jetpack_SSO_Helpers::is_two_step_required(), 'sso_should_hide_login_form' => Jetpack_SSO_Helpers::should_hide_login_form(), 'sso_match_by_email' => Jetpack_SSO_Helpers::match_by_email(), 'sso_new_user_override' => Jetpack_SSO_Helpers::new_user_override(), 'sso_bypass_default_login_form' => Jetpack_SSO_Helpers::bypass_login_forward_wpcom(), 'wp_version' => Jetpack_Sync_Functions::wp_version(), 'get_plugins' => Jetpack_Sync_Functions::get_plugins(), 'active_modules' => Jetpack::get_active_modules(), 'hosting_provider' => Jetpack_Sync_Functions::get_hosting_provider(), 'locale' => get_locale(), 'site_icon_url' => Jetpack_Sync_Functions::site_icon_url());
if (is_multisite()) {
$callables['network_name'] = Jetpack::network_name();
$callables['network_allow_new_registrations'] = Jetpack::network_allow_new_registrations();
$callables['network_add_new_users'] = Jetpack::network_add_new_users();
$callables['network_site_upload_space'] = Jetpack::network_site_upload_space();
$callables['network_upload_file_types'] = Jetpack::network_upload_file_types();
$callables['network_enable_administration_menus'] = Jetpack::network_enable_administration_menus();
}
$this->sender->do_sync();
foreach ($callables as $name => $value) {
// TODO: figure out why _sometimes_ the 'support' value of
// the post_types value is being removed from the output
if ($name === 'post_types') {
continue;
}
$this->assertCallableIsSynced($name, $value);
}
$whitelist_keys = array_keys($this->callable_module->get_callable_whitelist());
$callables_keys = array_keys($callables);
// Are we testing all the callables in the defaults?
$whitelist_and_callable_keys_difference = array_diff($whitelist_keys, $callables_keys);
$this->assertTrue(empty($whitelist_and_callable_keys_difference), 'Some whitelisted options don\'t have a test: ' . print_r($whitelist_and_callable_keys_difference, 1));
// Are there any duplicate keys?
$unique_whitelist = array_unique($whitelist_keys);
$this->assertEquals(count($unique_whitelist), count($whitelist_keys), 'The duplicate keys are: ' . print_r(array_diff_key($whitelist_keys, array_unique($whitelist_keys)), 1));
}
示例2: update_jetpack_main_network_site_option
/**
* Trigger an update to the main_network_site when we update the siteurl of a site.
* @return null
*/
function update_jetpack_main_network_site_option()
{
// do_action( 'add_option_$option', '$option', '$value-of-the-option' );
/**
* Fires when the site URL is updated.
* Determines if the site is the main site of a Mulitiste network.
*
* @since 3.3.0
*
* @param string jetpack_main_network_site.
* @param string network_site_url() Site URL for the "main" site of the current Multisite network.
*/
do_action('add_option_jetpack_main_network_site', 'jetpack_main_network_site', network_site_url());
/**
* Fires when the site URL is updated.
* Determines if the is part of a multi network.
*
* @since 3.3.0
*
* @param string jetpack_is_main_network.
* @param bool Jetpack::is_multi_network() Is the site part of a multi network.
*/
do_action('add_option_jetpack_is_main_network', 'jetpack_is_main_network', (string) (bool) Jetpack::is_multi_network());
/**
* Fires when the site URL is updated.
* Determines if the site is part of a multisite network.
*
* @since 3.4.0
*
* @param string jetpack_is_multi_site.
* @param bool is_multisite() Is the site part of a mutlisite network.
*/
do_action('add_option_jetpack_is_multi_site', 'jetpack_is_multi_site', (string) (bool) is_multisite());
}
示例3: is_main_network_option
/**
* Return whether we are dealing with a multi network setup or not.
* The reason we are type casting this is because we want to avoid the situation where
* the result is false since when is_main_network_option return false it cases
* the rest the get_option( 'jetpack_is_multi_network' ); to return the value that is set in the
* database which could be set to anything as opposed to what this function returns.
* @param bool $option
*
* @return boolean
*/
public function is_main_network_option($option)
{
// return '1' or ''
return (string) (bool) Jetpack::is_multi_network();
}
示例4: update_jetpack_main_network_site_option
/**
* Trigger an update to the main_network_site when we update the siteurl of a site.
* @return null
*/
function update_jetpack_main_network_site_option()
{
// do_action( 'add_option_$option', '$option', '$value-of-the-option' );
do_action('add_option_jetpack_main_network_site', 'jetpack_main_network_site', network_site_url());
do_action('add_option_jetpack_is_main_network', 'jetpack_is_main_network', (string) (bool) Jetpack::is_multi_network());
do_action('add_option_jetpack_is_multi_site', 'jetpack_is_multi_site', (string) (bool) is_multisite());
}
示例5: update_jetpack_main_network_site_option
/**
* Trigger an update to the main_network_site when we update the siteurl of a site.
* @return null
*/
function update_jetpack_main_network_site_option()
{
do_action('add_option_jetpack_main_network_site', 'main_network_site', network_site_url());
do_action('add_option_jetpack_is_main_network', 'jetpack_is_main_network', (string) (bool) Jetpack::is_multi_network());
}
示例6: generate_stats_array
public static function generate_stats_array($prefix = '')
{
$return = array();
$return["{$prefix}version"] = JETPACK__VERSION;
$return["{$prefix}wp-version"] = get_bloginfo('version');
$return["{$prefix}php-version"] = PHP_VERSION;
$return["{$prefix}branch"] = floatval(JETPACK__VERSION);
$return["{$prefix}wp-branch"] = floatval(get_bloginfo('version'));
$return["{$prefix}php-branch"] = floatval(PHP_VERSION);
$return["{$prefix}public"] = Jetpack_Options::get_option('public');
$return["{$prefix}ssl"] = Jetpack::permit_ssl();
$return["{$prefix}language"] = get_bloginfo('language');
$return["{$prefix}charset"] = get_bloginfo('charset');
$return["{$prefix}is-multisite"] = is_multisite() ? 'multisite' : 'singlesite';
$return["{$prefix}identitycrisis"] = Jetpack::check_identity_crisis(1) ? 'yes' : 'no';
$return["{$prefix}plugins"] = implode(',', Jetpack::get_active_plugins());
// is-multi-network can have three values, `single-site`, `single-network`, and `multi-network`
$return["{$prefix}is-multi-network"] = 'single-site';
if (is_multisite()) {
$return["{$prefix}is-multi-network"] = Jetpack::is_multi_network() ? 'multi-network' : 'single-network';
}
if (!empty($_SERVER['SERVER_ADDR']) || !empty($_SERVER['LOCAL_ADDR'])) {
$ip = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
$ip_arr = array_map('intval', explode('.', $ip));
if (4 == count($ip_arr)) {
$return["{$prefix}ip-2-octets"] = implode('.', array_slice($ip_arr, 0, 2));
$return["{$prefix}ip-3-octets"] = implode('.', array_slice($ip_arr, 0, 3));
}
}
foreach (Jetpack::get_available_modules() as $slug) {
$return["{$prefix}module-{$slug}"] = Jetpack::is_module_active($slug) ? 'on' : 'off';
}
return $return;
}
示例7: is_main_network
protected function is_main_network()
{
return Jetpack::is_multi_network();
}
示例8: generate_stats_array
public static function generate_stats_array($prefix = '')
{
$return = array();
$return["{$prefix}version"] = JETPACK__VERSION;
$return["{$prefix}wp-version"] = get_bloginfo('version');
$return["{$prefix}php-version"] = PHP_VERSION;
$return["{$prefix}branch"] = floatval(JETPACK__VERSION);
$return["{$prefix}wp-branch"] = floatval(get_bloginfo('version'));
$return["{$prefix}php-branch"] = floatval(PHP_VERSION);
$return["{$prefix}public"] = Jetpack_Options::get_option('public');
$return["{$prefix}ssl"] = Jetpack::permit_ssl();
$return["{$prefix}language"] = get_bloginfo('language');
$return["{$prefix}charset"] = get_bloginfo('charset');
$return["{$prefix}is-multisite"] = is_multisite() ? 'multisite' : 'singlesite';
$return["{$prefix}identitycrisis"] = Jetpack::check_identity_crisis(1) ? 'yes' : 'no';
$return["{$prefix}plugins"] = implode(',', Jetpack::get_active_plugins());
switch (Jetpack_Options::get_option('json_api_full_management', null)) {
case null:
$return["{$prefix}full_manage"] = 'unset';
break;
case false:
$return["{$prefix}full_manage"] = 'false';
break;
case true:
$return["{$prefix}full_manage"] = 'true';
break;
default:
$return["{$prefix}full_manage"] = Jetpack_Options::get_option('json_api_full_management', null);
}
if (!Jetpack_Options::get_option('public')) {
// Also flag things as private since we don't provide the user with option to easy opt into if the site is private
$return["{$prefix}full_manage"] = 'private-' . $return["{$prefix}full_manage"];
}
// is-multi-network can have three values, `single-site`, `single-network`, and `multi-network`
$return["{$prefix}is-multi-network"] = 'single-site';
if (is_multisite()) {
$return["{$prefix}is-multi-network"] = Jetpack::is_multi_network() ? 'multi-network' : 'single-network';
}
if (!empty($_SERVER['SERVER_ADDR']) || !empty($_SERVER['LOCAL_ADDR'])) {
$ip = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
$ip_arr = array_map('intval', explode('.', $ip));
if (4 == count($ip_arr)) {
$return["{$prefix}ip-2-octets"] = implode('.', array_slice($ip_arr, 0, 2));
$return["{$prefix}ip-3-octets"] = implode('.', array_slice($ip_arr, 0, 3));
}
}
foreach (Jetpack::get_available_modules() as $slug) {
$return["{$prefix}module-{$slug}"] = Jetpack::is_module_active($slug) ? 'on' : 'off';
}
return $return;
}
示例9: generate_stats_array
public static function generate_stats_array($prefix = '')
{
$return = array();
$return["{$prefix}version"] = JETPACK__VERSION;
$return["{$prefix}wp-version"] = get_bloginfo('version');
$return["{$prefix}php-version"] = PHP_VERSION;
$return["{$prefix}branch"] = floatval(JETPACK__VERSION);
$return["{$prefix}wp-branch"] = floatval(get_bloginfo('version'));
$return["{$prefix}php-branch"] = floatval(PHP_VERSION);
$return["{$prefix}public"] = Jetpack_Options::get_option('public');
$return["{$prefix}ssl"] = Jetpack::permit_ssl();
$return["{$prefix}is-https"] = is_ssl() ? 'https' : 'http';
$return["{$prefix}language"] = get_bloginfo('language');
$return["{$prefix}charset"] = get_bloginfo('charset');
$return["{$prefix}is-multisite"] = is_multisite() ? 'multisite' : 'singlesite';
$return["{$prefix}identitycrisis"] = Jetpack::check_identity_crisis(1) ? 'yes' : 'no';
$return["{$prefix}plugins"] = implode(',', Jetpack::get_active_plugins());
$return["{$prefix}single-user-site"] = Jetpack::is_single_user_site();
$return["{$prefix}manage-enabled"] = Jetpack::is_module_active('manage');
// is-multi-network can have three values, `single-site`, `single-network`, and `multi-network`
$return["{$prefix}is-multi-network"] = 'single-site';
if (is_multisite()) {
$return["{$prefix}is-multi-network"] = Jetpack::is_multi_network() ? 'multi-network' : 'single-network';
}
if (!empty($_SERVER['SERVER_ADDR']) || !empty($_SERVER['LOCAL_ADDR'])) {
$ip = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
$ip_arr = array_map('intval', explode('.', $ip));
if (4 == count($ip_arr)) {
$return["{$prefix}ip-2-octets"] = implode('.', array_slice($ip_arr, 0, 2));
}
}
foreach (Jetpack::get_available_modules() as $slug) {
$return["{$prefix}module-{$slug}"] = Jetpack::is_module_active($slug) ? 'on' : 'off';
}
require_once dirname(__FILE__) . '/sync/class.jetpack-sync-wp-replicastore.php';
$store = new Jetpack_Sync_WP_Replicastore();
$return["{$prefix}sync-checksum"] = json_encode($store->checksum_all());
return $return;
}