You are here

function _blogapi_get_post in Drupal 4

Same name and namespace in other branches
  1. 5 modules/blogapi/blogapi.module \_blogapi_get_post()
  2. 6 modules/blogapi/blogapi.module \_blogapi_get_post()
2 calls to _blogapi_get_post()
blogapi_blogger_get_post in modules/blogapi.module
Blogging API callback. Returns a specified blog node.
blogapi_blogger_get_recent_posts in modules/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

modules/blogapi.module, line 689
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, NULL, NULL, true),
    'permaLink' => url('node/' . $node->nid, NULL, NULL, true),
  );
  if ($bodies) {
    if ($node->comment == 1) {
      $comment = 2;
    }
    else {
      if ($node->comment == 2) {
        $comment = 1;
      }
    }
    $xmlrpcval['content'] = "<title>{$node->title}</title>{$node->body}";
    $xmlrpcval['description'] = $node->body;

    // Add MT specific fields
    $xmlrpcval['mt_allow_comments'] = (int) $comment;
    $xmlrpcval['mt_convert_breaks'] = $node->format;
  }
  return $xmlrpcval;
}