Return enclosure data in mw_getPosts(). Props Otto42. fixes #7772

git-svn-id: http://svn.automattic.com/wordpress/trunk@9089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-10-06 19:20:50 +00:00
parent 0ba694a607
commit 6b94d84123
1 changed files with 16 additions and 1 deletions

View File

@ -2525,6 +2525,19 @@ class wp_xmlrpc_server extends IXR_Server {
if( $postdata['post_status'] === 'future' ) {
$postdata['post_status'] = 'publish';
}
$enclosure = array();
foreach ( (array) get_post_custom($post_ID) as $key => $val) {
if ($key == 'enclosure') {
foreach ( (array) $val as $enc ) {
$encdata = split("\n", $enc);
$enclosure['url'] = trim(htmlspecialchars($encdata[0]));
$enclosure['length'] = trim($encdata[1]);
$enclosure['type'] = trim($encdata[2]);
break 2;
}
}
}
$resp = array(
'dateCreated' => new IXR_Date($post_date),
@ -2550,7 +2563,9 @@ class wp_xmlrpc_server extends IXR_Server {
'post_status' => $postdata['post_status'],
'custom_fields' => $this->get_custom_fields($post_ID)
);
if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
return $resp;
} else {
return new IXR_Error(404, __('Sorry, no such post.'));