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

git-svn-id: https://develop.svn.wordpress.org/trunk@9089 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-10-06 19:20:50 +00:00
parent 7b297a3c25
commit 522217d0bc
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.'));