Auth_Yadis_Yadis.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <!-- template designed by Marco Von Ballmoos -->
  6. <title>Docs For Class Auth_Yadis_Yadis</title>
  7. <link rel="stylesheet" href="../media/stylesheet.css" />
  8. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
  9. </head>
  10. <body>
  11. <div class="page-body">
  12. <h2 class="class-name">Class Auth_Yadis_Yadis</h2>
  13. <a name="sec-description"></a>
  14. <div class="info-box">
  15. <div class="info-box-title">Description</div>
  16. <div class="nav-bar">
  17. <span class="disabled">Description</span> |
  18. <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
  19. </div>
  20. <div class="info-box-body">
  21. <!-- ========== Info from phpDoc block ========= -->
  22. <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>
  23. <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 &quot;discover&quot; method statically with a URI parameter:</p><p><pre> $http_response = array();
  24. $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
  25. $yadis_object = Auth_Yadis_Yadis::discover($uri,
  26. $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(
  27. array("filterByURI",
  28. "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) {
  29. // Query $service object here. Return true if the service
  30. // matches your query; false if not.
  31. }</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) {
  32. foreach ($service->getElements('xrd:URI') as $uri) {
  33. if (preg_match("/some_pattern/",
  34. $service->parser->content($uri))) {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }</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"),
  40. 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 &quot;services()&quot; 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>
  41. <p class="notes">
  42. Located in <a class="field" href="_Auth---Yadis---Yadis.php.html">/Auth/Yadis/Yadis.php</a> (line <span class="field">242</span>)
  43. </p>
  44. <pre></pre>
  45. </div>
  46. </div>
  47. <a name="sec-method-summary"></a>
  48. <div class="info-box">
  49. <div class="info-box-title">Method Summary</span></div>
  50. <div class="nav-bar">
  51. <a href="#sec-description">Description</a> |
  52. <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
  53. </div>
  54. <div class="info-box-body">
  55. <div class="method-summary">
  56. <div class="method-definition">
  57. <span class="method-result">void</span>
  58. <a href="#curlPresent" title="details" class="method-name">curlPresent</a>
  59. ()
  60. </div>
  61. <div class="method-definition">
  62. <span class="method-result">mixed</span>
  63. <a href="#discover" title="details" class="method-name">discover</a>
  64. (<span class="var-type">string</span>&nbsp;<span class="var-name">$uri</span>, <span class="var-type"></span>&nbsp;<span class="var-name">&$fetcher</span>, [<span class="var-type">array</span>&nbsp;<span class="var-name">$extra_ns_map</span> = <span class="var-default">null</span>], [<span class="var-type">integer</span>&nbsp;<span class="var-name">$timeout</span> = <span class="var-default">20</span>], <span class="var-type">array</span>&nbsp;<span class="var-name">$http_response</span>, <span class="var-type">Auth_Yadis_HTTPFetcher</span>&nbsp;<span class="var-name">$fetcher</span>)
  65. </div>
  66. <div class="method-definition">
  67. <span class="method-result">void</span>
  68. <a href="#getHTTPFetcher" title="details" class="method-name">getHTTPFetcher</a>
  69. ([<span class="var-type"></span>&nbsp;<span class="var-name">$timeout</span> = <span class="var-default">20</span>])
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <a name="sec-methods"></a>
  75. <div class="info-box">
  76. <div class="info-box-title">Methods</div>
  77. <div class="nav-bar">
  78. <a href="#sec-description">Description</a> |
  79. <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
  80. </div>
  81. <div class="info-box-body">
  82. <A NAME='method_detail'></A>
  83. <a name="methodcurlPresent" id="curlPresent"><!-- --></a>
  84. <div class="evenrow">
  85. <div class="method-header">
  86. <span class="method-title">curlPresent</span> (line <span class="line-number">264</span>)
  87. </div>
  88. <!-- ========== Info from phpDoc block ========= -->
  89. <div class="method-signature">
  90. <span class="method-result">void</span>
  91. <span class="method-name">
  92. curlPresent
  93. </span>
  94. ()
  95. </div>
  96. </div>
  97. <a name="methoddiscover" id="discover"><!-- --></a>
  98. <div class="oddrow">
  99. <div class="method-header">
  100. <span class="method-title">discover</span> (line <span class="line-number">320</span>)
  101. </div>
  102. <!-- ========== Info from phpDoc block ========= -->
  103. <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>
  104. <ul class="tags">
  105. <li><span class="field">return:</span> Either null or an instance of Auth_Yadis_Yadis, depending on whether the discovery succeeded.</li>
  106. </ul>
  107. <div class="method-signature">
  108. <span class="method-result">mixed</span>
  109. <span class="method-name">
  110. discover
  111. </span>
  112. (<span class="var-type">string</span>&nbsp;<span class="var-name">$uri</span>, <span class="var-type"></span>&nbsp;<span class="var-name">&$fetcher</span>, [<span class="var-type">array</span>&nbsp;<span class="var-name">$extra_ns_map</span> = <span class="var-default">null</span>], [<span class="var-type">integer</span>&nbsp;<span class="var-name">$timeout</span> = <span class="var-default">20</span>], <span class="var-type">array</span>&nbsp;<span class="var-name">$http_response</span>, <span class="var-type">Auth_Yadis_HTTPFetcher</span>&nbsp;<span class="var-name">$fetcher</span>)
  113. </div>
  114. <ul class="parameters">
  115. <li>
  116. <span class="var-type">string</span>
  117. <span class="var-name">$uri</span><span class="var-description">: The URI on which to perform Yadis discovery.</span> </li>
  118. <li>
  119. <span class="var-type">array</span>
  120. <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>
  121. <li>
  122. <span class="var-type">Auth_Yadis_HTTPFetcher</span>
  123. <span class="var-name">$fetcher</span><span class="var-description">: An instance of a Auth_Yadis_HTTPFetcher subclass.</span> </li>
  124. <li>
  125. <span class="var-type">array</span>
  126. <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>
  127. <li>
  128. <span class="var-type">integer</span>
  129. <span class="var-name">$timeout</span><span class="var-description">: An optional fetcher timeout, in seconds.</span> </li>
  130. <li>
  131. <span class="var-type"></span>
  132. <span class="var-name">&$fetcher</span> </li>
  133. </ul>
  134. </div>
  135. <a name="methodgetHTTPFetcher" id="getHTTPFetcher"><!-- --></a>
  136. <div class="evenrow">
  137. <div class="method-header">
  138. <span class="method-title">getHTTPFetcher</span> (line <span class="line-number">253</span>)
  139. </div>
  140. <!-- ========== Info from phpDoc block ========= -->
  141. <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>
  142. <p class="description"><p>If Auth_Yadis_CURL_OVERRIDE is defined, this method will always return a Auth_Yadis_PlainHTTPFetcher.</p></p>
  143. <div class="method-signature">
  144. <span class="method-result">void</span>
  145. <span class="method-name">
  146. getHTTPFetcher
  147. </span>
  148. ([<span class="var-type"></span>&nbsp;<span class="var-name">$timeout</span> = <span class="var-default">20</span>])
  149. </div>
  150. <ul class="parameters">
  151. <li>
  152. <span class="var-type"></span>
  153. <span class="var-name">$timeout</span> </li>
  154. </ul>
  155. </div>
  156. </div>
  157. </div>
  158. <p class="notes" id="credit">
  159. 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>
  160. </p>
  161. </div></body>
  162. </html>