Changeset 4814

Show
Ignore:
Timestamp:
01/26/07 20:05:53 (2 years ago)
Author:
ryan
Message:

WP XML-RPC API enhancements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/xmlrpc.php

    r4807 r4814  
    2323    <homePageLink><?php bloginfo_rss('url') ?></homePageLink> 
    2424    <apis> 
     25      <api name="WordPress" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    2526      <api name="Movable Type" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    2627      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
     
    184185            $link = post_permalink($page->ID); 
    185186 
     187            // Get info the page parent if there is one. 
     188            $parent_title = ""; 
     189            if(!empty($page->post_parent)) { 
     190                $parent = get_page($page->post_parent); 
     191                $parent_title = $parent->post_title; 
     192            } 
     193 
    186194            // Determine comment and ping settings. 
    187195            $allow_comments = ("open" == $page->comment_status) ? 1 : 0; 
     
    197205            } 
    198206 
    199             // Get the users nicename
    200             $nicename = get_profile("user_nicename", $username); 
     207            // Get the author info
     208            $author = get_userdata($page->post_author); 
    201209 
    202210            $page_struct = array( 
    203                 "dateCreated"       => new IXR_Date($page_date), 
    204                 "userid"            => $page->post_author, 
    205                 "page_id"           => $page->ID, 
    206                 "page_status"       => $page->post_status, 
    207                 "description"       => $full_page["main"], 
    208                 "title"             => $page->post_title, 
    209                 "link"              => $link, 
    210                 "permaLink"         => $link, 
    211                 "categories"        => $categories, 
    212                 "excerpt"           => $page->post_excerpt, 
    213                 "text_more"         => $full_page["extended"], 
    214                 "mt_allow_comments" => $allow_comments, 
    215                 "mt_allow_pings"    => $allow_pings, 
    216                 "wp_slug"           => $page->post_name, 
    217                 "wp_password"       => $page->post_password, 
    218                 "wp_author"         => $nicename, 
    219                 "wp_page_parent_id" => $page->post_parent, 
    220                 "wp_page_order"     => $page->menu_order 
     211                "dateCreated"           => new IXR_Date($page_date), 
     212                "userid"                => $page->post_author, 
     213                "page_id"               => $page->ID, 
     214                "page_status"           => $page->post_status, 
     215                "description"           => $full_page["main"], 
     216                "title"                 => $page->post_title, 
     217                "link"                  => $link, 
     218                "permaLink"             => $link, 
     219                "categories"            => $categories, 
     220                "excerpt"               => $page->post_excerpt, 
     221                "text_more"             => $full_page["extended"], 
     222                "mt_allow_comments"     => $allow_comments, 
     223                "mt_allow_pings"        => $allow_pings, 
     224                "wp_slug"               => $page->post_name, 
     225                "wp_password"           => $page->post_password, 
     226                "wp_author"             => $author->user_nicename, 
     227                "wp_page_parent_id"     => $page->post_parent, 
     228                "wp_page_parent_title"  => $parent_title, 
     229                "wp_page_order"         => $page->menu_order, 
     230                "wp_author_username"    => $author->user_login 
    221231            ); 
    222232 
     
    409419        $page_list = $wpdb->get_results(" 
    410420            SELECT ID page_id, 
    411                 post_title page_title 
     421                post_title page_title, 
     422                post_parent page_parent_id 
    412423            FROM {$wpdb->posts} 
    413424            WHERE post_type = 'page' 
     
    11551166        $post = get_extended($postdata['post_content']); 
    11561167        $link = post_permalink($postdata['ID']); 
     1168 
     1169        // Get the author info. 
     1170        $author = get_userdata($postdata['post_author']); 
    11571171 
    11581172        $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0; 
     
    11731187          'mt_text_more' => $post['extended'], 
    11741188          'mt_allow_comments' => $allow_comments, 
    1175           'mt_allow_pings' => $allow_pings 
     1189          'mt_allow_pings' => $allow_pings, 
     1190          'wp_slug' => $postdata['post_name'], 
     1191          'wp_password' => $postdata['post_password'], 
     1192          'wp_author' => $author->user_nicename, 
     1193          'wp_author_username'  => $author->user_login 
    11761194        ); 
    11771195 
     
    12651283 
    12661284        // FIXME: can we avoid using direct SQL there? 
    1267         if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) { 
     1285        if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name,category_parent FROM $wpdb->categories", ARRAY_A)) { 
    12681286            foreach ($cats as $cat) { 
    12691287                $struct['categoryId'] = $cat['cat_ID']; 
     1288                $struct['parentId'] = $cat['category_parent']; 
    12701289                $struct['description'] = $cat['cat_name']; 
    12711290                $struct['categoryName'] = $cat['cat_name'];