Make WordPress Core

Ticket #23012: 23012.2.diff

File 23012.2.diff, 56.8 KB (added by welcher, 11 years ago)

Patch refresh and items mentioned by @jdgrimes

  • wp-includes/default-widgets.php

     
    1414class WP_Widget_Pages extends WP_Widget {
    1515
    1616        public function __construct() {
    17                 $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A list of your site’s Pages.') );
    18                 parent::__construct('pages', __('Pages'), $widget_ops);
     17                $widget_ops = array( 'classname' => 'widget_pages', 'description' => esc_html__( 'A list of your site’s Pages.' ) );
     18                parent::__construct( 'pages', esc_html__( 'Pages' ), $widget_ops );
    1919        }
    2020
    2121        /**
     
    3838                $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
    3939                $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
    4040
    41                 if ( $sortby == 'menu_order' )
     41                if ( 'menu_order' == $sortby ) {
    4242                        $sortby = 'menu_order, post_title';
     43                }
    4344
    4445                /**
    4546                 * Filter the arguments for the Pages widget.
     
    5455                        'title_li'    => '',
    5556                        'echo'        => 0,
    5657                        'sort_column' => $sortby,
    57                         'exclude'     => $exclude
     58                        'exclude'     => $exclude,
    5859                ) ) );
    5960
    6061                if ( ! empty( $out ) ) {
     
    7879         */
    7980        public function update( $new_instance, $old_instance ) {
    8081                $instance = $old_instance;
    81                 $instance['title'] = strip_tags($new_instance['title']);
     82                $instance['title'] = strip_tags( $new_instance['title'] );
    8283                if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
    8384                        $instance['sortby'] = $new_instance['sortby'];
    8485                } else {
     
    9596         */
    9697        public function form( $instance ) {
    9798                //Defaults
    98                 $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
    99                 $title = esc_attr( $instance['title'] );
    100                 $exclude = esc_attr( $instance['exclude'] );
     99                $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '' ) );
     100                $title = isset( $instance['title'] ) ? $instance['title'] : '';
     101                $exclude = isset( $instance['exclude'] ) ? $instance['exclude'] : '';
    101102        ?>
    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>
     103                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_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( $title ); ?>" /></p>
    103104                <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">
    106                                 <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
    107                                 <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
     105                        <label for="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>"><?php esc_html_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">
     107                                <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php esc_html_e( 'Page title' ); ?></option>
     108                                <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php esc_html_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 esc_html_e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo esc_attr( $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 />
    114                         <small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
     115                        <small><?php esc_html_e( 'Page IDs, separated by commas.' ); ?></small>
    115116                </p>
    116117<?php
    117118        }
     
    126127class WP_Widget_Links extends WP_Widget {
    127128
    128129        public function __construct() {
    129                 $widget_ops = array('description' => __( "Your blogroll" ) );
    130                 parent::__construct('links', __('Links'), $widget_ops);
     130                $widget_ops = array(
     131                        'description' => esc_html__( 'Your blogroll' )
     132                );
     133                parent::__construct( 'links', esc_html__( 'Links' ), $widget_ops );
    131134        }
    132135
    133136        /**
     
    136139         */
    137140        public function widget( $args, $instance ) {
    138141                $show_description = isset($instance['description']) ? $instance['description'] : false;
    139                 $show_name = isset($instance['name']) ? $instance['name'] : false;
    140                 $show_rating = isset($instance['rating']) ? $instance['rating'] : false;
    141                 $show_images = isset($instance['images']) ? $instance['images'] : true;
    142                 $category = isset($instance['category']) ? $instance['category'] : false;
    143                 $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
    144                 $order = $orderby == 'rating' ? 'DESC' : 'ASC';
    145                 $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
     142                $show_name        = isset($instance['name']) ? $instance['name'] : false;
     143                $show_rating      = isset($instance['rating']) ? $instance['rating'] : false;
     144                $show_images      = isset($instance['images']) ? $instance['images'] : true;
     145                $category         = isset($instance['category']) ? $instance['category'] : false;
     146                $orderby          = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
     147                $order            = $orderby == 'rating' ? 'DESC' : 'ASC';
     148                $limit            = isset( $instance['limit'] ) ? $instance['limit'] : -1;
    146149
    147150                $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
    148151
     
    175178                $new_instance = (array) $new_instance;
    176179                $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 );
    177180                foreach ( $instance as $field => $val ) {
    178                         if ( isset($new_instance[$field]) )
    179                                 $instance[$field] = 1;
     181                        if ( isset( $new_instance[ $field ] ) ) {
     182                                $instance[ $field ] = 1;
     183                        }
    180184                }
    181185
    182186                $instance['orderby'] = 'name';
    183                 if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
     187                if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) ) {
    184188                        $instance['orderby'] = $new_instance['orderby'];
     189                }
    185190
    186191                $instance['category'] = intval( $new_instance['category'] );
    187192                $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
     
    197202                //Defaults
    198203                $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false, 'orderby' => 'name', 'limit' => -1 ) );
    199204                $link_cats = get_terms( 'link_category' );
    200                 if ( ! $limit = intval( $instance['limit'] ) )
     205                if ( ! $limit = intval( $instance['limit'] ) ) {
    201206                        $limit = -1;
     207                }
     208
    202209?>
    203210                <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'); ?>">
    206                 <option value=""><?php _ex('All Links', 'links widget'); ?></option>
     211                <label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php esc_html_e( 'Select Link Category:' ); ?></label>
     212                <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>">
     213                <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option>
    207214                <?php
    208215                foreach ( $link_cats as $link_cat ) {
    209216                        echo '<option value="' . intval( $link_cat->term_id ) . '"'
    210217                                . selected( $instance['category'], $link_cat->term_id, false )
    211                                 . '>' . $link_cat->name . "</option>\n";
     218                                . '>' . esc_html( $link_cat->name ) . "</option>\n";
    212219                }
    213220                ?>
    214221                </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">
    217                         <option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title' ); ?></option>
    218                         <option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating' ); ?></option>
    219                         <option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID' ); ?></option>
     222                <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Sort by:' ); ?></label>
     223                <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
     224                        <option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php esc_html_e( 'Link title' ); ?></option>
     225                        <option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php esc_html_e( 'Link rating' ); ?></option>
     226                        <option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php esc_html_e( 'Link ID' ); ?></option>
    220227                        <option value="rand"<?php selected( $instance['orderby'], 'rand' ); ?>><?php _ex( 'Random', 'Links widget' ); ?></option>
    221228                </select>
    222229                </p>
    223230                <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>
     231                <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' ) ); ?>" />
     232                <label for="<?php echo esc_attr( $this->get_field_id( 'images' ) ); ?>"><?php esc_html_e( 'Show Link Image' ); ?></label><br />
     233                <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' ) ); ?>" />
     234                <label for="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>"><?php esc_html_e( 'Show Link Name' ); ?></label><br />
     235                <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' ) ); ?>" />
     236                <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><?php esc_html_e( 'Show Link Description' ); ?></label><br />
     237                <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' ) ); ?>" />
     238                <label for="<?php echo esc_attr( $this->get_field_id( 'rating' ) ); ?>"><?php esc_html_e( 'Show Link Rating' ); ?></label>
    232239                </p>
    233240                <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" />
     241                <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Number of links to show:' ); ?></label>
     242                <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" />
    236243                </p>
    237244<?php
    238245        }
     
    246253class WP_Widget_Search extends WP_Widget {
    247254
    248255        public function __construct() {
    249                 $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") );
     256                $widget_ops = array( 'classname' => 'widget_search', 'description' => esc_html__( 'A search form for your site.' ) );
    250257                parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
    251258        }
    252259
     
    273280         * @param array $instance
    274281         */
    275282        public function form( $instance ) {
    276                 $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
     283                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    277284                $title = $instance['title'];
    278285?>
    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>
     286                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_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>
    280287<?php
    281288        }
    282289
     
    287294         */
    288295        public function update( $new_instance, $old_instance ) {
    289296                $instance = $old_instance;
    290                 $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
    291                 $instance['title'] = strip_tags($new_instance['title']);
     297                $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
     298                $instance['title'] = strip_tags( $new_instance['title'] );
    292299                return $instance;
    293300        }
    294301
     
    302309class WP_Widget_Archives extends WP_Widget {
    303310
    304311        public function __construct() {
    305                 $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s Posts.') );
    306                 parent::__construct('archives', __('Archives'), $widget_ops);
     312                $widget_ops = array( 'classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s Posts.' ) );
     313                parent::__construct( 'archives', esc_html__( 'Archives' ), $widget_ops );
    307314        }
    308315
    309316        /**
     
    340347                        $dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
    341348                                'type'            => 'monthly',
    342349                                'format'          => 'option',
    343                                 'show_post_count' => $c
     350                                'show_post_count' => $c,
    344351                        ) );
    345352
    346353                        switch ( $dropdown_args['type'] ) {
     
    382389                 */
    383390                wp_get_archives( apply_filters( 'widget_archives_args', array(
    384391                        'type'            => 'monthly',
    385                         'show_post_count' => $c
     392                        'show_post_count' => $c,
    386393                ) ) );
    387394?>
    388395                </ul>
     
    399406         */
    400407        public function update( $new_instance, $old_instance ) {
    401408                $instance = $old_instance;
    402                 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
    403                 $instance['title'] = strip_tags($new_instance['title']);
     409                $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );
     410                $instance['title'] = strip_tags( $new_instance['title'] );
    404411                $instance['count'] = $new_instance['count'] ? 1 : 0;
    405412                $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
    406413
     
    411418         * @param array $instance
    412419         */
    413420        public function form( $instance ) {
    414                 $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"' : '';
     421                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );
     422                $title    = strip_tags( $instance['title'] );
     423                $count    = $instance['count']    ? true : false;
     424                $dropdown = $instance['dropdown'] ? true : false;
    418425?>
    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>
     426                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_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( $title ); ?>" /></p>
    420427                <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>
     428                        <input class="checkbox" type="checkbox" <?php checked( true , $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 esc_html_e( 'Display as dropdown' ); ?></label>
    422429                        <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>
     430                        <input class="checkbox" type="checkbox" <?php checked( true , $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 esc_html_e( 'Show post counts' ); ?></label>
    424431                </p>
    425432<?php
    426433        }
     
    436443class WP_Widget_Meta extends WP_Widget {
    437444
    438445        public function __construct() {
    439                 $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, &amp; WordPress.org links.") );
    440                 parent::__construct('meta', __('Meta'), $widget_ops);
     446                $widget_ops = array( 'classname' => 'widget_meta', 'description' => esc_html__( 'Login, RSS, &amp; WordPress.org links.' ) );
     447                parent::__construct( 'meta', esc_html__( 'Meta' ), $widget_ops );
    441448        }
    442449
    443450        /**
     
    448455                /** This filter is documented in wp-includes/default-widgets.php */
    449456                $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );
    450457
     458                /**
     459                 * Allowed html tags
     460                 */
     461                $allowed_tags = array(
     462                        'abbr' => array(
     463                                'title' => array()
     464                        )
     465                );
     466
    451467                echo $args['before_widget'];
    452468                if ( $title ) {
    453469                        echo $args['before_title'] . $title . $args['after_title'];
     
    456472                        <ul>
    457473                        <?php wp_register(); ?>
    458474                        <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>
     475                        <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php echo wp_kses( __( 'Entries <abbr title="Really Simple Syndication">RSS</abbr>' ), $allowed_tags ); ?></a></li>
     476                        <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php echo wp_kses( __( 'Comments <abbr title="Really Simple Syndication">RSS</abbr>' ), $allowed_tags ); ?></a></li>
    461477<?php
    462478                        /**
    463479                         * Filter the "Powered by WordPress" text in the Meta widget.
     
    486502         */
    487503        public function update( $new_instance, $old_instance ) {
    488504                $instance = $old_instance;
    489                 $instance['title'] = strip_tags($new_instance['title']);
     505                $instance['title'] = strip_tags( $new_instance['title'] );
    490506
    491507                return $instance;
    492508        }
     
    496512         */
    497513        public function form( $instance ) {
    498514                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    499                 $title = strip_tags($instance['title']);
     515                $title = strip_tags( $instance['title'] );
    500516?>
    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>
     517                        <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_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( $title ); ?>" /></p>
    502518<?php
    503519        }
    504520}
     
    511527class WP_Widget_Calendar extends WP_Widget {
    512528
    513529        public function __construct() {
    514                 $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s Posts.') );
    515                 parent::__construct('calendar', __('Calendar'), $widget_ops);
     530                $widget_ops = array( 'classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s Posts.' ) );
     531                parent::__construct( 'calendar', esc_html__( 'Calendar' ), $widget_ops );
    516532        }
    517533
    518534        /**
     
    540556         */
    541557        public function update( $new_instance, $old_instance ) {
    542558                $instance = $old_instance;
    543                 $instance['title'] = strip_tags($new_instance['title']);
     559                $instance['title'] = strip_tags( $new_instance['title'] );
    544560
    545561                return $instance;
    546562        }
     
    550566         */
    551567        public function form( $instance ) {
    552568                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    553                 $title = strip_tags($instance['title']);
     569                $title = strip_tags( $instance['title'] );
    554570?>
    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>
     571                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:' ); ?></label>
     572                <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>
    557573<?php
    558574        }
    559575}
     
    566582class WP_Widget_Text extends WP_Widget {
    567583
    568584        public function __construct() {
    569                 $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.'));
    570                 $control_ops = array('width' => 400, 'height' => 350);
    571                 parent::__construct('text', __('Text'), $widget_ops, $control_ops);
     585                $widget_ops = array(
     586                        'classname' => 'widget_text',
     587                        'description' => esc_html__( 'Arbitrary text or HTML.' )
     588                );
     589                $control_ops = array(
     590                        'width' => 400,
     591                        'height' => 350,
     592                );
     593                parent::__construct( 'text', esc_html__( 'Text' ), $widget_ops, $control_ops );
    572594        }
    573595
    574596        /**
     
    592614                if ( ! empty( $title ) ) {
    593615                        echo $args['before_title'] . $title . $args['after_title'];
    594616                } ?>
    595                         <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
     617                        <div class="textwidget"><?php echo ! empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
    596618                <?php
    597619                echo $args['after_widget'];
    598620        }
     
    604626         */
    605627        public function update( $new_instance, $old_instance ) {
    606628                $instance = $old_instance;
    607                 $instance['title'] = strip_tags($new_instance['title']);
    608                 if ( current_user_can('unfiltered_html') )
    609                         $instance['text'] =  $new_instance['text'];
    610                 else
    611                         $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
     629                $instance['title'] = strip_tags( $new_instance['title'] );
     630                if ( current_user_can( 'unfiltered_html' ) ) {
     631                        $instance['text'] = $new_instance['text'];
     632                } else {
     633                        $instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) ); // wp_filter_post_kses() expects slashed
     634                }
    612635                $instance['filter'] = ! empty( $new_instance['filter'] );
    613636                return $instance;
    614637        }
     
    618641         */
    619642        public function form( $instance ) {
    620643                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    621                 $title = strip_tags($instance['title']);
    622                 $text = esc_textarea($instance['text']);
     644                $title = strip_tags( $instance['title'] );
     645                $text = isset( $instance['text'] ) ? $instance['text'] : '';
    623646?>
    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>
     647                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:' ); ?></label>
     648                <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>
    626649
    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>
     650                <p><label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Content:' ); ?></label>
     651                <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( $text ); ?></textarea></p>
    629652
    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>
     653                <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( isset( $instance['filter'] ) ? $instance['filter'] : 0 ); ?> />&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"><?php esc_html_e( 'Automatically add paragraphs' ); ?></label></p>
    631654<?php
    632655        }
    633656}
     
    640663class WP_Widget_Categories extends WP_Widget {
    641664
    642665        public function __construct() {
    643                 $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
    644                 parent::__construct('categories', __('Categories'), $widget_ops);
     666                $widget_ops = array(
     667                        'classname' => 'widget_categories',
     668                        'description' => esc_html__( 'A list or dropdown of categories.' )
     669                );
     670                parent::__construct( 'categories', esc_html__( 'Categories' ), $widget_ops );
    645671        }
    646672
    647673        /**
     
    668694                $cat_args = array(
    669695                        'orderby'      => 'name',
    670696                        'show_count'   => $c,
    671                         'hierarchical' => $h
     697                        'hierarchical' => $h,
    672698                );
    673699
    674700                if ( $d ) {
     
    677703
    678704                        echo '<label class="screen-reader-text" for="' . esc_attr( $dropdown_id ) . '">' . $title . '</label>';
    679705
    680                         $cat_args['show_option_none'] = __( 'Select Category' );
     706                        $cat_args['show_option_none'] = esc_html__( 'Select Category' );
    681707                        $cat_args['id'] = $dropdown_id;
    682708
    683709                        /**
     
    695721<script type='text/javascript'>
    696722/* <![CDATA[ */
    697723(function() {
    698         var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
     724        var dropdown = document.getElementById( "<?php echo wp_json_encode( $dropdown_id ); ?>" );
    699725        function onCatChange() {
    700726                if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
    701                         location.href = "<?php echo home_url(); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
     727                        location.href = "<?php echo esc_url( home_url() ); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
    702728                }
    703729        }
    704730        dropdown.onchange = onCatChange;
     
    736762         */
    737763        public function update( $new_instance, $old_instance ) {
    738764                $instance = $old_instance;
    739                 $instance['title'] = strip_tags($new_instance['title']);
    740                 $instance['count'] = !empty($new_instance['count']) ? 1 : 0;
    741                 $instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
    742                 $instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;
     765                $instance['title'] = strip_tags( $new_instance['title'] );
     766                $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0;
     767                $instance['hierarchical'] = ! empty( $new_instance['hierarchical'] ) ? 1 : 0;
     768                $instance['dropdown'] = ! empty($new_instance['dropdown'] ) ? 1 : 0;
    743769
    744770                return $instance;
    745771        }
     
    749775         */
    750776        public function form( $instance ) {
    751777                //Defaults
    752                 $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    753                 $title = esc_attr( $instance['title'] );
     778                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    754779                $count = isset($instance['count']) ? (bool) $instance['count'] :false;
    755780                $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
    756781                $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
    757782?>
    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>
     783                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:' ); ?></label>
     784                <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>
    760785
    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 />
     786                <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 ); ?> />
     787                <label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php esc_html_e( 'Display as dropdown' ); ?></label><br />
    763788
    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 />
     789                <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 ); ?> />
     790                <label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php esc_html_e( 'Show post counts' ); ?></label><br />
    766791
    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>
     792                <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 ); ?> />
     793                <label for="<?php echo esc_attr( $this->get_field_id( 'hierarchical' ) ); ?>"><?php esc_html_e( 'Show hierarchy' ); ?></label></p>
    769794<?php
    770795        }
    771796
     
    779804class WP_Widget_Recent_Posts extends WP_Widget {
    780805
    781806        public function __construct() {
    782                 $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site&#8217;s most recent Posts.") );
    783                 parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
     807                $widget_ops = array(
     808                        'classname' => 'widget_recent_entries',
     809                        'description' => esc_html__( 'Your site&#8217;s most recent Posts.' )
     810                );
     811                parent::__construct( 'recent-posts',esc_html__( 'Recent Posts' ), $widget_ops );
    784812                $this->alt_option_name = 'widget_recent_entries';
    785813
    786                 add_action( 'save_post', array($this, 'flush_widget_cache') );
    787                 add_action( 'deleted_post', array($this, 'flush_widget_cache') );
    788                 add_action( 'switch_theme', array($this, 'flush_widget_cache') );
     814                add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
     815                add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
     816                add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
    789817        }
    790818
    791819        /**
     
    819847                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    820848
    821849                $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
    822                 if ( ! $number )
     850                if ( ! $number ) {
    823851                        $number = 5;
     852                }
    824853                $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
    825854
    826855                /**
     
    836865                        'posts_per_page'      => $number,
    837866                        'no_found_rows'       => true,
    838867                        'post_status'         => 'publish',
    839                         'ignore_sticky_posts' => true
     868                        'ignore_sticky_posts' => true,
    840869                ) ) );
    841870
    842                 if ($r->have_posts()) :
     871                if ( $r->have_posts() ) :
    843872?>
    844873                <?php echo $args['before_widget']; ?>
    845                 <?php if ( $title ) {
     874                <?php
     875                if ( $title ) {
    846876                        echo $args['before_title'] . $title . $args['after_title'];
    847                 } ?>
     877                }?>
    848878                <ul>
    849879                <?php while ( $r->have_posts() ) : $r->the_post(); ?>
    850880                        <li>
     
    877907         */
    878908        public function update( $new_instance, $old_instance ) {
    879909                $instance = $old_instance;
    880                 $instance['title'] = strip_tags($new_instance['title']);
     910                $instance['title'] = strip_tags( $new_instance['title'] );
    881911                $instance['number'] = (int) $new_instance['number'];
    882912                $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
    883913                $this->flush_widget_cache();
    884914
    885915                $alloptions = wp_cache_get( 'alloptions', 'options' );
    886                 if ( isset($alloptions['widget_recent_entries']) )
    887                         delete_option('widget_recent_entries');
     916                if ( isset( $alloptions['widget_recent_entries'] ) ) {
     917                        delete_option( 'widget_recent_entries' );
     918                }
    888919
    889920                return $instance;
    890921        }
     
    893924         * @access public
    894925         */
    895926        public function flush_widget_cache() {
    896                 wp_cache_delete('widget_recent_posts', 'widget');
     927                wp_cache_delete( 'widget_recent_posts', 'widget' );
    897928        }
    898929
    899930        /**
     
    900931         * @param array $instance
    901932         */
    902933        public function form( $instance ) {
    903                 $title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    904                 $number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
    905                 $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false;
     934                $title     = isset( $instance['title'] )     ? $instance['title']: '';
     935                $number    = isset( $instance['number'] )    ? $instance['number'] : 5;
     936                $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
    906937?>
    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>
     938                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:' ); ?></label>
     939                <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>
    909940
    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>
     941                <p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of posts to show:' ); ?></label>
     942                <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>
    912943
    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>
     944                <p><input class="checkbox" type="checkbox" <?php checked( (bool) $show_date ); ?> id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" />
     945                <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>"><?php esc_html_e( 'Display post date?' ); ?></label></p>
    915946<?php
    916947        }
    917948}
     
    924955class WP_Widget_Recent_Comments extends WP_Widget {
    925956
    926957        public function __construct() {
    927                 $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site&#8217;s most recent comments.' ) );
    928                 parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
     958                $widget_ops = array(
     959                        'classname' => 'widget_recent_comments',
     960                        'description' => esc_html__( 'Your site&#8217;s most recent comments.' )
     961                );
     962                parent::__construct( 'recent-comments', esc_html__( 'Recent Comments' ), $widget_ops );
    929963                $this->alt_option_name = 'widget_recent_comments';
    930964
    931                 if ( is_active_widget(false, false, $this->id_base) )
    932                         add_action( 'wp_head', array($this, 'recent_comments_style') );
     965                if ( is_active_widget( false, false, $this->id_base ) ) {
     966                        add_action( 'wp_head', array( $this, 'recent_comments_style' ) );
     967                }
    933968
    934                 add_action( 'comment_post', array($this, 'flush_widget_cache') );
    935                 add_action( 'edit_comment', array($this, 'flush_widget_cache') );
    936                 add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
     969                add_action( 'comment_post', array( $this, 'flush_widget_cache' ) );
     970                add_action( 'edit_comment', array( $this, 'flush_widget_cache' ) );
     971                add_action( 'transition_comment_status', array( $this, 'flush_widget_cache' ) );
    937972        }
    938973
    939974        /**
     
    949984                 * @param string $id_base The widget ID.
    950985                 */
    951986                if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
    952                         || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
     987                        || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
    953988                        return;
     989                }
    954990                ?>
    955991        <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    956992<?php
     
    960996         * @access public
    961997         */
    962998        public function flush_widget_cache() {
    963                 wp_cache_delete('widget_recent_comments', 'widget');
     999                wp_cache_delete( 'widget_recent_comments', 'widget' );
    9641000        }
    9651001
    9661002        /**
     
    9751011
    9761012                $cache = array();
    9771013                if ( ! $this->is_preview() ) {
    978                         $cache = wp_cache_get('widget_recent_comments', 'widget');
     1014                        $cache = wp_cache_get( 'widget_recent_comments', 'widget' );
    9791015                }
    9801016                if ( ! is_array( $cache ) ) {
    9811017                        $cache = array();
    9821018                }
    9831019
    984                 if ( ! isset( $args['widget_id'] ) )
     1020                if ( ! isset( $args['widget_id'] ) ) {
    9851021                        $args['widget_id'] = $this->id;
     1022                }
    9861023
    9871024                if ( isset( $cache[ $args['widget_id'] ] ) ) {
    9881025                        echo $cache[ $args['widget_id'] ];
     
    9971034                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    9981035
    9991036                $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
    1000                 if ( ! $number )
     1037                if ( ! $number ) {
    10011038                        $number = 5;
     1039                }
    10021040
     1041
    10031042                /**
    10041043                 * Filter the arguments for the Recent Comments widget.
    10051044                 *
     
    10121051                $comments = get_comments( apply_filters( 'widget_comments_args', array(
    10131052                        'number'      => $number,
    10141053                        'status'      => 'approve',
    1015                         'post_status' => 'publish'
     1054                        'post_status' => 'publish',
    10161055                ) ) );
    10171056
    10181057                $output .= $args['before_widget'];
     
    10261065                        $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
    10271066                        _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
    10281067
    1029                         foreach ( (array) $comments as $comment) {
     1068                        foreach ( (array) $comments as $comment ) {
    10301069                                $output .= '<li class="recentcomments">';
    10311070                                /* translators: comments widget: 1: comment author, 2: post link */
    10321071                                $output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
     
    11361175                $url = esc_url(strip_tags($url));
    11371176                $icon = includes_url('images/rss.png');
    11381177                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>";
     1178                        $title = '<a class="rsswidget" href="' . esc_url( $url ). '"><img style="border:0" width="14" height="14" src="' . esc_attr( $icon ) .'" alt="RSS" /></a> <a class="rsswidget" href="' . esc_url( $link ) .'">' . $title.'</a>';
    11401179
    11411180                echo $args['before_widget'];
    11421181                if ( $title ) {
     
    11651204         */
    11661205        public function form( $instance ) {
    11671206                if ( empty( $instance ) ) {
    1168                         $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 );
     1207                        $instance = array(
     1208                                'title'         => '',
     1209                                'url'           => '',
     1210                                'items'         => 10,
     1211                                'error'         => false,
     1212                                'show_summary'  => 0,
     1213                                'show_author'   => 0,
     1214                                'show_date'     => 0
     1215                        );
    11691216                }
    11701217                $instance['number'] = $this->number;
    11711218
     
    11831230 */
    11841231function wp_widget_rss_output( $rss, $args = array() ) {
    11851232        if ( is_string( $rss ) ) {
    1186                 $rss = fetch_feed($rss);
    1187         } elseif ( is_array($rss) && isset($rss['url']) ) {
     1233                $rss = fetch_feed( $rss );
     1234        } elseif ( is_array( $rss ) && isset( $rss['url'] ) ) {
    11881235                $args = $rss;
    1189                 $rss = fetch_feed($rss['url']);
    1190         } elseif ( !is_object($rss) ) {
     1236                $rss = fetch_feed( $rss['url'] );
     1237        } elseif ( ! is_object( $rss ) ) {
    11911238                return;
    11921239        }
    11931240
    1194         if ( is_wp_error($rss) ) {
    1195                 if ( is_admin() || current_user_can('manage_options') )
    1196                         echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
     1241        if ( is_wp_error( $rss ) ) {
     1242                if ( is_admin() || current_user_can( 'manage_options' ) ) {
     1243                        echo '<p><strong>' . sprintf( esc_html__( 'RSS Error: %s' ), $rss->get_error_message() ) . '</strong></p>';
     1244                }
     1245
    11971246                return;
    11981247        }
    11991248
    1200         $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0 );
     1249        $default_args = array(
     1250                'show_author'   => 0,
     1251                'show_date'     => 0,
     1252                'show_summary'  => 0,
     1253                'items'         => 0
     1254        );
    12011255        $args = wp_parse_args( $args, $default_args );
    12021256
    12031257        $items = (int) $args['items'];
    1204         if ( $items < 1 || 20 < $items )
     1258        if ( $items < 1 || 20 < $items ) {
    12051259                $items = 10;
     1260        }
     1261
    12061262        $show_summary  = (int) $args['show_summary'];
    12071263        $show_author   = (int) $args['show_author'];
    12081264        $show_date     = (int) $args['show_date'];
    12091265
    1210         if ( !$rss->get_item_quantity() ) {
    1211                 echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
     1266        if ( ! $rss->get_item_quantity() ) {
     1267                echo '<ul><li>' . esc_html__( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
    12121268                $rss->__destruct();
    12131269                unset($rss);
    12141270                return;
     
    12541310                $author = '';
    12551311                if ( $show_author ) {
    12561312                        $author = $item->get_author();
    1257                         if ( is_object($author) ) {
     1313                        if ( is_object( $author ) ) {
    12581314                                $author = $author->get_name();
    12591315                                $author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
    12601316                        }
     
    12611317                }
    12621318
    12631319                if ( $link == '' ) {
    1264                         echo "<li>$title{$date}{$summary}{$author}</li>";
     1320                        echo '<li>' . $title . $date . $summary . $author . '</li>';
    12651321                } elseif ( $show_summary ) {
    1266                         echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$summary}{$author}</li>";
     1322                        echo '<li><a class="rsswidget" href="' . esc_url( $link ) .'">' . $title .'</a>' . $date . $summary . $author . '</li>';
    12671323                } else {
    1268                         echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$author}</li>";
     1324                        echo '<li><a class="rsswidget" href="'.  esc_url( $link ) .'">' . $title . '</a>' . $date . $author . '</li>';
    12691325                }
    12701326        }
    12711327        echo '</ul>';
     
    13031359        $args['show_date']      = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date'];
    13041360
    13051361        if ( ! empty( $args['error'] ) ) {
    1306                 echo '<p class="widget-error"><strong>' . sprintf( __( 'RSS Error: %s' ), $args['error'] ) . '</strong></p>';
     1362                echo '<p class="widget-error"><strong>' . sprintf( esc_html__( 'RSS Error: %s' ), $args['error'] ) . '</strong></p>';
    13071363        }
    13081364
    13091365        if ( $inputs['url'] ) :
    13101366?>
    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>
     1367        <p><label for="rss-url-<?php echo esc_attr( $args['number'] ); ?>"><?php esc_html_e( 'Enter the RSS feed URL here:' ); ?></label>
     1368        <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_attr( $args['url'] ); ?>" /></p>
    13131369<?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>
     1370        <p><label for="rss-title-<?php echo esc_attr( $args['number'] ); ?>"><?php esc_html_e( 'Give the feed a title (optional):' ); ?></label>
     1371        <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>
    13161372<?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]">
     1373        <p><label for="rss-items-<?php echo esc_attr( $args['number'] ); ?>"><?php esc_html_e( 'How many items would you like to display?' ); ?></label>
     1374        <select id="rss-items-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][items]">
    13191375<?php
    13201376                for ( $i = 1; $i <= 20; ++$i ) {
    13211377                        echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>";
     
    13231379?>
    13241380        </select></p>
    13251381<?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>
     1382        <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'] ); ?> />
     1383        <label for="rss-show-summary-<?php echo esc_attr( $args['number'] ); ?>"><?php esc_html_e( 'Display item content?' ); ?></label></p>
    13281384<?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>
     1385        <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'] ); ?> />
     1386        <label for="rss-show-author-<?php echo esc_attr( $args['number'] ); ?>"><?php esc_html_e( 'Display item author if available?' ); ?></label></p>
    13311387<?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>
     1388        <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'] ); ?>/>
     1389        <label for="rss-show-date-<?php echo esc_attr( $args['number'] ); ?>"><?php esc_html_e( 'Display item date?' ); ?></label></p>
    13341390<?php
    13351391        endif;
    1336         foreach ( array_keys($default_inputs) as $input ) :
    1337                 if ( 'hidden' === $inputs[$input] ) :
     1392        foreach ( array_keys( $default_inputs ) as $input ) :
     1393                if ( 'hidden' === $inputs[ $input ] ) :
    13381394                        $id = str_replace( '_', '-', $input );
    13391395?>
    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 ]; ?>" />
     1396        <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 ] ); ?>" />
    13411397<?php
    13421398                endif;
    13431399        endforeach;
     
    13611417 */
    13621418function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
    13631419        $items = (int) $widget_rss['items'];
    1364         if ( $items < 1 || 20 < $items )
     1420        if ( $items < 1 || 20 < $items ) {
    13651421                $items = 10;
     1422        }
     1423
    13661424        $url           = esc_url_raw( strip_tags( $widget_rss['url'] ) );
    13671425        $title         = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
    13681426        $show_summary  = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
     
    13701428        $show_date     = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;
    13711429
    13721430        if ( $check_feed ) {
    1373                 $rss = fetch_feed($url);
     1431                $rss = fetch_feed( $url );
    13741432                $error = false;
    13751433                $link = '';
    1376                 if ( is_wp_error($rss) ) {
     1434                if ( is_wp_error( $rss ) ) {
    13771435                        $error = $rss->get_error_message();
    13781436                } else {
    1379                         $link = esc_url(strip_tags($rss->get_permalink()));
    1380                         while ( stristr($link, 'http') != $link )
    1381                                 $link = substr($link, 1);
     1437                        $link = esc_url( strip_tags( $rss->get_permalink() ) );
     1438                        while ( stristr( $link, 'http' ) != $link ) {
     1439                                $link = substr( $link, 1 );
     1440                        }
    13821441
    13831442                        $rss->__destruct();
    13841443                        unset($rss);
     
    14371496                 * @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'.
    14381497                 */
    14391498                wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
    1440                         'taxonomy' => $current_taxonomy
     1499                        'taxonomy' => $current_taxonomy,
    14411500                ) ) );
    14421501
    14431502                echo "</div>\n";
     
    14931552 *
    14941553 * @since 3.0.0
    14951554 */
    1496  class WP_Nav_Menu_Widget extends WP_Widget {
     1555class WP_Nav_Menu_Widget extends WP_Widget {
    14971556
    14981557        public function __construct() {
    1499                 $widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
    1500                 parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
     1558                $widget_ops = array( 'description' => esc_html__( 'Add a custom menu to your sidebar.' ) );
     1559                parent::__construct( 'nav_menu',esc_html__( 'Custom Menu' ), $widget_ops );
    15011560        }
    15021561
    15031562        /**
     
    15081567                // Get menu
    15091568                $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
    15101569
    1511                 if ( !$nav_menu )
     1570                if ( ! $nav_menu ) {
    15121571                        return;
     1572                }
    15131573
     1574
    15141575                /** This filter is documented in wp-includes/default-widgets.php */
    15151576                $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    15161577
    15171578                echo $args['before_widget'];
    15181579
    1519                 if ( !empty($instance['title']) )
     1580                if ( ! empty( $instance['title'] ) ) {
    15201581                        echo $args['before_title'] . $instance['title'] . $args['after_title'];
     1582                }
    15211583
     1584
    15221585                $nav_menu_args = array(
    15231586                        'fallback_cb' => '',
    1524                         'menu'        => $nav_menu
     1587                        'menu'        => $nav_menu,
    15251588                );
    15261589
    15271590                /**
     
    15511614        public function update( $new_instance, $old_instance ) {
    15521615                $instance = array();
    15531616                if ( ! empty( $new_instance['title'] ) ) {
    1554                         $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
     1617                        $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
    15551618                }
    15561619                if ( ! empty( $new_instance['nav_menu'] ) ) {
    15571620                        $instance['nav_menu'] = (int) $new_instance['nav_menu'];
     
    15701633                $menus = wp_get_nav_menus();
    15711634
    15721635                // If no menus exists, direct the user to go and create some.
    1573                 if ( !$menus ) {
    1574                         echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';
     1636                if ( ! $menus ) {
     1637                        echo '<p>'. sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_url( admin_url( 'nav-menus.php' ) ) ) .'</p>';
    15751638                        return;
    15761639                }
    15771640                ?>
    15781641                <p>
    1579                         <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
    1580                         <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
     1642                        <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:' ) ?></label>
     1643                        <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 ); ?>" />
    15811644                </p>
    15821645                <p>
    1583                         <label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
    1584                         <select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
     1646                        <label for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php esc_html_e( 'Select Menu:' ); ?></label>
     1647                        <select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
    15851648                                <option value="0"><?php _e( '&mdash; Select &mdash;' ) ?></option>
    15861649                <?php
    1587                         foreach ( $menus as $menu ) {
    1588                                 echo '<option value="' . $menu->term_id . '"'
    1589                                         . selected( $nav_menu, $menu->term_id, false )
    1590                                         . '>'. esc_html( $menu->name ) . '</option>';
    1591                         }
     1650                foreach ( $menus as $menu ) {
     1651                        echo '<option value="' . $menu->term_id . '"'
     1652                                . selected( $nav_menu, $menu->term_id, false )
     1653                                . '>'. esc_html( $menu->name ) . '</option>';
     1654                }
    15921655                ?>
    15931656                        </select>
    15941657                </p>
     
    16051668 * @since 2.2.0
    16061669 */
    16071670function wp_widgets_init() {
    1608         if ( !is_blog_installed() )
     1671        if ( ! is_blog_installed() ) {
    16091672                return;
     1673        }
    16101674
    1611         register_widget('WP_Widget_Pages');
     1675        register_widget( 'WP_Widget_Pages' );
    16121676
    1613         register_widget('WP_Widget_Calendar');
     1677        register_widget( 'WP_Widget_Calendar' );
    16141678
    1615         register_widget('WP_Widget_Archives');
     1679        register_widget( 'WP_Widget_Archives' );
    16161680
    1617         if ( get_option( 'link_manager_enabled' ) )
    1618                 register_widget('WP_Widget_Links');
     1681        if ( get_option( 'link_manager_enabled' ) ) {
     1682                register_widget( 'WP_Widget_Links' );
     1683        }
    16191684
    1620         register_widget('WP_Widget_Meta');
    16211685
    1622         register_widget('WP_Widget_Search');
     1686        register_widget( 'WP_Widget_Meta' );
    16231687
    1624         register_widget('WP_Widget_Text');
     1688        register_widget( 'WP_Widget_Search' );
    16251689
    1626         register_widget('WP_Widget_Categories');
     1690        register_widget( 'WP_Widget_Text' );
    16271691
    1628         register_widget('WP_Widget_Recent_Posts');
     1692        register_widget( 'WP_Widget_Categories' );
    16291693
    1630         register_widget('WP_Widget_Recent_Comments');
     1694        register_widget( 'WP_Widget_Recent_Posts' );
    16311695
    1632         register_widget('WP_Widget_RSS');
     1696        register_widget( 'WP_Widget_Recent_Comments' );
    16331697
    1634         register_widget('WP_Widget_Tag_Cloud');
     1698        register_widget( 'WP_Widget_RSS' );
    16351699
    1636         register_widget('WP_Nav_Menu_Widget');
     1700        register_widget( 'WP_Widget_Tag_Cloud' );
    16371701
     1702        register_widget( 'WP_Nav_Menu_Widget' );
     1703
    16381704        /**
    16391705         * Fires after all default WordPress widgets have been registered.
    16401706         *