Auth_OpenID Klassenreferenz


Öffentliche Methoden

 isFailure ($thing)
 getQuery ($query_str=null)
 params_from_string ($str)
 ensureDir ($dir_name)
 addPrefix ($values, $prefix)
 arrayGet ($arr, $key, $fallback=null)
 parse_str ($query)
 httpBuildQuery ($data)
 appendArgs ($url, $args)
 urlunparse ($scheme, $host, $port=null, $path= '/', $query= '', $fragment= '')
 normalizeUrl ($url)
 intval ($value)
 bytes ($str)
 toBytes ($str)
 urldefrag ($url)
 filter ($callback, &$sequence)
 update (&$dest, &$src)
 log ($format_string)
 autoSubmitHTML ($form, $title="OpenId transaction in progress")

Ausführliche Beschreibung

Definiert in Zeile 112 der Datei OpenID.php.


Dokumentation der Elementfunktionen

addPrefix ( values,
prefix 
)

Adds a string prefix to all values of an array. Returns a new array containing the prefixed values.

private

Definiert in Zeile 225 der Datei OpenID.php.

00229     {
00230         $new_values = array();
00231         foreach ($values as $s) {
00232             $new_values[] = $prefix . $s;

appendArgs ( url,
args 
)

"Appends" query arguments onto a URL. The URL may or may not already have arguments (following a question mark).

private

Parameter:
string $url A URL, which may or may not already have arguments.
array $args Either an array key/value pairs or an array of arrays, each of which holding two values: a key and a value, sequentially. If $args is an ordinary key/value array, the parameters will be added to the URL in sorted alphabetical order; if $args is an array of arrays, their order will be preserved.
Rückgabe:
string $url The original URL with the new parameters added.

Definiert in Zeile 323 der Datei OpenID.php.

00327     {
00328         if (count($args) == 0) {
00329             return $url;
00330         }
00331 
00332         // Non-empty array; if it is an array of arrays, use
00333         // multisort; otherwise use sort.
00334         if (array_key_exists(0, $args) &&
00335             is_array($args[0])) {
00336             // Do nothing here.
00337         } else {
00338             $keys = array_keys($args);
00339             sort($keys);
00340             $new_args = array();
00341             foreach ($keys as $key) {
00342                 $new_args[] = array($key, $args[$key]);
00343             }
00344             $args = $new_args;
00345         }
00346 
00347         $sep = '?';
00348         if (strpos($url, '?') !== false) {
00349             $sep = '&';
00350         }

arrayGet ( arr,
key,
fallback = null 
)

Convenience function for getting array values. Given an array $arr and a key $key, get the corresponding value from the array or return $default if the key is absent.

private

Definiert in Zeile 241 der Datei OpenID.php.

00245     {
00246         if (is_array($arr)) {
00247             if (array_key_exists($key, $arr)) {
00248                 return $arr[$key];
00249             } else {
00250                 return $fallback;
00251             }
00252         } else {
00253             trigger_error("Auth_OpenID::arrayGet (key = ".$key.") expected " .
00254                           "array as first parameter, got " .
00255                           gettype($arr), E_USER_WARNING);
00256 

autoSubmitHTML ( form,
title = "OpenId transaction in progress" 
)

Definiert in Zeile 531 der Datei OpenID.php.

00535     {
00536         return("<html>".
00537                "<head><title>".
00538                $title .
00539                "</title></head>".
00540                "<body onload='document.forms[0].submit();'>".
00541                $form .
00542                "<script>".
00543                "var elements = document.forms[0].elements;".
00544                "for (var i = 0; i < elements.length; i++) {".
00545                "  elements[i].style.display = \"none\";".
00546                "}".
00547                "</script>".

bytes ( str  ) 

Count the number of bytes in a string independently of multibyte support conditions.

Parameter:
string $str The string of bytes to count.
Rückgabe:
int The number of bytes in $str.

Definiert in Zeile 461 der Datei OpenID.php.

00465     {

ensureDir ( dir_name  ) 

Create dir_name as a directory if it does not exist. If it exists, make sure that it is, in fact, a directory. Returns true if the operation succeeded; false if not.

private

Definiert in Zeile 203 der Datei OpenID.php.

00207     {
00208         if (is_dir($dir_name) || @mkdir($dir_name)) {
00209             return true;
00210         } else {
00211             $parent_dir = dirname($dir_name);
00212 
00213             // Terminal case; there is no parent directory to create.
00214             if ($parent_dir == $dir_name) {
00215                 return true;
00216             }
00217 

filter ( callback,
&$  sequence 
)

Definiert in Zeile 497 der Datei OpenID.php.

00501     {
00502         $result = array();
00503 
00504         foreach ($sequence as $item) {
00505             if (call_user_func_array($callback, array($item))) {
00506                 $result[] = $item;
00507             }
00508         }

getQuery ( query_str = null  ) 

Gets the query data from the server environment based on the request method used. If GET was used, this looks at $_SERVER['QUERY_STRING'] directly. If POST was used, this fetches data from the special php://input file stream.

Returns an associative array of the query arguments.

Skips invalid key/value pairs (i.e. keys with no '=value' portion).

Returns an empty array if neither GET nor POST was used, or if POST was used but php://input cannot be opened.

private

Definiert in Zeile 141 der Datei OpenID.php.

00145     {
00146         $data = array();
00147 
00148         if ($query_str !== null) {
00149             $data = Auth_OpenID::params_from_string($query_str);
00150         } else if (!array_key_exists('REQUEST_METHOD', $_SERVER)) {
00151             // Do nothing.
00152         } else {
00153           // XXX HACK FIXME HORRIBLE.
00154           //
00155           // POSTing to a URL with query parameters is acceptable, but
00156           // we don't have a clean way to distinguish those parameters
00157           // when we need to do things like return_to verification
00158           // which only want to look at one kind of parameter.  We're
00159           // going to emulate the behavior of some other environments
00160           // by defaulting to GET and overwriting with POST if POST
00161           // data is available.
00162           $data = Auth_OpenID::params_from_string($_SERVER['QUERY_STRING']);
00163 
00164           if ($_SERVER['REQUEST_METHOD'] == 'POST') {
00165             $str = file_get_contents('php://input');
00166 
00167             if ($str === false) {
00168               $post = array();
00169             } else {
00170               $post = Auth_OpenID::params_from_string($str);
00171             }
00172 
00173             $data = array_merge($data, $post);
00174           }
00175         }

httpBuildQuery ( data  ) 

Implements the PHP 5 'http_build_query' functionality.

private

Parameter:
array $data Either an array key/value pairs or an array of arrays, each of which holding two values: a key and a value, sequentially.
Rückgabe:
string $result The result of url-encoding the key/value pairs from $data into a URL query string (e.g. "username=bob&id=56").

Definiert in Zeile 295 der Datei OpenID.php.

00299     {
00300         $pairs = array();
00301         foreach ($data as $key => $value) {
00302             if (is_array($value)) {
00303                 $pairs[] = urlencode($value[0])."=".urlencode($value[1]);
00304             } else {
00305                 $pairs[] = urlencode($key)."=".urlencode($value);
00306             }

intval ( value  ) 

Replacement (wrapper) for PHP's intval() because it's broken.

private

Definiert in Zeile 443 der Datei OpenID.php.

00447     {
00448         $re = "/^\\d+$/";
00449 
00450         if (!preg_match($re, $value)) {
00451             return false;
00452         }

isFailure ( thing  ) 

Return true if $thing is an Auth_OpenID_FailureResponse object; false if not.

private

Definiert in Zeile 120 der Datei OpenID.php.

00124     {

log ( format_string  ) 

Wrap PHP's standard error_log functionality. Use this to perform all logging. It will interpolate any additional arguments into the format string before logging.

Parameter:
string $format_string The sprintf format for the message

Definiert in Zeile 524 der Datei OpenID.php.

00528     {
00529         $args = func_get_args();

normalizeUrl ( url  ) 

Given a URL, this "normalizes" it by adding a trailing slash and / or a leading http:// scheme where necessary. Returns null if the original URL is malformed and cannot be normalized.

private

Parameter:
string $url The URL to be normalized.
Rückgabe:
mixed $new_url The URL after normalization, or null if $url was malformed.

Definiert in Zeile 412 der Datei OpenID.php.

00416     {
00417         @$parsed = parse_url($url);
00418 
00419         if (!$parsed) {
00420             return null;
00421         }
00422 
00423         if (isset($parsed['scheme']) &&
00424             isset($parsed['host'])) {
00425             $scheme = strtolower($parsed['scheme']);
00426             if (!in_array($scheme, array('http', 'https'))) {
00427                 return null;
00428             }
00429         } else {
00430             $url = 'http://' . $url;
00431         }
00432 
00433         $normalized = Auth_OpenID_urinorm($url);
00434         if ($normalized === null) {
00435             return null;
00436         }

params_from_string ( str  ) 

Definiert in Zeile 177 der Datei OpenID.php.

00181     {
00182         $chunks = explode("&", $str);
00183 
00184         $data = array();
00185         foreach ($chunks as $chunk) {
00186             $parts = explode("=", $chunk, 2);
00187 
00188             if (count($parts) != 2) {
00189                 continue;
00190             }
00191 
00192             list($k, $v) = $parts;
00193             $data[$k] = urldecode($v);
00194         }

parse_str ( query  ) 

Replacement for PHP's broken parse_str.

Definiert in Zeile 261 der Datei OpenID.php.

00265     {
00266         if ($query === null) {
00267             return null;
00268         }
00269 
00270         $parts = explode('&', $query);
00271 
00272         $new_parts = array();
00273         for ($i = 0; $i < count($parts); $i++) {
00274             $pair = explode('=', $parts[$i]);
00275 
00276             if (count($pair) != 2) {
00277                 continue;
00278             }
00279 
00280             list($key, $value) = $pair;
00281             $new_parts[$key] = urldecode($value);
00282         }

toBytes ( str  ) 

Get the bytes in a string independently of multibyte support conditions.

Definiert in Zeile 470 der Datei OpenID.php.

00474     {
00475         $hex = bin2hex($str);
00476 
00477         if (!$hex) {
00478             return array();
00479         }
00480 
00481         $b = array();
00482         for ($i = 0; $i < strlen($hex); $i += 2) {
00483             $b[] = chr(base_convert(substr($hex, $i, 2), 16, 10));
00484         }

update ( &$  dest,
&$  src 
)

Definiert in Zeile 510 der Datei OpenID.php.

00514     {
00515         foreach ($src as $k => $v) {

urldefrag ( url  ) 

Definiert in Zeile 486 der Datei OpenID.php.

00490     {
00491         $parts = explode("#", $url, 2);
00492 
00493         if (count($parts) == 1) {
00494             return array($parts[0], "");
00495         } else {

urlunparse ( scheme,
host,
port = null,
path = '/',
query = '',
fragment = '' 
)

Implements python's urlunparse, which is not available in PHP. Given the specified components of a URL, this function rebuilds and returns the URL.

private

Parameter:
string $scheme The scheme (e.g. 'http'). Defaults to 'http'.
string $host The host. Required.
string $port The port.
string $path The path.
string $query The query.
string $fragment The fragment.
Rückgabe:
string $url The URL resulting from assembling the specified components.

Definiert in Zeile 367 der Datei OpenID.php.

00372     {
00373 
00374         if (!$scheme) {
00375             $scheme = 'http';
00376         }
00377 
00378         if (!$host) {
00379             return false;
00380         }
00381 
00382         if (!$path) {
00383             $path = '';
00384         }
00385 
00386         $result = $scheme . "://" . $host;
00387 
00388         if ($port) {
00389             $result .= ":" . $port;
00390         }
00391 
00392         $result .= $path;
00393 
00394         if ($query) {
00395             $result .= "?" . $query;
00396         }
00397 
00398         if ($fragment) {
00399             $result .= "#" . $fragment;
00400         }


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen