Make WordPress Core

Changeset 34614


Ignore:
Timestamp:
09/27/2015 12:50:04 AM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Improve documentation for the __construct(), recent_comments_style(), widget(), update(), and form() methods in WP_Widget_Recent_Comments.

Also fixes a typo in the class DocBlock.

Props leemon.
Fixes #34022. See #34013.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php

    r34581 r34614  
    99
    1010/**
    11  * Core class used to implement a Recent_Comments widget.
     11 * Core class used to implement a Recent Comments widget.
    1212 *
    1313 * @since 2.8.0
     
    1717class WP_Widget_Recent_Comments extends WP_Widget {
    1818
     19    /**
     20     * Sets up a new Recent Comments widget instance.
     21     *
     22     * @since 2.8.0
     23     * @access public
     24     */
    1925    public function __construct() {
    2026        $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site’s most recent comments.' ) );
     
    2632    }
    2733
    28     /**
     34    /**
     35     * Outputs the default styles for the Recent Comments widget.
     36     *
     37     * @since 2.8.0
    2938     * @access public
    3039     */
     
    4251            return;
    4352        ?>
    44     <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    45 <?php
     53        <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
     54        <?php
    4655    }
    4756
    4857    /**
    49      * @param array $args
    50      * @param array $instance
     58     * Outputs the content for the current Recent Comments widget instance.
     59     *
     60     * @since 2.8.0
     61     * @access public
     62     *
     63     * @param array $args     Display arguments including 'before_title', 'after_title',
     64     *                        'before_widget', and 'after_widget'.
     65     * @param array $instance Settings for the current Recent Comments widget instance.
    5166     */
    5267    public function widget( $args, $instance ) {
     
    108123
    109124    /**
    110      * @param array $new_instance
    111      * @param array $old_instance
    112      * @return array
     125     * Handles updating settings for the current Recent Comments widget instance.
     126     *
     127     * @since 2.8.0
     128     * @access public
     129     *
     130     * @param array $new_instance New settings for this instance as input by the user via
     131     *                            WP_Widget::form().
     132     * @param array $old_instance Old settings for this instance.
     133     * @return array Updated settings to save.
    113134     */
    114135    public function update( $new_instance, $old_instance ) {
     
    120141
    121142    /**
    122      * @param array $instance
     143     * Outputs the settings form for the Recent Comments widget.
     144     *
     145     * @since 2.8.0
     146     * @access public
     147     *
     148     * @param array $instance Current settings.
    123149     */
    124150    public function form( $instance ) {
    125151        $title = isset( $instance['title'] ) ? $instance['title'] : '';
    126152        $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
    127 ?>
     153        ?>
    128154        <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
    129155        <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>
     
    131157        <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label>
    132158        <input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /></p>
    133 <?php
     159        <?php
    134160    }
    135161}
Note: See TracChangeset for help on using the changeset viewer.