Make WordPress Core

Ticket #22400: 22400.default-widgets.php.3.diff

File 22400.default-widgets.php.3.diff, 21.0 KB (added by rzen, 9 years ago)

Take 3: remove extract() throughout default-widgets.php

  • src/wp-includes/default-widgets.php

     
    1919        }
    2020
    2121        function widget( $args, $instance ) {
    22                 extract( $args );
    2322
    2423                /**
    2524                 * Filter the widget title.
     
    3534                $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
    3635                $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
    3736
    38                 if ( $sortby == 'menu_order' )
     37                if ( 'menu_order' == $sortby ) {
    3938                        $sortby = 'menu_order, post_title';
     39                }
    4040
    4141                /**
    4242                 * Filter the arguments for the Pages widget.
     
    5454                        'exclude'     => $exclude
    5555                ) ) );
    5656
    57                 if ( !empty( $out ) ) {
    58                         echo $before_widget;
    59                         if ( $title)
    60                                 echo $before_title . $title . $after_title;
     57                if ( ! empty( $out ) ) {
     58                        echo $args['before_widget'];
     59                        if ( $title ) {
     60                                echo $args['before_title'] . $title . $args['after_title'];
     61                        }
    6162                ?>
    6263                <ul>
    6364                        <?php echo $out; ?>
    6465                </ul>
    6566                <?php
    66                         echo $after_widget;
     67                        echo $args['after_widget'];
    6768                }
    6869        }
    6970
     
    119120        }
    120121
    121122        function widget( $args, $instance ) {
    122                 extract($args, EXTR_SKIP);
    123123
    124124                $show_description = isset($instance['description']) ? $instance['description'] : false;
    125125                $show_name = isset($instance['name']) ? $instance['name'] : false;
     
    127127                $show_images = isset($instance['images']) ? $instance['images'] : true;
    128128                $category = isset($instance['category']) ? $instance['category'] : false;
    129129                $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
    130                 $order = $orderby == 'rating' ? 'DESC' : 'ASC';
     130                $order = ( 'rating' == $orderby ) ? 'DESC' : 'ASC';
    131131                $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
    132132
    133                 $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
     133                $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
    134134
    135135                /**
    136136                 * Filter the arguments for the Links widget.
     
    142142                 * @param array $args An array of arguments to retrieve the links list.
    143143                 */
    144144                wp_list_bookmarks( apply_filters( 'widget_links_args', array(
    145                         'title_before' => $before_title, 'title_after' => $after_title,
    146                         'category_before' => $before_widget, 'category_after' => $after_widget,
     145                        'title_before' => $args['before_title'], 'title_after' => $args['after_title'],
     146                        'category_before' => $args['before_widget'], 'category_after' => $args['after_widget'],
    147147                        'show_images' => $show_images, 'show_description' => $show_description,
    148148                        'show_name' => $show_name, 'show_rating' => $show_rating,
    149149                        'category' => $category, 'class' => 'linkcat widget',
     
    156156                $new_instance = (array) $new_instance;
    157157                $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 );
    158158                foreach ( $instance as $field => $val ) {
    159                         if ( isset($new_instance[$field]) )
     159                        if ( isset( $new_instance[ $field ] ) ) {
    160160                                $instance[$field] = 1;
     161                        }
    161162                }
    162163
    163164                $instance['orderby'] = 'name';
    164                 if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
     165                if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) ) {
    165166                        $instance['orderby'] = $new_instance['orderby'];
     167                }
    166168
    167169                $instance['category'] = intval( $new_instance['category'] );
    168170                $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
     
    229231        }
    230232
    231233        function widget( $args, $instance ) {
    232                 extract($args);
    233234
    234235                /** This filter is documented in wp-includes/default-widgets.php */
    235236                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    236237
    237                 echo $before_widget;
    238                 if ( $title )
    239                         echo $before_title . $title . $after_title;
     238                echo $args['before_widget'];
     239                if ( $title ) {
     240                        echo $args['before_title'] . $title . $args['after_title'];
     241                }
    240242
    241243                // Use current theme search form if it exists
    242244                get_search_form();
    243245
    244                 echo $after_widget;
     246                echo $args['after_widget'];
    245247        }
    246248
    247249        function form( $instance ) {
     
    274276        }
    275277
    276278        function widget( $args, $instance ) {
    277                 extract($args);
    278279                $c = ! empty( $instance['count'] ) ? '1' : '0';
    279280                $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
    280281
    281282                /** This filter is documented in wp-includes/default-widgets.php */
    282                 $title = apply_filters( 'widget_title', empty($instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base );
     283                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base );
    283284
    284                 echo $before_widget;
    285                 if ( $title )
    286                         echo $before_title . $title . $after_title;
     285                echo $args['before_widget'];
     286                if ( $title ) {
     287                        echo $args['before_title'] . $title . $args['after_title'];
     288                }
    287289
    288290                if ( $d ) {
    289291?>
     
    330332<?php
    331333                }
    332334
    333                 echo $after_widget;
     335                echo $args['after_widget'];
    334336        }
    335337
    336338        function update( $new_instance, $old_instance ) {
     
    374376        }
    375377
    376378        function widget( $args, $instance ) {
    377                 extract($args);
    378379
    379380                /** This filter is documented in wp-includes/default-widgets.php */
    380381                $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );
    381382
    382                 echo $before_widget;
    383                 if ( $title )
    384                         echo $before_title . $title . $after_title;
     383                echo $args['before_widget'];
     384                if ( $title ) {
     385                        echo $args['before_title'] . $title . $args['after_title'];
     386                }
    385387?>
    386388                        <ul>
    387389                        <?php wp_register(); ?>
     
    406408?>
    407409                        </ul>
    408410<?php
    409                 echo $after_widget;
     411                echo $args['after_widget'];
    410412        }
    411413
    412414        function update( $new_instance, $old_instance ) {
     
    438440        }
    439441
    440442        function widget( $args, $instance ) {
    441                 extract($args);
    442443
    443444                /** This filter is documented in wp-includes/default-widgets.php */
    444445                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    445446
    446                 echo $before_widget;
    447                 if ( $title )
    448                         echo $before_title . $title . $after_title;
     447                echo $args['before_widget'];
     448                if ( $title ) {
     449                        echo $args['before_title'] . $title . $args['after_title'];
     450                }
    449451                echo '<div id="calendar_wrap">';
    450452                get_calendar();
    451453                echo '</div>';
    452                 echo $after_widget;
     454                echo $args['after_widget'];
    453455        }
    454456
    455457        function update( $new_instance, $old_instance ) {
     
    483485        }
    484486
    485487        function widget( $args, $instance ) {
    486                 extract($args);
    487488
    488489                /** This filter is documented in wp-includes/default-widgets.php */
    489490                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
     
    497498                 * @param WP_Widget $instance    WP_Widget instance.
    498499                 */
    499500                $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );
    500                 echo $before_widget;
    501                 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
     501                echo $args['before_widget'];
     502                if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } ?>
    502503                        <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
    503504                <?php
    504                 echo $after_widget;
     505                echo $args['after_widget'];
    505506        }
    506507
    507508        function update( $new_instance, $old_instance ) {
    508509                $instance = $old_instance;
    509510                $instance['title'] = strip_tags($new_instance['title']);
    510                 if ( current_user_can('unfiltered_html') )
     511                if ( current_user_can('unfiltered_html') ) {
    511512                        $instance['text'] =  $new_instance['text'];
    512                 else
     513                } else {
    513514                        $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
     515                }
    514516                $instance['filter'] = isset($new_instance['filter']);
    515517                return $instance;
    516518        }
     
    543545        }
    544546
    545547        function widget( $args, $instance ) {
    546                 extract( $args );
    547548
    548549                /** This filter is documented in wp-includes/default-widgets.php */
    549550                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );
     
    552553                $h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
    553554                $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
    554555
    555                 echo $before_widget;
    556                 if ( $title )
    557                         echo $before_title . $title . $after_title;
     556                echo $args['before_widget'];
     557                if ( $title ) {
     558                        echo $args['before_title'] . $title . $args['after_title'];
     559                }
    558560
    559561                $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
    560562
     
    605607<?php
    606608                }
    607609
    608                 echo $after_widget;
     610                echo $args['after_widget'];
    609611        }
    610612
    611613        function update( $new_instance, $old_instance ) {
     
    679681                }
    680682
    681683                ob_start();
    682                 extract($args);
    683684
    684685                $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
    685686
     
    687688                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    688689
    689690                $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
    690                 if ( ! $number )
     691                if ( ! $number ) {
    691692                        $number = 5;
     693                }
    692694                $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
    693695
    694696                /**
     
    709711
    710712                if ($r->have_posts()) :
    711713?>
    712                 <?php echo $before_widget; ?>
    713                 <?php if ( $title ) echo $before_title . $title . $after_title; ?>
     714                <?php echo $args['before_widget']; ?>
     715                <?php if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } ?>
    714716                <ul>
    715717                <?php while ( $r->have_posts() ) : $r->the_post(); ?>
    716718                        <li>
     
    721723                        </li>
    722724                <?php endwhile; ?>
    723725                </ul>
    724                 <?php echo $after_widget; ?>
     726                <?php echo $args['after_widget']; ?>
    725727<?php
    726728                // Reset the global $the_post as this query will have stomped on it
    727729                wp_reset_postdata();
     
    744746                $this->flush_widget_cache();
    745747
    746748                $alloptions = wp_cache_get( 'alloptions', 'options' );
    747                 if ( isset($alloptions['widget_recent_entries']) )
     749                if ( isset( $alloptions['widget_recent_entries'] ) ) {
    748750                        delete_option('widget_recent_entries');
     751                }
    749752
    750753                return $instance;
    751754        }
     
    783786                parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
    784787                $this->alt_option_name = 'widget_recent_comments';
    785788
    786                 if ( is_active_widget(false, false, $this->id_base) )
     789                if ( is_active_widget( false, false, $this->id_base ) ) {
    787790                        add_action( 'wp_head', array($this, 'recent_comments_style') );
     791                }
    788792
    789793                add_action( 'comment_post', array($this, 'flush_widget_cache') );
    790794                add_action( 'edit_comment', array($this, 'flush_widget_cache') );
     
    802806                 * @param string $id_base The widget ID.
    803807                 */
    804808                if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
    805                         || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
     809                        || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
    806810                        return;
     811                }
    807812                ?>
    808813        <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    809814<?php
     
    832837                        return;
    833838                }
    834839
    835                 extract($args, EXTR_SKIP);
    836840                $output = '';
    837841
    838842                $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' );
     
    841845                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    842846
    843847                $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
    844                 if ( ! $number )
     848                if ( ! $number ) {
    845849                        $number = 5;
     850                }
    846851
    847852                /**
    848853                 * Filter the arguments for the Recent Comments widget.
     
    859864                        'post_status' => 'publish'
    860865                ) ) );
    861866
    862                 $output .= $before_widget;
    863                 if ( $title )
    864                         $output .= $before_title . $title . $after_title;
     867                $output .= $args['before_widget'];
     868                if ( $title ) {
     869                        $output .= $args['before_title'] . $title . $args['after_title'];
     870                }
    865871
    866872                $output .= '<ul id="recentcomments">';
    867873                if ( $comments ) {
     
    874880                        }
    875881                }
    876882                $output .= '</ul>';
    877                 $output .= $after_widget;
     883                $output .= $args['after_widget'];
    878884
    879885                echo $output;
    880886
     
    891897                $this->flush_widget_cache();
    892898
    893899                $alloptions = wp_cache_get( 'alloptions', 'options' );
    894                 if ( isset($alloptions['widget_recent_comments']) )
     900                if ( isset( $alloptions['widget_recent_comments'] ) ) {
    895901                        delete_option('widget_recent_comments');
     902                }
    896903
    897904                return $instance;
    898905        }
     
    928935                if ( isset($instance['error']) && $instance['error'] )
    929936                        return;
    930937
    931                 extract($args, EXTR_SKIP);
    932 
    933938                $url = ! empty( $instance['url'] ) ? $instance['url'] : '';
    934                 while ( stristr($url, 'http') != $url )
     939                while ( stristr( $url, 'http' ) != $url ) {
    935940                        $url = substr($url, 1);
     941                }
    936942
    937                 if ( empty($url) )
     943                if ( empty( $url ) ) {
    938944                        return;
     945                }
    939946
    940947                // self-url destruction sequence
    941                 if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) )
     948                if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) ) {
    942949                        return;
     950                }
    943951
    944952                $rss = fetch_feed($url);
    945953                $title = $instance['title'];
     
    948956
    949957                if ( ! is_wp_error($rss) ) {
    950958                        $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
    951                         if ( empty($title) )
     959                        if ( empty( $title ) ) {
    952960                                $title = esc_html(strip_tags($rss->get_title()));
     961                        }
    953962                        $link = esc_url(strip_tags($rss->get_permalink()));
    954                         while ( stristr($link, 'http') != $link )
     963                        while ( stristr( $link, 'http' ) != $link ) {
    955964                                $link = substr($link, 1);
     965                        }
    956966                }
    957967
    958                 if ( empty($title) )
     968                if ( empty( $title ) ) {
    959969                        $title = empty($desc) ? __('Unknown Feed') : $desc;
     970                }
    960971
    961972                /** This filter is documented in wp-includes/default-widgets.php */
    962973                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
     
    963974
    964975                $url = esc_url(strip_tags($url));
    965976                $icon = includes_url('images/rss.png');
    966                 if ( $title )
     977                if ( $title ) {
    967978                        $title = "<a class='rsswidget' href='$url' title='" . esc_attr__( 'Syndicate this content' ) ."'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
     979                }
    968980
    969                 echo $before_widget;
    970                 if ( $title )
    971                         echo $before_title . $title . $after_title;
     981                echo $args['before_widget'];
     982                if ( $title ) {
     983                        echo $args['before_title'] . $title . $args['after_title'];
     984                }
    972985                wp_widget_rss_output( $rss, $instance );
    973                 echo $after_widget;
     986                echo $args['after_widget'];
    974987
    975                 if ( ! is_wp_error($rss) )
     988                if ( ! is_wp_error( $rss ) ) {
    976989                        $rss->__destruct();
     990                }
    977991                unset($rss);
    978992        }
    979993
     
    984998
    985999        function form($instance) {
    9861000
    987                 if ( empty($instance) )
     1001                if ( empty( $instance ) ) {
    9881002                        $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 );
     1003                }
    9891004                $instance['number'] = $this->number;
    9901005
    9911006                wp_widget_rss_form( $instance );
     
    10111026        }
    10121027
    10131028        if ( is_wp_error($rss) ) {
    1014                 if ( is_admin() || current_user_can('manage_options') )
     1029                if ( is_admin() || current_user_can( 'manage_options' ) ) {
    10151030                        echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
     1031                }
    10161032                return;
    10171033        }
    10181034
    10191035        $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
    10201036        $args = wp_parse_args( $args, $default_args );
    1021         extract( $args, EXTR_SKIP );
    10221037
    1023         $items = (int) $items;
    1024         if ( $items < 1 || 20 < $items )
     1038        $items = (int) $args['items'];
     1039        if ( $items < 1 || 20 < $items ) {
    10251040                $items = 10;
    1026         $show_summary  = (int) $show_summary;
    1027         $show_author   = (int) $show_author;
    1028         $show_date     = (int) $show_date;
     1041        }
     1042        $show_summary  = (int) $args['show_summary'];
     1043        $show_author   = (int) $args['show_author'];
     1044        $show_date     = (int) $args['show_date'];
    10291045
    10301046        if ( !$rss->get_item_quantity() ) {
    10311047                echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
     
    10371053        echo '<ul>';
    10381054        foreach ( $rss->get_items(0, $items) as $item ) {
    10391055                $link = $item->get_link();
    1040                 while ( stristr($link, 'http') != $link )
     1056                while ( stristr( $link, 'http' ) != $link ) {
    10411057                        $link = substr($link, 1);
     1058                }
    10421059                $link = esc_url(strip_tags($link));
    10431060                $title = esc_attr(strip_tags($item->get_title()));
    1044                 if ( empty($title) )
     1061                if ( empty( $title ) ) {
    10451062                        $title = __('Untitled');
     1063                }
    10461064
    10471065                $desc = @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
    10481066                $desc = esc_attr( strip_tags( $desc ) );
     
    11101128
    11111129        $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true );
    11121130        $inputs = wp_parse_args( $inputs, $default_inputs );
    1113         extract( $args );
    1114         extract( $inputs, EXTR_SKIP );
    11151131
    1116         $number = esc_attr( $number );
    1117         $title  = esc_attr( $title );
    1118         $url    = esc_url( $url );
    1119         $items  = (int) $items;
    1120         if ( $items < 1 || 20 < $items )
     1132        $number = esc_attr( $inputs['number'] );
     1133        $title  = esc_attr( $inputs['title'] );
     1134        $url    = esc_url( $inputs['url'] );
     1135        $items  = (int) $inputs['items'];
     1136        if ( $items < 1 || 20 < $items ) {
    11211137                $items  = 10;
    1122         $show_summary   = (int) $show_summary;
    1123         $show_author    = (int) $show_author;
    1124         $show_date      = (int) $show_date;
     1138        }
     1139        $show_summary   = (int) $inputs['show_summary'];
     1140        $show_author    = (int) $inputs['show_author'];
     1141        $show_date      = (int) $inputs['show_date'];
    11251142
    1126         if ( !empty($error) )
     1143        if ( ! empty( $error ) ) {
    11271144                echo '<p class="widget-error"><strong>' . sprintf( __('RSS Error: %s'), $error) . '</strong></p>';
     1145        }
    11281146
    11291147        if ( $inputs['url'] ) :
    11301148?>
     
    11371155        <p><label for="rss-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?'); ?></label>
    11381156        <select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]">
    11391157<?php
    1140                 for ( $i = 1; $i <= 20; ++$i )
     1158                for ( $i = 1; $i <= 20; ++$i ) {
    11411159                        echo "<option value='$i' " . selected( $items, $i, false ) . ">$i</option>";
     1160                }
    11421161?>
    11431162        </select></p>
    11441163<?php endif; if ( $inputs['show_summary'] ) : ?>
     
    11801199 */
    11811200function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
    11821201        $items = (int) $widget_rss['items'];
    1183         if ( $items < 1 || 20 < $items )
     1202        if ( $items < 1 || 20 < $items ) {
    11841203                $items = 10;
     1204        }
    11851205        $url           = esc_url_raw( strip_tags( $widget_rss['url'] ) );
    11861206        $title         = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
    11871207        $show_summary  = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
     
    12201240        }
    12211241
    12221242        function widget( $args, $instance ) {
    1223                 extract($args);
    12241243                $current_taxonomy = $this->_get_current_taxonomy($instance);
    12251244                if ( !empty($instance['title']) ) {
    12261245                        $title = $instance['title'];
     
    12361255                /** This filter is documented in wp-includes/default-widgets.php */
    12371256                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    12381257
    1239                 echo $before_widget;
    1240                 if ( $title )
    1241                         echo $before_title . $title . $after_title;
     1258                echo $args['before_widget'];
     1259                if ( $title ) {
     1260                        echo $args['before_title'] . $title . $args['after_title'];
     1261                }
    12421262                echo '<div class="tagcloud">';
    12431263
    12441264                /**
     
    12561276                ) ) );
    12571277
    12581278                echo "</div>\n";
    1259                 echo $after_widget;
     1279                echo $args['after_widget'];
    12601280        }
    12611281
    12621282        function update( $new_instance, $old_instance ) {
     
    12741294        <select class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>">
    12751295        <?php foreach ( get_taxonomies() as $taxonomy ) :
    12761296                                $tax = get_taxonomy($taxonomy);
    1277                                 if ( !$tax->show_tagcloud || empty($tax->labels->name) )
     1297                                if ( ! $tax->show_tagcloud || empty( $tax->labels->name ) ) {
    12781298                                        continue;
     1299                                }
    12791300        ?>
    12801301                <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>
    12811302        <?php endforeach; ?>
     
    12831304        }
    12841305
    12851306        function _get_current_taxonomy($instance) {
    1286                 if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
     1307                if ( ! empty( $instance['taxonomy'] ) && taxonomy_exists( $instance['taxonomy'] ) ) {
    12871308                        return $instance['taxonomy'];
     1309                }
    12881310
    12891311                return 'post_tag';
    12901312        }
     
    13061328                // Get menu
    13071329                $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
    13081330
    1309                 if ( !$nav_menu )
     1331                if ( ! $nav_menu ) {
    13101332                        return;
     1333                }
    13111334
    13121335                /** This filter is documented in wp-includes/default-widgets.php */
    13131336                $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
     
    13141337
    13151338                echo $args['before_widget'];
    13161339
    1317                 if ( !empty($instance['title']) )
     1340                if ( ! empty( $instance['title'] ) ) {
    13181341                        echo $args['before_title'] . $instance['title'] . $args['after_title'];
     1342                }
    13191343
    13201344                wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) );
    13211345
     
    13711395 * @since 2.2.0
    13721396 */
    13731397function wp_widgets_init() {
    1374         if ( !is_blog_installed() )
     1398        if ( ! is_blog_installed() ) {
    13751399                return;
     1400        }
    13761401
    13771402        register_widget('WP_Widget_Pages');
    13781403
     
    13801405
    13811406        register_widget('WP_Widget_Archives');
    13821407
    1383         if ( get_option( 'link_manager_enabled' ) )
     1408        if ( get_option( 'link_manager_enabled' ) ) {
    13841409                register_widget('WP_Widget_Links');
     1410        }
    13851411
    13861412        register_widget('WP_Widget_Meta');
    13871413