Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/19/2015 04:27:37 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Templates: Escape all gettext output in default template parts. See #1999.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/templates/default/bbpress-functions.php

    r5466 r5688  
    4949        parent::__construct( bbp_parse_args( $properties, array(
    5050            'id'      => 'default',
    51             'name'    => __( 'bbPress Default', 'bbpress' ),
     51            'name'    => 'bbPress Default',
    5252            'version' => bbp_get_version(),
    5353            'dir'     => trailingslashit( bbpress()->themes_dir . 'default' ),
     
    241241            wp_localize_script( 'bbpress-forum', 'bbpForumJS', array(
    242242                'bbp_ajaxurl'        => bbp_get_ajax_url(),
    243                 'generic_ajax_error' => __( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
     243                'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
    244244                'is_user_logged_in'  => is_user_logged_in(),
    245245                'subs_nonce'         => wp_create_nonce( 'toggle-subscription_' . get_the_ID() )
     
    250250            wp_localize_script( 'bbpress-topic', 'bbpTopicJS', array(
    251251                'bbp_ajaxurl'        => bbp_get_ajax_url(),
    252                 'generic_ajax_error' => __( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
     252                'generic_ajax_error' => esc_html__( 'Something went wrong. Refresh your browser and try again.', 'bbpress' ),
    253253                'is_user_logged_in'  => is_user_logged_in(),
    254254                'fav_nonce'          => wp_create_nonce( 'toggle-favorite_' .     get_the_ID() ),
     
    278278        // Bail if subscriptions are not active
    279279        if ( ! bbp_is_subscriptions_active() ) {
    280             bbp_ajax_response( false, __( 'Subscriptions are no longer active.', 'bbpress' ), 300 );
     280            bbp_ajax_response( false, esc_html__( 'Subscriptions are no longer active.', 'bbpress' ), 300 );
    281281        }
    282282
    283283        // Bail if user is not logged in
    284284        if ( ! is_user_logged_in() ) {
    285             bbp_ajax_response( false, __( 'Please login to subscribe to this forum.', 'bbpress' ), 301 );
     285            bbp_ajax_response( false, esc_html__( 'Please login to subscribe to this forum.', 'bbpress' ), 301 );
    286286        }
    287287
     
    292292        // Bail if user cannot add favorites for this user
    293293        if ( ! current_user_can( 'edit_user', $user_id ) ) {
    294             bbp_ajax_response( false, __( 'You do not have permission to do this.', 'bbpress' ), 302 );
     294            bbp_ajax_response( false, esc_html__( 'You do not have permission to do this.', 'bbpress' ), 302 );
    295295        }
    296296
     
    300300        // Bail if forum cannot be found
    301301        if ( empty( $forum ) ) {
    302             bbp_ajax_response( false, __( 'The forum could not be found.', 'bbpress' ), 303 );
     302            bbp_ajax_response( false, esc_html__( 'The forum could not be found.', 'bbpress' ), 303 );
    303303        }
    304304
    305305        // Bail if user did not take this action
    306306        if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'toggle-subscription_' . $forum->ID ) ) {
    307             bbp_ajax_response( false, __( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
     307            bbp_ajax_response( false, esc_html__( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
    308308        }
    309309
     
    313313        // Bail if action failed
    314314        if ( empty( $status ) ) {
    315             bbp_ajax_response( false, __( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
     315            bbp_ajax_response( false, esc_html__( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
    316316        }
    317317
     
    346346        // Bail if favorites are not active
    347347        if ( ! bbp_is_favorites_active() ) {
    348             bbp_ajax_response( false, __( 'Favorites are no longer active.', 'bbpress' ), 300 );
     348            bbp_ajax_response( false, esc_html__( 'Favorites are no longer active.', 'bbpress' ), 300 );
    349349        }
    350350
    351351        // Bail if user is not logged in
    352352        if ( ! is_user_logged_in() ) {
    353             bbp_ajax_response( false, __( 'Please login to make this topic a favorite.', 'bbpress' ), 301 );
     353            bbp_ajax_response( false, esc_html__( 'Please login to make this topic a favorite.', 'bbpress' ), 301 );
    354354        }
    355355
     
    360360        // Bail if user cannot add favorites for this user
    361361        if ( ! current_user_can( 'edit_user', $user_id ) ) {
    362             bbp_ajax_response( false, __( 'You do not have permission to do this.', 'bbpress' ), 302 );
     362            bbp_ajax_response( false, esc_html__( 'You do not have permission to do this.', 'bbpress' ), 302 );
    363363        }
    364364
     
    368368        // Bail if topic cannot be found
    369369        if ( empty( $topic ) ) {
    370             bbp_ajax_response( false, __( 'The topic could not be found.', 'bbpress' ), 303 );
     370            bbp_ajax_response( false, esc_html__( 'The topic could not be found.', 'bbpress' ), 303 );
    371371        }
    372372
    373373        // Bail if user did not take this action
    374374        if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'toggle-favorite_' . $topic->ID ) ) {
    375             bbp_ajax_response( false, __( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
     375            bbp_ajax_response( false, esc_html__( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
    376376        }
    377377
     
    381381        // Bail if action failed
    382382        if ( empty( $status ) ) {
    383             bbp_ajax_response( false, __( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
     383            bbp_ajax_response( false, esc_html__( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
    384384        }
    385385
     
    414414        // Bail if subscriptions are not active
    415415        if ( ! bbp_is_subscriptions_active() ) {
    416             bbp_ajax_response( false, __( 'Subscriptions are no longer active.', 'bbpress' ), 300 );
     416            bbp_ajax_response( false, esc_html__( 'Subscriptions are no longer active.', 'bbpress' ), 300 );
    417417        }
    418418
    419419        // Bail if user is not logged in
    420420        if ( ! is_user_logged_in() ) {
    421             bbp_ajax_response( false, __( 'Please login to subscribe to this topic.', 'bbpress' ), 301 );
     421            bbp_ajax_response( false, esc_html__( 'Please login to subscribe to this topic.', 'bbpress' ), 301 );
    422422        }
    423423
     
    428428        // Bail if user cannot add favorites for this user
    429429        if ( ! current_user_can( 'edit_user', $user_id ) ) {
    430             bbp_ajax_response( false, __( 'You do not have permission to do this.', 'bbpress' ), 302 );
     430            bbp_ajax_response( false, esc_html__( 'You do not have permission to do this.', 'bbpress' ), 302 );
    431431        }
    432432
     
    436436        // Bail if topic cannot be found
    437437        if ( empty( $topic ) ) {
    438             bbp_ajax_response( false, __( 'The topic could not be found.', 'bbpress' ), 303 );
     438            bbp_ajax_response( false, esc_html__( 'The topic could not be found.', 'bbpress' ), 303 );
    439439        }
    440440
    441441        // Bail if user did not take this action
    442442        if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'toggle-subscription_' . $topic->ID ) ) {
    443             bbp_ajax_response( false, __( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
     443            bbp_ajax_response( false, esc_html__( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
    444444        }
    445445
     
    449449        // Bail if action failed
    450450        if ( empty( $status ) ) {
    451             bbp_ajax_response( false, __( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
     451            bbp_ajax_response( false, esc_html__( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
    452452        }
    453453
Note: See TracChangeset for help on using the changeset viewer.