Make WordPress Core


Ignore:
Timestamp:
09/03/2015 06:16:35 PM (9 years ago)
Author:
wonderboymusic
Message:

Introduce WP_Comment class to model/strongly-type rows from the comments database table. Inclusion of this class is a pre-req for some more general comment cleanup and sanity.

  • Takes inspiration from WP_Post and adds sanity to comment caching.
  • Clarifies when the current global value for $comment is returned. The current implementation in get_comment() introduces side effects and an occasion stale global value for $comment when comment caches are cleaned.
  • Strongly-types @param docs
  • This class is marked final for now

Props wonderboymusic, nacin.

See #32619.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-comments-post.php

    r31090 r33891  
    147147 * @since 3.4.0
    148148 *
    149  * @param object $comment Comment object.
    150  * @param WP_User $user   User object. The user may not exist.
     149 * @param WP_Comment $comment Comment object.
     150 * @param WP_User    $user    User object. The user may not exist.
    151151 */
    152152do_action( 'set_comment_cookies', $comment, $user );
     
    159159 * @since 2.0.5
    160160 *
    161  * @param string $location The 'redirect_to' URI sent via $_POST.
    162  * @param object $comment  Comment object.
     161 * @param string     $location The 'redirect_to' URI sent via $_POST.
     162 * @param WP_Comment $comment  Comment object.
    163163 */
    164164$location = apply_filters( 'comment_post_redirect', $location, $comment );
Note: See TracChangeset for help on using the changeset viewer.