Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/28/2024 12:35:08 PM (12 months ago)
Author:
imath
Message:

Core: improve PHP code standards using WPCS

See #7228 (branch 12.0)

File:
1 edited

Legend:

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

    r13693 r13819  
    9292        $list_type = bp_is_group() ? 'groups' : 'personal';
    9393
    94         /**
    95          * Filters the "options nav", the secondary-level single item navigation menu.
    96          *
    97          * This is a dynamic filter that is dependent on the provided css_id value.
    98          *
    99          * @since 1.1.0
    100          *
    101          * @param string $value         HTML list item for the submenu item.
    102          * @param array  $subnav_item   Submenu array item being displayed.
    103          * @param string $selected_item Current action.
    104          */
    105         echo apply_filters( 'bp_get_options_nav_' . $subnav_item->css_id, '<li id="' . esc_attr( $subnav_item->css_id . '-' . $list_type . '-li' ) . '" ' . $selected . '><a id="' . esc_attr( $subnav_item->css_id ) . '" href="' . esc_url( $subnav_item->link ) . '">' . $subnav_item->name . '</a></li>', $subnav_item, $selected_item );
     94        // phpcs:ignore WordPress.Security.EscapeOutput
     95        echo apply_filters(
     96            /**
     97             * Filters the "options nav", the secondary-level single item navigation menu.
     98             *
     99             * This is a dynamic filter that is dependent on the provided css_id value.
     100             *
     101             * @since 1.1.0
     102             *
     103             * @param string $value         HTML list item for the submenu item.
     104             * @param array  $subnav_item   Submenu array item being displayed.
     105             * @param string $selected_item Current action.
     106             */
     107            'bp_get_options_nav_' . $subnav_item->css_id,
     108            '<li id="' . esc_attr( $subnav_item->css_id . '-' . $list_type . '-li' ) . '" ' . $selected . '><a id="' . esc_attr( $subnav_item->css_id ) . '" href="' . esc_url( $subnav_item->link ) . '">' . wp_kses( $subnav_item->name, array( 'span' => array( 'class' => true ) ) ) . '</a></li>',
     109            $subnav_item,
     110            $selected_item
     111        );
    106112    }
    107113}
     
    150156 */
    151157function bp_avatar_admin_step() {
    152     echo bp_get_avatar_admin_step();
     158    echo esc_html( bp_get_avatar_admin_step() );
    153159}
    154160    /**
     
    182188 */
    183189function bp_avatar_to_crop() {
    184     echo bp_get_avatar_to_crop();
     190    echo esc_url( bp_get_avatar_to_crop() );
    185191}
    186192    /**
     
    213219 */
    214220function bp_avatar_to_crop_src() {
    215     echo bp_get_avatar_to_crop_src();
     221    echo esc_attr( bp_get_avatar_to_crop_src() );
    216222}
    217223    /**
     
    244250 */
    245251function bp_site_name() {
    246     echo bp_get_site_name();
     252    echo esc_html( bp_get_site_name() );
    247253}
    248254    /**
     
    381387             * @param string $youtext Context-determined string to display.
    382388             */
    383             echo apply_filters( 'bp_word_or_name', $youtext );
     389            echo esc_html( apply_filters( 'bp_word_or_name', $youtext ) );
    384390        } else {
    385391
     
    394400
    395401            /** This filter is documented in bp-core/bp-core-template.php */
    396             echo apply_filters( 'bp_word_or_name', $nametext );
     402            echo esc_html( apply_filters( 'bp_word_or_name', $nametext ) );
    397403        } else {
    398404
     
    558564 */
    559565function bp_search_default_text( $component = '' ) {
    560     echo bp_get_search_default_text( $component );
     566    echo esc_attr( bp_get_search_default_text( $component ) );
    561567}
    562568    /**
     
    614620 */
    615621function bp_form_field_attributes( $name = '', $attributes = array() ) {
     622    // phpcs:ignore WordPress.Security.EscapeOutput
    616623    echo bp_get_form_field_attributes( $name, $attributes );
    617624}
     
    696703 */
    697704function bp_button( $args = '' ) {
     705    // Escaping is done in `BP_Core_HTML_Element()`.
     706    // phpcs:ignore WordPress.Security.EscapeOutput
    698707    echo bp_get_button( $args );
    699708}
     
    970979 */
    971980function bp_total_member_count() {
    972     echo bp_get_total_member_count();
     981    echo esc_html( bp_get_total_member_count() );
    973982}
    974983    /**
     
    13251334 */
    13261335function bp_root_slug( $component = '' ) {
    1327     echo bp_get_root_slug( $component );
     1336    echo esc_url( bp_get_root_slug( $component ) );
    13281337}
    13291338    /**
     
    14551464 */
    14561465function bp_search_slug() {
    1457     echo bp_get_search_slug();
     1466    echo esc_url( bp_get_search_slug() );
    14581467}
    14591468    /**
     
    31413150 */
    31423151function bp_the_body_class() {
    3143     echo bp_get_the_body_class();
     3152    echo implode( ' ', array_map( 'sanitize_html_class', bp_get_the_body_class() ) );
    31443153}
    31453154    /**
     
    37033712
    37043713    if ( ! empty( $args->echo ) ) {
     3714        // phpcs:ignore WordPress.Security.EscapeOutput
    37053715        echo $nav_menu;
    37063716    } else {
     
    37173727 */
    37183728function bp_email_the_salutation( $settings = array() ) {
    3719     echo bp_email_get_salutation( $settings );
     3729    echo esc_html( bp_email_get_salutation( $settings ) );
    37203730}
    37213731
Note: See TracChangeset for help on using the changeset viewer.