You are here

function _blogapi_get_post in Blog API 7

2 calls to _blogapi_get_post()
blogapi_blogger_get_post in ./blogapi.module
Blogging API callback. Returns a specified blog node.
blogapi_blogger_get_recent_posts in ./blogapi.module
Blogging API callback. Returns the latest few postings in a user's blog. $bodies TRUE <a href="http://movabletype.org/docs/mtmanual_programmatic.html#item_mt%2EgetRece... returns a bandwidth-friendly list</a>.

File

./blogapi.module, line 972
Enable users to post using applications that support XML-RPC blog APIs.

Code

function _blogapi_get_post($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 = $node->body[LANGUAGE_NONE][0]['value'];
    $format = $node->body[LANGUAGE_NONE][0]['format'];
    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;
  }
  return $xmlrpcval;
}