Skip to:
Content

BuddyPress.org

Changeset 13808


Ignore:
Timestamp:
04/26/2024 05:44:26 AM (12 months ago)
Author:
imath
Message:

Groups component: improve PHP code standards using WPCS

See #7228 (trunk)

Location:
trunk/src/bp-groups
Files:
13 edited

Legend:

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

    r13482 r13808  
    535535 */
    536536function bp_groups_admin_screen_options( $value, $option, $new_value ) {
    537     if ( 'toplevel_page_bp_groups_per_page' != $option && 'toplevel_page_bp_groups_network_per_page' != $option )
     537    if ( 'toplevel_page_bp_groups_per_page' != $option && 'toplevel_page_bp_groups_network_per_page' != $option ) {
    538538        return $value;
     539    }
    539540
    540541    // Per page.
    541542    $new_value = (int) $new_value;
    542     if ( $new_value < 1 || $new_value > 999 )
     543    if ( $new_value < 1 || $new_value > 999 ) {
    543544        return $value;
     545    }
    544546
    545547    return $new_value;
     
    576578function bp_groups_admin_edit() {
    577579
    578     if ( ! bp_current_user_can( 'bp_moderate' ) )
     580    if ( ! bp_current_user_can( 'bp_moderate' ) ) {
    579581        die( '-1' );
     582    }
    580583
    581584    $messages = array();
    582585
    583586    // If the user has just made a change to a group, build status messages.
    584     if ( !empty( $_REQUEST['no_admins'] ) || ! empty( $_REQUEST['error'] ) || ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['error_new'] ) || ! empty( $_REQUEST['success_new'] ) || ! empty( $_REQUEST['error_modified'] ) || ! empty( $_REQUEST['success_modified'] ) ) {
     587    if ( ! empty( $_REQUEST['no_admins'] ) || ! empty( $_REQUEST['error'] ) || ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['error_new'] ) || ! empty( $_REQUEST['success_new'] ) || ! empty( $_REQUEST['error_modified'] ) || ! empty( $_REQUEST['success_modified'] ) ) {
    585588        $no_admins        = ! empty( $_REQUEST['no_admins']        ) ? 1                                             : 0;
    586589        $errors           = ! empty( $_REQUEST['error']            ) ? $_REQUEST['error']                            : '';
     
    653656
    654657    <div class="wrap">
    655         <h1 class="wp-heading-inline"><?php _e( 'Edit Group', 'buddypress' ); ?></h1>
     658        <h1 class="wp-heading-inline"><?php esc_html_e( 'Edit Group', 'buddypress' ); ?></h1>
    656659
    657660        <?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?>
     
    662665
    663666        <?php // If the user has just made a change to an group, display the status messages. ?>
    664         <?php if ( !empty( $messages ) ) : ?>
    665             <div id="moderated" class="<?php echo ( $is_error ) ? 'error' : 'updated'; ?> notice is-dismissible"><p><?php echo implode( "</p><p>", $messages ); ?></p></div>
     667        <?php if ( ! empty( $messages ) ) : ?>
     668            <div id="moderated" class="<?php echo esc_attr( ( $is_error ) ? 'error' : 'updated' ); ?> notice is-dismissible"><p><?php echo implode( "</p><p>", array_map( 'esc_html', $messages ) ); ?></p></div>
    666669        <?php endif; ?>
    667670
     
    675678                            <div id="postdiv">
    676679                                <div id="bp_groups_name" class="groupbox">
    677                                     <h2><?php _e( 'Name and Description', 'buddypress' ); ?></h2>
     680                                    <h2><?php esc_html_e( 'Name and Description', 'buddypress' ); ?></h2>
    678681                                    <div class="inside">
    679                                         <label for="bp-groups-name" class="screen-reader-text"><?php
    680                                             /* translators: accessibility text */
    681                                             _e( 'Group Name', 'buddypress' );
    682                                         ?></label>
     682                                        <label for="bp-groups-name" class="screen-reader-text">
     683                                            <?php
     684                                                /* translators: accessibility text */
     685                                                esc_html_e( 'Group Name', 'buddypress' );
     686                                            ?>
     687                                        </label>
    683688                                        <input type="text" name="bp-groups-name" id="bp-groups-name" value="<?php echo esc_attr( stripslashes( $group_name ) ) ?>" />
    684689                                        <div id="bp-groups-permalink-box">
     
    690695                                        </div>
    691696
    692                                         <label for="bp-groups-description" class="screen-reader-text"><?php
    693                                             /* translators: accessibility text */
    694                                             _e( 'Group Description', 'buddypress' );
    695                                         ?></label>
     697                                        <label for="bp-groups-description" class="screen-reader-text">
     698                                            <?php
     699                                                /* translators: accessibility text */
     700                                                esc_html_e( 'Group Description', 'buddypress' );
     701                                            ?>
     702                                        </label>
    696703                                        <?php wp_editor( stripslashes( $group->description ), 'bp-groups-description', array( 'media_buttons' => false, 'teeny' => true, 'textarea_rows' => 5, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
    697704                                    </div>
     
    718725        <?php else : ?>
    719726
    720             <p><?php
    721                 printf(
    722                     '%1$s <a href="%2$s">%3$s</a>',
    723                     __( 'No group found with this ID.', 'buddypress' ),
    724                     esc_url( bp_get_admin_url( 'admin.php?page=bp-groups' ) ),
    725                     __( 'Go back and try again.', 'buddypress' )
    726                 );
    727             ?></p>
     727            <p>
     728                <?php
     729                    printf(
     730                        '%1$s <a href="%2$s">%3$s</a>',
     731                        esc_html__( 'No group found with this ID.', 'buddypress' ),
     732                        esc_url( bp_get_admin_url( 'admin.php?page=bp-groups' ) ),
     733                        esc_html__( 'Go back and try again.', 'buddypress' )
     734                    );
     735                ?>
     736            </p>
    728737
    729738        <?php endif; ?>
     
    765774    }
    766775
    767     $base_url  = remove_query_arg( array( 'action', 'action2', 'paged', 's', '_wpnonce', 'gid' ), $_SERVER['REQUEST_URI'] ); ?>
     776    $base_url = remove_query_arg( array( 'action', 'action2', 'paged', 's', '_wpnonce', 'gid' ), $_SERVER['REQUEST_URI'] ); ?>
    768777
    769778    <div class="wrap">
    770         <h1 class="wp-heading-inline"><?php _e( 'Delete Groups', 'buddypress' ) ?></h1>
     779        <h1 class="wp-heading-inline"><?php esc_html_e( 'Delete Groups', 'buddypress' ) ?></h1>
    771780        <hr class="wp-header-end">
    772781
    773         <p><?php _e( 'You are about to delete the following groups:', 'buddypress' ) ?></p>
     782        <p><?php esc_html_e( 'You are about to delete the following groups:', 'buddypress' ) ?></p>
    774783
    775784        <ul class="bp-group-delete-list">
     
    779788        </ul>
    780789
    781         <p><strong><?php _e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p>
    782 
    783         <a class="button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'do_delete', 'gid' => implode( ',', $gids ) ), $base_url ), 'bp-groups-delete' ) ); ?>"><?php _e( 'Delete Permanently', 'buddypress' ) ?></a>
    784         <a class="button" href="<?php echo esc_attr( $base_url ); ?>"><?php _e( 'Cancel', 'buddypress' ) ?></a>
     790        <p><strong><?php esc_html_e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p>
     791
     792        <a class="button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'do_delete', 'gid' => implode( ',', $gids ) ), $base_url ), 'bp-groups-delete' ) ); ?>"><?php esc_html_e( 'Delete Permanently', 'buddypress' ) ?></a>
     793        <a class="button" href="<?php echo esc_attr( $base_url ); ?>"><?php esc_html_e( 'Cancel', 'buddypress' ) ?></a>
    785794    </div>
    786795
     
    830839    <div class="wrap">
    831840
    832         <h1 class="wp-heading-inline"><?php _e( 'Groups', 'buddypress' ); ?></h1>
     841        <h1 class="wp-heading-inline"><?php esc_html_e( 'Groups', 'buddypress' ); ?></h1>
    833842
    834843        <?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?>
     
    836845        <?php endif; ?>
    837846
    838         <?php if ( !empty( $_REQUEST['s'] ) ) : ?>
    839             <span class="subtitle"><?php printf( __( 'Search results for &#8220;%s&#8221;', 'buddypress' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ); ?></span>
     847        <?php if ( ! empty( $_REQUEST['s'] ) ) : ?>
     848            <span class="subtitle"><?php printf( esc_html__( 'Search results for &#8220;%s&#8221;', 'buddypress' ), esc_html( wp_html_excerpt( stripslashes( $_REQUEST['s'] ), 50 ) ) ); ?></span>
    840849        <?php endif; ?>
    841850
     
    843852
    844853        <?php // If the user has just made a change to an group, display the status messages. ?>
    845         <?php if ( !empty( $messages ) ) : ?>
    846             <div id="moderated" class="<?php echo ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated'; ?> notice is-dismissible"><p><?php echo implode( "<br/>\n", $messages ); ?></p></div>
     854        <?php if ( ! empty( $messages ) ) : ?>
     855            <div id="moderated" class="<?php echo esc_attr( ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated' ); ?> notice is-dismissible"><p><?php echo implode( "<br/>\n", array_map( 'esc_html', $messages ) ); ?></p></div>
    847856        <?php endif; ?>
    848857
     
    851860
    852861        <form id="bp-groups-form" action="" method="get">
    853             <?php $bp_groups_list_table->search_box( __( 'Search all Groups', 'buddypress' ), 'bp-groups' ); ?>
     862            <?php $bp_groups_list_table->search_box( esc_html__( 'Search all Groups', 'buddypress' ), 'bp-groups' ); ?>
    854863            <input type="hidden" name="page" value="<?php echo esc_attr( $plugin_page ); ?>" />
    855864            <?php $bp_groups_list_table->display(); ?>
     
    874883    <?php if ( bp_is_active( 'forums' ) ) : ?>
    875884        <div class="bp-groups-settings-section" id="bp-groups-settings-section-forum">
    876             <label for="group-show-forum"><input type="checkbox" name="group-show-forum" id="group-show-forum" <?php checked( $item->enable_forum ) ?> /> <?php _e( 'Enable discussion forum', 'buddypress' ) ?></label>
     885            <label for="group-show-forum"><input type="checkbox" name="group-show-forum" id="group-show-forum" <?php checked( $item->enable_forum ) ?> /> <?php esc_html_e( 'Enable discussion forum', 'buddypress' ) ?></label>
    877886        </div>
    878887    <?php endif; ?>
     
    880889    <div class="bp-groups-settings-section" id="bp-groups-settings-section-status">
    881890        <fieldset>
    882             <legend><?php _e( 'Privacy', 'buddypress' ); ?></legend>
    883 
    884             <label for="bp-group-status-public"><input type="radio" name="group-status" id="bp-group-status-public" value="public" <?php checked( $item->status, 'public' ) ?> /><?php _e( 'Public', 'buddypress' ) ?></label>
    885             <label for="bp-group-status-private"><input type="radio" name="group-status" id="bp-group-status-private" value="private" <?php checked( $item->status, 'private' ) ?> /><?php _e( 'Private', 'buddypress' ) ?></label>
    886             <label for="bp-group-status-hidden"><input type="radio" name="group-status" id="bp-group-status-hidden" value="hidden" <?php checked( $item->status, 'hidden' ) ?> /><?php _e( 'Hidden', 'buddypress' ) ?></label>
     891            <legend><?php esc_html_e( 'Privacy', 'buddypress' ); ?></legend>
     892
     893            <label for="bp-group-status-public"><input type="radio" name="group-status" id="bp-group-status-public" value="public" <?php checked( $item->status, 'public' ) ?> /><?php esc_html_e( 'Public', 'buddypress' ) ?></label>
     894            <label for="bp-group-status-private"><input type="radio" name="group-status" id="bp-group-status-private" value="private" <?php checked( $item->status, 'private' ) ?> /><?php esc_html_e( 'Private', 'buddypress' ) ?></label>
     895            <label for="bp-group-status-hidden"><input type="radio" name="group-status" id="bp-group-status-hidden" value="hidden" <?php checked( $item->status, 'hidden' ) ?> /><?php esc_html_e( 'Hidden', 'buddypress' ) ?></label>
    887896        </fieldset>
    888897    </div>
     
    890899    <div class="bp-groups-settings-section" id="bp-groups-settings-section-invite-status">
    891900        <fieldset>
    892             <legend><?php _e( 'Who can invite others to this group?', 'buddypress' ); ?></legend>
    893 
    894             <label for="bp-group-invite-status-members"><input type="radio" name="group-invite-status" id="bp-group-invite-status-members" value="members" <?php checked( $invite_status, 'members' ) ?> /><?php _e( 'All group members', 'buddypress' ) ?></label>
    895             <label for="bp-group-invite-status-mods"><input type="radio" name="group-invite-status" id="bp-group-invite-status-mods" value="mods" <?php checked( $invite_status, 'mods' ) ?> /><?php _e( 'Group admins and mods only', 'buddypress' ) ?></label>
    896             <label for="bp-group-invite-status-admins"><input type="radio" name="group-invite-status" id="bp-group-invite-status-admins" value="admins" <?php checked( $invite_status, 'admins' ) ?> /><?php _e( 'Group admins only', 'buddypress' ) ?></label>
     901            <legend><?php esc_html_e( 'Who can invite others to this group?', 'buddypress' ); ?></legend>
     902
     903            <label for="bp-group-invite-status-members"><input type="radio" name="group-invite-status" id="bp-group-invite-status-members" value="members" <?php checked( $invite_status, 'members' ) ?> /><?php esc_html_e( 'All group members', 'buddypress' ) ?></label>
     904            <label for="bp-group-invite-status-mods"><input type="radio" name="group-invite-status" id="bp-group-invite-status-mods" value="mods" <?php checked( $invite_status, 'mods' ) ?> /><?php esc_html_e( 'Group admins and mods only', 'buddypress' ) ?></label>
     905            <label for="bp-group-invite-status-admins"><input type="radio" name="group-invite-status" id="bp-group-invite-status-admins" value="admins" <?php checked( $invite_status, 'admins' ) ?> /><?php esc_html_e( 'Group admins only', 'buddypress' ) ?></label>
    897906        </fieldset>
    898907    </div>
     
    919928    ?>
    920929
    921     <label for="bp-groups-new-members" class="screen-reader-text"><?php
    922         /* translators: accessibility text */
    923         _e( 'Add new members', 'buddypress' );
    924     ?></label>
     930    <label for="bp-groups-new-members" class="screen-reader-text">
     931        <?php
     932            /* translators: accessibility text */
     933            esc_html_e( 'Add new members', 'buddypress' );
     934        ?>
     935    </label>
    925936    <input name="bp-groups-new-members" type="text" id="bp-groups-new-members" class="<?php echo esc_attr( $class ); ?>" placeholder="" />
    926937    <?php if ( $notice ) : ?>
     
    10071018        <div class="bp-groups-member-type" id="bp-groups-member-type-<?php echo esc_attr( $member_type ) ?>">
    10081019
    1009             <h3><?php switch ( $member_type ) :
     1020            <h3>
     1021                <?php
     1022                switch ( $member_type ) :
    10101023                    case 'admin'  : esc_html_e( 'Administrators', 'buddypress' ); break;
    10111024                    case 'mod'    : esc_html_e( 'Moderators',     'buddypress' ); break;
    10121025                    case 'member' : esc_html_e( 'Members',        'buddypress' ); break;
    10131026                    case 'banned' : esc_html_e( 'Banned Members', 'buddypress' ); break;
    1014             endswitch; ?></h3>
     1027                endswitch;
     1028                ?>
     1029            </h3>
    10151030
    10161031            <div class="bp-group-admin-pagination table-top">
    1017                 <?php echo $pagination[ $member_type ] ?>
     1032                <?php
     1033                    // phpcs:ignore WordPress.Security.EscapeOutput
     1034                    echo $pagination[ $member_type ];
     1035                ?>
    10181036            </div>
    10191037
    1020         <?php if ( !empty( $type_users ) ) : ?>
     1038        <?php if ( ! empty( $type_users ) ) : ?>
    10211039
    10221040            <table class="widefat bp-group-members">
    10231041                <thead>
    10241042                    <tr>
    1025                         <th scope="col" class="uid-column"><?php _ex( 'ID', 'Group member user_id in group admin', 'buddypress' ); ?></th>
    1026                         <th scope="col" class="uname-column"><?php _ex( 'Name', 'Group member name in group admin', 'buddypress' ); ?></th>
    1027                         <th scope="col" class="urole-column"><?php _ex( 'Group Role', 'Group member role in group admin', 'buddypress' ); ?></th>
     1043                        <th scope="col" class="uid-column"><?php echo esc_html_x( 'ID', 'Group member user_id in group admin', 'buddypress' ); ?></th>
     1044                        <th scope="col" class="uname-column"><?php echo esc_html_x( 'Name', 'Group member name in group admin', 'buddypress' ); ?></th>
     1045                        <th scope="col" class="urole-column"><?php echo esc_html_x( 'Group Role', 'Group member role in group admin', 'buddypress' ); ?></th>
    10281046                    </tr>
    10291047                </thead>
     
    10361054
    10371055                        <td class="uname-column">
    1038                             <a style="float: left;" href="<?php echo bp_members_get_user_url( $type_user->ID ); ?>"><?php echo bp_core_fetch_avatar( array(
    1039                                 'item_id' => $type_user->ID,
    1040                                 'width'   => '32',
    1041                                 'height'  => '32'
    1042                             ) ); ?></a>
    1043 
    1044                             <span style="margin: 8px; float: left;"><?php echo bp_core_get_userlink( $type_user->ID ); ?></span>
     1056                            <a style="float: left;" href="<?php echo esc_url( bp_members_get_user_url( $type_user->ID ) ); ?>">
     1057                                <?php
     1058                                    // phpcs:ignore WordPress.Security.EscapeOutput
     1059                                    echo bp_core_fetch_avatar(
     1060                                        array(
     1061                                            'item_id' => $type_user->ID,
     1062                                            'width'   => '32',
     1063                                            'height'  => '32'
     1064                                        )
     1065                                    );
     1066                                ?>
     1067                            </a>
     1068
     1069                            <span style="margin: 8px; float: left;">
     1070                                <?php
     1071                                    // phpcs:ignore WordPress.Security.EscapeOutput
     1072                                    echo bp_core_get_userlink( $type_user->ID );
     1073                                ?>
     1074                            </span>
    10451075                        </td>
    10461076
    10471077                        <td class="urole-column">
    1048                             <label for="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" class="screen-reader-text"><?php
    1049                                 /* translators: accessibility text */
    1050                                 _e( 'Select group role for member', 'buddypress' );
    1051                             ?></label>
     1078                            <label for="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" class="screen-reader-text">
     1079                                <?php
     1080                                    /* translators: accessibility text */
     1081                                    esc_html_e( 'Select group role for member', 'buddypress' );
     1082                                ?>
     1083                            </label>
    10521084                            <select class="bp-groups-role" id="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" name="bp-groups-role[<?php echo esc_attr( $type_user->ID ); ?>]">
    10531085                                <optgroup label="<?php esc_attr_e( 'Roles', 'buddypress' ); ?>">
    10541086                                    <option class="admin"  value="admin"  <?php selected( 'admin',  $member_type ); ?>><?php esc_html_e( 'Administrator', 'buddypress' ); ?></option>
    1055                                     <option class="mod"    value="mod"    <?php selected( 'mod',    $member_type ); ?>><?php esc_html_e( 'Moderator',     'buddypress' ); ?></option>
    1056                                     <option class="member" value="member" <?php selected( 'member', $member_type ); ?>><?php esc_html_e( 'Member',        'buddypress' ); ?></option>
     1087                                    <option class="mod"    value="mod"    <?php selected( 'mod',    $member_type ); ?>><?php esc_html_e( 'Moderator', 'buddypress' ); ?></option>
     1088                                    <option class="member" value="member" <?php selected( 'member', $member_type ); ?>><?php esc_html_e( 'Member', 'buddypress' ); ?></option>
     1089
    10571090                                    <?php if ( 'banned' === $member_type ) : ?>
    1058                                     <option class="banned" value="banned" <?php selected( 'banned', $member_type ); ?>><?php esc_html_e( 'Banned',        'buddypress' ); ?></option>
     1091                                        <option class="banned" value="banned" <?php selected( 'banned', $member_type ); ?>><?php esc_html_e( 'Banned', 'buddypress' ); ?></option>
    10591092                                    <?php endif; ?>
     1093
    10601094                                </optgroup>
    10611095                                <optgroup label="<?php esc_attr_e( 'Actions', 'buddypress' ); ?>">
    10621096                                    <option class="remove" value="remove"><?php esc_html_e( 'Remove', 'buddypress' ); ?></option>
     1097
    10631098                                    <?php if ( 'banned' !== $member_type ) : ?>
    10641099                                        <option class="banned" value="banned"><?php esc_html_e( 'Ban', 'buddypress' ); ?></option>
    10651100                                    <?php endif; ?>
     1101
    10661102                                </optgroup>
    10671103                            </select>
     
    11211157 */
    11221158function bp_groups_admin_edit_metabox_status( $item ) {
    1123     $base_url = add_query_arg( array(
    1124         'page' => 'bp-groups',
    1125         'gid'  => $item->id
    1126     ), bp_get_admin_url( 'admin.php' ) ); ?>
     1159    $base_url = add_query_arg(
     1160        array(
     1161            'page' => 'bp-groups',
     1162            'gid'  => $item->id
     1163        ),
     1164        bp_get_admin_url( 'admin.php' )
     1165    );
     1166    ?>
    11271167
    11281168    <div id="submitcomment" class="submitbox">
    11291169        <div id="major-publishing-actions">
    11301170            <div id="delete-action">
    1131                 <a class="submitdelete deletion" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'action', 'delete', $base_url ), 'bp-groups-delete' ) ); ?>"><?php _e( 'Delete Group', 'buddypress' ) ?></a>
     1171                <a class="submitdelete deletion" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'action', 'delete', $base_url ), 'bp-groups-delete' ) ); ?>"><?php esc_html_e( 'Delete Group', 'buddypress' ) ?></a>
    11321172            </div>
    11331173
     
    11611201    ?>
    11621202
    1163     <label for="bp-groups-group-type" class="screen-reader-text"><?php
    1164         /* translators: accessibility text */
    1165         esc_html_e( 'Select group type', 'buddypress' );
    1166     ?></label>
     1203    <label for="bp-groups-group-type" class="screen-reader-text">
     1204        <?php
     1205            /* translators: accessibility text */
     1206            esc_html_e( 'Select group type', 'buddypress' );
     1207        ?>
     1208    </label>
    11671209
    11681210    <ul class="categorychecklist form-no-clear">
     
    12651307    $current_page_end   = $page * $per_page > intval( $query->total_users ) ? $query->total_users : $page * $per_page;
    12661308
    1267     $pag_links = paginate_links( array(
    1268         'base'      => add_query_arg( $qs_key, '%#%', $url_base ),
    1269         'format'    => '',
    1270         'prev_text' => __( '&laquo;', 'buddypress' ),
    1271         'next_text' => __( '&raquo;', 'buddypress' ),
    1272         'total'     => ceil( $query->total_users / $per_page ),
    1273         'current'   => $page,
    1274     ) );
     1309    $pag_links = paginate_links(
     1310        array(
     1311            'base'      => add_query_arg( $qs_key, '%#%', $url_base ),
     1312            'format'    => '',
     1313            'prev_text' => __( '&laquo;', 'buddypress' ),
     1314            'next_text' => __( '&raquo;', 'buddypress' ),
     1315            'total'     => ceil( $query->total_users / $per_page ),
     1316            'current'   => $page,
     1317        )
     1318    );
    12751319
    12761320    if ( 1 == $query->total_users ) {
     
    12861330    }
    12871331
    1288     $pagination .= '<span class="bp-group-admin-pagination-viewing">' . $viewing_text . '</span>';
     1332    $pagination .= '<span class="bp-group-admin-pagination-viewing">' . esc_html( $viewing_text ) . '</span>';
     1333
     1334    // phpcs:ignore WordPress.Security.EscapeOutput
    12891335    $pagination .= '<span class="bp-group-admin-pagination-links">' . $pag_links . '</span>';
    12901336
     
    13311377    }
    13321378
    1333     $suggestions = bp_core_get_suggestions( array(
    1334         'group_id' => -$group_id,  // A negative value will exclude this group's members from the suggestions.
    1335         'limit'    => 10,
    1336         'term'     => $term,
    1337         'type'     => 'members',
    1338     ) );
     1379    $suggestions = bp_core_get_suggestions(
     1380        array(
     1381            'group_id' => -$group_id,  // A negative value will exclude this group's members from the suggestions.
     1382            'limit'    => 10,
     1383            'term'     => $term,
     1384            'type'     => 'members',
     1385        )
     1386    );
    13391387
    13401388    $matches = array();
  • trunk/src/bp-groups/bp-groups-blocks.php

    r13716 r13808  
    349349
    350350    // Include the common JS template.
     351    // phpcs:ignore WordPress.Security.EscapeOutput
    351352    echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-groups.php' );
    352353
  • trunk/src/bp-groups/bp-groups-functions.php

    r13619 r13808  
    330330    // Backward compatibility with old method of passing arguments.
    331331    if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
    332         _deprecated_argument( __METHOD__, '2.9.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__ ) );
     332        _deprecated_argument( __METHOD__, '2.9.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__ ) );
    333333
    334334        $old_args_keys = array(
     
    813813    if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
    814814        /* translators: 1: the name of the method. 2: the name of the file. */
    815         _deprecated_argument( __METHOD__, '2.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__ ) );
     815        _deprecated_argument( __METHOD__, '2.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__ ) );
    816816
    817817        $old_args_keys = array(
     
    18321832    // Backward compatibility with old method of passing arguments.
    18331833    if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
    1834         _deprecated_argument( __METHOD__, '5.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__ ) );
     1834        _deprecated_argument( __METHOD__, '5.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__ ) );
    18351835
    18361836        $old_args_keys = array(
     
    20482048function groups_demote_member( $user_id, $group_id ) {
    20492049
    2050     if ( ! bp_is_item_admin() )
     2050    if ( ! bp_is_item_admin() ) {
    20512051        return false;
     2052    }
    20522053
    20532054    $member = new BP_Groups_Member( $user_id, $group_id );
     
    20772078function groups_ban_member( $user_id, $group_id ) {
    20782079
    2079     if ( ! bp_is_item_admin() )
     2080    if ( ! bp_is_item_admin() ) {
    20802081        return false;
     2082    }
    20812083
    20822084    $member = new BP_Groups_Member( $user_id, $group_id );
     
    21062108function groups_unban_member( $user_id, $group_id ) {
    21072109
    2108     if ( ! bp_is_item_admin() )
     2110    if ( ! bp_is_item_admin() ) {
    21092111        return false;
     2112    }
    21102113
    21112114    $member = new BP_Groups_Member( $user_id, $group_id );
     
    21762179    // Backward compatibility with old method of passing arguments.
    21772180    if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
    2178         _deprecated_argument( __METHOD__, '5.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__ ) );
     2181        _deprecated_argument( __METHOD__, '5.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__ ) );
    21792182
    21802183        $old_args_keys = array(
     
    22512254    if ( ! empty( $membership_id ) ) {
    22522255        /* translators: 1: the name of the method. 2: the name of the file. */
    2253         _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     2256        _deprecated_argument( __METHOD__, '5.0.0', sprintf( esc_html__( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
    22542257    }
    22552258
     
    22852288    if ( ! empty( $membership_id ) ){
    22862289        /* translators: 1: the name of the method. 2: the name of the file. */
    2287         _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     2290        _deprecated_argument( __METHOD__, '5.0.0', sprintf( esc_html__( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
    22882291    }
    22892292
     
    23232326    if ( ! empty( $membership_id ) ){
    23242327        /* translators: 1: the name of the method. 2: the name of the file. */
    2325         _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     2328        _deprecated_argument( __METHOD__, '5.0.0', sprintf( esc_html__( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
    23262329    }
    23272330
     
    26432646 */
    26442647function bp_group_type_tax_name() {
    2645     echo bp_get_group_type_tax_name();
     2648    echo esc_html( bp_get_group_type_tax_name() );
    26462649}
    26472650
     
    28782881
    28792882    if ( isset( $bp->groups->types[ $group_type ] ) ) {
    2880         return new WP_Error( 'bp_group_type_exists', __( 'Group type already exists.', 'buddypress' ), $group_type );
     2883        return new WP_Error( 'bp_group_type_exists', esc_html__( 'Group type already exists.', 'buddypress' ), $group_type );
    28812884    }
    28822885
  • trunk/src/bp-groups/bp-groups-notifications.php

    r13503 r13808  
    11611161function groups_screen_notification_settings() {
    11621162
    1163     if ( !$group_invite = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_invite', true ) )
     1163    if ( ! $group_invite = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_invite', true ) ) {
    11641164        $group_invite  = 'yes';
    1165 
    1166     if ( !$group_update = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_group_updated', true ) )
     1165    }
     1166
     1167    if ( ! $group_update = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_group_updated', true ) ) {
    11671168        $group_update  = 'yes';
    1168 
    1169     if ( !$group_promo = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_admin_promotion', true ) )
     1169    }
     1170
     1171    if ( ! $group_promo = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_admin_promotion', true ) ) {
    11701172        $group_promo   = 'yes';
    1171 
    1172     if ( !$group_request = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_membership_request', true ) )
     1173    }
     1174
     1175    if ( ! $group_request = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_membership_request', true ) ) {
    11731176        $group_request = 'yes';
     1177    }
    11741178
    11751179    if ( ! $group_request_completed = bp_get_user_meta( bp_displayed_user_id(), 'notification_membership_request_completed', true ) ) {
     
    11821186            <tr>
    11831187                <th class="icon"></th>
    1184                 <th class="title"><?php _ex( 'Groups', 'Group settings on notification settings page', 'buddypress' ) ?></th>
    1185                 <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    1186                 <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     1188                <th class="title"><?php echo esc_html_x( 'Groups', 'Group settings on notification settings page', 'buddypress' ) ?></th>
     1189                <th class="yes"><?php esc_html_e( 'Yes', 'buddypress' ) ?></th>
     1190                <th class="no"><?php esc_html_e( 'No', 'buddypress' )?></th>
    11871191            </tr>
    11881192        </thead>
     
    11911195            <tr id="groups-notification-settings-invitation">
    11921196                <td></td>
    1193                 <td><?php _ex( 'A member invites you to join a group', 'group settings on notification settings page','buddypress' ) ?></td>
     1197                <td><?php echo esc_html_x( 'A member invites you to join a group', 'group settings on notification settings page','buddypress' ) ?></td>
    11941198                <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-yes" value="yes" <?php checked( $group_invite, 'yes', true ) ?>/><label for="notification-groups-invite-yes" class="bp-screen-reader-text"><?php
    11951199                    /* translators: accessibility text */
    1196                     _e( 'Yes, send email', 'buddypress' );
     1200                    esc_html_e( 'Yes, send email', 'buddypress' );
    11971201                ?></label></td>
    11981202                <td class="no"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-no" value="no" <?php checked( $group_invite, 'no', true ) ?>/><label for="notification-groups-invite-no" class="bp-screen-reader-text"><?php
    11991203                    /* translators: accessibility text */
    1200                     _e( 'No, do not send email', 'buddypress' );
     1204                    esc_html_e( 'No, do not send email', 'buddypress' );
    12011205                ?></label></td>
    12021206            </tr>
    12031207            <tr id="groups-notification-settings-info-updated">
    12041208                <td></td>
    1205                 <td><?php _ex( 'Group information is updated', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1209                <td><?php echo esc_html_x( 'Group information is updated', 'group settings on notification settings page', 'buddypress' ) ?></td>
    12061210                <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-yes" value="yes" <?php checked( $group_update, 'yes', true ) ?>/><label for="notification-groups-group-updated-yes" class="bp-screen-reader-text"><?php
    12071211                    /* translators: accessibility text */
    1208                     _e( 'Yes, send email', 'buddypress' );
     1212                    esc_html_e( 'Yes, send email', 'buddypress' );
    12091213                ?></label></td>
    12101214                <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-no" value="no" <?php checked( $group_update, 'no', true ) ?>/><label for="notification-groups-group-updated-no" class="bp-screen-reader-text"><?php
    12111215                    /* translators: accessibility text */
    1212                     _e( 'No, do not send email', 'buddypress' );
     1216                    esc_html_e( 'No, do not send email', 'buddypress' );
    12131217                ?></label></td>
    12141218            </tr>
    12151219            <tr id="groups-notification-settings-promoted">
    12161220                <td></td>
    1217                 <td><?php _ex( 'You are promoted to a group administrator or moderator', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1221                <td><?php echo esc_html_x( 'You are promoted to a group administrator or moderator', 'group settings on notification settings page', 'buddypress' ) ?></td>
    12181222                <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-yes" value="yes" <?php checked( $group_promo, 'yes', true ) ?>/><label for="notification-groups-admin-promotion-yes" class="bp-screen-reader-text"><?php
    12191223                    /* translators: accessibility text */
    1220                     _e( 'Yes, send email', 'buddypress' );
     1224                    esc_html_e( 'Yes, send email', 'buddypress' );
    12211225                ?></label></td>
    12221226                <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-no" value="no" <?php checked( $group_promo, 'no', true ) ?>/><label for="notification-groups-admin-promotion-no" class="bp-screen-reader-text"><?php
    12231227                    /* translators: accessibility text */
    1224                     _e( 'No, do not send email', 'buddypress' );
     1228                    esc_html_e( 'No, do not send email', 'buddypress' );
    12251229                ?></label></td>
    12261230            </tr>
    12271231            <tr id="groups-notification-settings-request">
    12281232                <td></td>
    1229                 <td><?php _ex( 'A member requests to join a private group for which you are an admin', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1233                <td><?php echo esc_html_x( 'A member requests to join a private group for which you are an admin', 'group settings on notification settings page', 'buddypress' ) ?></td>
    12301234                <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-yes" value="yes" <?php checked( $group_request, 'yes', true ) ?>/><label for="notification-groups-membership-request-yes" class="bp-screen-reader-text"><?php
    12311235                    /* translators: accessibility text */
    1232                     _e( 'Yes, send email', 'buddypress' );
     1236                    esc_html_e( 'Yes, send email', 'buddypress' );
    12331237                ?></label></td>
    12341238                <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-no" value="no" <?php checked( $group_request, 'no', true ) ?>/><label for="notification-groups-membership-request-no" class="bp-screen-reader-text"><?php
    12351239                    /* translators: accessibility text */
    1236                     _e( 'No, do not send email', 'buddypress' );
     1240                    esc_html_e( 'No, do not send email', 'buddypress' );
    12371241                ?></label></td>
    12381242            </tr>
    12391243            <tr id="groups-notification-settings-request-completed">
    12401244                <td></td>
    1241                 <td><?php _ex( 'Your request to join a group has been approved or denied', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1245                <td><?php echo esc_html_x( 'Your request to join a group has been approved or denied', 'group settings on notification settings page', 'buddypress' ) ?></td>
    12421246                <td class="yes"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-yes" value="yes" <?php checked( $group_request_completed, 'yes', true ) ?>/><label for="notification-groups-membership-request-completed-yes" class="bp-screen-reader-text"><?php
    12431247                    /* translators: accessibility text */
    1244                     _e( 'Yes, send email', 'buddypress' );
     1248                    esc_html_e( 'Yes, send email', 'buddypress' );
    12451249                ?></label></td>
    12461250                <td class="no"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-no" value="no" <?php checked( $group_request_completed, 'no', true ) ?>/><label for="notification-groups-membership-request-completed-no" class="bp-screen-reader-text"><?php
    12471251                    /* translators: accessibility text */
    1248                     _e( 'No, do not send email', 'buddypress' );
     1252                    esc_html_e( 'No, do not send email', 'buddypress' );
    12491253                ?></label></td>
    12501254            </tr>
  • trunk/src/bp-groups/bp-groups-template.php

    r13548 r13808  
    1717 */
    1818function bp_groups_slug() {
    19     echo bp_get_groups_slug();
     19    echo esc_url( bp_get_groups_slug() );
    2020}
    2121    /**
     
    4444 */
    4545function bp_groups_root_slug() {
    46     echo bp_get_groups_root_slug();
     46    echo esc_url( bp_get_groups_root_slug() );
    4747}
    4848    /**
     
    227227 */
    228228function bp_group_type_directory_link( $group_type = '' ) {
     229    // phpcs:ignore WordPress.Security.EscapeOutput
    229230    echo bp_get_group_type_directory_link( $group_type );
    230231}
     
    269270 * @since 2.7.0
    270271 * @see   bp_get_group_type_list() for parameter documentation.
     272 *
     273 * @param integer $group_id The group ID.
     274 * @param array   $r        List parameters.
    271275 */
    272276function bp_group_type_list( $group_id = 0, $r = array() ) {
     277    // phpcs:ignore WordPress.Security.EscapeOutput
    273278    echo bp_get_group_type_list( $group_id, $r );
    274279}
     
    657662 */
    658663function bp_group_id( $group = false ) {
    659     echo bp_get_group_id( $group );
     664    echo intval( bp_get_group_id( $group ) );
    660665}
    661666    /**
     
    696701 */
    697702function bp_group_class( $classes = array() ) {
     703    // phpcs:ignore WordPress.Security.EscapeOutput
    698704    echo bp_get_group_class( $classes );
    699705}
     
    764770         * @param array $classes Array of determined classes for the row.
    765771         */
    766         $classes = apply_filters( 'bp_get_group_class', $classes );
     772        $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_group_class', $classes ) );
    767773        $classes = array_merge( $classes, array() );
    768774        $retval = 'class="' . join( ' ', $classes ) . '"';
     
    780786 */
    781787function bp_group_name( $group = false ) {
     788    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     789    // phpcs:ignore WordPress.Security.EscapeOutput
    782790    echo bp_get_group_name( $group );
    783791}
     
    820828 */
    821829function bp_group_type( $group = false ) {
    822     echo bp_get_group_type( $group );
     830    echo esc_html( bp_get_group_type( $group ) );
    823831}
    824832    /**
     
    870878 */
    871879function bp_group_status( $group = false ) {
    872     echo bp_get_group_status( $group );
     880    echo esc_html( bp_get_group_status( $group ) );
    873881}
    874882    /**
     
    914922 */
    915923function bp_group_avatar( $args = '', $group = false ) {
     924    // phpcs:ignore WordPress.Security.EscapeOutput
    916925    echo bp_get_group_avatar( $args, $group );
    917926}
     
    10181027 */
    10191028function bp_group_avatar_thumb( $group = false ) {
     1029    // phpcs:ignore WordPress.Security.EscapeOutput
    10201030    echo bp_get_group_avatar_thumb( $group );
    10211031}
     
    10481058 */
    10491059function bp_group_avatar_mini( $group = false ) {
     1060    // phpcs:ignore WordPress.Security.EscapeOutput
    10501061    echo bp_get_group_avatar_mini( $group );
    10511062}
     
    10821093 */
    10831094function bp_group_avatar_url( $group = false, $type = 'full' ) {
    1084     echo bp_get_group_avatar_url( $group, $type );
     1095    echo esc_url( bp_get_group_avatar_url( $group, $type ) );
    10851096}
    10861097    /**
     
    11621173 */
    11631174function bp_group_last_active( $group = false, $args = array() ) {
    1164     echo bp_get_group_last_active( $group, $args );
     1175    echo esc_html( bp_get_group_last_active( $group, $args ) );
    11651176}
    11661177    /**
     
    13091320 */
    13101321function bp_group_link( $group = false ) {
     1322    // phpcs:ignore WordPress.Security.EscapeOutput
    13111323    echo bp_get_group_link( $group );
    13121324}
     
    14191431 */
    14201432function bp_group_slug( $group = false ) {
    1421     echo bp_get_group_slug( $group );
     1433    echo esc_url( bp_get_group_slug( $group ) );
    14221434}
    14231435    /**
     
    14591471 */
    14601472function bp_group_description( $group = false ) {
     1473    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     1474    // phpcs:ignore WordPress.Security.EscapeOutput
    14611475    echo bp_get_group_description( $group );
    14621476}
     
    14991513 */
    15001514function bp_group_description_editable( $group = false ) {
    1501     echo bp_get_group_description_editable( $group );
     1515    echo esc_textarea( bp_get_group_description_editable( $group ) );
    15021516}
    15031517    /**
     
    15481562 */
    15491563function bp_group_description_excerpt( $group = false, $length = 225 ) {
     1564    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     1565    // phpcs:ignore WordPress.Security.EscapeOutput
    15501566    echo bp_get_group_description_excerpt( $group, $length );
    15511567}
     
    15911607 */
    15921608function bp_group_date_created( $group = false, $args = array() ) {
    1593     echo bp_get_group_date_created( $group, $args );
     1609    echo esc_html( bp_get_group_date_created( $group, $args ) );
    15941610}
    15951611    /**
     
    16501666 */
    16511667function bp_group_creator_username( $group = false ) {
     1668    // Escaping is made in `bp-members/bp-members-functions.php`.
     1669    // phpcs:ignore WordPress.Security.EscapeOutput
    16521670    echo bp_get_group_creator_username( $group );
    16531671}
     
    16901708 */
    16911709function bp_group_creator_id( $group = false ) {
    1692     echo bp_get_group_creator_id( $group );
     1710    echo intval( bp_get_group_creator_id( $group ) );
    16931711}
    16941712    /**
     
    17301748 */
    17311749function bp_group_creator_permalink( $group = false ) {
    1732     echo bp_get_group_creator_permalink( $group );
     1750    echo esc_url( bp_get_group_creator_permalink( $group ) );
    17331751}
    17341752    /**
     
    18001818 */
    18011819function bp_group_creator_avatar( $group = false, $args = array() ) {
     1820    // phpcs:ignore WordPress.Security.EscapeOutput
    18021821    echo bp_get_group_creator_avatar( $group, $args );
    18031822}
     
    19111930    $group = bp_get_group( $group );
    19121931
     1932    // phpcs:disable WordPress.Security.EscapeOutput
    19131933    if ( ! empty( $group->admins ) ) { ?>
    19141934        <ul id="group-admins">
     
    19431963    <?php } ?>
    19441964    <?php
     1965    // phpcs:enable
    19451966}
    19461967
     
    19571978    $group = bp_get_group( $group );
    19581979
     1980    // phpcs:disable WordPress.Security.EscapeOutput
    19591981    if ( ! empty( $group->mods ) ) :
    19601982        ?>
     
    19892011        <?php
    19902012    endif;
     2013    // phpcs:enable
    19912014}
    19922015
     
    20912114 */
    20922115function bp_groups_pagination_links() {
     2116    // Escaping is done in WordPress's `paginate_links()` function.
     2117    // phpcs:ignore WordPress.Security.EscapeOutput
    20932118    echo bp_get_groups_pagination_links();
    20942119}
     
    21212146 */
    21222147function bp_groups_pagination_count() {
    2123     echo bp_get_groups_pagination_count();
     2148    echo esc_html( bp_get_groups_pagination_count() );
    21242149}
    21252150    /**
     
    21912216 */
    21922217function bp_group_total_members( $group = false ) {
    2193     echo bp_get_group_total_members( $group );
     2218    echo intval( bp_get_group_total_members( $group ) );
    21942219}
    21952220    /**
     
    22312256 */
    22322257function bp_group_member_count( $group = false ) {
    2233     echo bp_get_group_member_count( $group );
     2258    echo esc_html( bp_get_group_member_count( $group ) );
    22342259}
    22352260    /**
     
    25092534 */
    25102535function bp_group_member_promote_mod_link( $args = '' ) {
    2511     echo bp_get_group_member_promote_mod_link( $args );
     2536    echo esc_url( bp_get_group_member_promote_mod_link( $args ) );
    25122537}
    25132538    /**
     
    25642589 */
    25652590function bp_group_member_promote_admin_link( $args = '' ) {
    2566     echo bp_get_group_member_promote_admin_link( $args );
     2591    echo esc_url( bp_get_group_member_promote_admin_link( $args ) );
    25672592}
    25682593    /**
     
    26222647 */
    26232648function bp_group_member_demote_link( $user_id = 0, $group = false ) {
    2624     echo bp_get_group_member_demote_link( $user_id, $group );
     2649    echo esc_url( bp_get_group_member_demote_link( $user_id, $group ) );
    26252650}
    26262651    /**
     
    26772702 */
    26782703function bp_group_member_ban_link( $user_id = 0, $group = false ) {
    2679     echo bp_get_group_member_ban_link( $user_id, $group );
     2704    echo esc_url( bp_get_group_member_ban_link( $user_id, $group ) );
    26802705}
    26812706    /**
     
    27312756 */
    27322757function bp_group_member_unban_link( $user_id = 0, $group = false ) {
    2733     echo bp_get_group_member_unban_link( $user_id, $group );
     2758    echo esc_url( bp_get_group_member_unban_link( $user_id, $group ) );
    27342759}
    27352760    /**
     
    27712796         * @param int             $user_id The user ID.
    27722797         */
    2773         return apply_filters( 'bp_get_group_member_unban_link', $url,   $group, $user_id );
     2798        return apply_filters( 'bp_get_group_member_unban_link', $url, $group, $user_id );
    27742799    }
    27752800
     
    27852810 */
    27862811function bp_group_member_remove_link( $user_id = 0, $group = false ) {
    2787     echo bp_get_group_member_remove_link( $user_id, $group );
     2812    echo esc_url( bp_get_group_member_remove_link( $user_id, $group ) );
    27882813}
    27892814    /**
     
    28852910
    28862911    if ( ! empty( $admin_tabs_backcompat ) ) {
    2887         _doing_it_wrong( "do_action( 'groups_admin_tabs' )", __( 'This action should not be used directly. Please use the BuddyPress Group Extension API to generate Manage tabs.', 'buddypress' ), '2.2.0' );
     2912        _doing_it_wrong( "do_action( 'groups_admin_tabs' )", esc_html__( 'This action should not be used directly. Please use the BuddyPress Group Extension API to generate Manage tabs.', 'buddypress' ), '2.2.0' );
    28882913        $subnav_output .= $admin_tabs_backcompat;
    28892914    }
     
    28982923 */
    28992924function bp_group_total_for_member() {
    2900     echo bp_get_group_total_for_member();
     2925    echo intval( bp_get_group_total_for_member() );
    29012926}
    29022927    /**
     
    29302955 */
    29312956function bp_group_form_action( $page, $group = false ) {
    2932     echo bp_get_group_form_action( $page, $group );
     2957    echo esc_url( bp_get_group_form_action( $page, $group ) );
    29332958}
    29342959    /**
     
    29833008 */
    29843009function bp_group_admin_form_action( $page = false, $group = false ) {
    2985     echo bp_get_group_admin_form_action( $page, $group );
     3010    echo esc_url( bp_get_group_admin_form_action( $page, $group ) );
    29863011}
    29873012    /**
     
    31853210 */
    31863211function bp_group_accept_invite_link() {
    3187     echo bp_get_group_accept_invite_link();
     3212    echo esc_url( bp_get_group_accept_invite_link() );
    31883213}
    31893214    /**
     
    32333258 */
    32343259function bp_group_reject_invite_link() {
    3235     echo bp_get_group_reject_invite_link();
     3260    echo esc_url( bp_get_group_reject_invite_link() );
    32363261}
    32373262    /**
     
    32813306 */
    32823307function bp_group_leave_confirm_link() {
    3283     echo bp_get_group_leave_confirm_link();
     3308    echo esc_url( bp_get_group_leave_confirm_link() );
    32843309}
    32853310    /**
     
    33273352 */
    33283353function bp_group_leave_reject_link() {
    3329     echo bp_get_group_leave_reject_link();
     3354    echo esc_url( bp_get_group_leave_reject_link() );
    33303355}
    33313356    /**
     
    33653390 */
    33663391function bp_group_send_invite_form_action() {
    3367     echo bp_get_group_send_invite_form_action();
     3392    echo esc_url( bp_get_group_send_invite_form_action() );
    33683393}
    33693394    /**
     
    34393464 */
    34403465function bp_group_join_button( $group = false ) {
     3466    // Escaping is done in `BP_Core_HTML_Element()`.
     3467    // phpcs:ignore WordPress.Security.EscapeOutput
    34413468    echo bp_get_group_join_button( $group );
    34423469}
     
    36373664 */
    36383665function bp_group_create_button() {
     3666    // Escaping is done in `BP_Core_HTML_Element()`.
     3667    // phpcs:ignore WordPress.Security.EscapeOutput
    36393668    echo bp_get_group_create_button();
    36403669}
     
    36833712 */
    36843713function bp_group_create_nav_item() {
     3714    // Escaping is done in `BP_Core_HTML_Element()`.
     3715    // phpcs:ignore WordPress.Security.EscapeOutput
    36853716    echo bp_get_group_create_nav_item();
    36863717}
     
    37983829     * @param object $group   Group to get status message for.
    37993830     */
    3800     echo apply_filters( 'bp_group_status_message', $message, $group );
     3831    echo esc_html( apply_filters( 'bp_group_status_message', $message, $group ) );
    38013832}
    38023833
     
    38303861 */
    38313862function bp_total_group_count() {
    3832     echo bp_get_total_group_count();
     3863    echo intval( bp_get_total_group_count() );
    38333864}
    38343865    /**
     
    38593890 */
    38603891function bp_total_group_count_for_user( $user_id = 0 ) {
    3861     echo bp_get_total_group_count_for_user( $user_id );
     3892    echo intval( bp_get_total_group_count_for_user( $user_id ) );
    38623893}
    38633894    /**
     
    40164047 */
    40174048function bp_group_member_avatar( $args = '' ) {
     4049    // phpcs:ignore WordPress.Security.EscapeOutput
    40184050    echo bp_get_group_member_avatar( $args );
    40194051}
     
    40614093 */
    40624094function bp_group_member_avatar_thumb( $args = '' ) {
     4095    // phpcs:ignore WordPress.Security.EscapeOutput
    40634096    echo bp_get_group_member_avatar_thumb( $args );
    40644097}
     
    41074140 */
    41084141function bp_group_member_avatar_mini( $width = 30, $height = 30 ) {
     4142    // phpcs:ignore WordPress.Security.EscapeOutput
    41094143    echo bp_get_group_member_avatar_mini( $width, $height );
    41104144}
     
    41534187 */
    41544188function bp_group_member_name() {
    4155     echo bp_get_group_member_name();
     4189    echo esc_html( bp_get_group_member_name() );
    41564190}
    41574191    /**
     
    41834217 */
    41844218function bp_group_member_url() {
    4185     echo bp_get_group_member_url();
     4219    echo esc_url( bp_get_group_member_url() );
    41864220}
    41874221    /**
     
    42134247 */
    42144248function bp_group_member_link() {
     4249    // phpcs:ignore WordPress.Security.EscapeOutput
    42154250    echo bp_get_group_member_link();
    42164251}
     
    42344269         * @param string $value HTML link for the current user.
    42354270         */
    4236         return apply_filters( 'bp_get_group_member_link', '<a href="' . bp_members_get_user_url( $members_template->member->user_id ) . '">' . $members_template->member->display_name . '</a>' );
     4271        return apply_filters( 'bp_get_group_member_link', '<a href="' . esc_url( bp_members_get_user_url( $members_template->member->user_id ) ) . '">' . esc_html( $members_template->member->display_name ) . '</a>' );
    42374272    }
    42384273
     
    42434278 */
    42444279function bp_group_member_domain() {
    4245     echo bp_get_group_member_domain();
     4280    echo esc_url( bp_get_group_member_domain() );
    42464281}
    42474282    /**
     
    42734308 */
    42744309function bp_group_member_is_friend() {
    4275     echo bp_get_group_member_is_friend();
     4310    echo esc_html( bp_get_group_member_is_friend() );
    42764311}
    42774312    /**
     
    43114346 */
    43124347function bp_group_member_is_banned() {
     4348    // phpcs:ignore WordPress.Security.EscapeOutput
    43134349    echo bp_get_group_member_is_banned();
    43144350}
     
    43554391         * @param string $value HTML class to add.
    43564392         */
    4357         echo apply_filters( 'bp_group_member_css_class', 'banned-user' );
     4393        echo esc_attr( apply_filters( 'bp_group_member_css_class', 'banned-user' ) );
    43584394    }
    43594395}
     
    43694405 */
    43704406function bp_group_member_joined_since( $args = array() ) {
    4371     echo bp_get_group_member_joined_since( $args );
     4407    echo esc_html( bp_get_group_member_joined_since( $args ) );
    43724408}
    43734409    /**
     
    44274463 */
    44284464function bp_group_member_id() {
    4429     echo bp_get_group_member_id();
     4465    echo intval( bp_get_group_member_id() );
    44304466}
    44314467    /**
     
    44744510 */
    44754511function bp_group_pag_id() {
    4476     echo bp_get_group_pag_id();
     4512    echo esc_url( bp_get_group_pag_id() );
    44774513}
    44784514    /**
     
    44994535 */
    45004536function bp_group_member_pagination() {
     4537    // Escaping is done in WordPress's `paginate_links()` function.
     4538    // phpcs:ignore WordPress.Security.EscapeOutput
    45014539    echo bp_get_group_member_pagination();
    45024540    wp_nonce_field( 'bp_groups_member_list', '_member_pag_nonce' );
     
    45304568 */
    45314569function bp_group_member_pagination_count() {
    4532     echo bp_get_group_member_pagination_count();
     4570    echo esc_html( bp_get_group_member_pagination_count() );
    45334571}
    45344572    /**
     
    45754613 */
    45764614function bp_group_member_admin_pagination() {
     4615    // Escaping is done in WordPress's `paginate_links()` function.
     4616    // phpcs:ignore WordPress.Security.EscapeOutput
    45774617    echo bp_get_group_member_admin_pagination();
    45784618    wp_nonce_field( 'bp_groups_member_admin_list', '_member_admin_pag_nonce' );
     
    47074747    </div>
    47084748
    4709     <h2 class="bp-screen-reader-text"><?php
    4710         /* translators: accessibility text */
    4711         _e( 'Members', 'buddypress' );
    4712     ?></h2>
     4749    <h2 class="bp-screen-reader-text">
     4750        <?php
     4751            /* translators: accessibility text */
     4752            esc_html_e( 'Members', 'buddypress' );
     4753        ?>
     4754    </h2>
    47134755
    47144756    <div id="members-group-list" class="group_members dir-list">
     
    47284770    ?>
    47294771    <li id="group_members-order-select" class="last filter">
    4730         <label for="group_members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
     4772        <label for="group_members-order-by"><?php esc_html_e( 'Order By:', 'buddypress' ); ?></label>
    47314773        <select id="group_members-order-by">
    4732             <option value="last_joined"><?php _e( 'Newest', 'buddypress' ); ?></option>
    4733             <option value="first_joined"><?php _e( 'Oldest', 'buddypress' ); ?></option>
     4774            <option value="last_joined"><?php esc_html_e( 'Newest', 'buddypress' ); ?></option>
     4775            <option value="first_joined"><?php esc_html_e( 'Oldest', 'buddypress' ); ?></option>
    47344776
    47354777            <?php if ( bp_is_active( 'activity' ) ) : ?>
    4736                 <option value="group_activity"><?php _e( 'Group Activity', 'buddypress' ); ?></option>
     4778                <option value="group_activity"><?php esc_html_e( 'Group Activity', 'buddypress' ); ?></option>
    47374779            <?php endif; ?>
    47384780
    4739             <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
     4781            <option value="alphabetical"><?php esc_html_e( 'Alphabetical', 'buddypress' ); ?></option>
    47404782
    47414783            <?php
     
    48324874        }
    48334875
    4834 
     4876        // phpcs:ignore WordPress.Security.EscapeOutput
    48354877        printf( '<li%1$s>%2$s</li>', $current_class, $step_name );
    48364878        $counter++;
     
    48474889
    48484890/**
     4891 * Output the group creation step's title.
     4892 *
    48494893 * @since 1.0.0
    48504894 */
     
    48524896    $bp = buddypress();
    48534897
    4854     /**
    4855      * Filters the group creation stage title.
    4856      *
    4857      * @since 1.1.0
    4858      *
    4859      * @param string $value HTML markup for the group creation stage title.
    4860      */
    4861     echo apply_filters( 'bp_group_creation_stage_title', '<span>&mdash; ' . $bp->groups->group_creation_steps[bp_get_groups_current_create_step()]['name'] . '</span>' );
    4862 }
    4863 
    4864 /**
     4898    // phpcs:ignore WordPress.Security.EscapeOutput
     4899    echo apply_filters(
     4900        /**
     4901         * Filters the group creation stage title.
     4902         *
     4903         * @since 1.1.0
     4904         *
     4905         * @param string $value HTML markup for the group creation stage title.
     4906         */
     4907        'bp_group_creation_stage_title',
     4908        '<span>&mdash; ' . esc_html( $bp->groups->group_creation_steps[bp_get_groups_current_create_step()]['name'] ) . '</span>'
     4909    );
     4910}
     4911
     4912/**
     4913 * Output the group's creation form action URL.
     4914 *
    48654915 * @since 1.1.0
    48664916 */
    48674917function bp_group_creation_form_action() {
    4868     echo bp_get_group_creation_form_action();
    4869 }
    4870 
    4871 /**
     4918    echo esc_url( bp_get_group_creation_form_action() );
     4919}
     4920
     4921/**
     4922 * Get the group's creation form action URL.
     4923 *
    48724924 * @since 1.1.0
    48734925 *
    4874  * @return mixed|void
     4926 * @return string The group's creation form action URL.
    48754927 */
    48764928    function bp_get_group_creation_form_action() {
     
    49004952
    49014953/**
     4954 * Check the requested creation step is the current one.
     4955 *
    49024956 * @since 1.1.0
    49034957 *
    4904  * @param string $step_slug
     4958 * @param string $step_slug The group creation step's slug.
    49054959 *
    49064960 * @return bool
     
    49174971    // If this the first step, we can just accept and return true.
    49184972    $keys = array_keys( $bp->groups->group_creation_steps );
    4919     if ( !bp_action_variable( 1 ) && array_shift( $keys ) == $step_slug ) {
     4973    if ( ! bp_action_variable( 1 ) && array_shift( $keys ) == $step_slug ) {
    49204974        return true;
    49214975    }
     
    49234977    // Before allowing a user to see a group creation step we must make sure
    49244978    // previous steps are completed.
    4925     if ( !bp_is_first_group_creation_step() ) {
    4926         if ( !bp_are_previous_group_creation_steps_complete( $step_slug ) ) {
     4979    if ( ! bp_is_first_group_creation_step() ) {
     4980        if ( ! bp_are_previous_group_creation_steps_complete( $step_slug ) ) {
    49274981            return false;
    49284982        }
     
    49384992
    49394993/**
     4994 * Check the requested creation step is completed.
     4995 *
    49404996 * @since 1.1.0
    49414997 *
    4942  * @param array $step_slugs
     4998 * @param array $step_slugs The list of group creation step slugs.
    49434999 *
    49445000 * @return bool
     
    49475003    $bp = buddypress();
    49485004
    4949     if ( !isset( $bp->groups->completed_create_steps ) ) {
     5005    if ( ! isset( $bp->groups->completed_create_steps ) ) {
    49505006        return false;
    49515007    }
     
    49555011
    49565012        foreach ( (array) $step_slugs as $step_slug ) {
    4957             if ( !in_array( $step_slug, $bp->groups->completed_create_steps ) ) {
     5013            if ( ! in_array( $step_slug, $bp->groups->completed_create_steps ) ) {
    49585014                $found = false;
    49595015            }
     
    49695025
    49705026/**
     5027 * Check previous steps compared to the requested creation step are completed.
     5028 *
    49715029 * @since 1.1.0
    49725030 *
    4973  * @param string $step_slug
     5031 * @param string $step_slug The group creation step's slug.
    49745032 *
    49755033 * @return bool
     
    50015059
    50025060/**
     5061 * Outputs the new group ID.
     5062 *
    50035063 * @since 1.1.0
    50045064 */
    50055065function bp_new_group_id() {
    5006     echo bp_get_new_group_id();
     5066    echo intval( bp_get_new_group_id() );
    50075067}
    50085068
     
    50295089
    50305090/**
     5091 * Output the new group's name.
     5092 *
    50315093 * @since 1.1.0
    50325094 */
    50335095function bp_new_group_name() {
     5096    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     5097    // phpcs:ignore WordPress.Security.EscapeOutput
    50345098    echo bp_get_new_group_name();
    50355099}
    50365100
    50375101    /**
     5102     * Get the new group's name.
     5103     *
    50385104     * @since 1.1.0
    50395105     *
    5040      * @return mixed|void
     5106     * @return string The new group's name.
    50415107     */
    50425108    function bp_get_new_group_name() {
     
    50575123
    50585124/**
     5125 * Output the new group's description.
     5126 *
    50595127 * @since 1.1.0
    50605128 */
    50615129function bp_new_group_description() {
     5130    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     5131    // phpcs:ignore WordPress.Security.EscapeOutput
    50625132    echo bp_get_new_group_description();
    50635133}
    50645134
    50655135    /**
     5136     * Get the new group's description.
     5137     *
    50665138     * @since 1.1.0
    50675139     *
    5068      * @return mixed|void
     5140     * @return string The new group's description.
    50695141     */
    50705142    function bp_get_new_group_description() {
     
    50855157
    50865158/**
     5159 * Outputs 1 if the new group has a forum.
     5160 *
     5161 * @todo deprecate
    50875162 * @since 1.1.0
    50885163 */
    50895164function bp_new_group_enable_forum() {
    5090     echo bp_get_new_group_enable_forum();
    5091 }
    5092 
    5093     /**
     5165    echo intval( bp_get_new_group_enable_forum() );
     5166}
     5167
     5168    /**
     5169     * Checks whether a new group has a forum or not.
     5170     *
     5171     * @todo deprecate
    50945172     * @since 1.1.0
    50955173     *
    5096      * @return int
     5174     * @return int 1 if the new group has a forum. O otherwise.
    50975175     */
    50985176    function bp_get_new_group_enable_forum() {
     
    51135191
    51145192/**
     5193 * Outputs the new group's status.
     5194 *
    51155195 * @since 1.1.0
    51165196 */
    51175197function bp_new_group_status() {
    5118     echo bp_get_new_group_status();
    5119 }
    5120 
    5121     /**
     5198    echo esc_html( bp_get_new_group_status() );
     5199}
     5200
     5201    /**
     5202     * Gets the new group's status.
     5203     *
    51225204     * @since 1.1.0
    51235205     *
    5124      * @return mixed|void
     5206     * @return string The new group's status.
    51255207     */
    51265208    function bp_get_new_group_status() {
     
    51505232 */
    51515233function bp_new_group_avatar( $args = '' ) {
     5234    // phpcs:ignore WordPress.Security.EscapeOutput
    51525235    echo bp_get_new_group_avatar( $args );
    51535236}
     
    52655348 */
    52665349function bp_groups_current_create_step() {
    5267     echo bp_get_groups_current_create_step();
     5350    echo esc_html( bp_get_groups_current_create_step() );
    52685351}
    52695352    /**
     
    53745457 */
    53755458function bp_new_group_invite_friend_list( $args = array() ) {
     5459    // phpcs:ignore WordPress.Security.EscapeOutput
    53765460    echo bp_get_new_group_invite_friend_list( $args );
    53775461}
     
    54615545
    54625546/**
     5547 * Outputs a search form for the Groups directory.
     5548 *
    54635549 * @since 1.0.0
    54645550 */
     
    54755561    $search_form_html = '<form action="" method="get" id="search-groups-form">
    54765562        <label for="groups_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="groups_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
    5477         <input type="submit" id="groups_search_submit" name="groups_search_submit" value="'. __( 'Search', 'buddypress' ) .'" />
     5563        <input type="submit" id="groups_search_submit" name="groups_search_submit" value="'. esc_html__( 'Search', 'buddypress' ) .'" />
    54785564    </form>';
    54795565
    5480     /**
    5481      * Filters the HTML markup for the groups search form.
    5482      *
    5483      * @since 1.9.0
    5484      *
    5485      * @param string $search_form_html HTML markup for the search form.
    5486      */
    5487     echo apply_filters( 'bp_directory_groups_search_form', $search_form_html );
    5488 
     5566    // phpcs:ignore WordPress.Security.EscapeOutput
     5567    echo apply_filters(
     5568        /**
     5569         * Filters the HTML markup for the groups search form.
     5570         *
     5571         * @since 1.9.0
     5572         *
     5573         * @param string $search_form_html HTML markup for the search form.
     5574         */
     5575        'bp_directory_groups_search_form',
     5576        $search_form_html
     5577    );
    54895578}
    54905579
     
    54955584 */
    54965585function bp_current_group_directory_type_message() {
    5497     echo bp_get_current_group_directory_type_message();
     5586    echo wp_kses( bp_get_current_group_directory_type_message(), array( 'strong' =>  true ) );
    54985587}
    54995588    /**
     
    55385627 */
    55395628function bp_group_current_admin_tab() {
    5540     echo bp_get_group_current_admin_tab();
     5629    echo esc_html( bp_get_group_current_admin_tab() );
    55415630}
    55425631    /**
     
    55755664 */
    55765665function bp_group_current_avatar( $type = 'thumb' ) {
     5666    // phpcs:ignore WordPress.Security.EscapeOutput
    55775667    echo bp_get_group_current_avatar( $type );
    55785668}
     
    56405730
    56415731/**
     5732 * Outputs the URL to delete a group avatar.
     5733 *
    56425734 * @since 1.1.0
    56435735 */
    56445736function bp_group_avatar_delete_link() {
    5645     echo bp_get_group_avatar_delete_link();
    5646 }
    5647 
    5648     /**
     5737    echo esc_url( bp_get_group_avatar_delete_link() );
     5738}
     5739
     5740    /**
     5741     * Gets the URL to delete a group avatar.
     5742     *
    56495743     * @since 1.1.0
    56505744     *
    5651      * @return mixed|void
     5745     * @return string The URL to delete a group avatar.
    56525746     */
    56535747    function bp_get_group_avatar_delete_link() {
     
    56725766
    56735767/**
     5768 * Fires a hook to let 3rd party plugins add some html content to group's home page.
     5769 *
    56745770 * @since 1.0.0
    56755771 */
     
    56795775
    56805776/**
     5777 * Fires a hook to let 3rd party plugins add custom group admin tabs.
     5778 *
     5779 * @todo deprecate.
    56815780 * @since 1.0.0
    56825781 */
     
    56865785
    56875786/**
     5787 * Fires a hook to let 3rd party plugins add custom group editable fields.
     5788 *
     5789 * @todo deprecate.
    56885790 * @since 1.0.0
    56895791 */
     
    56935795
    56945796/**
     5797 * Fires a hook to let 3rd party plugins add custom group fields.
     5798 *
     5799 * @todo deprecate.
    56955800 * @since 1.0.0
    56965801 */
     
    57695874    global $requests_template;
    57705875
    5771     /**
    5772      * Filters the requesting user's avatar thumbnail.
    5773      *
    5774      * @since 1.0.0
    5775      *
    5776      * @param string $value HTML markup for the user's avatar thumbnail.
    5777      */
     5876    // phpcs:ignore WordPress.Security.EscapeOutput
    57785877    echo apply_filters(
     5878        /**
     5879         * Filters the requesting user's avatar thumbnail.
     5880         *
     5881         * @since 1.0.0
     5882         *
     5883         * @param string $value HTML markup for the user's avatar thumbnail.
     5884         */
    57795885        'bp_group_request_user_avatar_thumb',
    57805886        bp_core_fetch_avatar(
     
    57905896
    57915897/**
     5898 * Outputs the URL to reject a group membership request.
     5899 *
    57925900 * @since 1.0.0
    57935901 */
    57945902function bp_group_request_reject_link() {
    5795     echo bp_get_group_request_reject_link();
    5796 }
    5797 
    5798     /**
     5903    echo esc_url( bp_get_group_request_reject_link() );
     5904}
     5905
     5906    /**
     5907     * Gets the URL to reject a group membership request.
     5908     *
    57995909     * @since 1.2.6
    58005910     *
    5801      * @return mixed|void
     5911     * @return string The URL to reject a group membership request.
    58025912     */
    58035913    function bp_get_group_request_reject_link() {
     
    58275937
    58285938/**
     5939 * Outputs the URL to accept a group membership request.
     5940 *
    58295941 * @since 1.0.0
    58305942 */
    58315943function bp_group_request_accept_link() {
    5832     echo bp_get_group_request_accept_link();
    5833 }
    5834 
    5835     /**
     5944    echo esc_url( bp_get_group_request_accept_link() );
     5945}
     5946
     5947    /**
     5948     * Gets the URL to reject a group membership request.
     5949     *
    58365950     * @since 1.2.6
    5837      * @return mixed|void
     5951     *
     5952     * @return string The URL to reject a group membership request.
    58385953     */
    58395954    function bp_get_group_request_accept_link() {
     
    58635978
    58645979/**
     5980 * Outputs the link to reach the requesting user's profile page.
     5981 *
    58655982 * @since 1.0.0
    58665983 */
    58675984function bp_group_request_user_link() {
     5985    // phpcs:ignore WordPress.Security.EscapeOutput
    58685986    echo bp_get_group_request_user_link();
    58695987}
    58705988
    58715989    /**
     5990     * Gets the link to reach the requesting user's profile page.
     5991     *
    58725992     * @since 1.2.6
    58735993     *
    5874      * @return mixed|void
     5994     * @return string HTML output.
    58755995     */
    58765996    function bp_get_group_request_user_link() {
     
    58886008
    58896009/**
     6010 * Outputs the elapsed time since the group membership request was made.
     6011 *
    58906012 * @since 1.0.0
    58916013 */
     
    58936015    global $requests_template;
    58946016
    5895     /**
    5896      * Filters the formatted time since membership was requested.
    5897      *
    5898      * @since 1.0.0
    5899      *
    5900      * @param string $value Formatted time since membership was requested.
    5901      */
    5902     echo apply_filters(
    5903         'bp_group_request_time_since_requested',
    5904         /* translators: %s: human time diff */
    5905         sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( $requests_template->request->date_modified ) )
     6017    // phpcs:ignore WordPress.Security.EscapeOutput
     6018    echo esc_html(
     6019        /**
     6020         * Filters the formatted time since membership was requested.
     6021         *
     6022         * @since 1.0.0
     6023         *
     6024         * @param string $value Formatted time since membership was requested.
     6025         */
     6026        apply_filters(
     6027            'bp_group_request_time_since_requested',
     6028            /* translators: %s: human time diff */
     6029            sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( $requests_template->request->date_modified ) )
     6030        )
    59066031    );
    59076032}
    59086033
    59096034/**
     6035 * Outputs the comment a member sent with their membership request.
     6036 *
    59106037 * @since 1.0.0
    59116038 */
     
    59206047     * @param string $value Membership request comment left by user.
    59216048     */
    5922     echo apply_filters( 'bp_group_request_comment', strip_tags( stripslashes( $requests_template->request->comments ) ) );
     6049    echo esc_html( apply_filters( 'bp_group_request_comment', stripslashes( $requests_template->request->comments ) ) );
    59236050}
    59246051
     
    59296056 */
    59306057function bp_group_requests_pagination_links() {
     6058    // Escaping is done in WordPress's `paginate_links()` function.
     6059    // phpcs:ignore WordPress.Security.EscapeOutput
    59316060    echo bp_get_group_requests_pagination_links();
    59326061}
     
    59576086 */
    59586087function bp_group_requests_pagination_count() {
    5959     echo bp_get_group_requests_pagination_count();
     6088    echo esc_html( bp_get_group_requests_pagination_count() );
    59606089}
    59616090    /**
     
    60746203 */
    60756204function bp_group_invite_item_id() {
    6076     echo bp_get_group_invite_item_id();
     6205    echo esc_attr( bp_get_group_invite_item_id() );
    60776206}
    60786207
     
    60996228 */
    61006229function bp_group_invite_user_avatar() {
     6230    // phpcs:ignore WordPress.Security.EscapeOutput
    61016231    echo bp_get_group_invite_user_avatar();
    61026232}
     
    61246254 */
    61256255function bp_group_invite_user_link() {
     6256    // phpcs:ignore WordPress.Security.EscapeOutput
    61266257    echo bp_get_group_invite_user_link();
    61276258}
     
    61496280 */
    61506281function bp_group_invite_user_last_active() {
    6151     echo bp_get_group_invite_user_last_active();
     6282    echo esc_html( bp_get_group_invite_user_last_active() );
    61526283}
    61536284
     
    61746305 */
    61756306function bp_group_invite_user_remove_invite_url() {
    6176     echo bp_get_group_invite_user_remove_invite_url();
     6307    echo esc_url( bp_get_group_invite_user_remove_invite_url() );
    61776308}
    61786309
     
    62096340 */
    62106341function bp_group_invite_pagination_links() {
     6342    // Escaping is done in WordPress's `paginate_links()` function.
     6343    // phpcs:ignore WordPress.Security.EscapeOutput
    62116344    echo bp_get_group_invite_pagination_links();
    62126345}
     
    62386371 */
    62396372function bp_group_invite_pagination_count() {
    6240     echo bp_get_group_invite_pagination_count();
     6373    echo esc_html( bp_get_group_invite_pagination_count() );
    62416374}
    62426375    /**
     
    62786411    if ( ! bp_is_active( 'groups' ) || ! bp_is_active( 'activity' ) || ! bp_is_group() ) {
    62796412        return;
    6280     } ?>
    6281 
    6282     <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php echo esc_attr( bp_get_current_group_name() ); ?> | <?php _e( 'Group Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_group_activity_feed_link() ?>" />
    6283 
    6284 <?php
     6413    }
     6414    ?>
     6415    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php echo esc_attr( bp_get_current_group_name() ); ?> | <?php esc_html_e( 'Group Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_group_activity_feed_link(); ?>" />
     6416    <?php
    62856417}
    62866418add_action( 'bp_head', 'bp_groups_activity_feed' );
     
    62926424 */
    62936425function bp_group_activity_feed_link() {
    6294     echo bp_get_group_activity_feed_link();
     6426    echo esc_url( bp_get_group_activity_feed_link() );
    62956427}
    62966428    /**
     
    63256457 */
    63266458function bp_current_group_id() {
    6327     echo bp_get_current_group_id();
     6459    echo intval( bp_get_current_group_id() );
    63286460}
    63296461    /**
     
    63556487 */
    63566488function bp_current_group_slug() {
    6357     echo bp_get_current_group_slug();
     6489    echo esc_url( bp_get_current_group_slug() );
    63586490}
    63596491    /**
     
    63856517 */
    63866518function bp_current_group_name() {
     6519    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     6520    // phpcs:ignore WordPress.Security.EscapeOutput
    63876521    echo bp_get_current_group_name();
    63886522}
     
    64156549 */
    64166550function bp_current_group_description() {
     6551    // Escaping is made in `bp-groups/bp-groups-filters.php`.
     6552    // phpcs:ignore WordPress.Security.EscapeOutput
    64176553    echo bp_get_current_group_description();
    64186554}
     
    64616597 */
    64626598function bp_groups_action_link( $action = '', $query_args = '', $nonce = false ) {
    6463     echo bp_get_groups_action_link( $action, $query_args, $nonce );
     6599    echo esc_url( bp_get_groups_action_link( $action, $query_args, $nonce ) );
    64646600}
    64656601    /**
     
    65316667 */
    65326668function bp_groups_profile_stats( $args = '' ) {
    6533     echo bp_groups_get_profile_stats( $args );
     6669    echo wp_kses(
     6670        bp_groups_get_profile_stats( $args ),
     6671        array(
     6672            'li'     => array( 'class' => true ),
     6673            'div'    => array( 'class' => true ),
     6674            'strong' => true,
     6675            'a'      => array( 'href' => true ),
     6676        )
     6677    );
    65346678}
    65356679add_action( 'bp_members_admin_user_stats', 'bp_groups_profile_stats', 8, 1 );
  • trunk/src/bp-groups/bp-groups-widgets.php

    r13481 r13808  
    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-groups/classes/class-bp-group-extension.php

    r13524 r13808  
    13301330        ob_end_clean();
    13311331
     1332        // phpcs:ignore WordPress.Security.EscapeOutput
    13321333        echo $this->maybe_add_submit_button( $screen );
    13331334
     
    14261427        return $screen . sprintf(
    14271428            '<div id="%s"><input type="submit" name="save" value="%s" id="%s"></div>',
    1428             'bp-group-edit-' . $this->slug . '-submit-wrapper',
    1429             $this->screens['edit']['submit_text'],
    1430             'bp-group-edit-' . $this->slug . '-submit'
     1429            'bp-group-edit-' . esc_attr( $this->slug ) . '-submit-wrapper',
     1430            esc_attr( $this->screens['edit']['submit_text'] ),
     1431            'bp-group-edit-' . esc_attr( $this->slug ) . '-submit'
    14311432        );
    14321433    }
  • trunk/src/bp-groups/classes/class-bp-groups-group-members-template.php

    r13446 r13808  
    122122        if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
    123123            /* translators: 1: the name of the method. 2: the name of the file. */
    124             _deprecated_argument( __METHOD__, '2.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__ ) );
     124            _deprecated_argument( __METHOD__, '2.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__ ) );
    125125
    126126            $old_args_keys = array(
  • trunk/src/bp-groups/classes/class-bp-groups-invite-template.php

    r13433 r13808  
    100100        if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
    101101            /* translators: 1: the name of the method. 2: the name of the file. */
    102             _deprecated_argument( __METHOD__, '2.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__ ) );
     102            _deprecated_argument( __METHOD__, '2.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__ ) );
    103103
    104104            $old_args_keys = array(
  • trunk/src/bp-groups/classes/class-bp-groups-list-table.php

    r13650 r13808  
    251251     */
    252252    public function no_items() {
    253         _e( 'No groups found.', 'buddypress' );
     253        esc_html_e( 'No groups found.', 'buddypress' );
    254254    }
    255255
     
    262262        $this->display_tablenav( 'top' ); ?>
    263263
    264         <h2 class="screen-reader-text"><?php
    265             /* translators: accessibility text */
    266             _e( 'Groups list', 'buddypress' );
    267         ?></h2>
    268 
    269         <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
     264        <h2 class="screen-reader-text">
     265            <?php
     266                /* translators: accessibility text */
     267                esc_html_e( 'Groups list', 'buddypress' );
     268            ?>
     269        </h2>
     270
     271        <table class="wp-list-table <?php echo esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>" cellspacing="0">
    270272            <thead>
    271273                <tr>
     
    334336         * @param string $value       ID of the current group being displayed.
    335337         */
    336         $row_classes = apply_filters( 'bp_groups_admin_row_class', $row_classes, $item['id'] );
     338        $row_classes = array_map( 'sanitize_html_class', apply_filters( 'bp_groups_admin_row_class', $row_classes, $item['id'] ) );
    337339        $row_class = ' class="' . implode( ' ', $row_classes ) . '"';
    338340
     341        // phpcs:ignore WordPress.Security.EscapeOutput
    339342        echo '<tr' . $row_class . ' id="group-' . esc_attr( $item['id'] ) . '" data-parent_id="' . esc_attr( $item['id'] ) . '" data-root_id="' . esc_attr( $item['id'] ) . '">';
     343
     344        // Escapes are made into `self::single_row_columns()`.
     345        // phpcs:ignore WordPress.Security.EscapeOutput
    340346        echo $this->single_row_columns( $item );
    341347        echo '</tr>';
     
    352358        $url_base = bp_get_admin_url( 'admin.php?page=bp-groups' ); ?>
    353359
    354         <h2 class="screen-reader-text"><?php
    355             /* translators: accessibility text */
    356             _e( 'Filter groups list', 'buddypress' );
    357         ?></h2>
     360        <h2 class="screen-reader-text">
     361            <?php
     362                /* translators: accessibility text */
     363                esc_html_e( 'Filter groups list', 'buddypress' );
     364            ?>
     365        </h2>
    358366
    359367        <ul class="subsubsub">
     
    365373                        sprintf(
    366374                            '<span class="count">(%s)</span>',
    367                             number_format_i18n( $this->group_counts['all'] )
     375                            esc_html( number_format_i18n( $this->group_counts['all'] ) )
    368376                        )
    369377                    ); ?>
     
    374382                    <?php printf(
    375383                        /* translators: %s is the placeholder for the count html `<span class="count"/>` */
    376                         _n( 'Public %s', 'Public %s', $this->group_counts['public'], 'buddypress' ),
     384                        esc_html( _n( 'Public %s', 'Public %s', $this->group_counts['public'], 'buddypress' ) ),
    377385                        sprintf(
    378386                            '<span class="count">(%s)</span>',
    379                             number_format_i18n( $this->group_counts['public'] )
     387                            esc_html( number_format_i18n( $this->group_counts['public'] ) )
    380388                        )
    381389                    ); ?>
     
    386394                    <?php printf(
    387395                        /* translators: %s is the placeholder for the count html `<span class="count"/>` */
    388                         _n( 'Private %s', 'Private %s', $this->group_counts['private'], 'buddypress' ),
     396                        esc_html( _n( 'Private %s', 'Private %s', $this->group_counts['private'], 'buddypress' ) ),
    389397                        sprintf(
    390398                            '<span class="count">(%s)</span>',
    391                             number_format_i18n( $this->group_counts['private'] )
     399                            esc_html( number_format_i18n( $this->group_counts['private'] ) )
    392400                        )
    393401                    ); ?>
     
    398406                    <?php printf(
    399407                        /* translators: %s is the placeholder for the count html tag */
    400                         _n( 'Hidden %s', 'Hidden %s', $this->group_counts['hidden'], 'buddypress' ),
     408                        esc_html( _n( 'Hidden %s', 'Hidden %s', $this->group_counts['hidden'], 'buddypress' ) ),
    401409                        sprintf(
    402410                            '<span class="count">(%s)</span>',
    403                             number_format_i18n( $this->group_counts['hidden'] )
     411                            esc_html( number_format_i18n( $this->group_counts['hidden'] ) )
    404412                        )
    405413                    ); ?>
     
    546554    public function column_cb( $item = array() ) {
    547555        /* translators: accessibility text */
    548         printf( '<label class="screen-reader-text" for="gid-%1$d">' . __( 'Select group %1$d', 'buddypress' ) . '</label><input type="checkbox" name="gid[]" value="%1$d" id="gid-%1$d" />', $item['id'] );
     556        printf( '<label class="screen-reader-text" for="gid-%1$d">' . esc_html__( 'Select group %1$d', 'buddypress' ) . '</label><input type="checkbox" name="gid[]" value="%1$d" id="gid-%1$d" />', intval( $item['id'] ) );
    549557    }
    550558
     
    639647        $content = sprintf( '<strong><a href="%s">%s</a></strong>', esc_url( $edit_url ), $group_name );
    640648
    641         echo $avatar . ' ' . $content . ' ' . $this->row_actions( $actions );
     649        echo wp_kses(
     650            $avatar,
     651            array(
     652                'img' => array(
     653                    'alt'    => true,
     654                    'src'    => true,
     655                    'srcset' => true,
     656                    'class'  => true,
     657                    'height' => true,
     658                    'width'  => true,
     659                )
     660            )
     661        );
     662        // phpcs:ignore WordPress.Security.EscapeOutput
     663        echo ' ' . $content . ' ' . $this->row_actions( $actions );
    642664    }
    643665
     
    651673    public function column_description( $item = array() ) {
    652674
    653         /**
    654          * Filters the markup for the Description column.
    655          *
    656          * @since 1.0.0
    657          *
    658          * @param string $value Markup for the Description column.
    659          * @param array  $item  The current group item in the loop.
    660          */
    661         echo apply_filters_ref_array( 'bp_get_group_description', array( $item['description'], $item ) );
     675        // phpcs:ignore WordPress.Security.EscapeOutput
     676        echo apply_filters_ref_array(
     677            /**
     678             * Filters the markup for the Description column.
     679             *
     680             * @since 1.0.0
     681             *
     682             * @param string $value Markup for the Description column.
     683             * @param array  $item  The current group item in the loop.
     684             */
     685            'bp_get_group_description',
     686            array( $item['description'], $item )
     687        );
    662688    }
    663689
     
    695721         * @parma array  $item        The current group item in the loop.
    696722         */
    697         echo apply_filters_ref_array( 'bp_groups_admin_get_group_status', array( $status_desc, $item ) );
     723        echo esc_html( apply_filters_ref_array( 'bp_groups_admin_get_group_status', array( $status_desc, $item ) ) );
    698724    }
    699725
     
    715741         *
    716742         * @param int   $count Markup for the number of Members column.
    717          * @parma array $item  The current group item in the loop.
    718          */
    719         echo apply_filters_ref_array( 'bp_groups_admin_get_group_member_count', array( (int) $count, $item ) );
     743         * @param array $item  The current group item in the loop.
     744         */
     745        echo intval( apply_filters_ref_array( 'bp_groups_admin_get_group_member_count', array( $count, $item ) ) );
    720746    }
    721747
     
    736762         *
    737763         * @param string $last_active Markup for the Last Active column.
    738          * @parma array  $item        The current group item in the loop.
    739          */
    740         echo apply_filters_ref_array( 'bp_groups_admin_get_group_last_active', array( $last_active, $item ) );
     764         * @param array  $item        The current group item in the loop.
     765         */
     766        echo esc_html( apply_filters_ref_array( 'bp_groups_admin_get_group_last_active', array( $last_active, $item ) ) );
    741767    }
    742768
     
    805831        remove_filter( 'bp_get_group_type_directory_permalink', array( $this, 'group_type_permalink_use_admin_filter' ), 10 );
    806832
    807         /**
    808          * Filters the markup for the Group Type column.
    809          *
    810          * @since 2.7.0
    811          *
    812          * @param string $retval Markup for the Group Type column.
    813          * @parma array  $item   The current group item in the loop.
    814          */
    815         echo apply_filters_ref_array( 'bp_groups_admin_get_group_type_column', array( $retval, $item ) );
     833        // phpcs:ignore WordPress.Security.EscapeOutput
     834        echo apply_filters_ref_array(
     835            /**
     836             * Filters the markup for the Group Type column.
     837             *
     838             * @since 2.7.0
     839             *
     840             * @param string $retval Markup for the Group Type column.
     841             * @parma array  $item   The current group item in the loop.
     842             */
     843            'bp_groups_admin_get_group_type_column',
     844            array( $retval, $item )
     845        );
    816846    }
    817847
     
    850880        ?>
    851881        <div class="alignleft actions">
    852             <label class="screen-reader-text" for="<?php echo $id_name; ?>"><?php _e( 'Change group type to&hellip;', 'buddypress' ) ?></label>
    853             <select name="<?php echo $id_name; ?>" id="<?php echo $id_name; ?>" style="display:inline-block;float:none;">
    854                 <option value=""><?php _e( 'Change group type to&hellip;', 'buddypress' ) ?></option>
     882            <label class="screen-reader-text" for="<?php echo esc_attr( $id_name ); ?>"><?php esc_html_e( 'Change group type to&hellip;', 'buddypress' ) ?></label>
     883            <select name="<?php echo esc_attr( $id_name ); ?>" id="<?php echo esc_attr( $id_name ); ?>" style="display:inline-block;float:none;">
     884                <option value=""><?php esc_html_e( 'Change group type to&hellip;', 'buddypress' ) ?></option>
    855885
    856886                <?php foreach( $types as $type ) : ?>
     
    860890                <?php endforeach; ?>
    861891
    862                 <option value="remove_group_type"><?php _e( 'No Group Type', 'buddypress' ) ?></option>
     892                <option value="remove_group_type"><?php esc_html_e( 'No Group Type', 'buddypress' ) ?></option>
    863893
    864894            </select>
  • trunk/src/bp-groups/classes/class-bp-groups-membership-requests-template.php

    r13399 r13808  
    9999        if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
    100100            /* translators: 1: the name of the method. 2: the name of the file. */
    101             _deprecated_argument( __METHOD__, '2.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__ ) );
     101            _deprecated_argument( __METHOD__, '2.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__ ) );
    102102
    103103            $old_args_keys = array(
  • trunk/src/bp-groups/classes/class-bp-groups-template.php

    r13399 r13808  
    139139        // Backward compatibility with old method of passing arguments.
    140140        if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
    141             _deprecated_argument( __METHOD__, '1.7', 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__ ) );
     141            _deprecated_argument( __METHOD__, '1.7', 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__ ) );
    142142
    143143            $old_args_keys = array(
  • trunk/src/bp-groups/classes/class-bp-groups-widget.php

    r13481 r13808  
    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/**
Note: See TracChangeset for help on using the changeset viewer.