$v) {
echo '' . "\n";
}
}
}
if (is_author()) {
$author = get_userdata(get_query_var('author'));
$url = get_author_posts_url($author->user_login);
$identity = MicroID::canonicalize_identity_uri($author->user_email);
$microid = MicroID::generate($identity, $url);
if (!empty($microid)) {
echo '' . "\n";
}
}
}
/**
* Wrap post with div that includes a microid for the post
*/
function add_microid_on_post($content = '')
{
$identity = MicroID::canonicalize_identity_uri(get_the_author_email());
$microid = MicroID::generate($identity, get_permalink());
if (!empty($microid)) {
return "
$content
";
} else {
return $content;
}
}
/**
* Wrap comment with div that includes a microid for the comment
*/
function add_microid_on_comment($comment = '')
{
$identity = MicroID::canonicalize_identity_uri(get_comment_author_email());
$microid = MicroID::generate($identity, get_permalink());
if (!empty($microid)) {
return "$comment
";
} else {
return $comment;
}
}
/**
* Register admin menu.
*/
function menu() {
add_options_page('MicroID Options', 'MicroID', 8, __FILE__, array('MicroID', 'manage'));
}
/**
* Manage admin option page.
*/
function manage() {
$microid_identities = get_option('microid_identities');
$updated = false;
if (array_key_exists('action', $_REQUEST)) {
switch($_REQUEST['action']) {
case 'submit':
if (array_key_exists('new_identity', $_REQUEST) && !empty($_REQUEST['new_identity'])) {
$newID = MicroID::canonicalize_identity_uri($_REQUEST['new_identity']);
$microid_identities[$newID] = MicroID::generate($newID, get_option('home'));
$updated = true;
}
update_option( 'microid_include_posts', isset($_REQUEST['microid_include_posts']) ? true : false );
update_option( 'microid_include_comments', isset($_REQUEST['microid_include_comments']) ? true : false );
break;
case 'delete':
if (array_key_exists('id', $_REQUEST) && !empty($_REQUEST['id'])) {
unset($microid_identities[$_REQUEST['id']]);
$updated = true;
}
break;
case 'default':
$default_ids = MicroID::default_identities();
if (!empty($default_ids)) {
foreach($default_ids as $id) {
$newID = MicroID::canonicalize_identity_uri($id);
$microid_identities[$newID] = MicroID::generate($newID, get_option('home'));
}
$updated = true;
}
break;
}
}
if ($updated) {
update_option('microid_identities', $microid_identities);
}
// options page
?>
MicroID
MicroID is an open source, decentralized identity protocol. It was originally developed in 2005 by Jeremie Miller. A MicroID is a simple identifier comprised of a hashed communication/identity URI (e.g. Email, OpenID, and/or Yadis) and claimed URL. Together, the two elements create a hash that can be claimed by third party services.
You can read more about MicroID on Wikipedia and on the MicroID homepage and blog.
Having a MicroID on your blog will allow you to claim it as your own in claim services sich as claimID.
'.__('Changes have been saved', '').'
';
} ?>