summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-04-04 22:55:40 +0000
committertailor <cygnus@janrain.com>2007-04-04 22:55:40 +0000
commit9bd1ca15e7f07e3c5ab28edddcf244555b2887ce (patch)
tree231d6b5a3041a5476033d2dd85eee852b3bc613c /Auth
parentf53a81c83f27a5d84e998b197b6569e35a12df8b (diff)
downloadphp-openid-9bd1ca15e7f07e3c5ab28edddcf244555b2887ce.zip
php-openid-9bd1ca15e7f07e3c5ab28edddcf244555b2887ce.tar.gz
php-openid-9bd1ca15e7f07e3c5ab28edddcf244555b2887ce.tar.bz2
[project @ Move math extension data into a function]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/OpenID/BigMath.php39
1 files changed, 21 insertions, 18 deletions
diff --git a/Auth/OpenID/BigMath.php b/Auth/OpenID/BigMath.php
index f8188a3..cfa0b35 100644
--- a/Auth/OpenID/BigMath.php
+++ b/Auth/OpenID/BigMath.php
@@ -340,20 +340,24 @@ class Auth_OpenID_GmpMathWrapper extends Auth_OpenID_MathLibrary{
* You can define new math library implementations and add them to
* this array.
*/
-global $_Auth_OpenID_math_extensions;
-$_Auth_OpenID_math_extensions = array();
-
-if (!defined('Auth_OpenID_BUGGY_GMP')) {
- $_Auth_OpenID_math_extensions[] =
- array('modules' => array('gmp', 'php_gmp'),
- 'extension' => 'gmp',
- 'class' => 'Auth_OpenID_GmpMathWrapper');
-}
+function Auth_OpenID_math_extensions()
+{
+ $result = array();
+
+ if (!defined('Auth_OpenID_BUGGY_GMP')) {
+ $result[] =
+ array('modules' => array('gmp', 'php_gmp'),
+ 'extension' => 'gmp',
+ 'class' => 'Auth_OpenID_GmpMathWrapper');
+ }
+
+ $result[] = array(
+ 'modules' => array('bcmath', 'php_bcmath'),
+ 'extension' => 'bcmath',
+ 'class' => 'Auth_OpenID_BcMathWrapper');
-$_Auth_OpenID_math_extensions[] = array(
- 'modules' => array('bcmath', 'php_bcmath'),
- 'extension' => 'bcmath',
- 'class' => 'Auth_OpenID_BcMathWrapper');
+ return $result;
+}
/**
* Detect which (if any) math library is available
@@ -397,7 +401,7 @@ function Auth_OpenID_detectMathLibrary($exts)
* functionality.
*
* Checks for the existence of an extension module described by the
- * local {@link Auth_OpenID_math_extensions} array and returns an
+ * result of {@link Auth_OpenID_math_extensions()} and returns an
* instance of a wrapper for that extension module. If no extension
* module is found, an instance of {@link Auth_OpenID_MathWrapper} is
* returned, which wraps the native PHP integer implementation. The
@@ -429,13 +433,12 @@ function &Auth_OpenID_getMathLib()
}
// If this method has not been called before, look at
- // $Auth_OpenID_math_extensions and try to find an extension that
+ // Auth_OpenID_math_extensions and try to find an extension that
// works.
- global $_Auth_OpenID_math_extensions;
- $ext = Auth_OpenID_detectMathLibrary($_Auth_OpenID_math_extensions);
+ $ext = Auth_OpenID_detectMathLibrary(Auth_OpenID_math_extensions());
if ($ext === false) {
$tried = array();
- foreach ($_Auth_OpenID_math_extensions as $extinfo) {
+ foreach (Auth_OpenID_math_extensions() as $extinfo) {
$tried[] = $extinfo['extension'];
}
$triedstr = implode(", ", $tried);