Make WordPress Core

Ticket #16003: wp_category_ids-2.diff

File wp_category_ids-2.diff, 2.1 KB (added by ericmann, 14 years ago)

New patch sends/receives category IDs as ints rather than strings.

  • class-wp-xmlrpc-server.php

     
    23032303                                }
    23042304                        }
    23052305                }
     2306                if ( isset( $content_struct['wp_category_ids'] ) ) {
     2307                        $catids = array_map( 'intval', $content_struct['wp_category_ids'] );
     2308                        logIO('O', 'Post cat ids: ' . var_export($catids, true));
    23062309
     2310                        if ( is_array($catids) ) {
     2311                                $post_category = array_merge( $post_category, array_diff( $catids, $post_category ) );
     2312                        }
     2313                }
     2314
    23072315                // We've got all the data -- post it:
    23082316                $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template');
    23092317
     
    25672575                                }
    25682576                        }
    25692577                }
     2578                if ( isset( $content_struct['wp_category_ids'] ) ) {
     2579                        $catids = array_map( 'intval', $content_struct['wp_category_ids'] );
     2580                        logIO('O', 'Post cat ids: ' . var_export($catids, true));
    25702581
     2582                        if ( is_array($catids) ) {
     2583                                $post_category = array_merge( $post_category, array_diff( $catids, $post_category ) );
     2584                        }
     2585                }
     2586
    25712587                $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null;
    25722588                $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null;
    25732589
     
    27552771                                // commented out because no other tool seems to use this
    27562772                                //            'content' => $entry['post_content'],
    27572773                                'categories' => $categories,
     2774                                'wp_category_ids' => array_map( 'intval', $catids ),
    27582775                                'mt_excerpt' => $postdata['post_excerpt'],
    27592776                                'mt_text_more' => $post['extended'],
    27602777                                'mt_allow_comments' => $allow_comments,
     
    28652882                                // commented out because no other tool seems to use this
    28662883                                // 'content' => $entry['post_content'],
    28672884                                'categories' => $categories,
     2885                                'wp_category_ids' => array_map( 'intval', $catids ),
    28682886                                'mt_excerpt' => $entry['post_excerpt'],
    28692887                                'mt_text_more' => $post['extended'],
    28702888                                'mt_allow_comments' => $allow_comments,