- Replaced the bloggerapi module by the blogapi module writen by James.
parent
4317747eee
commit
2f639017c4
|
@ -0,0 +1,332 @@
|
|||
<?php
|
||||
|
||||
// $Id$
|
||||
|
||||
function blogapi_help($section) {
|
||||
$output = '';
|
||||
switch ($section) {
|
||||
case 'admin/help#blogapi':
|
||||
$output .= t('This module adds support for several XML-RPC based blogging APIs. Specifically, it currently implements the %bloggerAPI, %metaweblogAPI, and most of the %moveabletype extensions. This allows users to contribute to drupal using external GUI applications, which can often offer richer functionality that online forms based editing', array('%bloggerAPI' => '<a href="http://www.blogger.com/developers/api/1_docs/">Blogger API</a>', '%metaweblogAPI' => '<a href="http://www.xmlrpc.com/metaWeblogApi">MetaWeblog API</a>', '%moveabletype' => '<a href="http://www.movabletype.org/docs/mtmanual_programmatic.html">Moveable Type API</a>'));
|
||||
break;
|
||||
case 'admin/system/modules#description':
|
||||
$output .= t('Enable users to post using applications that support XML-RPC blog APIs');
|
||||
break;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function blogapi_xmlrpc() {
|
||||
$methods = array('blogger.getUsersBlogs' => array('function' => 'blogapi_get_users_blogs'),
|
||||
'blogger.newPost' => array('function' => 'blogapi_new_post'),
|
||||
'blogger.editPost' => array('function' => 'blogapi_edit_post'),
|
||||
'blogger.deletePost' => array('function' => 'blogapi_delete_post'),
|
||||
'blogger.getRecentPosts' => array('function' => 'blogapi_get_recent_posts'),
|
||||
'metaWeblog.newPost' => array('function' => 'blogapi_new_post'),
|
||||
'metaWeblog.editPost' => array('function' => 'blogapi_edit_post'),
|
||||
'metaWeblog.getPost' => array('function' => 'blogapi_get_post'),
|
||||
'metaWeblog.newMediaObject' => array('function' => 'blogapi_new_media_object'),
|
||||
'metaWeblog.getCategories' => array('function' => 'blogapi_get_categories'),
|
||||
'metaWeblog.getRecentPosts' => array('function' => 'blogapi_get_recent_posts'),
|
||||
'mt.getCategoryList' => array('function' => 'blogapi_get_category_list'),
|
||||
'mt.getPostCategories' => array('function' => 'blogapi_get_post_categories'),
|
||||
'mt.setPostCategories' => array('function' => 'blogapi_set_post_categories')
|
||||
);
|
||||
|
||||
return $methods;
|
||||
}
|
||||
|
||||
/** api functions */
|
||||
|
||||
function blogapi_get_users_blogs($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if ($user->uid) {
|
||||
$struct = new xmlrpcval(array('url' => new xmlrpcval(url('blog/' . $user->uid)),
|
||||
'blogid' => new xmlrpcval($user->uid),
|
||||
'blogName' => new xmlrpcval($user->name . "'s blog")),
|
||||
'struct');
|
||||
$resp = new xmlrpcval(array($struct), "array");
|
||||
return new xmlrpcresp($resp);
|
||||
}
|
||||
else {
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
}
|
||||
|
||||
function blogapi_get_user_info($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if ($user->uid) {
|
||||
$struct = new xmlrpcval(array('userid' => new xmlrpcval($user->uid, 'string'),
|
||||
'lastname' => new xmlrpcval(substr($user->name, strrpos($user->name, " ") + 1), 'string'),
|
||||
'firstname' => new xmlrpcval(substr($user->name, 0, strrpos($user->name, " ")), 'string'),
|
||||
'nickname' => new xmlrpcval($user->name, 'string'),
|
||||
'email' => new xmlrpcval($user->mail, 'string'),
|
||||
'url' => new xmlrpcval(url('blog/view/' . $user->uid), 'string')),
|
||||
'struct');
|
||||
return new xmlrpcresp($struct);
|
||||
}
|
||||
else {
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
}
|
||||
|
||||
function blogapi_new_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$promote = variable_get("node_promote_blog", 0);
|
||||
$comment = variable_get("node_comment_blog", 2);
|
||||
$moderate = variable_get("node_moderate_blog", 0);
|
||||
$revision = variable_get("node_revision_blog", 0);
|
||||
|
||||
// check for bloggerAPI vs. metaWeblogAPI
|
||||
if (is_array($params[3])) {
|
||||
$title = $params[3]['title'];
|
||||
$body = $params[3]['description'];
|
||||
}
|
||||
else {
|
||||
$title = blogapi_blogger_title($params[3]);
|
||||
$body = $params[3];
|
||||
}
|
||||
|
||||
$node = node_validate(array('type' => 'blog',
|
||||
'uid' => $user->uid,
|
||||
'name' => $user->name,
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
'status' => $params[4],
|
||||
'promote' => $promote,
|
||||
'comment' => $comment,
|
||||
'moderate' => $moderate,
|
||||
'revision' => $revision
|
||||
), $error);
|
||||
|
||||
if (count($error) > 0) {
|
||||
return blogapi_error($error);
|
||||
}
|
||||
|
||||
if (!node_access("create", $node)) {
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
|
||||
$nid = node_save($node);
|
||||
if ($nid) {
|
||||
watchdog("special", "$node->type: added '$node->title' using blog API", l(t("view post"), "node/view/$nid"));
|
||||
return new xmlrpcresp(new xmlrpcval($nid, 'string'));
|
||||
}
|
||||
|
||||
return blogapi_error(t('error storing post'));
|
||||
}
|
||||
|
||||
function blogapi_edit_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$node = node_load(array('nid' => $params[0]));
|
||||
if (!$node) {
|
||||
return blogapi_error(message_na());
|
||||
}
|
||||
|
||||
if (!node_access('update', $node)){
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
|
||||
// check for bloggerAPI vs. metaWeblogAPI
|
||||
if (is_array($params[3])) {
|
||||
$title = $params[3]['title'];
|
||||
$body = $params[3]['description'];
|
||||
}
|
||||
else {
|
||||
$title = blogapi_blogger_title($params[3]);
|
||||
$body = $params[3];
|
||||
}
|
||||
|
||||
$node->title = $title;
|
||||
$node->body = $body;
|
||||
$node->status = $params[4];
|
||||
$node = node_validate($node, $error);
|
||||
|
||||
if (count($error) > 0) {
|
||||
return blogapi_error($error);
|
||||
}
|
||||
|
||||
$nid = node_save($node);
|
||||
if ($nid) {
|
||||
watchdog("special", "$node->type: updated '$node->title' using blog API", l(t("view post"), "node/view/$nid"));
|
||||
return new xmlrpcresp(new xmlrpcval(true, "boolean"));
|
||||
}
|
||||
|
||||
return blogapi_error(t('error storing node'));
|
||||
}
|
||||
|
||||
function blogapi_get_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$node = node_load(array('nid' => $params[0]));
|
||||
$blog = new xmlrpcval(array('userid' => new xmlrpcval($node->name, 'string'),
|
||||
'dateCreated' => new xmlrpcval(iso8601_encode($node->created), "dateTime.iso8601"),
|
||||
'title' => new xmlrpcval($node->title, 'string'),
|
||||
'description' => new xmlrpcval($node->body, 'string'),
|
||||
'postid' => new xmlrpcval($node->nid, 'string')),
|
||||
'struct');
|
||||
|
||||
return new xmlrpcresp($blog);
|
||||
}
|
||||
|
||||
function blogapi_delete_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
|
||||
$user = blogapi_validate_user($params[2], $params[3]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$ret = node_delete(array('nid' => $params[1], 'confirm' => 1));
|
||||
return new xmlrpcresp(new xmlrpcval(true, "boolean"));
|
||||
}
|
||||
|
||||
function blogapi_new_media_object($req_params) {
|
||||
return blogapi_error('not implemented');
|
||||
}
|
||||
|
||||
function blogapi_get_category_list($req_params) {
|
||||
if (!function_exists('taxonomy_get_vocabularies')) {
|
||||
return blogapi_error('no categories');
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
$vocabularies = taxonomy_get_vocabularies('blog');
|
||||
foreach ($vocabularies as $vocabulary) {
|
||||
$terms = taxonomy_get_tree($vocabulary->vid);
|
||||
foreach ($terms as $term) {
|
||||
$term_name = $term->name;
|
||||
foreach (taxonomy_get_parents($term->tid) as $parent) {
|
||||
$term_name = $parent->name . '/' . $term_name;
|
||||
}
|
||||
$categories[] = new xmlrpcval(array('categoryName' => new xmlrpcval($term_name, 'string'),
|
||||
'categoryId' => new xmlrpcval($term->tid, 'string')),
|
||||
'struct');
|
||||
}
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval($categories, "array"));
|
||||
}
|
||||
|
||||
function blogapi_get_post_categories($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$terms = taxonomy_node_get_terms($params[0]);
|
||||
$categories = array();
|
||||
foreach($terms as $term) {
|
||||
$term_name = $term->name;
|
||||
foreach (taxonomy_get_parents($term->tid) as $parent) {
|
||||
$term_name = $parent->name . '/' . $term_name;
|
||||
}
|
||||
$categories[] = new xmlrpcval(array('categoryName' => new xmlrpcval($term_name, 'string'),
|
||||
'categoryId' => new xmlrpcval($term->tid, 'string'),
|
||||
'isPrimary' => new xmlrpcval(true, 'boolean')),
|
||||
'struct');
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval($categories, "array"));
|
||||
}
|
||||
|
||||
function blogapi_set_post_categories($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$nid = $params[0];
|
||||
$terms = array();
|
||||
foreach ($params[3] as $category) {
|
||||
$terms[] = $category['categoryId']->scalarval();
|
||||
}
|
||||
taxonomy_node_save($nid, $terms);
|
||||
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
|
||||
}
|
||||
|
||||
function blogapi_get_recent_posts($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$res = db_query_range("SELECT n.nid, n.title, n.body, n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = 'blog' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]);
|
||||
while ($blog = db_fetch_object($res)) {
|
||||
$blogs[] = new xmlrpcval(array('userid' => new xmlrpcval($blog->name, 'string'),
|
||||
'dateCreated' => new xmlrpcval(iso8601_encode($blog->created), "dateTime.iso8601"),
|
||||
'title' => new xmlrpcval($blog->title, 'string'),
|
||||
'description' => new xmlrpcval($blog->body, 'string'),
|
||||
'postid' => new xmlrpcval($blog->nid, 'string')),
|
||||
'struct');
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval($blogs, "array"));
|
||||
}
|
||||
|
||||
/** helper functions */
|
||||
|
||||
function blogapi_convert($params) {
|
||||
$cparams = array();
|
||||
$num_params= $params->getNumParams();
|
||||
|
||||
for ($i = 0; $i < $num_params; $i++) {
|
||||
$sn = $params->getParam($i);
|
||||
$cparams[] = $sn->getval();
|
||||
}
|
||||
|
||||
return $cparams;
|
||||
}
|
||||
|
||||
function blogapi_error($message) {
|
||||
global $xmlrpcusererr;
|
||||
|
||||
return new xmlrpcresp(0, $xmlrpcusererr + 1, $message);
|
||||
}
|
||||
|
||||
function blogapi_validate_user($username, $password) {
|
||||
global $user;
|
||||
|
||||
$user = user_load(array('name' => $username, 'pass' => $password, 'status' => 1));
|
||||
|
||||
if (!user_access('access blog API')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
function blogapi_blogger_title(&$contents) {
|
||||
if (eregi("<title>(.*)</title>", $contents, $title)) {
|
||||
$title = strip_tags($title[0]);
|
||||
$contents = ereg_replace("<title>.*</title>", "", $cparams[4]);
|
||||
}
|
||||
else {
|
||||
list($title, $rest) = explode("\n", $contents, 2);
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,332 @@
|
|||
<?php
|
||||
|
||||
// $Id$
|
||||
|
||||
function blogapi_help($section) {
|
||||
$output = '';
|
||||
switch ($section) {
|
||||
case 'admin/help#blogapi':
|
||||
$output .= t('This module adds support for several XML-RPC based blogging APIs. Specifically, it currently implements the %bloggerAPI, %metaweblogAPI, and most of the %moveabletype extensions. This allows users to contribute to drupal using external GUI applications, which can often offer richer functionality that online forms based editing', array('%bloggerAPI' => '<a href="http://www.blogger.com/developers/api/1_docs/">Blogger API</a>', '%metaweblogAPI' => '<a href="http://www.xmlrpc.com/metaWeblogApi">MetaWeblog API</a>', '%moveabletype' => '<a href="http://www.movabletype.org/docs/mtmanual_programmatic.html">Moveable Type API</a>'));
|
||||
break;
|
||||
case 'admin/system/modules#description':
|
||||
$output .= t('Enable users to post using applications that support XML-RPC blog APIs');
|
||||
break;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function blogapi_xmlrpc() {
|
||||
$methods = array('blogger.getUsersBlogs' => array('function' => 'blogapi_get_users_blogs'),
|
||||
'blogger.newPost' => array('function' => 'blogapi_new_post'),
|
||||
'blogger.editPost' => array('function' => 'blogapi_edit_post'),
|
||||
'blogger.deletePost' => array('function' => 'blogapi_delete_post'),
|
||||
'blogger.getRecentPosts' => array('function' => 'blogapi_get_recent_posts'),
|
||||
'metaWeblog.newPost' => array('function' => 'blogapi_new_post'),
|
||||
'metaWeblog.editPost' => array('function' => 'blogapi_edit_post'),
|
||||
'metaWeblog.getPost' => array('function' => 'blogapi_get_post'),
|
||||
'metaWeblog.newMediaObject' => array('function' => 'blogapi_new_media_object'),
|
||||
'metaWeblog.getCategories' => array('function' => 'blogapi_get_categories'),
|
||||
'metaWeblog.getRecentPosts' => array('function' => 'blogapi_get_recent_posts'),
|
||||
'mt.getCategoryList' => array('function' => 'blogapi_get_category_list'),
|
||||
'mt.getPostCategories' => array('function' => 'blogapi_get_post_categories'),
|
||||
'mt.setPostCategories' => array('function' => 'blogapi_set_post_categories')
|
||||
);
|
||||
|
||||
return $methods;
|
||||
}
|
||||
|
||||
/** api functions */
|
||||
|
||||
function blogapi_get_users_blogs($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if ($user->uid) {
|
||||
$struct = new xmlrpcval(array('url' => new xmlrpcval(url('blog/' . $user->uid)),
|
||||
'blogid' => new xmlrpcval($user->uid),
|
||||
'blogName' => new xmlrpcval($user->name . "'s blog")),
|
||||
'struct');
|
||||
$resp = new xmlrpcval(array($struct), "array");
|
||||
return new xmlrpcresp($resp);
|
||||
}
|
||||
else {
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
}
|
||||
|
||||
function blogapi_get_user_info($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if ($user->uid) {
|
||||
$struct = new xmlrpcval(array('userid' => new xmlrpcval($user->uid, 'string'),
|
||||
'lastname' => new xmlrpcval(substr($user->name, strrpos($user->name, " ") + 1), 'string'),
|
||||
'firstname' => new xmlrpcval(substr($user->name, 0, strrpos($user->name, " ")), 'string'),
|
||||
'nickname' => new xmlrpcval($user->name, 'string'),
|
||||
'email' => new xmlrpcval($user->mail, 'string'),
|
||||
'url' => new xmlrpcval(url('blog/view/' . $user->uid), 'string')),
|
||||
'struct');
|
||||
return new xmlrpcresp($struct);
|
||||
}
|
||||
else {
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
}
|
||||
|
||||
function blogapi_new_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$promote = variable_get("node_promote_blog", 0);
|
||||
$comment = variable_get("node_comment_blog", 2);
|
||||
$moderate = variable_get("node_moderate_blog", 0);
|
||||
$revision = variable_get("node_revision_blog", 0);
|
||||
|
||||
// check for bloggerAPI vs. metaWeblogAPI
|
||||
if (is_array($params[3])) {
|
||||
$title = $params[3]['title'];
|
||||
$body = $params[3]['description'];
|
||||
}
|
||||
else {
|
||||
$title = blogapi_blogger_title($params[3]);
|
||||
$body = $params[3];
|
||||
}
|
||||
|
||||
$node = node_validate(array('type' => 'blog',
|
||||
'uid' => $user->uid,
|
||||
'name' => $user->name,
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
'status' => $params[4],
|
||||
'promote' => $promote,
|
||||
'comment' => $comment,
|
||||
'moderate' => $moderate,
|
||||
'revision' => $revision
|
||||
), $error);
|
||||
|
||||
if (count($error) > 0) {
|
||||
return blogapi_error($error);
|
||||
}
|
||||
|
||||
if (!node_access("create", $node)) {
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
|
||||
$nid = node_save($node);
|
||||
if ($nid) {
|
||||
watchdog("special", "$node->type: added '$node->title' using blog API", l(t("view post"), "node/view/$nid"));
|
||||
return new xmlrpcresp(new xmlrpcval($nid, 'string'));
|
||||
}
|
||||
|
||||
return blogapi_error(t('error storing post'));
|
||||
}
|
||||
|
||||
function blogapi_edit_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$node = node_load(array('nid' => $params[0]));
|
||||
if (!$node) {
|
||||
return blogapi_error(message_na());
|
||||
}
|
||||
|
||||
if (!node_access('update', $node)){
|
||||
return blogapi_error(message_access());
|
||||
}
|
||||
|
||||
// check for bloggerAPI vs. metaWeblogAPI
|
||||
if (is_array($params[3])) {
|
||||
$title = $params[3]['title'];
|
||||
$body = $params[3]['description'];
|
||||
}
|
||||
else {
|
||||
$title = blogapi_blogger_title($params[3]);
|
||||
$body = $params[3];
|
||||
}
|
||||
|
||||
$node->title = $title;
|
||||
$node->body = $body;
|
||||
$node->status = $params[4];
|
||||
$node = node_validate($node, $error);
|
||||
|
||||
if (count($error) > 0) {
|
||||
return blogapi_error($error);
|
||||
}
|
||||
|
||||
$nid = node_save($node);
|
||||
if ($nid) {
|
||||
watchdog("special", "$node->type: updated '$node->title' using blog API", l(t("view post"), "node/view/$nid"));
|
||||
return new xmlrpcresp(new xmlrpcval(true, "boolean"));
|
||||
}
|
||||
|
||||
return blogapi_error(t('error storing node'));
|
||||
}
|
||||
|
||||
function blogapi_get_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$node = node_load(array('nid' => $params[0]));
|
||||
$blog = new xmlrpcval(array('userid' => new xmlrpcval($node->name, 'string'),
|
||||
'dateCreated' => new xmlrpcval(iso8601_encode($node->created), "dateTime.iso8601"),
|
||||
'title' => new xmlrpcval($node->title, 'string'),
|
||||
'description' => new xmlrpcval($node->body, 'string'),
|
||||
'postid' => new xmlrpcval($node->nid, 'string')),
|
||||
'struct');
|
||||
|
||||
return new xmlrpcresp($blog);
|
||||
}
|
||||
|
||||
function blogapi_delete_post($req_params) {
|
||||
global $user;
|
||||
|
||||
$params = blogapi_convert($req_params);
|
||||
|
||||
$user = blogapi_validate_user($params[2], $params[3]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$ret = node_delete(array('nid' => $params[1], 'confirm' => 1));
|
||||
return new xmlrpcresp(new xmlrpcval(true, "boolean"));
|
||||
}
|
||||
|
||||
function blogapi_new_media_object($req_params) {
|
||||
return blogapi_error('not implemented');
|
||||
}
|
||||
|
||||
function blogapi_get_category_list($req_params) {
|
||||
if (!function_exists('taxonomy_get_vocabularies')) {
|
||||
return blogapi_error('no categories');
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
$vocabularies = taxonomy_get_vocabularies('blog');
|
||||
foreach ($vocabularies as $vocabulary) {
|
||||
$terms = taxonomy_get_tree($vocabulary->vid);
|
||||
foreach ($terms as $term) {
|
||||
$term_name = $term->name;
|
||||
foreach (taxonomy_get_parents($term->tid) as $parent) {
|
||||
$term_name = $parent->name . '/' . $term_name;
|
||||
}
|
||||
$categories[] = new xmlrpcval(array('categoryName' => new xmlrpcval($term_name, 'string'),
|
||||
'categoryId' => new xmlrpcval($term->tid, 'string')),
|
||||
'struct');
|
||||
}
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval($categories, "array"));
|
||||
}
|
||||
|
||||
function blogapi_get_post_categories($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$terms = taxonomy_node_get_terms($params[0]);
|
||||
$categories = array();
|
||||
foreach($terms as $term) {
|
||||
$term_name = $term->name;
|
||||
foreach (taxonomy_get_parents($term->tid) as $parent) {
|
||||
$term_name = $parent->name . '/' . $term_name;
|
||||
}
|
||||
$categories[] = new xmlrpcval(array('categoryName' => new xmlrpcval($term_name, 'string'),
|
||||
'categoryId' => new xmlrpcval($term->tid, 'string'),
|
||||
'isPrimary' => new xmlrpcval(true, 'boolean')),
|
||||
'struct');
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval($categories, "array"));
|
||||
}
|
||||
|
||||
function blogapi_set_post_categories($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$nid = $params[0];
|
||||
$terms = array();
|
||||
foreach ($params[3] as $category) {
|
||||
$terms[] = $category['categoryId']->scalarval();
|
||||
}
|
||||
taxonomy_node_save($nid, $terms);
|
||||
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
|
||||
}
|
||||
|
||||
function blogapi_get_recent_posts($req_params) {
|
||||
$params = blogapi_convert($req_params);
|
||||
$user = blogapi_validate_user($params[1], $params[2]);
|
||||
if (!$user->uid) {
|
||||
return blogapi_error(t('error validating user'));
|
||||
}
|
||||
|
||||
$res = db_query_range("SELECT n.nid, n.title, n.body, n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = 'blog' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]);
|
||||
while ($blog = db_fetch_object($res)) {
|
||||
$blogs[] = new xmlrpcval(array('userid' => new xmlrpcval($blog->name, 'string'),
|
||||
'dateCreated' => new xmlrpcval(iso8601_encode($blog->created), "dateTime.iso8601"),
|
||||
'title' => new xmlrpcval($blog->title, 'string'),
|
||||
'description' => new xmlrpcval($blog->body, 'string'),
|
||||
'postid' => new xmlrpcval($blog->nid, 'string')),
|
||||
'struct');
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval($blogs, "array"));
|
||||
}
|
||||
|
||||
/** helper functions */
|
||||
|
||||
function blogapi_convert($params) {
|
||||
$cparams = array();
|
||||
$num_params= $params->getNumParams();
|
||||
|
||||
for ($i = 0; $i < $num_params; $i++) {
|
||||
$sn = $params->getParam($i);
|
||||
$cparams[] = $sn->getval();
|
||||
}
|
||||
|
||||
return $cparams;
|
||||
}
|
||||
|
||||
function blogapi_error($message) {
|
||||
global $xmlrpcusererr;
|
||||
|
||||
return new xmlrpcresp(0, $xmlrpcusererr + 1, $message);
|
||||
}
|
||||
|
||||
function blogapi_validate_user($username, $password) {
|
||||
global $user;
|
||||
|
||||
$user = user_load(array('name' => $username, 'pass' => $password, 'status' => 1));
|
||||
|
||||
if (!user_access('access blog API')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
function blogapi_blogger_title(&$contents) {
|
||||
if (eregi("<title>(.*)</title>", $contents, $title)) {
|
||||
$title = strip_tags($title[0]);
|
||||
$contents = ereg_replace("<title>.*</title>", "", $cparams[4]);
|
||||
}
|
||||
else {
|
||||
list($title, $rest) = explode("\n", $contents, 2);
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
?>
|
|
@ -1,375 +0,0 @@
|
|||
<?php
|
||||
// $Id$
|
||||
|
||||
/*
|
||||
** The Drupal Blogger API implementation.
|
||||
*/
|
||||
|
||||
function bloggerapi_xmlrpc() {
|
||||
return array("blogger.newPost" => array("function" => "bloggerapi_newPost"),
|
||||
"blogger.editPost" => array("function" => "bloggerapi_editPost"),
|
||||
"blogger.getUsersBlogs" => array("function" => "bloggerapi_getUsersBlogs"),
|
||||
"blogger.getUserInfo" => array("function" => "bloggerapi_getUserInfo"),
|
||||
"blogger.getTemplate" => array("function" => "bloggerapi_getTemplate"),
|
||||
"blogger.setTemplate" => array("function" => "bloggerapi_setTemplate"),
|
||||
"blogger.getPost" => array("function" => "bloggerapi_getPost"),
|
||||
"blogger.getRecentPosts" => array("function" => "bloggerapi_getRecentPosts"),
|
||||
"blogger.deletePost" => array("function" => "bloggerapi_deletePost")
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
** The following functions map to the various Blogger method calls.
|
||||
** All these functions subsequently use the blogger_driver function
|
||||
*/
|
||||
|
||||
function bloggerapi_newPost($params) {
|
||||
global $user, $xmlrpcerruser;
|
||||
|
||||
/*
|
||||
** Call the driver function with appropriate method to return a node
|
||||
*/
|
||||
|
||||
$node = node_validate(bloggerapi_driver("newPost", $params, $error), $error);
|
||||
|
||||
if (!$node->error) {
|
||||
if (node_access("create", $node)) {
|
||||
throttle("node", variable_get("max_node_rate", 900));
|
||||
|
||||
$nid = node_save($node);
|
||||
if ($nid) {
|
||||
watchdog("special", "$node->type: added '$node->title' using the Blogger API", l(t("view post"), "node/view/$nid"));
|
||||
return new xmlrpcresp(new xmlrpcval("$nid", "string"));
|
||||
}
|
||||
else {
|
||||
$error = bloggerapi_error("Error posting node");
|
||||
return $error->error_resp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $node->error_resp;
|
||||
}
|
||||
|
||||
function bloggerapi_editPost($params) {
|
||||
global $user, $xmlrpcerruser;
|
||||
|
||||
$node = node_validate(bloggerapi_driver("editPost", $params, $error), $error);
|
||||
|
||||
if (!$node->error) {
|
||||
$nid = node_save($node);
|
||||
if ($nid) {
|
||||
watchdog("special", "$node->type: updated '$node->title' using the Blogger API", l(t("view post"), "node/view/$nid"));
|
||||
return new xmlrpcresp(new xmlrpcval($nid, "string"));
|
||||
}
|
||||
else {
|
||||
# $error = bloggerapi_error("Error updating node: $node->nid");
|
||||
return $node->error_resp;
|
||||
}
|
||||
}
|
||||
return $node->error_resp;
|
||||
}
|
||||
|
||||
function bloggerapi_getUsersBlogs($params) {
|
||||
$resp = bloggerapi_driver("getUsersBlogs", $params);
|
||||
|
||||
return $resp->error ? $resp->error_resp : new xmlrpcresp($resp);
|
||||
}
|
||||
|
||||
function bloggerapi_getUserInfo($params) {
|
||||
$resp = bloggerapi_driver("getUserInfo", $params);
|
||||
|
||||
return $resp->error ? $resp->error_resp : new xmlrpcresp($resp);
|
||||
}
|
||||
|
||||
function bloggerapi_getTemplate($params) {
|
||||
$error = bloggerapi_error(t("Get Template is not relevant for Drupal"));
|
||||
return $error->error_resp;
|
||||
}
|
||||
|
||||
function bloggerapi_setTemplate($params) {
|
||||
$error = bloggerapi_error(t("Set Template is not relevant for Drupal"));
|
||||
return $error->error_resp;
|
||||
}
|
||||
|
||||
function bloggerapi_getPost($params) {
|
||||
$resp = bloggerapi_driver("getPost", $params);
|
||||
|
||||
return $resp->error ? $resp->error_resp : new xmlrpcresp($resp);
|
||||
}
|
||||
|
||||
function bloggerapi_getRecentPosts($params) {
|
||||
$resp = bloggerapi_driver("getRecentPosts", $params);
|
||||
|
||||
return $resp->error ? $resp->error_resp : new xmlrpcresp($resp);
|
||||
}
|
||||
|
||||
function bloggerapi_deletePost($params) {
|
||||
$resp = bloggerapi_driver("deletePost", $params);
|
||||
|
||||
return $resp->error ? $resp->error_resp : new xmlrpcresp($resp);
|
||||
}
|
||||
|
||||
function bloggerapi_driver($method, $params = 0, $error = 0) {
|
||||
global $user, $xmlrpcusererr;
|
||||
|
||||
/*
|
||||
** Convert parameters to an array
|
||||
*/
|
||||
|
||||
$cparams = bloggerapi_convert($params);
|
||||
|
||||
/*
|
||||
** Validate the user, the postion in the array for username and password
|
||||
** are not always the same.
|
||||
*/
|
||||
|
||||
if ($method == "getUsersBlogs" || $method == "getUserInfo") {
|
||||
$user = bloggerapi_validate_user($cparams[1], $cparams[2]);
|
||||
}
|
||||
else {
|
||||
$user = bloggerapi_validate_user($cparams[2], $cparams[3]);
|
||||
}
|
||||
|
||||
if ($user->uid && user_access("access Blogger API")) {
|
||||
|
||||
/*
|
||||
** Check for title tags, if not generate one.
|
||||
*/
|
||||
|
||||
if (eregi("<title>(.*)</title>", $cparams[4], $title)) {
|
||||
$title = strip_tags($title[0]);
|
||||
$cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]);
|
||||
}
|
||||
else {
|
||||
$title = bloggerapi_title($cparams[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
** Check if we can set promote.
|
||||
*/
|
||||
|
||||
$promote = variable_get("node_promote_blog", "0");
|
||||
|
||||
/*
|
||||
** Maps params to node array or call another function
|
||||
*/
|
||||
|
||||
switch ($method) {
|
||||
case "newPost":
|
||||
return array("type" => "blog", "uid" => $user->uid, "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => $promote, "revision" => 0);
|
||||
case "editPost":
|
||||
$node = node_load(array("nid" => $cparams[1]));
|
||||
if ($node->uid == $user->uid) {
|
||||
return array("nid" => $cparams[1], "uid" => $user->uid, "type" => "blog", "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => $promote, "revision" => 0);
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error updating node");
|
||||
}
|
||||
case "getUsersBlogs":
|
||||
return bloggerapi_user_blogs();
|
||||
case "getUserInfo":
|
||||
return bloggerapi_user_info();
|
||||
case "getPost":
|
||||
return bloggerapi_node_load($cparams[1]);
|
||||
case "getRecentPosts":
|
||||
return bloggerapi_node_recent($cparams[4]);
|
||||
case "deletePost":
|
||||
return bloggerapi_node_delete($cparams[1]);
|
||||
case "distribute":
|
||||
break;
|
||||
default:
|
||||
return bloggerapi_error("Error in the authentication process");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error in the authentication process");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** The following functions do the *actual* work of deleting posts
|
||||
** and returning posts etc,
|
||||
*/
|
||||
|
||||
|
||||
function bloggerapi_user_blogs() {
|
||||
global $user;
|
||||
|
||||
if ($user->uid) {
|
||||
$struct = new xmlrpcval(array("url" => new xmlrpcval(url("blog/$user->uid")), "blogid" => new xmlrpcval($user->uid), "blogName" => new xmlrpcval($user->name . "'s blog at ". variable_get("site_name", "drupal"))), "struct");
|
||||
return new xmlrpcval(array($struct), "array");
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error retrieving user blogs");
|
||||
}
|
||||
}
|
||||
|
||||
function bloggerapi_user_info() {
|
||||
global $user;
|
||||
|
||||
if ($user->uid) {
|
||||
return new xmlrpcval(array("nickname" => new xmlrpcval($user->name, "string"),
|
||||
"userid" => new xmlrpcval($user->uid, "string"),
|
||||
"url" => new xmlrpcval(url("blog/view/". urlencode($user->uid)), "string"),
|
||||
"email" => new xmlrpcval($user->mail, "string"),
|
||||
"lastname" => new xmlrpcval(substr($user->name, strrpos($user->name, " ") + 1), "string"),
|
||||
"firstname" => new xmlrpcval(substr($user->name, 0, strrpos($user->name, " ")), "string"),
|
||||
), "struct");
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error retrieving user information");
|
||||
}
|
||||
}
|
||||
|
||||
function bloggerapi_node_load($nid) {
|
||||
global $user;
|
||||
|
||||
$blog = node_load(array("nid" => $nid, "type" => "blog"));
|
||||
if ($blog->uid == $user->uid) {
|
||||
$body = "<title>$blog->title</title>\n". $blog->body;
|
||||
return new xmlrpcval(array("userid" => new xmlrpcval($user->name, "string"),
|
||||
"dateCreated" => new xmlrpcval(iso8601_encode($blog->timestamp), "dateTime.iso8601"),
|
||||
"content" => new xmlrpcval($body, "string"),
|
||||
"postid" => new xmlrpcval($blog->nid, "string")
|
||||
), "struct");
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error retrieving blogid: $nid");
|
||||
}
|
||||
}
|
||||
|
||||
function bloggerapi_node_recent($num) {
|
||||
global $user;
|
||||
|
||||
if (($num == 0) or ($num > 100)) $num = 50;
|
||||
$result = db_query_range("SELECT n.*, u.name FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND n.uid = %d ORDER BY n.nid DESC", $user->uid, 0, $num);
|
||||
if ($result) {
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$body = "<title>$blog->title</title>\n". $blog->body;
|
||||
$blogs[] = new xmlrpcval(array("userid" => new xmlrpcval($blog->name, "string"),
|
||||
"dateCreated" => new xmlrpcval(iso8601_encode($blog->created), "dateTime.iso8601"),
|
||||
"content" => new xmlrpcval($body, "string"),
|
||||
"postid" => new xmlrpcval($blog->nid, "string")
|
||||
), "struct");
|
||||
}
|
||||
return new xmlrpcval($blogs, "array");
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error retrieving recent blogs");
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: rework node_delete() and then invoke it instead of performing the deletion here.
|
||||
function bloggerapi_node_delete($nid) {
|
||||
global $user;
|
||||
|
||||
$node = node_load(array("nid" => $nid, "type" => "blog"));
|
||||
if ($node->uid == $user->uid) {
|
||||
if (node_access("delete", $node)) {
|
||||
|
||||
/*
|
||||
** Delete the specified node and its comments:
|
||||
*/
|
||||
|
||||
db_query("DELETE FROM {node} WHERE nid = '$node->nid'");
|
||||
db_query("DELETE FROM {comments} WHERE nid = '$node->nid'");
|
||||
|
||||
watchdog("special", "$node->type: deleted '$node->title', via Blogger API");
|
||||
$message = "Node: $node->nid, was deleted";
|
||||
return new xmlrpcval(1, "boolean");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return bloggerapi_error("Error deleting node: $nid");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Helper functions
|
||||
*/
|
||||
|
||||
function tt() {
|
||||
$tt = array_flip(get_html_translation_table(HTML_ENTITIES));
|
||||
$tt["'"] = "'";
|
||||
return $tt;
|
||||
}
|
||||
|
||||
function bloggerapi_error($message) {
|
||||
global $xmlrpcusererr;
|
||||
|
||||
$error->error = 1;
|
||||
$error->error_msg = $message;
|
||||
$error->error_resp = new xmlrpcresp(0, $xmlrpcerruser + 1, $message);
|
||||
return $error;
|
||||
}
|
||||
|
||||
function bloggerapi_validate_user($username, $password) {
|
||||
global $user;
|
||||
|
||||
if ($username && $password) {
|
||||
$user = user_load(array("name" => $username, "pass" => $password, "status" => 1));
|
||||
return $user;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function bloggerapi_convert($params) {
|
||||
$cparams= array();
|
||||
$num_params = $params->getNumParams();
|
||||
|
||||
for ($i = 0; $i < $num_params; $i++) {
|
||||
$sn = $params->getParam($i);
|
||||
$cparams[] = $sn->scalarval();
|
||||
}
|
||||
return $cparams;
|
||||
}
|
||||
|
||||
function bloggerapi_title($body) {
|
||||
$title = strip_tags(strtr($title ? $title : substr(strip_tags(strtr($body, tt())), 0, 30), tt()));
|
||||
return $title;
|
||||
}
|
||||
|
||||
/*
|
||||
** Admin functions and module hooks
|
||||
*/
|
||||
|
||||
function bloggerapi_perm() {
|
||||
return array("access Blogger API");
|
||||
}
|
||||
|
||||
function bloggerapi_help($section) {
|
||||
$output = "";
|
||||
|
||||
switch ($section) {
|
||||
case 'admin/help#bloggerapi':
|
||||
$output = "<h3>Introduction</h3>";
|
||||
$output .= "<p>%blogger-com, the well-known public weblog service, provides an application programing interface (API) to allow remote procedure calls (RPC) to the Blogger service. Drupal supports this %blogger-api, which means that many remote clients (e.g. %client-radio, %client-blogbuddy, %client-w_bloggar, and %client-textrouter) may post to Drupal. These clients provide a bevy of interesting capabilities like offline composing, spellcheck, and WYSIWYG editing; many folks prefer to blog with a client application over typical web forms. By supporting the Blogger API, Drupal grows grander than a web site engine, it's a <i>content accepting machine</i>™.</p>";
|
||||
$output .= "<p>The %blogger_api uses the %xml-rpc protocol for communicating with the outside world. %xml-rpc, originally developed by Dave Winer of %userland-software, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses %xml-rpc for several other tasks (e.g. notifiying %weblogs-com of blog updates and making/accepting %distributed-authentication requests)</p>";
|
||||
$output .= "<h3>Blogger API implementation</h3>";
|
||||
$output .= "<p>A word of warning on the Blogger API: it is <b>unofficial</b>. It exists because Blogger is one of the most popular and the first service to implement an XML-RPC interface. It may not be the best implementation of a distributed weblog API. For a promising candidate, see the %echo-proj.</p>";
|
||||
$output .= "<p>Drupal's support for the Blogger API is quite complete. Each method with an asterisk below has been implemented in Drupal.</p>";
|
||||
$output .= "<p>%bloggerapi-newpost<br />%bloggerapi-editpost<br />%bloggerapi-getuserblogs<br />%bloggerapi-getuserinfo<br />%bloggerapi-gettemplate<br />%bloggerapi-settemplate</p>";
|
||||
$output .= "<p>Drupal also supports the following methods. These methods were added after the those listed above and are not documented on the Blogger API web site. Each method is linked to its corresponding blogger-dev mailing list post:</p>";
|
||||
$output .= "<p>%message-296<br />%message-225<br />%message-147</p>";
|
||||
$output .= "<h3>Installation and usage</h3>";
|
||||
$output .= "<p>To install the Blogger API module, enable the module on the %mod-config. Also make sure you have your permissions set correctly for accessing the Blogger API. The relevant settings can be found under the %permissions page. Check the checkbox behind the line \"access Blogger API\" for the roles that are allowed to use the Blogger API.</p>";
|
||||
$output .= "<p>Once the API is enabled you can download one of the above mentioned Blogger API clients and get blogging.</p>";
|
||||
$output .= "<h3>Setup of the client</h3>";
|
||||
$output .= "<p>The Drupal page you need to call in order to connect using the Blogger API is <i>http://server/xmlrpc.php</i> where <i>server</i> is the URL of the site you want to post to. As an example when posting to drupal.org, the account settings for %client-w_bloggar would be: host: www.drupal.org (default = plant.blogger.com) and page: xmlrpc.php (default = /api/RPC2).</p>";
|
||||
$output .= "<p>You can't use remote authentication when posting using a Blogger API enabled client, even when you could use that to authenticate on the site itself. You will have to use the site's local username, enter a password for that account, and then use that combination to post using the Blogger API client.</p>";
|
||||
$output .= "<h3>Notes and limitations</h3>";
|
||||
$output .= "<ul><li>The Blogger API contains an AppKey that is discarded in the Drupal Implementation.</li><li>The Blogger API does not allow for a title element. Our work around for this is either to use <title></title> tags in the body of your post or let the module create a title by inspecting the first few lines of the post body.</li><li>The publish parameter is always set to <i>1</i>.</li><li>When using the <i>getUserInfo</i> call, Drupal attempts to generate a first and last name from the Drupal username; no distinction is made internally</li><li><i>GetUsersBlogs</i> only returns one blog because unlike Blogger, Drupal only allows one blog per user.</li></ul>";
|
||||
$output = t($output, array("%blogger-com" => "<a href=\"http://www.blogger.com/\">Blogger</a>", "%blogger_api" => "%blogger-api\">Blogger API</a>", "%client-radio" => "<a href=\"http://radio.userland.com/\">Radio</a>", "%client-blogbuddy" => "<a href=\"http://blogbuddy.sourceforge.net/\">BlogBuddy</a>", "%client-w_bloggar" => "<a href=\"http://www.wbloggar.com/\">w.bloggar</a>", "%client-textrouter" => "<a href=\"http://projects.kittle.info/tr/\">TextRouter</a>", "%xml-rpc" => "<a href=\"http://www.xmlrpc.com/\">XML-RPC</a>", "%userland-software" => "<a href=\"http://www.userland.com/\">UserLand Software</a>", "%weblogs-com" => "<a href=\"http://www.weblogs.com/\">weblogs.com</a>", "%distributed-authentication" => l(t("distributed authentication"), "user/help"), "%echo-proj" => "<a href=\"http://www.intertwingly.net/wiki/pie/RoadMap\">". t("Echo project") ."</a>", "%bloggerapi-newpost" => "%blogger-api/xmlrpc_newPost.html\">blogger.newPost()*</a>", "%bloggerapi-editpost" => "%blogger-api/xmlrpc_editPost.html\">blogger.editPost()*</a>", "%bloggerapi-getuserblogs" => "%blogger-api/xmlrpc_getUserBlogs.html\">blogger.getUsersBlogs()*</a>", "%bloggerapi-getuserinfo" => "%blogger-api/xmlrpc_getUserInfo.html\">blogger.getUserInfo()*</a>", "%bloggerapi-gettemplate" => "%blogger-api/xmlrpc_getTemplate.html\">blogger.getTemplate()*</a>", "%bloggerapi-settemplate" => "%blogger-api/xmlrpc_setTemplate.html\">blogger.setTemplate()*</a>", "%message-296" => "%blogger-dev/296\">blogger.getPost()*</a>", "%message-225" => "%blogger-dev/225\">blogger.getRecentPosts()*</a>", "%message-147" => "%blogger-dev/147\">blogger.deletePost()*</a>", "%mod-config" => l(t("modules configuration page"), "admin/systems/modules"), "%permissions" => l(t("administer") ." » ". t("accounts") ." » ". t("permissions"), "admin/user/permission")));
|
||||
$output = strtr($output, array("%blogger-api" => "<a href=\"http://www.blogger.com/developers/api/1_docs", "%blogger-dev" => "<a href=\"http://groups.yahoo.com/group/bloggerDev/message"));
|
||||
break;
|
||||
case 'admin/system/modules#description':
|
||||
$output .= t("Enables users to post using tools or applications that support the Blogger API.");
|
||||
break;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue