Skip to:
Content

BuddyPress.org

Ticket #9288: 9288.patch

File 9288.patch, 39.0 KB (added by opurockey, 8 months ago)
  • bp-blogs-template.php

     
    1414 * Output the blogs component slug.
    1515 *
    1616 * @since 1.5.0
    17  *
    1817 */
    1918function bp_blogs_slug() {
    2019        echo esc_attr( bp_get_blogs_slug() );
     
    2625         *
    2726         * @return string The 'blogs' slug.
    2827         */
    29         function bp_get_blogs_slug() {
     28function bp_get_blogs_slug() {
    3029
    31                 /**
    32                 * Filters the blogs component slug.
    33                 *
    34                 * @since 1.5.0
    35                 *
    36                 * @param string $slug Slug for the blogs component.
    37                 */
    38                 return apply_filters( 'bp_get_blogs_slug', buddypress()->blogs->slug );
    39         }
     30        /**
     31        * Filters the blogs component slug.
     32        *
     33        * @since 1.5.0
     34        *
     35        * @param string $slug Slug for the blogs component.
     36        */
     37        return apply_filters( 'bp_get_blogs_slug', buddypress()->blogs->slug );
     38}
    4039
    4140/**
    4241 * Output the blogs component root slug.
    4342 *
    4443 * @since 1.5.0
    45  *
    4644 */
    4745function bp_blogs_root_slug() {
    4846        echo esc_attr( bp_get_blogs_root_slug() );
     
    5452         *
    5553         * @return string The 'blogs' root slug.
    5654         */
    57         function bp_get_blogs_root_slug() {
     55function bp_get_blogs_root_slug() {
    5856
    59                 /**
    60                 * Filters the blogs component root slug.
    61                 *
    62                 * @since 1.5.0
    63                 *
    64                 * @param string $root_slug Root slug for the blogs component.
    65                 */
    66                 return apply_filters( 'bp_get_blogs_root_slug', buddypress()->blogs->root_slug );
    67         }
     57        /**
     58        * Filters the blogs component root slug.
     59        *
     60        * @since 1.5.0
     61        *
     62        * @param string $root_slug Root slug for the blogs component.
     63        */
     64        return apply_filters( 'bp_get_blogs_root_slug', buddypress()->blogs->root_slug );
     65}
    6866
    6967/**
    7068 * Output Blogs directory's URL.
     
    9391        $path_chunks = bp_parse_args(
    9492                array_intersect_key( $path_chunks, $supported_chunks ),
    9593                array(
    96                         'component_id' => 'blogs'
     94                        'component_id' => 'blogs',
    9795                )
    9896        );
    9997
     
    173171
    174172        // Check for and use search terms.
    175173        $search_terms_default = false;
    176         $search_query_arg = bp_core_get_component_search_query_arg( 'blogs' );
     174        $search_query_arg     = bp_core_get_component_search_query_arg( 'blogs' );
    177175        if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
    178176                $search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] );
    179177        } elseif ( ! empty( $_REQUEST['s'] ) ) {
     
    305303         *
    306304         * @return string HTML pagination links.
    307305         */
    308         function bp_get_blogs_pagination_links() {
    309                 global $blogs_template;
     306function bp_get_blogs_pagination_links() {
     307        global $blogs_template;
    310308
    311                 /**
    312                 * Filters the blogs pagination links.
    313                 *
    314                 * @since 1.0.0
    315                 *
    316                 * @param string $pag_links HTML pagination links.
    317                 */
    318                 return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
    319         }
     309        /**
     310        * Filters the blogs pagination links.
     311        *
     312        * @since 1.0.0
     313        *
     314        * @param string $pag_links HTML pagination links.
     315        */
     316        return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
     317}
    320318
    321319/**
    322320 * Output a blog's avatar.
     
    361359         * }
    362360         * @return string|bool User avatar string. False if avatars are turned off.
    363361         */
    364         function bp_get_blog_avatar( $args = '' ) {
    365                 global $blogs_template;
     362function bp_get_blog_avatar( $args = '' ) {
     363        global $blogs_template;
    366364
    367                 // Bail if avatars are turned off
    368                 // @todo Should we maybe still filter this?
    369                 if ( ! buddypress()->avatar->show_avatars ) {
    370                         return false;
    371                 }
     365        // Bail if avatars are turned off
     366        // @todo Should we maybe still filter this?
     367        if ( ! buddypress()->avatar->show_avatars ) {
     368                return false;
     369        }
    372370
    373                 // Set default value for the `alt` attribute.
    374                 $alt_attribute = __( 'Site icon for the blog', 'buddypress' );
     371        // Set default value for the `alt` attribute.
     372        $alt_attribute = __( 'Site icon for the blog', 'buddypress' );
    375373
    376                 if ( ! empty( $args['blog_id'] ) ) {
    377                         $blog_id = (int) $args['blog_id'];
    378                 } else if ( isset( $blogs_template->blog->blog_id ) ) {
    379                         $blog_id = bp_get_blog_id();
     374        if ( ! empty( $args['blog_id'] ) ) {
     375                $blog_id = (int) $args['blog_id'];
     376        } elseif ( isset( $blogs_template->blog->blog_id ) ) {
     377                $blog_id = bp_get_blog_id();
    380378
    381                         /* translators: %s is the blog name */
    382                         $alt_attribute = sprintf( __( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() );
    383                 } else {
    384                         $blog_id = 0;
    385                 }
     379                /* translators: %s is the blog name */
     380                $alt_attribute = sprintf( __( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() );
     381        } else {
     382                $blog_id = 0;
     383        }
    386384
    387                 // Parse the arguments.
    388                 $r = bp_parse_args(
    389                         $args,
    390                         array(
    391                                 'item_id'    => $blog_id,
    392                                 'avatar_dir' => 'blog-avatars',
    393                                 'object'     => 'blog',
    394                                 'type'       => 'full',
    395                                 'width'      => false,
    396                                 'height'     => false,
    397                                 'class'      => 'avatar',
    398                                 'id'         => false,
    399                                 'alt'        => $alt_attribute,
    400                                 'no_grav'    => false,
    401                                 'html'       => true,
    402                         ),
    403                         'blog_avatar'
    404                 );
     385        // Parse the arguments.
     386        $r = bp_parse_args(
     387                $args,
     388                array(
     389                        'item_id'    => $blog_id,
     390                        'avatar_dir' => 'blog-avatars',
     391                        'object'     => 'blog',
     392                        'type'       => 'full',
     393                        'width'      => false,
     394                        'height'     => false,
     395                        'class'      => 'avatar',
     396                        'id'         => false,
     397                        'alt'        => $alt_attribute,
     398                        'no_grav'    => false,
     399                        'html'       => true,
     400                ),
     401                'blog_avatar'
     402        );
    405403
    406                 /**
    407                 * If the `admin_user_id` was provided, make the Blog avatar
    408                 * defaults to the Blog's Admin user one.
    409                 */
    410                 if ( isset( $r['admin_user_id'] ) && $r['admin_user_id'] ) {
    411                         $r['item_id']    = (int) $r['admin_user_id'];
    412                         $r['avatar_dir'] = 'avatars';
    413                         $r['object']     = 'user';
    414                 } elseif ( ! $r['no_grav'] ) {
    415                         $r['no_grav'] = true;
    416                 }
     404        /**
     405        * If the `admin_user_id` was provided, make the Blog avatar
     406        * defaults to the Blog's Admin user one.
     407        */
     408        if ( isset( $r['admin_user_id'] ) && $r['admin_user_id'] ) {
     409                $r['item_id']    = (int) $r['admin_user_id'];
     410                $r['avatar_dir'] = 'avatars';
     411                $r['object']     = 'user';
     412        } elseif ( ! $r['no_grav'] ) {
     413                $r['no_grav'] = true;
     414        }
    417415
    418                 // Use site icon if available.
    419                 $avatar = '';
    420                 if ( bp_is_active( 'blogs', 'site-icon' ) ) {
    421                         $site_icon = bp_blogs_get_blogmeta( $blog_id, "site_icon_url_{$r['type']}" );
     416        // Use site icon if available.
     417        $avatar = '';
     418        if ( bp_is_active( 'blogs', 'site-icon' ) ) {
     419                $site_icon = bp_blogs_get_blogmeta( $blog_id, "site_icon_url_{$r['type']}" );
    422420
    423                         // Never attempted to fetch site icon before; do it now!
    424                         if ( '' === $site_icon ) {
    425                                 // Fetch the other size first.
    426                                 if ( 'full' === $r['type'] ) {
    427                                         $size      = bp_core_avatar_thumb_width();
    428                                         $save_size = 'thumb';
    429                                 } else {
    430                                         $size      = bp_core_avatar_full_width();
    431                                         $save_size = 'full';
    432                                 }
     421                // Never attempted to fetch site icon before; do it now!
     422                if ( '' === $site_icon ) {
     423                        // Fetch the other size first.
     424                        if ( 'full' === $r['type'] ) {
     425                                $size      = bp_core_avatar_thumb_width();
     426                                $save_size = 'thumb';
     427                        } else {
     428                                $size      = bp_core_avatar_full_width();
     429                                $save_size = 'full';
     430                        }
    433431
    434                                 $site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
     432                        $site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
    435433
    436                                 // Empty site icons get saved as integer 0.
    437                                 if ( empty( $site_icon ) ) {
    438                                         $site_icon = 0;
    439                                 }
     434                        // Empty site icons get saved as integer 0.
     435                        if ( empty( $site_icon ) ) {
     436                                $site_icon = 0;
     437                        }
    440438
    441                                 // Sync site icon for other size to blogmeta.
    442                                 bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$save_size}", $site_icon );
     439                        // Sync site icon for other size to blogmeta.
     440                        bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$save_size}", $site_icon );
    443441
    444                                 // Now, fetch the size we want.
    445                                 if ( 0 !== $site_icon ) {
    446                                         $size      = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
    447                                         $site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
    448                                 }
    449 
    450                                 // Sync site icon to blogmeta.
    451                                 bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$r['type']}", $site_icon );
     442                        // Now, fetch the size we want.
     443                        if ( 0 !== $site_icon ) {
     444                                $size      = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
     445                                $site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
    452446                        }
    453447
    454                         // We have a site icon.
    455                         if ( ! is_numeric( $site_icon ) ) {
    456                                 // Just return the raw url of the Site Icon.
    457                                 if ( ! $r['html'] ) {
    458                                         return esc_url_raw( $site_icon );
    459                                 }
     448                        // Sync site icon to blogmeta.
     449                        bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$r['type']}", $site_icon );
     450                }
    460451
    461                                 if ( empty( $r['width'] ) && ! isset( $size ) ) {
    462                                         $size = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
    463                                 } else {
    464                                         $size = (int) $r['width'];
    465                                 }
     452                // We have a site icon.
     453                if ( ! is_numeric( $site_icon ) ) {
     454                        // Just return the raw url of the Site Icon.
     455                        if ( ! $r['html'] ) {
     456                                return esc_url_raw( $site_icon );
     457                        }
    466458
    467                                 $avatar = sprintf( '<img src="%1$s" class="%2$s" width="%3$s" height="%3$s" alt="%4$s" />',
    468                                         esc_url( $site_icon ),
    469                                         esc_attr( "{$r['class']} avatar-{$size}" ),
    470                                         esc_attr( $size ),
    471                                         esc_attr( $alt_attribute )
    472                                 );
     459                        if ( empty( $r['width'] ) && ! isset( $size ) ) {
     460                                $size = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
     461                        } else {
     462                                $size = (int) $r['width'];
    473463                        }
    474                 }
    475464
    476                 // Fallback to Default blog avatar.
    477                 if ( '' === $avatar ) {
    478                         $avatar = bp_core_fetch_avatar( $r );
     465                        $avatar = sprintf(
     466                                '<img src="%1$s" class="%2$s" width="%3$s" height="%3$s" alt="%4$s" />',
     467                                esc_url( $site_icon ),
     468                                esc_attr( "{$r['class']} avatar-{$size}" ),
     469                                esc_attr( $size ),
     470                                esc_attr( $alt_attribute )
     471                        );
    479472                }
     473        }
    480474
    481                 /**
    482                  * Filters a blog's avatar.
    483                  *
    484                  * @since 1.5.0
    485                  *
    486                  * @param string $avatar  Formatted HTML <img> element, or raw avatar
    487                  *                        URL based on $html arg.
    488                  * @param int    $blog_id ID of the blog whose avatar is being displayed.
    489                  * @param array  $r       Array of arguments used when fetching avatar.
    490                  */
    491                 return apply_filters( 'bp_get_blog_avatar', $avatar, $blog_id, $r );
     475        // Fallback to Default blog avatar.
     476        if ( '' === $avatar ) {
     477                $avatar = bp_core_fetch_avatar( $r );
    492478        }
    493479
     480        /**
     481         * Filters a blog's avatar.
     482         *
     483         * @since 1.5.0
     484         *
     485         * @param string $avatar  Formatted HTML <img> element, or raw avatar
     486         *                        URL based on $html arg.
     487         * @param int    $blog_id ID of the blog whose avatar is being displayed.
     488         * @param array  $r       Array of arguments used when fetching avatar.
     489         */
     490        return apply_filters( 'bp_get_blog_avatar', $avatar, $blog_id, $r );
     491}
     492
    494493function bp_blog_permalink() {
    495494        echo esc_url( bp_get_blog_permalink() );
    496495}
    497         function bp_get_blog_permalink() {
    498                 global $blogs_template;
     496function bp_get_blog_permalink() {
     497        global $blogs_template;
    499498
    500                 if ( ! empty( $blogs_template->blog->domain ) ) {
    501                         $permalink = get_site_url( $blogs_template->blog->blog_id );
     499        if ( ! empty( $blogs_template->blog->domain ) ) {
     500                $permalink = get_site_url( $blogs_template->blog->blog_id );
    502501
    503                 } else {
    504                         $protocol = 'http://';
    505                         if ( is_ssl() ) {
    506                                 $protocol = 'https://';
    507                         }
    508 
    509                         $permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
     502        } else {
     503                $protocol = 'http://';
     504                if ( is_ssl() ) {
     505                        $protocol = 'https://';
    510506                }
    511507
    512                 /**
    513                  * Filters the blog permalink.
    514                  *
    515                  * @since 1.0.0
    516                  *
    517                  * @param string $permalink Permalink URL for the blog.
    518                  */
    519                 return apply_filters( 'bp_get_blog_permalink', $permalink );
     508                $permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
    520509        }
    521510
     511        /**
     512         * Filters the blog permalink.
     513         *
     514         * @since 1.0.0
     515         *
     516         * @param string $permalink Permalink URL for the blog.
     517         */
     518        return apply_filters( 'bp_get_blog_permalink', $permalink );
     519}
     520
    522521/**
    523522 * Output the name of the current blog in the loop.
    524523 */
     
    530529         *
    531530         * @return string The name of the current blog in the loop.
    532531         */
    533         function bp_get_blog_name() {
    534                 global $blogs_template;
     532function bp_get_blog_name() {
     533        global $blogs_template;
    535534
    536                 $name = '';
     535        $name = '';
    537536
    538                 if ( ! empty( $blogs_template->blog->name ) ) {
    539                         $name = $blogs_template->blog->name;
    540                 }
    541 
    542                 /**
    543                  * Filters the name of the current blog in the loop.
    544                  *
    545                  * @since 1.2.0
    546                  *
    547                  * @param string $name Name of the current blog in the loop.
    548                  */
    549                 return apply_filters( 'bp_get_blog_name', $name );
     537        if ( ! empty( $blogs_template->blog->name ) ) {
     538                $name = $blogs_template->blog->name;
    550539        }
    551540
     541        /**
     542         * Filters the name of the current blog in the loop.
     543         *
     544         * @since 1.2.0
     545         *
     546         * @param string $name Name of the current blog in the loop.
     547         */
     548        return apply_filters( 'bp_get_blog_name', $name );
     549}
     550
    552551/**
    553552 * Output the ID of the current blog in the loop.
    554553 *
     
    564563         *
    565564         * @return int ID of the current blog in the loop.
    566565         */
    567         function bp_get_blog_id() {
    568                 global $blogs_template;
     566function bp_get_blog_id() {
     567        global $blogs_template;
    569568
    570                 /**
    571                 * Filters the ID of the current blog in the loop.
    572                 *
    573                 * @since 1.7.0
    574                 *
    575                 * @param int $blog_id ID of the current blog in the loop.
    576                 */
    577                 return apply_filters( 'bp_get_blog_id', $blogs_template->blog->blog_id );
    578         }
     569        /**
     570        * Filters the ID of the current blog in the loop.
     571        *
     572        * @since 1.7.0
     573        *
     574        * @param int $blog_id ID of the current blog in the loop.
     575        */
     576        return apply_filters( 'bp_get_blog_id', $blogs_template->blog->blog_id );
     577}
    579578
    580579/**
    581580 * Output the description of the current blog in the loop.
     
    596595         *
    597596         * @return string Description of the current blog in the loop.
    598597         */
    599         function bp_get_blog_description() {
    600                 global $blogs_template;
     598function bp_get_blog_description() {
     599        global $blogs_template;
    601600
    602                 /**
    603                 * Filters the description of the current blog in the loop.
    604                 *
    605                 * @since 1.0.0
    606                 *
    607                 * @param string $value Description of the current blog in the loop.
    608                 */
    609                 return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
    610         }
     601        /**
     602        * Filters the description of the current blog in the loop.
     603        *
     604        * @since 1.0.0
     605        *
     606        * @param string $value Description of the current blog in the loop.
     607        */
     608        return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
     609}
    611610
    612611/**
    613612 * Output the row class of the current blog in the loop.
     
    630629         * @param array $classes Array of custom classes.
    631630         * @return string Row class of the site.
    632631         */
    633         function bp_get_blog_class( $classes = array() ) {
    634                 global $blogs_template;
     632function bp_get_blog_class( $classes = array() ) {
     633        global $blogs_template;
    635634
    636                 // Add even/odd classes, but only if there's more than 1 group.
    637                 if ( $blogs_template->blog_count > 1 ) {
    638                         $pos_in_loop = (int) $blogs_template->current_blog;
    639                         $classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
     635        // Add even/odd classes, but only if there's more than 1 group.
     636        if ( $blogs_template->blog_count > 1 ) {
     637                $pos_in_loop = (int) $blogs_template->current_blog;
     638                $classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
    640639
    641640                // If we've only one site in the loop, don't bother with odd and even.
    642                 } else {
    643                         $classes[] = 'bp-single-blog';
    644                 }
     641        } else {
     642                $classes[] = 'bp-single-blog';
     643        }
    645644
    646                 /**
    647                 * Filters the row class of the current blog in the loop.
    648                 *
    649                 * @since 1.7.0
    650                 *
    651                 * @param array $classes Array of classes to be applied to row.
    652                 */
    653                 $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_blog_class', $classes ) );
    654                 $classes = array_merge( $classes, array() );
    655                 $retval  = 'class="' . join( ' ', $classes ) . '"';
     645        /**
     646        * Filters the row class of the current blog in the loop.
     647        *
     648        * @since 1.7.0
     649        *
     650        * @param array $classes Array of classes to be applied to row.
     651        */
     652        $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_blog_class', $classes ) );
     653        $classes = array_merge( $classes, array() );
     654        $retval  = 'class="' . join( ' ', $classes ) . '"';
    656655
    657                 return $retval;
    658         }
     656        return $retval;
     657}
    659658
    660659/**
    661660 * Output the last active date of the current blog in the loop.
     
    676675         * }
    677676         * @return string Last active date.
    678677         */
    679         function bp_get_blog_last_active( $args = array() ) {
    680                 global $blogs_template;
     678function bp_get_blog_last_active( $args = array() ) {
     679        global $blogs_template;
    681680
    682                 // Parse the activity format.
    683                 $r = bp_parse_args(
    684                         $args,
    685                         array(
    686                                 'active_format' => true,
    687                         )
    688                 );
     681        // Parse the activity format.
     682        $r = bp_parse_args(
     683                $args,
     684                array(
     685                        'active_format' => true,
     686                )
     687        );
    689688
    690                 // Backwards compatibility for anyone forcing a 'true' active_format.
    691                 if ( true === $r['active_format'] ) {
    692                         /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
    693                         $r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' );
    694                 }
     689        // Backwards compatibility for anyone forcing a 'true' active_format.
     690        if ( true === $r['active_format'] ) {
     691                /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
     692                $r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' );
     693        }
    695694
    696                 // Blog has been posted to at least once.
    697                 if ( isset( $blogs_template->blog->last_activity ) ) {
     695        // Blog has been posted to at least once.
     696        if ( isset( $blogs_template->blog->last_activity ) ) {
    698697
    699                         // Backwards compatibility for pre 1.5 'ago' strings.
    700                         $last_activity = ! empty( $r['active_format'] )
    701                                 ? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] )
    702                                 : bp_core_time_since( $blogs_template->blog->last_activity );
     698                // Backwards compatibility for pre 1.5 'ago' strings.
     699                $last_activity = ! empty( $r['active_format'] )
     700                        ? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] )
     701                        : bp_core_time_since( $blogs_template->blog->last_activity );
    703702
    704703                // Blog has never been posted to.
    705                 } else {
    706                         $last_activity = __( 'Never active', 'buddypress' );
    707                 }
    708 
    709                 /**
    710                  * Filters the last active date of the current blog in the loop.
    711                  *
    712                  * @since 1.2.0
    713                  *
    714                  * @param string $last_activity Last active date.
    715                  * @param array  $r             Array of parsed args used to determine formatting.
    716                  */
    717                 return apply_filters( 'bp_blog_last_active', $last_activity, $r );
     704        } else {
     705                $last_activity = __( 'Never active', 'buddypress' );
    718706        }
    719707
     708        /**
     709         * Filters the last active date of the current blog in the loop.
     710         *
     711         * @since 1.2.0
     712         *
     713         * @param string $last_activity Last active date.
     714         * @param array  $r             Array of parsed args used to determine formatting.
     715         */
     716        return apply_filters( 'bp_blog_last_active', $last_activity, $r );
     717}
     718
    720719/**
    721720 * Output the latest post from the current blog in the loop.
    722721 *
     
    743742         * }
    744743         * @return string $retval String of the form 'Latest Post: [link to post]'.
    745744         */
    746         function bp_get_blog_latest_post( $args = array() ) {
    747                 global $blogs_template;
     745function bp_get_blog_latest_post( $args = array() ) {
     746        global $blogs_template;
    748747
    749                 $r = bp_parse_args(
    750                         $args,
    751                         array(
    752                                 'latest_format' => true,
    753                         )
    754                 );
     748        $r = bp_parse_args(
     749                $args,
     750                array(
     751                        'latest_format' => true,
     752                )
     753        );
    755754
    756                 $retval = bp_get_blog_latest_post_title();
     755        $retval = bp_get_blog_latest_post_title();
    757756
    758                 if ( ! empty( $retval ) ) {
    759                         if ( ! empty( $r['latest_format'] ) ) {
     757        if ( ! empty( $retval ) ) {
     758                if ( ! empty( $r['latest_format'] ) ) {
    760759
    761                                 /**
    762                                 * Filters the title text of the latest post for the current blog in loop.
    763                                 *
    764                                 * @since 1.0.0
    765                                 *
    766                                 * @param string $retval Title of the latest post.
    767                                 */
    768                                 $retval = sprintf(
    769                                         /* translators: %s: the title of the latest post */
    770                                         __( 'Latest Post: %s', 'buddypress' ),
    771                                         '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>'
    772                                 );
    773                         } else {
     760                        /**
     761                        * Filters the title text of the latest post for the current blog in loop.
     762                        *
     763                        * @since 1.0.0
     764                        *
     765                        * @param string $retval Title of the latest post.
     766                        */
     767                        $retval = sprintf(
     768                                /* translators: %s: the title of the latest post */
     769                                __( 'Latest Post: %s', 'buddypress' ),
     770                                '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>'
     771                        );
     772                } else {
    774773
    775                                 /** This filter is documented in bp-blogs/bp-blogs-template.php */
    776                                 $retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';
    777                         }
     774                        /** This filter is documented in bp-blogs/bp-blogs-template.php */
     775                        $retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';
    778776                }
    779 
    780                 /**
    781                  * Filters the HTML markup result for the latest blog post in loop.
    782                  *
    783                  * @since 1.2.0
    784                  * @since 2.6.0 Added the `$r` parameter.
    785                  *
    786                  * @param string $retval HTML markup for the latest post.
    787                  * @param array  $r      Array of parsed arguments.
    788                  */
    789                 return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
    790777        }
    791778
     779        /**
     780         * Filters the HTML markup result for the latest blog post in loop.
     781         *
     782         * @since 1.2.0
     783         * @since 2.6.0 Added the `$r` parameter.
     784         *
     785         * @param string $retval HTML markup for the latest post.
     786         * @param array  $r      Array of parsed arguments.
     787         */
     788        return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
     789}
     790
    792791/**
    793792 * Output the title of the latest post on the current blog in the loop.
    794793 *
     
    808807         *
    809808         * @return string Post title.
    810809         */
    811         function bp_get_blog_latest_post_title() {
    812                 global $blogs_template;
     810function bp_get_blog_latest_post_title() {
     811        global $blogs_template;
    813812
    814                 $retval = '';
     813        $retval = '';
    815814
    816                 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) )
    817                         $retval = $blogs_template->blog->latest_post->post_title;
    818 
    819                 /**
    820                  * Filters the title text of the latest post on the current blog in the loop.
    821                  *
    822                  * @since 1.7.0
    823                  *
    824                  * @param string $retval Title text for the latest post.
    825                  */
    826                 return apply_filters( 'bp_get_blog_latest_post_title', $retval );
     815        if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) ) {
     816                $retval = $blogs_template->blog->latest_post->post_title;
    827817        }
    828818
     819        /**
     820         * Filters the title text of the latest post on the current blog in the loop.
     821         *
     822         * @since 1.7.0
     823         *
     824         * @param string $retval Title text for the latest post.
     825         */
     826        return apply_filters( 'bp_get_blog_latest_post_title', $retval );
     827}
     828
    829829/**
    830830 * Output the permalink of the latest post on the current blog in the loop.
    831831 *
     
    845845         *
    846846         * @return string URL of the blog's latest post.
    847847         */
    848         function bp_get_blog_latest_post_permalink() {
    849                 global $blogs_template;
     848function bp_get_blog_latest_post_permalink() {
     849        global $blogs_template;
    850850
    851                 $retval = '';
     851        $retval = '';
    852852
    853                 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) )
    854                         $retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );
    855 
    856                 /**
    857                  * Filters the permalink of the latest post on the current blog in the loop.
    858                  *
    859                  * @since 1.7.0
    860                  *
    861                  * @param string $retval Permalink URL of the latest post.
    862                  */
    863                 return apply_filters( 'bp_get_blog_latest_post_permalink', $retval );
     853        if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) ) {
     854                $retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );
    864855        }
    865856
     857        /**
     858         * Filters the permalink of the latest post on the current blog in the loop.
     859         *
     860         * @since 1.7.0
     861         *
     862         * @param string $retval Permalink URL of the latest post.
     863         */
     864        return apply_filters( 'bp_get_blog_latest_post_permalink', $retval );
     865}
     866
    866867/**
    867868 * Output the content of the latest post on the current blog in the loop.
    868869 *
    869870 * @since 1.7.0
    870  *
    871871 */
    872872function bp_blog_latest_post_content() {
    873873        echo wp_kses_post( bp_get_blog_latest_post_content() );
     
    881881         *
    882882         * @return string Content of the blog's latest post.
    883883         */
    884         function bp_get_blog_latest_post_content() {
    885                 global $blogs_template;
     884function bp_get_blog_latest_post_content() {
     885        global $blogs_template;
    886886
    887                 $retval = '';
     887        $retval = '';
    888888
    889                 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) ) {
    890                         $retval = $blogs_template->blog->latest_post->post_content;
    891                 }
    892 
    893                 /**
    894                  * Filters the content of the latest post on the current blog in the loop.
    895                  *
    896                  * @since 1.7.0
    897                  *
    898                  * @param string $retval Content of the latest post on the current blog in the loop.
    899                  */
    900                 return apply_filters( 'bp_get_blog_latest_post_content', $retval );
     889        if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) ) {
     890                $retval = $blogs_template->blog->latest_post->post_content;
    901891        }
    902892
     893        /**
     894         * Filters the content of the latest post on the current blog in the loop.
     895         *
     896         * @since 1.7.0
     897         *
     898         * @param string $retval Content of the latest post on the current blog in the loop.
     899         */
     900        return apply_filters( 'bp_get_blog_latest_post_content', $retval );
     901}
     902
    903903/**
    904904 * Output the featured image of the latest post on the current blog in the loop.
    905905 *
     
    923923         *                     'large', or 'post-thumbnail'. Default: 'thumbnail'.
    924924         * @return string URL of the image.
    925925         */
    926         function bp_get_blog_latest_post_featured_image( $size = 'thumbnail' ) {
    927                 global $blogs_template;
     926function bp_get_blog_latest_post_featured_image( $size = 'thumbnail' ) {
     927        global $blogs_template;
    928928
    929                 $retval = '';
     929        $retval = '';
    930930
    931                 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[$size] ) ) {
    932                         $retval = $blogs_template->blog->latest_post->images[$size];
    933                 }
    934 
    935                 /**
    936                  * Filters the featured image of the latest post on the current blog in the loop.
    937                  *
    938                  * @since 1.7.0
    939                  *
    940                  * @param string $retval The featured image of the latest post on the current blog in the loop.
    941                  */
    942                 return apply_filters( 'bp_get_blog_latest_post_featured_image', $retval );
     931        if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[ $size ] ) ) {
     932                $retval = $blogs_template->blog->latest_post->images[ $size ];
    943933        }
    944934
     935        /**
     936         * Filters the featured image of the latest post on the current blog in the loop.
     937         *
     938         * @since 1.7.0
     939         *
     940         * @param string $retval The featured image of the latest post on the current blog in the loop.
     941         */
     942        return apply_filters( 'bp_get_blog_latest_post_featured_image', $retval );
     943}
     944
    945945/**
    946946 * Does the latest blog post have a featured image?
    947947 *
     
    953953 *              featured image of the given size.
    954954 */
    955955function bp_blog_latest_post_has_featured_image( $thumbnail = 'thumbnail' ) {
    956         $image  = bp_get_blog_latest_post_featured_image( $thumbnail );
     956        $image = bp_get_blog_latest_post_featured_image( $thumbnail );
    957957
    958958        /**
    959959         * Filters whether or not the latest blog post has a featured image.
     
    976976 */
    977977function bp_blog_hidden_fields() {
    978978        if ( isset( $_REQUEST['s'] ) ) {
    979                 echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />';
     979                echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ) . '" name="search_terms" />';
    980980        }
    981981
    982982        if ( isset( $_REQUEST['letter'] ) ) {
     
    999999         *
    10001000         * @return int Total number of blogs.
    10011001         */
    1002         function bp_get_total_blog_count() {
     1002function bp_get_total_blog_count() {
    10031003
    1004                 /**
    1005                 * Filters the total number of blogs on the site.
    1006                 *
    1007                 * @since 1.2.0
    1008                 *
    1009                 * @param int $value Total number of blogs on the site.
    1010                 */
    1011                 return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
    1012         }
     1004        /**
     1005        * Filters the total number of blogs on the site.
     1006        *
     1007        * @since 1.2.0
     1008        *
     1009        * @param int $value Total number of blogs on the site.
     1010        */
     1011        return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
     1012}
    10131013        add_filter( 'bp_get_total_blog_count', 'bp_core_number_format' );
    10141014
    10151015/**
     
    10261026         * @param int $user_id ID of the user.
    10271027         * @return int Total number of blogs for the user.
    10281028         */
    1029         function bp_get_total_blog_count_for_user( $user_id = 0 ) {
     1029function bp_get_total_blog_count_for_user( $user_id = 0 ) {
    10301030
    1031                 /**
    1032                 * Filters the total number of blogs for a given user.
    1033                 *
    1034                 * @since 1.2.0
    1035                 * @since 2.6.0 Added the `$user_id` parameter.
    1036                 *
    1037                 * @param int $value   Total number of blogs for a given user.
    1038                 * @param int $user_id ID of the queried user.
    1039                 */
    1040                 return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ), $user_id );
    1041         }
     1031        /**
     1032        * Filters the total number of blogs for a given user.
     1033        *
     1034        * @since 1.2.0
     1035        * @since 2.6.0 Added the `$user_id` parameter.
     1036        *
     1037        * @param int $value   Total number of blogs for a given user.
     1038        * @param int $user_id ID of the queried user.
     1039        */
     1040        return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ), $user_id );
     1041}
    10421042        add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
    10431043
    10441044
     
    10761076                 *      WP_Error $errors     WP_Error object.
    10771077                 * }
    10781078                 */
    1079                 $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
     1079                $filtered_results = apply_filters(
     1080                        'signup_another_blog_init',
     1081                        array(
     1082                                'blogname'   => $blogname,
     1083                                'blog_title' => $blog_title,
     1084                                'errors'     => $errors,
     1085                        )
     1086                );
    10801087                $blogname         = $filtered_results['blogname'];
    10811088                $blog_title       = $filtered_results['blog_title'];
    10821089                $errors           = $filtered_results['errors'];
     
    11171124                         *
    11181125                         * @since 1.0.0
    11191126                         */
    1120                         do_action( 'signup_hidden_fields' ); ?>
     1127                        do_action( 'signup_hidden_fields' );
     1128                        ?>
    11211129
    11221130                        <?php bp_blogs_signup_blog( $blogname, $blog_title, $errors ); ?>
    11231131                        <p>
     
    11241132                                <input id="submit" type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site', 'buddypress' ); ?>" />
    11251133                        </p>
    11261134
    1127                         <?php wp_nonce_field( 'bp_blog_signup_form' ) ?>
     1135                        <?php wp_nonce_field( 'bp_blog_signup_form' ); ?>
    11281136                </form>
    11291137                <?php
    11301138
     
    12061214        if ( ! is_user_logged_in() ) {
    12071215                $url = sprintf(
    12081216                        /* translators: %s is the site domain and path. */
    1209                         __( 'domain.%s' , 'buddypress' ),
     1217                        __( 'domain.%s', 'buddypress' ),
    12101218                        $current_site->domain . $current_site->path
    12111219                );
    12121220
     
    12131221                if ( ! is_subdomain_install() ) {
    12141222                        $url = sprintf(
    12151223                                /* translators: %s is the site domain and path. */
    1216                                 __( '%sblogname' , 'buddypress'),
     1224                                __( '%sblogname', 'buddypress' ),
    12171225                                $current_site->domain . $current_site->path
    12181226                        );
    12191227                }
     
    12221230                        '<p>(<strong>%1$s.</strong> %2$s)</p>',
    12231231                        sprintf(
    12241232                                /* translators: %s is the site url. */
    1225                                 esc_html__( 'Your address will be %s' , 'buddypress' ), esc_url( $url )
     1233                                esc_html__( 'Your address will be %s', 'buddypress' ),
     1234                                esc_url( $url )
    12261235                        ),
    1227                         esc_html__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!' , 'buddypress' )
     1236                        esc_html__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!', 'buddypress' )
    12281237                );
    12291238        }
    12301239
     
    12311240        // Blog Title.
    12321241        ?>
    12331242        <p>
    1234                 <label for="blog_title"><?php esc_html_e('Site Title:', 'buddypress') ?></label>
     1243                <label for="blog_title"><?php esc_html_e( 'Site Title:', 'buddypress' ); ?></label>
    12351244                <input name="blog_title" type="text" id="blog_title" value="<?php echo esc_html( $blog_title ); ?>" />
    12361245
    12371246                <?php
     
    12431252
    12441253        <fieldset class="create-site">
    12451254
    1246                 <legend class="label"><?php esc_html_e( 'Privacy: I would like my site to appear in search engines, and in public listings around this network', 'buddypress' ) ?></legend>
     1255                <legend class="label"><?php esc_html_e( 'Privacy: I would like my site to appear in search engines, and in public listings around this network', 'buddypress' ); ?></legend>
    12471256
    12481257                <p>
    12491258                        <label class="checkbox" for="blog_public_on">
    12501259                                <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php checked( ! isset( $_POST['blog_public'] ) || 1 === (int) $_POST['blog_public'] ); ?> />
    1251                                 <strong><?php esc_html_e( 'Yes' , 'buddypress'); ?></strong>
     1260                                <strong><?php esc_html_e( 'Yes', 'buddypress' ); ?></strong>
    12521261                        </label>
    12531262                </p>
    12541263
     
    12551264                <p>
    12561265                        <label class="checkbox" for="blog_public_off">
    12571266                                <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php checked( isset( $_POST['blog_public'] ) && 0 === (int) $_POST['blog_public'] ); ?> />
    1258                                 <strong><?php esc_html_e( 'No' , 'buddypress'); ?></strong>
     1267                                <strong><?php esc_html_e( 'No', 'buddypress' ); ?></strong>
    12591268                        </label>
    12601269                </p>
    12611270
     
    13211330         *      string $public Default public status.
    13221331         * }
    13231332         */
    1324         $meta = apply_filters( 'add_signup_meta', array( 'lang_id' => 1, 'public' => $public ) );
     1333        $meta = apply_filters(
     1334                'add_signup_meta',
     1335                array(
     1336                        'lang_id' => 1,
     1337                        'public'  => $public,
     1338                )
     1339        );
    13251340
    13261341        return wpmu_create_blog(
    13271342                $blog['domain'],
    13281343                $blog['path'],
    13291344                $blog['blog_title'],
    1330                 $current_user->ID, $meta,
     1345                $current_user->ID,
     1346                $meta,
    13311347                $current_site->id
    13321348        );
    13331349}
     
    14271443        }
    14281444
    14291445        $search_form_html = '<form action="" method="get" id="search-blogs-form">
    1430                 <label for="blogs_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
     1446                <label for="blogs_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="' . esc_attr( $search_value ) . '" /></label>
    14311447                <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . esc_attr__( 'Search', 'buddypress' ) . '" />
    14321448        </form>';
    14331449
     
    14621478         *
    14631479         * @return false|string
    14641480         */
    1465         function bp_get_blog_create_button() {
    1466                 if ( ! is_user_logged_in() ) {
    1467                         return false;
    1468                 }
     1481function bp_get_blog_create_button() {
     1482        if ( ! is_user_logged_in() ) {
     1483                return false;
     1484        }
    14691485
    1470                 if ( ! bp_blog_signup_enabled() ) {
    1471                         return false;
    1472                 }
     1486        if ( ! bp_blog_signup_enabled() ) {
     1487                return false;
     1488        }
    14731489
    1474                 $url = bp_get_blogs_directory_url(
    1475                         array(
    1476                                 'create_single_item' => 1,
    1477                         )
    1478                 );
     1490        $url = bp_get_blogs_directory_url(
     1491                array(
     1492                        'create_single_item' => 1,
     1493                )
     1494        );
    14791495
    1480                 $button_args = array(
    1481                         'id'         => 'create_blog',
    1482                         'component'  => 'blogs',
    1483                         'link_text'  => __( 'Create a Site', 'buddypress' ),
    1484                         'link_class' => 'blog-create no-ajax',
    1485                         'link_href'  => $url,
    1486                         'wrapper'    => false,
    1487                         'block_self' => false,
    1488                 );
     1496        $button_args = array(
     1497                'id'         => 'create_blog',
     1498                'component'  => 'blogs',
     1499                'link_text'  => __( 'Create a Site', 'buddypress' ),
     1500                'link_class' => 'blog-create no-ajax',
     1501                'link_href'  => $url,
     1502                'wrapper'    => false,
     1503                'block_self' => false,
     1504        );
    14891505
    1490                 /**
    1491                 * Filters the Create a Site button.
    1492                 *
    1493                 * @since 2.0.0
    1494                 *
    1495                 * @param array $button_args Array of arguments to be used for the Create a Site button.
    1496                 */
    1497                 return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
    1498         }
     1506        /**
     1507        * Filters the Create a Site button.
     1508        *
     1509        * @since 2.0.0
     1510        *
     1511        * @param array $button_args Array of arguments to be used for the Create a Site button.
     1512        */
     1513        return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
     1514}
    14991515
    15001516/**
    15011517 * Output the Create a Site nav item.
     
    15151531         *
    15161532         * @return string
    15171533         */
    1518         function bp_get_blog_create_nav_item() {
    1519                 // Get the create a site button.
    1520                 $create_blog_button = bp_get_blog_create_button();
     1534function bp_get_blog_create_nav_item() {
     1535        // Get the create a site button.
     1536        $create_blog_button = bp_get_blog_create_button();
    15211537
    1522                 // Make sure the button is available.
    1523                 if ( empty( $create_blog_button ) ) {
    1524                         return;
    1525                 }
     1538        // Make sure the button is available.
     1539        if ( empty( $create_blog_button ) ) {
     1540                return;
     1541        }
    15261542
    1527                 $output = '<li id="blog-create-nav">' . $create_blog_button . '</li>';
     1543        $output = '<li id="blog-create-nav">' . $create_blog_button . '</li>';
    15281544
    1529                 /**
    1530                 * Filters the Create A Site nav item output.
    1531                 *
    1532                 * @since 2.2.0
    1533                 *
    1534                 * @param string $output Nav item output.
    1535                 */
    1536                 return apply_filters( 'bp_get_blog_create_nav_item', $output );
    1537         }
     1545        /**
     1546        * Filters the Create A Site nav item output.
     1547        *
     1548        * @since 2.2.0
     1549        *
     1550        * @param string $output Nav item output.
     1551        */
     1552        return apply_filters( 'bp_get_blog_create_nav_item', $output );
     1553}
    15381554
    15391555/**
    15401556 * Checks if a specific theme is still filtering the Blogs directory title
     
    15931609         * }
    15941610         * @return array Thhe arguments of the button for visiting a blog in a loop.
    15951611         */
    1596         function bp_get_blogs_visit_blog_button_args( $args = '' ) {
    1597                 $button_args = bp_parse_args(
    1598                         $args,
    1599                         array(
    1600                                 'id'                => 'visit_blog',
    1601                                 'component'         => 'blogs',
    1602                                 'must_be_logged_in' => false,
    1603                                 'block_self'        => false,
    1604                                 'wrapper_class'     => 'blog-button visit',
    1605                                 'link_href'         => bp_get_blog_permalink(),
    1606                                 'link_class'        => 'blog-button visit',
    1607                                 'link_text'         => __( 'Visit Site', 'buddypress' ),
    1608                                 'link_title'        => __( 'Visit Site', 'buddypress' ),
    1609                         )
    1610                 );
     1612function bp_get_blogs_visit_blog_button_args( $args = '' ) {
     1613        $button_args = bp_parse_args(
     1614                $args,
     1615                array(
     1616                        'id'                => 'visit_blog',
     1617                        'component'         => 'blogs',
     1618                        'must_be_logged_in' => false,
     1619                        'block_self'        => false,
     1620                        'wrapper_class'     => 'blog-button visit',
     1621                        'link_href'         => bp_get_blog_permalink(),
     1622                        'link_class'        => 'blog-button visit',
     1623                        'link_text'         => __( 'Visit Site', 'buddypress' ),
     1624                        'link_title'        => __( 'Visit Site', 'buddypress' ),
     1625                )
     1626        );
    16111627
    1612                 /**
    1613                 * Filters the button for visiting a blog in a loop.
    1614                 *
    1615                 * @since 1.2.10
    1616                 *
    1617                 * @param array $button_args Array of arguments to be used for the button to visit a blog.
    1618                 */
    1619                 return (array) apply_filters( 'bp_get_blogs_visit_blog_button', $button_args );
    1620         }
     1628        /**
     1629        * Filters the button for visiting a blog in a loop.
     1630        *
     1631        * @since 1.2.10
     1632        *
     1633        * @param array $button_args Array of arguments to be used for the button to visit a blog.
     1634        */
     1635        return (array) apply_filters( 'bp_get_blogs_visit_blog_button', $button_args );
     1636}
    16211637
    16221638        /**
    16231639         * Return button for visiting a blog in a loop.
     
    16301646         * @param array|string $args See {@link bp_get_blogs_visit_blog_button_args()}.
    16311647         * @return string The HTML for the Visit button.
    16321648         */
    1633         function bp_get_blogs_visit_blog_button( $args = '' ) {
    1634                 $button_args = bp_get_blogs_visit_blog_button_args( $args );
     1649function bp_get_blogs_visit_blog_button( $args = '' ) {
     1650        $button_args = bp_get_blogs_visit_blog_button_args( $args );
    16351651
    1636                 if ( ! array_filter( $button_args ) ) {
    1637                         return '';
    1638                 }
    1639 
    1640                 return bp_get_button( $button_args );
     1652        if ( ! array_filter( $button_args ) ) {
     1653                return '';
    16411654        }
    16421655
     1656        return bp_get_button( $button_args );
     1657}
     1658
    16431659/** Stats **********************************************************************/
    16441660
    16451661/**