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/1.5.php

    r14073 r14269  
    109109        $admin_page_hooks[$file] = sanitize_title( $menu_title );
    110110
    111         if ( !empty( $function ) && !empty ( $hookname ) )
     111        if ( ! empty( $function ) && ! empty( $hookname ) ) {
    112112                add_action( $hookname, $function );
    113 
    114         if ( empty( $icon_url ) )
     113        }
     114
     115        if ( empty( $icon_url ) ) {
    115116                $icon_url = 'images/generic.png';
    116         elseif ( is_ssl() && 0 === strpos( $icon_url, 'http://' ) )
     117        } elseif ( is_ssl() && 0 === strpos( $icon_url, 'http://' ) ) {
    117118                $icon_url = 'https://' . substr( $icon_url, 7 );
     119        }
    118120
    119121        do {
    … …  
    340342
    341343        /* Make sure there's only one instance of each username */
    342         if ( !$usernames = array_unique( $usernames[1] ) )
     344        if ( ! $usernames = array_unique( $usernames[1] ) ) {
    343345                return false;
     346        }
    344347
    345348        $group = new BP_Groups_Group( $group_id );
    346349
    347350        foreach ( (array) $usernames as $username ) {
    348                 if ( !$receiver_user_id = bp_core_get_userid( $username ) )
     351                $receiver_user_id = bp_core_get_userid( $username );
     352
     353                if ( ! $receiver_user_id ) {
    349354                        continue;
     355                }
    350356
    351357                /* Check the user is a member of the group before sending the update. */
    352                 if ( !groups_is_user_member( $receiver_user_id, $group_id ) )
     358                if ( !groups_is_user_member( $receiver_user_id, $group_id ) ) {
    353359                        continue;
     360                }
    354361
    355362                // Now email the user with the contents of the message (if they have enabled email notifications).
    … …  
    367374                        $ud = bp_core_get_core_userdata( $receiver_user_id );
    368375                        $to = $ud->user_email;
     376
    369377                        $subject = bp_get_email_subject(
    370378                                array(
    … …  
    523531        function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
    524532                _deprecated_function( __FUNCTION__, '1.5', "No longer required." );
    525                 if ( !is_admin() || !bp_current_user_can( 'bp_moderate' ) )
     533                if ( !is_admin() || !bp_current_user_can( 'bp_moderate' ) ) {
    526534                        return false;
     535                }
    527536
    528537                return $oldvalue;
    … …  
    589598        function bp_dtheme_add_blog_comments_js() {
    590599                _deprecated_function( __FUNCTION__, '1.5', "Enqueue the comment-reply script in your theme's header.php." );
    591                 if ( is_singular() && bp_is_blog_page() && get_option( 'thread_comments' ) )
     600                if ( is_singular() && bp_is_blog_page() && get_option( 'thread_comments' ) ) {
    592601                        wp_enqueue_script( 'comment-reply' );
     602                }
    593603        }
    594604        endif;
    … …  
    747757
    748758
    749         if ( $admins = groups_get_group_admins( $group->id ) ) : ?>
    750 
    751                 <ul id="admins-list" class="item-list<?php if ( !empty( $admin_list ) ) : ?> single-line<?php endif; ?>">
     759        if ( $admins = groups_get_group_admins( $group->id ) ) :
     760                $single_line_class = ! empty( $admin_list ) ? ' single-line' : '';
     761                ?>
     762
     763                <ul id="admins-list" class="item-list<?php echo esc_attr( $single_line_class ); ?>">
    752764
    753765                <?php foreach ( (array) $admins as $admin ) { ?>
Note: See TracChangeset for help on using the changeset viewer.