/**
* The library version string
*/
-define('Auth_OpenID_VERSION', '2.1.3');
+define('Auth_OpenID_VERSION', '2.2.2');
/**
* Require the fetcher code.
define('Auth_OpenID_punct',
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
-if (Auth_OpenID_getMathLib() === null) {
- Auth_OpenID_setNoMathSupport();
-}
+Auth_OpenID_include_init();
/**
* The OpenID utility function class.
*
* @access private
*/
- function isFailure($thing)
+ static function isFailure($thing)
{
return is_a($thing, 'Auth_OpenID_FailureResponse');
}
* Returns an empty array if neither GET nor POST was used, or if
* POST was used but php://input cannot be opened.
*
+ * See background:
+ * http://lists.openidenabled.com/pipermail/dev/2007-March/000395.html
+ *
* @access private
*/
- function getQuery($query_str=null)
+ static function getQuery($query_str=null)
{
$data = array();
return $data;
}
- function params_from_string($str)
+ static function params_from_string($str)
{
$chunks = explode("&", $str);
}
list($k, $v) = $parts;
- $data[$k] = urldecode($v);
+ $data[urldecode($k)] = urldecode($v);
}
return $data;
*
* @access private
*/
- function ensureDir($dir_name)
+ static function ensureDir($dir_name)
{
if (is_dir($dir_name) || @mkdir($dir_name)) {
return true;
*
* @access private
*/
- function addPrefix($values, $prefix)
+ static function addPrefix($values, $prefix)
{
$new_values = array();
foreach ($values as $s) {
*
* @access private
*/
- function arrayGet($arr, $key, $fallback = null)
+ static function arrayGet($arr, $key, $fallback = null)
{
if (is_array($arr)) {
if (array_key_exists($key, $arr)) {
/**
* Replacement for PHP's broken parse_str.
*/
- function parse_str($query)
+ static function parse_str($query)
{
if ($query === null) {
return null;
}
list($key, $value) = $pair;
- $new_parts[$key] = urldecode($value);
+ $new_parts[urldecode($key)] = urldecode($value);
}
return $new_parts;
* pairs from $data into a URL query string
* (e.g. "username=bob&id=56").
*/
- function httpBuildQuery($data)
+ static function httpBuildQuery($data)
{
$pairs = array();
foreach ($data as $key => $value) {
* @return string $url The original URL with the new parameters added.
*
*/
- function appendArgs($url, $args)
+ static function appendArgs($url, $args)
{
if (count($args) == 0) {
return $url;
* @return string $url The URL resulting from assembling the
* specified components.
*/
- function urlunparse($scheme, $host, $port = null, $path = '/',
+ static function urlunparse($scheme, $host, $port = null, $path = '/',
$query = '', $fragment = '')
{
* @return mixed $new_url The URL after normalization, or null if
* $url was malformed.
*/
- function normalizeUrl($url)
+ static function normalizeUrl($url)
{
@$parsed = parse_url($url);
*
* @access private
*/
- function intval($value)
+ static function intval($value)
{
$re = "/^\\d+$/";
* @param string $str The string of bytes to count.
* @return int The number of bytes in $str.
*/
- function bytes($str)
+ static function bytes($str)
{
return strlen(bin2hex($str)) / 2;
}
* Get the bytes in a string independently of multibyte support
* conditions.
*/
- function toBytes($str)
+ static function toBytes($str)
{
$hex = bin2hex($str);
return $b;
}
- function urldefrag($url)
+ static function urldefrag($url)
{
$parts = explode("#", $url, 2);
}
}
- function filter($callback, &$sequence)
+ static function filter($callback, &$sequence)
{
$result = array();
return $result;
}
- function update(&$dest, &$src)
+ static function update(&$dest, &$src)
{
foreach ($src as $k => $v) {
$dest[$k] = $v;
*
* @param string $format_string The sprintf format for the message
*/
- function log($format_string)
+ static function log($format_string)
{
$args = func_get_args();
$message = call_user_func_array('sprintf', $args);
error_log($message);
}
- function autoSubmitHTML($form, $title="OpenId transaction in progress")
+ static function autoSubmitHTML($form, $title="OpenId transaction in progress")
{
return("<html>".
"<head><title>".
"</html>");
}
}
-?>
+
+/*
+ * Function to run when this file is included.
+ * Abstracted to a function to make life easier
+ * for some PHP optimizers.
+ */
+function Auth_OpenID_include_init() {
+ if (Auth_OpenID_getMathLib() === null) {
+ Auth_OpenID_setNoMathSupport();
+ }
+}