Make WordPress Core

Ticket #23012: 23012.5.diff

File 23012.5.diff, 36.3 KB (added by wonderboymusic, 11 years ago)
  • src/wp-includes/default-widgets.php

     
    7878         */
    7979        public function update( $new_instance, $old_instance ) {
    8080                $instance = $old_instance;
    81                 $instance['title'] = strip_tags($new_instance['title']);
     81                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    8282                if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
    8383                        $instance['sortby'] = $new_instance['sortby'];
    8484                } else {
     
    8585                        $instance['sortby'] = 'menu_order';
    8686                }
    8787
    88                 $instance['exclude'] = strip_tags( $new_instance['exclude'] );
     88                $instance['exclude'] = sanitize_text_field( $new_instance['exclude'] );
    8989
    9090                return $instance;
    9191        }
     
    9696        public function form( $instance ) {
    9797                //Defaults
    9898                $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
    99                 $title = esc_attr( $instance['title'] );
    100                 $exclude = esc_attr( $instance['exclude'] );
    10199        ?>
    102                 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
    103100                <p>
    104                         <label for="<?php echo $this->get_field_id('sortby'); ?>"><?php _e( 'Sort by:' ); ?></label>
    105                         <select name="<?php echo $this->get_field_name('sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat">
     101                        <label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e('Title:'); ?></label>
     102                        <input class="widefat" id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
     103                </p>
     104                <p>
     105                        <label for="<?php echo esc_attr( $this->get_field_id('sortby') ); ?>"><?php _e( 'Sort by:' ); ?></label>
     106                        <select name="<?php echo esc_attr( $this->get_field_name('sortby') ); ?>" id="<?php echo esc_attr( $this->get_field_id('sortby') ); ?>" class="widefat">
    106107                                <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
    107108                                <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
    108109                                <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
     
    109110                        </select>
    110111                </p>
    111112                <p>
    112                         <label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" />
     113                        <label for="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo esc_attr( $instance['exclude'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'exclude' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>" class="widefat" />
    113114                        <br />
    114115                        <small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
    115116                </p>
     
    201202                        $limit = -1;
    202203?>
    203204                <p>
    204                 <label for="<?php echo $this->get_field_id('category'); ?>"><?php _e( 'Select Link Category:' ); ?></label>
    205                 <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">
     205                <label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php _e( 'Select Link Category:' ); ?></label>
     206                <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>">
    206207                <option value=""><?php _ex('All Links', 'links widget'); ?></option>
    207208                <?php
    208209                foreach ( $link_cats as $link_cat ) {
     
    212213                }
    213214                ?>
    214215                </select>
    215                 <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Sort by:' ); ?></label>
    216                 <select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
     216                <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php _e( 'Sort by:' ); ?></label>
     217                <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
    217218                        <option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title' ); ?></option>
    218219                        <option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating' ); ?></option>
    219220                        <option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID' ); ?></option>
     
    221222                </select>
    222223                </p>
    223224                <p>
    224                 <input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" />
    225                 <label for="<?php echo $this->get_field_id('images'); ?>"><?php _e('Show Link Image'); ?></label><br />
    226                 <input class="checkbox" type="checkbox" <?php checked($instance['name'], true) ?> id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" />
    227                 <label for="<?php echo $this->get_field_id('name'); ?>"><?php _e('Show Link Name'); ?></label><br />
    228                 <input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>" />
    229                 <label for="<?php echo $this->get_field_id('description'); ?>"><?php _e('Show Link Description'); ?></label><br />
    230                 <input class="checkbox" type="checkbox" <?php checked($instance['rating'], true) ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" />
    231                 <label for="<?php echo $this->get_field_id('rating'); ?>"><?php _e('Show Link Rating'); ?></label>
     225                <input class="checkbox" type="checkbox" <?php checked( $instance['images'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'images' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'images' ) ); ?>" />
     226                <label for="<?php echo esc_attr( $this->get_field_id( 'images' ) ); ?>"><?php _e('Show Link Image'); ?></label><br />
     227                <input class="checkbox" type="checkbox" <?php checked( $instance['name'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'name' ) ); ?>" />
     228                <label for="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>"><?php _e('Show Link Name'); ?></label><br />
     229                <input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" />
     230                <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><?php _e('Show Link Description'); ?></label><br />
     231                <input class="checkbox" type="checkbox" <?php checked( $instance['rating'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'rating' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'rating' ) ); ?>" />
     232                <label for="<?php echo esc_attr( $this->get_field_id( 'rating' ) ); ?>"><?php _e('Show Link Rating'); ?></label>
    232233                </p>
    233234                <p>
    234                 <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e( 'Number of links to show:' ); ?></label>
    235                 <input id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
     235                <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of links to show:' ); ?></label>
     236                <input id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
    236237                </p>
    237238<?php
    238239        }
     
    276277                $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    277278                $title = $instance['title'];
    278279?>
    279                 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
     280                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
    280281<?php
    281282        }
    282283
     
    288289        public function update( $new_instance, $old_instance ) {
    289290                $instance = $old_instance;
    290291                $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
    291                 $instance['title'] = strip_tags($new_instance['title']);
     292                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    292293                return $instance;
    293294        }
    294295
     
    400401        public function update( $new_instance, $old_instance ) {
    401402                $instance = $old_instance;
    402403                $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
    403                 $instance['title'] = strip_tags($new_instance['title']);
     404                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    404405                $instance['count'] = $new_instance['count'] ? 1 : 0;
    405406                $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
    406407
     
    412413         */
    413414        public function form( $instance ) {
    414415                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
    415                 $title = strip_tags($instance['title']);
    416                 $count = $instance['count'] ? 'checked="checked"' : '';
    417                 $dropdown = $instance['dropdown'] ? 'checked="checked"' : '';
    418416?>
    419                 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
     417                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
    420418                <p>
    421                         <input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e('Display as dropdown'); ?></label>
     419                        <input class="checkbox" type="checkbox" <?php checked( $instance['dropdown'] ); ?> id="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'dropdown' ) ); ?>" /> <label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php _e( 'Display as dropdown' ); ?></label>
    422420                        <br/>
    423                         <input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Show post counts'); ?></label>
     421                        <input class="checkbox" type="checkbox" <?php checked( $instance['count'] ); ?> id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>" /> <label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php _e( 'Show post counts' ); ?></label>
    424422                </p>
    425423<?php
    426424        }
     
    456454                        <ul>
    457455                        <?php wp_register(); ?>
    458456                        <li><?php wp_loginout(); ?></li>
    459                         <li><a href="<?php bloginfo('rss2_url'); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
    460                         <li><a href="<?php bloginfo('comments_rss2_url'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
     457                        <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
     458                        <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
    461459<?php
    462460                        /**
    463461                         * Filter the "Powered by WordPress" text in the Meta widget.
     
    486484         */
    487485        public function update( $new_instance, $old_instance ) {
    488486                $instance = $old_instance;
    489                 $instance['title'] = strip_tags($new_instance['title']);
     487                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    490488
    491489                return $instance;
    492490        }
     
    496494         */
    497495        public function form( $instance ) {
    498496                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    499                 $title = strip_tags($instance['title']);
    500497?>
    501                         <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
     498                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
    502499<?php
    503500        }
    504501}
     
    540537         */
    541538        public function update( $new_instance, $old_instance ) {
    542539                $instance = $old_instance;
    543                 $instance['title'] = strip_tags($new_instance['title']);
     540                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    544541
    545542                return $instance;
    546543        }
     
    550547         */
    551548        public function form( $instance ) {
    552549                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    553                 $title = strip_tags($instance['title']);
    554550?>
    555                 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
    556                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
     551                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label>
     552                <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
    557553<?php
    558554        }
    559555}
     
    604600         */
    605601        public function update( $new_instance, $old_instance ) {
    606602                $instance = $old_instance;
    607                 $instance['title'] = strip_tags($new_instance['title']);
     603                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    608604                if ( current_user_can('unfiltered_html') )
    609605                        $instance['text'] =  $new_instance['text'];
    610606                else
    611                         $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
     607                        $instance['text'] = wp_kses_post( $new_instance['text'] );
    612608                $instance['filter'] = ! empty( $new_instance['filter'] );
    613609                return $instance;
    614610        }
     
    618614         */
    619615        public function form( $instance ) {
    620616                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    621                 $title = strip_tags($instance['title']);
    622                 $text = esc_textarea($instance['text']);
    623 ?>
    624                 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
    625                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
     617                $filter = isset( $instance['filter'] ) ? $instance['filter'] : 0;
     618                ?>
     619                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label>
     620                <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
    626621
    627                 <p><label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
    628                 <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea></p>
     622                <p><label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php _e( 'Content:' ); ?></label>
     623                <textarea class="widefat" rows="16" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea></p>
    629624
    630                 <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>
     625                <p><input id="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'filter' ) ); ?>" type="checkbox" <?php checked( $filter ); ?> />&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>
    631626<?php
    632627        }
    633628}
     
    736731         */
    737732        public function update( $new_instance, $old_instance ) {
    738733                $instance = $old_instance;
    739                 $instance['title'] = strip_tags($new_instance['title']);
     734                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    740735                $instance['count'] = !empty($new_instance['count']) ? 1 : 0;
    741736                $instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
    742737                $instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;
     
    750745        public function form( $instance ) {
    751746                //Defaults
    752747                $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    753                 $title = esc_attr( $instance['title'] );
    754748                $count = isset($instance['count']) ? (bool) $instance['count'] :false;
    755749                $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
    756750                $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
    757751?>
    758                 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
    759                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
     752                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label>
     753                <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
    760754
    761                 <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> />
    762                 <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
     755                <p><input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'dropdown' ) ); ?>"<?php checked( $dropdown ); ?> />
     756                <label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php _e('Display as dropdown'); ?></label><br />
    763757
    764                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
    765                 <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />
     758                <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>"<?php checked( $count ); ?> />
     759                <label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php _e('Show post counts'); ?></label><br />
    766760
    767                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
    768                 <label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
     761                <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'hierarchical' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hierarchical' ) ); ?>"<?php checked( $hierarchical ); ?> />
     762                <label for="<?php echo esc_attr( $this->get_field_id( 'hierarchical' ) ); ?>"><?php _e('Show hierarchy'); ?></label></p>
    769763<?php
    770764        }
    771765
     
    877871         */
    878872        public function update( $new_instance, $old_instance ) {
    879873                $instance = $old_instance;
    880                 $instance['title'] = strip_tags($new_instance['title']);
     874                $instance['title'] = santize_text_field( $new_instance['title'] );
    881875                $instance['number'] = (int) $new_instance['number'];
    882876                $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
    883877                $this->flush_widget_cache();
     
    904898                $number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
    905899                $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false;
    906900?>
    907                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
    908                 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
     901                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label>
     902                <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
    909903
    910                 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
    911                 <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
     904                <p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e('Number of posts to show:'); ?></label>
     905                <input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3" /></p>
    912906
    913                 <p><input class="checkbox" type="checkbox" <?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" />
    914                 <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display post date?' ); ?></label></p>
     907                <p><input class="checkbox" type="checkbox" <?php checked( $show_date ); ?> id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" />
     908                <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>"><?php _e('Display post date?'); ?></label></p>
    915909<?php
    916910        }
    917911}
     
    10541048         */
    10551049        public function update( $new_instance, $old_instance ) {
    10561050                $instance = $old_instance;
    1057                 $instance['title'] = strip_tags($new_instance['title']);
     1051                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    10581052                $instance['number'] = absint( $new_instance['number'] );
    10591053                $this->flush_widget_cache();
    10601054
     
    10691063         * @param array $instance
    10701064         */
    10711065        public function form( $instance ) {
    1072                 $title  = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    1073                 $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
     1066                $title = isset( $instance['title'] ) ? $instance['title'] : '';
     1067                $number = isset( $instance['number'] ) ? $instance['number'] : 5;
    10741068?>
    1075                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
    1076                 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
     1069                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e('Title:'); ?></label>
     1070                <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
    10771071
    1078                 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label>
    1079                 <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
     1072                <p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e('Number of comments to show:'); ?></label>
     1073                <input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo absint( $number ); ?>" size="3" /></p>
    10801074<?php
    10811075        }
    10821076}
     
    11211115                if ( ! is_wp_error($rss) ) {
    11221116                        $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
    11231117                        if ( empty($title) )
    1124                                 $title = esc_html(strip_tags($rss->get_title()));
    1125                         $link = esc_url(strip_tags($rss->get_permalink()));
     1118                                $title = strip_tags( $rss->get_title() );
     1119                        $link = strip_tags( $rss->get_permalink() );
    11261120                        while ( stristr($link, 'http') != $link )
    11271121                                $link = substr($link, 1);
    11281122                }
     
    11331127                /** This filter is documented in wp-includes/default-widgets.php */
    11341128                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    11351129
    1136                 $url = esc_url(strip_tags($url));
    1137                 $icon = includes_url('images/rss.png');
     1130                $url = strip_tags( $url );
     1131                $icon = includes_url( 'images/rss.png' );
    11381132                if ( $title )
    1139                         $title = "<a class='rsswidget' href='$url'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link'>$title</a>";
     1133                        $title = '<a class="rsswidget" href="' . esc_url( $url ) . '"><img style="border:0" width="14" height="14" src="' . esc_url( $icon ) . '" alt="RSS" /></a> <a class="rsswidget" href="' . esc_url( $link ) . '">"'. esc_html( $title ) .'"</a>';
    11401134
    11411135                echo $args['before_widget'];
    11421136                if ( $title ) {
     
    12891283        $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true );
    12901284        $inputs = wp_parse_args( $inputs, $default_inputs );
    12911285
    1292         $args['number'] = esc_attr( $args['number'] );
    1293         $args['title'] = isset( $args['title'] ) ? esc_attr( $args['title'] ) : '';
    1294         $args['url'] = isset( $args['url'] ) ? esc_url( $args['url'] ) : '';
     1286        $args['title'] = isset( $args['title'] ) ? $args['title'] : '';
     1287        $args['url'] = isset( $args['url'] ) ? $args['url'] : '';
    12951288        $args['items'] = isset( $args['items'] ) ? (int) $args['items'] : 0;
    12961289
    12971290        if ( $args['items'] < 1 || 20 < $args['items'] ) {
     
    13081301
    13091302        if ( $inputs['url'] ) :
    13101303?>
    1311         <p><label for="rss-url-<?php echo $args['number']; ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label>
    1312         <input class="widefat" id="rss-url-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][url]" type="text" value="<?php echo $args['url']; ?>" /></p>
     1304        <p><label for="rss-url-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label>
     1305        <input class="widefat" id="rss-url-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][url]" type="text" value="<?php echo esc_url( $args['url'] ); ?>" /></p>
    13131306<?php endif; if ( $inputs['title'] ) : ?>
    1314         <p><label for="rss-title-<?php echo $args['number']; ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label>
    1315         <input class="widefat" id="rss-title-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][title]" type="text" value="<?php echo $args['title']; ?>" /></p>
     1307        <p><label for="rss-title-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label>
     1308        <input class="widefat" id="rss-title-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][title]" type="text" value="<?php echo esc_attr( $args['title'] ); ?>" /></p>
    13161309<?php endif; if ( $inputs['items'] ) : ?>
    1317         <p><label for="rss-items-<?php echo $args['number']; ?>"><?php _e( 'How many items would you like to display?' ); ?></label>
    1318         <select id="rss-items-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][items]">
    1319 <?php
    1320                 for ( $i = 1; $i <= 20; ++$i ) {
    1321                         echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>";
    1322                 }
    1323 ?>
     1310        <p><label for="rss-items-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'How many items would you like to display?' ); ?></label>
     1311        <select id="rss-items-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][items]">
     1312        <?php
     1313        for ( $i = 1; $i <= 20; ++$i ) {
     1314                echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>";
     1315        }
     1316        ?>
    13241317        </select></p>
    13251318<?php endif; if ( $inputs['show_summary'] ) : ?>
    1326         <p><input id="rss-show-summary-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> />
    1327         <label for="rss-show-summary-<?php echo $args['number']; ?>"><?php _e( 'Display item content?' ); ?></label></p>
     1319        <p><input id="rss-show-summary-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> />
     1320        <label for="rss-show-summary-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Display item content?' ); ?></label></p>
    13281321<?php endif; if ( $inputs['show_author'] ) : ?>
    1329         <p><input id="rss-show-author-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> />
    1330         <label for="rss-show-author-<?php echo $args['number']; ?>"><?php _e( 'Display item author if available?' ); ?></label></p>
     1322        <p><input id="rss-show-author-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> />
     1323        <label for="rss-show-author-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Display item author if available?' ); ?></label></p>
    13311324<?php endif; if ( $inputs['show_date'] ) : ?>
    1332         <p><input id="rss-show-date-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?>/>
    1333         <label for="rss-show-date-<?php echo $args['number']; ?>"><?php _e( 'Display item date?' ); ?></label></p>
     1325        <p><input id="rss-show-date-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?>/>
     1326        <label for="rss-show-date-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Display item date?' ); ?></label></p>
    13341327<?php
    13351328        endif;
    13361329        foreach ( array_keys($default_inputs) as $input ) :
     
    13371330                if ( 'hidden' === $inputs[$input] ) :
    13381331                        $id = str_replace( '_', '-', $input );
    13391332?>
    1340         <input type="hidden" id="rss-<?php echo $id; ?>-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][<?php echo $input; ?>]" value="<?php echo $args[ $input ]; ?>" />
     1333        <input type="hidden" id="rss-<?php echo esc_attr( $id ); ?>-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][<?php echo esc_attr( $input ); ?>]" value="<?php echo esc_attr( $args[ $input ] ); ?>" />
    13411334<?php
    13421335                endif;
    13431336        endforeach;
     
    14511444         */
    14521445        public function update( $new_instance, $old_instance ) {
    14531446                $instance = array();
    1454                 $instance['title'] = strip_tags(stripslashes($new_instance['title']));
     1447                $instance['title'] = sanitize_text_field( $new_instance['title'] );
    14551448                $instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
    14561449                return $instance;
    14571450        }
     
    14611454         */
    14621455        public function form( $instance ) {
    14631456                $current_taxonomy = $this->_get_current_taxonomy($instance);
     1457                $title = isset( $instance['title'] ) ? $instance['title'] : '';
    14641458?>
    1465         <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
    1466         <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p>
    1467         <p><label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:') ?></label>
    1468         <select class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>">
     1459        <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ) ?></label>
     1460        <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>" /></p>
     1461        <p><label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php _e( 'Taxonomy:' ) ?></label>
     1462        <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>">
    14691463        <?php foreach ( get_taxonomies() as $taxonomy ) :
    1470                                 $tax = get_taxonomy($taxonomy);
    1471                                 if ( !$tax->show_tagcloud || empty($tax->labels->name) )
    1472                                         continue;
     1464                $tax = get_taxonomy($taxonomy);
     1465                if ( !$tax->show_tagcloud || empty($tax->labels->name) )
     1466                        continue;
    14731467        ?>
    1474                 <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>
     1468                <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo esc_attr( $tax->labels->name ); ?></option>
    14751469        <?php endforeach; ?>
    14761470        </select></p><?php
    14771471        }
     
    15511545        public function update( $new_instance, $old_instance ) {
    15521546                $instance = array();
    15531547                if ( ! empty( $new_instance['title'] ) ) {
    1554                         $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
     1548                        $instance['title'] = sanitize_text_field( $new_instance['title'] );
    15551549                }
    15561550                if ( ! empty( $new_instance['nav_menu'] ) ) {
    15571551                        $instance['nav_menu'] = (int) $new_instance['nav_menu'];
     
    15841578                </p>
    15851579                <div class="nav-menu-widget-form-controls" <?php if ( empty( $menus ) ) { echo ' style="display:none" '; } ?>>
    15861580                        <p>
    1587                                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ) ?></label>
    1588                                 <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>"/>
     1581                                <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ) ?></label>
     1582                                <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>"/>
    15891583                        </p>
    15901584                        <p>
    1591                                 <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?></label>
    1592                                 <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>">
     1585                                <label for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php _e( 'Select Menu:' ); ?></label>
     1586                                <select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
    15931587                                        <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    15941588                                        <?php foreach ( $menus as $menu ) : ?>
    15951589                                                <option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $nav_menu, $menu->term_id ); ?>>