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
17
xmlrpc.php
17
xmlrpc.php
|
@ -2525,6 +2525,19 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
if( $postdata['post_status'] === 'future' ) {
|
if( $postdata['post_status'] === 'future' ) {
|
||||||
$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),
|
||||||
|
@ -2550,7 +2563,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
'post_status' => $postdata['post_status'],
|
'post_status' => $postdata['post_status'],
|
||||||
'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