summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authorJosh Hoyt <josh@janrain.com>2006-02-01 21:04:11 +0000
committerJosh Hoyt <josh@janrain.com>2006-02-01 21:04:11 +0000
commite8ff781cac2490517ce6d6920217391f53fcb171 (patch)
treee734c5982f0dc4db5019de3fb582090cbd6396a4 /Auth
parentc0c77f56180e5e570295914fce493c6c8965da54 (diff)
downloadphp-openid-e8ff781cac2490517ce6d6920217391f53fcb171.zip
php-openid-e8ff781cac2490517ce6d6920217391f53fcb171.tar.gz
php-openid-e8ff781cac2490517ce6d6920217391f53fcb171.tar.bz2
[project @ Documentation and minor cleanup of BigMath.php]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/OpenID/BigMath.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/Auth/OpenID/BigMath.php b/Auth/OpenID/BigMath.php
index ffe768d..4a90903 100644
--- a/Auth/OpenID/BigMath.php
+++ b/Auth/OpenID/BigMath.php
@@ -329,7 +329,7 @@ class Auth_OpenID_GmpMathWrapper extends Auth_OpenID_MathLibrary{
* You can define new math library implementations and add them to
* this array.
*/
-$_Auth_OpenID_supported_extensions = array(
+$_Auth_OpenID_math_extensions = array(
array('modules' => array('gmp', 'php_gmp'),
'extension' => 'gmp',
'class' => 'Auth_OpenID_GmpMathWrapper'),
@@ -338,6 +338,9 @@ $_Auth_OpenID_supported_extensions = array(
'class' => 'Auth_OpenID_BcMathWrapper')
);
+/**
+ * Detect which (if any) math library is available
+ */
function Auth_OpenID_detectMathLibrary($exts)
{
$loaded = false;
@@ -363,7 +366,7 @@ function Auth_OpenID_detectMathLibrary($exts)
// Auth_OpenID_MathWrapper which wraps the specified
// module's functionality.
if ($loaded) {
- return $extension['class'];
+ return $extension;
}
}
@@ -409,8 +412,8 @@ function &Auth_OpenID_getMathLib()
// If this method has not been called before, look at
// $Auth_OpenID_supported_extensions and try to find an
// extension that works.
- global $_Auth_OpenID_supported_extensions;
- $ext = Auth_OpenID_detectMathLibrary($_Auth_OpenID_supported_extensions);
+ global $_Auth_OpenID_math_extensions;
+ $ext = Auth_OpenID_detectMathLibrary($_Auth_OpenID_math_extensions);
if ($ext === false) {
$tried = array();
foreach ($_Auth_OpenID_supported_extensions as $extinfo) {
@@ -424,7 +427,8 @@ function &Auth_OpenID_getMathLib()
}
// Instantiate a new wrapper
- $lib = new $ext();
+ $class = $ext['class'];
+ $lib = new $class();
return $lib;
}