Make WordPress Core

Changeset 32589


Ignore:
Timestamp:
05/24/2015 09:27:12 PM (11 years ago)
Author:
wonderboymusic
Message:

Add missing doc blocks to default-widgets.php.
Move add_action() for widgets to default-filters.php with its brethren.

See #32444.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r32161 r32589  
    383383add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
    384384
     385// Widgets
     386add_action( 'init', 'wp_widgets_init', 1 );
     387
    385388// Admin Bar
    386389// Don't remove. Wrong way to disable.
  • trunk/src/wp-includes/default-widgets.php

    r31886 r32589  
    1919        }
    2020
     21        /**
     22         * @param array $args
     23         * @param array $instance
     24         */
    2125        public function widget( $args, $instance ) {
    2226
    … …  
    6872        }
    6973
     74        /**
     75         * @param array $new_instance
     76         * @param array $old_instance
     77         * @return array
     78         */
    7079        public function update( $new_instance, $old_instance ) {
    7180                $instance = $old_instance;
    … …  
    8291        }
    8392
     93        /**
     94         * @param array $instance
     95         */
    8496        public function form( $instance ) {
    8597                //Defaults
    … …  
    119131        }
    120132
     133        /**
     134         * @param array $args
     135         * @param array $instance
     136         */
    121137        public function widget( $args, $instance ) {
    122 
    123138                $show_description = isset($instance['description']) ? $instance['description'] : false;
    124139                $show_name = isset($instance['name']) ? $instance['name'] : false;
    … …  
    152167        }
    153168
     169        /**
     170         * @param array $new_instance
     171         * @param array $old_instance
     172         * @return array
     173         */
    154174        public function update( $new_instance, $old_instance ) {
    155175                $new_instance = (array) $new_instance;
    … …  
    170190        }
    171191
     192        /**
     193         * @param array $instance
     194         */
    172195        public function form( $instance ) {
    173196
    … …  
    228251        }
    229252
     253        /**
     254         * @param array $args
     255         * @param array $instance
     256         */
    230257        public function widget( $args, $instance ) {
    231 
    232258                /** This filter is documented in wp-includes/default-widgets.php */
    233259                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    … …  
    244270        }
    245271
     272        /**
     273         * @param array $instance
     274         */
    246275        public function form( $instance ) {
    247276                $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    … …  
    252281        }
    253282
     283        /**
     284         * @param array $new_instance
     285         * @param array $old_instance
     286         * @return array
     287         */
    254288        public function update( $new_instance, $old_instance ) {
    255289                $instance = $old_instance;
    … …  
    273307        }
    274308
     309        /**
     310         * @param array $args
     311         * @param array $instance
     312         */
    275313        public function widget( $args, $instance ) {
    276314                $c = ! empty( $instance['count'] ) ? '1' : '0';
    … …  
    355393        }
    356394
     395        /**
     396         * @param array $new_instance
     397         * @param array $old_instance
     398         * @return array
     399         */
    357400        public function update( $new_instance, $old_instance ) {
    358401                $instance = $old_instance;
    … …  
    365408        }
    366409
     410        /**
     411         * @param array $instance
     412         */
    367413        public function form( $instance ) {
    368414                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
    … …  
    395441        }
    396442
     443        /**
     444         * @param array $args
     445         * @param array $instance
     446         */
    397447        public function widget( $args, $instance ) {
    398 
    399448                /** This filter is documented in wp-includes/default-widgets.php */
    400449                $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );
    … …  
    431480        }
    432481
     482        /**
     483         * @param array $new_instance
     484         * @param array $old_instance
     485         * @return array
     486         */
    433487        public function update( $new_instance, $old_instance ) {
    434488                $instance = $old_instance;
    … …  
    438492        }
    439493
     494        /**
     495         * @param array $instance
     496         */
    440497        public function form( $instance ) {
    441498                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    … …  
    459516        }
    460517
     518        /**
     519         * @param array $args
     520         * @param array $instance
     521         */
    461522        public function widget( $args, $instance ) {
    462 
    463523                /** This filter is documented in wp-includes/default-widgets.php */
    464524                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    … …  
    474534        }
    475535
     536        /**
     537         * @param array $new_instance
     538         * @param array $old_instance
     539         * @return array
     540         */
    476541        public function update( $new_instance, $old_instance ) {
    477542                $instance = $old_instance;
    … …  
    481546        }
    482547
     548        /**
     549         * @param array $instance
     550         */
    483551        public function form( $instance ) {
    484552                $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    … …  
    504572        }
    505573
     574        /**
     575         * @param array $args
     576         * @param array $instance
     577         */
    506578        public function widget( $args, $instance ) {
    507 
    508579                /** This filter is documented in wp-includes/default-widgets.php */
    509580                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
    … …  
    527598        }
    528599
     600        /**
     601         * @param array $new_instance
     602         * @param array $old_instance
     603         * @return array
     604         */
    529605        public function update( $new_instance, $old_instance ) {
    530606                $instance = $old_instance;
    … …  
    538614        }
    539615
     616        /**
     617         * @param array $instance
     618         */
    540619        public function form( $instance ) {
    541620                $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    … …  
    565644        }
    566645
     646        /**
     647         * @param array $args
     648         * @param array $instance
     649         */
    567650        public function widget( $args, $instance ) {
    568 
    569651                /** This filter is documented in wp-includes/default-widgets.php */
    570652                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );
    … …  
    645727        }
    646728
     729        /**
     730         * @param array $new_instance
     731         * @param array $old_instance
     732         * @return array
     733         */
    647734        public function update( $new_instance, $old_instance ) {
    648735                $instance = $old_instance;
    … …  
    655742        }
    656743
     744        /**
     745         * @param array $instance
     746         */
    657747        public function form( $instance ) {
    658748                //Defaults
    … …  
    696786        }
    697787
    698         public function widget($args, $instance) {
     788        /**
     789         * @param array $args
     790         * @param array $instance
     791         */
     792        public function widget( $args, $instance ) {
    699793                $cache = array();
    700794                if ( ! $this->is_preview() ) {
    … …  
    774868        }
    775869
     870        /**
     871         * @param array $new_instance
     872         * @param array $old_instance
     873         * @return array
     874         */
    776875        public function update( $new_instance, $old_instance ) {
    777876                $instance = $old_instance;
    … …  
    792891        }
    793892
     893        /**
     894         * @param array $instance
     895         */
    794896        public function form( $instance ) {
    795897                $title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    … …  
    830932
    831933        public function recent_comments_style() {
    832 
    833934                /**
    834935                 * Filter the Recent Comments default widget styles.
    … …  
    851952        }
    852953
     954        /**
     955         * @global array  $comments
     956         * @global object $comment
     957         *
     958         * @param array $args
     959         * @param array $instance
     960         */
    853961        public function widget( $args, $instance ) {
    854962                global $comments, $comment;
    … …  
    9281036        }
    9291037
     1038        /**
     1039         * @param array $new_instance
     1040         * @param array $old_instance
     1041         * @return array
     1042         */
    9301043        public function update( $new_instance, $old_instance ) {
    9311044                $instance = $old_instance;
    … …  
    9411054        }
    9421055
     1056        /**
     1057         * @param array $instance
     1058         */
    9431059        public function form( $instance ) {
    9441060                $title  = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    … …  
    9671083        }
    9681084
    969         public function widget($args, $instance) {
    970 
     1085        /**
     1086         * @param array $args
     1087         * @param array $instance
     1088         */
     1089        public function widget( $args, $instance ) {
    9711090                if ( isset($instance['error']) && $instance['error'] )
    9721091                        return;
    … …  
    10201139        }
    10211140
    1022         public function update($new_instance, $old_instance) {
     1141        /**
     1142         * @param array $new_instance
     1143         * @param array $old_instance
     1144         * @return array
     1145         */
     1146        public function update( $new_instance, $old_instance ) {
    10231147                $testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
    10241148                return wp_widget_rss_process( $new_instance, $testurl );
    10251149        }
    10261150
    1027         public function form($instance) {
    1028 
    1029                 if ( empty($instance) )
     1151        /**
     1152         * @param array $instance
     1153         */
     1154        public function form( $instance ) {
     1155                if ( empty( $instance ) ) {
    10301156                        $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 );
     1157                }
    10311158                $instance['number'] = $this->number;
    10321159
    … …  
    12621389        }
    12631390
     1391        /**
     1392         * @param array $args
     1393         * @param array $instance
     1394         */
    12641395        public function widget( $args, $instance ) {
    12651396                $current_taxonomy = $this->_get_current_taxonomy($instance);
    … …  
    13021433        }
    13031434
     1435        /**
     1436         * @param array $new_instance
     1437         * @param array $old_instance
     1438         * @return array
     1439         */
    13041440        public function update( $new_instance, $old_instance ) {
    13051441                $instance = array();
    … …  
    13091445        }
    13101446
     1447        /**
     1448         * @param array $instance
     1449         */
    13111450        public function form( $instance ) {
    13121451                $current_taxonomy = $this->_get_current_taxonomy($instance);
    … …  
    13461485        }
    13471486
    1348         public function widget($args, $instance) {
     1487        /**
     1488         * @param array $args
     1489         * @param array $instance
     1490         */
     1491        public function widget( $args, $instance ) {
    13491492                // Get menu
    13501493                $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
    … …  
    13851528        }
    13861529
     1530        /**
     1531         * @param array $new_instance
     1532         * @param array $old_instance
     1533         * @return array
     1534         */
    13871535        public function update( $new_instance, $old_instance ) {
    13881536                $instance = array();
    … …  
    13961544        }
    13971545
     1546        /**
     1547         * @param array $instance
     1548         */
    13981549        public function form( $instance ) {
    13991550                $title = isset( $instance['title'] ) ? $instance['title'] : '';
    … …  
    14761627        do_action( 'widgets_init' );
    14771628}
    1478 
    1479 add_action('init', 'wp_widgets_init', 1);
Note: See TracChangeset for help on using the changeset viewer.