WordPress.org

Make WordPress Core

Changeset 28532


Ignore:
Timestamp:
05/19/2014 05:29:42 PM (4 years ago)
Author:
wonderboymusic
Message:

WP_Date_Query was only missing one access modifier.

Add access modifier (public) to all default widgets' class methods.

See #27881, #22234.

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

Legend:

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

    r28252 r28532  
    106106     *                              'comment_date', 'comment_date_gmt'.
    107107     */
    108     function __construct( $date_query, $default_column = 'post_date' ) {
     108    public function __construct( $date_query, $default_column = 'post_date' ) {
    109109        if ( empty( $date_query ) || ! is_array( $date_query ) )
    110110            return;
  • trunk/src/wp-includes/default-widgets.php

    r28449 r28532  
    1414class WP_Widget_Pages extends WP_Widget {
    1515
    16     function __construct() {
     16    public function __construct() {
    1717        $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A list of your site’s Pages.') );
    1818        parent::__construct('pages', __('Pages'), $widget_ops);
    1919    }
    2020
    21     function widget( $args, $instance ) {
     21    public function widget( $args, $instance ) {
    2222
    2323        /**
     
    6868    }
    6969
    70     function update( $new_instance, $old_instance ) {
     70    public function update( $new_instance, $old_instance ) {
    7171        $instance = $old_instance;
    7272        $instance['title'] = strip_tags($new_instance['title']);
     
    8282    }
    8383
    84     function form( $instance ) {
     84    public function form( $instance ) {
    8585        //Defaults
    8686        $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
     
    114114class WP_Widget_Links extends WP_Widget {
    115115
    116     function __construct() {
     116    public function __construct() {
    117117        $widget_ops = array('description' => __( "Your blogroll" ) );
    118118        parent::__construct('links', __('Links'), $widget_ops);
    119119    }
    120120
    121     function widget( $args, $instance ) {
     121    public function widget( $args, $instance ) {
    122122
    123123        $show_description = isset($instance['description']) ? $instance['description'] : false;
     
    152152    }
    153153
    154     function update( $new_instance, $old_instance ) {
     154    public function update( $new_instance, $old_instance ) {
    155155        $new_instance = (array) $new_instance;
    156156        $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 );
     
    170170    }
    171171
    172     function form( $instance ) {
     172    public function form( $instance ) {
    173173
    174174        //Defaults
     
    223223class WP_Widget_Search extends WP_Widget {
    224224
    225     function __construct() {
     225    public function __construct() {
    226226        $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") );
    227227        parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
    228228    }
    229229
    230     function widget( $args, $instance ) {
     230    public function widget( $args, $instance ) {
    231231
    232232        /** This filter is documented in wp-includes/default-widgets.php */
     
    244244    }
    245245
    246     function form( $instance ) {
     246    public function form( $instance ) {
    247247        $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    248248        $title = $instance['title'];
     
    252252    }
    253253
    254     function update( $new_instance, $old_instance ) {
     254    public function update( $new_instance, $old_instance ) {
    255255        $instance = $old_instance;
    256256        $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
     
    268268class WP_Widget_Archives extends WP_Widget {
    269269
    270     function __construct() {
     270    public function __construct() {
    271271        $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s Posts.') );
    272272        parent::__construct('archives', __('Archives'), $widget_ops);
    273273    }
    274274
    275     function widget( $args, $instance ) {
     275    public function widget( $args, $instance ) {
    276276        $c = ! empty( $instance['count'] ) ? '1' : '0';
    277277        $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
     
    333333    }
    334334
    335     function update( $new_instance, $old_instance ) {
     335    public function update( $new_instance, $old_instance ) {
    336336        $instance = $old_instance;
    337337        $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
     
    343343    }
    344344
    345     function form( $instance ) {
     345    public function form( $instance ) {
    346346        $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
    347347        $title = strip_tags($instance['title']);
     
    368368class WP_Widget_Meta extends WP_Widget {
    369369
    370     function __construct() {
     370    public function __construct() {
    371371        $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") );
    372372        parent::__construct('meta', __('Meta'), $widget_ops);
    373373    }
    374374
    375     function widget( $args, $instance ) {
     375    public function widget( $args, $instance ) {
    376376
    377377        /** This filter is documented in wp-includes/default-widgets.php */
     
    409409    }
    410410
    411     function update( $new_instance, $old_instance ) {
     411    public function update( $new_instance, $old_instance ) {
    412412        $instance = $old_instance;
    413413        $instance['title'] = strip_tags($new_instance['title']);
     
    416416    }
    417417
    418     function form( $instance ) {
     418    public function form( $instance ) {
    419419        $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    420420        $title = strip_tags($instance['title']);
     
    432432class WP_Widget_Calendar extends WP_Widget {
    433433
    434     function __construct() {
     434    public function __construct() {
    435435        $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s Posts.') );
    436436        parent::__construct('calendar', __('Calendar'), $widget_ops);
    437437    }
    438438
    439     function widget( $args, $instance ) {
     439    public function widget( $args, $instance ) {
    440440
    441441        /** This filter is documented in wp-includes/default-widgets.php */
     
    452452    }
    453453
    454     function update( $new_instance, $old_instance ) {
     454    public function update( $new_instance, $old_instance ) {
    455455        $instance = $old_instance;
    456456        $instance['title'] = strip_tags($new_instance['title']);
     
    459459    }
    460460
    461     function form( $instance ) {
     461    public function form( $instance ) {
    462462        $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    463463        $title = strip_tags($instance['title']);
     
    476476class WP_Widget_Text extends WP_Widget {
    477477
    478     function __construct() {
     478    public function __construct() {
    479479        $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.'));
    480480        $control_ops = array('width' => 400, 'height' => 350);
     
    482482    }
    483483
    484     function widget( $args, $instance ) {
     484    public function widget( $args, $instance ) {
    485485
    486486        /** This filter is documented in wp-includes/default-widgets.php */
     
    505505    }
    506506
    507     function update( $new_instance, $old_instance ) {
     507    public function update( $new_instance, $old_instance ) {
    508508        $instance = $old_instance;
    509509        $instance['title'] = strip_tags($new_instance['title']);
     
    516516    }
    517517
    518     function form( $instance ) {
     518    public function form( $instance ) {
    519519        $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    520520        $title = strip_tags($instance['title']);
     
    538538class WP_Widget_Categories extends WP_Widget {
    539539
    540     function __construct() {
     540    public function __construct() {
    541541        $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
    542542        parent::__construct('categories', __('Categories'), $widget_ops);
    543543    }
    544544
    545     function widget( $args, $instance ) {
     545    public function widget( $args, $instance ) {
    546546
    547547        /** This filter is documented in wp-includes/default-widgets.php */
     
    609609    }
    610610
    611     function update( $new_instance, $old_instance ) {
     611    public function update( $new_instance, $old_instance ) {
    612612        $instance = $old_instance;
    613613        $instance['title'] = strip_tags($new_instance['title']);
     
    619619    }
    620620
    621     function form( $instance ) {
     621    public function form( $instance ) {
    622622        //Defaults
    623623        $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
     
    650650class WP_Widget_Recent_Posts extends WP_Widget {
    651651
    652     function __construct() {
     652    public function __construct() {
    653653        $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site’s most recent Posts.") );
    654654        parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
     
    660660    }
    661661
    662     function widget($args, $instance) {
     662    public function widget($args, $instance) {
    663663        $cache = array();
    664664        if ( ! $this->is_preview() ) {
     
    738738    }
    739739
    740     function update( $new_instance, $old_instance ) {
     740    public function update( $new_instance, $old_instance ) {
    741741        $instance = $old_instance;
    742742        $instance['title'] = strip_tags($new_instance['title']);
     
    752752    }
    753753
    754     function flush_widget_cache() {
     754    public function flush_widget_cache() {
    755755        wp_cache_delete('widget_recent_posts', 'widget');
    756756    }
    757757
    758     function form( $instance ) {
     758    public function form( $instance ) {
    759759        $title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    760760        $number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
     
    780780class WP_Widget_Recent_Comments extends WP_Widget {
    781781
    782     function __construct() {
     782    public function __construct() {
    783783        $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site’s most recent comments.' ) );
    784784        parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
     
    793793    }
    794794
    795     function recent_comments_style() {
     795    public function recent_comments_style() {
    796796
    797797        /**
     
    811811    }
    812812
    813     function flush_widget_cache() {
     813    public function flush_widget_cache() {
    814814        wp_cache_delete('widget_recent_comments', 'widget');
    815815    }
    816816
    817     function widget( $args, $instance ) {
     817    public function widget( $args, $instance ) {
    818818        global $comments, $comment;
    819819
     
    886886    }
    887887
    888     function update( $new_instance, $old_instance ) {
     888    public function update( $new_instance, $old_instance ) {
    889889        $instance = $old_instance;
    890890        $instance['title'] = strip_tags($new_instance['title']);
     
    899899    }
    900900
    901     function form( $instance ) {
     901    public function form( $instance ) {
    902902        $title  = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    903903        $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
     
    919919class WP_Widget_RSS extends WP_Widget {
    920920
    921     function __construct() {
     921    public function __construct() {
    922922        $widget_ops = array( 'description' => __('Entries from any RSS or Atom feed.') );
    923923        $control_ops = array( 'width' => 400, 'height' => 200 );
     
    925925    }
    926926
    927     function widget($args, $instance) {
     927    public function widget($args, $instance) {
    928928
    929929        if ( isset($instance['error']) && $instance['error'] )
     
    978978    }
    979979
    980     function update($new_instance, $old_instance) {
     980    public function update($new_instance, $old_instance) {
    981981        $testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
    982982        return wp_widget_rss_process( $new_instance, $testurl );
    983983    }
    984984
    985     function form($instance) {
     985    public function form($instance) {
    986986
    987987        if ( empty($instance) )
     
    12131213class WP_Widget_Tag_Cloud extends WP_Widget {
    12141214
    1215     function __construct() {
     1215    public function __construct() {
    12161216        $widget_ops = array( 'description' => __( "A cloud of your most used tags.") );
    12171217        parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
    12181218    }
    12191219
    1220     function widget( $args, $instance ) {
     1220    public function widget( $args, $instance ) {
    12211221        $current_taxonomy = $this->_get_current_taxonomy($instance);
    12221222        if ( !empty($instance['title']) ) {
     
    12581258    }
    12591259
    1260     function update( $new_instance, $old_instance ) {
     1260    public function update( $new_instance, $old_instance ) {
    12611261        $instance['title'] = strip_tags(stripslashes($new_instance['title']));
    12621262        $instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
     
    12641264    }
    12651265
    1266     function form( $instance ) {
     1266    public function form( $instance ) {
    12671267        $current_taxonomy = $this->_get_current_taxonomy($instance);
    12681268?>
     
    12811281    }
    12821282
    1283     function _get_current_taxonomy($instance) {
     1283    public function _get_current_taxonomy($instance) {
    12841284        if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
    12851285            return $instance['taxonomy'];
     
    12961296 class WP_Nav_Menu_Widget extends WP_Widget {
    12971297
    1298     function __construct() {
     1298    public function __construct() {
    12991299        $widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
    13001300        parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
    13011301    }
    13021302
    1303     function widget($args, $instance) {
     1303    public function widget($args, $instance) {
    13041304        // Get menu
    13051305        $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
     
    13211321    }
    13221322
    1323     function update( $new_instance, $old_instance ) {
     1323    public function update( $new_instance, $old_instance ) {
    13241324        $instance = array();
    13251325        if ( ! empty( $new_instance['title'] ) ) {
     
    13321332    }
    13331333
    1334     function form( $instance ) {
     1334    public function form( $instance ) {
    13351335        $title = isset( $instance['title'] ) ? $instance['title'] : '';
    13361336        $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
Note: See TracChangeset for help on using the changeset viewer.