mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Add mt_keywords support. Props redsweater. fixes #900
git-svn-id: http://svn.automattic.com/wordpress/trunk@5278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
47de90d17a
commit
798be8a8e2
32
xmlrpc.php
32
xmlrpc.php
@ -989,6 +989,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_excerpt = $content_struct['mt_excerpt'];
|
||||
$post_more = $content_struct['mt_text_more'];
|
||||
|
||||
$tags_input = $content_struct['mt_keywords'];
|
||||
|
||||
$comment_status = (!isset($content_struct['mt_allow_comments'])) ?
|
||||
get_option('default_comment_status')
|
||||
: $content_struct['mt_allow_comments'];
|
||||
@ -1027,7 +1029,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
}
|
||||
|
||||
// We've got all the data -- post it:
|
||||
$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');
|
||||
$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');
|
||||
|
||||
$post_ID = wp_insert_post($postdata);
|
||||
|
||||
@ -1171,6 +1173,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_more = $content_struct['mt_text_more'];
|
||||
$post_status = $publish ? 'publish' : 'draft';
|
||||
|
||||
$tags_input = $content_struct['mt_keywords'];
|
||||
|
||||
if ( ('publish' == $post_status) ) {
|
||||
if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') )
|
||||
return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.'));
|
||||
@ -1202,7 +1206,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
}
|
||||
|
||||
// We've got all the data -- post it:
|
||||
$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author');
|
||||
$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input');
|
||||
|
||||
$result = wp_update_post($newpost);
|
||||
if (!$result) {
|
||||
@ -1243,6 +1247,17 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$categories[] = get_cat_name($catid);
|
||||
}
|
||||
|
||||
$tagnames = array();
|
||||
$tags = get_post_tags( $post_ID );
|
||||
if ( !empty( $tags ) ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$tagnames[] = $tag->cat_name;
|
||||
}
|
||||
$tagnames = implode( ', ', $tagnames );
|
||||
} else {
|
||||
$tagnames = '';
|
||||
}
|
||||
|
||||
$post = get_extended($postdata['post_content']);
|
||||
$link = post_permalink($postdata['ID']);
|
||||
|
||||
@ -1267,6 +1282,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
'mt_text_more' => $post['extended'],
|
||||
'mt_allow_comments' => $allow_comments,
|
||||
'mt_allow_pings' => $allow_pings,
|
||||
'mt_keywords' => $tagnames,
|
||||
'wp_slug' => $postdata['post_name'],
|
||||
'wp_password' => $postdata['post_password'],
|
||||
'wp_author_id' => $author->ID,
|
||||
@ -1310,6 +1326,17 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$categories[] = get_cat_name($catid);
|
||||
}
|
||||
|
||||
$tagnames = array();
|
||||
$tags = get_post_tags( $entry['ID'] );
|
||||
if ( !empty( $tags ) ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$tagnames[] = $tag->cat_name;
|
||||
}
|
||||
$tagnames = implode( ', ', $tagnames );
|
||||
} else {
|
||||
$tagnames = '';
|
||||
}
|
||||
|
||||
$post = get_extended($entry['post_content']);
|
||||
$link = post_permalink($entry['ID']);
|
||||
|
||||
@ -1334,6 +1361,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
'mt_text_more' => $post['extended'],
|
||||
'mt_allow_comments' => $allow_comments,
|
||||
'mt_allow_pings' => $allow_pings,
|
||||
'mt_keywords' => $tagnames,
|
||||
'wp_slug' => $entry['post_name'],
|
||||
'wp_password' => $entry['post_password'],
|
||||
'wp_author_id' => $author->ID,
|
||||
|
Loading…
Reference in New Issue
Block a user