Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15317 r17260  
    11<?php
    2 
    32/**
    43 * Default Widgets
     
    263262        <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>
    264263        <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>
     265            <br/>
    265266            <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             <br />
    267             <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 a drop down'); ?></label>
    268267        </p>
    269268<?php
     
    400399        $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    401400        $title = strip_tags($instance['title']);
    402         $text = format_to_edit($instance['text']);
     401        $text = esc_textarea($instance['text']);
    403402?>
    404403        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
     
    492491
    493492        <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 ); ?> />
    494         <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Show as dropdown' ); ?></label><br />
     493        <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
    495494
    496495        <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
     
    536535
    537536        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);
    538         if ( !$number = (int) $instance['number'] )
    539             $number = 10;
    540         else if ( $number < 1 )
    541             $number = 1;
    542         else if ( $number > 15 )
    543             $number = 15;
    544 
    545         $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
     537        if ( ! $number = absint( $instance['number'] ) )
     538            $number = 10;
     539
     540        $r = new WP_Query(array('posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
    546541        if ($r->have_posts()) :
    547542?>
     
    583578    function form( $instance ) {
    584579        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
    585         if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
    586             $number = 5;
     580        $number = isset($instance['number']) ? absint($instance['number']) : 5;
    587581?>
    588582        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
     
    614608    }
    615609
    616     function recent_comments_style() { ?>
     610    function recent_comments_style() {
     611        if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
     612            || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
     613            return;
     614        ?>
    617615    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    618616<?php
     
    640638        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']);
    641639
    642         if ( ! $number = (int) $instance['number'] )
     640        if ( ! $number = absint( $instance['number'] ) )
    643641            $number = 5;
    644         else if ( $number < 1 )
    645             $number = 1;
    646642
    647643        $comments = get_comments( array( 'number' => $number, 'status' => 'approve' ) );
     
    667663        $instance = $old_instance;
    668664        $instance['title'] = strip_tags($new_instance['title']);
    669         $instance['number'] = (int) $new_instance['number'];
     665        $instance['number'] = absint( $new_instance['number'] );
    670666        $this->flush_widget_cache();
    671667
     
    715711
    716712        if ( empty($url) )
     713            return;
     714
     715        // self-url destruction sequence
     716        if ( $url == site_url() || $url == home_url() )
    717717            return;
    718718
     
    837837        $date = '';
    838838        if ( $show_date ) {
    839             $date = $item->get_date();
     839            $date = $item->get_date( 'U' );
    840840
    841841            if ( $date ) {
    842                 if ( $date_stamp = strtotime( $date ) )
    843                     $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
    844                 else
    845                     $date = '';
     842                $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
    846843            }
    847844        }
     
    10121009        if ( $title )
    10131010            echo $before_title . $title . $after_title;
    1014         echo '<div>';
     1011        echo '<div class="tagcloud">';
    10151012        wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) );
    10161013        echo "</div>\n";
Note: See TracChangeset for help on using the changeset viewer.