From 29df2d591f7783b94582f3f76dc7f6cad2fb1398 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 20 Jan 2025 14:30:02 +0000 Subject: [PATCH] Coding Standards: Rename the `$isPrimary` variable in `wp_xmlrpc_server` methods. This resolves a few WPCS warnings: {{{ Variable "$isPrimary" is not in valid snake_case format, try "$is_primary" }}} Additionally, this commit renames `$catids` to `$cat_ids` for consistency. Follow-up to [1671]. See #62279. git-svn-id: https://develop.svn.wordpress.org/trunk@59665 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-xmlrpc-server.php | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 458ffbb0a5..14a8843e4f 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -6087,9 +6087,9 @@ class wp_xmlrpc_server extends IXR_Server { $post_modified_gmt = $this->_convert_date_gmt( $postdata['post_modified_gmt'], $postdata['post_modified'] ); $categories = array(); - $catids = wp_get_post_categories( $post_id ); - foreach ( $catids as $catid ) { - $categories[] = get_cat_name( $catid ); + $cat_ids = wp_get_post_categories( $post_id ); + foreach ( $cat_ids as $cat_id ) { + $categories[] = get_cat_name( $cat_id ); } $tagnames = array(); @@ -6239,9 +6239,9 @@ class wp_xmlrpc_server extends IXR_Server { $post_modified_gmt = $this->_convert_date_gmt( $entry['post_modified_gmt'], $entry['post_modified'] ); $categories = array(); - $catids = wp_get_post_categories( $entry['ID'] ); - foreach ( $catids as $catid ) { - $categories[] = get_cat_name( $catid ); + $cat_ids = wp_get_post_categories( $entry['ID'] ); + foreach ( $cat_ids as $cat_id ) { + $categories[] = get_cat_name( $cat_id ); } $tagnames = array(); @@ -6639,16 +6639,16 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'mt.getPostCategories', $args, $this ); $categories = array(); - $catids = wp_get_post_categories( (int) $post_id ); + $cat_ids = wp_get_post_categories( (int) $post_id ); // First listed category will be the primary category. - $isPrimary = true; - foreach ( $catids as $catid ) { + $is_primary = true; + foreach ( $cat_ids as $cat_id ) { $categories[] = array( - 'categoryName' => get_cat_name( $catid ), - 'categoryId' => (string) $catid, - 'isPrimary' => $isPrimary, + 'categoryName' => get_cat_name( $cat_id ), + 'categoryId' => (string) $cat_id, + 'isPrimary' => $is_primary, ); - $isPrimary = false; + $is_primary = false; } return $categories; @@ -6693,12 +6693,12 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } - $catids = array(); + $cat_ids = array(); foreach ( $categories as $cat ) { - $catids[] = $cat['categoryId']; + $cat_ids[] = $cat['categoryId']; } - wp_set_post_categories( $post_id, $catids ); + wp_set_post_categories( $post_id, $cat_ids ); return true; }