Changeset 27697
- Timestamp:
- 03/25/2014 08:52:22 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/default-widgets.php
r27691 r27697 22 22 extract( $args ); 23 23 24 $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base); 24 /** 25 * Filter the widget title. 26 * 27 * @since 2.6.0 28 * 29 * @param string $title The widget title. Default 'Pages'. 30 * @param array $instance An array of the widget's settings. 31 * @param mixed $id_base The widget ID. 32 */ 33 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base ); 34 25 35 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; 26 36 $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; … … 29 39 $sortby = 'menu_order, post_title'; 30 40 31 $out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) ); 41 /** 42 * Filter the arguments for the Pages widget. 43 * 44 * @since 2.8.0 45 * 46 * @see wp_list_pages() 47 * 48 * @param array $args An array of arguments to retrieve the pages list. 49 */ 50 $out = wp_list_pages( apply_filters( 'widget_pages_args', array( 51 'title_li' => '', 52 'echo' => 0, 53 'sort_column' => $sortby, 54 'exclude' => $exclude 55 ) ) ); 32 56 33 57 if ( !empty( $out ) ) { … … 108 132 109 133 $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); 110 wp_list_bookmarks(apply_filters('widget_links_args', array( 134 135 /** 136 * Filter the arguments for the Links widget. 137 * 138 * @since 2.6.0 139 * 140 * @see wp_list_bookmarks() 141 * 142 * @param array $args An array of arguments to retrieve the links list. 143 */ 144 wp_list_bookmarks( apply_filters( 'widget_links_args', array( 111 145 'title_before' => $before_title, 'title_after' => $after_title, 112 146 'category_before' => $before_widget, 'category_after' => $after_widget, … … 116 150 'orderby' => $orderby, 'order' => $order, 117 151 'limit' => $limit, 118 ) ));152 ) ) ); 119 153 } 120 154 … … 197 231 function widget( $args, $instance ) { 198 232 extract($args); 233 234 /** This filter is documented in wp-includes/default-widgets.php */ 199 235 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 200 236 … … 242 278 $c = ! empty( $instance['count'] ) ? '1' : '0'; 243 279 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 244 $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); 280 281 /** 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 ); 245 283 246 284 echo $before_widget; … … 250 288 if ( $d ) { 251 289 ?> 252 <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> 290 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 291 <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option> 292 293 <?php 294 /** 295 * Filter the arguments for the Archives widget drop-down. 296 * 297 * @since 2.8.0 298 * 299 * @see wp_get_archives() 300 * 301 * @param array $args An array of Archives widget drop-down arguments. 302 */ 303 wp_get_archives( apply_filters( 'widget_archives_dropdown_args', array( 304 'type' => 'monthly', 305 'format' => 'option', 306 'show_post_count' => $c 307 ) ) ); 308 ?> 309 </select> 253 310 <?php 254 311 } else { 255 312 ?> 256 313 <ul> 257 <?php wp_get_archives(apply_filters('widget_archives_args', array('type' => 'monthly', 'show_post_count' => $c))); ?> 314 <?php 315 /** 316 * Filter the arguments for the Archives widget. 317 * 318 * @since 2.8.0 319 * 320 * @see wp_get_archives() 321 * 322 * @param array $args An array of Archives option arguments. 323 */ 324 wp_get_archives( apply_filters( 'widget_archives_args', array( 325 'type' => 'monthly', 326 'show_post_count' => $c 327 ) ) ); 328 ?> 258 329 </ul> 259 330 <?php … … 305 376 function widget( $args, $instance ) { 306 377 extract($args); 307 $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base); 378 379 /** This filter is documented in wp-includes/default-widgets.php */ 380 $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); 308 381 309 382 echo $before_widget; … … 316 389 <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> 317 390 <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> 318 <?php echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>', 391 <?php 392 /** 393 * Filter the "Powered by WordPress" text in the Meta widget. 394 * 395 * @since 3.6.0 396 * 397 * @param string $title_text Default title text for the WordPress.org link. 398 */ 399 echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>', 319 400 esc_url( __( 'https://wordpress.org/' ) ), 320 401 esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), 321 402 _x( 'WordPress.org', 'meta widget link text' ) 322 ) ); ?> 323 <?php wp_meta(); ?> 403 ) ); 404 405 wp_meta(); 406 ?> 324 407 </ul> 325 408 <?php … … 357 440 function widget( $args, $instance ) { 358 441 extract($args); 359 $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); 442 443 /** This filter is documented in wp-includes/default-widgets.php */ 444 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 445 360 446 echo $before_widget; 361 447 if ( $title ) … … 399 485 function widget( $args, $instance ) { 400 486 extract($args); 487 488 /** This filter is documented in wp-includes/default-widgets.php */ 401 489 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 490 491 /** 492 * Filter the content of the Text widget. 493 * 494 * @since 2.3.0 495 * 496 * @param string $widget_text The widget content. 497 * @param WP_Widget $instance WP_Widget instance. 498 */ 402 499 $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); 403 500 echo $before_widget; … … 449 546 extract( $args ); 450 547 451 $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); 548 /** This filter is documented in wp-includes/default-widgets.php */ 549 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); 550 452 551 $c = ! empty( $instance['count'] ) ? '1' : '0'; 453 552 $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; … … 462 561 if ( $d ) { 463 562 $cat_args['show_option_none'] = __('Select Category'); 464 wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); 563 564 /** 565 * Filter the arguments for the Categories widget drop-down. 566 * 567 * @since 2.8.0 568 * 569 * @see wp_dropdown_categories() 570 * 571 * @param array $cat_args An array of Categories widget drop-down arguments. 572 */ 573 wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) ); 465 574 ?> 466 575 … … 483 592 <?php 484 593 $cat_args['title_li'] = ''; 485 wp_list_categories(apply_filters('widget_categories_args', $cat_args)); 594 595 /** 596 * Filter the arguments for the Categories widget. 597 * 598 * @since 2.8.0 599 * 600 * @param array $cat_args An array of Categories widget options. 601 */ 602 wp_list_categories( apply_filters( 'widget_categories_args', $cat_args ) ); 486 603 ?> 487 604 </ul> … … 561 678 562 679 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); 680 681 /** This filter is documented in wp-includes/default-widgets.php */ 563 682 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 683 564 684 $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; 565 685 if ( ! $number ) … … 567 687 $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; 568 688 569 $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) ); 689 /** 690 * Filter the arguments for the Recent Posts widget. 691 * 692 * @since 3.4.0 693 * 694 * @see WP_Query::get_posts() 695 * 696 * @param array $args An array of arguments used to retrieve the recent posts. 697 */ 698 $r = new WP_Query( apply_filters( 'widget_posts_args', array( 699 'posts_per_page' => $number, 700 'no_found_rows' => true, 701 'post_status' => 'publish', 702 'ignore_sticky_posts' => true 703 ) ) ); 704 570 705 if ($r->have_posts()) : 571 706 ?> … … 649 784 650 785 function recent_comments_style() { 786 787 /** 788 * Filter the Recent Comments default widget styles. 789 * 790 * @since 3.1.0 791 * 792 * @param bool $active Whether the widget is active. Default true. 793 * @param string $id_base The widget ID. 794 */ 651 795 if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876 652 796 || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) … … 681 825 682 826 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); 827 828 /** This filter is documented in wp-includes/default-widgets.php */ 683 829 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 830 684 831 $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; 685 832 if ( ! $number ) 686 833 $number = 5; 687 834 688 $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); 835 /** 836 * Filter the arguments for the Recent Comments widget. 837 * 838 * @since 3.4.0 839 * 840 * @see get_comments() 841 * 842 * @param array $comment_args An array of arguments used to retrieve the recent comments. 843 */ 844 $comments = get_comments( apply_filters( 'widget_comments_args', array( 845 'number' => $number, 846 'status' => 'approve', 847 'post_status' => 'publish' 848 ) ) ); 849 689 850 $output .= $before_widget; 690 851 if ( $title ) … … 783 944 $title = empty($desc) ? __('Unknown Feed') : $desc; 784 945 785 $title = apply_filters('widget_title', $title, $instance, $this->id_base); 946 /** This filter is documented in wp-includes/default-widgets.php */ 947 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 948 786 949 $url = esc_url(strip_tags($url)); 787 950 $icon = includes_url('images/rss.png'); … … 1055 1218 } 1056 1219 } 1057 $title = apply_filters('widget_title', $title, $instance, $this->id_base); 1220 1221 /** This filter is documented in wp-includes/default-widgets.php */ 1222 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 1058 1223 1059 1224 echo $before_widget; … … 1061 1226 echo $before_title . $title . $after_title; 1062 1227 echo '<div class="tagcloud">'; 1063 wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) ); 1228 1229 /** 1230 * Filter the taxonomy used in the Tag Cloud widget. 1231 * 1232 * @since 2.8.0 1233 * @since 3.0.0 Added taxonomy drop-down. 1234 * 1235 * @see wp_tag_cloud() 1236 * 1237 * @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'. 1238 */ 1239 wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array( 1240 'taxonomy' => $current_taxonomy 1241 ) ) ); 1242 1064 1243 echo "</div>\n"; 1065 1244 echo $after_widget; … … 1116 1295 return; 1117 1296 1297 /** This filter is documented in wp-includes/default-widgets.php */ 1118 1298 $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 1119 1299 … … 1206 1386 register_widget('WP_Nav_Menu_Widget'); 1207 1387 1208 do_action('widgets_init'); 1388 /** 1389 * Fires after all default WordPress widgets have been registered. 1390 * 1391 * @since 2.2.0 1392 */ 1393 do_action( 'widgets_init' ); 1209 1394 } 1210 1395
Note: See TracChangeset
for help on using the changeset viewer.