ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
Auth_Yadis_Yadis Class Reference
+ Collaboration diagram for Auth_Yadis_Yadis:

Static Public Member Functions

static getHTTPFetcher ($timeout=20)
 Returns an HTTP fetcher object.
static curlPresent ()
static _getHeader ($header_list, $names)
 private
static _getContentType ($content_type_header)
 private
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.

Detailed Description

Definition at line 242 of file Yadis.php.

Member Function Documentation

static Auth_Yadis_Yadis::_getContentType (   $content_type_header)
static

private

Definition at line 288 of file Yadis.php.

Referenced by discover().

{
if ($content_type_header) {
$parts = explode(";", $content_type_header);
return strtolower($parts[0]);
}
}

+ Here is the caller graph for this function:

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

private

Definition at line 272 of file Yadis.php.

References $n.

Referenced by discover().

{
foreach ($header_list as $name => $value) {
foreach ($names as $n) {
if (strtolower($name) == strtolower($n)) {
return $value;
}
}
}
return null;
}

+ Here is the caller graph for this function:

static Auth_Yadis_Yadis::curlPresent ( )
static

Definition at line 264 of file Yadis.php.

Referenced by getHTTPFetcher().

{
return function_exists('curl_init');
}

+ Here is the caller graph for this function:

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.

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

{
$request_uri = $uri;
$headers = array("Accept: " . Auth_Yadis_CONTENT_TYPE .
', text/html; q=0.3, application/xhtml+xml; q=0.5');
if ($fetcher === null) {
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher($timeout);
}
$response = $fetcher->get($uri, $headers);
if (!$response || ($response->status != 200 and
$response->status != 206)) {
$result->fail();
return $result;
}
$result->normalized_uri = $response->final_url;
$response->headers,
array('content-type'));
if ($result->content_type &&
$result->xrds_uri = $result->normalized_uri;
} else {
$yadis_location = Auth_Yadis_Yadis::_getHeader(
$response->headers,
if (!$yadis_location) {
$parser = new Auth_Yadis_ParseHTML();
$yadis_location = $parser->getHTTPEquiv($response->body);
}
if ($yadis_location) {
$result->xrds_uri = $yadis_location;
$response = $fetcher->get($yadis_location);
if ((!$response) || ($response->status != 200 and
$response->status != 206)) {
$result->fail();
return $result;
}
$response->headers,
array('content-type'));
}
}
$result->response_text = $response->body;
return $result;
}

+ Here is the call graph for this function:

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.

References curlPresent().

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

{
(!defined('Auth_Yadis_CURL_OVERRIDE'))) {
$fetcher = new Auth_Yadis_ParanoidHTTPFetcher($timeout);
} else {
$fetcher = new Auth_Yadis_PlainHTTPFetcher($timeout);
}
return $fetcher;
}

+ 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: