[Plugin: XRDS-Simple] XRDS meta and headers for author's page broken
-
If I’m right, XRDS meta and headers should reference the author when produced for an author’s page. So I changed xrds_meta function as follows:
function xrds_meta() { global $wp_rewrite; $regex = preg_replace('/%author%/', '(.+)', $wp_rewrite->get_author_permastruct()); preg_match('|'.$regex.'|', $_SERVER['REQUEST_URI'], $matches); if ($matches) { $username = sanitize_user($matches[1], true); echo '<meta http-equiv="X-XRDS-Location" content="'.get_bloginfo('home').'/?xrds&author='.$username.'" />'."\n"; echo '<meta http-equiv="X-Yadis-Location" content="'.get_bloginfo('home').'/?xrds&author='.$username.'" />'."\n"; } else { echo '<meta http-equiv="X-XRDS-Location" content="'.get_bloginfo('home').'/?xrds" />'."\n"; echo '<meta http-equiv="X-Yadis-Location" content="'.get_bloginfo('home').'/?xrds" />'."\n"; } }
Somethin similar I made for xrds_parse_request function:
function xrds_parse_request($wp) { global $wp_rewrite; $accept = explode(',', $_SERVER['HTTP_ACCEPT']); if(isset($_GET['xrds']) || in_array('application/xrds+xml', $accept)) { header('Content-type: application/xrds+xml'); echo xrds_write(); exit; } else { $regex = preg_replace('/%author%/', '(.+)', $wp_rewrite->get_author_permastruct()); preg_match('|'.$regex.'|', $_SERVER['REQUEST_URI'], $matches); if ($matches) { $username = sanitize_user($matches[1], true); @header('X-XRDS-Location: '.get_bloginfo('home').'/?xrds&author='.$username); @header('X-Yadis-Location: '.get_bloginfo('home').'/?xrds&author='.$username); } else { @header('X-XRDS-Location: '.get_bloginfo('home').'/?xrds'); @header('X-Yadis-Location: '.get_bloginfo('home').'/?xrds'); } } }
- The topic ‘[Plugin: XRDS-Simple] XRDS meta and headers for author's page broken’ is closed to new replies.