Coding Standards: Rename $comment_post_ID and $comment_author_IP variables in various files.

This fixes two WPCS warnings:
* `Variable "$comment_post_ID" is not in valid snake_case format`
* `Variable "$comment_author_IP" is not in valid snake_case format`

While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.

Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:

* `edit_comment`
* `comment_id_not_found`
* `comment_closed`
* `comment_on_trash`
* `comment_on_draft`
* `comment_on_password_protected`
* `pre_comment_on_post`

The change does not affect parameters for functions receiving an array of comment data:

* `wp_insert_comment()`
* `wp_new_comment()`
* `wp_update_comment()`
* `wp_handle_comment_submission()`

The associated array keys still match the database fields: `comment_post_ID` and `comment_author_IP`.

Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],

See #55647, #56244.

git-svn-id: https://develop.svn.wordpress.org/trunk@53723 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-07-19 16:17:56 +00:00
parent eaad35de6b
commit 788a070963
5 changed files with 129 additions and 50 deletions
+6 -3
View File
@@ -7013,7 +7013,7 @@ class wp_xmlrpc_server extends IXR_Server {
$context = '[…] ' . esc_html( $excerpt ) . ' […]';
$pagelinkedfrom = $this->escape( $pagelinkedfrom );
$comment_post_ID = (int) $post_ID;
$comment_post_id = (int) $post_ID;
$comment_author = $title;
$comment_author_email = '';
$this->escape( $comment_author );
@@ -7022,8 +7022,11 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape( $comment_content );
$comment_type = 'pingback';
$commentdata = compact(
'comment_post_ID',
$commentdata = array(
'comment_post_ID' => $comment_post_id,
);
$commentdata += compact(
'comment_author',
'comment_author_url',
'comment_author_email',