Make WordPress Core

Ticket #23012: 23012.3.diff

File 23012.3.diff, 62.7 KB (added by welcher, 11 years ago)

Patch refresh and removing esc_html on strings

  • 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' => __( 'A list of your site’s Pages.' ) );
     18                parent::__construct( 'pages', __( 'Pages' ), $widget_ops );
    1919        }
    2020
    2121        /**
     
    3333                 * @param array  $instance An array of the widget's settings.
    3434                 * @param mixed  $id_base  The widget ID.
    3535                 */
    36                 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base );
    37 
    38                 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
     36                $title   = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base );
     37                $sortby  = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
    3938                $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
    4039
    41                 if ( $sortby == 'menu_order' )
     40                if ( 'menu_order' == $sortby ) {
    4241                        $sortby = 'menu_order, post_title';
     42                }
    4343
    4444                /**
    4545                 * Filter the arguments for the Pages widget.
     
    5454                        'title_li'    => '',
    5555                        'echo'        => 0,
    5656                        'sort_column' => $sortby,
    57                         'exclude'     => $exclude
     57                        'exclude'     => $exclude,
    5858                ) ) );
    5959
    6060                if ( ! empty( $out ) ) {
     
    7878         */
    7979        public function update( $new_instance, $old_instance ) {
    8080                $instance = $old_instance;
    81                 $instance['title'] = strip_tags($new_instance['title']);
     81                $instance['title'] = strip_tags( $new_instance['title'] );
    8282                if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
    8383                        $instance['sortby'] = $new_instance['sortby'];
    8484                } else {
     
    9595         */
    9696        public function form( $instance ) {
    9797                //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'] );
     98                $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '' ) );
     99                $title = isset( $instance['title'] ) ? $instance['title'] : '';
     100                $exclude = isset( $instance['exclude'] ) ? $instance['exclude'] : '';
    101101        ?>
    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>
     102                <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( $title ); ?>" /></p>
    103103                <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>
     104                        <label for="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>"><?php esc_html_e( 'Sort by:' ); ?></label>
     105                        <select name="<?php echo esc_attr( $this->get_field_name( 'sortby' ) ); ?>" id="<?php echo esc_attr( $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>
    108108                                <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
    109109                        </select>
    110110                </p>
    111111                <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" />
     112                        <label for="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>"><?php _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" />
    113113                        <br />
    114114                        <small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
    115115                </p>
     
    126126class WP_Widget_Links extends WP_Widget {
    127127
    128128        public function __construct() {
    129                 $widget_ops = array('description' => __( "Your blogroll" ) );
    130                 parent::__construct('links', __('Links'), $widget_ops);
     129                $widget_ops = array(
     130                        'description' => __( 'Your blogroll' )
     131                );
     132                parent::__construct( 'links',__( 'Links' ), $widget_ops );
    131133        }
    132134
    133135        /**
     
    136138         */
    137139        public function widget( $args, $instance ) {
    138140                $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;
     141                $show_name        = isset($instance['name']) ? $instance['name'] : false;
     142                $show_rating      = isset($instance['rating']) ? $instance['rating'] : false;
     143                $show_images      = isset($instance['images']) ? $instance['images'] : true;
     144                $category         = isset($instance['category']) ? $instance['category'] : false;
     145                $orderby          = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
     146                $order            = $orderby == 'rating' ? 'DESC' : 'ASC';
     147                $limit            = isset( $instance['limit'] ) ? $instance['limit'] : -1;
    146148
    147149                $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
    148150
     
    175177                $new_instance = (array) $new_instance;
    176178                $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 );
    177179                foreach ( $instance as $field => $val ) {
    178                         if ( isset($new_instance[$field]) )
    179                                 $instance[$field] = 1;
     180                        if ( isset( $new_instance[ $field ] ) ) {
     181                                $instance[ $field ] = 1;
     182                        }
    180183                }
    181184
    182185                $instance['orderby'] = 'name';
    183                 if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
     186                if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) ) {
    184187                        $instance['orderby'] = $new_instance['orderby'];
     188                }
    185189
    186190                $instance['category'] = intval( $new_instance['category'] );
    187191                $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
     
    197201                //Defaults
    198202                $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false, 'orderby' => 'name', 'limit' => -1 ) );
    199203                $link_cats = get_terms( 'link_category' );
    200                 if ( ! $limit = intval( $instance['limit'] ) )
     204                if ( ! $limit = intval( $instance['limit'] ) ) {
    201205                        $limit = -1;
     206                }
     207
    202208?>
    203209                <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>
     210                <label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php _e( 'Select Link Category:' ); ?></label>
     211                <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>">
     212                <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option>
    207213                <?php
    208214                foreach ( $link_cats as $link_cat ) {
    209215                        echo '<option value="' . intval( $link_cat->term_id ) . '"'
     
    212218                }
    213219                ?>
    214220                </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">
     221                <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php _e( 'Sort by:' ); ?></label>
     222                <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
    217223                        <option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title' ); ?></option>
    218224                        <option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating' ); ?></option>
    219225                        <option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID' ); ?></option>
     
    221227                </select>
    222228                </p>
    223229                <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>
     230                <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' ) ); ?>" />
     231                <label for="<?php echo esc_attr( $this->get_field_id( 'images' ) ); ?>"><?php _e( 'Show Link Image' ); ?></label><br />
     232                <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' ) ); ?>" />
     233                <label for="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>"><?php _e( 'Show Link Name' ); ?></label><br />
     234                <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' ) ); ?>" />
     235                <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><?php _e( 'Show Link Description' ); ?></label><br />
     236                <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' ) ); ?>" />
     237                <label for="<?php echo esc_attr( $this->get_field_id( 'rating' ) ); ?>"><?php _e( 'Show Link Rating' ); ?></label>
    232238                </p>
    233239                <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" />
     240                <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of links to show:' ); ?></label>
     241                <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" />
    236242                </p>
    237243<?php
    238244        }
     
    246252class WP_Widget_Search extends WP_Widget {
    247253
    248254        public function __construct() {
    249                 $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") );
     255                $widget_ops = array( 'classname' => 'widget_search', 'description' => _( 'A search form for your site.' ) );
    250256                parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
    251257        }
    252258
     
    273279         * @param array $instance
    274280         */
    275281        public function form( $instance ) {
    276                 $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
     282                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    277283                $title = $instance['title'];
    278284?>
    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>
     285                <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>
    280286<?php
    281287        }
    282288
     
    287293         */
    288294        public function update( $new_instance, $old_instance ) {
    289295                $instance = $old_instance;
    290                 $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
    291                 $instance['title'] = strip_tags($new_instance['title']);
     296                $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
     297                $instance['title'] = strip_tags( $new_instance['title'] );
    292298                return $instance;
    293299        }
    294300
     
    302308class WP_Widget_Archives extends WP_Widget {
    303309
    304310        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);
     311                $widget_ops = array( 'classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s Posts.' ) );
     312                parent::__construct( 'archives', __( 'Archives' ), $widget_ops );
    307313        }
    308314
    309315        /**
     
    340346                        $dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
    341347                                'type'            => 'monthly',
    342348                                'format'          => 'option',
    343                                 'show_post_count' => $c
     349                                'show_post_count' => $c,
    344350                        ) );
    345351
    346352                        switch ( $dropdown_args['type'] ) {
     
    382388                 */
    383389                wp_get_archives( apply_filters( 'widget_archives_args', array(
    384390                        'type'            => 'monthly',
    385                         'show_post_count' => $c
     391                        'show_post_count' => $c,
    386392                ) ) );
    387393?>
    388394                </ul>
     
    399405         */
    400406        public function update( $new_instance, $old_instance ) {
    401407                $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']);
     408                $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );
     409                $instance['title'] = strip_tags( $new_instance['title'] );
    404410                $instance['count'] = $new_instance['count'] ? 1 : 0;
    405411                $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
    406412
     
    411417         * @param array $instance
    412418         */
    413419        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"' : '';
     420                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );
     421                $title    = strip_tags( $instance['title'] );
     422                $count    = $instance['count']    ? true : false;
     423                $dropdown = $instance['dropdown'] ? true : false;
    418424?>
    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>
     425                <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( $title ); ?>" /></p>
    420426                <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>
     427                        <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 _e( 'Display as dropdown' ); ?></label>
    422428                        <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>
     429                        <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 _e( 'Show post counts' ); ?></label>
    424430                </p>
    425431<?php
    426432        }
     
    436442class WP_Widget_Meta extends WP_Widget {
    437443
    438444        public function __construct() {
    439                 $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, &amp; WordPress.org links.") );
    440                 parent::__construct('meta', __('Meta'), $widget_ops);
     445                $widget_ops = array( 'classname' => 'widget_meta', 'description' => __( 'Login, RSS, &amp; WordPress.org links.' ) );
     446                parent::__construct( 'meta', __( 'Meta' ), $widget_ops );
    441447        }
    442448
    443449        /**
     
    456462                        <ul>
    457463                        <?php wp_register(); ?>
    458464                        <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>
     465                        <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php echo _e( 'Entries <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li>
     466                        <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li>
    461467<?php
    462468                        /**
    463469                         * Filter the "Powered by WordPress" text in the Meta widget.
     
    486492         */
    487493        public function update( $new_instance, $old_instance ) {
    488494                $instance = $old_instance;
    489                 $instance['title'] = strip_tags($new_instance['title']);
     495                $instance['title'] = strip_tags( $new_instance['title'] );
    490496
    491497                return $instance;
    492498        }
     
    496502         */
    497503        public function form( $instance ) {
    498504                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    499                 $title = strip_tags($instance['title']);
     505                $title = strip_tags( $instance['title'] );
    500506?>
    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>
     507                        <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( $title ); ?>" /></p>
    502508<?php
    503509        }
    504510}
     
    511517class WP_Widget_Calendar extends WP_Widget {
    512518
    513519        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);
     520                $widget_ops = array( 'classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s Posts.' ) );
     521                parent::__construct( 'calendar', __( 'Calendar' ), $widget_ops );
    516522        }
    517523
    518524        /**
     
    540546         */
    541547        public function update( $new_instance, $old_instance ) {
    542548                $instance = $old_instance;
    543                 $instance['title'] = strip_tags($new_instance['title']);
     549                $instance['title'] = strip_tags( $new_instance['title'] );
    544550
    545551                return $instance;
    546552        }
     
    550556         */
    551557        public function form( $instance ) {
    552558                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    553                 $title = strip_tags($instance['title']);
     559                $title = strip_tags( $instance['title'] );
    554560?>
    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>
     561                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
     562                <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>
    557563<?php
    558564        }
    559565}
     
    566572class WP_Widget_Text extends WP_Widget {
    567573
    568574        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);
     575                $widget_ops = array(
     576                        'classname' => 'widget_text',
     577                        'description' => __( 'Arbitrary text or HTML.' )
     578                );
     579                $control_ops = array(
     580                        'width' => 400,
     581                        'height' => 350,
     582                );
     583                parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops );
    572584        }
    573585
    574586        /**
     
    592604                if ( ! empty( $title ) ) {
    593605                        echo $args['before_title'] . $title . $args['after_title'];
    594606                } ?>
    595                         <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
     607                        <div class="textwidget"><?php echo ! empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
    596608                <?php
    597609                echo $args['after_widget'];
    598610        }
     
    604616         */
    605617        public function update( $new_instance, $old_instance ) {
    606618                $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
     619                $instance['title'] = strip_tags( $new_instance['title'] );
     620                if ( current_user_can( 'unfiltered_html' ) ) {
     621                        $instance['text'] = $new_instance['text'];
     622                } else {
     623                        $instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) ); // wp_filter_post_kses() expects slashed
     624                }
    612625                $instance['filter'] = ! empty( $new_instance['filter'] );
    613626                return $instance;
    614627        }
     
    618631         */
    619632        public function form( $instance ) {
    620633                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    621                 $title = strip_tags($instance['title']);
    622                 $text = esc_textarea($instance['text']);
     634                $title = strip_tags( $instance['title'] );
     635                $text = isset( $instance['text'] ) ? $instance['text'] : '';
    623636?>
    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>
     637                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
     638                <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>
    626639
    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>
     640                <p><label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php _e( 'Content:' ); ?></label>
     641                <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>
    629642
    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>
     643                <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 _e( 'Automatically add paragraphs' ); ?></label></p>
    631644<?php
    632645        }
    633646}
     
    640653class WP_Widget_Categories extends WP_Widget {
    641654
    642655        public function __construct() {
    643                 $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
    644                 parent::__construct('categories', __('Categories'), $widget_ops);
     656                $widget_ops = array(
     657                        'classname' => 'widget_categories',
     658                        'description' => __( 'A list or dropdown of categories.' )
     659                );
     660                parent::__construct( 'categories', __( 'Categories' ), $widget_ops );
    645661        }
    646662
    647663        /**
     
    668684                $cat_args = array(
    669685                        'orderby'      => 'name',
    670686                        'show_count'   => $c,
    671                         'hierarchical' => $h
     687                        'hierarchical' => $h,
    672688                );
    673689
    674690                if ( $d ) {
     
    695711<script type='text/javascript'>
    696712/* <![CDATA[ */
    697713(function() {
    698         var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
     714        var dropdown = document.getElementById( "<?php echo wp_json_encode( $dropdown_id ); ?>" );
    699715        function onCatChange() {
    700716                if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
    701                         location.href = "<?php echo home_url(); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
     717                        location.href = "<?php echo esc_url( home_url() ); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
    702718                }
    703719        }
    704720        dropdown.onchange = onCatChange;
     
    736752         */
    737753        public function update( $new_instance, $old_instance ) {
    738754                $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;
     755                $instance['title'] = strip_tags( $new_instance['title'] );
     756                $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0;
     757                $instance['hierarchical'] = ! empty( $new_instance['hierarchical'] ) ? 1 : 0;
     758                $instance['dropdown'] = ! empty($new_instance['dropdown'] ) ? 1 : 0;
    743759
    744760                return $instance;
    745761        }
     
    749765         */
    750766        public function form( $instance ) {
    751767                //Defaults
    752                 $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    753                 $title = esc_attr( $instance['title'] );
     768                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    754769                $count = isset($instance['count']) ? (bool) $instance['count'] :false;
    755770                $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
    756771                $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
    757772?>
    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>
     773                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
     774                <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>
    760775
    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 />
     776                <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 ); ?> />
     777                <label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
    763778
    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 />
     779                <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 ); ?> />
     780                <label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php _e( 'Show post counts' ); ?></label><br />
    766781
    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>
     782                <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 ); ?> />
     783                <label for="<?php echo esc_attr( $this->get_field_id( 'hierarchical' ) ); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
    769784<?php
    770785        }
    771786
     
    779794class WP_Widget_Recent_Posts extends WP_Widget {
    780795
    781796        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);
     797                $widget_ops = array(
     798                        'classname' => 'widget_recent_entries',
     799                        'description' => __( 'Your site&#8217;s most recent Posts.' )
     800                );
     801                parent::__construct( 'recent-posts', __( 'Recent Posts' ), $widget_ops );
    784802                $this->alt_option_name = 'widget_recent_entries';
    785803
    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') );
     804                add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
     805                add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
     806                add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
    789807        }
    790808
    791809        /**
     
    819837                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    820838
    821839                $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
    822                 if ( ! $number )
     840                if ( ! $number ) {
    823841                        $number = 5;
     842                }
    824843                $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
    825844
    826845                /**
     
    836855                        'posts_per_page'      => $number,
    837856                        'no_found_rows'       => true,
    838857                        'post_status'         => 'publish',
    839                         'ignore_sticky_posts' => true
     858                        'ignore_sticky_posts' => true,
    840859                ) ) );
    841860
    842                 if ($r->have_posts()) :
     861                if ( $r->have_posts() ) :
    843862?>
    844863                <?php echo $args['before_widget']; ?>
    845                 <?php if ( $title ) {
     864                <?php
     865                if ( $title ) {
    846866                        echo $args['before_title'] . $title . $args['after_title'];
    847                 } ?>
     867                }?>
    848868                <ul>
    849869                <?php while ( $r->have_posts() ) : $r->the_post(); ?>
    850870                        <li>
     
    877897         */
    878898        public function update( $new_instance, $old_instance ) {
    879899                $instance = $old_instance;
    880                 $instance['title'] = strip_tags($new_instance['title']);
     900                $instance['title'] = strip_tags( $new_instance['title'] );
    881901                $instance['number'] = (int) $new_instance['number'];
    882902                $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
    883903                $this->flush_widget_cache();
    884904
    885905                $alloptions = wp_cache_get( 'alloptions', 'options' );
    886                 if ( isset($alloptions['widget_recent_entries']) )
    887                         delete_option('widget_recent_entries');
     906                if ( isset( $alloptions['widget_recent_entries'] ) ) {
     907                        delete_option( 'widget_recent_entries' );
     908                }
    888909
    889910                return $instance;
    890911        }
     
    893914         * @access public
    894915         */
    895916        public function flush_widget_cache() {
    896                 wp_cache_delete('widget_recent_posts', 'widget');
     917                wp_cache_delete( 'widget_recent_posts', 'widget' );
    897918        }
    898919
    899920        /**
     
    900921         * @param array $instance
    901922         */
    902923        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;
     924                $title     = isset( $instance['title'] )     ? $instance['title']: '';
     925                $number    = isset( $instance['number'] )    ? $instance['number'] : 5;
     926                $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
    906927?>
    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>
     928                <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
     929                <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>
    909930
    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>
     931                <p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
     932                <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>
    912933
    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>
     934                <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' ) ); ?>" />
     935                <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>"><?php _e( 'Display post date?' ); ?></label></p>
    915936<?php
    916937        }
    917938}
     
    924945class WP_Widget_Recent_Comments extends WP_Widget {
    925946
    926947        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);
     948                $widget_ops = array(
     949                        'classname' => 'widget_recent_comments',
     950                        'description' => _( 'Your site&#8217;s most recent comments.' )
     951                );
     952                parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops );
    929953                $this->alt_option_name = 'widget_recent_comments';
    930954
    931                 if ( is_active_widget(false, false, $this->id_base) )
    932                         add_action( 'wp_head', array($this, 'recent_comments_style') );
     955                if ( is_active_widget( false, false, $this->id_base ) ) {
     956                        add_action( 'wp_head', array( $this, 'recent_comments_style' ) );
     957                }
    933958
    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') );
     959                add_action( 'comment_post', array( $this, 'flush_widget_cache' ) );
     960                add_action( 'edit_comment', array( $this, 'flush_widget_cache' ) );
     961                add_action( 'transition_comment_status', array( $this, 'flush_widget_cache' ) );
    937962        }
    938963
    939964        /**
     
    949974                 * @param string $id_base The widget ID.
    950975                 */
    951976                if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
    952                         || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
     977                        || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
    953978                        return;
     979                }
    954980                ?>
    955981        <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    956982<?php
     
    960986         * @access public
    961987         */
    962988        public function flush_widget_cache() {
    963                 wp_cache_delete('widget_recent_comments', 'widget');
     989                wp_cache_delete( 'widget_recent_comments', 'widget' );
    964990        }
    965991
    966992        /**
     
    9751001
    9761002                $cache = array();
    9771003                if ( ! $this->is_preview() ) {
    978                         $cache = wp_cache_get('widget_recent_comments', 'widget');
     1004                        $cache = wp_cache_get( 'widget_recent_comments', 'widget' );
    9791005                }
    9801006                if ( ! is_array( $cache ) ) {
    9811007                        $cache = array();
    9821008                }
    9831009
    984                 if ( ! isset( $args['widget_id'] ) )
     1010                if ( ! isset( $args['widget_id'] ) ) {
    9851011                        $args['widget_id'] = $this->id;
     1012                }
    9861013
    9871014                if ( isset( $cache[ $args['widget_id'] ] ) ) {
    9881015                        echo $cache[ $args['widget_id'] ];
     
    9971024                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    9981025
    9991026                $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
    1000                 if ( ! $number )
     1027                if ( ! $number ) {
    10011028                        $number = 5;
     1029                }
    10021030
     1031
    10031032                /**
    10041033                 * Filter the arguments for the Recent Comments widget.
    10051034                 *
     
    10121041                $comments = get_comments( apply_filters( 'widget_comments_args', array(
    10131042                        'number'      => $number,
    10141043                        'status'      => 'approve',
    1015                         'post_status' => 'publish'
     1044                        'post_status' => 'publish',
    10161045                ) ) );
    10171046
    10181047                $output .= $args['before_widget'];
     
    10261055                        $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
    10271056                        _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
    10281057
    1029                         foreach ( (array) $comments as $comment) {
     1058                        foreach ( (array) $comments as $comment ) {
    10301059                                $output .= '<li class="recentcomments">';
    10311060                                /* translators: comments widget: 1: comment author, 2: post link */
    10321061                                $output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
     
    10541083         */
    10551084        public function update( $new_instance, $old_instance ) {
    10561085                $instance = $old_instance;
    1057                 $instance['title'] = strip_tags($new_instance['title']);
     1086                $instance['title'] = strip_tags( $new_instance['title'] );
    10581087                $instance['number'] = absint( $new_instance['number'] );
    10591088                $this->flush_widget_cache();
    10601089
    10611090                $alloptions = wp_cache_get( 'alloptions', 'options' );
    1062                 if ( isset($alloptions['widget_recent_comments']) )
    1063                         delete_option('widget_recent_comments');
     1091                if ( isset( $alloptions['widget_recent_comments'] ) ) {
     1092                        delete_option( 'widget_recent_comments' );
     1093                }
    10641094
    10651095                return $instance;
    10661096        }
     
    10891119class WP_Widget_RSS extends WP_Widget {
    10901120
    10911121        public function __construct() {
    1092                 $widget_ops = array( 'description' => __('Entries from any RSS or Atom feed.') );
     1122                $widget_ops = array( 'description' => __( 'Entries from any RSS or Atom feed.' ) );
    10931123                $control_ops = array( 'width' => 400, 'height' => 200 );
    1094                 parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops );
     1124                parent::__construct( 'rss', __( 'RSS' ), $widget_ops, $control_ops );
    10951125        }
    10961126
    10971127        /**
     
    10991129         * @param array $instance
    11001130         */
    11011131        public function widget( $args, $instance ) {
    1102                 if ( isset($instance['error']) && $instance['error'] )
     1132                if ( isset($instance['error']) && $instance['error'] ) {
    11031133                        return;
     1134                }
    11041135
    11051136                $url = ! empty( $instance['url'] ) ? $instance['url'] : '';
    1106                 while ( stristr($url, 'http') != $url )
    1107                         $url = substr($url, 1);
     1137                while ( stristr( $url, 'http' ) != $url ) {
     1138                        $url = substr( $url, 1 );
     1139                }
    11081140
    1109                 if ( empty($url) )
     1141                if ( empty($url) ) {
    11101142                        return;
     1143                }
    11111144
    11121145                // self-url destruction sequence
    1113                 if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) )
     1146                if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) ) {
    11141147                        return;
     1148                }
    11151149
    1116                 $rss = fetch_feed($url);
     1150                $rss = fetch_feed( $url );
    11171151                $title = $instance['title'];
    11181152                $desc = '';
    11191153                $link = '';
    11201154
    1121                 if ( ! is_wp_error($rss) ) {
    1122                         $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
    1123                         if ( empty($title) )
    1124                                 $title = esc_html(strip_tags($rss->get_title()));
    1125                         $link = esc_url(strip_tags($rss->get_permalink()));
    1126                         while ( stristr($link, 'http') != $link )
    1127                                 $link = substr($link, 1);
     1155                if ( ! is_wp_error( $rss ) ) {
     1156                        $desc = esc_attr( strip_tags( @html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
     1157                        if ( empty( $title ) ) {
     1158                                $title = esc_html( strip_tags( $rss->get_title() ) );
     1159                        }
     1160                        $link = esc_url( strip_tags( $rss->get_permalink() ) );
     1161                        while ( stristr( $link, 'http' ) != $link ) {
     1162                                $link = substr( $link, 1 );
     1163                        }
    11281164                }
    11291165
    1130                 if ( empty($title) )
    1131                         $title = empty($desc) ? __('Unknown Feed') : $desc;
     1166                if ( empty( $title ) ) {
     1167                        $title = empty( $desc ) ? __( 'Unknown Feed' ) : $desc;
     1168                }
    11321169
    11331170                /** This filter is documented in wp-includes/default-widgets.php */
    11341171                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    11351172
    1136                 $url = esc_url(strip_tags($url));
    1137                 $icon = includes_url('images/rss.png');
    1138                 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>";
     1173                $url = esc_url( strip_tags( $url ) );
     1174                $icon = includes_url( 'images/rss.png' );
     1175                if ( $title ) {
     1176                        $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 ) .'">' . $title.'</a>';
     1177                }
    11401178
    11411179                echo $args['before_widget'];
    11421180                if ( $title ) {
     
    11451183                wp_widget_rss_output( $rss, $instance );
    11461184                echo $args['after_widget'];
    11471185
    1148                 if ( ! is_wp_error($rss) )
     1186                if ( ! is_wp_error( $rss ) ) {
    11491187                        $rss->__destruct();
     1188                }
    11501189                unset($rss);
    11511190        }
    11521191
     
    11561195         * @return array
    11571196         */
    11581197        public function update( $new_instance, $old_instance ) {
    1159                 $testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
     1198                $testurl = ( isset( $new_instance['url'] ) && ( ! isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
    11601199                return wp_widget_rss_process( $new_instance, $testurl );
    11611200        }
    11621201
     
    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( __( '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() ) {
     1266        if ( ! $rss->get_item_quantity() ) {
    12111267                echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
    12121268                $rss->__destruct();
    12131269                unset($rss);
     
    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>';
     
    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 _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 _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 _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 _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 _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 _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);
     
    13961455class WP_Widget_Tag_Cloud extends WP_Widget {
    13971456
    13981457        public function __construct() {
    1399                 $widget_ops = array( 'description' => __( "A cloud of your most used tags.") );
    1400                 parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
     1458                $widget_ops = array( 'description' => __( 'A cloud of your most used tags.' ) );
     1459                parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops );
    14011460        }
    14021461
    14031462        /**
     
    14051464         * @param array $instance
    14061465         */
    14071466        public function widget( $args, $instance ) {
    1408                 $current_taxonomy = $this->_get_current_taxonomy($instance);
    1409                 if ( !empty($instance['title']) ) {
     1467                $current_taxonomy = $this->_get_current_taxonomy( $instance );
     1468                if ( ! empty( $instance['title'] ) ) {
    14101469                        $title = $instance['title'];
    14111470                } else {
    14121471                        if ( 'post_tag' == $current_taxonomy ) {
    1413                                 $title = __('Tags');
     1472                                $title = __( 'Tags' );
    14141473                        } else {
    1415                                 $tax = get_taxonomy($current_taxonomy);
     1474                                $tax = get_taxonomy( $current_taxonomy );
    14161475                                $title = $tax->labels->name;
    14171476                        }
    14181477                }
     
    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";
     
    14511510         */
    14521511        public function update( $new_instance, $old_instance ) {
    14531512                $instance = array();
    1454                 $instance['title'] = strip_tags(stripslashes($new_instance['title']));
    1455                 $instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
     1513                $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
     1514                $instance['taxonomy'] = stripslashes( $new_instance['taxonomy'] );
    14561515                return $instance;
    14571516        }
    14581517
     
    14601519         * @param array $instance
    14611520         */
    14621521        public function form( $instance ) {
    1463                 $current_taxonomy = $this->_get_current_taxonomy($instance);
     1522                $current_taxonomy = $this->_get_current_taxonomy( $instance );
     1523                $title = ( isset ( $instance['title'] ) ) ? $instance['title'] : '';
    14641524?>
    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'); ?>">
     1525        <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ) ?></label>
     1526        <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>
     1527        <p><label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php _e( 'Taxonomy:' ) ?></label>
     1528        <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>">
    14691529        <?php foreach ( get_taxonomies() as $taxonomy ) :
    1470                                 $tax = get_taxonomy($taxonomy);
    1471                                 if ( !$tax->show_tagcloud || empty($tax->labels->name) )
     1530                                $tax = get_taxonomy( $taxonomy );
     1531                                if ( ! $tax->show_tagcloud || empty( $tax->labels->name ) ) {
    14721532                                        continue;
     1533                                }
    14731534        ?>
    1474                 <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>
     1535                <option value="<?php echo esc_attr( $taxonomy ) ?>" <?php selected( $taxonomy, $current_taxonomy ) ?>><?php echo esc_html( $tax->labels->name ); ?></option>
    14751536        <?php endforeach; ?>
    14761537        </select></p><?php
    14771538        }
     
    14811542         * @return string
    14821543         */
    14831544        public function _get_current_taxonomy($instance) {
    1484                 if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
     1545                if ( ! empty( $instance['taxonomy'] ) && taxonomy_exists( $instance['taxonomy'] ) ) {
    14851546                        return $instance['taxonomy'];
     1547                }
    14861548
    14871549                return 'post_tag';
    14881550        }
     
    14931555 *
    14941556 * @since 3.0.0
    14951557 */
    1496  class WP_Nav_Menu_Widget extends WP_Widget {
     1558class WP_Nav_Menu_Widget extends WP_Widget {
    14971559
    14981560        public function __construct() {
    1499                 $widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
    1500                 parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
     1561                $widget_ops = array( 'description' => __( 'Add a custom menu to your sidebar.' ) );
     1562                parent::__construct( 'nav_menu', __( 'Custom Menu' ), $widget_ops );
    15011563        }
    15021564
    15031565        /**
     
    15081570                // Get menu
    15091571                $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
    15101572
    1511                 if ( !$nav_menu )
     1573                if ( ! $nav_menu ) {
    15121574                        return;
     1575                }
    15131576
     1577
    15141578                /** This filter is documented in wp-includes/default-widgets.php */
    15151579                $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    15161580
    15171581                echo $args['before_widget'];
    15181582
    1519                 if ( !empty($instance['title']) )
     1583                if ( ! empty( $instance['title'] ) ) {
    15201584                        echo $args['before_title'] . $instance['title'] . $args['after_title'];
     1585                }
    15211586
     1587
    15221588                $nav_menu_args = array(
    15231589                        'fallback_cb' => '',
    1524                         'menu'        => $nav_menu
     1590                        'menu'        => $nav_menu,
    15251591                );
    15261592
    15271593                /**
     
    15511617        public function update( $new_instance, $old_instance ) {
    15521618                $instance = array();
    15531619                if ( ! empty( $new_instance['title'] ) ) {
    1554                         $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
     1620                        $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
    15551621                }
    15561622                if ( ! empty( $new_instance['nav_menu'] ) ) {
    15571623                        $instance['nav_menu'] = (int) $new_instance['nav_menu'];
     
    15631629         * @param array $instance
    15641630         */
    15651631        public function form( $instance ) {
    1566                 $title = isset( $instance['title'] ) ? $instance['title'] : '';
     1632                $title    = isset( $instance['title'] ) ? $instance['title'] : '';
    15671633                $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
    15681634
    15691635                // Get menus
     
    15701636                $menus = wp_get_nav_menus();
    15711637
    15721638                // 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>';
     1639                if ( ! $menus ) {
     1640                        echo '<p>'. sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_url( admin_url( 'nav-menus.php' ) ) ) .'</p>';
    15751641                        return;
    15761642                }
    15771643                ?>
    15781644                <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; ?>" />
     1645                        <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ) ?></label>
     1646                        <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 ); ?>" />
    15811647                </p>
    15821648                <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'); ?>">
     1649                        <label for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php _e( 'Select Menu:' ); ?></label>
     1650                        <select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
    15851651                                <option value="0"><?php _e( '&mdash; Select &mdash;' ) ?></option>
    15861652                <?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                         }
     1653                foreach ( $menus as $menu ) {
     1654                        echo '<option value="' . $menu->term_id . '"'
     1655                                . selected( $nav_menu, $menu->term_id, false )
     1656                                . '>'. esc_html( $menu->name ) . '</option>';
     1657                }
    15921658                ?>
    15931659                        </select>
    15941660                </p>
     
    16051671 * @since 2.2.0
    16061672 */
    16071673function wp_widgets_init() {
    1608         if ( !is_blog_installed() )
     1674        if ( ! is_blog_installed() ) {
    16091675                return;
     1676        }
    16101677
    1611         register_widget('WP_Widget_Pages');
     1678        register_widget( 'WP_Widget_Pages' );
    16121679
    1613         register_widget('WP_Widget_Calendar');
     1680        register_widget( 'WP_Widget_Calendar' );
    16141681
    1615         register_widget('WP_Widget_Archives');
     1682        register_widget( 'WP_Widget_Archives' );
    16161683
    1617         if ( get_option( 'link_manager_enabled' ) )
    1618                 register_widget('WP_Widget_Links');
     1684        if ( get_option( 'link_manager_enabled' ) ) {
     1685                register_widget( 'WP_Widget_Links' );
     1686        }
    16191687
    1620         register_widget('WP_Widget_Meta');
    16211688
    1622         register_widget('WP_Widget_Search');
     1689        register_widget( 'WP_Widget_Meta' );
    16231690
    1624         register_widget('WP_Widget_Text');
     1691        register_widget( 'WP_Widget_Search' );
    16251692
    1626         register_widget('WP_Widget_Categories');
     1693        register_widget( 'WP_Widget_Text' );
    16271694
    1628         register_widget('WP_Widget_Recent_Posts');
     1695        register_widget( 'WP_Widget_Categories' );
    16291696
    1630         register_widget('WP_Widget_Recent_Comments');
     1697        register_widget( 'WP_Widget_Recent_Posts' );
    16311698
    1632         register_widget('WP_Widget_RSS');
     1699        register_widget( 'WP_Widget_Recent_Comments' );
    16331700
    1634         register_widget('WP_Widget_Tag_Cloud');
     1701        register_widget( 'WP_Widget_RSS' );
    16351702
    1636         register_widget('WP_Nav_Menu_Widget');
     1703        register_widget( 'WP_Widget_Tag_Cloud' );
    16371704
     1705        register_widget( 'WP_Nav_Menu_Widget' );
     1706
    16381707        /**
    16391708         * Fires after all default WordPress widgets have been registered.
    16401709         *