You are here

function _blogapi_get_post in Drupal 6

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