function blogapi_rsd in Blog API 7.2
Same name and namespace in other branches
- 7 blogapi.module \blogapi_rsd()
Return a BlogAPI RSD for XML-RPC APIs
@todo: Implement apiLink correctly using service endpoint URL @todo: Implement multi-user blogs
1 string reference to 'blogapi_rsd'
- blogapi_menu in ./
blogapi.module - Implements hook_menu().
File
- ./
blogapi.module, line 101 - Enable users to post using applications that support BlogAPIs.
Code
function blogapi_rsd() {
global $base_url;
$base = url('', array(
'absolute' => TRUE,
));
$xmlrpc_apis = blogapi_get_info('xmlrpc');
$default_xmlrpc_api = variable_get('blogapi_xmlrpc_default_provider', NULL);
// Until we figure out how to handle multiple bloggers, we'll just use a
// hardcoded blogid.
$blogid = 1;
drupal_add_http_header('Content-Type', 'application/rsd+xml; charset=utf-8');
// The extra whitespace in this function is to preserve code alignment in
// the output.
print <<<__RSD__
<?xml version="1.0"?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
<service>
<engineName>Drupal</engineName>
<engineLink>http://drupal.org/</engineLink>
<homePageLink>{<span class="php-variable">$base</span>}</homePageLink>
<apis>
__RSD__;
foreach ($xmlrpc_apis as $module => $info) {
$default = 'false';
if ($module == $default_xmlrpc_api) {
$default = 'true';
}
$endpoint = "{$base_url}/blogapi/{$info['type']}";
print "\n <api name='{$info['name']}' preferred='{$default}' apiLink='{$endpoint}' blogID='{$blogid}' />";
}
print <<<__RSD__
</apis>
</service>
</rsd>
__RSD__;
}