function blogapi_format_post_for_xmlrpc in Blog API 7.2
Helper function. Adds appropriate metadata to the XML-RPC return values.
3 calls to blogapi_format_post_for_xmlrpc()
- blogapi_blogger_get_post in modules/
blogapi_blogger/ blogapi_blogger.module - Service callback for blogger.getPost
- blogapi_get_recent_posts in ./
blogapi.module - Helper function. Returns the latest few nodes created by a given user.
- blogapi_metaweblog_get_post in modules/
blogapi_metaweblog/ blogapi_metaweblog.module - Service callback for metaWeblog.getPost
File
- ./
blogapi.module, line 299 - Enable users to post using applications that support BlogAPIs.
Code
function blogapi_format_post_for_xmlrpc($node, $bodies = TRUE) {
$xmlrpcval = array(
'userid' => $node->name,
'dateCreated' => xmlrpc_date($node->created),
'title' => $node->title,
'postid' => $node->nid,
'link' => url('node/' . $node->nid, array(
'absolute' => TRUE,
)),
'permaLink' => url('node/' . $node->nid, array(
'absolute' => TRUE,
)),
);
if ($bodies) {
$body = !empty($node->body) ? $node->body[LANGUAGE_NONE][0]['value'] : '';
$format = !empty($node->body) ? $node->body[LANGUAGE_NONE][0]['format'] : 0;
if ($node->comment == 1) {
$comment = 2;
}
elseif ($node->comment == 2) {
$comment = 1;
}
$xmlrpcval['content'] = "<title>{$node->title}</title>{$body}";
$xmlrpcval['description'] = $body;
// Add MT specific fields.
$xmlrpcval['mt_allow_comments'] = (int) $comment;
$xmlrpcval['mt_convert_breaks'] = $format;
}
// Allow altering the XML-RPC response.
drupal_alter('blogapi_xmlrpc_response', $xmlrpcval);
return $xmlrpcval;
}