Coding Standards: Rename the $isPrimary variable in wp_xmlrpc_server methods.
Some checks are pending
Cleanup Pull Requests / Clean up pull requests (push) Waiting to run
Coding Standards / PHP coding standards (push) Waiting to run
Coding Standards / JavaScript coding standards (push) Waiting to run
Coding Standards / Slack Notifications (push) Blocked by required conditions
Coding Standards / Failed workflow tasks (push) Blocked by required conditions
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Waiting to run
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Waiting to run
End-to-end Tests / Slack Notifications (push) Blocked by required conditions
End-to-end Tests / Failed workflow tasks (push) Blocked by required conditions
JavaScript Tests / QUnit Tests (push) Waiting to run
JavaScript Tests / Slack Notifications (push) Blocked by required conditions
JavaScript Tests / Failed workflow tasks (push) Blocked by required conditions
Performance Tests / Single site (push) Waiting to run
Performance Tests / Multisite (push) Waiting to run
Performance Tests / Slack Notifications (push) Blocked by required conditions
Performance Tests / Failed workflow tasks (push) Blocked by required conditions
PHP Compatibility / Check PHP compatibility (push) Waiting to run
PHP Compatibility / Slack Notifications (push) Blocked by required conditions
PHP Compatibility / Failed workflow tasks (push) Blocked by required conditions
PHPUnit Tests / PHP 7.2 (push) Waiting to run
PHPUnit Tests / PHP 7.3 (push) Waiting to run
PHPUnit Tests / PHP 7.4 (push) Waiting to run
PHPUnit Tests / PHP 8.0 (push) Waiting to run
PHPUnit Tests / PHP 8.1 (push) Waiting to run
PHPUnit Tests / PHP 8.2 (push) Waiting to run
PHPUnit Tests / PHP 8.3 (push) Waiting to run
PHPUnit Tests / PHP 8.4 (push) Waiting to run
PHPUnit Tests / html-api-html5lib-tests (push) Waiting to run
PHPUnit Tests / Slack Notifications (push) Blocked by required conditions
PHPUnit Tests / Failed workflow tasks (push) Blocked by required conditions
Test Build Processes / Core running from build (push) Waiting to run
Test Build Processes / Core running from src (push) Waiting to run
Test Build Processes / Gutenberg running from build (push) Waiting to run
Test Build Processes / Gutenberg running from src (push) Waiting to run
Test Build Processes / Slack Notifications (push) Blocked by required conditions
Test Build Processes / Failed workflow tasks (push) Blocked by required conditions

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
This commit is contained in:
Sergey Biryukov 2025-01-20 14:30:02 +00:00
parent 7fe8f1cc6f
commit 29df2d591f

View File

@ -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;
}