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:
parent
0ba694a607
commit
6b94d84123
15
xmlrpc.php
15
xmlrpc.php
|
@ -2526,6 +2526,19 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
$postdata['post_status'] = 'publish';
|
$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(
|
$resp = array(
|
||||||
'dateCreated' => new IXR_Date($post_date),
|
'dateCreated' => new IXR_Date($post_date),
|
||||||
'userid' => $postdata['post_author'],
|
'userid' => $postdata['post_author'],
|
||||||
|
@ -2551,6 +2564,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
'custom_fields' => $this->get_custom_fields($post_ID)
|
'custom_fields' => $this->get_custom_fields($post_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
|
||||||
|
|
||||||
return $resp;
|
return $resp;
|
||||||
} else {
|
} else {
|
||||||
return new IXR_Error(404, __('Sorry, no such post.'));
|
return new IXR_Error(404, __('Sorry, no such post.'));
|
||||||
|
|
Loading…
Reference in New Issue