Make WordPress Core

Ticket #28836: meta-boxes.php.patch

File meta-boxes.php.patch, 5.3 KB (added by pbearne, 11 years ago)

patch with escaping added

  • wp-admin/includes/meta-boxes.php

     
    465465        $taxonomy = $r['taxonomy'];
    466466        $tax = get_taxonomy( $taxonomy );
    467467        ?>
    468         <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
    469                 <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
    470                         <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all"><?php echo $tax->labels->all_items; ?></a></li>
    471                         <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
     468        <div id="taxonomy-<?php echo esc_attr( $taxonomy ); ?>" class="categorydiv">
     469                <ul id="<?php echo esc_attr( $taxonomy ); ?>-tabs" class="category-tabs">
     470                        <li class="tabs"><a href="#<?php echo esc_attr( $taxonomy ); ?>-all"><?php echo esc_html( $tax->labels->all_items ); ?></a></li>
     471                        <li class="hide-if-no-js"><a href="#<?php echo esc_attr( $taxonomy ); ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
    472472                </ul>
    473473
    474                 <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">
    475                         <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >
     474                <div id="<?php echo esc_attr( $taxonomy ); ?>-pop" class="tabs-panel" style="display: none;">
     475                        <ul id="<?php echo esc_attr( $taxonomy ); ?>checklist-pop" class="categorychecklist form-no-clear" >
    476476                                <?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>
    477477                        </ul>
    478478                </div>
    479479
    480                 <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">
     480                <div id="<?php echo esc_attr( $taxonomy ); ?>-all" class="tabs-panel">
    481481                        <?php
    482             $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';
     482            $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . esc_attr( $taxonomy ) . ']';
    483483            echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
    484484            ?>
    485                         <ul id="<?php echo $taxonomy; ?>checklist" data-wp-lists="list:<?php echo $taxonomy?>" class="categorychecklist form-no-clear">
     485                        <ul id="<?php echo esc_attr( $taxonomy ) ; ?>checklist" data-wp-lists="list:<?php echo esc_attr( $taxonomy ); ?>" class="categorychecklist form-no-clear">
    486486                                <?php wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'popular_cats' => $popular_ids ) ) ?>
    487487                        </ul>
    488488                </div>
    489489        <?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
    490                         <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
     490                        <div id="<?php echo esc_attr( $taxonomy ); ?>-adder" class="wp-hidden-children">
    491491                                <h4>
    492                                         <a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js">
     492                                        <a id="<?php echo esc_attr( $taxonomy ); ?>-add-toggle" href="#<?php echo esc_attr( $taxonomy ); ?>-add" class="hide-if-no-js">
    493493                                                <?php
    494494                                                        /* translators: %s: add new taxonomy label */
    495495                                                        printf( __( '+ %s' ), $tax->labels->add_new_item );
     
    496496                                                ?>
    497497                                        </a>
    498498                                </h4>
    499                                 <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
    500                                         <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php echo $tax->labels->add_new_item; ?></label>
    501                                         <input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
    502                                         <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent">
    503                                                 <?php echo $tax->labels->parent_item_colon; ?>
     499                                <p id="<?php echo esc_attr( $taxonomy ); ?>-add" class="category-add wp-hidden-child">
     500                                        <label class="screen-reader-text" for="new<?php echo esc_attr( $taxonomy ); ?>"><?php echo $tax->labels->add_new_item; ?></label>
     501                                        <input type="text" name="new<?php echo esc_attr( $taxonomy ); ?>" id="new<?php echo esc_attr( $taxonomy ); ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
     502                                        <label class="screen-reader-text" for="new<?php echo esc_attr( $taxonomy ); ?>_parent">
     503                                                <?php echo esc_html( $tax->labels->parent_item_colon ); ?>
    504504                                        </label>
    505505                                        <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;' ) ); ?>
    506                                         <input type="button" id="<?php echo $taxonomy; ?>-add-submit" data-wp-lists="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
     506                                        <input type="button" id="<?php echo esc_attr( $taxonomy ); ?>-add-submit" data-wp-lists="add:<?php echo esc_attr( $taxonomy ) ?>checklist:<?php echo $taxonomy ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
    507507                                        <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?>
    508                                         <span id="<?php echo $taxonomy; ?>-ajax-response"></span>
     508                                        <span id="<?php echo esc_attr( $taxonomy ); ?>-ajax-response"></span>
    509509                                </p>
    510510                        </div>
    511511                <?php endif; ?>