ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Auth_Yadis_Yadis Class Reference
+ Collaboration diagram for Auth_Yadis_Yadis:

Static Public Member Functions

static getHTTPFetcher ($timeout=20)
 Returns an HTTP fetcher object. More...
 
static curlPresent ()
 
static _getHeader ($header_list, $names)
 @access private More...
 
static _getContentType ($content_type_header)
 @access private More...
 
static discover ($uri, $fetcher, $extra_ns_map=null, $timeout=20)
 This should be called statically and will build a Yadis instance if the discovery process succeeds. More...
 

Detailed Description

Definition at line 242 of file Yadis.php.

Member Function Documentation

◆ _getContentType()

static Auth_Yadis_Yadis::_getContentType (   $content_type_header)
static

@access private

Definition at line 288 of file Yadis.php.

289 {
290 if ($content_type_header) {
291 $parts = explode(";", $content_type_header);
292 return strtolower($parts[0]);
293 }
294 }

Referenced by discover().

+ Here is the caller graph for this function:

◆ _getHeader()

static Auth_Yadis_Yadis::_getHeader (   $header_list,
  $names 
)
static

@access private

Definition at line 272 of file Yadis.php.

273 {
274 foreach ($header_list as $name => $value) {
275 foreach ($names as $n) {
276 if (strtolower($name) == strtolower($n)) {
277 return $value;
278 }
279 }
280 }
281
282 return null;
283 }
$n
Definition: RandomTest.php:80

References $n.

Referenced by discover().

+ Here is the caller graph for this function:

◆ curlPresent()

static Auth_Yadis_Yadis::curlPresent ( )
static

Definition at line 264 of file Yadis.php.

265 {
266 return function_exists('curl_init');
267 }

Referenced by getHTTPFetcher().

+ Here is the caller graph for this function:

◆ discover()

static Auth_Yadis_Yadis::discover (   $uri,
  $fetcher,
  $extra_ns_map = null,
  $timeout = 20 
)
static

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.

Parameters
string$uriThe URI on which to perform Yadis discovery.
array$http_responseAn array reference where the HTTP response object will be stored (see Auth_Yadis_HTTPResponse.
Auth_Yadis_HTTPFetcher$fetcherAn instance of a Auth_Yadis_HTTPFetcher subclass.
array$extra_ns_mapAn array which maps namespace names to namespace URIs to be used when parsing the Yadis XRDS document.
integer$timeoutAn optional fetcher timeout, in seconds.
Returns
mixed $obj Either null or an instance of Auth_Yadis_Yadis, depending on whether the discovery succeeded.

Definition at line 320 of file Yadis.php.

322 {
324
325 $request_uri = $uri;
326 $headers = array("Accept: " . Auth_Yadis_CONTENT_TYPE .
327 ', text/html; q=0.3, application/xhtml+xml; q=0.5');
328
329 if ($fetcher === null) {
330 $fetcher = Auth_Yadis_Yadis::getHTTPFetcher($timeout);
331 }
332
333 $response = $fetcher->get($uri, $headers);
334
335 if (!$response || ($response->status != 200 and
336 $response->status != 206)) {
337 $result->fail();
338 return $result;
339 }
340
341 $result->normalized_uri = $response->final_url;
343 $response->headers,
344 array('content-type'));
345
346 if ($result->content_type &&
349 $result->xrds_uri = $result->normalized_uri;
350 } else {
351 $yadis_location = Auth_Yadis_Yadis::_getHeader(
352 $response->headers,
354
355 if (!$yadis_location) {
356 $parser = new Auth_Yadis_ParseHTML();
357 $yadis_location = $parser->getHTTPEquiv($response->body);
358 }
359
360 if ($yadis_location) {
361 $result->xrds_uri = $yadis_location;
362
363 $response = $fetcher->get($yadis_location);
364
365 if ((!$response) || ($response->status != 200 and
366 $response->status != 206)) {
367 $result->fail();
368 return $result;
369 }
370
372 $response->headers,
373 array('content-type'));
374 }
375 }
376
377 $result->response_text = $response->body;
378 return $result;
379 }
$result
const Auth_Yadis_CONTENT_TYPE
Need both fetcher types so we can use the right one based on the presence or absence of CURL.
Definition: Yadis.php:36
const Auth_Yadis_HEADER_NAME
Yadis header.
Definition: Yadis.php:41
static getHTTPFetcher($timeout=20)
Returns an HTTP fetcher object.
Definition: Yadis.php:253
static _getContentType($content_type_header)
@access private
Definition: Yadis.php:288
static _getHeader($header_list, $names)
@access private
Definition: Yadis.php:272

References $result, _getContentType(), _getHeader(), Auth_Yadis_CONTENT_TYPE, Auth_Yadis_HEADER_NAME, and getHTTPFetcher().

+ Here is the call graph for this function:

◆ getHTTPFetcher()

static Auth_Yadis_Yadis::getHTTPFetcher (   $timeout = 20)
static

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.

If Auth_Yadis_CURL_OVERRIDE is defined, this method will always return a Auth_Yadis_PlainHTTPFetcher.

Definition at line 253 of file Yadis.php.

254 {
256 (!defined('Auth_Yadis_CURL_OVERRIDE'))) {
257 $fetcher = new Auth_Yadis_ParanoidHTTPFetcher($timeout);
258 } else {
259 $fetcher = new Auth_Yadis_PlainHTTPFetcher($timeout);
260 }
261 return $fetcher;
262 }
static curlPresent()
Definition: Yadis.php:264

References curlPresent().

Referenced by Auth_OpenID_GenericConsumer\Auth_OpenID_GenericConsumer(), discover(), and Auth_OpenID_CheckIDRequest\returnToVerified().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: