Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/28/2024 12:23:47 PM (3 years ago)
Author:
imath
Message:

Core: improve PHP code standards using WPCS

See #7228 (trunk)

File:
1 edited

Legend:

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

    r13772 r13818  
    116116                        printf(
    117117                                // Translators: 1: is the url to the BP Components settings screen. 2: is the url to the xProfile administration screen.
    118                                 __( 'Components, Pages, Settings, and Forums, have been moved to <a href="%1$s">Settings &gt; BuddyPress</a>. Profile Fields has been moved into the <a href="%2$s">Users</a> menu.', 'buddypress' ),
     118                                esc_html__( 'Components, Pages, Settings, and Forums, have been moved to <a href="%1$s">Settings &gt; BuddyPress</a>. Profile Fields has been moved into the <a href="%2$s">Users</a> menu.', 'buddypress' ),
    119119                                esc_url( $settings_url ),
    120                                 bp_get_admin_url( 'users.php?page=bp-profile-setup' )
     120                                esc_url( bp_get_admin_url( 'users.php?page=bp-profile-setup' ) )
    121121                        );
    122122                        ?>
    … …  
    161161
    162162                foreach ( $notices as $notice ) {
    163                         printf( '<p>%s</p>', $notice['message'] );
     163                        printf(
     164                                '<p>%s</p>',
     165                                wp_kses(
     166                                        $notice['message'],
     167                                        array(
     168                                                'strong' => true,
     169                                                'code'   => true,
     170                                                'a'      => array(
     171                                                        'href' => true,
     172                                                ),
     173                                        )
     174                                )
     175                        );
    164176                }
    165177
    … …  
    423435                                <?php foreach ( $bp->admin->nav_tabs as $nav_tab ) : ?>
    424436
    425                                         <?php echo $nav_tab; ?>
     437                                        <?php
     438                                                echo wp_kses(
     439                                                        $nav_tab,
     440                                                        array(
     441                                                                'a' => array(
     442                                                                        'href'  => true,
     443                                                                        'class' => true
     444                                                                ),
     445                                                        )
     446                                                );
     447                                        ?>
    426448
    427449                                <?php endforeach; ?>
    … …  
    472494        }
    473495
     496        // phpcs:ignore WordPress.Security.EscapeOutput
    474497        echo implode( "\n", $tabs_html );
     498
    475499        /**
    476500         * Fires after the output of tabs for the admin area.
    … …  
    651675                _doing_it_wrong(
    652676                        'bp_core_admin_tabs()',
    653                         __( 'BuddyPress Settings and Tools Screens are now using a new tabbed header. Please use `bp_core_admin_tabbed_screen_header()` instead of bp_core_admin_tabs() to output tabs.', 'buddypress' ),
     677                        esc_html__( 'BuddyPress Settings and Tools Screens are now using a new tabbed header. Please use `bp_core_admin_tabbed_screen_header()` instead of bp_core_admin_tabs() to output tabs.', 'buddypress' ),
    654678                        '10.0.0'
    655679                );
    … …  
    11941218        }
    11951219
     1220        // phpcs:ignore WordPress.Security.EscapeOutput
    11961221        echo preg_replace( '/\<div(\sclass=\".*\"\s|\s)id=\"tabs-panel-posttype-bp_nav_menu_item-search\"[^>]*>(.*?)\<\/div\>/s', $all_bp_tabs, $output );
    11971222}
    … …  
    12751300
    12761301        $tax_name = esc_attr( $r['taxonomy'] );
     1302
     1303        // phpcs:disable WordPress.Security.EscapeOutput
    12771304        ?>
    12781305        <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
    … …  
    12981325        </div>
    12991326        <?php
     1327        // phpcs:enable
    13001328}
    13011329
    … …  
    13271355        <?php
    13281356                /* translators: accessibility text */
    1329                 _e( 'Plain text email content', 'buddypress' );
     1357                esc_html_e( 'Plain text email content', 'buddypress' );
    13301358        ?>
    1331         </label><textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
    1332 
    1333         <p><?php _e( 'Most email clients support HTML email. However, some people prefer to receive plain text email. Enter a plain text alternative version of your email here.', 'buddypress' ); ?></p>
     1359        </label>
     1360                <textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php
     1361                        // phpcs:ignore WordPress.Security.EscapeOutput
     1362                        echo $post->post_excerpt; ?>
     1363                </textarea>
     1364
     1365        <p><?php esc_html_e( 'Most email clients support HTML email. However, some people prefer to receive plain text email. Enter a plain text alternative version of your email here.', 'buddypress' ); ?></p>
    13341366
    13351367        <?php
    … …  
    16081640                <a class="bp-welcome-panel-close bp-is-dismissible" href="#" data-notice_id="<?php echo esc_attr( $notification->id ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the notification', 'buddypress' ); ?>"><?php esc_html_e( 'Dismiss', 'buddypress' ); ?></a>
    16091641                <div class="bp-welcome-panel-content">
    1610                         <h2><span class="bp-version"><?php echo number_format_i18n( $notification->version, 1 ); ?></span> <?php echo esc_html( $notification->title ); ?></h2>
     1642                        <h2><span class="bp-version"><?php echo esc_html( number_format_i18n( $notification->version, 1 ) ); ?></span> <?php echo esc_html( $notification->title ); ?></h2>
    16111643                        <p class="about-description">
    16121644                                <?php echo wp_kses( $notification->content, array( 'a' => array( 'href' => true ), 'br' => array(), 'strong' => array() ) ); ?>
Note: See TracChangeset for help on using the changeset viewer.