Make WordPress Core

Changeset 34613


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

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

Also fixes a typo in the class DocBlock.

Props leemon.
Fixes #34023. See #34013.

File:
1 edited

Legend:

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

    r34514 r34613  
    99
    1010/**
    11  * Core class used to implement a Recent_Posts widget.
     11 * Core class used to implement a Recent Posts widget.
    1212 *
    1313 * @since 2.8.0
     
    1717class WP_Widget_Recent_Posts extends WP_Widget {
    1818
     19    /**
     20     * Sets up a new Recent Posts widget instance.
     21     *
     22     * @since 2.8.0
     23     * @access public
     24     */
    1925    public function __construct() {
    2026        $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site’s most recent Posts.") );
     
    2430
    2531    /**
    26      * @param array $args
    27      * @param array $instance
     32     * Outputs the content for the current Recent Posts widget instance.
     33     *
     34     * @since 2.8.0
     35     * @access public
     36     *
     37     * @param array $args     Display arguments including 'before_title', 'after_title',
     38     *                        'before_widget', and 'after_widget'.
     39     * @param array $instance Settings for the current Recent Posts widget instance.
    2840     */
    2941    public function widget( $args, $instance ) {
     
    5971
    6072        if ($r->have_posts()) :
    61 ?>
     73        ?>
    6274        <?php echo $args['before_widget']; ?>
    6375        <?php if ( $title ) {
     
    7587        </ul>
    7688        <?php echo $args['after_widget']; ?>
    77 <?php
     89        <?php
    7890        // Reset the global $the_post as this query will have stomped on it
    7991        wp_reset_postdata();
     
    8395
    8496    /**
    85      * @param array $new_instance
    86      * @param array $old_instance
    87      * @return array
     97     * Handles updating the settings for the current Recent Posts widget instance.
     98     *
     99     * @since 2.8.0
     100     * @access public
     101     *
     102     * @param array $new_instance New settings for this instance as input by the user via
     103     *                            WP_Widget::form().
     104     * @param array $old_instance Old settings for this instance.
     105     * @return array Updated settings to save.
    88106     */
    89107    public function update( $new_instance, $old_instance ) {
     
    96114
    97115    /**
    98      * @param array $instance
     116     * Outputs the settings form for the Recent Posts widget.
     117     *
     118     * @since 2.8.0
     119     * @access public
     120     *
     121     * @param array $instance Current settings.
    99122     */
    100123    public function form( $instance ) {
Note: See TracChangeset for help on using the changeset viewer.