Skip to:
Content

BuddyPress.org

Changeset 13799


Ignore:
Timestamp:
04/23/2024 09:39:11 PM (12 months ago)
Author:
imath
Message:

Members component: improve PHP code standards using WPCS

See #7228 (trunk)

Location:
trunk/src/bp-members
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-admin.php

    r13234 r13799  
    146146
    147147    ?>
    148     <div id="signup-info-modal-<?php echo $signup_object->id; ?>" style="display:none;">
     148    <div id="signup-info-modal-<?php echo esc_attr( $signup_object->id ); ?>" style="display:none;">
    149149        <h1><?php printf( '%1$s (%2$s)', esc_html( $signup_object->user_name ), esc_html( $signup_object->user_email ) ); ?></h1>
    150150
     
    166166                    <tr>
    167167                        <td class="column-fields"><?php echo esc_html( $signup_field_labels[ $profile_field_id ] ); ?></td>
    168                         <td><?php echo bp_members_admin_format_xprofile_field_for_display( $field_value ); ?></td>
     168                        <td>
     169                            <?php
     170                            // phpcs:ignore WordPress.Security.EscapeOutput
     171                            echo bp_members_admin_format_xprofile_field_for_display( $field_value );
     172                            ?>
     173                        </td>
    169174                    </tr>
    170175                <?php endforeach; else: ?>
  • trunk/src/bp-members/bp-members-blocks.php

    r13716 r13799  
    369369    );
    370370
    371     // Include the common JS template.
     371    // Include the common JS template (Escaping is done there).
     372    // phpcs:ignore WordPress.Security.EscapeOutput
    372373    echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-members.php' );
    373374
  • trunk/src/bp-members/bp-members-functions.php

    r13798 r13799  
    11371137        // Don't send the warning more than once per pageload.
    11381138        if ( false === $warned ) {
    1139             _doing_it_wrong( 'get_user_meta( $user_id, \'last_activity\' )', __( 'User last_activity data is no longer stored in usermeta. Use bp_get_user_last_activity() instead.', 'buddypress' ), '2.0.0' );
     1139            _doing_it_wrong( 'get_user_meta( $user_id, \'last_activity\' )', esc_html__( 'User last_activity data is no longer stored in usermeta. Use bp_get_user_last_activity() instead.', 'buddypress' ), '2.0.0' );
    11401140            $warned = true;
    11411141        }
     
    11721172function _bp_update_user_meta_last_activity_warning( $meta_id, $object_id, $meta_key, $meta_value ) {
    11731173    if ( 'last_activity' === $meta_key ) {
    1174         _doing_it_wrong( 'update_user_meta( $user_id, \'last_activity\' )', __( 'User last_activity data is no longer stored in usermeta. Use bp_update_user_last_activity() instead.', 'buddypress' ), '2.0.0' );
     1174        _doing_it_wrong( 'update_user_meta( $user_id, \'last_activity\' )', esc_html__( 'User last_activity data is no longer stored in usermeta. Use bp_update_user_last_activity() instead.', 'buddypress' ), '2.0.0' );
    11751175        bp_update_user_last_activity( $object_id, $meta_value );
    11761176    }
     
    26862686 */
    26872687function bp_member_type_tax_name() {
    2688     echo bp_get_member_type_tax_name();
     2688    echo esc_html( bp_get_member_type_tax_name() );
    26892689}
    26902690    /**
  • trunk/src/bp-members/bp-members-notifications.php

    r13433 r13799  
    241241            <tr>
    242242                <th class="icon"></th>
    243                 <th class="title"><?php _ex( 'Members', 'Member settings on notification settings page', 'buddypress' ) ?></th>
    244                 <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    245                 <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     243                <th class="title"><?php echo esc_html_x( 'Members', 'Member settings on notification settings page', 'buddypress' ); ?></th>
     244                <th class="yes"><?php esc_html_e( 'Yes', 'buddypress' ) ?></th>
     245                <th class="no"><?php esc_html_e( 'No', 'buddypress' )?></th>
    246246            </tr>
    247247        </thead>
  • trunk/src/bp-members/bp-members-template.php

    r13647 r13799  
    1919 */
    2020function bp_profile_slug() {
    21     echo bp_get_profile_slug();
     21    echo esc_url( bp_get_profile_slug() );
    2222}
    2323    /**
     
    4646 */
    4747function bp_members_slug() {
    48     echo bp_get_members_slug();
     48    echo esc_url( bp_get_members_slug() );
    4949}
    5050    /**
     
    7373 */
    7474function bp_members_root_slug() {
    75     echo bp_get_members_root_slug();
     75    echo esc_url( bp_get_members_root_slug() );
    7676}
    7777    /**
     
    216216 */
    217217function bp_signup_slug() {
    218     echo bp_get_signup_slug();
     218    echo esc_url( bp_get_signup_slug() );
    219219}
    220220    /**
     
    249249 */
    250250function bp_activate_slug() {
    251     echo bp_get_activate_slug();
     251    echo esc_url( bp_get_activate_slug() );
    252252}
    253253    /**
     
    282282 */
    283283function bp_members_invitations_slug() {
    284     echo bp_get_members_invitations_slug();
     284    echo esc_url( bp_get_members_invitations_slug() );
    285285}
    286286    /**
     
    490490 */
    491491function bp_members_pagination_count() {
    492     echo bp_get_members_pagination_count();
     492    echo esc_html( bp_get_members_pagination_count() );
    493493}
    494494    /**
     
    559559 */
    560560function bp_members_pagination_links() {
     561    // Escaping is done in WordPress's `paginate_links()` function.
     562    // phpcs:ignore WordPress.Security.EscapeOutput
    561563    echo bp_get_members_pagination_links();
    562564}
     
    589591 */
    590592function bp_member_user_id() {
    591     echo bp_get_member_user_id();
     593    echo intval( bp_get_member_user_id() );
    592594}
    593595    /**
     
    625627 */
    626628function bp_member_class( $classes = array() ) {
     629    // phpcs:ignore WordPress.Security.EscapeOutput
    627630    echo bp_get_member_class( $classes );
    628631}
     
    673676        if ( $member_types = bp_get_member_type( $members_template->member->id, false ) ) {
    674677            foreach ( $member_types as $member_type ) {
    675                 $classes[] = sprintf( 'member-type-%s', esc_attr( $member_type ) );
     678                $classes[] = sprintf( 'member-type-%s', $member_type );
    676679            }
    677680        }
     
    682685         * @since 1.7.0
    683686         *
    684          * @param string $classes Classes to be added to the HTML element.
    685          */
    686         $classes = apply_filters( 'bp_get_member_class', $classes );
     687         * @param array $classes Classes to be added to the HTML element.
     688         */
     689        $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_member_class', $classes ) );
    687690        $classes = array_merge( $classes, array() );
    688691        $retval  = 'class="' . join( ' ', $classes ) . '"';
     
    697700 */
    698701function bp_member_user_nicename() {
    699     echo bp_get_member_user_nicename();
     702    echo esc_html( bp_get_member_user_nicename() );
    700703}
    701704    /**
     
    727730 */
    728731function bp_member_user_login() {
    729     echo bp_get_member_user_login();
     732    echo esc_html( bp_get_member_user_login() );
    730733}
    731734    /**
     
    757760 */
    758761function bp_member_user_email() {
    759     echo bp_get_member_user_email();
     762    echo esc_html( bp_get_member_user_email() );
    760763}
    761764    /**
     
    811814 */
    812815function bp_member_avatar( $args = '' ) {
     816    // phpcs:disable WordPress.Security.EscapeOutput
    813817
    814818    /**
     
    822826     */
    823827    echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ), $args );
     828    // phpcs:enable
    824829}
    825830    /**
     
    950955 */
    951956function bp_member_name() {
     957    // phpcs:disable WordPress.Security.EscapeOutput
    952958
    953959    /**
     
    959965     */
    960966    echo apply_filters( 'bp_member_name', bp_get_member_name() );
     967    // phpcs:enable
    961968}
    962969    /**
     
    10171024 */
    10181025function bp_member_last_active( $args = array() ) {
    1019     echo bp_get_member_last_active( $args );
     1026    echo esc_html( bp_get_member_last_active( $args ) );
    10201027}
    10211028    /**
     
    10911098 */
    10921099function bp_member_latest_update( $args = '' ) {
     1100    // phpcs:ignore WordPress.Security.EscapeOutput
    10931101    echo bp_get_member_latest_update( $args );
    10941102}
     
    12071215 */
    12081216function bp_member_profile_data( $args = '' ) {
     1217    // phpcs:ignore WordPress.Security.EscapeOutput
    12091218    echo bp_get_member_profile_data( $args );
    12101219}
     
    13151324 */
    13161325function bp_member_registered( $args = array() ) {
    1317     echo bp_get_member_registered( $args );
     1326    echo esc_html( bp_get_member_registered( $args ) );
    13181327}
    13191328    /**
     
    13691378 */
    13701379function bp_member_random_profile_data() {
    1371     if ( bp_is_active( 'xprofile' ) ) { ?>
    1372         <?php $random_data = xprofile_get_random_profile_data( bp_get_member_user_id(), true ); ?>
     1380    if ( bp_is_active( 'xprofile' ) ) {
     1381        $random_data = xprofile_get_random_profile_data( bp_get_member_user_id(), true );
     1382        // phpcs:disable WordPress.Security.EscapeOutput
     1383        ?>
    13731384            <strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong>
    13741385            <?php echo wp_filter_kses( $random_data[0]->value ) ?>
    1375     <?php }
     1386        <?php
     1387        // phpcs:enable
     1388    }
    13761389}
    13771390
     
    14141427    $search_form_html = '<form action="" method="get" id="search-members-form">
    14151428        <label for="members_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
    1416         <input type="submit" id="members_search_submit" name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
     1429        <input type="submit" id="members_search_submit" name="members_search_submit" value="' . esc_html__( 'Search', 'buddypress' ) . '" />
    14171430    </form>';
    14181431
    1419     /**
    1420      * Filters the Members component search form.
    1421      *
    1422      * @since 1.9.0
    1423      *
    1424      * @param string $search_form_html HTML markup for the member search form.
    1425      */
    1426     echo apply_filters( 'bp_directory_members_search_form', $search_form_html );
     1432    // phpcs:ignore WordPress.Security.EscapeOutput
     1433    echo apply_filters(
     1434        /**
     1435         * Filters the Members component search form.
     1436         *
     1437         * @since 1.9.0
     1438         *
     1439         * @param string $search_form_html HTML markup for the member search form.
     1440         */
     1441        'bp_directory_members_search_form',
     1442        $search_form_html
     1443    );
    14271444}
    14281445
     
    14331450 */
    14341451function bp_total_site_member_count() {
    1435     echo bp_get_total_site_member_count();
     1452    echo esc_html( bp_get_total_site_member_count() );
    14361453}
    14371454    /**
     
    15021519        }
    15031520
    1504         // Echo out the final list item.
    1505         echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item->css_id, array( '<li id="li-nav-' . $nav_item->css_id . '" ' . $selected . '><a id="my-' . $nav_item->css_id . '" href="' . $nav_item->link . '">' . $nav_item->name . '</a></li>', &$nav_item ) );
     1521        // phpcs:ignore WordPress.Security.EscapeOutput
     1522        echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item->css_id, array( '<li id="li-nav-' . esc_attr( $nav_item->css_id ) . '" ' . $selected . '><a id="my-' . esc_attr( $nav_item->css_id ) . '" href="' . esc_url( $nav_item->link ) . '">' . esc_html( $nav_item->name ) . '</a></li>', &$nav_item ) );
    15061523    }
    15071524
    15081525    // Always add a log out list item to the end of the navigation.
    1509     $logout_link = '<li><a id="wp-logout" href="' .  wp_logout_url( bp_get_root_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
    1510 
     1526    $logout_link = '<li><a id="wp-logout" href="' .  esc_url( wp_logout_url( bp_get_root_url() ) ) . '">' . esc_html__( 'Log Out', 'buddypress' ) . '</a></li>';
     1527
     1528    // phpcs:ignore WordPress.Security.EscapeOutput
    15111529    echo apply_filters( 'bp_logout_nav_link', $logout_link );
    15121530}
     
    16301648        }
    16311649
    1632         /**
    1633          * Filters the navigation markup for the displayed user.
    1634          *
    1635          * This is a dynamic filter that is dependent on the navigation tab component being rendered.
    1636          *
    1637          * @since 1.1.0
    1638          *
    1639          * @param string $value         Markup for the tab list item including link.
    1640          * @param array  $user_nav_item Array holding parts used to construct tab list item.
    1641          *                              Passed by reference.
    1642          */
    1643         echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item->css_id, array( '<li id="' . $user_nav_item->css_id . '-personal-li" ' . $selected . '><a id="user-' . $user_nav_item->css_id . '" href="' . $link . '">' . $user_nav_item->name . '</a></li>', &$user_nav_item ) );
     1650        // phpcs:ignore WordPress.Security.EscapeOutput
     1651        echo apply_filters_ref_array(
     1652            /**
     1653             * Filters the navigation markup for the displayed user.
     1654             *
     1655             * This is a dynamic filter that is dependent on the navigation tab component being rendered.
     1656             *
     1657             * @since 1.1.0
     1658             *
     1659             * @param string $value         Markup for the tab list item including link.
     1660             * @param array  $user_nav_item Array holding parts used to construct tab list item.
     1661             *                              Passed by reference.
     1662             */
     1663            'bp_get_displayed_user_nav_' . $user_nav_item->css_id,
     1664            array(
     1665                '<li id="' . esc_attr( $user_nav_item->css_id ) . '-personal-li" ' . $selected . '><a id="user-' . esc_attr( $user_nav_item->css_id ) . '" href="' . esc_url( $link ) . '">' . wp_kses( $user_nav_item->name, array( 'span' => array( 'class' => true ) ) ) . '</a></li>',
     1666                &$user_nav_item
     1667            )
     1668        );
    16441669    }
    16451670}
     
    16711696 */
    16721697function bp_loggedin_user_avatar( $args = '' ) {
     1698    // phpcs:ignore WordPress.Security.EscapeOutput
    16731699    echo bp_get_loggedin_user_avatar( $args );
    16741700}
     
    17301756 */
    17311757function bp_displayed_user_avatar( $args = '' ) {
     1758    // phpcs:ignore WordPress.Security.EscapeOutput
    17321759    echo bp_get_displayed_user_avatar( $args );
    17331760}
     
    17851812 */
    17861813function bp_displayed_user_email() {
    1787     echo bp_get_displayed_user_email();
     1814    echo esc_html( bp_get_displayed_user_email() );
    17881815}
    17891816    /**
     
    18241851 */
    18251852function bp_last_activity( $user_id = 0 ) {
    1826     echo bp_get_last_activity( $user_id );
     1853    echo esc_html( bp_get_last_activity( $user_id ) );
    18271854}
    18281855    /**
     
    18611888 */
    18621889function bp_user_firstname() {
    1863     echo bp_get_user_firstname();
     1890    echo esc_html( bp_get_user_firstname() );
    18641891}
    18651892    /**
     
    19932020     * @param string $url Generated link for the displayed user's profile.
    19942021     */
    1995     return apply_filters( 'bp_displayed_user_domain',$url );
     2022    return apply_filters( 'bp_displayed_user_domain', $url );
    19962023}
    19972024
     
    20892116 */
    20902117function bp_displayed_user_fullname() {
    2091     echo bp_get_displayed_user_fullname();
     2118    echo esc_html( bp_get_displayed_user_fullname() );
    20922119}
    20932120    /**
     
    21162143     * @since 1.0.0
    21172144     */
    2118     function bp_user_fullname() { echo bp_get_displayed_user_fullname(); }
     2145    function bp_user_fullname() { echo esc_html( bp_get_displayed_user_fullname() ); }
    21192146
    21202147
     
    21252152 */
    21262153function bp_loggedin_user_fullname() {
    2127     echo bp_get_loggedin_user_fullname();
     2154    echo esc_html( bp_get_loggedin_user_fullname() );
    21282155}
    21292156    /**
     
    21532180 */
    21542181function bp_displayed_user_username() {
    2155     echo bp_get_displayed_user_username();
     2182    echo esc_html( bp_get_displayed_user_username() );
    21562183}
    21572184    /**
     
    21872214 */
    21882215function bp_loggedin_user_username() {
    2189     echo bp_get_loggedin_user_username();
     2216    echo esc_html( bp_get_loggedin_user_username() );
    21902217}
    21912218    /**
     
    22212248 */
    22222249function bp_current_member_type_message() {
    2223     echo bp_get_current_member_type_message();
     2250    echo wp_kses( bp_get_current_member_type_message(), array( 'strong' => true ) );
    22242251}
    22252252    /**
     
    22542281 */
    22552282function bp_member_type_directory_link( $member_type = '' ) {
     2283    // phpcs:ignore WordPress.Security.EscapeOutput
    22562284    echo bp_get_member_type_directory_link( $member_type );
    22572285}
     
    23022330 */
    23032331function bp_member_type_list( $user_id = 0, $r = array() ) {
     2332    // phpcs:ignore WordPress.Security.EscapeOutput
    23042333    echo bp_get_member_type_list( $user_id, $r );
    23052334}
     
    25772606 */
    25782607function bp_signup_username_value() {
    2579     echo bp_get_signup_username_value();
     2608    echo esc_html( bp_get_signup_username_value() );
    25802609}
    25812610    /**
     
    26092638 */
    26102639function bp_signup_email_value() {
    2611     echo bp_get_signup_email_value();
     2640    echo esc_html( bp_get_signup_email_value() );
    26122641}
    26132642    /**
     
    26472676 */
    26482677function bp_signup_with_blog_value() {
    2649     echo bp_get_signup_with_blog_value();
     2678    echo intval( bp_get_signup_with_blog_value() );
    26502679}
    26512680    /**
     
    26772706 */
    26782707function bp_signup_blog_url_value() {
    2679     echo bp_get_signup_blog_url_value();
     2708    echo esc_url( bp_get_signup_blog_url_value() );
    26802709}
    26812710    /**
     
    27092738 */
    27102739function bp_signup_subdomain_base() {
    2711     echo bp_signup_get_subdomain_base();
     2740    echo esc_url( bp_signup_get_subdomain_base() );
    27122741}
    27132742    /**
     
    27452774 */
    27462775function bp_signup_blog_title_value() {
    2747     echo bp_get_signup_blog_title_value();
     2776    echo esc_html( bp_get_signup_blog_title_value() );
    27482777}
    27492778    /**
     
    27772806 */
    27782807function bp_signup_blog_privacy_value() {
    2779     echo bp_get_signup_blog_privacy_value();
     2808    echo esc_html( bp_get_signup_blog_privacy_value() );
    27802809}
    27812810    /**
     
    28092838 */
    28102839function bp_signup_avatar_dir_value() {
    2811     echo bp_get_signup_avatar_dir_value();
     2840    echo esc_html( bp_get_signup_avatar_dir_value() );
    28122841}
    28132842    /**
     
    28222851
    28232852        // Check if signup_avatar_dir is passed.
    2824         if ( !empty( $_POST['signup_avatar_dir'] ) )
     2853        if ( ! empty( $_POST['signup_avatar_dir'] ) ) {
    28252854            $signup_avatar_dir = $_POST['signup_avatar_dir'];
    28262855
    2827         // If not, check if global is set.
    2828         elseif ( !empty( $bp->signup->avatar_dir ) )
     2856            // If not, check if global is set.
     2857        } elseif ( ! empty( $bp->signup->avatar_dir ) ) {
    28292858            $signup_avatar_dir = $bp->signup->avatar_dir;
    28302859
    2831         // If not, set false.
    2832         else
     2860            // If not, set false.
     2861        } else {
    28332862            $signup_avatar_dir = false;
     2863        }
    28342864
    28352865        /**
     
    28722902 */
    28732903function bp_current_signup_step() {
    2874     echo bp_get_current_signup_step();
     2904    echo esc_html( bp_get_current_signup_step() );
    28752905}
    28762906    /**
     
    28952925 */
    28962926function bp_signup_avatar( $args = '' ) {
     2927    // phpcs:ignore WordPress.Security.EscapeOutput
    28972928    echo bp_get_signup_avatar( $args );
    28982929}
     
    29242955        );
    29252956
    2926         extract( $r, EXTR_SKIP );
    2927 
    29282957        $signup_avatar_dir = bp_get_signup_avatar_dir_value();
    29292958
     
    29352964                'avatar_dir' => 'avatars/signups',
    29362965                'type'       => 'full',
    2937                 'width'      => $size,
    2938                 'height'     => $size,
    2939                 'alt'        => $alt,
    2940                 'class'      => $class,
     2966                'width'      => $r['size'],
     2967                'height'     => $r['size'],
     2968                'alt'        => $r['alt'],
     2969                'class'      => $r['class'],
    29412970            ) );
    29422971
     
    29622991            $gravatar_url    = apply_filters( 'bp_gravatar_url', '//www.gravatar.com/avatar/' );
    29632992            $md5_lcase_email = md5( strtolower( bp_get_signup_email_value() ) );
    2964             $gravatar_img    = '<img src="' . $gravatar_url . $md5_lcase_email . '?d=' . $default_grav . '&amp;s=' . $size . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />';
     2993            $gravatar_img    = '<img src="' . $gravatar_url . $md5_lcase_email . '?d=' . $default_grav . '&amp;s=' . $r['size'] . '" width="' . esc_attr( $r['size'] ) . '" height="' . esc_attr( $r['size'] ) . '" alt="' . esc_attr( $r['alt'] ) . '" class="' . esc_attr( $r['class'] ) . '" />';
    29652994        }
    29662995
     
    29843013 */
    29853014function bp_signup_allowed() {
     3015    // phpcs:ignore WordPress.Security.EscapeOutput
    29863016    echo bp_get_signup_allowed();
    29873017}
     
    30813111 */
    30823112function bp_members_activity_feed() {
    3083     if ( !bp_is_active( 'activity' ) || !bp_is_user() )
    3084         return; ?>
    3085 
    3086     <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_displayed_user_fullname() ?> | <?php _e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" />
    3087 
    3088 <?php
     3113    if ( ! bp_is_active( 'activity' ) || ! bp_is_user() ) {
     3114        return;
     3115    }
     3116    // phpcs:disable WordPress.Security.EscapeOutput
     3117    ?>
     3118    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_displayed_user_fullname() ?> | <?php esc_attr_e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" />
     3119    <?php
     3120    // phpcs:enable
    30893121}
    30903122add_action( 'bp_head', 'bp_members_activity_feed' );
     
    31703202 */
    31713203function bp_avatar_delete_link() {
    3172     echo bp_get_avatar_delete_link();
     3204    echo esc_url( bp_get_avatar_delete_link() );
    31733205}
    31743206    /**
     
    33123344 */
    33133345function bp_members_invitations_pagination_count() {
    3314     echo bp_get_members_invitations_pagination_count();
     3346    echo esc_html( bp_get_members_invitations_pagination_count() );
    33153347}
    33163348    /**
     
    33523384 */
    33533385function bp_members_invitations_pagination_links() {
     3386    // phpcs:ignore WordPress.Security.EscapeOutput
    33543387    echo bp_get_members_invitations_pagination_links();
    33553388}
     
    33883421    }
    33893422
    3390     /**
    3391      * Use this filter to sanitize the output.
    3392      *
    3393      * @since 8.0.0
    3394      *
    3395      * @param int|string $value    The value for the requested property.
    3396      * @param string     $property The name of the requested property.
    3397      * @param string     $context  The context of display.
    3398      */
    3399     echo apply_filters( 'bp_the_members_invitation_property', bp_get_the_members_invitation_property( $property ), $property, $context );
     3423    // phpcs:ignore WordPress.Security.EscapeOutput
     3424    echo apply_filters(
     3425        /**
     3426         * Use this filter to sanitize the output.
     3427         *
     3428         * @since 8.0.0
     3429         *
     3430         * @param int|string $value    The value for the requested property.
     3431         * @param string     $property The name of the requested property.
     3432         * @param string     $context  The context of display.
     3433         */
     3434        'bp_the_members_invitation_property',
     3435        bp_get_the_members_invitation_property( $property ),
     3436        $property,
     3437        $context
     3438    );
    34003439}
    34013440    /**
     
    34523491 */
    34533492function bp_the_members_invitation_action_links( $args = '' ) {
     3493    // phpcs:ignore WordPress.Security.EscapeOutput
    34543494    echo bp_get_the_members_invitation_action_links( $args );
    34553495}
     
    35083548 */
    35093549function bp_the_members_invitations_resend_link( $user_id = 0 ) {
     3550    // phpcs:ignore WordPress.Security.EscapeOutput
    35103551    echo bp_get_the_members_invitation_delete_link( $user_id );
    35113552}
     
    35273568        }
    35283569
    3529         $retval = sprintf( '<a href="%1$s" class="resend secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_members_invitations_resend_url( $user_id ) ), __( 'Resend', 'buddypress' ) );
     3570        $retval = sprintf( '<a href="%1$s" class="resend secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_members_invitations_resend_url( $user_id ) ), esc_html__( 'Resend', 'buddypress' ) );
    35303571
    35313572        /**
     
    35993640 */
    36003641function bp_the_members_invitations_delete_link( $user_id = 0 ) {
     3642    // phpcs:ignore WordPress.Security.EscapeOutput
    36013643    echo bp_get_the_members_invitation_delete_link( $user_id );
    36023644}
     
    36963738 */
    36973739function bp_members_invitations_list_invites_permalink( $user_id = 0 ) {
    3698     echo bp_get_members_invitations_list_invites_permalink( $user_id );
     3740    echo esc_url( bp_get_members_invitations_list_invites_permalink( $user_id ) );
    36993741}
    37003742    /**
     
    37343776 */
    37353777function bp_members_invitations_send_invites_permalink( $user_id = 0 ) {
    3736     echo bp_get_members_invitations_send_invites_permalink( $user_id );
     3778    echo esc_url( bp_get_members_invitations_send_invites_permalink( $user_id ) );
    37373779}
    37383780    /**
  • trunk/src/bp-members/bp-members-widgets.php

    r13481 r13799  
    1212defined( 'ABSPATH' ) || exit;
    1313
    14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     14_deprecated_file( basename( __FILE__ ), '12.0.0', '', esc_html__( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
  • trunk/src/bp-members/classes/class-bp-core-members-template.php

    r13414 r13799  
    128128        // Backward compatibility with old method of passing arguments.
    129129        if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
    130             _deprecated_argument( __METHOD__, '7.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     130            _deprecated_argument( __METHOD__, '7.0.0', sprintf( esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
    131131
    132132            $old_args_keys = array(
  • trunk/src/bp-members/classes/class-bp-core-members-widget.php

    r13481 r13799  
    1212defined( 'ABSPATH' ) || exit;
    1313
    14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     14_deprecated_file( basename( __FILE__ ), '12.0.0', '', esc_html__( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
    1515
    1616/**
  • trunk/src/bp-members/classes/class-bp-core-recently-active-widget.php

    r13481 r13799  
    1212defined( 'ABSPATH' ) || exit;
    1313
    14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     14_deprecated_file( basename( __FILE__ ), '12.0.0', '', esc_html__( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
    1515
    1616/**
  • trunk/src/bp-members/classes/class-bp-core-whos-online-widget.php

    r13481 r13799  
    1212defined( 'ABSPATH' ) || exit;
    1313
    14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     14_deprecated_file( basename( __FILE__ ), '12.0.0', '', esc_html__( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
    1515
    1616/**
  • trunk/src/bp-members/classes/class-bp-members-admin.php

    r13795 r13799  
    923923            if ( current_user_can( 'edit_user', $user->ID ) ) : ?>
    924924
    925                 <a class="nav-tab<?php echo esc_attr( $wp_active ); ?>" href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'Profile', 'buddypress' ); ?></a>
     925                <a class="nav-tab<?php echo esc_attr( $wp_active ); ?>" href="<?php echo esc_url( $wordpress_url );?>"><?php esc_html_e( 'Profile', 'buddypress' ); ?></a>
    926926
    927927            <?php endif; ?>
    928928
    929             <a class="nav-tab<?php echo esc_attr( $bp_active ); ?>" href="<?php echo esc_url( $community_url );?>"><?php _e( 'Extended Profile', 'buddypress' ); ?></a>
     929            <a class="nav-tab<?php echo esc_attr( $bp_active ); ?>" href="<?php echo esc_url( $community_url );?>"><?php esc_html_e( 'Extended Profile', 'buddypress' ); ?></a>
    930930        </h2>
    931931
     
    950950        // Can current user edit this profile?
    951951        if ( ! $this->member_can_edit( $user_id ) ) {
    952             wp_die( __( 'You cannot edit the requested user.', 'buddypress' ) );
     952            wp_die( esc_html__( 'You cannot edit the requested user.', 'buddypress' ) );
    953953        }
    954954
     
    12481248            <?php else : ?>
    12491249
    1250                 <p><?php
     1250                <p>
     1251                    <?php
    12511252                    printf(
    12521253                        '%1$s <a href="%2$s">%3$s</a>',
    1253                         __( 'No user found with this ID.', 'buddypress' ),
     1254                        esc_html__( 'No user found with this ID.', 'buddypress' ),
    12541255                        esc_url( bp_get_admin_url( 'users.php' ) ),
    1255                         __( 'Go back and try again.', 'buddypress' )
     1256                        esc_html__( 'Go back and try again.', 'buddypress' )
    12561257                    );
    1257                 ?></p>
     1258                    ?>
     1259                </p>
    12581260
    12591261            <?php endif; ?>
     
    13251327                            <?php
    13261328                            /* translators: %s: registration date */
    1327                             printf( __( 'Registered on: %s', 'buddypress' ), '<strong>' . $date . '</strong>' );
     1329                            printf( esc_html__( 'Registered on: %s', 'buddypress' ), '<strong>' . esc_html( $date ) . '</strong>' );
    13281330                            ?>
    13291331                        </span>
     
    13601362            <?php
    13611363            /* translators: %s: member name */
    1362             printf( __( '%s has been marked as a spammer. All BuddyPress data associated with the user has been removed', 'buddypress' ), esc_html( bp_core_get_user_displayname( $user->ID ) ) );
     1364            printf( esc_html__( '%s has been marked as a spammer. All BuddyPress data associated with the user has been removed', 'buddypress' ), esc_html( bp_core_get_user_displayname( $user->ID ) ) );
    13631365            ?>
    13641366        </p>
     
    13961398                <?php
    13971399                /* translators: %s: date */
    1398                 printf( __( 'Last active: %1$s', 'buddypress' ), '<strong>' . $date . '</strong>' );
     1400                printf( esc_html__( 'Last active: %1$s', 'buddypress' ), '<strong>' . esc_html( $date ) . '</strong>' );
    13991401                ?>
    14001402            </li>
     
    14351437        <div class="avatar">
    14361438
    1437             <?php echo bp_core_fetch_avatar( array(
    1438                 'item_id' => $user->ID,
    1439                 'object'  => 'user',
    1440                 'type'    => 'full',
    1441                 'title'   => $user->display_name
    1442             ) ); ?>
     1439            <?php
     1440            // Escaping is done in `bp_core_fetch_avatar()`.
     1441            // phpcs:ignore WordPress.Security.EscapeOutput
     1442            echo bp_core_fetch_avatar(
     1443                array(
     1444                    'item_id' => $user->ID,
     1445                    'object'  => 'user',
     1446                    'type'    => 'full',
     1447                    'title'   => $user->display_name
     1448                )
     1449            );
     1450            ?>
    14431451
    14441452            <?php if ( bp_get_user_has_avatar( $user->ID ) ) :
     
    21712179                    $notice = array(
    21722180                        'class'   => 'error',
    2173                         'message' => esc_html__( 'There was a problem sending the activation emails. Please try again.', 'buddypress' ),
     2181                        'message' => __( 'There was a problem sending the activation emails. Please try again.', 'buddypress' ),
    21742182                    );
    21752183                    break;
     
    21782186                    $notice = array(
    21792187                        'class'   => 'error',
    2180                         'message' => esc_html__( 'There was a problem activating accounts. Please try again.', 'buddypress' ),
     2188                        'message' => __( 'There was a problem activating accounts. Please try again.', 'buddypress' ),
    21812189                    );
    21822190                    break;
     
    21852193                    $notice = array(
    21862194                        'class'   => 'error',
    2187                         'message' => esc_html__( 'There was a problem deleting sign-ups. Please try again.', 'buddypress' ),
     2195                        'message' => __( 'There was a problem deleting sign-ups. Please try again.', 'buddypress' ),
    21882196                    );
    21892197                    break;
     
    22252233            <?php endif; ?>
    22262234
    2227                 <p><?php echo $notice['message']; ?></p>
     2235                <p><?php echo esc_html( $notice['message'] ); ?></p>
    22282236
    22292237                <?php if ( ! empty( $_REQUEST['notactivated'] ) || ! empty( $_REQUEST['notdeleted'] ) || ! empty( $_REQUEST['notsent'] ) ) :?>
     
    23072315
    23082316        <div class="wrap">
    2309             <h1 class="wp-heading-inline"><?php _e( 'Users', 'buddypress' ); ?></h1>
     2317            <h1 class="wp-heading-inline"><?php esc_html_e( 'Users', 'buddypress' ); ?></h1>
    23102318
    23112319            <?php if ( current_user_can( 'create_users' ) ) : ?>
     
    23202328
    23212329            if ( $usersearch ) {
    2322                 printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'buddypress' ) . '</span>', esc_html( $usersearch ) );
     2330                printf( '<span class="subtitle">' . esc_html__( 'Search results for &#8220;%s&#8221;', 'buddypress' ) . '</span>', esc_html( $usersearch ) );
    23232331            }
    23242332            ?>
     
    24932501                                <tr>
    24942502                                    <td class="column-fields"><?php esc_html_e( 'Email', 'buddypress' ); ?></td>
    2495                                     <td><?php echo sanitize_email( $signup->user_email ); ?></td>
     2503                                    <td><?php echo esc_html( $signup->user_email ); ?></td>
    24962504                                </tr>
    24972505
     
    25012509                                        <tr>
    25022510                                            <td class="column-fields"><?php echo esc_html( $fdata[ $pid ] ); ?></td>
    2503                                             <td><?php echo bp_members_admin_format_xprofile_field_for_display( $field_value ); ?></td>
     2511                                            <td>
     2512                                                <?php
     2513                                                // phpcs:ignore WordPress.Security.EscapeOutput
     2514                                                echo bp_members_admin_format_xprofile_field_for_display( $field_value );
     2515                                                ?>
     2516                                            </td>
    25042517                                        </tr>
    25052518
     
    25402553                            <?php
    25412554                            /* translators: %s: notification date */
    2542                             printf( esc_html__( 'Last notified: %s', 'buddypress'), $last_notified );
     2555                            printf( esc_html__( 'Last notified: %s', 'buddypress'), esc_html( $last_notified ) );
    25432556                            ?>
    25442557
     
    25952608        $id_name = 'bottom' === $which ? 'bp_change_type2' : 'bp_change_type';
    25962609
    2597         $types = bp_get_member_types( array(), 'objects' ); ?>
    2598 
    2599         <label class="screen-reader-text" for="<?php echo $id_name; ?>"><?php _e( 'Change member type to&hellip;', 'buddypress' ) ?></label>
     2610        $types = bp_get_member_types( array(), 'objects' );
     2611
     2612        // phpcs:disable WordPress.Security.EscapeOutput
     2613        ?>
     2614        <label class="screen-reader-text" for="<?php echo $id_name; ?>"><?php esc_html_e( 'Change member type to&hellip;', 'buddypress' ) ?></label>
    26002615        <select name="<?php echo $id_name; ?>" id="<?php echo $id_name; ?>" style="display:inline-block;float:none;">
    2601             <option value=""><?php _e( 'Change member type to&hellip;', 'buddypress' ) ?></option>
     2616            <option value=""><?php esc_html_e( 'Change member type to&hellip;', 'buddypress' ) ?></option>
    26022617
    26032618            <?php foreach( $types as $type ) : ?>
     
    26072622            <?php endforeach; ?>
    26082623
    2609             <option value="remove_member_type"><?php _e( 'No Member Type', 'buddypress' ) ?></option>
     2624            <option value="remove_member_type"><?php esc_html_e( 'No Member Type', 'buddypress' ) ?></option>
    26102625
    26112626        </select>
    26122627        <?php
     2628        // phpcs:enable
     2629
    26132630        wp_nonce_field( 'bp-bulk-users-change-type-' . bp_loggedin_user_id(), 'bp-bulk-users-change-type-nonce' );
    26142631        submit_button( __( 'Change', 'buddypress' ), 'button', 'bp_change_member_type', false );
     
    31333150            <?php endif; ?>
    31343151
    3135                 <p><?php echo $notice['message']; ?></p>
     3152                <p><?php echo esc_html( $notice['message'] ); ?></p>
    31363153            </div>
    31373154
     
    32093226            <?php
    32103227            if ( $usersearch ) {
    3211                 printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'buddypress' ) . '</span>', esc_html( $usersearch ) );
     3228                printf( '<span class="subtitle">' . esc_html__( 'Search results for &#8220;%s&#8221;', 'buddypress' ) . '</span>', esc_html( $usersearch ) );
    32123229            }
    32133230            ?>
     
    33473364                                    <?php
    33483365                                    /* translators: %s: notification date */
    3349                                     printf( esc_html__( 'Last notified: %s', 'buddypress'), $last_notified );
     3366                                    printf( esc_html__( 'Last notified: %s', 'buddypress'), esc_html( $last_notified ) );
    33503367                                    ?>
    33513368                                </p>
  • trunk/src/bp-members/classes/class-bp-members-invitations-list-table.php

    r13469 r13799  
    259259            );
    260260
    261             /* translators: %s: url to site settings */
    262             printf( __( 'Invitations are not allowed. %s', 'buddypress' ), $link );
     261            printf(
     262                /* translators: %s: url to site settings */
     263                esc_html__( 'Invitations are not allowed. %s', 'buddypress' ),
     264                // The link has been escaped at line 255.
     265                // phpcs:ignore WordPress.Security.EscapeOutput
     266                $link
     267            );
    263268        }
    264269
     
    288293        $style = '';
    289294        foreach ( $this->items as $invite ) {
    290             $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
     295            $style = 'alt' === $style ? '' : 'alt';
     296
     297            // Escapes are made into `self::single_row()`.
     298            // phpcs:ignore WordPress.Security.EscapeOutput
    291299            echo "\n\t" . $this->single_row( $invite, $style );
    292300        }
     
    307315     */
    308316    public function single_row( $invite = null, $style = '', $role = '', $numposts = 0 ) {
    309         echo '<tr' . $style . ' id="invitation-' . esc_attr( $invite->id ) . '">';
     317        if ( '' === $style ) {
     318            echo '<tr id="signup-' . esc_attr( $invite->id ) . '">';
     319        } else {
     320            echo '<tr class="alternate" id="signup-' . esc_attr( $invite->id ) . '">';
     321        }
     322
     323        // BuddyPress relies on WordPress's `WP_Users_List_Table::single_row_columns()`.
     324        // phpcs:ignore WordPress.Security.EscapeOutput
    310325        echo $this->single_row_columns( $invite );
    311326        echo '</tr>';
     
    324339            <?php
    325340                /* translators: accessibility text */
    326                 printf( esc_html__( 'Select invitation: %s', 'buddypress' ), $invite->id );
     341                printf( esc_html__( 'Select invitation: %s', 'buddypress' ), intval( $invite->id ) );
    327342            ?>
    328343        </label>
     
    396411        $actions = apply_filters( 'bp_members_invitations_management_row_actions', $actions, $invite );
    397412
     413        // BuddyPress relies on WordPress's `WP_Users_List_Table::row_actions()`.
     414        // phpcs:ignore WordPress.Security.EscapeOutput
    398415        echo $this->row_actions( $actions );
    399416    }
     
    426443        $user_link = bp_members_get_user_url( $invite->inviter_id );
    427444
    428         printf( '%1$s <strong><a href="%2$s" class="edit">%3$s</a></strong><br/>', $avatar, esc_url( $user_link ), esc_html( $inviter->user_login ) );
     445        printf(
     446            '%1$s <strong><a href="%2$s" class="edit">%3$s</a></strong><br/>',
     447            wp_kses(
     448                $avatar,
     449                array(
     450                    'img' => array(
     451                        'alt'    => true,
     452                        'src'    => true,
     453                        'srcset' => true,
     454                        'class'  => true,
     455                        'height' => true,
     456                        'width'  => true,
     457                    )
     458                )
     459            ),
     460            esc_url( $user_link ),
     461            esc_html( $inviter->user_login )
     462        );
    429463    }
    430464
  • trunk/src/bp-members/classes/class-bp-members-list-table.php

    r13499 r13799  
    216216            }
    217217
    218             /* translators: %s: url to site settings */
    219             printf( __( 'Registration is disabled. %s', 'buddypress' ), $link );
     218            printf(
     219                /* translators: %s: url to site settings */
     220                esc_html__( 'Registration is disabled. %s', 'buddypress' ),
     221                // The link has been escaped at line 213 & 215.
     222                // phpcs:ignore WordPress.Security.EscapeOutput
     223                $link
     224            );
    220225        }
    221226
     
    249254            }
    250255
    251             $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
     256            $style = 'alt' === $style ? '' : 'alt';
     257
     258            // Escapes are made into `self::single_row()`.
     259            // phpcs:ignore WordPress.Security.EscapeOutput
    252260            echo "\n\t" . $this->single_row( $signup_object, $style );
    253261        }
     
    268276     */
    269277    public function single_row( $signup_object = null, $style = '', $role = '', $numposts = 0 ) {
    270         echo '<tr' . $style . ' id="signup-' . esc_attr( $signup_object->id ) . '">';
     278        if ( '' === $style ) {
     279            echo '<tr id="signup-' . esc_attr( $signup_object->id ) . '">';
     280        } else {
     281            echo '<tr class="alternate" id="signup-' . esc_attr( $signup_object->id ) . '">';
     282        }
     283
     284        // BuddyPress relies on WordPress's `WP_Users_List_Table::single_row_columns()`.
     285        // phpcs:ignore WordPress.Security.EscapeOutput
    271286        echo $this->single_row_columns( $signup_object );
    272287        echo '</tr>';
     
    282297    public function column_cb( $signup_object = null ) {
    283298    ?>
    284         <label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>"><?php
    285             /* translators: accessibility text */
    286             printf( esc_html__( 'Select user: %s', 'buddypress' ), $signup_object->user_login );
    287         ?></label>
     299        <label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>">
     300            <?php
     301            printf(
     302                /* translators: accessibility text */
     303                esc_html__( 'Select user: %s', 'buddypress' ),
     304                esc_html( $signup_object->user_login )
     305            );
     306            ?>
     307        </label>
    288308        <input type="checkbox" id="signup_<?php echo intval( $signup_object->id ) ?>" name="allsignups[]" value="<?php echo esc_attr( $signup_object->id ) ?>" />
    289309        <?php
     
    330350        );
    331351
    332         echo $avatar . sprintf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $activate_link ), $signup_object->user_login );
     352        echo wp_kses(
     353            $avatar,
     354            array(
     355                'img' => array(
     356                    'alt'    => true,
     357                    'src'    => true,
     358                    'srcset' => true,
     359                    'class'  => true,
     360                    'height' => true,
     361                    'width'  => true,
     362                )
     363            )
     364        );
     365        printf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $activate_link ), esc_html( $signup_object->user_login ) );
    333366
    334367        $actions = array();
    335368
    336         $actions['activate'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $activate_link ), __( 'Activate', 'buddypress' ) );
    337         $actions['resend']   = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link ), __( 'Email', 'buddypress' ) );
     369        $actions['activate'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $activate_link ), esc_html__( 'Activate', 'buddypress' ) );
     370        $actions['resend']   = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link ), esc_html__( 'Email', 'buddypress' ) );
    338371
    339372        if ( current_user_can( 'delete_users' ) ) {
    340             $actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), __( 'Delete', 'buddypress' ) );
     373            $actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), esc_html__( 'Delete', 'buddypress' ) );
    341374        }
    342375
     
    351384        $actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object );
    352385
     386        // BuddyPress relies on WordPress's `WP_Users_List_Table::row_actions()`.
     387        // phpcs:ignore WordPress.Security.EscapeOutput
    353388        echo $this->row_actions( $actions );
    354389    }
     
    407442     */
    408443    public function column_registered( $signup_object = null ) {
    409         echo mysql2date( 'Y/m/d g:i:s a', $signup_object->registered );
     444        echo esc_html( mysql2date( 'Y/m/d g:i:s a', $signup_object->registered ) );
    410445    }
    411446
     
    419454    public function column_date_sent( $signup_object = null ) {
    420455        if ( $signup_object->count_sent > 0 ) {
    421             echo mysql2date( 'Y/m/d g:i:s a', $signup_object->date_sent );
     456            echo esc_html( mysql2date( 'Y/m/d g:i:s a', $signup_object->date_sent ) );
    422457        } else {
    423             $message = __( 'Not yet notified', 'buddypress' );
     458            $message = esc_html__( 'Not yet notified', 'buddypress' );
    424459
    425460            /**
  • trunk/src/bp-members/classes/class-bp-members-ms-list-table.php

    r13499 r13799  
    205205            }
    206206
    207             /* translators: %s: url to site settings */
    208             printf( __( 'Registration is disabled. %s', 'buddypress' ), $link );
     207            printf(
     208                /* translators: %s: url to site settings */
     209                esc_html__( 'Registration is disabled. %s', 'buddypress' ),
     210                // The link has been escaped at line 204.
     211                // phpcs:ignore WordPress.Security.EscapeOutput
     212                $link
     213            );
    209214        }
    210215    }
     
    237242            }
    238243
    239             $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
     244            $style = 'alt' === $style ? '' : 'alt';
     245
     246            // Escapes are made into `self::single_row()`.
     247            // phpcs:ignore WordPress.Security.EscapeOutput
    240248            echo "\n\t" . $this->single_row( $signup_object, $style );
    241249        }
     
    253261     */
    254262    public function single_row( $signup_object = null, $style = '' ) {
    255         echo '<tr' . $style . ' id="signup-' . esc_attr( $signup_object->id ) . '">';
     263        if ( '' === $style ) {
     264            echo '<tr id="signup-' . esc_attr( $signup_object->id ) . '">';
     265        } else {
     266            echo '<tr class="alternate" id="signup-' . esc_attr( $signup_object->id ) . '">';
     267        }
     268
     269        // BuddyPress relies on WordPress's `WP_MS_Users_List_Table::single_row_columns()`.
     270        // phpcs:ignore WordPress.Security.EscapeOutput
    256271        echo $this->single_row_columns( $signup_object );
    257272        echo '</tr>';
     
    281296    public function column_cb( $signup_object = null ) {
    282297    ?>
    283         <label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>"><?php printf(
    284             /* translators: accessibility text */
    285             esc_html__( 'Select user: %s', 'buddypress' ), $signup_object->user_login );
    286         ?></label>
     298        <label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>">
     299            <?php
     300            printf(
     301                /* translators: accessibility text */
     302                esc_html__( 'Select user: %s', 'buddypress' ),
     303                esc_html( $signup_object->user_login )
     304            );
     305            ?>
     306        </label>
    287307        <input type="checkbox" id="signup_<?php echo intval( $signup_object->id ) ?>" name="allsignups[]" value="<?php echo esc_attr( $signup_object->id ) ?>" />
    288308        <?php
     
    329349        );
    330350
    331         echo $avatar . sprintf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $activate_link ), $signup_object->user_login );
     351        echo wp_kses(
     352            $avatar,
     353            array(
     354                'img' => array(
     355                    'alt'    => true,
     356                    'src'    => true,
     357                    'srcset' => true,
     358                    'class'  => true,
     359                    'height' => true,
     360                    'width'  => true,
     361                )
     362            )
     363        );
     364        printf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $activate_link ), esc_html( $signup_object->user_login ) );
    332365
    333366        $actions = array();
    334367
    335         $actions['activate'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $activate_link ), __( 'Activate', 'buddypress' ) );
    336         $actions['resend']   = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link    ), __( 'Email',    'buddypress' ) );
     368        $actions['activate'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $activate_link ), esc_html__( 'Activate', 'buddypress' ) );
     369        $actions['resend']   = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link    ), esc_html__( 'Email',    'buddypress' ) );
    337370
    338371        if ( current_user_can( 'delete_users' ) ) {
    339             $actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), __( 'Delete', 'buddypress' ) );
     372            $actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), esc_html__( 'Delete', 'buddypress' ) );
    340373        }
    341374
     
    343376        $actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object );
    344377
     378        // BuddyPress relies on WordPress's `WP_MS_Users_List_Table::row_actions()`.
     379        // phpcs:ignore WordPress.Security.EscapeOutput
    345380        echo $this->row_actions( $actions );
    346381    }
     
    409444            $date = 'Y/m/d';
    410445        } else {
    411             $date = 'Y/m/d \<\b\r \/\> g:i:s a';
    412         }
    413 
    414         echo mysql2date( $date, $signup_object->registered ) . "</td>";
     446            $date = "Y/m/d \n g:i:s a";
     447        }
     448
     449        echo nl2br( esc_html( mysql2date( $date, $signup_object->registered ) ) ) . "</td>";
    415450    }
    416451
     
    430465            $date = 'Y/m/d';
    431466        } else {
    432             $date = 'Y/m/d \<\b\r \/\> g:i:s a';
     467            $date = "Y/m/d \n g:i:s a";
    433468        }
    434469
    435470        if ( $signup_object->count_sent > 0 ) {
    436             echo mysql2date( $date, $signup_object->date_sent );
     471            echo nl2br( esc_html( mysql2date( $date, $signup_object->date_sent ) ) );
    437472        } else {
    438             $message = __( 'Not yet notified', 'buddypress' );
     473            $message = esc_html__( 'Not yet notified', 'buddypress' );
    439474
    440475            /**
  • trunk/src/bp-members/screens/register.php

    r13763 r13799  
    198198                 */
    199199                add_action( 'bp_' . $fieldname . '_errors', function() use ( $error_message, $fieldname ) {
    200                     /**
    201                      * Filter here to edit the error message about the invalid field value.
    202                      *
    203                      * @since 1.5.0
    204                      * @since 8.0.0 Adds the `$fieldname` parameter.
    205                      *
    206                      * @param string $value     Error message wrapped in html.
    207                      * @param string $fieldname The name of the signup field.
    208                      */
    209                     echo apply_filters( 'bp_members_signup_error_message', "<div class=\"error\">" . $error_message . "</div>", $fieldname );
     200                    echo wp_kses(
     201                        /**
     202                         * Filter here to edit the error message about the invalid field value.
     203                         *
     204                         * @since 1.5.0
     205                         * @since 8.0.0 Adds the `$fieldname` parameter.
     206                         *
     207                         * @param string $value     Error message wrapped in html.
     208                         * @param string $fieldname The name of the signup field.
     209                         */
     210                        apply_filters( 'bp_members_signup_error_message', "<div class=\"error\">" . $error_message . "</div>", $fieldname ),
     211                        array(
     212                            'div' => array( 'class' => true ),
     213                        )
     214                    );
    210215                } );
    211216            }
Note: See TracChangeset for help on using the changeset viewer.