本文整理汇总了PHP中get_current_site函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_site函数的具体用法?PHP get_current_site怎么用?PHP get_current_site使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_site函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Check that legacy data exists before doing anything
*
* @return void
*/
public static function load()
{
// Exit early if there is no option holding the DB version
if (false === get_site_option('wp_stream_db')) {
return;
}
global $wpdb;
// If there are no legacy tables found, then attempt to clear all legacy data and exit early
if (null === $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}stream'")) {
self::drop_legacy_data(false);
return;
}
self::$site_id = is_multisite() ? get_current_site()->id : 1;
self::$blog_id = get_current_blog_id();
$since = WP_Stream::$api->get_plan_retention_max_date();
self::$record_count = $wpdb->get_var($wpdb->prepare("\n\t\t\t\tSELECT COUNT(*)\n\t\t\t\tFROM {$wpdb->base_prefix}stream AS s, {$wpdb->base_prefix}stream_context AS sc\n\t\t\t\tWHERE s.site_id = %d\n\t\t\t\t\tAND s.blog_id = %d\n\t\t\t\t\tAND s.type = 'stream'\n\t\t\t\t\tAND s.created > %s\n\t\t\t\t\tAND sc.record_id = s.ID\n\t\t\t\t", self::$site_id, self::$blog_id, $since));
// If there are no legacy records for this site/blog, then attempt to clear all legacy data and exit early
if (0 === self::$record_count) {
self::drop_legacy_data();
return;
}
self::$limit = apply_filters('wp_stream_migrate_chunk_size', 100);
add_action('admin_notices', array(__CLASS__, 'migrate_notice'), 9);
add_action('wp_ajax_wp_stream_migrate_action', array(__CLASS__, 'process_migrate_action'));
}
开发者ID:johnleesw,项目名称:mustardseedwp,代码行数:30,代码来源:class-wp-stream-migrate.php
示例2: primary
/**
* In a multisite, returns the id of the primary site in the network.
* Otherwise, returns the same value as get_current_blog_id()
* @return integer
*/
static function primary()
{
if (is_multisite()) {
return get_current_site()->blog_id;
}
return get_current_blog_id();
}
开发者ID:amekusa,项目名称:WPELib,代码行数:12,代码来源:site.php
示例3: render
function render()
{
$this->open_section_box($this->id, __("Create New Site", "ns-cloner"), false, __("Create Site", "ns-cloner"));
?>
<label for="target_title"><?php
_e("Give the Target site a Title", "ns-cloner");
?>
</label>
<input type="text" name="target_title" placeholder="New Site H1"/>
<label for="target_name"><?php
_e("Give the Target site a URL (or \"Name\" in WP terminology)", "ns-cloner");
?>
</label>
<?php
if (is_subdomain_install()) {
?>
<input type="text" name="target_name" />.<?php
echo preg_replace('|^www\\.|', '', get_current_site()->domain);
?>
<?php
} else {
?>
<?php
echo get_current_site()->domain . get_current_site()->path;
?>
<input type="text" name="target_name" />
<?php
}
?>
<?php
$this->close_section_box();
}
开发者ID:alpual,项目名称:Caitlin-Sabo,代码行数:33,代码来源:ns-cloner-section-create-target.php
示例4: 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;
}
开发者ID:HasClass0,项目名称:mainwp-child-reports,代码行数:26,代码来源:log.php
示例5: setup_constants
protected function setup_constants()
{
$domain = strtoupper($this->args['domain']);
// JUST IN CASE
defined($domain . '_TEXTDOMAIN') or define($domain . '_TEXTDOMAIN', $this->args['domain']);
defined($domain . '_ENABLE_MULTIROOTBLOG') or define($domain . '_ENABLE_MULTIROOTBLOG', FALSE);
if (!defined($domain . '_ROOT_BLOG')) {
// root blog is the main site on this network
if (is_multisite() && !constant($domain . '_ENABLE_MULTIROOTBLOG')) {
$current_site = get_current_site();
// root blogs for multi-network
if (defined($domain . '_SITE_ROOT_BLOG_' . $current_site->id)) {
$root_blog_id = constant($domain . '_SITE_ROOT_BLOG_' . $current_site->id);
} else {
$root_blog_id = $current_site->blog_id;
}
// root blog is every site on this network
} else {
if (is_multisite() && constant($domain . '_ENABLE_MULTIROOTBLOG')) {
$root_blog_id = $this->current_blog;
// root blog is the only blog on this network
} else {
if (!is_multisite()) {
$root_blog_id = 1;
}
}
}
define($domain . '_ROOT_BLOG', $root_blog_id);
}
}
开发者ID:geminorum,项目名称:gmember,代码行数:30,代码来源:networkcore.class.php
示例6: 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.0');
if ($blog = get_site_option('dashboard_blog')) {
return get_blog_details($blog);
}
return get_blog_details(get_current_site()->blog_id);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:18,代码来源:ms-deprecated.php
示例7: override_base_var
function override_base_var()
{
global $base;
if (!is_multisite()) {
return;
}
$base = get_current_site()->path;
}
开发者ID:vunh1989,项目名称:evacorp2,代码行数:8,代码来源:networks-mufunctions.php
示例8: list_
/**
* ## OPTIONS
*
* [<network>]
* : Network ID (defaults to current network, use `--url=...`)
*
* [--format=<format>]
* : Format to display as (table, json, csv, count)
*
* @subcommand list
*/
public function list_($args, $assoc_args)
{
$id = empty($args[0]) ? get_current_site()->id : absint($args[0]);
$mappings = Network_Mapping::get_by_network($id);
if (empty($mappings)) {
return;
}
$this->display($mappings, $assoc_args);
}
开发者ID:fansided,项目名称:Mercator,代码行数:20,代码来源:class-network-mapping-command.php
示例9: comicpress_profile_members_only
function comicpress_profile_members_only()
{
global $profileuser, $errormsg;
$comicpress_is_member = get_user_meta($profileuser->ID, 'comicpress-is-member', true);
if (empty($comicpress_is_member)) {
$comicpress_is_member = 0;
}
$site_name = get_option('blogname');
if (is_multisite()) {
$current_site = get_current_site();
if (!isset($current_site->site_name)) {
$site_name = ucfirst($current_site->domain);
} else {
$site_name = $current_site->site_name;
}
}
?>
<div style="border: solid 1px #aaa; background: #eee; padding: 0 10px 10px;">
<h3><?php
_e('Member of', 'comicpress');
?>
<?php
echo $site_name;
?>
</h3>
<table class="form-table">
<tr>
<th><label for="Memberflag"><?php
_e('Member?', 'comicpress');
?>
</label></th>
<td>
<?php
if (current_user_can('edit_users') || is_super_admin()) {
?>
<input id="comicpress-is-member" name="comicpress-is-member" type="checkbox" value="1" <?php
checked(true, $comicpress_is_member);
?>
/>
<?php
} else {
if ($comicpress_is_member) {
echo 'Is Member';
} else {
echo 'Not a Member';
}
}
?>
</td>
</tr>
</table>
</div>
<br />
<br />
<?php
}
开发者ID:besimhu,项目名称:legacy,代码行数:56,代码来源:membersonly.php
示例10: __construct
/**
* The Constructor function adds the function that pushes published posts to the list, as well as registers the widget.
*/
function __construct()
{
load_plugin_textdomain('hrpn', false, dirname(plugin_basename(__FILE__)) . '/languages');
add_action('publish_post', array($this, 'Add_Post_To_H1_Recent_Posts_From_Network'));
add_action('widgets_init', array($this, 'Register_H1_Recent_Posts_From_Network_Widget'));
$first_post = get_site_option('first_post');
$first_post = str_replace("SITE_URL", esc_url(network_home_url()), $first_post);
$first_post = str_replace("SITE_NAME", get_current_site()->site_name, $first_post);
$this->first_post = $first_post;
}
开发者ID:ZeelandFamily,项目名称:h1-recent-posts-from-network,代码行数:13,代码来源:HerculesRecentPostsfromNetwork.php
示例11: subdomain_body_class
function subdomain_body_class($classes)
{
global $subdomain;
$site = get_current_site()->domain;
$url = get_bloginfo('url');
$sub = preg_replace('@http://@i', '', $url);
$sub = preg_replace('@' . $site . '@i', '', $sub);
$sub = preg_replace('@\\.@i', '', $sub);
$classes[] = 'site-' . $sub;
$subdomain = $sub;
return $classes;
}
开发者ID:foxydot,项目名称:madvia,代码行数:12,代码来源:msd-functions.php
示例12: ra_bp_multinetwork_meta_key_filter
function ra_bp_multinetwork_meta_key_filter($key)
{
global $wpdb;
static $user_meta_keys = array('last_activity' => false, 'bp_new_mention_count' => false, 'bp_favorite_activities' => false, 'bp_latest_update' => false, 'total_friend_count' => false, 'total_group_count' => false, 'notification_groups_group_updated' => false, 'notification_groups_membership_request' => false, 'notification_membership_request_completed' => false, 'notification_groups_admin_promotion' => false, 'notification_groups_invite' => false, 'notification_messages_new_message' => false, 'notification_messages_new_notice' => false, 'closed_notices' => false, 'profile_last_updated' => false, 'notification_activity_new_mention' => false, 'notification_activity_new_reply' => false);
if ($wpdb->siteid < 2 || !isset($user_meta_keys[$key])) {
return $key;
}
if (!$user_meta_keys[$key]) {
$current_site = get_current_site();
$user_meta_keys[$key] = $wpdb->get_blog_prefix($current_site->blog_id) . $key;
}
return $user_meta_keys[$key];
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:13,代码来源:bp-multi-network.php
示例13: comicpress_hosted_on
function comicpress_hosted_on()
{
if (is_multisite()) {
$current_site = get_current_site();
if (!isset($current_site->site_name)) {
$site_name = ucfirst($current_site->domain);
} else {
$site_name = $current_site->site_name;
}
$output = "<span class=\"footer-pipe\">|</span> ";
$output .= __('Hosted on', 'comicpress') . ' <a href="http://' . $current_site->domain . $current_site->path . '">' . $site_name . '</a> ';
return apply_filters('comicpress_hosted_on', $output);
}
}
开发者ID:besimhu,项目名称:legacy,代码行数:14,代码来源:footer-text.php
示例14: resetCronSetup
/**
* Resets `crons_setup` and clears WP-Cron schedules.
*
* @since 151220 Fixing bug with Auto-Cache Engine cron disappearing in some scenarios
*
* @note This MUST happen upon uninstall and deactivation due to buggy WP_Cron behavior. Events with a custom schedule will disappear when plugin is not active (see http://bit.ly/1lGdr78).
*/
public function resetCronSetup()
{
if (is_multisite()) {
// Main site CRON jobs.
switch_to_blog(get_current_site()->blog_id);
wp_clear_scheduled_hook('_cron_' . GLOBAL_NS . '_cleanup');
restore_current_blog();
// Restore current blog.
} else {
// Standard WP installation.
wp_clear_scheduled_hook('_cron_' . GLOBAL_NS . '_cleanup');
}
$this->updateOptions(['crons_setup' => $this->default_options['crons_setup'], 'crons_setup_on_namespace' => $this->default_options['crons_setup_on_namespace'], 'crons_setup_with_cache_cleanup_schedule' => $this->default_options['crons_setup_with_cache_cleanup_schedule'], 'crons_setup_on_wp_with_schedules' => $this->default_options['crons_setup_on_wp_with_schedules']]);
}
开发者ID:arobbins,项目名称:sblog,代码行数:21,代码来源:CronUtils.php
示例15: bu_navigation_sandbox_init
/**
* Add a bu-navigation site if this plugin is being tested by lettuce.
* This sets up for the "User is warned when leaving changes" scenario
*/
function bu_navigation_sandbox_init($response, $coverage, $users)
{
if (in_array('plugin-bu-navigation', $coverage)) {
$network = get_current_site();
$domain = $network->domain;
$admin_id = get_current_user_id();
$options = array('users' => array('site_admin' => array($users['site_admin']), 'contributor' => array($users['contributor'])), 'network_id' => $network->id);
// Public site, no ACL
$path = '/bu-navigation/';
$title = 'BU Navigation';
$site_id = bu_create_site($domain, $path, $title, $admin_id, $options);
bu_navigation_sandbox_setup_site($response, $site_id, 'bu-navigation');
}
}
开发者ID:iamapioneer,项目名称:sdas,代码行数:18,代码来源:sandbox-setup.php
示例16: multisite_deactivate
/**
* Run the deactivation script on every blog for a multisite install
*
* @return void
*/
protected function multisite_deactivate()
{
/** @var wpdb $wpdb */
global $wpdb;
$site = get_current_site();
$blog_ids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE site_id=%d", $site->id));
$large = wp_is_large_network();
foreach ($blog_ids as $blog) {
set_time_limit(30);
switch_to_blog($blog);
$large ? $this->short_blog_deactivate() : $this->blog_deactivate();
restore_current_blog();
}
}
开发者ID:hubbardsc,项目名称:field_day,代码行数:19,代码来源:Abstract_Deactivation.php
示例17: get_document_id_prefix
/**
* Get the ID prefix for AWS documents
*
* @return string
*/
public static function get_document_id_prefix()
{
// generate prefix if we haven't already
if (empty(self::$document_id_prefix)) {
if (is_multisite()) {
$site = get_current_site();
self::$document_id_prefix = $site->id;
} else {
self::$document_id_prefix = 1;
}
self::$document_id_prefix .= '_' . get_current_blog_id() . '_';
self::$document_id_prefix = apply_filters('lift_document_id_prefix', self::$document_id_prefix);
}
return self::$document_id_prefix;
}
开发者ID:humanmade,项目名称:vip-mu-plugins-public,代码行数:20,代码来源:posts-to-sdf.php
示例18: is_ajax
/**
* Test to see if executing an AJAX call specific to the WP Migrate DB family of plugins.
*
* @return bool
*/
public static function is_ajax()
{
// must be doing AJAX the WordPress way
if (!defined('DOING_AJAX') || !DOING_AJAX) {
return false;
}
// must be one of our actions -- e.g. core plugin (wpmdb_*), media files (wpmdbmf_*)
if (!isset($_POST['action']) || 0 !== strpos($_POST['action'], 'wpmdb')) {
return false;
}
// must be on blog #1 (first site) if multisite
if (is_multisite() && 1 != get_current_site()->id) {
return false;
}
return true;
}
开发者ID:arobbins,项目名称:davis,代码行数:21,代码来源:wpmdb-utils.php
示例19: vibe_header_essentials
function vibe_header_essentials()
{
$favicon = vibe_get_option('favicon');
if (!isset($favicon)) {
$favicon = VIBE_URL . '/images/favicon.png';
}
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="' . get_current_site() . '">
<link rel="shortcut icon" href="' . $favicon . '" />
<link rel="icon" type="image/png" href="' . $favicon . '">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="' . VIBE_URL . '/js/html5shiv.js"></script>
<script src="' . VIBE_URL . '/js/respond.min.js"></script>
<![endif]-->';
}
开发者ID:inetbiz,项目名称:wordpress-lms,代码行数:16,代码来源:register.php
示例20: log
/**
* Log handler
*
* @param Connector $connector Connector responsible for logging the event
* @param string $message sprintf-ready error message string
* @param array $args sprintf (and extra) arguments to use
* @param int $object_id Target object id
* @param string $context Context of the event
* @param string $action Action of the event
* @param int $user_id User responsible for the event
*
* @return mixed True if updated, otherwise false|WP_Error
*/
public function log($connector, $message, $args, $object_id, $context, $action, $user_id = null)
{
if (is_null($user_id)) {
$user_id = get_current_user_id();
}
if (is_null($object_id)) {
$object_id = 0;
}
$wp_cron_tracking = isset($this->plugin->settings->options['advanced_wp_cron_tracking']) ? $this->plugin->settings->options['advanced_wp_cron_tracking'] : false;
$author = new Author($user_id);
$agent = $author->get_current_agent();
// WP Cron tracking requires opt-in and WP Cron to be enabled
if (!$wp_cron_tracking && 'wp_cron' === $agent) {
return false;
}
$user = new \WP_User($user_id);
if ($this->is_record_excluded($connector, $context, $action, $user)) {
return false;
}
$user_meta = array('user_email' => (string) (!empty($user->user_email)) ? $user->user_email : '', 'display_name' => (string) $author->get_display_name(), 'user_login' => (string) (!empty($user->user_login)) ? $user->user_login : '', 'user_role_label' => (string) $author->get_role(), 'agent' => (string) $agent);
if ('wp_cli' === $agent && function_exists('posix_getuid')) {
$uid = posix_getuid();
$user_info = posix_getpwuid($uid);
$user_meta['system_user_id'] = (int) $uid;
$user_meta['system_user_name'] = (string) $user_info['name'];
}
// Prevent any meta with null values from being logged
$stream_meta = array_filter($args, function ($var) {
return !is_null($var);
});
// Add user meta to Stream meta
$stream_meta['user_meta'] = $user_meta;
// All meta must be strings, so we will serialize any array meta values
array_walk($stream_meta, function (&$v) {
$v = (string) maybe_serialize($v);
});
// Get the current time in milliseconds
$iso_8601_extended_date = wp_stream_get_iso_8601_extended_date();
$recordarr = array('object_id' => (int) $object_id, 'site_id' => (int) is_multisite() ? get_current_site()->id : 1, 'blog_id' => (int) apply_filters('wp_stream_blog_id_logged', get_current_blog_id()), 'user_id' => (int) $user_id, 'user_role' => (string) (!empty($user->roles)) ? $user->roles[0] : '', 'created' => (string) $iso_8601_extended_date, 'summary' => (string) vsprintf($message, $args), 'connector' => (string) $connector, 'context' => (string) $context, 'action' => (string) $action, 'ip' => (string) wp_stream_filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP), 'meta' => (array) $stream_meta);
if (0 === $recordarr['object_id']) {
unset($recordarr['object_id']);
}
$result = $this->plugin->db->insert($recordarr);
$this->debug_backtrace($recordarr);
return $result;
}
开发者ID:azanebrain,项目名称:representme,代码行数:59,代码来源:class-log.php
注:本文中的get_current_site函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论