Skip to:
Content

BuddyPress.org

Changeset 13821


Ignore:
Timestamp:
04/28/2024 10:25:38 PM (2 years ago)
Author:
imath
Message:

BP Nouveau: improve PHP code standards using WPCS

See #7228 (branch 12.0)

Location:
branches/12.0/src
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • branches/12.0/src/bp-activity/bp-activity-template.php

    r13817 r13821  
    13001300
    13011301/**
     1302 * Returns the Allowed HTML tags for the activity action.
     1303 *
     1304 * @since 12.4.1
     1305 *
     1306 * @return array The Allowed HTML tags for the activity action.
     1307 */
     1308function bp_activity_action_allowed_html() {
     1309        return array(
     1310                'p'    => true,
     1311                'a'    => array(
     1312                        'href'            => true,
     1313                        'class'           => true,
     1314                        'data-bp-tooltip' => true,
     1315                ),
     1316                'span' => array(
     1317                        'class'          => true,
     1318                        'data-livestamp' => true,
     1319                ),
     1320                'img'  => array(
     1321                        'src'     => true,
     1322                        'loading' => true,
     1323                        'class'   => true,
     1324                        'alt'     => true,
     1325                        'height'  => true,
     1326                        'width'   => true,
     1327                ),
     1328        );
     1329}
     1330
     1331/**
     1332 * Output Activity metadata.
     1333 *
     1334 * @since 12.4.1
     1335 */
     1336function bp_output_activity_meta( $content = '' ) {
     1337        echo wp_kses( bp_insert_activity_meta( $content ), bp_activity_action_allowed_html() );
     1338}
     1339
     1340/**
    13021341 * Output the activity action.
    13031342 *
     
    13071346 */
    13081347function bp_activity_action( $args = array() ) {
    1309         echo wp_kses(
    1310                 bp_get_activity_action( $args ),
    1311                 array(
    1312                         'p'    => true,
    1313                         'a'    => array(
    1314                                 'href'            => true,
    1315                                 'class'           => true,
    1316                                 'data-bp-tooltip' => true,
    1317                         ),
    1318                         'span' => array(
    1319                                 'class' => true,
    1320                         ),
    1321                         'img'  => array(
    1322                                 'src'     => true,
    1323                                 'loading' => true,
    1324                                 'class'   => true,
    1325                                 'alt'     => true,
    1326                                 'height'  => true,
    1327                                 'width'   => true,
    1328                         ),
    1329                 )
    1330         );
     1348        echo wp_kses( bp_get_activity_action( $args ), bp_activity_action_allowed_html() );
    13311349}
    13321350
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/activity/widget.php

    r13817 r13821  
    4141                                                </cite>
    4242
    43                                                 <?php echo bp_insert_activity_meta(); ?>
     43                                                <?php bp_output_activity_meta(); ?>
    4444
    4545                                        </footer>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/assets/emails/single-bp-email.php

    r13693 r13821  
    166166                                                do_action( 'bp_before_email_header' );
    167167
    168                                                 echo bp_get_option( 'blogname' );
     168                                                echo esc_html( bp_get_option( 'blogname' ) );
    169169
    170170                                                /**
     
    216216                                                ?>
    217217
    218                                                 <span class="footer_text"><?php echo nl2br( stripslashes( $settings['footer_text'] ) ); ?></span>
     218                                                <span class="footer_text"><?php echo nl2br( esc_html( stripslashes( $settings['footer_text'] ) ) ); ?></span>
    219219                                                <br><br>
    220220                                                <a href="{{{unsubscribe}}}" style="text-decoration: underline;"><?php echo esc_html_x( 'unsubscribe', 'email', 'buddypress' ); ?></a>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/assets/embeds/header-activity.php

    r12082 r13821  
    2929                <?php endif; ?>
    3030
    31                 <span class="bp-embed-timestamp"><a href="<?php bp_activity_thread_permalink(); ?>"><?php echo date_i18n( get_option( 'time_format' ) . ' - ' . get_option( 'date_format' ), strtotime( bp_get_activity_date_recorded() ) ); ?></a></span>
     31                <span class="bp-embed-timestamp"><a href="<?php bp_activity_thread_permalink(); ?>"><?php echo esc_html( date_i18n( get_option( 'time_format' ) . ' - ' . get_option( 'date_format' ), strtotime( bp_get_activity_date_recorded() ) ) ); ?></a></span>
    3232        </p>
    3333</div>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/blogs/confirm.php

    r13530 r13821  
    1919                        sprintf(
    2020                                /* translators: %s: the link of the new site */
    21                                 __( '%s is your new site.', 'buddypress' ),
     21                                esc_html__( '%s is your new site.', 'buddypress' ),
    2222                                sprintf( '<a href="%s">%s</a>', esc_url( $args['blog_url'] ), esc_url( $args['blog_url'] ) )
    2323                        ),
    2424                        sprintf(
    25                                 /* translators: 1: Login URL, 2: User name */
    26                                 __( '<a href="%1$s">Log in</a> as "%2$s" using your existing password.', 'buddypress' ),
    27                                 esc_url( $args['login_url'] ),
     25                                /* translators: 1: Login link, 2: User name */
     26                                esc_html__( '%1$s as "%2$s" using your existing password.', 'buddypress' ),
     27                                '<a href="' . esc_url( $args['login_url'] ) . '">' . esc_html__( 'Log in', 'buddypress' ) . '</a>',
    2828                                esc_html( $args['user_name'] )
    2929                        )
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php

    r13510 r13821  
    3838        <input type="text" name="send_to" class="send-to-input" id="send-to-input" />
    3939
    40         <label for="subject"><?php _e( 'Subject', 'buddypress' ); ?></label>
     40        <label for="subject"><?php esc_html_e( 'Subject', 'buddypress' ); ?></label>
    4141        <input type="text" name="subject" id="subject"/>
    4242
     
    345345                                <?php bp_nouveau_messages_hook( 'before', 'reply_box' ); ?>
    346346
    347                                 <label for="message_content" class="bp-screen-reader-text"><?php _e( 'Reply to Message', 'buddypress' ); ?></label>
     347                                <label for="message_content" class="bp-screen-reader-text"><?php esc_html_e( 'Reply to Message', 'buddypress' ); ?></label>
    348348                                <div id="bp-message-content"></div>
    349349
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/search-form.php

    r12184 r13821  
    99<form action="" method="get" id="user_messages_search_form" class="bp-messages-search-form" data-bp-search="messages">
    1010        <label for="user_messages_search" class="bp-screen-reader-text">
    11                 <?php _e( 'Search Messages', 'buddypress' ); ?>
     11                <?php esc_html_e( 'Search Messages', 'buddypress' ); ?>
    1212        </label>
    1313        <input type="search" id="user_messages_search" placeholder="<?php echo esc_attr_x( 'Search', 'search placeholder text', 'buddypress' ); ?>"/>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/groups/groups-loop.php

    r13646 r13821  
    4949                                                                                sprintf(
    5050                                                                                        '<span data-livestamp="%1$s">%2$s</span>',
    51                                                                                         bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ),
     51                                                                                        esc_attr( bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ) ),
    5252                                                                                        esc_html( bp_get_group_last_active() )
    5353                                                                                )
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/group-settings.php

    r13156 r13821  
    7171                <?php foreach ( $group_types as $type ) : ?>
    7272                        <div class="checkbox">
    73                                 <label for="<?php printf( 'group-type-%s', $type->name ); ?>">
    74                                         <input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', $type->name ); ?>" value="<?php echo esc_attr( $type->name ); ?>" <?php bp_nouveau_group_type_checked( $type ); ?>/> <?php echo esc_html( $type->labels['name'] ); ?>
     73                                <label for="<?php printf( 'group-type-%s', esc_attr( $type->name ) ); ?>">
     74                                        <input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', esc_attr( $type->name ) ); ?>" value="<?php echo esc_attr( $type->name ); ?>" <?php bp_nouveau_group_type_checked( $type ); ?>/> <?php echo esc_html( $type->labels['name'] ); ?>
    7575                                        <?php
    7676                                        if ( ! empty( $type->description ) ) {
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/manage-members.php

    r13193 r13821  
    3131                                <li class="member-entry clearfix">
    3232
    33                                         <?php echo bp_core_fetch_avatar( array( 'item_id' => bp_get_member_user_id(), 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => '' ) ); ?>
     33                                        <?php
     34                                        // phpcs:ignore WordPress.Security.EscapeOutput
     35                                        echo bp_core_fetch_avatar( array( 'item_id' => bp_get_member_user_id(), 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => '' ) );
     36                                        ?>
    3437                                        <p class="list-title member-name">
    3538                                                <a href="<?php bp_member_permalink(); ?>"> <?php bp_member_name(); ?></a>
     
    6265                                <li class="members-entry clearfix">
    6366
    64                                         <?php echo bp_core_fetch_avatar( array( 'item_id' => bp_get_member_user_id(), 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => '' ) ); ?>
     67                                        <?php
     68                                        // phpcs:ignore WordPress.Security.EscapeOutput
     69                                        echo bp_core_fetch_avatar( array( 'item_id' => bp_get_member_user_id(), 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => '' ) );
     70                                        ?>
    6571                                        <p class="list-title member-name">
    6672                                                <a href="<?php bp_member_permalink(); ?>"> <?php bp_member_name(); ?></a>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php

    r13437 r13821  
    2626
    2727                                <?php if ( bp_nouveau_group_has_meta( 'status' ) ) : ?>
    28                                         <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_the_group_meta( array( 'keys' => 'status' ) ) ); ?></strong></p>
     28                                        <p class="highlight group-status"><strong><?php bp_nouveau_the_group_meta( array( 'keys' => 'status' ) ); ?></strong></p>
    2929                                <?php endif; ?>
    3030
     
    3636                                                        sprintf(
    3737                                                                '<span data-livestamp="%1$s">%2$s</span>',
    38                                                                 bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ),
     38                                                                esc_attr( bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ) ),
    3939                                                                esc_html( bp_get_group_last_active() )
    4040                                                        )
     
    6161                                        <div class="item-meta">
    6262
    63                                                 <?php echo bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?>
     63                                                <?php bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?>
    6464
    6565                                        </div><!-- .item-meta -->
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/groups/single/default-front.php

    r13095 r13821  
    1515
    1616                        <p>
    17                         <?php
    18                         printf(
    19                                 /* translators: 1: link to the customizer option. 2: link to the customizer widgets section. */
    20                                 esc_html__( 'You can set your preferences for the %1$s or add %2$s to it.', 'buddypress' ),
    21                                 bp_nouveau_groups_get_customizer_option_link(),
    22                                 bp_nouveau_groups_get_customizer_widgets_link()
    23                         );
    24                         ?>
     17                                <?php
     18                                printf(
     19                                        /* translators: 1: link to the customizer option. 2: link to the customizer widgets section. */
     20                                        esc_html__( 'You can set your preferences for the %1$s or add %2$s to it.', 'buddypress' ),
     21                                        // phpcs:disable WordPress.Security.EscapeOutput
     22                                        bp_nouveau_groups_get_customizer_option_link(), // Escaped in `bp_nouveau_get_customizer_link()`.
     23                                        bp_nouveau_groups_get_customizer_widgets_link() // Escaped in `bp_nouveau_get_customizer_link()`.
     24                                        // phpcs:enable
     25                                );
     26                                ?>
    2527                        </p>
    2628
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php

    r13437 r13821  
    3333                                sprintf(
    3434                                        '<span data-livestamp="%1$s">%2$s</span>',
    35                                         bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ),
     35                                        esc_attr( bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ) ),
    3636                                        esc_html( bp_get_group_last_active() )
    3737                                )
     
    5858                <div class="item-meta">
    5959
    60                         <?php echo bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?>
     60                        <?php bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?>
    6161
    6262                </div><!-- .item-meta -->
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/default-front.php

    r12595 r13821  
    1919                                /* translators: 1: link to the customizer option. 2: link to the customizer widgets section. */
    2020                                esc_html__( 'You can set the preferences of the %1$s or add %2$s to it.', 'buddypress' ),
    21                                 bp_nouveau_members_get_customizer_option_link(),
    22                                 bp_nouveau_members_get_customizer_widgets_link()
     21                                // phpcs:disable WordPress.Security.EscapeOutput
     22                                bp_nouveau_members_get_customizer_option_link(), // Escaped in `bp_nouveau_get_customizer_link()`.
     23                                bp_nouveau_members_get_customizer_widgets_link() // Escaped in `bp_nouveau_get_customizer_link()`.
     24                                // phpcs:enable
    2325                        );
    2426                        ?>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/groups/invites.php

    r13437 r13821  
    3636                                                        <span class="small">
    3737                                                        <?php
    38                                                         printf(
    39                                                                 /* translators: %s is the number of Group members */
    40                                                                 _n(
    41                                                                         '%s member',
    42                                                                         '%s members',
    43                                                                         bp_get_group_total_members( false ),
    44                                                                         'buddypress'
    45                                                                 ),
    46                                                                 number_format_i18n( bp_get_group_total_members( false ) )
     38                                                        echo esc_html(
     39                                                                sprintf(
     40                                                                        /* translators: %s is the number of Group members */
     41                                                                        _n(
     42                                                                                '%s member',
     43                                                                                '%s members',
     44                                                                                bp_get_group_total_members( false ),
     45                                                                                'buddypress'
     46                                                                        ),
     47                                                                        number_format_i18n( bp_get_group_total_members( false ) )
     48                                                                )
    4749                                                        );
    4850                                                        ?>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/parts/profile-visibility.php

    r12156 r13821  
    1919                printf(
    2020                        /* translators: field visibility level, e.g. "...seen by: everyone". */
    21                         __( 'This field may be seen by: %s', 'buddypress' ),
    22                         '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
     21                        esc_html__( 'This field may be seen by: %s', 'buddypress' ),
     22                        '<span class="current-visibility-level">' . esc_html( bp_get_the_profile_field_visibility_level_label() ) . '</span>'
    2323                );
    2424                ?>
     
    4343                printf(
    4444                        esc_html__( 'This field may be seen by: %s', 'buddypress' ),
    45                         '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
     45                        '<span class="current-visibility-level">' . esc_html( bp_get_the_profile_field_visibility_level_label() ) . '</span>'
    4646                );
    4747                ?>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/profile.php

    r13652 r13821  
    2020<?php bp_nouveau_member_hook( 'before', 'profile_content' ); ?>
    2121
    22 <div class="profile <?php echo bp_current_action(); ?>">
     22<div class="profile <?php echo esc_attr( bp_current_action() ); ?>">
    2323
    2424<?php
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/profile/edit.php

    r12156 r13821  
    3232                                        printf(
    3333                                                /* translators: %s = profile field group name */
    34                                                 __( 'Editing "%s" Profile Group', 'buddypress' ),
    35                                                 bp_get_the_profile_group_name()
    36                                         )
     34                                                esc_html__( 'Editing "%s" Profile Group', 'buddypress' ),
     35                                                esc_html( bp_get_the_profile_group_name() )
     36                                        );
    3737                                        ?>
    3838                                </h3>
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/profile/profile-wp.php

    r12156 r13821  
    1818                        printf(
    1919                                /* Translators: a member's profile, e.g. "Paul's profile". */
    20                                 __( "%s's Profile", 'buddypress' ),
    21                                 bp_get_displayed_user_fullname()
     20                                esc_html__( "%s's Profile", 'buddypress' ),
     21                                // phpcs:ignore WordPress.Security.EscapeOutput
     22                                bp_get_displayed_user_fullname() // Escaped in `bp-members/bp-members-filters.php`.
    2223                        );
    2324                }
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/settings/data.php

    r13472 r13821  
    2222
    2323                        <p><?php esc_html_e( 'Your request for an export of personal data has been completed.', 'buddypress' ); ?></p>
    24                         <p><?php printf( esc_html__( 'You may download your personal data by clicking on the link below. For privacy and security, we will automatically delete the file on %s, so please download it before then.', 'buddypress' ), bp_settings_get_personal_data_expiration_date( $request ) ); ?></p>
     24                        <p><?php printf( esc_html__( 'You may download your personal data by clicking on the link below. For privacy and security, we will automatically delete the file on %s, so please download it before then.', 'buddypress' ), esc_html( bp_settings_get_personal_data_expiration_date( $request ) ) ); ?></p>
    2525
    26                         <p><strong><?php printf( '<a href="%1$s">%2$s</a>', bp_settings_get_personal_data_export_url( $request ), esc_html__( 'Download personal data', 'buddypress' ) ); ?></strong></p>
     26                        <p><strong><?php printf( '<a href="%1$s">%2$s</a>', esc_url( bp_settings_get_personal_data_export_url( $request ) ), esc_html__( 'Download personal data', 'buddypress' ) ); ?></strong></p>
    2727
    2828                <?php else : ?>
     
    3232
    3333                        <form id="bp-data-export" method="post">
    34                                 <input type="hidden" name="bp-data-export-delete-request-nonce" value="<?php echo wp_create_nonce( 'bp-data-export-delete-request' ); ?>" />
    35                                 <button type="submit" name="bp-data-export-nonce" value="<?php echo wp_create_nonce( 'bp-data-export' ); ?>"><?php esc_html_e( 'Request new data export', 'buddypress' ); ?></button>
     34                                <input type="hidden" name="bp-data-export-delete-request-nonce" value="<?php echo esc_attr( wp_create_nonce( 'bp-data-export-delete-request' ) ); ?>" />
     35                                <button type="submit" name="bp-data-export-nonce" value="<?php echo esc_attr( wp_create_nonce( 'bp-data-export' ) ); ?>"><?php esc_html_e( 'Request new data export', 'buddypress' ); ?></button>
    3636                        </form>
    3737
     
    4040        <?php elseif ( 'request-confirmed' === $request->status ) : ?>
    4141
    42                 <p><?php printf( esc_html__( 'You previously requested an export of your personal data on %s.', 'buddypress' ), bp_settings_get_personal_data_confirmation_date( $request ) ); ?></p>
     42                <p><?php printf( esc_html__( 'You previously requested an export of your personal data on %s.', 'buddypress' ), esc_html( bp_settings_get_personal_data_confirmation_date( $request ) ) ); ?></p>
    4343                <p><?php esc_html_e( 'You will receive a link to download your export via email once we are able to fulfill your request.', 'buddypress' ); ?></p>
    4444
     
    5454
    5555        <form id="bp-data-export" method="post">
    56                 <button type="submit" name="bp-data-export-nonce" value="<?php echo wp_create_nonce( 'bp-data-export' ); ?>"><?php esc_html_e( 'Request personal data export', 'buddypress' ); ?></button>
     56                <button type="submit" name="bp-data-export-nonce" value="<?php echo esc_attr( wp_create_nonce( 'bp-data-export' ) ); ?>"><?php esc_html_e( 'Request personal data export', 'buddypress' ); ?></button>
    5757        </form>
    5858
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/settings/group-invites.php

    r13443 r13821  
    99
    1010<h2 class="screen-heading group-invites-screen">
    11         <?php _e( 'Group Invites', 'buddypress' ); ?>
     11        <?php esc_html_e( 'Group Invites', 'buddypress' ); ?>
    1212</h2>
    1313
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress/members/single/settings/notifications.php

    r13443 r13821  
    1010
    1111<h2 class="screen-heading email-settings-screen">
    12         <?php _e( 'Email Notifications', 'buddypress' ); ?>
     12        <?php esc_html_e( 'Email Notifications', 'buddypress' ); ?>
    1313</h2>
    1414
    1515<p class="bp-help-text email-notifications-info">
    16         <?php _e( 'Set your email notification preferences.', 'buddypress' ); ?>
     16        <?php esc_html_e( 'Set your email notification preferences.', 'buddypress' ); ?>
    1717</p>
    1818
  • branches/12.0/src/bp-templates/bp-nouveau/includes/activity/template-tags.php

    r13631 r13821  
    650650        }
    651651
    652         /**
    653          * Filters the opening tag for the template that lists activity comments.
    654          *
    655          * @since 1.6.0
    656          *
    657          * @param string $value Opening tag for the HTML markup to use.
    658          */
    659         echo apply_filters( 'bp_activity_recurse_comments_start_ul', '<ul>' );
     652        // phpcs:ignore WordPress.Security.EscapeOutput
     653        echo apply_filters(
     654                /** This filter is documented in bp-activity/bp-activity-template.php. */
     655                'bp_activity_recurse_comments_start_ul',
     656                '<ul>'
     657        );
    660658
    661659        foreach ( (array) $comment->children as $comment_child ) {
     
    683681        }
    684682
    685         /**
    686          * Filters the closing tag for the template that list activity comments.
    687          *
    688          * @since 1.6.0
    689          *
    690          * @param string $value Closing tag for the HTML markup to use.
    691          */
    692         echo apply_filters( 'bp_activity_recurse_comments_end_ul', '</ul>' );
     683        // phpcs:ignore WordPress.Security.EscapeOutput
     684        echo apply_filters(
     685                /** This filter is documented in bp-activity/bp-activity-template.php. */
     686                'bp_activity_recurse_comments_end_ul',
     687                '</ul>'
     688        );
    693689}
    694690
     
    699695 */
    700696function bp_nouveau_activity_comment_action() {
    701         echo bp_nouveau_get_activity_comment_action();
     697        echo wp_kses(
     698                bp_nouveau_get_activity_comment_action(),
     699                array(
     700                        'a'    => array(
     701                                'href'  => true,
     702                                'class' => true,
     703                        ),
     704                        'time' => array(
     705                                'datetime'          => true,
     706                                'class'             => true,
     707                                'data-bp-timestamp' => true,
     708                        ),
     709                )
     710        );
    702711}
    703712
  • branches/12.0/src/bp-templates/bp-nouveau/includes/activity/widgets.php

    r13481 r13821  
    1111defined( 'ABSPATH' ) || exit;
    1212
    13 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     13_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' ) );
  • branches/12.0/src/bp-templates/bp-nouveau/includes/classes/class-bp-nouveau-object-nav-widget.php

    r13481 r13821  
    1111defined( 'ABSPATH' ) || exit;
    1212
    13 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     13_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' ) );
  • branches/12.0/src/bp-templates/bp-nouveau/includes/functions.php

    r13727 r13821  
    305305        }
    306306
    307         // Print the wrapper and its content.
     307        // phpcs:ignore WordPress.Security.EscapeOutput
    308308        printf( '<%1$s%2$s%3$s>%4$s</%1$s>', $container, $container_id, $container_classes, $output );
    309309}
  • branches/12.0/src/bp-templates/bp-nouveau/includes/groups/classes.php

    r13469 r13821  
    431431        public function __get( $key = '' ) {
    432432                /* translators: %s is the name of the function to use instead of the deprecated one */
    433                 _doing_it_wrong( 'bp_nouveau_group_meta', sprintf( __( 'Please use %s instead', 'buddypress' ), 'bp_nouveau_the_group_meta( array( \'keys\' => \'' . $key . '\' ) )' ) , '7.0.0' );
     433                _doing_it_wrong( 'bp_nouveau_group_meta', sprintf( esc_html__( 'Please use %s instead', 'buddypress' ), 'bp_nouveau_the_group_meta( array( \'keys\' => \'' . esc_html( $key ) . '\' ) )' ) , '7.0.0' );
    434434
    435435                // Backwards compatibility.
  • branches/12.0/src/bp-templates/bp-nouveau/includes/groups/template-tags.php

    r13645 r13821  
    436436                printf(
    437437                        '<form action="%s" method="post" enctype="multipart/form-data">',
    438                         bp_get_group_creation_form_action()
     438                        esc_url( bp_get_group_creation_form_action() )
    439439                );
    440440        }
     
    449449        );
    450450
    451         // The submit actions
     451        // phpcs:ignore WordPress.Security.EscapeOutput
    452452        echo $output;
    453453
     
    10891089
    10901090        if ( ! bp_is_group() ) {
     1091                // phpcs:ignore WordPress.Security.EscapeOutput
    10911092                echo $group_meta->meta;
    10921093        } else {
     
    11391140        }
    11401141
     1142        // phpcs:ignore WordPress.Security.EscapeOutput
    11411143        echo $meta;
    11421144}
     
    13651367 *                      Defaults to the group currently being iterated on in the groups loop.
    13661368 * @param int $length   Optional. Length of returned string, including ellipsis. Default: 100.
    1367  *
    1368  * @return string Excerpt.
    13691369 */
    13701370function bp_nouveau_group_description_excerpt( $group = null, $length = null ) {
    1371         echo bp_nouveau_get_group_description_excerpt( $group, $length );
     1371        // Escaping is made in `bp-groups/bp-groups-filters.php`.
     1372        // phpcs:ignore WordPress.Security.EscapeOutput
     1373        echo apply_filters(
     1374                /** This filter is documented in bp-groups/bp-groups-template.php. */
     1375                'bp_get_group_description_excerpt',
     1376                bp_nouveau_get_group_description_excerpt( $group, $length )
     1377        );
    13721378}
    13731379
  • branches/12.0/src/bp-templates/bp-nouveau/includes/members/template-tags.php

    r13652 r13821  
    479479 */
    480480function bp_nouveau_member_meta() {
     481        // Escaping is made in `bp_nouveau_get_member_meta()`.
     482        // phpcs:ignore WordPress.Security.EscapeOutput
    481483        echo join( "\n", bp_nouveau_get_member_meta() );
    482484}
     
    515517                        } else {
    516518                                $meta = array(
    517                                         'last_activity' => sprintf( '%s', bp_get_member_last_active() ),
     519                                        'last_activity' => sprintf( '%s', esc_html( bp_get_member_last_active() ) ),
    518520                                );
    519521                        }
     
    746748 */
    747749function bp_nouveau_member_description_edit_link() {
     750        // Escaping is made in `bp_nouveau_member_get_description_edit_link()`.
     751        // phpcs:ignore WordPress.Security.EscapeOutput
    748752        echo bp_nouveau_member_get_description_edit_link();
    749753}
  • branches/12.0/src/bp-templates/bp-nouveau/includes/messages/template-tags.php

    r13200 r13821  
    109109 */
    110110function bp_nouveau_message_search_form() {
    111         $search_form_html = bp_buffer_template_part( 'common/js-templates/messages/search-form', null, false );
    112 
    113111        /**
    114112         * Filters the private message component search form.
     
    118116         * @param string $search_form_html HTML markup for the message search form.
    119117         */
    120         echo apply_filters( 'bp_message_search_form', $search_form_html );
     118        $search_form_html = apply_filters(
     119                'bp_message_search_form',
     120                bp_buffer_template_part( 'common/js-templates/messages/search-form', null, false )
     121        );
     122
     123        echo wp_kses(
     124                $search_form_html,
     125                array(
     126                        'form'   => array(
     127                                'action'         => true,
     128                                'method'         => true,
     129                                'id'             => true,
     130                                'class'          => true,
     131                                'data-bp-search' => true,
     132                        ),
     133                        'label'  => array(
     134                                'for'   => true,
     135                                'class' => true,
     136                        ),
     137                        'input'  => array(
     138                                'type'        => true,
     139                                'id'          => true,
     140                                'name'        => true,
     141                                'placeholder' => true,
     142                                'class'       => true,
     143                        ),
     144                        'button' => array(
     145                                'type'  => true,
     146                                'name'  => true,
     147                                'id'    => true,
     148                                'class' => true,
     149                        ),
     150                        'span'   => array(
     151                                'class'       => true,
     152                                'aria-hidden' => true,
     153                        ),
     154                )
     155        );
    121156}
  • branches/12.0/src/bp-templates/bp-nouveau/includes/notifications/template-tags.php

    r12473 r13821  
    1616 */
    1717function bp_nouveau_notifications_filters() {
     18        // Escaping is made in `bp_nouveau_get_notifications_filters()`.
     19        // phpcs:ignore WordPress.Security.EscapeOutput
    1820        echo bp_nouveau_get_notifications_filters();
    1921}
  • branches/12.0/src/bp-templates/bp-nouveau/includes/template-tags.php

    r13652 r13821  
    187187 */
    188188function bp_nouveau_template_message() {
     189        // Escaping is made in `bp-core/bp-core-filters.php`.
     190        // phpcs:ignore WordPress.Security.EscapeOutput
    189191        echo bp_nouveau_get_template_message();
    190192}
     
    198200         */
    199201        function bp_nouveau_get_template_message() {
    200                 $bp_nouveau = bp_nouveau();
     202                $bp_nouveau       = bp_nouveau();
     203                $template_message = '';
     204                $type             = '';
    201205
    202206                if ( ! empty( $bp_nouveau->user_feedback['message'] ) ) {
    203                         $user_feedback = $bp_nouveau->user_feedback['message'];
    204 
    205                         // @TODO: why is this treated differently?
    206                         foreach ( array( 'wp_kses_data', 'wp_unslash', 'wptexturize', 'convert_smilies', 'convert_chars' ) as $filter ) {
    207                                 $user_feedback = call_user_func( $filter, $user_feedback );
    208                         }
    209 
    210                         return '<p>' . $user_feedback . '</p>';
     207                        $template_message = $bp_nouveau->user_feedback['message'];
     208                        $type             = 'updated';
    211209
    212210                } elseif ( ! empty( $bp_nouveau->template_message['message'] ) ) {
    213                         /**
    214                          * Filters the 'template_notices' feedback message content.
    215                          *
    216                          * @since 1.5.5
    217                          *
    218                          * @param string $template_message Feedback message content.
    219                          * @param string $type             The type of message being displayed.
    220                          *                                 Either 'updated' or 'error'.
    221                          */
    222                         return apply_filters( 'bp_core_render_message_content', $bp_nouveau->template_message['message'], bp_nouveau_get_template_message_type() );
    223                 }
     211                        $template_message = $bp_nouveau->template_message['message'];
     212                        $type             = bp_nouveau_get_template_message_type();
     213                }
     214
     215                /**
     216                 * Filters the 'template_notices' feedback message content.
     217                 *
     218                 * @since 1.5.5
     219                 *
     220                 * @param string $template_message Feedback message content.
     221                 * @param string $type             The type of message being displayed.
     222                 *                                 Either 'updated' or 'error'.
     223                 */
     224                return apply_filters( 'bp_core_render_message_content', $template_message, $type );
    224225        }
    225226
     
    10171018 */
    10181019function bp_nouveau_nav_scope() {
    1019         echo bp_nouveau_get_nav_scope();  // Escaped by bp_get_form_field_attributes().
     1020        // Escaping is made in `bp_get_form_field_attributes()`.
     1021        // phpcs:ignore WordPress.Security.EscapeOutput
     1022        echo bp_nouveau_get_nav_scope();
    10201023}
    10211024        /**
     
    19171920function bp_nouveau_search_form() {
    19181921        $search_form_html = bp_buffer_template_part( 'common/search/search-form', null, false );
     1922        $allowed_html     = array(
     1923                'div'    => array(
     1924                        'id'             => true,
     1925                        'class'          => true,
     1926                        'data-bp-search' => true,
     1927                ),
     1928                'form'   => array(
     1929                        'action' => true,
     1930                        'method' => true,
     1931                        'id'     => true,
     1932                        'class'  => true,
     1933                        'role'   => true,
     1934                ),
     1935                'label'  => array(
     1936                        'for'   => true,
     1937                        'class' => true,
     1938                ),
     1939                'input'  => array(
     1940                        'type'        => true,
     1941                        'id'          => true,
     1942                        'name'        => true,
     1943                        'placeholder' => true,
     1944                        'class'       => true,
     1945                ),
     1946                'button' => array(
     1947                        'type'  => true,
     1948                        'name'  => true,
     1949                        'id'    => true,
     1950                        'class' => true,
     1951                ),
     1952                'span'   => array(
     1953                        'id'          => true,
     1954                        'class'       => true,
     1955                        'aria-hidden' => true,
     1956                ),
     1957        );
    19191958
    19201959        $objects = bp_nouveau_get_search_objects();
    19211960        if ( empty( $objects['primary'] ) || empty( $objects['secondary'] ) ) {
    1922                 echo $search_form_html;
     1961                echo wp_kses( $search_form_html, $allowed_html );
    19231962                return;
    19241963        }
     
    19371976                 * @param string $search_form_html The HTML output for the directory search form.
    19381977                 */
    1939                 echo apply_filters( "bp_directory_{$objects['secondary']}_search_form", $search_form_html );
     1978                echo wp_kses( apply_filters( "bp_directory_{$objects['secondary']}_search_form", $search_form_html ), $allowed_html );
    19401979
    19411980                if ( 'activity' === $objects['secondary'] ) {
     
    19802019                         * @param string $search_form_html The HTML output for the directory search form.
    19812020                         */
    1982                         echo apply_filters( "bp_group_{$objects['secondary']}_search_form", $search_form_html );
     2021                        echo wp_kses( apply_filters( "bp_group_{$objects['secondary']}_search_form", $search_form_html ), $allowed_html );
    19832022
    19842023                } else {
     
    19902029                         * @param string $search_form_html HTML markup for the member search form.
    19912030                         */
    1992                         echo apply_filters( 'bp_directory_members_search_form', $search_form_html );
     2031                        echo wp_kses( apply_filters( 'bp_directory_members_search_form', $search_form_html ), $allowed_html );
    19932032                }
    19942033
     
    22092248 */
    22102249function bp_nouveau_filter_options() {
    2211         echo bp_nouveau_get_filter_options();  // Escaped in inner functions.
     2250        // Escaping is made in `bp_nouveau_get_filter_options()`.
     2251        // phpcs:ignore WordPress.Security.EscapeOutput
     2252        echo bp_nouveau_get_filter_options();
    22122253}
    22132254
     
    24152456                        </p>
    24162457
    2417                         <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
     2458                        <p class="description indicator-hint"><?php echo esc_html( wp_get_password_hint() ); ?></p>
    24182459                        <?php
    24192460                } else {
     
    24332474                        if ( 'radio' !== $type ) {
    24342475                                if ( $required ) {
    2435                                         printf( $label_output, esc_attr( $name ), esc_html( $label ), __( '(required)', 'buddypress' ) );
     2476                                        // phpcs:ignore WordPress.Security.EscapeOutput
     2477                                        printf( $label_output, esc_attr( $name ), esc_html( $label ), esc_html__( '(required)', 'buddypress' ) );
    24362478                                } else {
     2479                                        // phpcs:ignore WordPress.Security.EscapeOutput
    24372480                                        printf( $label_output, esc_attr( $name ), esc_html( $label ) );
    24382481                                }
     
    25182561                                esc_attr( $name ),
    25192562                                esc_attr( $id ),
     2563                                // phpcs:ignore WordPress.Security.EscapeOutput
    25202564                                $class,  // Constructed safely above.
    25212565                                esc_attr( $value ),
     2566                                // phpcs:ignore WordPress.Security.EscapeOutput
    25222567                                $attribute_type // Constructed safely above.
    25232568                        );
     
    25262571                        if ( 'radio' !== $type ) {
    25272572                                if ( 'signup_blog_url' !== $name ) {
     2573                                        // phpcs:ignore WordPress.Security.EscapeOutput
    25282574                                        print( $field_output );  // Constructed safely above.
    25292575
    25302576                                // If it's the signup blog url, it's specific to Multisite config.
    25312577                                } elseif ( is_subdomain_install() ) {
    2532                                         // Constructed safely above.
    25332578                                        printf(
    25342579                                                '%1$s %2$s . %3$s',
    25352580                                                is_ssl() ? 'https://' : 'http://',
    2536                                                 $field_output,
    2537                                                 bp_signup_get_subdomain_base()
     2581                                                // phpcs:ignore WordPress.Security.EscapeOutput
     2582                                                $field_output, // Constructed safely above.
     2583                                                esc_url( bp_signup_get_subdomain_base() )
    25382584                                        );
    25392585
     
    25422588                                        printf(
    25432589                                                '%1$s %2$s',
    2544                                                 home_url( '/' ),
     2590                                                esc_url( home_url( '/' ) ),
     2591                                                // phpcs:ignore WordPress.Security.EscapeOutput
    25452592                                                $field_output  // Constructed safely above.
    25462593                                        );
     
    25502597                        } else {
    25512598                                // $label_output and $field_output are constructed safely above.
     2599                                // phpcs:ignore WordPress.Security.EscapeOutput
    25522600                                printf( $label_output, esc_attr( $name ), $field_output . ' ' . esc_html( $label ) );
    25532601                        }
     
    26242672
    26252673        // Output the submit button.
     2674        // phpcs:disable WordPress.Security.EscapeOutput
    26262675        if ( isset( $submit_data['wrapper'] ) && false === $submit_data['wrapper'] ) {
    26272676                echo $submit_input;
     
    26312680                printf( '<div class="submit">%s</div>', $submit_input );
    26322681        }
     2682        // phpcs:enable
    26332683
    26342684        $nonce = $submit_data['nonce'];
Note: See TracChangeset for help on using the changeset viewer.