using_mod_rewrite_permalinks() ? '' : '/index.php').'/xrds" />';
$xrdsProviders = get_option('xrds_services');
if ($provider = current($xrdsProviders)) {
echo '
';
}
}
/**
* Register Admin Menu.
*/
function menu() {
add_options_page('Yadis Options', 'Yadis', 9, 'global-yadis-options', array('Yadis', 'manage'));
}
function admin_head() {
wp_print_scripts(array('jquery', 'interface'));
$plugin_base = get_option('siteurl').'/wp-content/plugins/yadis';
?>
$_REQUEST['xrds-server'],
'delegate' => $_REQUEST['xrds-delegate'],
'simplereg' => false,
);
}
}
else if (@$_REQUEST['xrds-username']) {
$provider = Yadis::build_provider_definition($_REQUEST['xrds-id'], $_REQUEST['xrds-username']);
}
}
return $provider;
}
/**
* Build the specified predefined provider definition.
*/
function build_provider_definition($providerID, $username) {
$provider = Array();
$xrdsProviders = Yadis::predefined();
if (array_key_exists($providerID, $xrdsProviders)) {
$provider['server'] = preg_replace('/%/', $username, $xrdsProviders[$providerID][1]);
$provider['delegate'] = preg_replace('/%/', $username, $xrdsProviders[$providerID][2]);
$provider['simplereg'] = $xrdsProviders[$providerID][3];
return $provider;
}
}
/**
* Get pre-defined identity providers
*/
function predefined() {
$providers = array(
'aol' => array('AOL', 'http://api.screenname.aol.com/auth/openidServer','http://openid.aol.com/%',true),
'claimid' => array('ClaimID', 'http://openid.claimid.com/server','http://openid.claimid.com/%',true),
'livejournal' => array('LiveJournal', 'http://www.livejournal.com/openid/server.bml','http://%.livejournal.com/',true),
'myopenid' => array('MyOpenID', 'http://www.myopenid.com/server','http://%.myopenid.com/',true),
'yahoo' => array('Yahoo! (IDProxy)', 'http://idproxy.net/openid/server/','http://%.idproxy.net/',true),
'wordpress' => array('Wordpress.com', 'http://%.wordpress.com/?openidserver=1','http://%.wordpress.com/',true),
);
return $providers;
}
/**
* URL rewriting stuff, to serve xrds.xml
*/
function rewrite_rules($rules) {
$xrds_rules = array(
'xrds$' => 'index.php?xrds=xrds',
'xrds.xml$' => 'index.php?xrds=xrds',
'index.php/xrds$' => 'index.php?xrds=xrds',
);
return $rules + $xrds_rules;
}
/**
* Add 'xrds' as a valid query variables.
**/
function query_vars($vars) {
$vars[] = 'xrds';
return $vars;
}
/**
* Print XRDS document if 'xrds' query variable is present
**/
function xrds_xml($query) {
if ($query) $xrds = $query->query_vars['xrds'];
if (!empty($xrds)) {
$debug = ($xrds == 'debug' || array_key_exists('debug', $_REQUEST)) ? true : false;
Yadis::print_xrds($debug);
}
}
/**
* Print XRDS document.
**/
function print_xrds($debug = false) {
if ($debug) {
header('Content-Type: text/plain');
} else {
header('Content-Type: application/xrds+xml');
header('Content-Disposition: attachment;filename=xrds.xml');
}
$xrdsProviders = get_option('xrds_services');
echo '
'.__('Changes have been saved', '').'
'; } ?>