CoreFiles by mySites.guru
XRIRes.php70 lines, 2,209 bytes, from Joomla_1.5.7-Stable-Full_Package.zip
Raw History Compare with 1.5.6
md5
972f9310c57704d4f6879bb78c401a65
sha1
0556f48e7688586be98408b7bdd739b093952847
sha256
1049a9fced6aa628def643ea8b2e3b975c0f9a44602463a777d5db299f719248
<?php
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

require_once 'Services/Yadis/XRDS.php';
require_once 'Services/Yadis/XRI.php';

class Services_Yadis_ProxyResolver {
    function Services_Yadis_ProxyResolver(&$fetcher, $proxy_url = null)
    {
        $this->fetcher =& $fetcher;
        $this->proxy_url = $proxy_url;
        if (!$this->proxy_url) {
            $this->proxy_url = Services_Yadis_getDefaultProxy();
        }
    }

    function queryURL($xri, $service_type = null)
    {
        // trim off the xri:// prefix
        $qxri = substr(Services_Yadis_toURINormal($xri), 6);
        $hxri = $this->proxy_url . $qxri;
        $args = array(
                      '_xrd_r' => 'application/xrds+xml'
                      );

        if ($service_type) {
            $args['_xrd_t'] = $service_type;
        } else {
            // Don't perform service endpoint selection.
            $args['_xrd_r'] .= ';sep=false';
        }

        $query = Services_Yadis_XRIAppendArgs($hxri, $args);
        return $query;
    }

    function query($xri, $service_types, $filters = array())
    {
        $services = array();
        $canonicalID = null;
        foreach ($service_types as $service_type) {
            $url = $this->queryURL($xri, $service_type);
            $response = $this->fetcher->get($url);
            if ($response->status != 200) {
                continue;
            }
            $xrds = Services_Yadis_XRDS::parseXRDS($response->body);
            if (!$xrds) {
                continue;
            }
            $canonicalID = Services_Yadis_getCanonicalID($xri,
                                                         $xrds);

            if ($canonicalID === false) {
                return null;
            }

            $some_services = $xrds->services($filters);
            $services = array_merge($services, $some_services);
            // TODO:
            //  * If we do get hits for multiple service_types, we're
            //    almost certainly going to have duplicated service
            //    entries and broken priority ordering.
        }
        return array($canonicalID, $services);
    }
}

?>

The same content is in 9 releases, Joomla 1.5.0 to 1.5.8. See them all, or every version of this file.