• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_core_number_format函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bp_notifications_buddybar_menu

/**
 * Create the Notifications menu for the BuddyBar.
 *
 * @since BuddyPress (1.9.0)
 */
function bp_notifications_buddybar_menu()
{
    if (!is_user_logged_in()) {
        return false;
    }
    echo '<li id="bp-adminbar-notifications-menu"><a href="' . esc_url(bp_loggedin_user_domain()) . '">';
    _e('Notifications', 'buddypress');
    if ($notification_count = bp_notifications_get_unread_notification_count(bp_loggedin_user_id())) {
        ?>
		<span><?php 
        echo bp_core_number_format($notification_count);
        ?>
</span>
	<?php 
    }
    echo '</a>';
    echo '<ul>';
    if ($notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id())) {
        $counter = 0;
        for ($i = 0, $count = count($notifications); $i < $count; ++$i) {
            $alt = 0 == $counter % 2 ? ' class="alt"' : '';
            ?>

			<li<?php 
            echo $alt;
            ?>
><?php 
            echo $notifications[$i];
            ?>
</li>

			<?php 
            $counter++;
        }
    } else {
        ?>

		<li><a href="<?php 
        echo esc_url(bp_loggedin_user_domain());
        ?>
"><?php 
        _e('No new notifications.', 'buddypress');
        ?>
</a></li>

	<?php 
    }
    echo '</ul>';
    echo '</li>';
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:55,代码来源:bp-notifications-buddybar.php


示例2: bcg_posts_pagination_count

function bcg_posts_pagination_count($q)
{
    $posts_per_page = intval(get_query_var('posts_per_page'));
    $paged = intval(get_query_var('paged'));
    $numposts = $q->found_posts;
    $max_page = $q->max_num_pages;
    if (empty($paged) || $paged == 0) {
        $paged = 1;
    }
    $start_num = intval($posts_per_page * ($paged - 1)) + 1;
    $from_num = bp_core_number_format($start_num);
    $to_num = bp_core_number_format($start_num + ($posts_per_page - 1) > $numposts ? $numposts : $start_num + ($posts_per_page - 1));
    $total = bp_core_number_format($numposts);
    //$taxonomy = get_taxonomy( bcg_get_taxonomy() );
    $post_type_object = get_post_type_object(bcg_get_post_type());
    printf(__('Viewing %1s %2$s to %3$s (of %4$s )', 'bcg'), $post_type_object->labels->name, $from_num, $to_num, $total) . "&nbsp;";
    //$term = get_term_name ( $q->query_vars['cat'] );
    //if( bcg_is_category() )
    // printf( __( "In the %s %s ","bcg" ), $taxonomy->label, "<span class='bcg-cat-name'>". $term_name ."</span>" );
    ?>
	<span class="ajax-loader"></span><?php 
}
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:22,代码来源:template-tags.php


示例3: bp_the_topic_pagination_count

function bp_the_topic_pagination_count() {
	global $bp, $topic_template;

	$start_num = intval( ( $topic_template->pag_page - 1 ) * $topic_template->pag_num ) + 1;
	$from_num = bp_core_number_format( $start_num );
	$to_num = bp_core_number_format( ( $start_num + ( $topic_template->pag_num - 1  ) > $topic_template->total_post_count ) ? $topic_template->total_post_count : $start_num + ( $topic_template->pag_num - 1 ) );
	$total = bp_core_number_format( $topic_template->total_post_count );

	echo apply_filters( 'bp_the_topic_pagination_count', sprintf( __( 'Viewing post %1$s to %2$s (%3$s total posts)', 'buddypress' ), $from_num, $to_num, $total ) );
?>
	<span class="ajax-loader"></span>
<?php
}
开发者ID:n-sane,项目名称:zaroka,代码行数:13,代码来源:bp-forums-templatetags.php


示例4: bp_the_topic_pagination_count

/**
 * Return the pagination count for the current topic page.
 *
 * The "count" is a string of the form "Viewing x of y posts".
 *
 * @return string
 */
function bp_the_topic_pagination_count() {
	global $bp, $topic_template;

	$start_num = intval( ( $topic_template->pag_page - 1 ) * $topic_template->pag_num ) + 1;
	$from_num = bp_core_number_format( $start_num );
	$to_num = bp_core_number_format( ( $start_num + ( $topic_template->pag_num - 1  ) > $topic_template->total_post_count ) ? $topic_template->total_post_count : $start_num + ( $topic_template->pag_num - 1 ) );
	$total = bp_core_number_format( $topic_template->total_post_count );

	/**
	 * Filters the pagination count for the current topic page.
	 *
	 * @since BuddyPress (1.0.0)
	 *
	 * @param string $value    Pagination count for the current topic page.
	 * @param string $from_num Low end count in the view.
	 * @param string $to_num   High end count in the view.
	 * @param string $total    Total count of topics found.
	 */
	echo apply_filters( 'bp_the_topic_pagination_count', sprintf( _n( 'Viewing 1 post', 'Viewing %1$s - %2$s of %3$s posts', (int) $topic_template->total_post_count, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:27,代码来源:bp-forums-template.php


示例5: setup_admin_bar

 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of the $wp_admin_nav
  *      parameter array.
  * @uses is_user_logged_in()
  * @uses trailingslashit()
  * @uses bp_get_total_mention_count_for_user()
  * @uses bp_loggedin_user_id()
  * @uses bp_is_active()
  * @uses bp_get_friends_slug()
  * @uses bp_get_groups_slug()
  *
  * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
  *                            description.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Menus for logged in user.
     if (is_user_logged_in()) {
         // Setup the logged in user variables.
         $activity_link = trailingslashit(bp_loggedin_user_domain() . bp_get_activity_slug());
         // Unread message count.
         if (bp_activity_do_mentions()) {
             $count = bp_get_total_mention_count_for_user(bp_loggedin_user_id());
             if (!empty($count)) {
                 $title = sprintf(_x('Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress'), bp_core_number_format($count));
             } else {
                 $title = _x('Mentions', 'Toolbar Mention logged in user', 'buddypress');
             }
         }
         // Add the "Activity" sub menu.
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x('Activity', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link);
         // Personal.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => _x('Personal', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link);
         // Mentions.
         if (bp_activity_do_mentions()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => trailingslashit($activity_link . 'mentions'));
         }
         // Favorite activity items.
         if (bp_activity_can_favorite()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => _x('Favorites', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . 'favorites'));
         }
         // Friends?
         if (bp_is_active('friends')) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => _x('Friends', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_friends_slug()));
         }
         // Groups?
         if (bp_is_active('groups')) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => _x('Groups', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_groups_slug()));
         }
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:56,代码来源:bp-activity-loader.php


示例6: setup_admin_bar

 /**
  * Set up bp-friends integration with the WordPress admin bar.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_admin_bar() for a description of arguments.
  *
  * @param array $wp_admin_nav See BP_Component::setup_admin_bar()
  *                            for description.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Menus for logged in user.
     if (is_user_logged_in()) {
         // Setup the logged in user variables.
         $friends_link = trailingslashit(bp_loggedin_user_domain() . bp_get_friends_slug());
         // Pending friend requests.
         $count = count(friends_get_friendship_request_user_ids(bp_loggedin_user_id()));
         if (!empty($count)) {
             $title = sprintf(_x('Friends <span class="count">%s</span>', 'My Account Friends menu', 'buddypress'), bp_core_number_format($count));
             $pending = sprintf(_x('Pending Requests <span class="count">%s</span>', 'My Account Friends menu sub nav', 'buddypress'), bp_core_number_format($count));
         } else {
             $title = _x('Friends', 'My Account Friends menu', 'buddypress');
             $pending = _x('No Pending Requests', 'My Account Friends menu sub nav', 'buddypress');
         }
         // Add the "My Account" sub menus.
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $friends_link);
         // My Friends.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friendships', 'title' => _x('Friendships', 'My Account Friends menu sub nav', 'buddypress'), 'href' => $friends_link, 'position' => 10);
         // Requests.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-requests', 'title' => $pending, 'href' => trailingslashit($friends_link . 'requests'), 'position' => 20);
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:dcavins,项目名称:buddypress-svn,代码行数:34,代码来源:class-bp-friends-component.php


示例7: bp_get_total_site_member_count

/**
 * Get the total site member count.
 *
 * @return int
 */
function bp_get_total_site_member_count()
{
    /**
     * Filters the total site member count.
     *
     * @since 1.2.0
     *
     * @param int $value Number-formatted total site member count.
     */
    return apply_filters('bp_get_total_site_member_count', bp_core_number_format(bp_core_get_total_member_count()));
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:16,代码来源:bp-members-template.php


示例8: bp_blogs_pagination_count

/**
 * Output the blogs pagination count.
 *
 * @global object $blogs_template {@link BP_Blogs_Template}
 */
function bp_blogs_pagination_count()
{
    global $blogs_template;
    $start_num = intval(($blogs_template->pag_page - 1) * $blogs_template->pag_num) + 1;
    $from_num = bp_core_number_format($start_num);
    $to_num = bp_core_number_format($start_num + ($blogs_template->pag_num - 1) > $blogs_template->total_blog_count ? $blogs_template->total_blog_count : $start_num + ($blogs_template->pag_num - 1));
    $total = bp_core_number_format($blogs_template->total_blog_count);
    if (1 == $blogs_template->total_blog_count) {
        $message = __('Viewing 1 site', 'buddypress');
    } else {
        $message = sprintf(_n('Viewing %1$s - %2$s of %3$s site', 'Viewing %1$s - %2$s of %3$s sites', $blogs_template->total_blog_count, 'buddypress'), $from_num, $to_num, $total);
    }
    echo $message;
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:19,代码来源:bp-blogs-template.php


示例9: bp_messages_pagination_count

function bp_messages_pagination_count()
{
    global $messages_template;
    $start_num = intval(($messages_template->pag_page - 1) * $messages_template->pag_num) + 1;
    $from_num = bp_core_number_format($start_num);
    $to_num = bp_core_number_format($start_num + ($messages_template->pag_num - 1) > $messages_template->total_thread_count ? $messages_template->total_thread_count : $start_num + ($messages_template->pag_num - 1));
    $total = bp_core_number_format($messages_template->total_thread_count);
    echo sprintf(__('Viewing message %1$s to %2$s (of %3$s messages)', 'buddypress'), $from_num, $to_num, $total);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:9,代码来源:bp-messages-template.php


示例10: bp_get_activity_pagination_count

/**
 * Returns the activity pagination count
 *
 * @since 1.2.0
 *
 * @global object $bp BuddyPress global settings
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses bp_core_number_format()
 *
 * @return string The pagination text
 */
function bp_get_activity_pagination_count()
{
    global $bp, $activities_template;
    $start_num = intval(($activities_template->pag_page - 1) * $activities_template->pag_num) + 1;
    $from_num = bp_core_number_format($start_num);
    $to_num = bp_core_number_format($start_num + ($activities_template->pag_num - 1) > $activities_template->total_activity_count ? $activities_template->total_activity_count : $start_num + ($activities_template->pag_num - 1));
    $total = bp_core_number_format($activities_template->total_activity_count);
    return sprintf(__('Viewing item %1$s to %2$s (of %3$s items)', 'buddypress'), $from_num, $to_num, $total);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:20,代码来源:bp-activity-template.php


示例11: widget

    /**
     * Outputs the HTML for this widget.
     *
     * @global DPA_Achievement_Template $achievements_template Achievements template tag object
     * @global object $bp BuddyPress global settings
     * @param array $args An array of standard parameters for widgets
     * @param array $instance An array of settings for this widget instance
     * @since 2.0
     */
    function widget($args, $instance)
    {
        global $achievements_template, $bp;
        extract($args, EXTR_SKIP);
        if (dpa_has_achievements(array('slug' => $instance['achievement_slug'], 'populate_extras' => false, 'type' => 'single'))) {
            echo $before_widget;
            if ($instance['title']) {
                echo $before_title;
                echo esc_html(apply_filters('dpa_widget_title', $instance['title']));
                echo $after_title;
            }
            ?>

			<?php 
            while (dpa_achievements()) {
                dpa_the_achievement();
                ?>

				<div class="item-avatar">
					<a href="<?php 
                dpa_achievement_slug_permalink();
                ?>
"><?php 
                dpa_achievement_picture();
                ?>
</a>
					<div class="item-title"><a href="<?php 
                dpa_achievement_slug_permalink();
                ?>
"><?php 
                dpa_achievement_name();
                ?>
</a></div>
					<div class="item-meta"><span class="activity"><?php 
                printf(__("%s points", 'dpa'), bp_core_number_format(dpa_get_achievement_points()));
                ?>
</span></div>

					<div class="item-desc"><?php 
                dpa_achievement_description_excerpt();
                ?>
</div>
				</div>

			<?php 
            }
            ?>

			<p class="achievements-widget-showall"><a href="<?php 
            dpa_achievement_slug_permalink();
            ?>
"><?php 
            _e('Show More', 'dpa');
            ?>
</a></p>
			<div style="clear: right;"></div>

		<?php 
            echo $after_widget;
        }
        $achievements_template = null;
    }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:71,代码来源:achievements-widgets.php


示例12: messages_format_notifications

/**
 * Format notifications for the Messages component.
 *
 * @since 1.0.0
 *
 * @param string $action            The kind of notification being rendered.
 * @param int    $item_id           The primary item id.
 * @param int    $secondary_item_id The secondary item id.
 * @param int    $total_items       The total number of messaging-related notifications
 *                                  waiting for the user.
 * @param string $format            Return value format. 'string' for BuddyBar-compatible
 *                                  notifications; 'array' for WP Toolbar. Default: 'string'.
 * @return string|array Formatted notifications.
 */
function messages_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
    $total_items = (int) $total_items;
    $text = '';
    $link = trailingslashit(bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox');
    $title = __('Inbox', 'buddypress');
    $amount = 'single';
    if ('new_message' === $action) {
        if ($total_items > 1) {
            $amount = 'multiple';
            $text = sprintf(__('You have %d new messages', 'buddypress'), $total_items);
        } else {
            // Get message thread ID.
            $message = new BP_Messages_Message($item_id);
            $thread_id = $message->thread_id;
            $link = !empty($thread_id) ? bp_get_message_thread_view_link($thread_id) : false;
            if (!empty($secondary_item_id)) {
                $text = sprintf(__('%s sent you a new private message', 'buddypress'), bp_core_get_user_displayname($secondary_item_id));
            } else {
                $text = sprintf(_n('You have %s new private message', 'You have %s new private messages', $total_items, 'buddypress'), bp_core_number_format($total_items));
            }
        }
        if ('string' === $format) {
            if (!empty($link)) {
                $return = '<a href="' . esc_url($link) . '" title="' . esc_attr($title) . '">' . esc_html($text) . '</a>';
            } else {
                $return = esc_html($text);
            }
            /**
             * Filters the new message notification text before the notification is created.
             *
             * This is a dynamic filter. Possible filter names are:
             *   - 'bp_messages_multiple_new_message_notification'.
             *   - 'bp_messages_single_new_message_notification'.
             *
             * @param string $return            Notification text.
             * @param int    $total_items       Number of messages referred to by the notification.
             * @param string $text              The raw notification test (ie, not wrapped in a link).
             * @param int    $item_id           ID of the associated item.
             * @param int    $secondary_item_id ID of the secondary associated item.
             */
            $return = apply_filters('bp_messages_' . $amount . '_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
        } else {
            /** This filter is documented in bp-messages/bp-messages-notifications.php */
            $return = apply_filters('bp_messages_' . $amount . '_new_message_notification', array('text' => $text, 'link' => $link), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
        }
        // Custom notification action for the Messages component
    } else {
        if ('string' === $format) {
            $return = $text;
        } else {
            $return = array('text' => $text, 'link' => $link);
        }
        /**
         * Backcompat for plugins that used to filter bp_messages_single_new_message_notification
         * for their custom actions. These plugins should now use 'bp_messages_' . $action . '_notification'
         */
        if (has_filter('bp_messages_single_new_message_notification')) {
            if ('string' === $format) {
                /** This filter is documented in bp-messages/bp-messages-notifications.php */
                $return = apply_filters('bp_messages_single_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
                // Notice that there are seven parameters instead of six? Ugh...
            } else {
                /** This filter is documented in bp-messages/bp-messages-notifications.php */
                $return = apply_filters('bp_messages_single_new_message_notification', $return, $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
            }
        }
        /**
         * Filters the custom action notification before the notification is created.
         *
         * This is a dynamic filter based on the message notification action.
         *
         * @since 2.6.0
         *
         * @param array  $value             An associative array containing the text and the link of the notification
         * @param int    $item_id           ID of the associated item.
         * @param int    $secondary_item_id ID of the secondary associated item.
         * @param int    $total_items       Number of messages referred to by the notification.
         * @param string $format            Return value format. 'string' for BuddyBar-compatible
         *                                  notifications; 'array' for WP Toolbar. Default: 'string'.
         */
        $return = apply_filters("bp_messages_{$action}_notification", $return, $item_id, $secondary_item_id, $total_items, $format);
    }
    /**
     * Fires right before returning the formatted message notifications.
     *
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:101,代码来源:bp-messages-notifications.php


示例13: bp_blogs_pagination_count

function bp_blogs_pagination_count() {
	global $bp, $blogs_template;

	$start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
	$from_num = bp_core_number_format( $start_num );
	$to_num = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
	$total = bp_core_number_format( $blogs_template->total_blog_count );

	echo sprintf( __( 'Viewing blog %1$s to %2$s (of %3$s blogs)', 'buddypress' ), $from_num, $to_num, $total ); ?> &nbsp;
	<span class="ajax-loader"></span><?php
}
开发者ID:n-sane,项目名称:zaroka,代码行数:11,代码来源:bp-blogs-templatetags.php


示例14: setup_nav

 /**
  * Set up component navigation.
  *
  * @since BuddyPress (1.5.0)
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *        description.
  * @param array $sub_nav Optional. See BP_Component::setup_nav() for
  *        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     if (bp_displayed_user_id() === 0 || bp_displayed_user_id() === get_current_user_id()) {
         return;
     }
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     }
     $mutual_friends_link = trailingslashit($user_domain . BP_MUTUAL_FRIENDS_SLUG);
     // Add 'Friends' to the main navigation
     // Add 'Friends' to the main navigation
     $count = bp_mutual_friend_total_count();
     $class = 0 === $count ? 'no-count' : 'count';
     $main_nav = array('name' => sprintf(__('Mutual Friends <span class="%s">%s</span>', 'buddypress'), esc_attr($class), bp_core_number_format($count)), 'slug' => BP_MUTUAL_FRIENDS_SLUG, 'position' => 65, 'screen_function' => 'bp_mutual_friends_screen', 'default_subnav_slug' => 'my-mutual-friends', 'item_css_id' => 'members');
     // Add the subnav items to the mutual-friends nav item
     $sub_nav[] = array('name' => _x('Mutual Friends', 'Friends screen sub nav', 'buddypress'), 'slug' => 'my-mutual-friends', 'parent_url' => $mutual_friends_link, 'parent_slug' => BP_MUTUAL_FRIENDS_SLUG, 'screen_function' => 'bp_my_mutual_friends_screen', 'position' => 10);
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:sanketio,项目名称:Mutual-Buddies,代码行数:31,代码来源:bp-mutual-friends-loader.php


示例15: setup_nav

 /**
  * Set up component navigation for bp-blogs.
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *                        description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for
  *                        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     /**
      * Blog/post/comment menus should not appear on single WordPress setups.
      * Although comments and posts made by users will still show on their
      * activity stream.
      */
     if (!is_multisite()) {
         return false;
     }
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $slug = bp_get_blogs_slug();
     $parent_url = trailingslashit($user_domain . $slug);
     // Add 'Sites' to the main navigation.
     $count = (int) bp_get_total_blog_count_for_user();
     $class = 0 === $count ? 'no-count' : 'count';
     $nav_text = sprintf(__('Sites <span class="%s">%s</span>', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     $main_nav = array('name' => $nav_text, 'slug' => $slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-sites', 'item_css_id' => $this->id);
     $sub_nav[] = array('name' => __('My Sites', 'buddypress'), 'slug' => 'my-sites', 'parent_url' => $parent_url, 'parent_slug' => $slug, 'screen_function' => 'bp_blogs_screen_my_blogs', 'position' => 10);
     // Setup navigation.
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:39,代码来源:bp-blogs-loader.php


示例16: _e

?>
</span>&nbsp;

		<?php 
if (!dpa_get_achievement_is_active() && dpa_permission_can_user_edit()) {
    ?>
			<span class="highlight"><?php 
    _e('Inactive Achievement', 'dpa');
    ?>
</span>&nbsp;
		<?php 
}
?>

		<span class="activity"><?php 
printf(_n('Only %s person has unlocked this Achievement', '%s people have unlocked this Achievement', bp_core_number_format(dpa_get_achievement_unlocked_count()), 'dpa'), bp_core_number_format(dpa_get_achievement_unlocked_count()));
?>
</span>
	</p>

	<?php 
do_action('dpa_before_achievement_header_meta');
?>

	<div id="item-meta">
		<?php 
dpa_achievement_description_excerpt();
?>

		<div id="item-buttons">
			<?php 
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:achievement-header.php


示例17: messages_screen_conversation

/**
 * Load an individual conversation screen.
 *
 * @since 1.0.0
 *
 * @return bool|null False on failure.
 */
function messages_screen_conversation()
{
    // Bail if not viewing a single message.
    if (!bp_is_messages_component() || !bp_is_current_action('view')) {
        return false;
    }
    $thread_id = (int) bp_action_variable(0);
    if (empty($thread_id) || !messages_is_valid_thread($thread_id) || !messages_check_thread_access($thread_id) && !bp_current_user_can('bp_moderate')) {
        bp_core_redirect(trailingslashit(bp_displayed_user_domain() . bp_get_messages_slug()));
    }
    // Load up BuddyPress one time.
    $bp = buddypress();
    // Decrease the unread count in the nav before it's rendered.
    $count = bp_get_total_unread_messages_count();
    $class = 0 === $count ? 'no-count' : 'count';
    $nav_name = sprintf(__('Messages <span class="%s">%s</span>', 'buddypress'), esc_attr($class), bp_core_number_format($count));
    $bp->bp_nav[$bp->messages->slug]['name'] = $nav_name;
    /**
     * Fires right before the loading of the Messages view screen template file.
     *
     * @since 1.7.0
     */
    do_action('messages_screen_conversation');
    /**
     * Filters the template to load for the Messages view screen.
     *
     * @since 1.0.0
     *
     * @param string $template Path to the messages template to load.
     */
    bp_core_load_template(apply_filters('messages_template_view_message', 'members/single/home'));
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:39,代码来源:bp-messages-screens.php


示例18: setup_admin_bar

 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @see BP_Component::setup_nav() for a description of the $wp_admin_nav
  *      parameter array.
  *
  * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a description.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Menus for logged in user.
     if (is_user_logged_in()) {
         // Setup the logged in user variables.
         $groups_link = trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug());
         // Pending group invites.
         $count = groups_get_invite_count_for_user();
         $title = _x('Groups', 'My Account Groups', 'buddypress');
         $pending = _x('No Pending Invites', 'My Account Groups sub nav', 'buddypress');
         if (!empty($count['total'])) {
             $title = sprintf(_x('Groups <span class="count">%s</span>', 'My Account Groups nav', 'buddypress'), bp_core_number_format($count));
             $pending = sprintf(_x('Pending Invites <span class="count">%s</span>', 'My Account Groups sub nav', 'buddypress'), bp_core_number_format($count));
         }
         // Add the "My Account" sub menus.
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $groups_link);
         // My Groups.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-memberships', 'title' => _x('Memberships', 'My Account Groups sub nav', 'buddypress'), 'href' => $groups_link);
         // Invitations.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-invites', 'title' => $pending, 'href' => trailingslashit($groups_link . 'invites'));
         // Create a Group.
         if (bp_user_can_create_groups()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => _x('Create a Group', 'My Account Groups sub nav', 'buddypress'), 'href' => trailingslashit(bp_get_groups_directory_permalink() . 'create'));
         }
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:35,代码来源:bp-groups-loader.php


示例19: wff_bp_notifications_menu

/**
 * Roll our custom Bootstrap Notifications
 *
 * @since 1.0
 */
function wff_bp_notifications_menu()
{
    if (!is_user_logged_in()) {
        return false;
    }
    echo '<li class="dropdown menu-groups notification-nav" id="bp-adminbar-notifications-menu"><a data-toggle="dropdown" class="dropdown-toggle has-submenu" href="' . esc_url(bp_loggedin_user_domain()) . '"><i class="fa fa-bell"></i>';
    _e('', 'buddypress');
    if ($notification_count = bp_notifications_get_unread_notification_count(bp_loggedin_user_id())) {
        ?>
		<span id="notification-counter"><?php 
        echo bp_core_number_format($notification_count);
        ?>
</span>
		<?php 
    }
    echo '</a>';
    echo '<ul class="dropdown-menu">';
    if ($notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id())) {
        $counter = 0;
        for ($i = 0, $count = count($notifications); $i < $count; ++$i) {
            $alt = 0 == $counter % 2 ? ' class="alt"' : '';
            ?>

			<li<?php 
            echo $alt;
            ?>
><?php 
            echo $notifications[$i];
            ?>
</li>

			<?php 
            $counter++;
        }
    } else {
        ?>

		<li>
			<a href="<?php 
        echo esc_url(bp_loggedin_user_domain());
        ?>
">
				<?php 
        _e('No new notifications.', 'buddypress');
        ?>
			</a>
		</li>

		<?php 
    }
    echo '</ul>';
    echo '</li>';
}
开发者ID:WeFoster,项目名称:wefoster,代码行数:58,代码来源:bp-general.php


示例20: bp_groups_admin_create_pagination_links

/**
 * Create pagination links out of a BP_Group_Member_Query.
 *
 * This function is intended to create pagination links for use under the
 * Manage Members section of the Groups Admin Dashboard pages. It is a stopgap
 * measure until a more general pagination solution is in place for BuddyPress.
 * Plugin authors should not use this function, as it is likely to be
 * deprecated soon.
 *
 * @since 1.8.0
 *
 * @param BP_Group_Member_Query $query       A BP_Group_Member_Query object.
 * @param string                $member_type member|mod|admin|banned.
 *
 * @return string Pagination links HTML.
 */
function bp_groups_admin_create_pagination_links(BP_Group_Member_Query $query, $member_type)
{
    $pagination = '';
    if (!in_array($member_type, array('admin', 'mod', 'member', 'banned'))) {
        return $pagination;
    }
    // The key used to paginate this member type in the $_GET global
    $qs_key = $member_type . '_page';
    $url_base = remove_query_arg(array($qs_key, 'updated', 'success_modified'), $_SERVER['REQUEST_URI']);
    $page = isset($_GET[$qs_key]) ? absint($_GET[$qs_key]) : 1;
    $per_page = 10;
    // @todo Make this customizable?
    // Don't show anything if there's no pagination
    if (1 === $page && $query->total_users <= $per_page) {
        return $pagination;
    }
    $current_page_start = ($page - 1) * $per_page + 1;
    $current_page_end = $page * $per_page > intval($query->total_users) ? $query->total_users : $page * $per_page;
    $pag_links = paginate_links(array('base' => add_query_arg($qs_key, '%#%', $url_base), 'format' => '', 'prev_text' => __('&laquo;', 'buddypress'), 'next_text' => __('&raquo;', 'buddypress'), 'total' => ceil($query->total_users / $per_page), 'current' => $page));
    if (1 == $query->total_users) {
        $viewing_text = __('Viewing 1 member', 'buddypress');
    } else {
        $viewing_text = sprintf(_n('Viewing %1$s - %2$s of %3$s member', 'Viewing %1$s - %2$s of %3$s members', $query->total_users, 'buddypress'), bp_core_number_format($current_page_start), bp_core_number_format($current_page_end), bp_core_number_format($query->total_users));
    }
    $pagination .= '<span class="bp-group-admin-pagination-viewing">' . $viewing_text . '</span>';
    $pagination .= '<span class="bp-group-admin-pagination-links">' . $pag_links . '</span>';
    return $pagination;
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:44,代码来源:bp-groups-admin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_core_parse_args_array函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_core_no_access函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap