當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Auth_OpenID_math_extensions函數代碼示例

本文整理匯總了PHP中Auth_OpenID_math_extensions函數的典型用法代碼示例。如果您正苦於以下問題:PHP Auth_OpenID_math_extensions函數的具體用法?PHP Auth_OpenID_math_extensions怎麽用?PHP Auth_OpenID_math_extensions使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Auth_OpenID_math_extensions函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: detect_math

function detect_math($r, &$out)
{
    $out .= $r->h2('Math support');
    $ext = Auth_OpenID_detectMathLibrary(Auth_OpenID_math_extensions());
    if (!isset($ext['extension']) || !isset($ext['class'])) {
        $out .= $r->p('Your PHP installation does not include big integer math ' . 'support. This support is required if you wish to run a ' . 'secure OpenID server without using SSL.');
        $out .= $r->p('To use this library, you have a few options:');
        $gmp_lnk = $r->link('http://www.php.net/manual/en/ref.gmp.php', 'GMP');
        $bc_lnk = $r->link('http://www.php.net/manual/en/ref.bc.php', 'bcmath');
        $out .= $r->ol(array('Install the ' . $gmp_lnk . ' PHP extension', 'Install the ' . $bc_lnk . ' PHP extension', 'If your site is low-security, call ' . 'Auth_OpenID_setNoMathSupport(), defined in Auth/OpenID/BigMath.php. ', 'The library will function, but ' . 'the security of your OpenID server will depend on the ' . 'security of the network links involved. If you are only ' . 'using consumer support, you should still be able to operate ' . 'securely when the users are communicating with a ' . 'well-implemented server.'));
        return false;
    } else {
        switch ($ext['extension']) {
            case 'bcmath':
                $out .= $r->p('Your PHP installation has bcmath support. This is ' . 'adequate for small-scale use, but can be CPU-intensive. ' . 'You may want to look into installing the GMP extension.');
                $lnk = $r->link('http://www.php.net/manual/en/ref.gmp.php');
                $out .= $r->p('See ' . $lnk . ' for more information ' . 'about the GMP extension.');
                break;
            case 'gmp':
                $out .= $r->p('Your PHP installation has gmp support. Good.');
                break;
            default:
                $class = $ext['class'];
                $lib = new $class();
                $one = $lib->init(1);
                $two = $lib->add($one, $one);
                $t = $lib->toString($two);
                $out .= $r->p('Uh-oh. I do not know about the ' . $ext['extension'] . ' extension!');
                if ($t != '2') {
                    $out .= $r->p('It looks like it is broken. 1 + 1 = ' . var_export($t, false));
                    return false;
                } else {
                    $out .= $r->p('But it seems to be able to add one and one.');
                }
        }
        return true;
        // Math library is OK
    }
}
開發者ID:Jobava,項目名稱:diacritice-meta-repo,代碼行數:39,代碼來源:detect.php

示例2: Auth_OpenID_getMathLib

/**
 * {@link Auth_OpenID_getMathLib} checks for the presence of long
 * number extension modules and returns an instance of
 * {@link Auth_OpenID_MathWrapper} which exposes the module's
 * functionality.
 *
 * Checks for the existence of an extension module described by the
 * 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
 * proper calling convention for this method is $lib =
 * Auth_OpenID_getMathLib().
 *
 * This function checks for the existence of specific long number
 * implementations in the following order: GMP followed by BCmath.
 *
 * @return Auth_OpenID_MathWrapper $instance An instance of
 * {@link Auth_OpenID_MathWrapper} or one of its subclasses
 *
 * @package OpenID
 */
function Auth_OpenID_getMathLib()
{
    // The instance of Auth_OpenID_MathWrapper that we choose to
    // supply will be stored here, so that subseqent calls to this
    // method will return a reference to the same object.
    static $lib = null;
    if (isset($lib)) {
        return $lib;
    }
    if (Auth_OpenID_noMathSupport()) {
        $null = null;
        return $null;
    }
    // If this method has not been called before, look at
    // Auth_OpenID_math_extensions and try to find an extension that
    // works.
    $ext = Auth_OpenID_detectMathLibrary(Auth_OpenID_math_extensions());
    if ($ext === false) {
        $tried = array();
        foreach (Auth_OpenID_math_extensions() as $extinfo) {
            $tried[] = $extinfo['extension'];
        }
        $triedstr = implode(", ", $tried);
        Auth_OpenID_setNoMathSupport();
        $result = null;
        return $result;
    }
    // Instantiate a new wrapper
    $class = $ext['class'];
    $lib = new $class();
    return $lib;
}
開發者ID:ookwudili,項目名稱:chisimba,代碼行數:54,代碼來源:BigMath.php

示例3: exit

}
// ******** Math library selection ***********
// XXX FIXME
//     case '--math-lib':
//         $math_type[] = $value;
//         break;
if ($math_type && false) {
    if (defined('Auth_OpenID_NO_MATH_SUPPORT')) {
        print "--no-math and --math-lib are mutually exclusive\n";
        exit(1);
    }
    require_once 'Auth/OpenID/BigMath.php';
    $new_extensions = array();
    foreach ($math_type as $lib) {
        $found = false;
        foreach (Auth_OpenID_math_extensions() as $ext) {
            if ($ext['extension'] == $lib) {
                $new_extensions[] = $ext;
                $found = true;
                break;
            }
        }
        if (!$found) {
            print "Unknown math library specified: {$lib}\n";
            exit(1);
        }
    }
    $_Auth_OpenID_math_extensions = $new_extensions;
}
// ******** End math library selection **********
$suites = loadSuite($tests_to_run);
開發者ID:marcioyonamine,項目名稱:php-openid,代碼行數:31,代碼來源:texttest.php


注:本文中的Auth_OpenID_math_extensions函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。