Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/23/2015 03:55:00 AM (9 years ago)
Author:
tw2113
Message:

More documentation cleanup for BP-Blogs component.

See #6397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-template.php

    r10248 r10374  
    195195        $this->pag_num  = bp_sanitize_pagination_arg( 'num',          $per_page );
    196196
    197         // Backwards compatibility support for blogs by first letter
     197        // Backwards compatibility support for blogs by first letter.
    198198        if ( ! empty( $_REQUEST['letter'] ) ) {
    199199            $this->blogs = BP_Blogs_Blog::get_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page );
    200200
    201         // Typical blogs query
     201        // Typical blogs query.
    202202        } else {
    203203            $this->blogs = bp_blogs_get_blogs( array(
     
    212212        }
    213213
    214         // Set the total blog count
     214        // Set the total blog count.
    215215        if ( empty( $max ) || ( $max >= (int) $this->blogs['total'] ) ) {
    216216            $this->total_blog_count = (int) $this->blogs['total'];
     
    219219        }
    220220
    221         // Set the blogs array (to loop through later
     221        // Set the blogs array (to loop through later.
    222222        $this->blogs = $this->blogs['blogs'];
    223223
    224         // Get the current blog count to compare maximum against
     224        // Get the current blog count to compare maximum against.
    225225        $blog_count = count( $this->blogs );
    226226
    227         // Set the current blog count
     227        // Set the current blog count.
    228228        if ( empty( $max ) || ( $max >= (int) $blog_count ) ) {
    229229            $this->blog_count = (int) $blog_count;
     
    232232        }
    233233
    234         // Build pagination links based on total blogs and current page number
     234        // Build pagination links based on total blogs and current page number.
    235235        if ( ! empty( $this->total_blog_count ) && ! empty( $this->pag_num ) ) {
    236236            $this->pag_links = paginate_links( array(
     
    302302             */
    303303            do_action( 'blog_loop_end' );
    304             // Do some cleaning up after the loop
     304            // Do some cleaning up after the loop.
    305305            $this->rewind_blogs();
    306306        }
     
    324324        $this->blog        = $this->next_blog();
    325325
    326         // loop has just started
     326        // Loop has just started.
    327327        if ( 0 === $this->current_blog ) {
    328328
     
    396396    }
    397397
    398     // Parse arguments
     398    // Parse arguments.
    399399    $r = bp_parse_args( $args, array(
    400400        'type'              => 'active',
    401         'page_arg'          => 'bpage',                // See https://buddypress.trac.wordpress.org/ticket/3679
     401        'page_arg'          => 'bpage', // See https://buddypress.trac.wordpress.org/ticket/3679.
    402402        'page'              => 1,
    403403        'per_page'          => 20,
    404404        'max'               => false,
    405         'user_id'           => bp_displayed_user_id(), // Pass a user_id to limit to only blogs this user is a member of
     405        'user_id'           => bp_displayed_user_id(), // Pass a user_id to limit to only blogs this user is a member of.
    406406        'include_blog_ids'  => false,
    407407        'search_terms'      => $search_terms_default,
     
    409409    ), 'has_blogs' );
    410410
    411     // Set per_page to maximum if max is enforced
     411    // Set per_page to maximum if max is enforced.
    412412    if ( ! empty( $r['max'] ) && ( (int) $r['per_page'] > (int) $r['max'] ) ) {
    413413        $r['per_page'] = (int) $r['max'];
    414414    }
    415415
    416     // Get the blogs
     416    // Get the blogs.
    417417    $blogs_template = new BP_Blogs_Template( $r['type'], $r['page'], $r['per_page'], $r['max'], $r['user_id'], $r['search_terms'], $r['page_arg'], $r['update_meta_cache'], $r['include_blog_ids'] );
    418418
     
    550550        $author_displayname = bp_core_get_user_displayname( $blogs_template->blog->admin_user_id );
    551551
    552         // Parse the arguments
     552        // Parse the arguments.
    553553        $r = bp_parse_args( $args, array(
    554554            'type'    => 'full',
     
    562562        ) );
    563563
    564         // Fetch the avatar
     564        // Fetch the avatar.
    565565        $avatar = bp_core_fetch_avatar( array(
    566566            'item_id'    => $blogs_template->blog->admin_user_id,
    567567            'title'      => $r['title'],
    568             //'avatar_dir' => 'blog-avatars',
    569             //'object'     => 'blog',
     568            // 'avatar_dir' => 'blog-avatars',
     569            // 'object'     => 'blog',
    570570            'type'       => $r['type'],
    571571            'alt'        => $r['alt'],
     
    576576        ) );
    577577
    578         /***
     578        /**
    579579         * In future BuddyPress versions you will be able to set the avatar for a blog.
    580580         * Right now you can use a filter with the ID of the blog to change it if you wish.
     
    714714 * @since 1.7.0
    715715 *
    716  * @param array $classes Array of custom classes
     716 * @param array $classes Array of custom classes.
    717717 */
    718718function bp_blog_class( $classes = array() ) {
     
    725725     *
    726726     * @global BP_Blogs_Template $blogs_template
    727      * @param array $classes Array of custom classes
    728      *
     727     *
     728     * @param array $classes Array of custom classes.
    729729     * @return string Row class of the site.
    730730     */
     
    732732        global $blogs_template;
    733733
    734         // Add even/odd classes, but only if there's more than 1 group
     734        // Add even/odd classes, but only if there's more than 1 group.
    735735        if ( $blogs_template->blog_count > 1 ) {
    736736            $pos_in_loop = (int) $blogs_template->current_blog;
    737737            $classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
    738738
    739         // If we've only one site in the loop, don't bother with odd and even
     739        // If we've only one site in the loop, don't bother with odd and even.
    740740        } else {
    741741            $classes[] = 'bp-single-blog';
     
    778778        global $blogs_template;
    779779
    780         // Parse the activity format
     780        // Parse the activity format.
    781781        $r = bp_parse_args( $args, array(
    782782            'active_format' => true
    783783        ) );
    784784
    785         // Backwards compatibility for anyone forcing a 'true' active_format
     785        // Backwards compatibility for anyone forcing a 'true' active_format.
    786786        if ( true === $r['active_format'] ) {
    787787            $r['active_format'] = __( 'active %s', 'buddypress' );
    788788        }
    789789
    790         // Blog has been posted to at least once
     790        // Blog has been posted to at least once.
    791791        if ( isset( $blogs_template->blog->last_activity ) ) {
    792792
    793             // Backwards compatibility for pre 1.5 'ago' strings
     793            // Backwards compatibility for pre 1.5 'ago' strings.
    794794            $last_activity = ! empty( $r['active_format'] )
    795795                ? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] )
    796796                : bp_core_time_since( $blogs_template->blog->last_activity );
    797797
    798         // Blog has never been posted to
     798        // Blog has never been posted to.
    799799        } else {
    800800            $last_activity = __( 'Never active', 'buddypress' );
     
    10001000     * @param string $size Image version to return. 'thumbnail', 'medium',
    10011001     *                     'large', or 'post-thumbnail'. Default: 'thumbnail'.
    1002      *
    10031002     * @return string URL of the image.
    10041003     */
     
    10281027 * @param string $thumbnail Image version to return. 'thumbnail', 'medium', 'large',
    10291028 *                          or 'post-thumbnail'. Default: 'thumbnail'.
    1030  *
    10311029 * @return bool True if the latest blog post from the current blog has a
    10321030 *              featured image of the given size.
     
    11011099     *
    11021100     * @param int $user_id ID of the user.
    1103      *
    11041101     * @return int Total number of blogs for the user.
    11051102     */
     
    11381135     * Filters whether or not blog creation is enabled.
    11391136     *
     1137     * Return "all", "none", "blog" or "user".
     1138     *
    11401139     * @since 1.0.0
    11411140     *
    11421141     * @param string $active_signup Value of the registration site option creation status.
    11431142     */
    1144     $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
     1143    $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
    11451144
    11461145    if ( 'none' == $active_signup || 'user' == $active_signup )
     
    12261225    global $current_site;
    12271226
    1228     // Blog name
     1227    // Blog name.
    12291228    if( !is_subdomain_install() )
    12301229        echo '<label for="blogname">' . __('Site Name:', 'buddypress') . '</label>';
     
    12551254    }
    12561255
    1257     // Blog Title
     1256    // Blog Title.
    12581257    ?>
    12591258
     
    13231322    $public = (int) $_POST['blog_public'];
    13241323
    1325     $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // depreciated
     1324    // Depreciated.
     1325    $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) );
    13261326
    13271327    /**
     
    13981398function bp_create_blog_link() {
    13991399
    1400     // Don't show this link when not on your own profile
     1400    // Don't show this link when not on your own profile.
    14011401    if ( ! bp_is_my_profile() ) {
    14021402        return;
     
    14201420function bp_blogs_blog_tabs() {
    14211421
    1422     // Don't show these tabs on a user's own profile
     1422    // Don't show these tabs on a user's own profile.
    14231423    if ( bp_is_my_profile() ) {
    14241424        return false;
     
    15311531     */
    15321532    function bp_get_blog_create_nav_item() {
    1533         // Get the create a site button
     1533        // Get the create a site button.
    15341534        $create_blog_button = bp_get_blog_create_button();
    15351535
    1536         // Make sure the button is available
     1536        // Make sure the button is available.
    15371537        if ( empty( $create_blog_button ) ) {
    15381538            return;
     
    15551555 */
    15561556function bp_blog_backcompat_create_nav_item() {
    1557     // Bail if Blogs nav item is already used by bp-legacy
     1557    // Bail if Blogs nav item is already used by bp-legacy.
    15581558    if ( has_action( 'bp_blogs_directory_blog_types', 'bp_legacy_theme_blog_create_nav', 999 ) ) {
    15591559        return;
    15601560    }
    15611561
    1562     // Bail if the theme is not filtering the Blogs directory title
     1562    // Bail if the theme is not filtering the Blogs directory title.
    15631563    if ( ! has_filter( 'bp_blogs_directory_header' ) ) {
    15641564        return;
     
    16341634 * @uses bp_blogs_admin_get_profile_stats() to get the stats.
    16351635 *
    1636  * @param array|string $args before|after|user_id
     1636 * @param array|string $args Before|after|user_id.
    16371637 */
    16381638function bp_blogs_profile_stats( $args = '' ) {
     
    16461646 * @since 2.0.0
    16471647 *
    1648  * @param array|string $args before|after|user_id
    1649  *
     1648 * @param array|string $args Before|after|user_id.
    16501649 * @return string HTML for stats output.
    16511650 */
    16521651function bp_blogs_get_profile_stats( $args = '' ) {
    16531652
    1654     // Parse the args
     1653    // Parse the args.
    16551654    $r = bp_parse_args( $args, array(
    16561655        'before'  => '<li class="bp-blogs-profile-stats">',
     
    16611660    ), 'blogs_get_profile_stats' );
    16621661
    1663     // Allow completely overloaded output
     1662    // Allow completely overloaded output.
    16641663    if ( is_multisite() && empty( $r['output'] ) ) {
    16651664
    1666         // Only proceed if a user ID was passed
     1665        // Only proceed if a user ID was passed.
    16671666        if ( ! empty( $r['user_id'] ) ) {
    16681667
    1669             // Get the user's blogs
     1668            // Get the user's blogs.
    16701669            if ( empty( $r['blogs'] ) ) {
    16711670                $r['blogs'] = absint( bp_blogs_total_blogs_for_user( $r['user_id'] ) );
    16721671            }
    16731672
    1674             // If blogs exist, show some formatted output
     1673            // If blogs exist, show some formatted output.
    16751674            $r['output'] = $r['before'] . sprintf( _n( '%s site', '%s sites', $r['blogs'], 'buddypress' ), '<strong>' . $r['blogs'] . '</strong>' ) . $r['after'];
    16761675        }
Note: See TracChangeset for help on using the changeset viewer.