Make WordPress Core


Ignore:
Timestamp:
09/03/2015 06:16:35 PM (10 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-includes/pluggable.php

    r33827 r33891  
    21912191 *
    21922192 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
    2193  *                           user email, WP_User object, WP_Post object, or comment object.
     2193 *                           user email, WP_User object, WP_Post object, or WP_Comment object.
    21942194 * @param int    $size       Optional. Height and width of the avatar image file in pixels. Default 96.
    21952195 * @param string $default    Optional. URL for the default image or a default type. Accepts '404'
     
    22592259     * @since 4.2.0
    22602260     *
    2261      * @param string            $avatar      HTML for the user's avatar. Default null.
    2262      * @param int|object|string $id_or_email A user ID, email address, or comment object.
    2263      * @param array             $args        Arguments passed to get_avatar_url(), after processing.
     2261     * @param string $avatar      HTML for the user's avatar. Default null.
     2262     * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     2263     *                            user email, WP_User object, WP_Post object, or WP_Comment object.
     2264     * @param array  $args        Arguments passed to get_avatar_url(), after processing.
    22642265     */
    22652266    $avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
     
    23152316     * @since 4.2.0 The `$args` parameter was added.
    23162317     *
    2317      * @param string            $avatar      <img> tag for the user's avatar.
    2318      * @param int|object|string $id_or_email A user ID, email address, or comment object.
    2319      * @param int               $size        Square avatar width and height in pixels to retrieve.
    2320      * @param string            $alt         Alternative text to use in the avatar image tag.
     2318     * @param string $avatar      <img> tag for the user's avatar.
     2319     * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     2320     *                            user email, WP_User object, WP_Post object, or WP_Comment object.
     2321     * @param int    $size        Square avatar width and height in pixels to retrieve.
     2322     * @param string $alt         Alternative text to use in the avatar image tag.
    23212323     *                                       Default empty.
    2322      * @param array             $args        Arguments passed to get_avatar_data(), after processing.
     2324     * @param array  $args        Arguments passed to get_avatar_data(), after processing.
    23232325     */
    23242326    return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
Note: See TracChangeset for help on using the changeset viewer.