Make WordPress Core


Ignore:
Timestamp:
01/20/2025 02:30:02 PM (19 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r59664 r59665  
    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
     
    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
     
    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
     
    66946694                }
    66956695
    6696                 $catids = array();
     6696                $cat_ids = array();
    66976697                foreach ( $categories as $cat ) {
    6698                         $catids[] = $cat['categoryId'];
    6699                 }
    6700 
    6701                 wp_set_post_categories( $post_id, $catids );
     6698                        $cat_ids[] = $cat['categoryId'];
     6699                }
     6700
     6701                wp_set_post_categories( $post_id, $cat_ids );
    67026702
    67036703                return true;
Note: See TracChangeset for help on using the changeset viewer.