Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Unknown

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /openid/Services/Yadis/XRIRes.php

Documentation is available at XRIRes.php

  1. <?php
  2.  
  3. require_once 'Services/Yadis/XRDS.php';
  4. require_once 'Services/Yadis/XRI.php';
  5.  
  6.     function Services_Yadis_ProxyResolver(&$fetcher$proxy_url null)
  7.     {
  8.         global $DEFAULT_PROXY;
  9.  
  10.         $this->fetcher =$fetcher;
  11.         $this->proxy_url $proxy_url;
  12.         if (!$this->proxy_url{
  13.             $this->proxy_url $DEFAULT_PROXY;
  14.         }
  15.     }
  16.  
  17.     function queryURL($xri$service_type null)
  18.     {
  19.         // trim off the xri:// prefix
  20.         $qxri substr(Services_Yadis_toURINormal($xri)6);
  21.         $hxri $this->proxy_url $qxri;
  22.         $args array(
  23.                       '_xrd_r' => 'application/xrds+xml'
  24.                       );
  25.  
  26.         if ($service_type{
  27.             $args['_xrd_t'$service_type;
  28.         else {
  29.             // Don't perform service endpoint selection.
  30.             $args['_xrd_r'.= ';sep=false';
  31.         }
  32.  
  33.         $query Services_Yadis_XRIAppendArgs($hxri$args);
  34.         return $query;
  35.     }
  36.  
  37.     function query($xri$service_types$filters array())
  38.     {
  39.         $services array();
  40.         $canonicalID null;
  41.         foreach ($service_types as $service_type{
  42.             $url $this->queryURL($xri$service_type);
  43.             $response $this->fetcher->get($url);
  44.             if ($response->status != 200{
  45.                 continue;
  46.             }
  47.             $xrds Services_Yadis_XRDS::parseXRDS($response->body);
  48.             if (!$xrds{
  49.                 continue;
  50.             }
  51.             $canonicalID Services_Yadis_getCanonicalID($xri,
  52.                                                          $xrds);
  53.  
  54.             if ($canonicalID === false{
  55.                 return null;
  56.             }
  57.  
  58.             $some_services $xrds->services($filters);
  59.             $services array_merge($services$some_services);
  60.             // TODO:
  61.             //  * If we do get hits for multiple service_types, we're
  62.             //    almost certainly going to have duplicated service
  63.             //    entries and broken priority ordering.
  64.         }
  65.         return array($canonicalID$services);
  66.     }
  67. }
  68.  
  69. ?>

Documentation generated on Mon, 05 Mar 2007 21:33:14 +0000 by phpDocumentor 1.3.1