123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?xml version="1.0" encoding="iso-8859-1"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <!-- template designed by Marco Von Ballmoos -->
- <title>Docs For Class Auth_Yadis_Yadis</title>
- <link rel="stylesheet" href="../media/stylesheet.css" />
- <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
- </head>
- <body>
- <div class="page-body">
- <h2 class="class-name">Class Auth_Yadis_Yadis</h2>
- <a name="sec-description"></a>
- <div class="info-box">
- <div class="info-box-title">Description</div>
- <div class="nav-bar">
- <span class="disabled">Description</span> |
- <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
-
- </div>
- <div class="info-box-body">
- <!-- ========== Info from phpDoc block ========= -->
- <p class="short-description">This is the core of the PHP Yadis library. This is the only class a user needs to use to perform Yadis discovery. This class performs the discovery AND stores the result of the discovery.</p>
- <p class="description"><p>First, require this library into your program source:</p><p><pre> require_once "Auth/Yadis/Yadis.php";</pre></p><p>To perform Yadis discovery, first call the "discover" method statically with a URI parameter:</p><p><pre> $http_response = array();
- $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
- $yadis_object = Auth_Yadis_Yadis::discover($uri,
- $http_response, $fetcher);</pre></p><p>If the discovery succeeds, $yadis_object will be an instance of <a href="../OpenID/Auth_Yadis_Yadis.html">Auth_Yadis_Yadis</a>. If not, it will be null. The XRDS document found during discovery should have service descriptions, which can be accessed by calling</p><p><pre> $service_list = $yadis_object->services();</pre></p><p>which returns an array of objects which describe each service. These objects are instances of Auth_Yadis_Service. Each object describes exactly one whole Service element, complete with all of its Types and URIs (no expansion is performed). The common use case for using the service objects returned by services() is to write one or more filter functions and pass those to services():</p><p><pre> $service_list = $yadis_object->services(
- array("filterByURI",
- "filterByExtension"));</pre></p><p>The filter functions (whose names appear in the array passed to services()) take the following form:</p><p><pre> function myFilter(&$service) {
- // Query $service object here. Return true if the service
- // matches your query; false if not.
- }</pre></p><p>This is an example of a filter which uses a regular expression to match the content of URI tags (note that the Auth_Yadis_Service class provides a getURIs() method which you should use instead of this contrived example):</p><p><pre> function URIMatcher(&$service) {
- foreach ($service->getElements('xrd:URI') as $uri) {
- if (preg_match("/some_pattern/",
- $service->parser->content($uri))) {
- return true;
- }
- }
- return false;
- }</pre></p><p>The filter functions you pass will be called for each service object to determine which ones match the criteria your filters specify. The default behavior is that if a given service object matches ANY of the filters specified in the services() call, it will be returned. You can specify that a given service object will be returned ONLY if it matches ALL specified filters by changing the match mode of services():</p><p><pre> $yadis_object->services(array("filter1", "filter2"),
- SERVICES_YADIS_MATCH_ALL);</pre></p><p>See <a href="../OpenID/_Auth---Yadis---XRDS.php.html#defineSERVICES_YADIS_MATCH_ALL">SERVICES_YADIS_MATCH_ALL</a> and <a href="../OpenID/_Auth---Yadis---XRDS.php.html#defineSERVICES_YADIS_MATCH_ANY">SERVICES_YADIS_MATCH_ANY</a>.</p><p>Services described in an XRDS should have a library which you'll probably be using. Those libraries are responsible for defining filters that can be used with the "services()" call. If you need to write your own filter, see the documentation for <a href="../OpenID/Auth_Yadis_Service.html">Auth_Yadis_Service</a>.</p></p>
- <p class="notes">
- Located in <a class="field" href="_Auth---Yadis---Yadis.php.html">/Auth/Yadis/Yadis.php</a> (line <span class="field">242</span>)
- </p>
-
-
- <pre></pre>
-
- </div>
- </div>
- <a name="sec-method-summary"></a>
- <div class="info-box">
- <div class="info-box-title">Method Summary</span></div>
- <div class="nav-bar">
- <a href="#sec-description">Description</a> |
- <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
- </div>
- <div class="info-box-body">
- <div class="method-summary">
-
- <div class="method-definition">
- <span class="method-result">void</span>
- <a href="#curlPresent" title="details" class="method-name">curlPresent</a>
- ()
- </div>
-
- <div class="method-definition">
- <span class="method-result">mixed</span>
- <a href="#discover" title="details" class="method-name">discover</a>
- (<span class="var-type">string</span> <span class="var-name">$uri</span>, <span class="var-type"></span> <span class="var-name">&$fetcher</span>, [<span class="var-type">array</span> <span class="var-name">$extra_ns_map</span> = <span class="var-default">null</span>], [<span class="var-type">integer</span> <span class="var-name">$timeout</span> = <span class="var-default">20</span>], <span class="var-type">array</span> <span class="var-name">$http_response</span>, <span class="var-type">Auth_Yadis_HTTPFetcher</span> <span class="var-name">$fetcher</span>)
- </div>
-
- <div class="method-definition">
- <span class="method-result">void</span>
- <a href="#getHTTPFetcher" title="details" class="method-name">getHTTPFetcher</a>
- ([<span class="var-type"></span> <span class="var-name">$timeout</span> = <span class="var-default">20</span>])
- </div>
- </div>
- </div>
- </div>
-
- <a name="sec-methods"></a>
- <div class="info-box">
- <div class="info-box-title">Methods</div>
- <div class="nav-bar">
- <a href="#sec-description">Description</a> |
- <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
-
- </div>
- <div class="info-box-body">
- <A NAME='method_detail'></A>
- <a name="methodcurlPresent" id="curlPresent"><!-- --></a>
- <div class="evenrow">
-
- <div class="method-header">
- <span class="method-title">curlPresent</span> (line <span class="line-number">264</span>)
- </div>
-
- <!-- ========== Info from phpDoc block ========= -->
-
- <div class="method-signature">
- <span class="method-result">void</span>
- <span class="method-name">
- curlPresent
- </span>
- ()
- </div>
-
-
-
- </div>
- <a name="methoddiscover" id="discover"><!-- --></a>
- <div class="oddrow">
-
- <div class="method-header">
- <span class="method-title">discover</span> (line <span class="line-number">320</span>)
- </div>
-
- <!-- ========== Info from phpDoc block ========= -->
- <p class="short-description">This should be called statically and will build a Yadis instance if the discovery process succeeds. This implements Yadis discovery as specified in the Yadis specification.</p>
- <ul class="tags">
- <li><span class="field">return:</span> Either null or an instance of Auth_Yadis_Yadis, depending on whether the discovery succeeded.</li>
- </ul>
-
- <div class="method-signature">
- <span class="method-result">mixed</span>
- <span class="method-name">
- discover
- </span>
- (<span class="var-type">string</span> <span class="var-name">$uri</span>, <span class="var-type"></span> <span class="var-name">&$fetcher</span>, [<span class="var-type">array</span> <span class="var-name">$extra_ns_map</span> = <span class="var-default">null</span>], [<span class="var-type">integer</span> <span class="var-name">$timeout</span> = <span class="var-default">20</span>], <span class="var-type">array</span> <span class="var-name">$http_response</span>, <span class="var-type">Auth_Yadis_HTTPFetcher</span> <span class="var-name">$fetcher</span>)
- </div>
-
- <ul class="parameters">
- <li>
- <span class="var-type">string</span>
- <span class="var-name">$uri</span><span class="var-description">: The URI on which to perform Yadis discovery.</span> </li>
- <li>
- <span class="var-type">array</span>
- <span class="var-name">$http_response</span><span class="var-description">: An array reference where the HTTP response object will be stored (see Auth_Yadis_HTTPResponse.</span> </li>
- <li>
- <span class="var-type">Auth_Yadis_HTTPFetcher</span>
- <span class="var-name">$fetcher</span><span class="var-description">: An instance of a Auth_Yadis_HTTPFetcher subclass.</span> </li>
- <li>
- <span class="var-type">array</span>
- <span class="var-name">$extra_ns_map</span><span class="var-description">: An array which maps namespace names to namespace URIs to be used when parsing the Yadis XRDS document.</span> </li>
- <li>
- <span class="var-type">integer</span>
- <span class="var-name">$timeout</span><span class="var-description">: An optional fetcher timeout, in seconds.</span> </li>
- <li>
- <span class="var-type"></span>
- <span class="var-name">&$fetcher</span> </li>
- </ul>
-
-
- </div>
- <a name="methodgetHTTPFetcher" id="getHTTPFetcher"><!-- --></a>
- <div class="evenrow">
-
- <div class="method-header">
- <span class="method-title">getHTTPFetcher</span> (line <span class="line-number">253</span>)
- </div>
-
- <!-- ========== Info from phpDoc block ========= -->
- <p class="short-description">Returns an HTTP fetcher object. If the CURL extension is present, an instance of Auth_Yadis_ParanoidHTTPFetcher is returned. If not, an instance of Auth_Yadis_PlainHTTPFetcher is returned.</p>
- <p class="description"><p>If Auth_Yadis_CURL_OVERRIDE is defined, this method will always return a Auth_Yadis_PlainHTTPFetcher.</p></p>
-
- <div class="method-signature">
- <span class="method-result">void</span>
- <span class="method-name">
- getHTTPFetcher
- </span>
- ([<span class="var-type"></span> <span class="var-name">$timeout</span> = <span class="var-default">20</span>])
- </div>
-
- <ul class="parameters">
- <li>
- <span class="var-type"></span>
- <span class="var-name">$timeout</span> </li>
- </ul>
-
-
- </div>
-
- </div>
- </div>
- <p class="notes" id="credit">
- Documentation generated on Tue, 21 Apr 2009 11:31:34 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.2</a>
- </p>
- </div></body>
- </html>
|