Ticket #17457: 1-default-widgets.patch
| File 1-default-widgets.patch, 60.8 KB (added by ramiy, 2 years ago) |
|---|
-
default-widgets.php
14 14 class WP_Widget_Pages extends WP_Widget { 15 15 16 16 function __construct() { 17 $widget_ops = array( 'classname' => 'widget_pages', 'description' => __( 'Your site’s WordPress Pages') );18 parent::__construct( 'pages', __('Pages'), $widget_ops);17 $widget_ops = array( 'classname' => 'widget_pages', 'description' => __( 'Your site’s WordPress Pages' ) ); 18 parent::__construct( 'pages', __( 'Pages' ), $widget_ops); 19 19 } 20 20 21 21 function widget( $args, $instance ) { 22 22 extract( $args ); 23 23 24 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base);24 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base); 25 25 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; 26 26 $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; 27 27 28 28 if ( $sortby == 'menu_order' ) 29 29 $sortby = 'menu_order, post_title'; 30 30 31 $out = wp_list_pages( apply_filters( 'widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );31 $out = wp_list_pages( apply_filters( 'widget_pages_args', array( 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) ); 32 32 33 33 if ( !empty( $out ) ) { 34 34 echo $before_widget; 35 if ( $title )35 if ( $title ) 36 36 echo $before_title . $title . $after_title; 37 37 ?> 38 38 <ul> … … 45 45 46 46 function update( $new_instance, $old_instance ) { 47 47 $instance = $old_instance; 48 $instance['title'] = strip_tags( $new_instance['title']);48 $instance['title'] = strip_tags( $new_instance['title'] ); 49 49 if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) { 50 50 $instance['sortby'] = $new_instance['sortby']; 51 51 } else { … … 59 59 60 60 function form( $instance ) { 61 61 //Defaults 62 $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '' ) );62 $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '' ) ); 63 63 $title = esc_attr( $instance['title'] ); 64 64 $exclude = esc_attr( $instance['exclude'] ); 65 65 ?> 66 <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>66 <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> 67 67 <p> 68 <label for="<?php echo $this->get_field_id( 'sortby'); ?>"><?php _e( 'Sort by:' ); ?></label>69 <select name="<?php echo $this->get_field_name( 'sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat">70 <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title'); ?></option>71 <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order'); ?></option>68 <label for="<?php echo $this->get_field_id( 'sortby' ); ?>"><?php _e( 'Sort by:' ); ?></label> 69 <select name="<?php echo $this->get_field_name( 'sortby' ); ?>" id="<?php echo $this->get_field_id( 'sortby' ); ?>" class="widefat"> 70 <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title' ); ?></option> 71 <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order' ); ?></option> 72 72 <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option> 73 73 </select> 74 74 </p> 75 75 <p> 76 <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" />76 <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" /> 77 77 <br /> 78 78 <small><?php _e( 'Page IDs, separated by commas.' ); ?></small> 79 79 </p> … … 90 90 class WP_Widget_Links extends WP_Widget { 91 91 92 92 function __construct() { 93 $widget_ops = array( 'description' => __( "Your blogroll") );94 parent::__construct( 'links', __('Links'), $widget_ops);93 $widget_ops = array( 'description' => __( 'Your blogroll' ) ); 94 parent::__construct( 'links', __( 'Links' ), $widget_ops ); 95 95 } 96 96 97 97 function widget( $args, $instance ) { 98 extract( $args, EXTR_SKIP);98 extract( $args, EXTR_SKIP ); 99 99 100 $show_description = isset( $instance['description']) ? $instance['description'] : false;101 $show_name = isset( $instance['name']) ? $instance['name'] : false;102 $show_rating = isset( $instance['rating']) ? $instance['rating'] : false;103 $show_images = isset( $instance['images']) ? $instance['images'] : true;104 $category = isset( $instance['category']) ? $instance['category'] : false;100 $show_description = isset( $instance['description'] ) ? $instance['description'] : false; 101 $show_name = isset( $instance['name'] ) ? $instance['name'] : false; 102 $show_rating = isset( $instance['rating'] ) ? $instance['rating'] : false; 103 $show_images = isset( $instance['images'] ) ? $instance['images'] : true; 104 $category = isset( $instance['category'] ) ? $instance['category'] : false; 105 105 106 106 if ( is_admin() && !$category ) { 107 107 // Display All Links widget as such in the widgets screen 108 echo $before_widget . $before_title. __( 'All Links') . $after_title . $after_widget;108 echo $before_widget . $before_title. __( 'All Links' ) . $after_title . $after_widget; 109 109 return; 110 110 } 111 111 112 $before_widget = preg_replace( '/id="[^"]*"/','id="%id"', $before_widget);113 wp_list_bookmarks( apply_filters('widget_links_args', array(112 $before_widget = preg_replace( '/id="[^"]*"/','id="%id"', $before_widget ); 113 wp_list_bookmarks( apply_filters( 'widget_links_args', array( 114 114 'title_before' => $before_title, 'title_after' => $after_title, 115 115 'category_before' => $before_widget, 'category_after' => $after_widget, 116 116 'show_images' => $show_images, 'show_description' => $show_description, … … 123 123 $new_instance = (array) $new_instance; 124 124 $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0); 125 125 foreach ( $instance as $field => $val ) { 126 if ( isset( $new_instance[$field]) )126 if ( isset( $new_instance[$field] ) ) 127 127 $instance[$field] = 1; 128 128 } 129 $instance['category'] = intval( $new_instance['category']);129 $instance['category'] = intval( $new_instance['category'] ); 130 130 131 131 return $instance; 132 132 } … … 135 135 136 136 //Defaults 137 137 $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false ) ); 138 $link_cats = get_terms( 'link_category' );138 $link_cats = get_terms( 'link_category' ); 139 139 ?> 140 140 <p> 141 <label for="<?php echo $this->get_field_id( 'category'); ?>" class="screen-reader-text"><?php _e('Select Link Category'); ?></label>142 <select class="widefat" id="<?php echo $this->get_field_id( 'category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">143 <option value=""><?php _e( 'All Links'); ?></option>141 <label for="<?php echo $this->get_field_id( 'category' ); ?>" class="screen-reader-text"><?php _e( 'Select Link Category' ); ?></label> 142 <select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>"> 143 <option value=""><?php _e( 'All Links' ); ?></option> 144 144 <?php 145 145 foreach ( $link_cats as $link_cat ) { 146 echo '<option value="' . intval( $link_cat->term_id) . '"'146 echo '<option value="' . intval( $link_cat->term_id ) . '"' 147 147 . ( $link_cat->term_id == $instance['category'] ? ' selected="selected"' : '' ) 148 148 . '>' . $link_cat->name . "</option>\n"; 149 149 } 150 150 ?> 151 151 </select></p> 152 152 <p> 153 <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'); ?>" />154 <label for="<?php echo $this->get_field_id( 'images'); ?>"><?php _e('Show Link Image'); ?></label><br />155 <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'); ?>" />156 <label for="<?php echo $this->get_field_id( 'name'); ?>"><?php _e('Show Link Name'); ?></label><br />157 <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'); ?>" />158 <label for="<?php echo $this->get_field_id( 'description'); ?>"><?php _e('Show Link Description'); ?></label><br />159 <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'); ?>" />160 <label for="<?php echo $this->get_field_id( 'rating'); ?>"><?php _e('Show Link Rating'); ?></label>153 <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' ); ?>" /> 154 <label for="<?php echo $this->get_field_id( 'images' ); ?>"><?php _e( 'Show Link Image' ); ?></label><br /> 155 <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' ); ?>" /> 156 <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e( 'Show Link Name' ); ?></label><br /> 157 <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' ); ?>" /> 158 <label for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e( 'Show Link Description' ); ?></label><br /> 159 <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' ); ?>" /> 160 <label for="<?php echo $this->get_field_id( 'rating' ); ?>"><?php _e( 'Show Link Rating' ); ?></label> 161 161 </p> 162 162 <?php 163 163 } … … 171 171 class WP_Widget_Search extends WP_Widget { 172 172 173 173 function __construct() { 174 $widget_ops = array( 'classname' => 'widget_search', 'description' => __( "A search form for your site") );175 parent::__construct( 'search', __('Search'), $widget_ops);174 $widget_ops = array( 'classname' => 'widget_search', 'description' => __( 'A search form for your site' ) ); 175 parent::__construct( 'search', __( 'Search' ), $widget_ops ); 176 176 } 177 177 178 178 function widget( $args, $instance ) { 179 extract( $args);180 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);179 extract( $args ); 180 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base); 181 181 182 182 echo $before_widget; 183 183 if ( $title ) … … 190 190 } 191 191 192 192 function form( $instance ) { 193 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );193 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 194 194 $title = $instance['title']; 195 195 ?> 196 <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>196 <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> 197 197 <?php 198 198 } 199 199 200 200 function update( $new_instance, $old_instance ) { 201 201 $instance = $old_instance; 202 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => ''));203 $instance['title'] = strip_tags( $new_instance['title']);202 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) ); 203 $instance['title'] = strip_tags( $new_instance['title'] ); 204 204 return $instance; 205 205 } 206 206 … … 214 214 class WP_Widget_Archives extends WP_Widget { 215 215 216 216 function __construct() { 217 $widget_ops = array( 'classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s posts') );218 parent::__construct( 'archives', __('Archives'), $widget_ops);217 $widget_ops = array( 'classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s posts' ) ); 218 parent::__construct( 'archives', __( 'Archives' ), $widget_ops ); 219 219 } 220 220 221 221 function widget( $args, $instance ) { 222 extract( $args);222 extract( $args ); 223 223 $c = $instance['count'] ? '1' : '0'; 224 224 $d = $instance['dropdown'] ? '1' : '0'; 225 $title = apply_filters( 'widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base);225 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base); 226 226 227 227 echo $before_widget; 228 228 if ( $title ) … … 230 230 231 231 if ( $d ) { 232 232 ?> 233 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr( __('Select Month')); ?></option> <?php wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))); ?> </select>233 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option> <?php wp_get_archives( apply_filters( 'widget_archives_dropdown_args', array( 'type' => 'monthly', 'format' => 'option', 'show_post_count' => $c ) ) ); ?> </select> 234 234 <?php 235 235 } else { 236 236 ?> 237 237 <ul> 238 <?php wp_get_archives( apply_filters('widget_archives_args', array('type' => 'monthly', 'show_post_count' => $c))); ?>238 <?php wp_get_archives( apply_filters( 'widget_archives_args', array( 'type' => 'monthly', 'show_post_count' => $c ) ) ); ?> 239 239 </ul> 240 240 <?php 241 241 } … … 245 245 246 246 function update( $new_instance, $old_instance ) { 247 247 $instance = $old_instance; 248 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );249 $instance['title'] = strip_tags( $new_instance['title']);248 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) ); 249 $instance['title'] = strip_tags( $new_instance['title'] ); 250 250 $instance['count'] = $new_instance['count'] ? 1 : 0; 251 251 $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; 252 252 … … 254 254 } 255 255 256 256 function form( $instance ) { 257 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );258 $title = strip_tags( $instance['title']);257 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) ); 258 $title = strip_tags( $instance['title'] ); 259 259 $count = $instance['count'] ? 'checked="checked"' : ''; 260 260 $dropdown = $instance['dropdown'] ? 'checked="checked"' : ''; 261 261 ?> 262 <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>262 <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> 263 263 <p> 264 <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>264 <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> 265 265 <br/> 266 <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>266 <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> 267 267 </p> 268 268 <?php 269 269 } … … 279 279 class WP_Widget_Meta extends WP_Widget { 280 280 281 281 function __construct() { 282 $widget_ops = array( 'classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );283 parent::__construct( 'meta', __('Meta'), $widget_ops);282 $widget_ops = array( 'classname' => 'widget_meta', 'description' => __( 'Log in/out, admin, feed and WordPress links' ) ); 283 parent::__construct( 'meta', __( 'Meta' ), $widget_ops); 284 284 } 285 285 286 286 function widget( $args, $instance ) { 287 extract( $args);288 $title = apply_filters( 'widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base);287 extract( $args ); 288 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); 289 289 290 290 echo $before_widget; 291 291 if ( $title ) … … 294 294 <ul> 295 295 <?php wp_register(); ?> 296 296 <li><?php wp_loginout(); ?></li> 297 <li><a href="<?php bloginfo( 'rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>298 <li><a href="<?php bloginfo( 'comments_rss2_url'); ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>299 <li><a href="http://wordpress.org/" title="<?php echo esc_attr( __('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>297 <li><a href="<?php bloginfo( 'rss2_url' ); ?>" title="<?php echo esc_attr( __( 'Syndicate this site using RSS 2.0' ) ); ?>"><?php _e( 'Entries <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li> 298 <li><a href="<?php bloginfo( 'comments_rss2_url' ); ?>" title="<?php echo esc_attr( __( 'The latest comments to all posts in RSS' ) ); ?>"><?php _e( 'Comments <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li> 299 <li><a href="http://wordpress.org/" title="<?php echo esc_attr( __( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ) ); ?>">WordPress.org</a></li> 300 300 <?php wp_meta(); ?> 301 301 </ul> 302 302 <?php … … 305 305 306 306 function update( $new_instance, $old_instance ) { 307 307 $instance = $old_instance; 308 $instance['title'] = strip_tags( $new_instance['title']);308 $instance['title'] = strip_tags( $new_instance['title'] ); 309 309 310 310 return $instance; 311 311 } 312 312 313 313 function form( $instance ) { 314 314 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 315 $title = strip_tags( $instance['title']);315 $title = strip_tags( $instance['title'] ); 316 316 ?> 317 <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>317 <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> 318 318 <?php 319 319 } 320 320 } … … 327 327 class WP_Widget_Calendar extends WP_Widget { 328 328 329 329 function __construct() { 330 $widget_ops = array( 'classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s posts') );331 parent::__construct( 'calendar', __('Calendar'), $widget_ops);330 $widget_ops = array( 'classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s posts' ) ); 331 parent::__construct( 'calendar', __( 'Calendar' ), $widget_ops); 332 332 } 333 333 334 334 function widget( $args, $instance ) { 335 extract( $args);336 $title = apply_filters( 'widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base);335 extract( $args ); 336 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? ' ' : $instance['title'], $instance, $this->id_base); 337 337 echo $before_widget; 338 338 if ( $title ) 339 339 echo $before_title . $title . $after_title; … … 345 345 346 346 function update( $new_instance, $old_instance ) { 347 347 $instance = $old_instance; 348 $instance['title'] = strip_tags( $new_instance['title']);348 $instance['title'] = strip_tags( $new_instance['title'] ); 349 349 350 350 return $instance; 351 351 } 352 352 353 353 function form( $instance ) { 354 354 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 355 $title = strip_tags( $instance['title']);355 $title = strip_tags( $instance['title'] ); 356 356 ?> 357 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:'); ?></label>358 <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>357 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 358 <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> 359 359 <?php 360 360 } 361 361 } … … 368 368 class WP_Widget_Text extends WP_Widget { 369 369 370 370 function __construct() { 371 $widget_ops = array( 'classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));372 $control_ops = array( 'width' => 400, 'height' => 350);373 parent::__construct( 'text', __('Text'), $widget_ops, $control_ops);371 $widget_ops = array( 'classname' => 'widget_text', 'description' => __( 'Arbitrary text or HTML' ) ); 372 $control_ops = array( 'width' => 400, 'height' => 350); 373 parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops); 374 374 } 375 375 376 376 function widget( $args, $instance ) { 377 extract( $args);378 $title = apply_filters( 'widget_title', empty( $instance['title']) ? '' : $instance['title'], $instance, $this->id_base);377 extract( $args ); 378 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base); 379 379 $text = apply_filters( 'widget_text', $instance['text'], $instance ); 380 380 echo $before_widget; 381 381 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> 382 <div class="textwidget"><?php echo $instance['filter'] ? wpautop( $text) : $text; ?></div>382 <div class="textwidget"><?php echo $instance['filter'] ? wpautop( $text ) : $text; ?></div> 383 383 <?php 384 384 echo $after_widget; 385 385 } 386 386 387 387 function update( $new_instance, $old_instance ) { 388 388 $instance = $old_instance; 389 $instance['title'] = strip_tags( $new_instance['title']);390 if ( current_user_can( 'unfiltered_html') )389 $instance['title'] = strip_tags( $new_instance['title'] ); 390 if ( current_user_can( 'unfiltered_html' ) ) 391 391 $instance['text'] = $new_instance['text']; 392 392 else 393 $instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text']) ) ); // wp_filter_post_kses() expects slashed394 $instance['filter'] = isset( $new_instance['filter']);393 $instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) ); // wp_filter_post_kses() expects slashed 394 $instance['filter'] = isset( $new_instance['filter'] ); 395 395 return $instance; 396 396 } 397 397 398 398 function form( $instance ) { 399 399 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) ); 400 $title = strip_tags( $instance['title']);401 $text = esc_textarea( $instance['text']);400 $title = strip_tags( $instance['title'] ); 401 $text = esc_textarea( $instance['text'] ); 402 402 ?> 403 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:'); ?></label>404 <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>403 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 404 <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> 405 405 406 <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>406 <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> 407 407 408 <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); ?> /> <label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>408 <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 ); ?> /> <label for="<?php echo $this->get_field_id( 'filter' ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label></p> 409 409 <?php 410 410 } 411 411 } … … 418 418 class WP_Widget_Categories extends WP_Widget { 419 419 420 420 function __construct() { 421 $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories") );422 parent::__construct( 'categories', __('Categories'), $widget_ops);421 $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( 'A list or dropdown of categories' ) ); 422 parent::__construct( 'categories', __( 'Categories' ), $widget_ops); 423 423 } 424 424 425 425 function widget( $args, $instance ) { 426 426 extract( $args ); 427 427 428 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base);428 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); 429 429 $c = $instance['count'] ? '1' : '0'; 430 430 $h = $instance['hierarchical'] ? '1' : '0'; 431 431 $d = $instance['dropdown'] ? '1' : '0'; … … 434 434 if ( $title ) 435 435 echo $before_title . $title . $after_title; 436 436 437 $cat_args = array( 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);437 $cat_args = array( 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); 438 438 439 439 if ( $d ) { 440 $cat_args['show_option_none'] = __( 'Select Category');441 wp_dropdown_categories( apply_filters('widget_categories_dropdown_args', $cat_args));440 $cat_args['show_option_none'] = __( 'Select Category' ); 441 wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args) ); 442 442 ?> 443 443 444 444 <script type='text/javascript'> … … 459 459 <ul> 460 460 <?php 461 461 $cat_args['title_li'] = ''; 462 wp_list_categories( apply_filters('widget_categories_args', $cat_args));462 wp_list_categories( apply_filters( 'widget_categories_args', $cat_args) ); 463 463 ?> 464 464 </ul> 465 465 <?php … … 470 470 471 471 function update( $new_instance, $old_instance ) { 472 472 $instance = $old_instance; 473 $instance['title'] = strip_tags( $new_instance['title']);474 $instance['count'] = !empty( $new_instance['count']) ? 1 : 0;475 $instance['hierarchical'] = !empty( $new_instance['hierarchical']) ? 1 : 0;476 $instance['dropdown'] = !empty( $new_instance['dropdown']) ? 1 : 0;473 $instance['title'] = strip_tags( $new_instance['title'] ); 474 $instance['count'] = !empty( $new_instance['count'] ) ? 1 : 0; 475 $instance['hierarchical'] = !empty( $new_instance['hierarchical'] ) ? 1 : 0; 476 $instance['dropdown'] = !empty( $new_instance['dropdown'] ) ? 1 : 0; 477 477 478 478 return $instance; 479 479 } 480 480 481 481 function form( $instance ) { 482 482 //Defaults 483 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );483 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 484 484 $title = esc_attr( $instance['title'] ); 485 $count = isset( $instance['count']) ? (bool) $instance['count'] :false;485 $count = isset( $instance['count'] ) ? (bool) $instance['count'] :false; 486 486 $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; 487 487 $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false; 488 488 ?> 489 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e( 'Title:' ); ?></label>490 <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>489 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 490 <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> 491 491 492 <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 ); ?> />493 <label for="<?php echo $this->get_field_id( 'dropdown'); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />492 <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 ); ?> /> 493 <label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label><br /> 494 494 495 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />496 <label for="<?php echo $this->get_field_id( 'count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />495 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>"<?php checked( $count ); ?> /> 496 <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show post counts' ); ?></label><br /> 497 497 498 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />499 <label for="<?php echo $this->get_field_id( 'hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>498 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'hierarchical' ); ?>" name="<?php echo $this->get_field_name( 'hierarchical' ); ?>"<?php checked( $hierarchical ); ?> /> 499 <label for="<?php echo $this->get_field_id( 'hierarchical' ); ?>"><?php _e( 'Show hierarchy' ); ?></label></p> 500 500 <?php 501 501 } 502 502 … … 510 510 class WP_Widget_Recent_Posts extends WP_Widget { 511 511 512 512 function __construct() { 513 $widget_ops = array( 'classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") );514 parent::__construct( 'recent-posts', __('Recent Posts'), $widget_ops);513 $widget_ops = array( 'classname' => 'widget_recent_entries', 'description' => __( 'The most recent posts on your site' ) ); 514 parent::__construct( 'recent-posts', __( 'Recent Posts' ), $widget_ops); 515 515 $this->alt_option_name = 'widget_recent_entries'; 516 516 517 add_action( 'save_post', array(&$this, 'flush_widget_cache' ) );518 add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) );519 add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) );517 add_action( 'save_post', array(&$this, 'flush_widget_cache' ) ); 518 add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) ); 519 add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) ); 520 520 } 521 521 522 function widget( $args, $instance) {523 $cache = wp_cache_get( 'widget_recent_posts', 'widget');522 function widget( $args, $instance ) { 523 $cache = wp_cache_get( 'widget_recent_posts', 'widget' ); 524 524 525 if ( !is_array( $cache) )525 if ( !is_array( $cache ) ) 526 526 $cache = array(); 527 527 528 if ( isset( $cache[$args['widget_id']]) ) {528 if ( isset( $cache[$args['widget_id']] ) ) { 529 529 echo $cache[$args['widget_id']]; 530 530 return; 531 531 } 532 532 533 533 ob_start(); 534 extract( $args);534 extract( $args ); 535 535 536 $title = apply_filters( 'widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);536 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Posts' ) : $instance['title'], $instance, $this->id_base); 537 537 if ( ! $number = absint( $instance['number'] ) ) 538 538 $number = 10; 539 539 540 $r = new WP_Query( array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true));541 if ( $r->have_posts()) :540 $r = new WP_Query( array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true) ); 541 if ( $r->have_posts() ) : 542 542 ?> 543 543 <?php echo $before_widget; ?> 544 544 <?php if ( $title ) echo $before_title . $title . $after_title; ?> 545 545 <ul> 546 <?php while ( $r->have_posts()) : $r->the_post(); ?>547 <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></li>546 <?php while ( $r->have_posts() ) : $r->the_post(); ?> 547 <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ? get_the_title() : get_the_ID() ); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></li> 548 548 <?php endwhile; ?> 549 549 </ul> 550 550 <?php echo $after_widget; ?> … … 555 555 endif; 556 556 557 557 $cache[$args['widget_id']] = ob_get_flush(); 558 wp_cache_set( 'widget_recent_posts', $cache, 'widget');558 wp_cache_set( 'widget_recent_posts', $cache, 'widget' ); 559 559 } 560 560 561 561 function update( $new_instance, $old_instance ) { 562 562 $instance = $old_instance; 563 $instance['title'] = strip_tags( $new_instance['title']);563 $instance['title'] = strip_tags( $new_instance['title'] ); 564 564 $instance['number'] = (int) $new_instance['number']; 565 565 $this->flush_widget_cache(); 566 566 567 567 $alloptions = wp_cache_get( 'alloptions', 'options' ); 568 if ( isset( $alloptions['widget_recent_entries']) )569 delete_option( 'widget_recent_entries');568 if ( isset( $alloptions['widget_recent_entries'] ) ) 569 delete_option( 'widget_recent_entries' ); 570 570 571 571 return $instance; 572 572 } 573 573 574 574 function flush_widget_cache() { 575 wp_cache_delete( 'widget_recent_posts', 'widget');575 wp_cache_delete( 'widget_recent_posts', 'widget' ); 576 576 } 577 577 578 578 function form( $instance ) { 579 $title = isset( $instance['title']) ? esc_attr($instance['title']) : '';580 $number = isset( $instance['number']) ? absint($instance['number']) : 5;579 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 580 $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; 581 581 ?> 582 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:'); ?></label>583 <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>582 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 583 <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> 584 584 585 <p><label for="<?php echo $this->get_field_id( 'number'); ?>"><?php _e('Number of posts to show:'); ?></label>586 <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>585 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label> 586 <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> 587 587 <?php 588 588 } 589 589 } … … 596 596 class WP_Widget_Recent_Comments extends WP_Widget { 597 597 598 598 function __construct() { 599 $widget_ops = array( 'classname' => 'widget_recent_comments', 'description' => __( 'The most recent comments' ) );600 parent::__construct( 'recent-comments', __('Recent Comments'), $widget_ops);599 $widget_ops = array( 'classname' => 'widget_recent_comments', 'description' => __( 'The most recent comments' ) ); 600 parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops); 601 601 $this->alt_option_name = 'widget_recent_comments'; 602 602 603 603 if ( is_active_widget(false, false, $this->id_base) ) 604 add_action( 'wp_head', array(&$this, 'recent_comments_style' ) );604 add_action( 'wp_head', array(&$this, 'recent_comments_style' ) ); 605 605 606 add_action( 'comment_post', array(&$this, 'flush_widget_cache' ) );607 add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache' ) );606 add_action( 'comment_post', array(&$this, 'flush_widget_cache' ) ); 607 add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache' ) ); 608 608 } 609 609 610 610 function recent_comments_style() { … … 617 617 } 618 618 619 619 function flush_widget_cache() { 620 wp_cache_delete( 'widget_recent_comments', 'widget');620 wp_cache_delete( 'widget_recent_comments', 'widget' ); 621 621 } 622 622 623 623 function widget( $args, $instance ) { 624 624 global $comments, $comment; 625 625 626 $cache = wp_cache_get( 'widget_recent_comments', 'widget');626 $cache = wp_cache_get( 'widget_recent_comments', 'widget' ); 627 627 628 628 if ( ! is_array( $cache ) ) 629 629 $cache = array(); … … 633 633 return; 634 634 } 635 635 636 extract( $args, EXTR_SKIP);636 extract( $args, EXTR_SKIP ); 637 637 $output = ''; 638 $title = apply_filters( 'widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']);638 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title']); 639 639 640 640 if ( ! $number = absint( $instance['number'] ) ) 641 641 $number = 5; … … 648 648 $output .= '<ul id="recentcomments">'; 649 649 if ( $comments ) { 650 650 foreach ( (array) $comments as $comment) { 651 $output .= '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf( _x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';651 $output .= '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf( _x( '%1$s on %2$s', 'widgets' ), get_comment_author_link(), '<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>' ) . '</li>'; 652 652 } 653 653 } 654 654 $output .= '</ul>'; … … 656 656 657 657 echo $output; 658 658 $cache[$args['widget_id']] = $output; 659 wp_cache_set( 'widget_recent_comments', $cache, 'widget');659 wp_cache_set( 'widget_recent_comments', $cache, 'widget' ); 660 660 } 661 661 662 662 function update( $new_instance, $old_instance ) { 663 663 $instance = $old_instance; 664 $instance['title'] = strip_tags( $new_instance['title']);664 $instance['title'] = strip_tags( $new_instance['title'] ); 665 665 $instance['number'] = absint( $new_instance['number'] ); 666 666 $this->flush_widget_cache(); 667 667 668 668 $alloptions = wp_cache_get( 'alloptions', 'options' ); 669 if ( isset( $alloptions['widget_recent_comments']) )670 delete_option( 'widget_recent_comments');669 if ( isset( $alloptions['widget_recent_comments'] ) ) 670 delete_option( 'widget_recent_comments' ); 671 671 672 672 return $instance; 673 673 } 674 674 675 675 function form( $instance ) { 676 $title = isset( $instance['title']) ? esc_attr($instance['title']) : '';677 $number = isset( $instance['number']) ? absint($instance['number']) : 5;676 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 677 $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; 678 678 ?> 679 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:'); ?></label>680 <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>679 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 680 <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> 681 681 682 <p><label for="<?php echo $this->get_field_id( 'number'); ?>"><?php _e('Number of comments to show:'); ?></label>683 <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>682 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label> 683 <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> 684 684 <?php 685 685 } 686 686 } … … 693 693 class WP_Widget_RSS extends WP_Widget { 694 694 695 695 function __construct() { 696 $widget_ops = array( 'description' => __( 'Entries from any RSS or Atom feed') );696 $widget_ops = array( 'description' => __( 'Entries from any RSS or Atom feed' ) ); 697 697 $control_ops = array( 'width' => 400, 'height' => 200 ); 698 parent::__construct( 'rss', __( 'RSS'), $widget_ops, $control_ops );698 parent::__construct( 'rss', __( 'RSS' ), $widget_ops, $control_ops ); 699 699 } 700 700 701 function widget( $args, $instance) {701 function widget( $args, $instance ) { 702 702 703 if ( isset( $instance['error']) && $instance['error'] )703 if ( isset( $instance['error'] ) && $instance['error'] ) 704 704 return; 705 705 706 extract( $args, EXTR_SKIP);706 extract( $args, EXTR_SKIP ); 707 707 708 708 $url = $instance['url']; 709 while ( stristr( $url, 'http') != $url )710 $url = substr( $url, 1);709 while ( stristr( $url, 'http' ) != $url ) 710 $url = substr( $url, 1 ); 711 711 712 if ( empty( $url) )712 if ( empty( $url ) ) 713 713 return; 714 714 715 715 // self-url destruction sequence 716 716 if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) ) 717 717 return; 718 718 719 $rss = fetch_feed( $url);719 $rss = fetch_feed( $url ); 720 720 $title = $instance['title']; 721 721 $desc = ''; 722 722 $link = ''; 723 723 724 if ( ! is_wp_error( $rss) ) {725 $desc = esc_attr( strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));726 if ( empty( $title) )727 $title = esc_html( strip_tags($rss->get_title()));728 $link = esc_url( strip_tags($rss->get_permalink()));729 while ( stristr( $link, 'http') != $link )730 $link = substr( $link, 1);724 if ( ! is_wp_error( $rss ) ) { 725 $desc = esc_attr( strip_tags(@html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ); 726 if ( empty( $title ) ) 727 $title = esc_html( strip_tags( $rss->get_title() ) ); 728 $link = esc_url( strip_tags( $rss->get_permalink() ) ); 729 while ( stristr( $link, 'http' ) != $link ) 730 $link = substr( $link, 1 ); 731 731 } 732 732 733 if ( empty( $title) )734 $title = empty( $desc) ? __('Unknown Feed') : $desc;733 if ( empty( $title ) ) 734 $title = empty( $desc ) ? __( 'Unknown Feed' ) : $desc; 735 735 736 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base);737 $url = esc_url( strip_tags($url));738 $icon = includes_url( 'images/rss.png');736 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base); 737 $url = esc_url( strip_tags( $url ) ); 738 $icon = includes_url( 'images/rss.png' ); 739 739 if ( $title ) 740 740 $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>"; 741 741 … … 745 745 wp_widget_rss_output( $rss, $instance ); 746 746 echo $after_widget; 747 747 748 if ( ! is_wp_error( $rss) )748 if ( ! is_wp_error( $rss ) ) 749 749 $rss->__destruct(); 750 unset( $rss);750 unset( $rss ); 751 751 } 752 752 753 function update( $new_instance, $old_instance) {754 $testurl = ( isset( $new_instance['url']) && ($new_instance['url'] != $old_instance['url']) );753 function update( $new_instance, $old_instance ) { 754 $testurl = ( isset( $new_instance['url'] ) && ( $new_instance['url'] != $old_instance['url'] ) ); 755 755 return wp_widget_rss_process( $new_instance, $testurl ); 756 756 } 757 757 758 function form( $instance) {758 function form( $instance ) { 759 759 760 if ( empty( $instance) )760 if ( empty( $instance ) ) 761 761 $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 ); 762 762 $instance['number'] = $this->number; 763 763 … … 775 775 */ 776 776 function wp_widget_rss_output( $rss, $args = array() ) { 777 777 if ( is_string( $rss ) ) { 778 $rss = fetch_feed( $rss);779 } elseif ( is_array( $rss) && isset($rss['url']) ) {778 $rss = fetch_feed( $rss ); 779 } elseif ( is_array( $rss ) && isset( $rss['url'] ) ) { 780 780 $args = $rss; 781 $rss = fetch_feed( $rss['url']);782 } elseif ( !is_object( $rss) ) {781 $rss = fetch_feed( $rss['url'] ); 782 } elseif ( !is_object( $rss ) ) { 783 783 return; 784 784 } 785 785 786 if ( is_wp_error( $rss) ) {787 if ( is_admin() || current_user_can( 'manage_options') )788 echo '<p>' . sprintf( __( '<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';786 if ( is_wp_error( $rss ) ) { 787 if ( is_admin() || current_user_can( 'manage_options' ) ) 788 echo '<p>' . sprintf( __( '<strong>RSS Error</strong>: %s' ), $rss->get_error_message() ) . '</p>'; 789 789 return; 790 790 } 791 791 … … 803 803 if ( !$rss->get_item_quantity() ) { 804 804 echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>'; 805 805 $rss->__destruct(); 806 unset( $rss);806 unset( $rss ); 807 807 return; 808 808 } 809 809 810 810 echo '<ul>'; 811 811 foreach ( $rss->get_items(0, $items) as $item ) { 812 812 $link = $item->get_link(); 813 while ( stristr( $link, 'http') != $link )814 $link = substr( $link, 1);815 $link = esc_url( strip_tags($link));816 $title = esc_attr( strip_tags($item->get_title()));817 if ( empty( $title) )818 $title = __( 'Untitled');813 while ( stristr( $link, 'http' ) != $link ) 814 $link = substr( $link, 1 ); 815 $link = esc_url( strip_tags( $link ) ); 816 $title = esc_attr( strip_tags( $item->get_title() ) ); 817 if ( empty( $title ) ) 818 $title = __( 'Untitled' ); 819 819 820 $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset') ) ) ) );820 $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ) ); 821 821 $desc = wp_html_excerpt( $desc, 360 ); 822 822 823 823 // Append ellipsis. Change existing [...] to […]. … … 846 846 $author = ''; 847 847 if ( $show_author ) { 848 848 $author = $item->get_author(); 849 if ( is_object( $author) ) {849 if ( is_object( $author ) ) { 850 850 $author = $author->get_name(); 851 851 $author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>'; 852 852 } … … 860 860 } 861 861 echo '</ul>'; 862 862 $rss->__destruct(); 863 unset( $rss);863 unset( $rss ); 864 864 } 865 865 866 866 … … 894 894 $show_author = (int) $show_author; 895 895 $show_date = (int) $show_date; 896 896 897 if ( !empty( $error) )898 echo '<p class="widget-error"><strong>' . sprintf( __( 'RSS Error: %s'), $error) . '</strong></p>';897 if ( !empty( $error ) ) 898 echo '<p class="widget-error"><strong>' . sprintf( __( 'RSS Error: %s' ), $error) . '</strong></p>'; 899 899 900 900 if ( $inputs['url'] ) : 901 901 ?> 902 <p><label for="rss-url-<?php echo $number; ?>"><?php _e( 'Enter the RSS feed URL here:'); ?></label>902 <p><label for="rss-url-<?php echo $number; ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label> 903 903 <input class="widefat" id="rss-url-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][url]" type="text" value="<?php echo $url; ?>" /></p> 904 904 <?php endif; if ( $inputs['title'] ) : ?> 905 <p><label for="rss-title-<?php echo $number; ?>"><?php _e( 'Give the feed a title (optional):'); ?></label>905 <p><label for="rss-title-<?php echo $number; ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label> 906 906 <input class="widefat" id="rss-title-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" /></p> 907 907 <?php endif; if ( $inputs['items'] ) : ?> 908 <p><label for="rss-items-<?php echo $number; ?>"><?php _e( 'How many items would you like to display?'); ?></label>908 <p><label for="rss-items-<?php echo $number; ?>"><?php _e( 'How many items would you like to display?' ); ?></label> 909 909 <select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]"> 910 910 <?php 911 911 for ( $i = 1; $i <= 20; ++$i ) … … 914 914 </select></p> 915 915 <?php endif; if ( $inputs['show_summary'] ) : ?> 916 916 <p><input id="rss-show-summary-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_summary]" type="checkbox" value="1" <?php if ( $show_summary ) echo 'checked="checked"'; ?>/> 917 <label for="rss-show-summary-<?php echo $number; ?>"><?php _e( 'Display item content?'); ?></label></p>917 <label for="rss-show-summary-<?php echo $number; ?>"><?php _e( 'Display item content?' ); ?></label></p> 918 918 <?php endif; if ( $inputs['show_author'] ) : ?> 919 919 <p><input id="rss-show-author-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_author]" type="checkbox" value="1" <?php if ( $show_author ) echo 'checked="checked"'; ?>/> 920 <label for="rss-show-author-<?php echo $number; ?>"><?php _e( 'Display item author if available?'); ?></label></p>920 <label for="rss-show-author-<?php echo $number; ?>"><?php _e( 'Display item author if available?' ); ?></label></p> 921 921 <?php endif; if ( $inputs['show_date'] ) : ?> 922 922 <p><input id="rss-show-date-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_date]" type="checkbox" value="1" <?php if ( $show_date ) echo 'checked="checked"'; ?>/> 923 <label for="rss-show-date-<?php echo $number; ?>"><?php _e( 'Display item date?'); ?></label></p>923 <label for="rss-show-date-<?php echo $number; ?>"><?php _e( 'Display item date?' ); ?></label></p> 924 924 <?php 925 925 endif; 926 foreach ( array_keys( $default_inputs) as $input ) :926 foreach ( array_keys( $default_inputs ) as $input ) : 927 927 if ( 'hidden' === $inputs[$input] ) : 928 928 $id = str_replace( '_', '-', $input ); 929 929 ?> … … 953 953 $items = (int) $widget_rss['items']; 954 954 if ( $items < 1 || 20 < $items ) 955 955 $items = 10; 956 $url = esc_url_raw( strip_tags( $widget_rss['url'] ));957 $title = trim( strip_tags( $widget_rss['title'] ));958 $show_summary = isset( $widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;959 $show_author = isset( $widget_rss['show_author']) ? (int) $widget_rss['show_author'] :0;960 $show_date = isset( $widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;956 $url = esc_url_raw( strip_tags( $widget_rss['url'] ) ); 957 $title = trim( strip_tags( $widget_rss['title'] ) ); 958 $show_summary = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0; 959 $show_author = isset( $widget_rss['show_author'] ) ? (int) $widget_rss['show_author'] :0; 960 $show_date = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0; 961 961 962 962 if ( $check_feed ) { 963 $rss = fetch_feed( $url);963 $rss = fetch_feed( $url ); 964 964 $error = false; 965 965 $link = ''; 966 if ( is_wp_error( $rss) ) {966 if ( is_wp_error( $rss ) ) { 967 967 $error = $rss->get_error_message(); 968 968 } else { 969 $link = esc_url( strip_tags($rss->get_permalink()));970 while ( stristr( $link, 'http') != $link )971 $link = substr( $link, 1);969 $link = esc_url( strip_tags( $rss->get_permalink() ) ); 970 while ( stristr( $link, 'http' ) != $link ) 971 $link = substr( $link, 1 ); 972 972 973 973 $rss->__destruct(); 974 unset( $rss);974 unset( $rss ); 975 975 } 976 976 } 977 977 … … 986 986 class WP_Widget_Tag_Cloud extends WP_Widget { 987 987 988 988 function __construct() { 989 $widget_ops = array( 'description' => __( "Your most used tags in cloud format") );990 parent::__construct( 'tag_cloud', __('Tag Cloud'), $widget_ops);989 $widget_ops = array( 'description' => __( 'Your most used tags in cloud format' ) ); 990 parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops); 991 991 } 992 992 993 993 function widget( $args, $instance ) { 994 extract( $args);995 $current_taxonomy = $this->_get_current_taxonomy( $instance);996 if ( !empty( $instance['title']) ) {994 extract( $args ); 995 $current_taxonomy = $this->_get_current_taxonomy( $instance ); 996 if ( !empty( $instance['title'] ) ) { 997 997 $title = $instance['title']; 998 998 } else { 999 999 if ( 'post_tag' == $current_taxonomy ) { 1000 $title = __( 'Tags');1000 $title = __( 'Tags' ); 1001 1001 } else { 1002 $tax = get_taxonomy( $current_taxonomy);1002 $tax = get_taxonomy( $current_taxonomy ); 1003 1003 $title = $tax->labels->name; 1004 1004 } 1005 1005 } 1006 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base);1006 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base); 1007 1007 1008 1008 echo $before_widget; 1009 1009 if ( $title ) 1010 1010 echo $before_title . $title . $after_title; 1011 1011 echo '<div class="tagcloud">'; 1012 wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) );1012 wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array( 'taxonomy' => $current_taxonomy) ) ); 1013 1013 echo "</div>\n"; 1014 1014 echo $after_widget; 1015 1015 } 1016 1016 1017 1017 function update( $new_instance, $old_instance ) { 1018 $instance['title'] = strip_tags( stripslashes($new_instance['title']));1019 $instance['taxonomy'] = stripslashes( $new_instance['taxonomy']);1018 $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) ); 1019 $instance['taxonomy'] = stripslashes( $new_instance['taxonomy'] ); 1020 1020 return $instance; 1021 1021 } 1022 1022 1023 1023 function form( $instance ) { 1024 $current_taxonomy = $this->_get_current_taxonomy( $instance);1024 $current_taxonomy = $this->_get_current_taxonomy( $instance ); 1025 1025 ?> 1026 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:') ?></label>1027 <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>1028 <p><label for="<?php echo $this->get_field_id( 'taxonomy'); ?>"><?php _e('Taxonomy:') ?></label>1029 <select class="widefat" id="<?php echo $this->get_field_id( 'taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>">1030 <?php foreach ( get_object_taxonomies( 'post') as $taxonomy ) :1031 $tax = get_taxonomy( $taxonomy);1032 if ( !$tax->show_tagcloud || empty( $tax->labels->name) )1026 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ) ?></label> 1027 <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> 1028 <p><label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy:' ) ?></label> 1029 <select class="widefat" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>"> 1030 <?php foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) : 1031 $tax = get_taxonomy( $taxonomy ); 1032 if ( !$tax->show_tagcloud || empty( $tax->labels->name ) ) 1033 1033 continue; 1034 1034 ?> 1035 <option value="<?php echo esc_attr( $taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>1035 <option value="<?php echo esc_attr( $taxonomy ) ?>" <?php selected( $taxonomy, $current_taxonomy ) ?>><?php echo $tax->labels->name; ?></option> 1036 1036 <?php endforeach; ?> 1037 1037 </select></p><?php 1038 1038 } 1039 1039 1040 function _get_current_taxonomy( $instance) {1041 if ( !empty( $instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )1040 function _get_current_taxonomy( $instance ) { 1041 if ( !empty( $instance['taxonomy'] ) && taxonomy_exists( $instance['taxonomy'] ) ) 1042 1042 return $instance['taxonomy']; 1043 1043 1044 1044 return 'post_tag'; … … 1053 1053 class WP_Nav_Menu_Widget extends WP_Widget { 1054 1054 1055 1055 function __construct() { 1056 $widget_ops = array( 'description' => __( 'Use this widget to add one of your custom menus as a widget.') );1057 parent::__construct( 'nav_menu', __( 'Custom Menu'), $widget_ops );1056 $widget_ops = array( 'description' => __( 'Use this widget to add one of your custom menus as a widget.' ) ); 1057 parent::__construct( 'nav_menu', __( 'Custom Menu' ), $widget_ops ); 1058 1058 } 1059 1059 1060 function widget( $args, $instance) {1060 function widget( $args, $instance ) { 1061 1061 // Get menu 1062 1062 $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] ); 1063 1063 1064 1064 if ( !$nav_menu ) 1065 1065 return; 1066 1066 1067 $instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);1067 $instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base); 1068 1068 1069 1069 echo $args['before_widget']; 1070 1070 1071 if ( !empty( $instance['title']) )1071 if ( !empty( $instance['title'] ) ) 1072 1072 echo $args['before_title'] . $instance['title'] . $args['after_title']; 1073 1073 1074 1074 wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) ); … … 1077 1077 } 1078 1078 1079 1079 function update( $new_instance, $old_instance ) { 1080 $instance['title'] = strip_tags( stripslashes( $new_instance['title']) );1080 $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) ); 1081 1081 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 1082 1082 return $instance; 1083 1083 } … … 1091 1091 1092 1092 // If no menus exists, direct the user to go and create some. 1093 1093 if ( !$menus ) { 1094 echo '<p>'. sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';1094 echo '<p>'. sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), admin_url( 'nav-menus.php' ) ) .'</p>'; 1095 1095 return; 1096 1096 } 1097 1097 ?> 1098 1098 <p> 1099 <label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:') ?></label>1100 <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; ?>" />1099 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ) ?></label> 1100 <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; ?>" /> 1101 1101 </p> 1102 1102 <p> 1103 <label for="<?php echo $this->get_field_id( 'nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>1104 <select id="<?php echo $this->get_field_id( 'nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">1103 <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?></label> 1104 <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>"> 1105 1105 <?php 1106 1106 foreach ( $menus as $menu ) { 1107 1107 $selected = $nav_menu == $menu->term_id ? ' selected="selected"' : ''; … … 1126 1126 if ( !is_blog_installed() ) 1127 1127 return; 1128 1128 1129 register_widget( 'WP_Widget_Pages');1129 register_widget( 'WP_Widget_Pages' ); 1130 1130 1131 register_widget( 'WP_Widget_Calendar');1131 register_widget( 'WP_Widget_Calendar' ); 1132 1132 1133 register_widget( 'WP_Widget_Archives');1133 register_widget( 'WP_Widget_Archives' ); 1134 1134 1135 register_widget( 'WP_Widget_Links');1135 register_widget( 'WP_Widget_Links' ); 1136 1136 1137 register_widget( 'WP_Widget_Meta');1137 register_widget( 'WP_Widget_Meta' ); 1138 1138 1139 register_widget( 'WP_Widget_Search');1139 register_widget( 'WP_Widget_Search' ); 1140 1140 1141 register_widget( 'WP_Widget_Text');1141 register_widget( 'WP_Widget_Text' ); 1142 1142 1143 register_widget( 'WP_Widget_Categories');1143 register_widget( 'WP_Widget_Categories' ); 1144 1144 1145 register_widget( 'WP_Widget_Recent_Posts');1145 register_widget( 'WP_Widget_Recent_Posts' ); 1146 1146 1147 register_widget( 'WP_Widget_Recent_Comments');1147 register_widget( 'WP_Widget_Recent_Comments' ); 1148 1148 1149 register_widget( 'WP_Widget_RSS');1149 register_widget( 'WP_Widget_RSS' ); 1150 1150 1151 register_widget( 'WP_Widget_Tag_Cloud');1151 register_widget( 'WP_Widget_Tag_Cloud' ); 1152 1152 1153 register_widget( 'WP_Nav_Menu_Widget');1153 register_widget( 'WP_Nav_Menu_Widget' ); 1154 1154 1155 do_action( 'widgets_init');1155 do_action( 'widgets_init' ); 1156 1156 } 1157 1157 1158 add_action( 'init', 'wp_widgets_init', 1);1158 add_action( 'init', 'wp_widgets_init', 1);
