Auth/OpenID/BigMath.php-Dateireferenz

gehe zum Quellcode dieser Datei

Datenstrukturen

class  Auth_OpenID_MathLibrary
class  Auth_OpenID_BcMathWrapper
class  Auth_OpenID_GmpMathWrapper

Namensbereiche

namespace  OpenID

Funktionen

 Auth_OpenID_math_extensions ()
 Auth_OpenID_detectMathLibrary ($exts)
Auth_OpenID_getMathLib ()
 Auth_OpenID_setNoMathSupport ()
 Auth_OpenID_noMathSupport ()


Dokumentation der Funktionen

Auth_OpenID_detectMathLibrary ( exts  ) 

Detect which (if any) math library is available

Definiert in Zeile 365 der Datei BigMath.php.

00366 {
00367     $loaded = false;
00368 
00369     foreach ($exts as $extension) {
00370         // See if the extension specified is already loaded.
00371         if ($extension['extension'] &&
00372             extension_loaded($extension['extension'])) {
00373             $loaded = true;
00374         }
00375 
00376         // Try to load dynamic modules.
00377         if (!$loaded) {
00378             foreach ($extension['modules'] as $module) {
00379                 if (@dl($module . "." . PHP_SHLIB_SUFFIX)) {
00380                     $loaded = true;
00381                     break;
00382                 }
00383             }
00384         }
00385 
00386         // If the load succeeded, supply an instance of
00387         // Auth_OpenID_MathWrapper which wraps the specified
00388         // module's functionality.
00389         if ($loaded) {
00390             return $extension;
00391         }
00392     }
00393 
00394     return false;
00395 }

& Auth_OpenID_getMathLib (  ) 

Definiert in Zeile 419 der Datei BigMath.php.

00420 {
00421     // The instance of Auth_OpenID_MathWrapper that we choose to
00422     // supply will be stored here, so that subseqent calls to this
00423     // method will return a reference to the same object.
00424     static $lib = null;
00425 
00426     if (isset($lib)) {
00427         return $lib;
00428     }
00429 
00430     if (Auth_OpenID_noMathSupport()) {
00431         $null = null;
00432         return $null;
00433     }
00434 
00435     // If this method has not been called before, look at
00436     // Auth_OpenID_math_extensions and try to find an extension that
00437     // works.
00438     $ext = Auth_OpenID_detectMathLibrary(Auth_OpenID_math_extensions());
00439     if ($ext === false) {
00440         $tried = array();
00441         foreach (Auth_OpenID_math_extensions() as $extinfo) {
00442             $tried[] = $extinfo['extension'];
00443         }
00444         $triedstr = implode(", ", $tried);
00445 
00446         Auth_OpenID_setNoMathSupport();
00447 
00448         $result = null;
00449         return $result;
00450     }
00451 
00452     // Instantiate a new wrapper
00453     $class = $ext['class'];
00454     $lib = new $class();
00455 
00456     return $lib;
00457 }

Auth_OpenID_math_extensions (  ) 

Define the supported extensions. An extension array has keys 'modules', 'extension', and 'class'. 'modules' is an array of PHP module names which the loading code will attempt to load. These values will be suffixed with a library file extension (e.g. ".so"). 'extension' is the name of a PHP extension which will be tested before 'modules' are loaded. 'class' is the string name of a Auth_OpenID_MathWrapper subclass which should be instantiated if a given extension is present.

You can define new math library implementations and add them to this array.

Definiert in Zeile 343 der Datei BigMath.php.

00344 {
00345     $result = array();
00346 
00347     if (!defined('Auth_OpenID_BUGGY_GMP')) {
00348         $result[] =
00349             array('modules' => array('gmp', 'php_gmp'),
00350                   'extension' => 'gmp',
00351                   'class' => 'Auth_OpenID_GmpMathWrapper');
00352     }
00353 
00354     $result[] = array(
00355                       'modules' => array('bcmath', 'php_bcmath'),
00356                       'extension' => 'bcmath',
00357                       'class' => 'Auth_OpenID_BcMathWrapper');
00358 
00359     return $result;
00360 }

Auth_OpenID_noMathSupport (  ) 

Definiert in Zeile 466 der Datei BigMath.php.

00467 {
00468     return defined('Auth_OpenID_NO_MATH_SUPPORT');
00469 }

Auth_OpenID_setNoMathSupport (  ) 

Definiert in Zeile 459 der Datei BigMath.php.

00460 {
00461     if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
00462         define('Auth_OpenID_NO_MATH_SUPPORT', true);
00463     }
00464 }

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