本文整理汇总了PHP中is_multisite函数的典型用法代码示例。如果您正苦于以下问题:PHP is_multisite函数的具体用法?PHP is_multisite怎么用?PHP is_multisite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_multisite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wppb_check_email_value
function wppb_check_email_value($message, $field, $request_data, $form_location)
{
global $wpdb;
if (isset($request_data['email']) && trim($request_data['email']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
if (isset($request_data['email']) && !is_email(trim($request_data['email']))) {
return __('The email you entered is not a valid email address.', 'profilebuilder');
}
if (is_multisite() || !is_multisite() && (isset($wppb_generalSettings['emailConfirmation']) && $wppb_generalSettings['emailConfirmation'] == 'yes')) {
$user_signup = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_email = %s", $request_data['email']));
if (!empty($user_signup)) {
return __('This email is already reserved to be used soon.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
}
$users = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email']));
if (!empty($users)) {
if ($form_location == 'register') {
return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
if ($form_location == 'edit_profile') {
$current_user = wp_get_current_user();
foreach ($users as $user) {
if ($user->ID != $current_user->ID) {
return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
}
}
}
return $message;
}
示例2: wpgmp_network_propagate
/**
* This function used to install required tables in the database on time of activation.
* @author Flipper Code <hello@flippercode.com>
* @version 1.0.0
* @package Maps
*/
function wpgmp_network_propagate($network_wide)
{
if (is_multisite() && $network_wide) {
// See if being activated on the entire network or one blog
global $wpdb;
// Get this so we can switch back to it later
$currentblog = $wpdb->blogid;
// For storing the list of activated blogs
$activated = array();
// Get all blogs in the network and activate plugin on each one
$sql = "SELECT blog_id FROM {$wpdb->blogs}";
$blog_ids = $wpdb->get_col($wpdb->prepare($sql, null));
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
wpgmp_activation();
}
// Switch back to the current blog
switch_to_blog($currentblog);
// Store the array for a later function
update_site_option('wpgmp_activated', $activated);
} else {
// Running on a single blog
wpgmp_activation();
}
}
示例3: show_license_form
/**
* Show a form where users can enter their license key
* Takes Multisites into account
*
* @param bool $embedded
* @return null
*/
public function show_license_form($embedded = true)
{
// For non-multisites, always show the license form
if (!is_multisite()) {
parent::show_license_form($embedded);
return;
}
// Plugin is network activated
if ($this->is_network_activated) {
// We're on the network admin
if (is_network_admin()) {
parent::show_license_form($embedded);
} else {
// We're not in the network admin area, show a notice
parent::show_license_form_heading();
if (is_super_admin()) {
echo "<p>" . sprintf(__('%s is network activated, you can manage your license in the <a href="%s">network admin license page</a>.', $this->product->get_text_domain()), $this->product->get_item_name(), $this->product->get_license_page_url()) . "</p>";
} else {
echo "<p>" . sprintf(__('%s is network activated, please contact your site administrator to manage the license.', $this->product->get_text_domain()), $this->product->get_item_name()) . "</p>";
}
}
} else {
if (false == is_network_admin()) {
parent::show_license_form($embedded);
}
}
}
示例4: wppa_delete_from_cloudinary
function wppa_delete_from_cloudinary($id)
{
$prefix = is_multisite() && !WPPA_MULTISITE_GLOBAL ? $blog_id . '-' : '';
$pub_id = $prefix . $id;
$args = array("invalidate" => true);
\Cloudinary\Uploader::destroy($pub_id, $args);
}
示例5: run
function run()
{
$this->settings = get_site_option('itsec_hide_backend');
//Execute module functions on frontend init
if ($this->settings['enabled'] === true) {
$jetpack_active_modules = get_option('jetpack_active_modules');
if (is_multisite() && function_exists('is_plugin_active_for_network')) {
//see if Jetpack is active
$is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php');
} else {
$is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array()));
}
if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) {
$this->auth_cookie_expired = false;
add_action('auth_cookie_expired', array($this, 'auth_cookie_expired'));
add_action('init', array($this, 'execute_hide_backend'), 1000);
add_action('login_init', array($this, 'execute_hide_backend_login'));
add_action('plugins_loaded', array($this, 'plugins_loaded'), 11);
add_filter('body_class', array($this, 'remove_admin_bar'));
add_filter('loginout', array($this, 'filter_loginout'));
add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2);
add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2);
add_filter('site_url', array($this, 'filter_login_url'), 10, 2);
add_filter('retrieve_password_message', array($this, 'retrieve_password_message'));
add_filter('comment_moderation_text', array($this, 'comment_moderation_text'));
remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
}
}
}
示例6: getNotWebCachePath
public static function getNotWebCachePath()
{
if (is_multisite()) {
return self::getBasePath() . '/cache/nextend/notweb' . get_current_blog_id();
}
return self::getBasePath() . '/cache/nextend/notweb';
}
示例7: __construct
/**
* Class constructor
*/
function __construct()
{
$this->options = WPSEO_Options::get_all();
if (is_multisite()) {
WPSEO_Options::maybe_set_multisite_defaults(false);
}
if ($this->options['stripcategorybase'] === true) {
add_action('created_category', array($this, 'schedule_rewrite_flush'));
add_action('edited_category', array($this, 'schedule_rewrite_flush'));
add_action('delete_category', array($this, 'schedule_rewrite_flush'));
}
$this->page_gsc = new WPSEO_GSC();
$this->dashboard_widget = new Yoast_Dashboard_Widget();
// Needs the lower than default priority so other plugins can hook underneath it without issue.
add_action('admin_menu', array($this, 'register_settings_page'), 5);
add_action('network_admin_menu', array($this, 'register_network_settings_page'));
add_filter('plugin_action_links_' . WPSEO_BASENAME, array($this, 'add_action_link'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
if ('0' == get_option('blog_public')) {
add_action('admin_footer', array($this, 'blog_public_warning'));
}
if ((isset($this->options['theme_has_description']) && $this->options['theme_has_description'] === true || $this->options['theme_description_found'] !== '') && $this->options['ignore_meta_description_warning'] !== true) {
add_action('admin_footer', array($this, 'meta_description_warning'));
}
if ($this->options['cleanslugs'] === true) {
add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0);
}
add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1);
add_action('after_switch_theme', array($this, 'switch_theme'));
add_action('switch_theme', array($this, 'switch_theme'));
add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3);
add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1);
add_action('admin_init', array($this, 'import_plugin_hooks'));
WPSEO_Utils::register_cache_clear_option('wpseo', '');
}
示例8: process
public function process()
{
$conds = apply_filters('qm/collect/conditionals', array('is_404', 'is_admin', 'is_archive', 'is_attachment', 'is_author', 'is_blog_admin', 'is_category', 'is_comment_feed', 'is_customize_preview', 'is_date', 'is_day', 'is_embed', 'is_feed', 'is_front_page', 'is_home', 'is_main_network', 'is_main_site', 'is_month', 'is_network_admin', 'is_page', 'is_page_template', 'is_paged', 'is_post_type_archive', 'is_preview', 'is_robots', 'is_rtl', 'is_search', 'is_single', 'is_singular', 'is_ssl', 'is_sticky', 'is_tag', 'is_tax', 'is_time', 'is_trackback', 'is_user_admin', 'is_year'));
$conds = apply_filters('query_monitor_conditionals', $conds);
$true = $false = $na = array();
foreach ($conds as $cond) {
if (function_exists($cond)) {
if ('is_sticky' === $cond and !get_post($id = null)) {
# Special case for is_sticky to prevent PHP notices
$false[] = $cond;
} else {
if (!is_multisite() and in_array($cond, array('is_main_network', 'is_main_site'))) {
# Special case for multisite conditionals to prevent them from being annoying on single site installs
$na[] = $cond;
} else {
if (call_user_func($cond)) {
$true[] = $cond;
} else {
$false[] = $cond;
}
}
}
} else {
$na[] = $cond;
}
}
$this->data['conds'] = compact('true', 'false', 'na');
}
示例9: log
public function log($connector, $message, $args, $object_id, $contexts, $user_id = null)
{
global $wpdb;
if (is_null($user_id)) {
$user_id = get_current_user_id();
}
require_once MAINWP_WP_STREAM_INC_DIR . 'class-wp-stream-author.php';
$user = new WP_User($user_id);
$roles = get_option($wpdb->get_blog_prefix() . 'user_roles');
if (!isset($args['author_meta'])) {
$args['author_meta'] = array('user_email' => $user->user_email, 'display_name' => defined('WP_CLI') && empty($user->display_name) ? 'WP-CLI' : $user->display_name, 'user_login' => $user->user_login, 'user_role_label' => !empty($user->roles) ? $roles[$user->roles[0]]['name'] : null, 'agent' => MainWP_WP_Stream_Author::get_current_agent());
if (defined('WP_CLI') && function_exists('posix_getuid')) {
$uid = posix_getuid();
$user_info = posix_getpwuid($uid);
$args['author_meta']['system_user_id'] = $uid;
$args['author_meta']['system_user_name'] = $user_info['name'];
}
}
// Remove meta with null values from being logged
$meta = array_filter($args, function ($var) {
return !is_null($var);
});
$recordarr = array('object_id' => $object_id, 'site_id' => is_multisite() ? get_current_site()->id : 1, 'blog_id' => apply_filters('blog_id_logged', is_network_admin() ? 0 : get_current_blog_id()), 'author' => $user_id, 'author_role' => !empty($user->roles) ? $user->roles[0] : null, 'created' => current_time('mysql', 1), 'summary' => vsprintf($message, $args), 'parent' => self::$instance->prev_record, 'connector' => $connector, 'contexts' => $contexts, 'meta' => $meta, 'ip' => mainwp_wp_stream_filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP));
$record_id = MainWP_WP_Stream_DB::get_instance()->insert($recordarr);
return $record_id;
}
示例10: convert_the_content_images_to_cloudinary_pull_request
/**
* Filter the raw post content and replace any images that are "local" with cloudinary images
*/
static function convert_the_content_images_to_cloudinary_pull_request($content)
{
if (!in_the_loop()) {
return $content;
}
//setup account name for use with get_cdn_prefix()
$account = static::get_option_value('cloud_name');
//if there is no account set, do not continue
if (empty($account)) {
return $content;
}
//prepare new values for use in string replacements
$cdn_fetch_prefix_no_protocal = static::get_cdn_prefix($account);
$site_url = get_bloginfo('url');
$site_url_no_protocal = preg_replace('/http[s]?:\\/\\//', '', $site_url);
$cdn_content = $content;
//prepare for multisite, switch location of images to actual source
if (is_multisite()) {
global $blog_id;
//fix rewrite urls to go directly to the file within the multisite subfolder
$cdn_content = str_replace($site_url . '/files/', $site_url . '/wp-content/blogs.dir/' . $blog_id . '/files/', $cdn_content);
}
//move any images that match the site source to pull them from the cdn
$cdn_fetch_options = static::get_cdn_options();
$cdn_content = preg_replace_callback("/<img(.*)src=\"(http:|https:)?\\/\\/(" . $site_url_no_protocal . ")(\\/.*\\/)((.*-(\\d{3})x(\\d{3}))|.*)?(\\.[a-zA-Z]{3,4}\")([^>]+>)/im", array(get_called_class(), 'callback_convert_image_source_to_cdn_url'), $cdn_content);
//if preg replace function worked correctly, use the new CDN content
if (!empty($cdn_content)) {
return $cdn_content;
}
//otherwise return the regular content
return $content;
}
开发者ID:WordPress-Phoenix,项目名称:wordpress-cloudinary-config-free-cdn-images,代码行数:35,代码来源:sm-cloudinary-config-free-cdn-images.php
示例11: sc_get_details
/**
* Handles the Shortcode for: `[s2Get /]`.
*
* @package s2Member\s2Get
* @since 3.5
*
* @attaches-to ``add_shortcode("s2Get");``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
* @return mixed Value of the requested data, or null on failure.
*
* @todo Prevent this routine from potentially returning objects/arrays?
*/
public static function sc_get_details($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_get_details", get_defined_vars());
unset($__refs, $__v);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
// Force array; trim quote entities.
$attr = shortcode_atts(array("constant" => "", "user_field" => "", "user_option" => "", "user_id" => ""), $attr);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars());
unset($__refs, $__v);
if ($attr["constant"] && defined($attr["constant"])) {
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() || preg_match("/^S2MEMBER_/i", $attr["constant"])) {
$get = constant($attr["constant"]);
}
} else {
if ($attr["user_field"] && (is_user_logged_in() || $attr["user_id"])) {
$get = c_ws_plugin__s2member_utils_users::get_user_field($attr["user_field"], (int) $attr["user_id"]);
} else {
if ($attr["user_option"] && (is_user_logged_in() || $attr["user_id"])) {
$get = get_user_option($attr["user_option"], (int) $attr["user_id"]);
}
}
}
return apply_filters("ws_plugin__s2member_sc_get_details", isset($get) ? $get : null, get_defined_vars());
}
示例12: initialize
public function initialize()
{
$this->user = new stdClass();
if (is_user_logged_in()) {
/* Populate settings we need for the menu based on the current user. */
$this->user->blogs = get_blogs_of_user(get_current_user_id());
if (is_multisite()) {
$this->user->active_blog = get_active_blog_for_user(get_current_user_id());
$this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id));
$this->user->account_domain = $this->user->domain;
} else {
$this->user->active_blog = $this->user->blogs[get_current_blog_id()];
$this->user->domain = trailingslashit(home_url());
$this->user->account_domain = $this->user->domain;
}
}
add_action('wp_head', 'wp_admin_bar_header');
add_action('admin_head', 'wp_admin_bar_header');
if (current_theme_supports('admin-bar')) {
$admin_bar_args = get_theme_support('admin-bar');
// add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );
$header_callback = $admin_bar_args[0]['callback'];
}
if (empty($header_callback)) {
$header_callback = '_admin_bar_bump_cb';
}
add_action('wp_head', $header_callback);
wp_enqueue_script('admin-bar');
wp_enqueue_style('admin-bar');
do_action('admin_bar_init');
}
示例13: jr_mt_settings_page
/**
* Settings page for plugin
*
* Display and Process Settings page for this plugin.
*
*/
function jr_mt_settings_page()
{
echo '<div class="wrap">';
screen_icon('plugins');
echo '<h2>jonradio Multiple Themes</h2>';
// Required because it is only called automatically for Admin Pages in the Settings section
settings_errors('jr_mt_settings');
$theme = wp_get_theme()->Name;
global $jr_mt_options_cache;
?>
<p>This plugin allows you to selectively change the Theme you have selected as your <b>Current Theme</b> in <b>Appearance-Themes</b> on the Admin panels.
You can choose from any of the <b>Available Themes</b> listed on the Appearance-Themes Admin panel for:
<ul>
<li> » All Pages</li>
<li> » All Posts</li>
<li> » The Site Home</li>
<li> » A Specific Page</li>
<li> » A Specific Post</li>
<li> » Any other non-Admin page that has its own Permalink; for example, a specific Archive or Category page</li>
</ul>
<?php
if (function_exists('is_multisite') && is_multisite()) {
echo "In a WordPress Network (AKA Multisite), Themes must be <b>Network Enabled</b> before they will appear as Available Themes on individual sites' Appearance-Themes panel.";
}
echo '</p>';
echo '<p>';
echo "The Current Theme is <b>{$theme}</b>. You will not normally need to specify it in any of the Settings on this page. The only exception would be if you specify a different Theme for All Pages or All Posts and wish to use the Current Theme for a specific Page, Post or other non-Admin page.";
echo '</p>';
echo '<form action="options.php" method="POST">';
// Plugin Settings are displayed and entered here:
settings_fields('jr_mt_settings');
do_settings_sections('jr_mt_settings_page');
echo '<p><input name="save" type="submit" value="Save Changes" class="button-primary" /></p></form>';
}
示例14: flashCache
/**
* Flash all cache
*
* @return boolean
*
* @access public
*/
public function flashCache()
{
global $wpdb;
//clear visitor's cache first
if (is_multisite()) {
//get all sites first and iterate through each
$query = 'SELECT blog_id FROM ' . $wpdb->blogs;
$blog_list = $wpdb->get_results($query);
if (is_array($blog_list)) {
foreach ($blog_list as $blog) {
$query = 'DELETE FROM ' . $wpdb->get_blog_prefix($blog->blog_id) . 'options ';
$query .= 'WHERE `option_name` = "aam_visitor_cache"';
$wpdb->query($query);
}
}
} else {
$query = 'DELETE FROM ' . $wpdb->options . ' ';
$query .= 'WHERE `option_name` = "aam_visitor_cache"';
$wpdb->query($query);
}
//clear users cache
$query = 'DELETE FROM ' . $wpdb->usermeta . ' ';
$query .= 'WHERE `meta_key` = "aam_cache"';
$wpdb->query($query);
return true;
}
示例15: init
function init()
{
global $cms_nav_ie_ver;
$this->plugin_localization();
// Check if WPML is active. If not display warning message and not load CMS Navigation
if (!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE) {
if (!function_exists('is_multisite') || !is_multisite()) {
add_action('admin_notices', array($this, '_no_wpml_warning'));
}
return false;
} elseif (version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) {
add_action('admin_notices', array($this, '_old_wpml_warning'));
return false;
}
// Load plugin settings
$this->settings = get_option('wpml_cms_nav_settings');
// Use WPML legacy. Read settings from WPML if they exist there.
if (empty($this->settings) && defined('ICL_SITEPRESS_VERSION')) {
require_once WPML_CMS_NAV_PLUGIN_PATH . '/inc/cms-navigation-schema.php';
wpml_cms_nav_default_settings();
}
// Initialize cache
$this->cache['offsite_url_cache'] = new wpml_cms_nav_cache('cms_nav_offsite_url', true);
// Determine User agent to be used in rendering the menu correctly for IE
$cms_nav_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false;
if ($cms_nav_user_agent && preg_match('#MSIE ([0-9]+)\\.[0-9]#', $cms_nav_user_agent, $matches)) {
$cms_nav_ie_ver = $matches[1];
}
// Setup the WP-Admin resources
add_action('admin_init', array($this, 'admin_init'));
// Setup the WP-Admin menus
add_action('admin_menu', array($this, 'menu'));
// Clear cache hook
add_action('wp_ajax_wpml_cms_nav_clear_nav_cache', array($this, 'clear_cache'));
// Save form(options) hook
add_action('wp_ajax_wpml_cms_nav_save_form', array($this, 'save_form'));
// theme hooks
add_action('icl_navigation_breadcrumb', array($this, 'cms_navigation_breadcrumb'));
add_action('icl_navigation_menu', array($this, 'cms_navigation_menu_nav'));
add_action('icl_navigation_sidebar', array($this, 'cms_navigation_page_navigation'));
// more hooks
add_action('save_post', array($this, 'cms_navigation_update_post_settings'), 4, 2);
add_action('admin_head', array($this, 'cms_navigation_page_edit_options'));
add_action('admin_head', array($this, 'cms_navigation_js'));
// offsite urls hooks
add_filter('page_link', array($this, 'rewrite_page_link'), 15, 2);
add_action('parse_query', array($this, 'redirect_offsite_urls'));
// situations to clear the cache
add_filter('permalink_structure_changed', array($this, 'clear_cache'));
add_filter('update_option_show_on_front', array($this, 'clear_cache'));
add_filter('update_option_page_on_front', array($this, 'clear_cache'));
add_filter('update_option_page_for_posts', array($this, 'clear_cache'));
add_action('delete_post', array($this, 'clear_cache'));
add_action('delete_category', array($this, 'clear_cache'));
add_action('create_category', array($this, 'clear_cache'));
add_action('edited_category', array($this, 'clear_cache'));
// add message to WPML dashboard widget
add_action('icl_dashboard_widget_content', array($this, 'icl_dashboard_widget_content'));
return true;
}