mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-06 05:34:26 +00:00
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55308 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1039,7 +1039,7 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @param int $comment_ID Comment ID.
|
||||
* @param int $comment_id Comment ID.
|
||||
* @param array $args {
|
||||
* Array of optional arguments.
|
||||
*
|
||||
@@ -1049,17 +1049,17 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded
|
||||
* @type int $per_page Per-page count to use when calculating pagination.
|
||||
* Defaults to the value of the 'comments_per_page' option.
|
||||
* @type int|string $max_depth If greater than 1, comment page will be determined
|
||||
* for the top-level parent `$comment_ID`.
|
||||
* for the top-level parent `$comment_id`.
|
||||
* Defaults to the value of the 'thread_comments_depth' option.
|
||||
* } *
|
||||
* @return int|null Comment page number or null on error.
|
||||
*/
|
||||
function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||
function get_page_of_comment( $comment_id, $args = array() ) {
|
||||
global $wpdb;
|
||||
|
||||
$page = null;
|
||||
|
||||
$comment = get_comment( $comment_ID );
|
||||
$comment = get_comment( $comment_id );
|
||||
if ( ! $comment ) {
|
||||
return;
|
||||
}
|
||||
@@ -1175,7 +1175,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||
* Filters the calculated page on which a comment appears.
|
||||
*
|
||||
* @since 4.4.0
|
||||
* @since 4.7.0 Introduced the `$comment_ID` parameter.
|
||||
* @since 4.7.0 Introduced the `$comment_id` parameter.
|
||||
*
|
||||
* @param int $page Comment page.
|
||||
* @param array $args {
|
||||
@@ -1196,9 +1196,9 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||
* @type int $per_page Number of comments per page.
|
||||
* @type int $max_depth Maximum comment threading depth allowed.
|
||||
* }
|
||||
* @param int $comment_ID ID of the comment.
|
||||
* @param int $comment_id ID of the comment.
|
||||
*/
|
||||
return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID );
|
||||
return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1837,7 +1837,7 @@ function wp_transition_comment_status( $new_status, $old_status, $comment ) {
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @param string $comment_ID The comment ID as a numeric string.
|
||||
* @param string $comment_id The comment ID as a numeric string.
|
||||
* @param WP_Comment $comment Comment object.
|
||||
*/
|
||||
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
|
||||
@@ -2281,9 +2281,9 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||
return $commentdata['comment_approved'];
|
||||
}
|
||||
|
||||
$comment_ID = wp_insert_comment( $commentdata );
|
||||
$comment_id = wp_insert_comment( $commentdata );
|
||||
|
||||
if ( ! $comment_ID ) {
|
||||
if ( ! $comment_id ) {
|
||||
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
|
||||
|
||||
foreach ( $fields as $field ) {
|
||||
@@ -2299,8 +2299,8 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||
return $commentdata['comment_approved'];
|
||||
}
|
||||
|
||||
$comment_ID = wp_insert_comment( $commentdata );
|
||||
if ( ! $comment_ID ) {
|
||||
$comment_id = wp_insert_comment( $commentdata );
|
||||
if ( ! $comment_id ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2311,13 +2311,13 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||
* @since 1.2.0
|
||||
* @since 4.5.0 The `$commentdata` parameter was added.
|
||||
*
|
||||
* @param int $comment_ID The comment ID.
|
||||
* @param int $comment_id The comment ID.
|
||||
* @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
|
||||
* @param array $commentdata Comment data.
|
||||
*/
|
||||
do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
|
||||
do_action( 'comment_post', $comment_id, $commentdata['comment_approved'], $commentdata );
|
||||
|
||||
return $comment_ID;
|
||||
return $comment_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2325,23 +2325,23 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param int $comment_ID ID of the comment.
|
||||
* @param int $comment_id ID of the comment.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
function wp_new_comment_notify_moderator( $comment_ID ) {
|
||||
$comment = get_comment( $comment_ID );
|
||||
function wp_new_comment_notify_moderator( $comment_id ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
|
||||
// Only send notifications for pending comments.
|
||||
$maybe_notify = ( '0' == $comment->comment_approved );
|
||||
|
||||
/** This filter is documented in wp-includes/comment.php */
|
||||
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );
|
||||
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
|
||||
|
||||
if ( ! $maybe_notify ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return wp_notify_moderator( $comment_ID );
|
||||
return wp_notify_moderator( $comment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2352,11 +2352,11 @@ function wp_new_comment_notify_moderator( $comment_ID ) {
|
||||
* Uses the {@see 'notify_post_author'} filter to determine whether the post author
|
||||
* should be notified when a new comment is added, overriding site setting.
|
||||
*
|
||||
* @param int $comment_ID Comment ID.
|
||||
* @param int $comment_id Comment ID.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
function wp_new_comment_notify_postauthor( $comment_ID ) {
|
||||
$comment = get_comment( $comment_ID );
|
||||
function wp_new_comment_notify_postauthor( $comment_id ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
|
||||
$maybe_notify = get_option( 'comments_notify' );
|
||||
|
||||
@@ -2367,9 +2367,9 @@ function wp_new_comment_notify_postauthor( $comment_ID ) {
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param bool $maybe_notify Whether to notify the post author about the new comment.
|
||||
* @param int $comment_ID The ID of the comment for the notification.
|
||||
* @param int $comment_id The ID of the comment for the notification.
|
||||
*/
|
||||
$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID );
|
||||
$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_id );
|
||||
|
||||
/*
|
||||
* wp_notify_postauthor() checks if notifying the author of their own comment.
|
||||
@@ -2384,7 +2384,7 @@ function wp_new_comment_notify_postauthor( $comment_ID ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return wp_notify_postauthor( $comment_ID );
|
||||
return wp_notify_postauthor( $comment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user