Source code for file /openid/Auth/Yadis/XRI.php
Documentation is available at XRI.php
* Routines for XRI resolution.
* @author JanRain, Inc. <openid@janrain.com>
* @copyright 2005-2008 Janrain, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache
// Do not allow direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once 'Auth/Yadis/Misc.php';
require_once 'Auth/Yadis/Yadis.php';
require_once 'Auth/OpenID.php';
return 'http://xri.net/';
return array('!', '=', '@', '+', '$', '(');
// According to RFC 3987, section 3.1, "Mapping of IRIs to URIs"
'Auth_Yadis_pct_escape_unicode', $iri);
// Append some arguments to an HTTP query. Yes, this is just like
// OpenID's appendArgs, but with special seasoning for XRI
// Non-empty array; if it is an array of arrays, use multisort;
foreach ($keys as $key) {
$new_args[] =
array($key, $args[$key]);
// According to XRI Resolution section "QXRI query parameters":
// "If the original QXRI had a null query component (only a
// leading question mark), or a query component consisting of
// only question marks, one additional leading question mark MUST
// be added when adding any XRI resolution parameters."
return $url .
$sep .
Auth_OpenID::httpBuildQuery($args);
$lastbang =
strrpos($canonicalID, '!');
$p =
substr($canonicalID, 0, $lastbang);
return $p ==
$providerID;
// Return the root authority for an XRI.
$authority =
explode('/', $xri, 2);
$authority =
$authority[0];
if ($authority[0] ==
'(') {
// XXX: This is incorrect if someone nests cross-references so
// there is another close-paren in there. Hopefully nobody
// does that before we have a real xriparse function.
// Hopefully nobody does that *ever*.
$_segments =
explode("!", $authority);
foreach ($_segments as $s) {
// Returns false or a canonical ID value.
// Now nodes are in reverse order.
$parser =
& $xrds->parser;
$canonicalID_nodes =
$parser->evalXPath('xrd:CanonicalID', $node);
if (!$canonicalID_nodes) {
$canonicalID =
$canonicalID_nodes[0];
for ($i =
1; $i <
count($xrd_list); $i++
) {
$parentCID =
$parser->evalXPath('xrd:CanonicalID', $xrd);
$childID =
$parent_sought;