WordPress.org

Make WordPress Core

Changeset 10796


Ignore:
Timestamp:
03/16/09 22:44:30 (5 years ago)
Author:
ryan
Message:

Move meta widget to WP_Widget. see #8441

File:
1 edited

Legend:

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

    r10795 r10796  
    288288            <input type="hidden" id="meta-submit" name="meta-submit" value="1" /> 
    289289<?php 
     290} 
     291 
     292/** 
     293 * Meta widget class 
     294 * 
     295 * Displays log in/out, RSS feed links, etc. 
     296 *  
     297 * @since 2.8.0 
     298 */ 
     299class WP_Widget_Meta extends WP_Widget { 
     300 
     301    function WP_Widget_Meta() { 
     302        $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); 
     303        $this->WP_Widget('meta', __('Meta'), $widget_ops); 
     304    } 
     305 
     306    function widget( $args, $instance ) { 
     307        extract($args); 
     308        $title = empty($instance['title']) ? __('Meta') : apply_filters('widget_title', $instance['title']); 
     309 
     310        echo $before_widget; 
     311        echo $before_title . $title . $after_title; 
     312?> 
     313            <ul> 
     314            <?php wp_register(); ?> 
     315            <li><?php wp_loginout(); ?></li> 
     316            <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo attribute_escape(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> 
     317            <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo attribute_escape(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> 
     318            <li><a href="http://wordpress.org/" title="<?php echo attribute_escape(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li> 
     319            <?php wp_meta(); ?> 
     320            </ul> 
     321<?php 
     322        echo $after_widget; 
     323    } 
     324 
     325    function update( $new_instance, $old_instance ) { 
     326        if ( !isset($new_instance['submit']) ) // user clicked cancel? 
     327            return false; 
     328 
     329        $instance = $old_instance; 
     330        $instance['title'] = strip_tags($new_instance['title']); 
     331 
     332        return $instance; 
     333    } 
     334 
     335    function form( $instance ) { 
     336        $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 
     337        $title = strip_tags($instance['title']); 
     338?> 
     339            <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p> 
     340            <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" /> 
     341<?php 
     342    } 
    290343} 
    291344 
     
    13331386    new WP_Widget_Links(); 
    13341387 
    1335     $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); 
    1336     wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops); 
    1337     wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control' ); 
     1388    //$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); 
     1389    //wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops); 
     1390    //wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control' ); 
     1391    new WP_Widget_Meta(); 
    13381392 
    13391393    new WP_Widget_Search(); 
Note: See TracChangeset for help on using the changeset viewer.