mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-02 19:54:28 +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:
@@ -3720,25 +3720,25 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$username = $args[1];
|
||||
$password = $args[2];
|
||||
$comment_ID = (int) $args[3];
|
||||
$comment_id = (int) $args[3];
|
||||
|
||||
$user = $this->login( $username, $password );
|
||||
if ( ! $user ) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
if ( ! get_comment( $comment_ID ) ) {
|
||||
if ( ! get_comment( $comment_id ) ) {
|
||||
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
|
||||
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
|
||||
return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) );
|
||||
}
|
||||
|
||||
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
||||
do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this );
|
||||
|
||||
$status = wp_delete_comment( $comment_ID );
|
||||
$status = wp_delete_comment( $comment_id );
|
||||
|
||||
if ( $status ) {
|
||||
/**
|
||||
@@ -3746,10 +3746,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param int $comment_ID ID of the deleted comment.
|
||||
* @param int $comment_id ID of the deleted comment.
|
||||
* @param array $args An array of arguments to delete the comment.
|
||||
*/
|
||||
do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||
do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||
}
|
||||
|
||||
return $status;
|
||||
@@ -3787,7 +3787,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$username = $args[1];
|
||||
$password = $args[2];
|
||||
$comment_ID = (int) $args[3];
|
||||
$comment_id = (int) $args[3];
|
||||
$content_struct = $args[4];
|
||||
|
||||
$user = $this->login( $username, $password );
|
||||
@@ -3795,18 +3795,18 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
if ( ! get_comment( $comment_ID ) ) {
|
||||
if ( ! get_comment( $comment_id ) ) {
|
||||
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
|
||||
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
|
||||
return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) );
|
||||
}
|
||||
|
||||
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
||||
do_action( 'xmlrpc_call', 'wp.editComment', $args, $this );
|
||||
$comment = array(
|
||||
'comment_ID' => $comment_ID,
|
||||
'comment_ID' => $comment_id,
|
||||
);
|
||||
|
||||
if ( isset( $content_struct['status'] ) ) {
|
||||
@@ -3858,10 +3858,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param int $comment_ID ID of the updated comment.
|
||||
* @param int $comment_id ID of the updated comment.
|
||||
* @param array $args An array of arguments to update the comment.
|
||||
*/
|
||||
do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||
do_action( 'xmlrpc_call_success_wp_editComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3999,12 +3999,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
||||
do_action( 'xmlrpc_call', 'wp.newComment', $args, $this );
|
||||
|
||||
$comment_ID = wp_new_comment( $comment, true );
|
||||
if ( is_wp_error( $comment_ID ) ) {
|
||||
return new IXR_Error( 403, $comment_ID->get_error_message() );
|
||||
$comment_id = wp_new_comment( $comment, true );
|
||||
if ( is_wp_error( $comment_id ) ) {
|
||||
return new IXR_Error( 403, $comment_id->get_error_message() );
|
||||
}
|
||||
|
||||
if ( ! $comment_ID ) {
|
||||
if ( ! $comment_id ) {
|
||||
return new IXR_Error( 403, __( 'Something went wrong.' ) );
|
||||
}
|
||||
|
||||
@@ -4013,12 +4013,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param int $comment_ID ID of the new comment.
|
||||
* @param int $comment_id ID of the new comment.
|
||||
* @param array $args An array of new comment arguments.
|
||||
*/
|
||||
do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||
do_action( 'xmlrpc_call_success_wp_newComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||
|
||||
return $comment_ID;
|
||||
return $comment_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7040,10 +7040,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
'remote_source_original'
|
||||
);
|
||||
|
||||
$comment_ID = wp_new_comment( $commentdata );
|
||||
$comment_id = wp_new_comment( $commentdata );
|
||||
|
||||
if ( is_wp_error( $comment_ID ) ) {
|
||||
return $this->pingback_error( 0, $comment_ID->get_error_message() );
|
||||
if ( is_wp_error( $comment_id ) ) {
|
||||
return $this->pingback_error( 0, $comment_id->get_error_message() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7051,9 +7051,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
*
|
||||
* @since 0.71
|
||||
*
|
||||
* @param int $comment_ID Comment ID.
|
||||
* @param int $comment_id Comment ID.
|
||||
*/
|
||||
do_action( 'pingback_post', $comment_ID );
|
||||
do_action( 'pingback_post', $comment_id );
|
||||
|
||||
/* translators: 1: URL of the page linked from, 2: URL of the page linked to. */
|
||||
return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $pagelinkedfrom, $pagelinkedto );
|
||||
|
||||
Reference in New Issue
Block a user