12 require_once 
'Auth/Yadis/Misc.php';
 
   13 require_once 
'Auth/Yadis/Yadis.php';
 
   14 require_once 
'Auth/OpenID.php';
 
   18     return 'http://xri.net/';
 
   23     return array(
'!', 
'=', 
'@', 
'+', 
'$', 
'(');
 
   32         $parts[] = sprintf(
"%s-%s", chr($m), chr(
$n));
 
   35     return sprintf(
'/[%s]/', implode(
'', $parts));
 
   57         $xri = 
'xri://' . $xri;
 
   65     $xref = $xref_match[0];
 
   66     $xref = str_replace(
'/', 
'%2F', $xref);
 
   67     $xref = str_replace(
'?', 
'%3F', $xref);
 
   68     $xref = str_replace(
'#', 
'%23', $xref);
 
   74     $xri = str_replace(
'%', 
'%25', $xri);
 
   76                                  '_escape_xref', $xri);
 
   92                                      'Auth_Yadis_pct_escape_unicode', $iri);
 
  103     if (count($args) == 0) {
 
  109     if (array_key_exists(0, $args) &&
 
  110         is_array($args[0])) {
 
  113         $keys = array_keys($args);
 
  116         foreach ($keys as $key) {
 
  117             $new_args[] = array($key, $args[$key]);
 
  128     if (strpos(rtrim($url, 
'?'), 
'?') !== 
false) {
 
  139     $lastbang = strrpos($canonicalID, 
'!');
 
  140     $p = substr($canonicalID, 0, $lastbang);
 
  141     return $p == $providerID;
 
  151         $xri = substr($xri, 6);
 
  154     $authority = explode(
'/', $xri, 2);
 
  155     $authority = $authority[0];
 
  156     if ($authority[0] == 
'(') {
 
  162         $root = substr($authority, 0, strpos($authority, 
')') + 1);
 
  165         $root = $authority[0];
 
  168         $_segments = explode(
"!", $authority);
 
  170         foreach ($_segments as $s) {
 
  171             $segments = array_merge($segments, explode(
"*", $s));
 
  173         $root = $segments[0];
 
  182         $xri = 
'xri://' . $xri;
 
  192     $xrd_list = array_reverse($xrds->allXrdNodes);
 
  193     $parser = $xrds->parser;
 
  194     $node = $xrd_list[0];
 
  196     $canonicalID_nodes = $parser->evalXPath(
'xrd:CanonicalID', $node);
 
  198     if (!$canonicalID_nodes) {
 
  202     $canonicalID = $canonicalID_nodes[0];
 
  205     $childID = $canonicalID;
 
  207     for ($i = 1; $i < count($xrd_list); $i++) {
 
  208         $xrd = $xrd_list[$i];
 
  210         $parent_sought = substr($childID, 0, strrpos($childID, 
'!'));
 
  211         $parentCID = $parser->evalXPath(
'xrd:CanonicalID', $xrd);
 
  217         if (strcasecmp($parent_sought, $parentCID)) {
 
  222         $childID = $parent_sought;