当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_core_get_root_domain函数代码示例

本文整理汇总了PHP中bp_core_get_root_domain函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_get_root_domain函数的具体用法?PHP bp_core_get_root_domain怎么用?PHP bp_core_get_root_domain使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_core_get_root_domain函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_blogs_redirect_to_random_blog

/**
 * Redirect to a random blog in the multisite network
 *
 * @since BuddyPress (1.0)
 * @package BuddyPress
 * @subpackage BlogsActions
 */
function bp_blogs_redirect_to_random_blog()
{
    // Bail if not looking for a random blog
    if (!bp_is_blogs_component() || !isset($_GET['random-blog'])) {
        return;
    }
    // Multisite is active so find a random blog
    if (is_multisite()) {
        $blog = bp_blogs_get_random_blogs(1, 1);
        bp_core_redirect(get_site_url($blog['blogs'][0]->blog_id));
        // No multisite and still called, always redirect to root
    } else {
        bp_core_redirect(bp_core_get_root_domain());
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:22,代码来源:bp-blogs-actions.php

示例2: bp_get_the_topic_last_poster_name

/**
 * Return the linked name of the user who last posted to the current topic in the loop.
 *
 * @return string HTML link to the profile of the user who last posted
 *         to the current topic.
 */
function bp_get_the_topic_last_poster_name()
{
    global $forum_template;
    $domain = bp_core_get_user_domain($forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login);
    // In the case where no user is found, bp_core_get_user_domain() may return the URL
    // of the Members directory
    if (!$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/') {
        return __('Deleted User', 'buddypress');
    }
    return apply_filters('bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>');
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:17,代码来源:bp-forums-template.php

示例3: setup_globals

 /**
  * Set up bp-core global settings.
  *
  * Sets up a majority of the BuddyPress globals that require a minimal
  * amount of processing, meaning they cannot be set in the BuddyPress class.
  *
  * @since BuddyPress (1.5.0)
  *
  * @see BP_Component::setup_globals() for description of parameters.
  *
  * @param array $args See {@link BP_Component::setup_globals()}.
  */
 public function setup_globals($args = array())
 {
     $bp = buddypress();
     /** Database **********************************************************/
     // Get the base database prefix
     if (empty($bp->table_prefix)) {
         $bp->table_prefix = bp_core_get_table_prefix();
     }
     // The domain for the root of the site where the main blog resides
     if (empty($bp->root_domain)) {
         $bp->root_domain = bp_core_get_root_domain();
     }
     // Fetches all of the core BuddyPress settings in one fell swoop
     if (empty($bp->site_options)) {
         $bp->site_options = bp_core_get_root_options();
     }
     // The names of the core WordPress pages used to display BuddyPress content
     if (empty($bp->pages)) {
         $bp->pages = bp_core_get_directory_pages();
     }
     /** Basic current user data *******************************************/
     // Logged in user is the 'current_user'
     $current_user = wp_get_current_user();
     // The user ID of the user who is currently logged in.
     $bp->loggedin_user = new stdClass();
     $bp->loggedin_user->id = isset($current_user->ID) ? $current_user->ID : 0;
     /** Avatars ***********************************************************/
     // Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar
     $bp->grav_default = new stdClass();
     $bp->grav_default->user = apply_filters('bp_user_gravatar_default', $bp->site_options['avatar_default']);
     $bp->grav_default->group = apply_filters('bp_group_gravatar_default', $bp->grav_default->user);
     $bp->grav_default->blog = apply_filters('bp_blog_gravatar_default', $bp->grav_default->user);
     // Notifications table. Included here for legacy purposes. Use
     // bp-notifications instead.
     $bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications';
     /**
      * Used to determine if user has admin rights on current content. If the
      * logged in user is viewing their own profile and wants to delete
      * something, is_item_admin is used. This is a generic variable so it
      * can be used by other components. It can also be modified, so when
      * viewing a group 'is_item_admin' would be 'true' if they are a group
      * admin, and 'false' if they are not.
      */
     bp_update_is_item_admin(bp_user_has_access(), 'core');
     // Is the logged in user is a mod for the current item?
     bp_update_is_item_mod(false, 'core');
     do_action('bp_core_setup_globals');
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:60,代码来源:bp-core-loader.php

示例4: bp_get_the_topic_last_poster_name

	/**
	 * Return the linked name of the user who last posted to the current topic in the loop.
	 *
	 * @return string HTML link to the profile of the user who last posted
	 *         to the current topic.
	 */
	function bp_get_the_topic_last_poster_name() {
		global $forum_template;

		$domain = bp_core_get_user_domain( $forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login ) ;

		// In the case where no user is found, bp_core_get_user_domain() may return the URL
		// of the Members directory
		if ( !$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/' )
			return __( 'Deleted User', 'buddypress' );

		/**
		 * Filters the linked name of the user who last posted to the current topic in the loop.
		 *
		 * @since BuddyPress (1.0.0)
		 *
		 * @param string $value HTML link to the profile of the user who last posted.
		 */
		return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' );
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:25,代码来源:bp-forums-template.php

示例5: bp_get_root_domain

/**
 * Return the "root domain", the URL of the BP root blog.
 *
 * @since 1.1.0
 *
 * @return string URL of the BP root blog.
 */
function bp_get_root_domain()
{
    $bp = buddypress();
    if (!empty($bp->root_domain)) {
        $domain = $bp->root_domain;
    } else {
        $domain = bp_core_get_root_domain();
        $bp->root_domain = $domain;
    }
    /**
     * Filters the "root domain", the URL of the BP root blog.
     *
     * @since 1.2.4
     *
     * @param string $domain URL of the BP root blog.
     */
    return apply_filters('bp_get_root_domain', $domain);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:25,代码来源:bp-core-template.php

示例6: generate_link

 /**
  * generte an <a href ...> tag that point to an url that trigger the flag
  * for the content identified by given parameters
  *
  * @param <array|strings> $args see defaults
  * @return <string> the flag/unflag link
  */
 function generate_link($args = '')
 {
     $defaults = array('type' => '', 'id' => 0, 'id2' => 0, 'author_id' => 0, 'is_author' => false, 'unflagged_text' => null, 'flagged_text' => null, 'can_moderate' => is_super_admin(), 'is_main_content' => false, 'custom_class' => '', 'context' => 'called');
     $params = wp_parse_args($args, $defaults);
     extract($params, EXTR_SKIP);
     //check mandatory params
     if (!$type || !$id) {
         return false;
     }
     $id = (int) $id;
     $id2 = (int) $id2;
     //TODO: anonymous flagging?cookies?
     if (!bp_loggedin_user_id()) {
         return null;
     }
     $is_author = $is_author || $author_id == bp_loggedin_user_id();
     // role relative to the content: 'moderator', 'author' or 'normal'
     if ($can_moderate) {
         $role = 'moderator';
     } elseif ($is_author) {
         $role = 'author';
     } else {
         $role = 'normal';
     }
     switch ($role) {
         case 'author':
             return null;
         case 'moderator':
         case 'normal':
             //has current user already flagged this?
             $flagged = in_array("{$type}-{$id}-{$id2}", $this->already_flagged);
             $action = $flagged ? 'unflag' : 'flag';
             $nonce = $this->create_nonce($action, $type, $id, $id2);
             $get_data = array('bpmod-action' => $action, 'type' => $type, 'id' => $id, 'id2' => $id2, '_wpnonce' => $nonce);
             $url = bp_core_get_root_domain() . '/?' . http_build_query($get_data);
             $text = $flagged ? $flagged_text : $unflagged_text;
             if (null === $text) {
                 $text = $flagged ? $this->options['flagged_text'] : $this->options['unflagged_text'];
             }
             $text = apply_filters('bp_moderation_link_text', $text, $flagged, $type, $id, $id2);
             $title_text = $flagged ? __('Unflag this content', 'bp-moderation') : __('Flag as inappropriate', 'bp-moderation');
             $link = "<a href='{$url}' title='" . $title_text;
             $link .= "' class='bpm-report-link bpm-type-{$type} ";
             $link .= $flagged ? 'bpm-flagged ' : 'bpm-unflagged ';
             $link .= empty($text) ? 'bpm-no-text ' : '';
             $link .= "bpm-context-{$context} {$custom_class}' >";
             $link .= "<span class='bpm-inner-text' >" . ($text ? $text : '&nbsp;') . "</span>";
             $link .= "</a>";
             return apply_filters('bp_moderation_get_link', $link, $type, $is_author, $id, $id2);
         default:
             return null;
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:60,代码来源:bpModFrontend.php

示例7: bp_get_root_domain

function bp_get_root_domain()
{
    global $bp;
    if (isset($bp->root_domain) && !empty($bp->root_domain)) {
        $domain = $bp->root_domain;
    } else {
        $domain = bp_core_get_root_domain();
        $bp->root_domain = $domain;
    }
    return apply_filters('bp_get_root_domain', $domain);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:11,代码来源:bp-core-template.php

示例8: forum_post_edit

 function forum_post_edit($id, $id2)
 {
     if (!($post = bp_forums_get_post($id2))) {
         return false;
     }
     $topic = bp_forums_get_topic_details($post->topic_id);
     $url = bp_core_get_root_domain() . '/' . BP_GROUPS_SLUG . '/' . $topic->object_slug . '/forum/topic/' . $topic->topic_slug . '/edit/post/' . $post->post_id . '/';
     return wp_nonce_url($url, 'bp_forums_edit_post');
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:9,代码来源:bpModDefaultContentTypes.php

示例9: bp_get_root_domain

/**
 * Return the "root domain", the URL of the BP root blog.
 *
 * @return string URL of the BP root blog.
 */
function bp_get_root_domain()
{
    $bp = buddypress();
    if (!empty($bp->root_domain)) {
        $domain = $bp->root_domain;
    } else {
        $domain = bp_core_get_root_domain();
        $bp->root_domain = $domain;
    }
    return apply_filters('bp_get_root_domain', $domain);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:16,代码来源:bp-core-template.php

示例10: bp_core_setup_globals

/**
 * bp_core_setup_globals()
 *
 * Sets up default global BuddyPress configuration settings and stores
 * them in a $bp variable.
 *
 * @package BuddyPress Core Core
 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
 * @global $current_user A WordPress global containing current user information
 * @global $current_component Which is set up in /bp-core/bp-core-catch-uri.php
 * @global $current_action Which is set up in /bp-core/bp-core-catch-uri.php
 * @global $action_variables Which is set up in /bp-core/bp-core-catch-uri.php
 * @uses bp_core_get_user_domain() Returns the domain for a user
 */
function bp_core_setup_globals()
{
    global $bp, $wpdb;
    global $current_user, $current_component, $current_action, $current_blog;
    global $displayed_user_id;
    global $action_variables;
    $current_user = wp_get_current_user();
    /* The domain for the root of the site where the main blog resides */
    $bp->root_domain = bp_core_get_root_domain();
    /* The user ID of the user who is currently logged in. */
    $bp->loggedin_user->id = $current_user->ID;
    /* The domain for the user currently logged in. eg: http://domain.com/members/andy */
    $bp->loggedin_user->domain = bp_core_get_user_domain($current_user->ID);
    /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
    $bp->displayed_user->id = $displayed_user_id;
    /* The domain for the user currently being displayed */
    $bp->displayed_user->domain = bp_core_get_user_domain($displayed_user_id);
    /* The component being used eg: http://domain.com/members/andy/ [profile] */
    $bp->current_component = $current_component;
    // type: string
    /* The current action for the component eg: http://domain.com/members/andy/profile/ [edit] */
    $bp->current_action = $current_action;
    // type: string
    /* The action variables for the current action eg: http://domain.com/members/andy/profile/edit/ [group] / [6] */
    $bp->action_variables = $action_variables;
    // type: array
    /* Only used where a component has a sub item, e.g. groups: http://domain.com/members/andy/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
    $bp->current_item = '';
    // type: string
    /* Used for overriding the 2nd level navigation menu so it can be used to display custom navigation for an item (for example a group) */
    $bp->is_single_item = false;
    /* The default component to use if none are set and someone visits: http://domain.com/members/andy */
    $bp->default_component = 'profile';
    /* Sets up the array container for the component navigation rendered by bp_get_nav() */
    $bp->bp_nav = array();
    /* Sets up the array container for the user navigation rendered by bp_get_user_nav() */
    $bp->bp_users_nav = array();
    /* Sets up the array container for the component options navigation rendered by bp_get_options_nav() */
    $bp->bp_options_nav = array();
    /* Sets up container used for the title of the current component option and rendered by bp_get_options_title() */
    $bp->bp_options_title = '';
    /* Sets up container used for the avatar of the current component being viewed. Rendered by bp_get_options_avatar() */
    $bp->bp_options_avatar = '';
    /* Fetches the default Gravatar image to use if the user has no avatar or gravatar */
    $bp->grav_default = get_site_option('user-avatar-default');
    /* Fetch the full name for the logged in and current user */
    $bp->loggedin_user->fullname = bp_core_global_user_fullname($bp->loggedin_user->id);
    $bp->displayed_user->fullname = bp_core_global_user_fullname($bp->displayed_user->id);
    /* Used to determine if user has admin rights on current content. If the logged in user is viewing
       their own profile and wants to delete a post on their wire, is_item_admin is used. This is a
       generic variable so it can be used in other components. It can also be modified, so when viewing a group
       'is_item_admin' would be 1 if they are a group admin, 0 if they are not. */
    $bp->is_item_admin = bp_is_home();
    /* Used to determine if the logged in user is a moderator for the current content. */
    $bp->is_item_mod = false;
    $bp->core->image_base = BP_PLUGIN_URL . '/bp-core/images';
    $bp->core->table_name_notifications = $wpdb->base_prefix . 'bp_notifications';
    if (!$bp->current_component) {
        $bp->current_component = $bp->default_component;
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:75,代码来源:bp-core.php

示例11: setup_globals

 function setup_globals()
 {
     global $bp;
     /** Database **********************************************************/
     // Get the base database prefix
     if (empty($bp->table_prefix)) {
         $bp->table_prefix = bp_core_get_table_prefix();
     }
     // The domain for the root of the site where the main blog resides
     if (empty($bp->root_domain)) {
         $bp->root_domain = bp_core_get_root_domain();
     }
     // Fetches all of the core BuddyPress settings in one fell swoop
     if (empty($bp->site_options)) {
         $bp->site_options = bp_core_get_root_options();
     }
     // The names of the core NXTClass pages used to display BuddyPress content
     if (empty($bp->pages)) {
         $bp->pages = bp_core_get_directory_pages();
     }
     /** Admin Bar *********************************************************/
     // Set the 'My Account' global to prevent debug notices
     $bp->my_account_menu_id = false;
     /** Component and Action **********************************************/
     // Used for overriding the 2nd level navigation menu so it can be used to
     // display custom navigation for an item (for example a group)
     $bp->is_single_item = false;
     // Sets up the array container for the component navigation rendered
     // by bp_get_nav()
     $bp->bp_nav = array();
     // Sets up the array container for the component options navigation
     // rendered by bp_get_options_nav()
     $bp->bp_options_nav = array();
     // Contains an array of all the active components. The key is the slug,
     // value the internal ID of the component.
     //$bp->active_components = array();
     /** Basic current user data *******************************************/
     // Logged in user is the 'current_user'
     $current_user = nxt_get_current_user();
     // The user ID of the user who is currently logged in.
     $bp->loggedin_user->id = $current_user->ID;
     /** Avatars ***********************************************************/
     // Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar
     $bp->grav_default->user = apply_filters('bp_user_gravatar_default', $bp->site_options['avatar_default']);
     $bp->grav_default->group = apply_filters('bp_group_gravatar_default', $bp->grav_default->user);
     $bp->grav_default->blog = apply_filters('bp_blog_gravatar_default', $bp->grav_default->user);
     // Notifications Table
     $bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications';
     /**
      * Used to determine if user has admin rights on current content. If the
      * logged in user is viewing their own profile and wants to delete
      * something, is_item_admin is used. This is a generic variable so it
      * can be used by other components. It can also be modified, so when
      * viewing a group 'is_item_admin' would be 'true' if they are a group
      * admin, and 'false' if they are not.
      */
     bp_update_is_item_admin(bp_user_has_access(), 'core');
     // Is the logged in user is a mod for the current item?
     bp_update_is_item_mod(false, 'core');
     do_action('bp_core_setup_globals');
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:61,代码来源:bp-core-loader.php

示例12: bp_core_setup_globals

/**
 * bp_core_setup_globals()
 *
 * Sets up default global BuddyPress configuration settings and stores
 * them in a $bp variable.
 *
 * @package BuddyPress Core Core
 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
 * @global $current_user A WordPress global containing current user information
 * @global $current_component Which is set up in /bp-core/bp-core-catch-uri.php
 * @global $current_action Which is set up in /bp-core/bp-core-catch-uri.php
 * @global $action_variables Which is set up in /bp-core/bp-core-catch-uri.php
 * @uses bp_core_get_user_domain() Returns the domain for a user
 */
function bp_core_setup_globals() {
	global $bp;
	global $current_user, $current_component, $current_action, $current_blog;
	global $displayed_user_id;
	global $action_variables;

	$current_user = wp_get_current_user();

	/* Get the base database prefix */
	$bp->table_prefix = bp_core_get_table_prefix();

	/* The domain for the root of the site where the main blog resides */
	$bp->root_domain = bp_core_get_root_domain();

	/* The user ID of the user who is currently logged in. */
	$bp->loggedin_user->id = $current_user->ID;

	/* The domain for the user currently logged in. eg: http://domain.com/members/andy */
	$bp->loggedin_user->domain = bp_core_get_user_domain( $bp->loggedin_user->id );

	/* The core userdata of the user who is currently logged in. */
	$bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id );

	/* is_super_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
	$bp->loggedin_user->is_super_admin = is_super_admin();
	$bp->loggedin_user->is_site_admin  = $bp->loggedin_user->is_super_admin; // deprecated 1.2.6

	/* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
	$bp->displayed_user->id = $displayed_user_id;

	/* The domain for the user currently being displayed */
	$bp->displayed_user->domain = bp_core_get_user_domain( $bp->displayed_user->id );

	/* The core userdata of the user who is currently being displayed */
	$bp->displayed_user->userdata = bp_core_get_core_userdata( $bp->displayed_user->id );

	/* The component being used eg: http://domain.com/members/andy/ [profile] */
	$bp->current_component = $current_component; // type: string

	/* The current action for the component eg: http://domain.com/members/andy/profile/ [edit] */
	$bp->current_action = $current_action; // type: string

	/* The action variables for the current action eg: http://domain.com/members/andy/profile/edit/ [group] / [6] */
	$bp->action_variables = $action_variables; // type: array

	/* Only used where a component has a sub item, e.g. groups: http://domain.com/members/andy/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
	$bp->current_item = ''; // type: string

	/* Used for overriding the 2nd level navigation menu so it can be used to display custom navigation for an item (for example a group) */
	$bp->is_single_item = false;

	/* The default component to use if none are set and someone visits: http://domain.com/members/andy */
	if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
		if ( defined( 'BP_ACTIVITY_SLUG' ) )
			$bp->default_component = BP_ACTIVITY_SLUG;
		else
			$bp->default_component = 'profile';
	} else {
		$bp->default_component = BP_DEFAULT_COMPONENT;
	}

	/* Fetches all of the core database based BuddyPress settings in one foul swoop */
	$bp->site_options = bp_core_get_site_options();

	/* Sets up the array container for the component navigation rendered by bp_get_nav() */
	$bp->bp_nav = array();

	/* Sets up the array container for the component options navigation rendered by bp_get_options_nav() */
	$bp->bp_options_nav = array();

	/* Contains an array of all the active components. The key is the slug, value the internal ID of the component */
	$bp->active_components = array();

	/* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */
	$bp->grav_default->user  = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default'] );
	$bp->grav_default->group = apply_filters( 'bp_group_gravatar_default', 'identicon' );
	$bp->grav_default->blog  = apply_filters( 'bp_blog_gravatar_default', 'identicon' );

	/* Fetch the full name for the logged in and current user */
	$bp->loggedin_user->fullname  = bp_core_get_user_displayname( $bp->loggedin_user->id );
	$bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id );

	/* Used to determine if user has admin rights on current content. If the logged in user is viewing
	   their own profile and wants to delete something, is_item_admin is used. This is a
	   generic variable so it can be used by other components. It can also be modified, so when viewing a group
	   'is_item_admin' would be 1 if they are a group admin, 0 if they are not. */
//.........这里部分代码省略.........
开发者ID:n-sane,项目名称:zaroka,代码行数:101,代码来源:bp-core.php


注:本文中的bp_core_get_root_domain函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。