Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r17260 r17825  
    1414class WP_Widget_Pages extends WP_Widget {
    1515
    16     function WP_Widget_Pages() {
     16    function __construct() {
    1717        $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'Your site’s WordPress Pages') );
    18         $this->WP_Widget('pages', __('Pages'), $widget_ops);
     18        parent::__construct('pages', __('Pages'), $widget_ops);
    1919    }
    2020
     
    9090class WP_Widget_Links extends WP_Widget {
    9191
    92     function WP_Widget_Links() {
     92    function __construct() {
    9393        $widget_ops = array('description' => __( "Your blogroll" ) );
    94         $this->WP_Widget('links', __('Links'), $widget_ops);
     94        parent::__construct('links', __('Links'), $widget_ops);
    9595    }
    9696
     
    171171class WP_Widget_Search extends WP_Widget {
    172172
    173     function WP_Widget_Search() {
     173    function __construct() {
    174174        $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site") );
    175         $this->WP_Widget('search', __('Search'), $widget_ops);
     175        parent::__construct('search', __('Search'), $widget_ops);
    176176    }
    177177
     
    214214class WP_Widget_Archives extends WP_Widget {
    215215
    216     function WP_Widget_Archives() {
     216    function __construct() {
    217217        $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s posts') );
    218         $this->WP_Widget('archives', __('Archives'), $widget_ops);
     218        parent::__construct('archives', __('Archives'), $widget_ops);
    219219    }
    220220
     
    279279class WP_Widget_Meta extends WP_Widget {
    280280
    281     function WP_Widget_Meta() {
     281    function __construct() {
    282282        $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
    283         $this->WP_Widget('meta', __('Meta'), $widget_ops);
     283        parent::__construct('meta', __('Meta'), $widget_ops);
    284284    }
    285285
     
    327327class WP_Widget_Calendar extends WP_Widget {
    328328
    329     function WP_Widget_Calendar() {
     329    function __construct() {
    330330        $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s posts') );
    331         $this->WP_Widget('calendar', __('Calendar'), $widget_ops);
     331        parent::__construct('calendar', __('Calendar'), $widget_ops);
    332332    }
    333333
     
    368368class WP_Widget_Text extends WP_Widget {
    369369
    370     function WP_Widget_Text() {
     370    function __construct() {
    371371        $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
    372372        $control_ops = array('width' => 400, 'height' => 350);
    373         $this->WP_Widget('text', __('Text'), $widget_ops, $control_ops);
     373        parent::__construct('text', __('Text'), $widget_ops, $control_ops);
    374374    }
    375375
     
    418418class WP_Widget_Categories extends WP_Widget {
    419419
    420     function WP_Widget_Categories() {
     420    function __construct() {
    421421        $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) );
    422         $this->WP_Widget('categories', __('Categories'), $widget_ops);
     422        parent::__construct('categories', __('Categories'), $widget_ops);
    423423    }
    424424
     
    510510class WP_Widget_Recent_Posts extends WP_Widget {
    511511
    512     function WP_Widget_Recent_Posts() {
     512    function __construct() {
    513513        $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") );
    514         $this->WP_Widget('recent-posts', __('Recent Posts'), $widget_ops);
     514        parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
    515515        $this->alt_option_name = 'widget_recent_entries';
    516516
     
    538538            $number = 10;
    539539
    540         $r = new WP_Query(array('posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
     540        $r = new WP_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
    541541        if ($r->have_posts()) :
    542542?>
     
    596596class WP_Widget_Recent_Comments extends WP_Widget {
    597597
    598     function WP_Widget_Recent_Comments() {
     598    function __construct() {
    599599        $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'The most recent comments' ) );
    600         $this->WP_Widget('recent-comments', __('Recent Comments'), $widget_ops);
     600        parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
    601601        $this->alt_option_name = 'widget_recent_comments';
    602602
     
    641641            $number = 5;
    642642
    643         $comments = get_comments( array( 'number' => $number, 'status' => 'approve' ) );
     643        $comments = get_comments( array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) );
    644644        $output .= $before_widget;
    645645        if ( $title )
     
    693693class WP_Widget_RSS extends WP_Widget {
    694694
    695     function WP_Widget_RSS() {
     695    function __construct() {
    696696        $widget_ops = array( 'description' => __('Entries from any RSS or Atom feed') );
    697697        $control_ops = array( 'width' => 400, 'height' => 200 );
    698         $this->WP_Widget( 'rss', __('RSS'), $widget_ops, $control_ops );
     698        parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops );
    699699    }
    700700
     
    714714
    715715        // self-url destruction sequence
    716         if ( $url == site_url() || $url == home_url() )
     716        if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) )
    717717            return;
    718718
     
    986986class WP_Widget_Tag_Cloud extends WP_Widget {
    987987
    988     function WP_Widget_Tag_Cloud() {
     988    function __construct() {
    989989        $widget_ops = array( 'description' => __( "Your most used tags in cloud format") );
    990         $this->WP_Widget('tag_cloud', __('Tag Cloud'), $widget_ops);
     990        parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
    991991    }
    992992
     
    10531053 class WP_Nav_Menu_Widget extends WP_Widget {
    10541054
    1055     function WP_Nav_Menu_Widget() {
     1055    function __construct() {
    10561056        $widget_ops = array( 'description' => __('Use this widget to add one of your custom menus as a widget.') );
    1057         parent::WP_Widget( 'nav_menu', __('Custom Menu'), $widget_ops );
     1057        parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
    10581058    }
    10591059
Note: See TracChangeset for help on using the changeset viewer.