Make WordPress Core

Changeset 55308


Ignore:
Timestamp:
02/12/2023 06:06:33 PM (22 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename $comment_ID variable to $comment_id in various files.

This resolves 80+ WPCS warnings in core:

Variable "$comment_ID" is not in valid snake_case format

While matching the database field of the same name, the $comment_ID variable did not follow the WordPress coding standards, and is now renamed to address that.

This affects:

  • Function parameters in:
    • get_comment_author()
    • comment_author()
    • get_comment_author_email()
    • comment_author_email()
    • get_comment_author_link()
    • comment_author_link()
    • get_comment_author_IP()
    • comment_author_IP()
    • get_comment_author_rl()
    • comment_author_url()
    • get_comment_date()
    • comment_date()
    • get_comment_excerpt()
    • comment_excerpt()
    • get_comment_text()
    • comment_text()
    • get_comment_time()
    • comment_time()
    • get_comment_type()
    • get_page_of_comment()
    • wp_new_comment_notify_moderator()
    • wp_new_comment_notify_postauthor()
    • get_commentdata()
  • Internal variables in:
    • get_comment_ID()
    • wp_new_comment()
    • wp_xmlrpc_server::wp_deleteComment()
    • wp_xmlrpc_server::wp_editComment()
    • wp_xmlrpc_server::wp_newComment()
    • wp_xmlrpc_server::pingback_ping()
  • Hook parameters in:
    • get_comment_author
    • comment_author
    • get_comment_author_email
    • author_email
    • get_comment_author_link
    • get_comment_author_IP
    • get_comment_author_url
    • comment_url
    • get_comment_excerpt
    • comment_excerpt
    • get_comment_ID
    • get_comment_type
    • get_page_of_comment
    • comment_{$new_status}_{$comment->comment_type}
    • comment_post
    • notify_moderator
    • notify_post_author
    • commentrss2_item
    • xmlrpc_call_success_wp_deleteComment
    • xmlrpc_call_success_wp_editComment
    • xmlrpc_call_success_wp_newComment
    • pingback_post

Note: The name change only affects variable names and DocBlocks.

The change does not affect:

  • comment_ID as the $orderby value in WP_Comment_Query::__construct()
  • comment_ID as the $orderby value in WP_Comment::get_children()
  • comment_ID as part of $commentarr parameter in wp_update_comment()

The associated array keys still match the database field.

Follow-up to [53723].

Props krunal265, costdev, SergeyBiryukov.
Fixes #57671. See #56791.

Location:
trunk/src/wp-includes
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r54877 r55308  
    37213721        $username   = $args[1];
    37223722        $password   = $args[2];
    3723         $comment_ID = (int) $args[3];
     3723        $comment_id = (int) $args[3];
    37243724
    37253725        $user = $this->login( $username, $password );
     
    37283728        }
    37293729
    3730         if ( ! get_comment( $comment_ID ) ) {
     3730        if ( ! get_comment( $comment_id ) ) {
    37313731            return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
    37323732        }
    37333733
    3734         if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
     3734        if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
    37353735            return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) );
    37363736        }
     
    37393739        do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this );
    37403740
    3741         $status = wp_delete_comment( $comment_ID );
     3741        $status = wp_delete_comment( $comment_id );
    37423742
    37433743        if ( $status ) {
     
    37473747             * @since 3.4.0
    37483748             *
    3749              * @param int   $comment_ID ID of the deleted comment.
     3749             * @param int   $comment_id ID of the deleted comment.
    37503750             * @param array $args       An array of arguments to delete the comment.
    37513751             */
    3752             do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
     3752            do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
    37533753        }
    37543754
     
    37883788        $username       = $args[1];
    37893789        $password       = $args[2];
    3790         $comment_ID     = (int) $args[3];
     3790        $comment_id     = (int) $args[3];
    37913791        $content_struct = $args[4];
    37923792
     
    37963796        }
    37973797
    3798         if ( ! get_comment( $comment_ID ) ) {
     3798        if ( ! get_comment( $comment_id ) ) {
    37993799            return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
    38003800        }
    38013801
    3802         if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
     3802        if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
    38033803            return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) );
    38043804        }
     
    38073807        do_action( 'xmlrpc_call', 'wp.editComment', $args, $this );
    38083808        $comment = array(
    3809             'comment_ID' => $comment_ID,
     3809            'comment_ID' => $comment_id,
    38103810        );
    38113811
     
    38593859         * @since 3.4.0
    38603860         *
    3861          * @param int   $comment_ID ID of the updated comment.
     3861         * @param int   $comment_id ID of the updated comment.
    38623862         * @param array $args       An array of arguments to update the comment.
    38633863         */
    3864         do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
     3864        do_action( 'xmlrpc_call_success_wp_editComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
    38653865
    38663866        return true;
     
    40004000        do_action( 'xmlrpc_call', 'wp.newComment', $args, $this );
    40014001
    4002         $comment_ID = wp_new_comment( $comment, true );
    4003         if ( is_wp_error( $comment_ID ) ) {
    4004             return new IXR_Error( 403, $comment_ID->get_error_message() );
    4005         }
    4006 
    4007         if ( ! $comment_ID ) {
     4002        $comment_id = wp_new_comment( $comment, true );
     4003        if ( is_wp_error( $comment_id ) ) {
     4004            return new IXR_Error( 403, $comment_id->get_error_message() );
     4005        }
     4006
     4007        if ( ! $comment_id ) {
    40084008            return new IXR_Error( 403, __( 'Something went wrong.' ) );
    40094009        }
     
    40144014         * @since 3.4.0
    40154015         *
    4016          * @param int   $comment_ID ID of the new comment.
     4016         * @param int   $comment_id ID of the new comment.
    40174017         * @param array $args       An array of new comment arguments.
    40184018         */
    4019         do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
    4020 
    4021         return $comment_ID;
     4019        do_action( 'xmlrpc_call_success_wp_newComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
     4020
     4021        return $comment_id;
    40224022    }
    40234023
     
    70417041        );
    70427042
    7043         $comment_ID = wp_new_comment( $commentdata );
    7044 
    7045         if ( is_wp_error( $comment_ID ) ) {
    7046             return $this->pingback_error( 0, $comment_ID->get_error_message() );
     7043        $comment_id = wp_new_comment( $commentdata );
     7044
     7045        if ( is_wp_error( $comment_id ) ) {
     7046            return $this->pingback_error( 0, $comment_id->get_error_message() );
    70477047        }
    70487048
     
    70527052         * @since 0.71
    70537053         *
    7054          * @param int $comment_ID Comment ID.
     7054         * @param int $comment_id Comment ID.
    70557055         */
    7056         do_action( 'pingback_post', $comment_ID );
     7056        do_action( 'pingback_post', $comment_id );
    70577057
    70587058        /* translators: 1: URL of the page linked from, 2: URL of the page linked to. */
  • trunk/src/wp-includes/comment-template.php

    r55289 r55308  
    1616 *
    1717 * @since 1.5.0
    18  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    19  *
    20  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to retrieve the author.
     18 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     19 *
     20 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to retrieve the author.
    2121 *                                   Default current comment.
    2222 * @return string The comment author
    2323 */
    24 function get_comment_author( $comment_ID = 0 ) {
    25     $comment    = get_comment( $comment_ID );
    26     $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_ID;
     24function get_comment_author( $comment_id = 0 ) {
     25    $comment    = get_comment( $comment_id );
     26    $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id;
    2727
    2828    if ( empty( $comment->comment_author ) ) {
     
    4141     *
    4242     * @since 1.5.0
    43      * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
     43     * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
    4444     *
    4545     * @param string     $author     The comment author's username.
    46      * @param string     $comment_ID The comment ID as a numeric string.
     46     * @param string     $comment_id The comment ID as a numeric string.
    4747     * @param WP_Comment $comment    The comment object.
    4848     */
    49     return apply_filters( 'get_comment_author', $author, $comment_ID, $comment );
     49    return apply_filters( 'get_comment_author', $author, $comment_id, $comment );
    5050}
    5151
     
    5454 *
    5555 * @since 0.71
    56  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    57  *
    58  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author.
     56 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     57 *
     58 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author.
    5959 *                                   Default current comment.
    6060 */
    61 function comment_author( $comment_ID = 0 ) {
    62     $comment = get_comment( $comment_ID );
     61function comment_author( $comment_id = 0 ) {
     62    $comment = get_comment( $comment_id );
    6363    $author  = get_comment_author( $comment );
    6464
     
    6767     *
    6868     * @since 1.2.0
    69      * @since 4.1.0 The `$comment_ID` parameter was added.
     69     * @since 4.1.0 The `$comment_id` parameter was added.
    7070     *
    7171     * @param string $author     The comment author's username.
    72      * @param string $comment_ID The comment ID as a numeric string.
     72     * @param string $comment_id The comment ID as a numeric string.
    7373     */
    7474    echo apply_filters( 'comment_author', $author, $comment->comment_ID );
     
    7979 *
    8080 * @since 1.5.0
    81  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    82  *
    83  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email.
     81 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     82 *
     83 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's email.
    8484 *                                   Default current comment.
    8585 * @return string The current comment author's email
    8686 */
    87 function get_comment_author_email( $comment_ID = 0 ) {
    88     $comment = get_comment( $comment_ID );
     87function get_comment_author_email( $comment_id = 0 ) {
     88    $comment = get_comment( $comment_id );
    8989
    9090    /**
     
    9292     *
    9393     * @since 1.5.0
    94      * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
     94     * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
    9595     *
    9696     * @param string     $comment_author_email The comment author's email address.
    97      * @param string     $comment_ID           The comment ID as a numeric string.
     97     * @param string     $comment_id           The comment ID as a numeric string.
    9898     * @param WP_Comment $comment              The comment object.
    9999     */
     
    111111 *
    112112 * @since 0.71
    113  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    114  *
    115  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's email.
     113 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     114 *
     115 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's email.
    116116 *                                   Default current comment.
    117117 */
    118 function comment_author_email( $comment_ID = 0 ) {
    119     $comment      = get_comment( $comment_ID );
     118function comment_author_email( $comment_id = 0 ) {
     119    $comment      = get_comment( $comment_id );
    120120    $author_email = get_comment_author_email( $comment );
    121121
     
    124124     *
    125125     * @since 1.2.0
    126      * @since 4.1.0 The `$comment_ID` parameter was added.
     126     * @since 4.1.0 The `$comment_id` parameter was added.
    127127     *
    128128     * @param string $author_email The comment author's email address.
    129      * @param string $comment_ID   The comment ID as a numeric string.
     129     * @param string $comment_id   The comment ID as a numeric string.
    130130     */
    131131    echo apply_filters( 'author_email', $author_email, $comment->comment_ID );
     
    209209 *
    210210 * Both get_comment_author_url() and get_comment_author() rely on get_comment(),
    211  * which falls back to the global comment variable if the $comment_ID argument is empty.
     211 * which falls back to the global comment variable if the $comment_id argument is empty.
    212212 *
    213213 * @since 1.5.0
    214  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    215  *
    216  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's link.
     214 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     215 *
     216 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's link.
    217217 *                                   Default current comment.
    218218 * @return string The comment author name or HTML link for author's URL.
    219219 */
    220 function get_comment_author_link( $comment_ID = 0 ) {
    221     $comment    = get_comment( $comment_ID );
    222     $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_ID;
     220function get_comment_author_link( $comment_id = 0 ) {
     221    $comment    = get_comment( $comment_id );
     222    $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id;
    223223    $url        = get_comment_author_url( $comment );
    224224    $author     = get_comment_author( $comment );
     
    264264     *
    265265     * @since 1.5.0
    266      * @since 4.1.0 The `$author` and `$comment_ID` parameters were added.
     266     * @since 4.1.0 The `$author` and `$comment_id` parameters were added.
    267267     *
    268268     * @param string $return     The HTML-formatted comment author link.
    269269     *                           Empty for an invalid URL.
    270270     * @param string $author     The comment author's username.
    271      * @param string $comment_ID The comment ID as a numeric string.
    272      */
    273     return apply_filters( 'get_comment_author_link', $return, $author, $comment_ID );
     271     * @param string $comment_id The comment ID as a numeric string.
     272     */
     273    return apply_filters( 'get_comment_author_link', $return, $author, $comment_id );
    274274}
    275275
     
    278278 *
    279279 * @since 0.71
    280  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    281  *
    282  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's link.
     280 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     281 *
     282 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's link.
    283283 *                                   Default current comment.
    284284 */
    285 function comment_author_link( $comment_ID = 0 ) {
    286     echo get_comment_author_link( $comment_ID );
     285function comment_author_link( $comment_id = 0 ) {
     286    echo get_comment_author_link( $comment_id );
    287287}
    288288
     
    291291 *
    292292 * @since 1.5.0
    293  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    294  *
    295  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address.
     293 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     294 *
     295 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's IP address.
    296296 *                                   Default current comment.
    297297 * @return string Comment author's IP address, or an empty string if it's not available.
    298298 */
    299 function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    300     $comment = get_comment( $comment_ID );
     299function get_comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
     300    $comment = get_comment( $comment_id );
    301301
    302302    /**
     
    304304     *
    305305     * @since 1.5.0
    306      * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
     306     * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
    307307     *
    308308     * @param string     $comment_author_ip The comment author's IP address, or an empty string if it's not available.
    309      * @param string     $comment_ID        The comment ID as a numeric string.
     309     * @param string     $comment_id        The comment ID as a numeric string.
    310310     * @param WP_Comment $comment           The comment object.
    311311     */
     
    317317 *
    318318 * @since 0.71
    319  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    320  *
    321  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
     319 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     320 *
     321 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
    322322 *                                   Default current comment.
    323323 */
    324 function comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    325     echo esc_html( get_comment_author_IP( $comment_ID ) );
     324function comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
     325    echo esc_html( get_comment_author_IP( $comment_id ) );
    326326}
    327327
     
    330330 *
    331331 * @since 1.5.0
    332  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    333  *
    334  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's URL.
     332 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     333 *
     334 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's URL.
    335335 *                                   Default current comment.
    336336 * @return string Comment author URL, if provided, an empty string otherwise.
    337337 */
    338 function get_comment_author_url( $comment_ID = 0 ) {
    339     $comment = get_comment( $comment_ID );
     338function get_comment_author_url( $comment_id = 0 ) {
     339    $comment = get_comment( $comment_id );
    340340    $url     = '';
    341341    $id      = 0;
     
    351351     *
    352352     * @since 1.5.0
    353      * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
     353     * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
    354354     *
    355355     * @param string          $url        The comment author's URL, or an empty string.
    356      * @param string|int      $comment_ID The comment ID as a numeric string, or 0 if not found.
     356     * @param string|int      $comment_id The comment ID as a numeric string, or 0 if not found.
    357357     * @param WP_Comment|null $comment    The comment object, or null if not found.
    358358     */
     
    364364 *
    365365 * @since 0.71
    366  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    367  *
    368  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's URL.
     366 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     367 *
     368 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's URL.
    369369 *                                   Default current comment.
    370370 */
    371 function comment_author_url( $comment_ID = 0 ) {
    372     $comment    = get_comment( $comment_ID );
     371function comment_author_url( $comment_id = 0 ) {
     372    $comment    = get_comment( $comment_id );
    373373    $author_url = get_comment_author_url( $comment );
    374374
     
    377377     *
    378378     * @since 1.2.0
    379      * @since 4.1.0 The `$comment_ID` parameter was added.
     379     * @since 4.1.0 The `$comment_id` parameter was added.
    380380     *
    381381     * @param string $author_url The comment author's URL.
    382      * @param string $comment_ID The comment ID as a numeric string.
     382     * @param string $comment_id The comment ID as a numeric string.
    383383     */
    384384    echo apply_filters( 'comment_url', $author_url, $comment->comment_ID );
     
    576576 *
    577577 * @since 1.5.0
    578  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
     578 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
    579579 *
    580580 * @param string         $format     Optional. PHP date format. Defaults to the 'date_format' option.
    581  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the date.
     581 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the date.
    582582 *                                   Default current comment.
    583583 * @return string The comment's date.
    584584 */
    585 function get_comment_date( $format = '', $comment_ID = 0 ) {
    586     $comment = get_comment( $comment_ID );
     585function get_comment_date( $format = '', $comment_id = 0 ) {
     586    $comment = get_comment( $comment_id );
    587587
    588588    $_format = ! empty( $format ) ? $format : get_option( 'date_format' );
     
    606606 *
    607607 * @since 0.71
    608  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
     608 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
    609609 *
    610610 * @param string         $format     Optional. PHP date format. Defaults to the 'date_format' option.
    611  * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date.
     611 * @param int|WP_Comment $comment_id WP_Comment or ID of the comment for which to print the date.
    612612 *                                   Default current comment.
    613613 */
    614 function comment_date( $format = '', $comment_ID = 0 ) {
    615     echo get_comment_date( $format, $comment_ID );
     614function comment_date( $format = '', $comment_id = 0 ) {
     615    echo get_comment_date( $format, $comment_id );
    616616}
    617617
     
    622622 *
    623623 * @since 1.5.0
    624  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    625  *
    626  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the excerpt.
     624 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     625 *
     626 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the excerpt.
    627627 *                                   Default current comment.
    628628 * @return string The possibly truncated comment excerpt.
    629629 */
    630 function get_comment_excerpt( $comment_ID = 0 ) {
    631     $comment = get_comment( $comment_ID );
     630function get_comment_excerpt( $comment_id = 0 ) {
     631    $comment = get_comment( $comment_id );
    632632
    633633    if ( ! post_password_required( $comment->comment_post_ID ) ) {
     
    655655     *
    656656     * @since 1.5.0
    657      * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
     657     * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
    658658     *
    659659     * @param string     $excerpt    The comment excerpt text.
    660      * @param string     $comment_ID The comment ID as a numeric string.
     660     * @param string     $comment_id The comment ID as a numeric string.
    661661     * @param WP_Comment $comment    The comment object.
    662662     */
     
    668668 *
    669669 * @since 1.2.0
    670  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    671  *
    672  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to print the excerpt.
     670 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     671 *
     672 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the excerpt.
    673673 *                                   Default current comment.
    674674 */
    675 function comment_excerpt( $comment_ID = 0 ) {
    676     $comment         = get_comment( $comment_ID );
     675function comment_excerpt( $comment_id = 0 ) {
     676    $comment         = get_comment( $comment_id );
    677677    $comment_excerpt = get_comment_excerpt( $comment );
    678678
     
    681681     *
    682682     * @since 1.2.0
    683      * @since 4.1.0 The `$comment_ID` parameter was added.
     683     * @since 4.1.0 The `$comment_id` parameter was added.
    684684     *
    685685     * @param string $comment_excerpt The comment excerpt text.
    686      * @param string $comment_ID      The comment ID as a numeric string.
     686     * @param string $comment_id      The comment ID as a numeric string.
    687687     */
    688688    echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
     
    698698function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    699699    $comment    = get_comment();
    700     $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';
     700    $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';
    701701
    702702    /**
     
    706706     * @since 4.1.0 The `$comment` parameter was added.
    707707     *
    708      * @param string     $comment_ID The current comment ID as a numeric string.
     708     * @param string     $comment_id The current comment ID as a numeric string.
    709709     * @param WP_Comment $comment    The comment object.
    710710     */
    711     return apply_filters( 'get_comment_ID', $comment_ID, $comment );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
     711    return apply_filters( 'get_comment_ID', $comment_id, $comment );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
    712712}
    713713
     
    986986 *
    987987 * @since 1.5.0
    988  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
     988 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
    989989 * @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed.
    990990 *
    991991 * @see Walker_Comment::comment()
    992992 *
    993  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the text.
     993 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the text.
    994994 *                                   Default current comment.
    995995 * @param array          $args       Optional. An array of arguments. Default empty array.
    996996 * @return string The comment content.
    997997 */
    998 function get_comment_text( $comment_ID = 0, $args = array() ) {
    999     $comment = get_comment( $comment_ID );
     998function get_comment_text( $comment_id = 0, $args = array() ) {
     999    $comment = get_comment( $comment_id );
    10001000
    10011001    $comment_content = $comment->comment_content;
     
    10331033 *
    10341034 * @since 0.71
    1035  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
     1035 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
    10361036 *
    10371037 * @see Walker_Comment::comment()
    10381038 *
    1039  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to print the text.
     1039 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the text.
    10401040 *                                   Default current comment.
    10411041 * @param array          $args       Optional. An array of arguments. Default empty array.
    10421042 */
    1043 function comment_text( $comment_ID = 0, $args = array() ) {
    1044     $comment = get_comment( $comment_ID );
     1043function comment_text( $comment_id = 0, $args = array() ) {
     1044    $comment = get_comment( $comment_id );
    10451045
    10461046    $comment_text = get_comment_text( $comment, $args );
     
    10631063 *
    10641064 * @since 1.5.0
    1065  * @since 6.2.0 Added the `$comment_ID` parameter.
     1065 * @since 6.2.0 Added the `$comment_id` parameter.
    10661066 *
    10671067 * @param string         $format     Optional. PHP date format. Defaults to the 'time_format' option.
     
    10691069 * @param bool           $translate  Optional. Whether to translate the time (for use in feeds).
    10701070 *                                   Default true.
    1071  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the time.
     1071 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the time.
    10721072 *                                   Default current comment.
    10731073 * @return string The formatted time.
    10741074 */
    1075 function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_ID = 0 ) {
    1076     $comment = get_comment( $comment_ID );
     1075function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_id = 0 ) {
     1076    $comment = get_comment( $comment_id );
    10771077
    10781078    if ( null === $comment ) {
     
    11041104 *
    11051105 * @since 0.71
    1106  * @since 6.2.0 Added the `$comment_ID` parameter.
     1106 * @since 6.2.0 Added the `$comment_id` parameter.
    11071107 *
    11081108 * @param string         $format     Optional. PHP time format. Defaults to the 'time_format' option.
    1109  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the time.
     1109 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the time.
    11101110 *                                   Default current comment.
    11111111 */
    1112 function comment_time( $format = '', $comment_ID = 0 ) {
    1113     echo get_comment_time( $format, $comment_ID );
     1112function comment_time( $format = '', $comment_id = 0 ) {
     1113    echo get_comment_time( $format, $comment_id );
    11141114}
    11151115
     
    11181118 *
    11191119 * @since 1.5.0
    1120  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    1121  *
    1122  * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the type.
     1120 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
     1121 *
     1122 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the type.
    11231123 *                                   Default current comment.
    11241124 * @return string The comment type.
    11251125 */
    1126 function get_comment_type( $comment_ID = 0 ) {
    1127     $comment = get_comment( $comment_ID );
     1126function get_comment_type( $comment_id = 0 ) {
     1127    $comment = get_comment( $comment_id );
    11281128
    11291129    if ( '' === $comment->comment_type ) {
     
    11351135     *
    11361136     * @since 1.5.0
    1137      * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
     1137     * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
    11381138     *
    11391139     * @param string     $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
    1140      * @param string     $comment_ID   The comment ID as a numeric string.
     1140     * @param string     $comment_id   The comment ID as a numeric string.
    11411141     * @param WP_Comment $comment      The comment object.
    11421142     */
  • trunk/src/wp-includes/comment.php

    r55258 r55308  
    10401040 * @global wpdb $wpdb WordPress database abstraction object.
    10411041 *
    1042  * @param int   $comment_ID Comment ID.
     1042 * @param int   $comment_id Comment ID.
    10431043 * @param array $args {
    10441044 *     Array of optional arguments.
     
    10501050 *                                 Defaults to the value of the 'comments_per_page' option.
    10511051 *     @type int|string $max_depth If greater than 1, comment page will be determined
    1052  *                                 for the top-level parent `$comment_ID`.
     1052 *                                 for the top-level parent `$comment_id`.
    10531053 *                                 Defaults to the value of the 'thread_comments_depth' option.
    10541054 * } *
    10551055 * @return int|null Comment page number or null on error.
    10561056 */
    1057 function get_page_of_comment( $comment_ID, $args = array() ) {
     1057function get_page_of_comment( $comment_id, $args = array() ) {
    10581058    global $wpdb;
    10591059
    10601060    $page = null;
    10611061
    1062     $comment = get_comment( $comment_ID );
     1062    $comment = get_comment( $comment_id );
    10631063    if ( ! $comment ) {
    10641064        return;
     
    11761176     *
    11771177     * @since 4.4.0
    1178      * @since 4.7.0 Introduced the `$comment_ID` parameter.
     1178     * @since 4.7.0 Introduced the `$comment_id` parameter.
    11791179     *
    11801180     * @param int   $page          Comment page.
     
    11971197     *     @type int    $max_depth Maximum comment threading depth allowed.
    11981198     * }
    1199      * @param int $comment_ID ID of the comment.
    1200      */
    1201     return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID );
     1199     * @param int $comment_id ID of the comment.
     1200     */
     1201    return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_id );
    12021202}
    12031203
     
    18381838     * @since 2.7.0
    18391839     *
    1840      * @param string     $comment_ID The comment ID as a numeric string.
     1840     * @param string     $comment_id The comment ID as a numeric string.
    18411841     * @param WP_Comment $comment    Comment object.
    18421842     */
     
    22822282    }
    22832283
    2284     $comment_ID = wp_insert_comment( $commentdata );
    2285 
    2286     if ( ! $comment_ID ) {
     2284    $comment_id = wp_insert_comment( $commentdata );
     2285
     2286    if ( ! $comment_id ) {
    22872287        $fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
    22882288
     
    23002300        }
    23012301
    2302         $comment_ID = wp_insert_comment( $commentdata );
    2303         if ( ! $comment_ID ) {
     2302        $comment_id = wp_insert_comment( $commentdata );
     2303        if ( ! $comment_id ) {
    23042304            return false;
    23052305        }
     
    23122312     * @since 4.5.0 The `$commentdata` parameter was added.
    23132313     *
    2314      * @param int        $comment_ID       The comment ID.
     2314     * @param int        $comment_id       The comment ID.
    23152315     * @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
    23162316     * @param array      $commentdata      Comment data.
    23172317     */
    2318     do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
    2319 
    2320     return $comment_ID;
     2318    do_action( 'comment_post', $comment_id, $commentdata['comment_approved'], $commentdata );
     2319
     2320    return $comment_id;
    23212321}
    23222322
     
    23262326 * @since 4.4.0
    23272327 *
    2328  * @param int $comment_ID ID of the comment.
     2328 * @param int $comment_id ID of the comment.
    23292329 * @return bool True on success, false on failure.
    23302330 */
    2331 function wp_new_comment_notify_moderator( $comment_ID ) {
    2332     $comment = get_comment( $comment_ID );
     2331function wp_new_comment_notify_moderator( $comment_id ) {
     2332    $comment = get_comment( $comment_id );
    23332333
    23342334    // Only send notifications for pending comments.
     
    23362336
    23372337    /** This filter is documented in wp-includes/comment.php */
    2338     $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );
     2338    $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
    23392339
    23402340    if ( ! $maybe_notify ) {
     
    23422342    }
    23432343
    2344     return wp_notify_moderator( $comment_ID );
     2344    return wp_notify_moderator( $comment_id );
    23452345}
    23462346
     
    23532353 * should be notified when a new comment is added, overriding site setting.
    23542354 *
    2355  * @param int $comment_ID Comment ID.
     2355 * @param int $comment_id Comment ID.
    23562356 * @return bool True on success, false on failure.
    23572357 */
    2358 function wp_new_comment_notify_postauthor( $comment_ID ) {
    2359     $comment = get_comment( $comment_ID );
     2358function wp_new_comment_notify_postauthor( $comment_id ) {
     2359    $comment = get_comment( $comment_id );
    23602360
    23612361    $maybe_notify = get_option( 'comments_notify' );
     
    23682368     *
    23692369     * @param bool $maybe_notify Whether to notify the post author about the new comment.
    2370      * @param int  $comment_ID   The ID of the comment for the notification.
    2371      */
    2372     $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID );
     2370     * @param int  $comment_id   The ID of the comment for the notification.
     2371     */
     2372    $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_id );
    23732373
    23742374    /*
     
    23852385    }
    23862386
    2387     return wp_notify_postauthor( $comment_ID );
     2387    return wp_notify_postauthor( $comment_id );
    23882388}
    23892389
  • trunk/src/wp-includes/deprecated.php

    r55258 r55308  
    12261226
    12271227/**
    1228  * Retrieve an array of comment data about comment $comment_ID.
     1228 * Retrieve an array of comment data about comment $comment_id.
    12291229 *
    12301230 * @since 0.71
     
    12321232 * @see get_comment()
    12331233 *
    1234  * @param int $comment_ID The ID of the comment
     1234 * @param int $comment_id The ID of the comment
    12351235 * @param int $no_cache Whether to use the cache (cast to bool)
    12361236 * @param bool $include_unapproved Whether to include unapproved comments
    12371237 * @return array The comment data
    12381238 */
    1239 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
     1239function get_commentdata( $comment_id, $no_cache = 0, $include_unapproved = false ) {
    12401240    _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
    1241     return get_comment($comment_ID, ARRAY_A);
     1241    return get_comment($comment_id, ARRAY_A);
    12421242}
    12431243
  • trunk/src/wp-includes/feed-rss2-comments.php

    r48585 r55308  
    111111         * @since 2.1.0
    112112         *
    113          * @param int $comment_ID The ID of the comment being displayed.
    114          * @param int $ID        The ID of the post the comment is connected to.
     113         * @param int $comment_id      The ID of the comment being displayed.
     114         * @param int $comment_post_id The ID of the post the comment is connected to.
    115115         */
    116116        do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
  • trunk/src/wp-includes/pluggable.php

    r55260 r55308  
    18761876         *
    18771877         * @param bool $maybe_notify Whether to notify blog moderator.
    1878          * @param int  $comment_ID   The id of the comment for the notification.
     1878         * @param int  $comment_id   The ID of the comment for the notification.
    18791879         */
    18801880        $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
Note: See TracChangeset for help on using the changeset viewer.