Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/10/2026 12:16:05 AM (3 months ago)
Author:
espellcaste
Message:

WPCS: Remove generated markup suppressions.

Refactor output-sensitive template conditions and loops to satisfy control-structure rules without changing generated markup.

Props espellcaste.
See #9174.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/deprecated/12.0.php

    r14029 r14269  
    622622function bp_groups_header_tabs() {
    623623        _deprecated_function( __FUNCTION__, '12.0.0' );
    624         $user_groups = bp_displayed_user_url() . bp_get_groups_slug(); ?>
    625 
    626         <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/recently-active' ) ); ?>"><?php esc_html_e( 'Recently Active', 'buddypress' ); ?></a></li>
    627         <li<?php if ( bp_is_action_variable( 'recently-joined', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/recently-joined' ) ); ?>"><?php esc_html_e( 'Recently Joined',  'buddypress' ); ?></a></li>
    628         <li<?php if ( bp_is_action_variable( 'most-popular',    0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/most-popular'    ) ); ?>"><?php esc_html_e( 'Most Popular',     'buddypress' ); ?></a></li>
    629         <li<?php if ( bp_is_action_variable( 'admin-of',        0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/admin-of'        ) ); ?>"><?php esc_html_e( 'Administrator Of', 'buddypress' ); ?></a></li>
    630         <li<?php if ( bp_is_action_variable( 'mod-of',          0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/mod-of'          ) ); ?>"><?php esc_html_e( 'Moderator Of',     'buddypress' ); ?></a></li>
    631         <li<?php if ( bp_is_action_variable( 'alphabetically'     ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/alphabetically'  ) ); ?>"><?php esc_html_e( 'Alphabetically',   'buddypress' ); ?></a></li>
     624
     625        $user_groups     = bp_displayed_user_url() . bp_get_groups_slug();
     626        $recently_active = ! bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 );
     627        $recently_joined = bp_is_action_variable( 'recently-joined', 0 );
     628        $most_popular    = bp_is_action_variable( 'most-popular', 0 );
     629        $admin_of        = bp_is_action_variable( 'admin-of', 0 );
     630        $mod_of          = bp_is_action_variable( 'mod-of', 0 );
     631        $alphabetical    = bp_is_action_variable( 'alphabetically' );
     632        ?>
     633
     634        <li<?php echo $recently_active ? ' class="current"' : ''; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/recently-active' ) ); ?>"><?php esc_html_e( 'Recently Active', 'buddypress' ); ?></a></li>
     635        <li<?php echo $recently_joined ? ' class="current"' : ''; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/recently-joined' ) ); ?>"><?php esc_html_e( 'Recently Joined',  'buddypress' ); ?></a></li>
     636        <li<?php echo $most_popular ? ' class="current"' : ''; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/most-popular'    ) ); ?>"><?php esc_html_e( 'Most Popular',     'buddypress' ); ?></a></li>
     637        <li<?php echo $admin_of ? ' class="current"' : ''; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/admin-of'        ) ); ?>"><?php esc_html_e( 'Administrator Of', 'buddypress' ); ?></a></li>
     638        <li<?php echo $mod_of ? ' class="current"' : ''; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/mod-of'          ) ); ?>"><?php esc_html_e( 'Moderator Of',     'buddypress' ); ?></a></li>
     639        <li<?php echo $alphabetical ? ' class="current"' : ''; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/alphabetically'  ) ); ?>"><?php esc_html_e( 'Alphabetically',   'buddypress' ); ?></a></li>
    632640
    633641<?php
    … …  
    655663        if ( bp_is_my_profile() ) {
    656664                return false;
    657         } ?>
     665        }
     666
     667        $my_blogs        = bp_is_current_action( 'my-blogs' ) || ! bp_current_action();
     668        $recent_posts    = bp_is_current_action( 'recent-posts' );
     669        $recent_comments = bp_is_current_action( 'recent-comments' );
     670        ?>
    658671
    659672        <ul class="content-header-nav">
    660                 <li<?php if ( bp_is_current_action( 'my-blogs' ) || !bp_current_action() ) : ?> class="current"<?php endif; ?>>
     673                <li<?php echo $my_blogs ? ' class="current"' : ''; ?>>
    661674                        <a href="<?php bp_displayed_user_link( array( bp_get_blogs_slug(), 'my-blogs' ) ); ?>">
    662675                                <?php
    … …  
    666679                        </a>
    667680                </li>
    668                 <li<?php if ( bp_is_current_action( 'recent-posts' ) ) : ?> class="current"<?php endif; ?>>
     681                <li<?php echo $recent_posts ? ' class="current"' : ''; ?>>
    669682                        <a href="<?php bp_displayed_user_link( array( bp_get_blogs_slug(), 'recent-posts' ) ); ?>">
    670683                                <?php
    … …  
    674687                        </a>
    675688                </li>
    676                 <li<?php if ( bp_is_current_action( 'recent-comments' ) ) : ?> class="current"<?php endif; ?>>
     689                <li<?php echo $recent_comments ? ' class="current"' : ''; ?>>
    677690                        <a href="<?php bp_displayed_user_link( array( bp_get_blogs_slug(), 'recent-comments' ) ); ?>">
    678691                                <?php
    … …  
    964977        }
    965978
    966         if ( $group_mods = groups_get_group_mods( $group->id ) ) { ?>
    967 
    968                 <ul id="mods-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>">
     979        if ( $group_mods = groups_get_group_mods( $group->id ) ) {
     980                $single_line_class = $admin_list ? ' single-line' : '';
     981                ?>
     982
     983                <ul id="mods-list" class="item-list<?php echo esc_attr( $single_line_class ); ?>">
    969984
    970985                <?php foreach ( (array) $group_mods as $mod ) { ?>
    … …  
    15871602function bp_groups_filter_title() {
    15881603        _deprecated_function( __FUNCTION__, '12.0.0' );
    1589         $current_filter = bp_action_variable( 0 );
    1590 
    1591         switch ( $current_filter ) {
    1592                 case 'recently-active': default:
     1604
     1605        switch ( bp_action_variable( 0 ) ) {
     1606                case 'recently-active':
    15931607                        esc_html_e( 'Recently Active', 'buddypress' );
    15941608                        break;
    … …  
    16071621                case 'alphabetically':
    16081622                        esc_html_e( 'Alphabetically', 'buddypress' );
    1609                 break;
     1623                        break;
     1624                default:
     1625                        esc_html_e( 'Recently Active', 'buddypress' );
    16101626        }
    16111627
Note: See TracChangeset for help on using the changeset viewer.