Skip to content

Commit 29df2d5

Browse files
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
1 parent 7fe8f1c commit 29df2d5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/wp-includes/class-wp-xmlrpc-server.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6087,9 +6087,9 @@ public function mw_getPost( $args ) {
60876087
$post_modified_gmt = $this->_convert_date_gmt( $postdata['post_modified_gmt'], $postdata['post_modified'] );
60886088

60896089
$categories = array();
6090-
$catids = wp_get_post_categories( $post_id );
6091-
foreach ( $catids as $catid ) {
6092-
$categories[] = get_cat_name( $catid );
6090+
$cat_ids = wp_get_post_categories( $post_id );
6091+
foreach ( $cat_ids as $cat_id ) {
6092+
$categories[] = get_cat_name( $cat_id );
60936093
}
60946094

60956095
$tagnames = array();
@@ -6239,9 +6239,9 @@ public function mw_getRecentPosts( $args ) {
62396239
$post_modified_gmt = $this->_convert_date_gmt( $entry['post_modified_gmt'], $entry['post_modified'] );
62406240

62416241
$categories = array();
6242-
$catids = wp_get_post_categories( $entry['ID'] );
6243-
foreach ( $catids as $catid ) {
6244-
$categories[] = get_cat_name( $catid );
6242+
$cat_ids = wp_get_post_categories( $entry['ID'] );
6243+
foreach ( $cat_ids as $cat_id ) {
6244+
$categories[] = get_cat_name( $cat_id );
62456245
}
62466246

62476247
$tagnames = array();
@@ -6639,16 +6639,16 @@ public function mt_getPostCategories( $args ) {
66396639
do_action( 'xmlrpc_call', 'mt.getPostCategories', $args, $this );
66406640

66416641
$categories = array();
6642-
$catids = wp_get_post_categories( (int) $post_id );
6642+
$cat_ids = wp_get_post_categories( (int) $post_id );
66436643
// First listed category will be the primary category.
6644-
$isPrimary = true;
6645-
foreach ( $catids as $catid ) {
6644+
$is_primary = true;
6645+
foreach ( $cat_ids as $cat_id ) {
66466646
$categories[] = array(
6647-
'categoryName' => get_cat_name( $catid ),
6648-
'categoryId' => (string) $catid,
6649-
'isPrimary' => $isPrimary,
6647+
'categoryName' => get_cat_name( $cat_id ),
6648+
'categoryId' => (string) $cat_id,
6649+
'isPrimary' => $is_primary,
66506650
);
6651-
$isPrimary = false;
6651+
$is_primary = false;
66526652
}
66536653

66546654
return $categories;
@@ -6693,12 +6693,12 @@ public function mt_setPostCategories( $args ) {
66936693
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
66946694
}
66956695

6696-
$catids = array();
6696+
$cat_ids = array();
66976697
foreach ( $categories as $cat ) {
6698-
$catids[] = $cat['categoryId'];
6698+
$cat_ids[] = $cat['categoryId'];
66996699
}
67006700

6701-
wp_set_post_categories( $post_id, $catids );
6701+
wp_set_post_categories( $post_id, $cat_ids );
67026702

67036703
return true;
67046704
}

0 commit comments

Comments
 (0)