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


PHP runkit_constant_redefine函數代碼示例

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


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

示例1: init

 /**
  * 應用程序初始化
  * @access public
  * @return void
  */
 public static function init()
 {
     // 加載動態應用公共文件和配置
     load_ext_file(COMMON_PATH);
     // 日誌目錄轉換為絕對路徑 默認情況下存儲到公共模塊下麵
     C('LOG_PATH', realpath(LOG_PATH) . '/Common/');
     // 定義當前請求的係統常量
     runkit_constant_redefine('NOW_TIME', $_SERVER['REQUEST_TIME']);
     runkit_constant_redefine('REQUEST_METHOD', $_SERVER['REQUEST_METHOD']);
     runkit_constant_redefine('IS_GET', REQUEST_METHOD == 'GET' ? true : false);
     runkit_constant_redefine('IS_POST', REQUEST_METHOD == 'POST' ? true : false);
     runkit_constant_redefine('IS_PUT', REQUEST_METHOD == 'PUT' ? true : false);
     runkit_constant_redefine('IS_DELETE', REQUEST_METHOD == 'DELETE' ? true : false);
     // URL調度
     Dispatcher::dispatch();
     if (C('REQUEST_VARS_FILTER')) {
         // 全局安全過濾
         array_walk_recursive($_GET, 'think_filter');
         array_walk_recursive($_POST, 'think_filter');
         array_walk_recursive($_REQUEST, 'think_filter');
     }
     // URL調度結束標簽
     Hook::listen('url_dispatch');
     runkit_constant_redefine('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' || !empty($_POST[C('VAR_AJAX_SUBMIT')]) || !empty($_GET[C('VAR_AJAX_SUBMIT')]) ? true : false);
     // TMPL_EXCEPTION_FILE 改為絕對地址
     C('TMPL_EXCEPTION_FILE', realpath(C('TMPL_EXCEPTION_FILE')));
     return;
 }
開發者ID:meimingmm,項目名稱:swoole-thinkphp,代碼行數:33,代碼來源:App.class.php

示例2: testWhichCrlf

 /**
  * @using runkit pecl extension
  * if not define PMA_USR_OS, then define it as Win
  * if installed runkit, then constant will not change
  */
 public function testWhichCrlf()
 {
     $runkit = function_exists('runkit_constant_redefine');
     if ($runkit && defined('PMA_USR_OS')) {
         $pma_usr_os = PMA_USR_OS;
     }
     if (defined('PMA_USR_OS') && !$runkit) {
         if (PMA_USR_OS == 'Win') {
             $this->assertEquals("\r\n", PMA_whichCrlf());
         } else {
             $this->assertEquals("\n", PMA_whichCrlf());
         }
         $this->markTestIncomplete('Cannot redefine constant');
     } else {
         if ($runkit) {
             define('PMA_USR_OS', 'Linux');
             $this->assertEquals("\n", PMA_whichCrlf());
         }
         if ($runkit) {
             runkit_constant_redefine('PMA_USR_OS', 'Win');
         } else {
             define('PMA_USR_OS', 'Win');
         }
         $this->assertEquals("\r\n", PMA_whichCrlf());
     }
     if ($runkit) {
         if (isset($pma_usr_os)) {
             runkit_constant_redefine('PMA_USR_OS', 'Win');
         } else {
             runkit_constant_remove('PMA_USR_OS');
         }
     }
 }
開發者ID:bugyak,項目名稱:phporadmin,代碼行數:38,代碼來源:PMA_whichCrlf_test.php

示例3: redefineConstant

 /**
  * @param RunkitConstant $constant
  *
  * @return boolean
  */
 public function redefineConstant(\Runkit\RunkitConstant $constant)
 {
     if (!function_exists('runkit_constant_redefine')) {
         return false;
     }
     return runkit_constant_redefine($constant->getName(), $constant->getValue());
 }
開發者ID:oncesk,項目名稱:runkit,代碼行數:12,代碼來源:Executor.php

示例4: resetConstant

 /**
  *	Reset original definition.
  */
 public static function resetConstant($constant)
 {
     $originalConstant = "__ORIGINAL_{$constant}";
     if (defined($originalConstant)) {
         runkit_constant_redefine($constant, constant($originalConstant));
         runkit_constant_remove($originalConstant);
     }
 }
開發者ID:v-technologies,項目名稱:transformist,代碼行數:11,代碼來源:Runkit.php

示例5: testGetImplementation

 public function testGetImplementation()
 {
     $nativePathClass = strtoupper(substr(PHP_OS, 0, 3)) === "WIN" ? "Spol\\Path\\WindowsPath" : "Spol\\Path\\UnixPath";
     $this->assertInstanceOf($nativePathClass, Path::getImplementation());
     runkit_constant_redefine("Spol\\Path\\Path::OS", "WINNT");
     $this->assertInstanceOf("Spol\\Path\\WindowsPath", Path::getImplementation());
     runkit_constant_redefine("Spol\\Path\\Path::OS", "Darwin");
     $this->assertInstanceOf("Spol\\Path\\UnixPath", Path::getImplementation());
 }
開發者ID:spol,項目名稱:path,代碼行數:9,代碼來源:PathTest.php

示例6: ensureConstant

 /**
  * @param string $constant
  * @param mixed $expected
  *
  * @return null
  */
 protected static function ensureConstant($constant, $expected)
 {
     if (defined($constant)) {
         $value = constant($constant);
         if ($value !== $expected) {
             if (extension_loaded('runkit')) {
                 if (!runkit_constant_redefine($constant, $expected)) {
                     self::markTestSkipped(sprintf("Failed to redefine constant %s to %s", $constant, $expected));
                 }
             } else {
                 self::markTestSkipped(sprintf("Skipping test because constant %s is %s instead of %s", $constant, $value, $expected));
             }
         }
     } else {
         define($constant, $expected);
     }
 }
開發者ID:msulistijo,項目名稱:PhpseclibBundle,代碼行數:23,代碼來源:PhpseclibTestCase.php

示例7: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     // Drizzle does not support GIS data types
     if (!defined("PMA_DRIZZLE")) {
         define("PMA_DRIZZLE", false);
     } else {
         if (PMA_DRIZZLE) {
             //PMA_DRIZZLE is defined and PMA_DRIZZLE = true
             if (PMA_HAS_RUNKIT) {
                 runkit_constant_redefine("PMA_DRIZZLE", false);
             } else {
                 //Drizzle does not support GIS data types
                 $this->markTestSkipped("Drizzle does not support GIS data types");
             }
         }
     }
     //setting
     $GLOBALS['plugin_param'] = 'table';
     $GLOBALS['finished'] = false;
     $GLOBALS['read_limit'] = 100000000;
     $GLOBALS['offset'] = 0;
     $GLOBALS['cfg']['Server']['DisableIS'] = false;
     $GLOBALS['cfg']['ServerDefault'] = 0;
     $GLOBALS['cfg']['AllowUserDropDatabase'] = false;
     $GLOBALS['import_file'] = 'test/test_data/timezone.shp.zip';
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $GLOBALS['dbi'] = $dbi;
     include_once 'libraries/plugins/import/ImportShp.class.php';
     $this->object = new ImportShp();
     /**
      * Load interface for zip extension.
      */
     include_once 'libraries/zip_extension.lib.php';
     $result = PMA_getZipContents($GLOBALS['import_file']);
     $GLOBALS['import_text'] = $result["data"];
     $GLOBALS['compression'] = 'application/zip';
     $GLOBALS['read_multiply'] = 10;
     $GLOBALS['import_type'] = 'ods';
     $GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
 }
開發者ID:yonh,項目名稱:php-mvc,代碼行數:48,代碼來源:ImportShp_test.php

示例8: testWhichCrlf

 /**
  * Test for whichCrlf
  *
  * @return void
  *
  * @using runkit pecl extension
  * if not define PMA_USR_OS, then define it as Win
  * if installed runkit, then constant will not change
  */
 public function testWhichCrlf()
 {
     if (PMA_HAS_RUNKIT && defined('PMA_USR_OS')) {
         $pma_usr_os = PMA_USR_OS;
     }
     if (defined('PMA_USR_OS') && !PMA_HAS_RUNKIT) {
         if (PMA_USR_OS == 'Win') {
             $this->assertEquals("\r\n", PMA_Util::whichCrlf());
         } else {
             $this->assertEquals("\n", PMA_Util::whichCrlf());
         }
         $this->markTestIncomplete('Cannot redefine constant');
     } else {
         if (PMA_HAS_RUNKIT) {
             if (!defined('PMA_USR_OS')) {
                 define('PMA_USR_OS', 'Linux');
             } else {
                 runkit_constant_redefine('PMA_USR_OS', 'Linux');
             }
             $this->assertEquals("\n", PMA_Util::whichCrlf());
         }
         if (PMA_HAS_RUNKIT) {
             runkit_constant_redefine('PMA_USR_OS', 'Win');
         } else {
             define('PMA_USR_OS', 'Win');
         }
         $this->assertEquals("\r\n", PMA_Util::whichCrlf());
     }
     if (PMA_HAS_RUNKIT) {
         if (isset($pma_usr_os)) {
             runkit_constant_redefine('PMA_USR_OS', 'Win');
         } else {
             runkit_constant_remove('PMA_USR_OS');
         }
     }
 }
開發者ID:xtreme-jamil-shamy,項目名稱:phpmyadmin-cf,代碼行數:45,代碼來源:PMA_whichCrlf_test.php

示例9: setUp

 /**
  * Configures environment
  *
  * @return void
  */
 protected function setUp()
 {
     //we test:
     //1. without Runkit,  PMA_DRIZZLE = false;
     //2. with Runkit,  PMA_DRIZZLE = true;
     if (!defined("PMA_DRIZZLE")) {
         define("PMA_DRIZZLE", false);
     }
     parent::setUp();
     //RunKit
     if (PMA_HAS_RUNKIT) {
         runkit_constant_redefine("PMA_DRIZZLE", true);
     }
 }
開發者ID:kfjihailong,項目名稱:phpMyAdmin,代碼行數:19,代碼來源:PMA_Table_test.php

示例10: runkit_constant_redefine

<?php

namespace Think\Upload\Driver\Bcs;

use Think\Upload\Driver\Bcs\BCS_MimeTypes;
use Think\Upload\Driver\Bcs\BCS_RequestCore;
use Think\Upload\Driver\Bcs\BCS_ResponseCore;
if (!defined('BCS_API_PATH')) {
    runkit_constant_redefine('BCS_API_PATH', dirname(__FILE__));
}
//AK 公鑰
define('BCS_AK', '');
//SK 私鑰
define('BCS_SK', '');
//superfile 每個object分片後綴
define('BCS_SUPERFILE_POSTFIX', '_bcs_superfile_');
//sdk superfile分片大小 ,單位 B(字節)
define('BCS_SUPERFILE_SLICE_SIZE', 1024 * 1024);
require_once BCS_API_PATH . '/requestcore.class.php';
require_once BCS_API_PATH . '/mimetypes.class.php';
/**
 * Default BCS Exception.
 */
class BCS_Exception extends \Exception
{
}
/**
 * BCS API
 */
class BaiduBCS
{
開發者ID:meimingmm,項目名稱:swoole-thinkphp,代碼行數:31,代碼來源:bcs.class.php

示例11: testPMAGetSqlQueriesForDisplayAndAddUser

    /**
     * Test for PMA_getSqlQueriesForDisplayAndAddUser
     *
     * @return void
     */
    public function testPMAGetSqlQueriesForDisplayAndAddUser()
    {
        $restoreMySQLVersion = "PMANORESTORE";

        if (! PMA_HAS_RUNKIT) {
            $this->markTestSkipped(
                'Cannot redefine constant. Missing runkit extension'
            );
        } else {
            $restoreMySQLVersion = PMA_MYSQL_INT_VERSION;
            runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50706);
        }

        $username = "PMA_username";
        $hostname = "PMA_hostname";
        $password = "pma_password";
        $_POST['pred_password'] = 'keep';
        $_REQUEST['authentication_plugin'] = 'mysql_native_password';
        $dbname = "PMA_db";

        list($create_user_real, $create_user_show, $real_sql_query, $sql_query)
            = PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password);

        //validate 1: $create_user_real
        $this->assertEquals(
            "CREATE USER 'PMA_username'@'PMA_hostname' IDENTIFIED "
            . "WITH mysql_native_password AS 'pma_password';",
            $create_user_real
        );

        //validate 2: $create_user_show
        $this->assertEquals(
            "CREATE USER 'PMA_username'@'PMA_hostname' IDENTIFIED "
            . "WITH mysql_native_password AS '***';",
            $create_user_show
        );

        //validate 3:$real_sql_query
        $this->assertEquals(
            "GRANT USAGE ON *.* TO 'PMA_username'@'PMA_hostname' REQUIRE NONE;",
            $real_sql_query
        );

        //validate 4:$sql_query
        $this->assertEquals(
            "GRANT USAGE ON *.* TO 'PMA_username'@'PMA_hostname' REQUIRE NONE;",
            $sql_query
        );

        //test for PMA_addUserAndCreateDatabase
        list($sql_query, $message) = PMA_addUserAndCreateDatabase(
            false, $real_sql_query, $sql_query, $username, $hostname, $dbname
        );

        //validate 5: $sql_query
        $this->assertEquals(
            "GRANT USAGE ON *.* TO 'PMA_username'@'PMA_hostname' REQUIRE NONE;",
            $sql_query
        );

        //validate 6: $message
        $this->assertEquals(
            "You have added a new user.",
            $message->getMessage()
        );

        if ($restoreMySQLVersion !== "PMANORESTORE") {
            runkit_constant_redefine('PMA_MYSQL_INT_VERSION', $restoreMySQLVersion);
        }
    }
開發者ID:nijel,項目名稱:phpmyadmin,代碼行數:75,代碼來源:PMA_server_privileges_test.php

示例12: define

 function define($k, $v)
 {
     if (defined($k)) {
         runkit_constant_redefine($k, $v);
     } else {
         runkit_constant_add($k, $v);
     }
 }
開發者ID:cobolbaby,項目名稱:phpdaemon,代碼行數:8,代碼來源:Worker.php

示例13: redefineConstant

 public static function redefineConstant($className, $constName, $value)
 {
     $runkitName = ($className === null ? "" : $className . "::") . $constName;
     yTest_debugCC("redefineConstant {$runkitName} to value " . var_export($value, true));
     $res = runkit_constant_redefine($runkitName, $value);
     yTest_assert($res);
 }
開發者ID:rsaugier,項目名稱:ytest,代碼行數:7,代碼來源:yTest_Reflection.php

示例14: _defineConstant

 /**
  * Defines resp. redefines a constant.
  *
  * @param string $name  A name.
  * @param string $value A value.
  *
  * @return void
  */
 private function _defineConstant($name, $value)
 {
     if (!defined($name)) {
         define($name, $value);
     } else {
         runkit_constant_redefine($name, $value);
     }
 }
開發者ID:bbfriend,項目名稱:realblog_xh,代碼行數:16,代碼來源:ArticleViewTest.php

示例15: testSendHeaderLocationWithSidUrlWithoutQuestionMark

 /**
  * Test for PMA_sendHeaderLocation
  *
  * @return void
  */
 public function testSendHeaderLocationWithSidUrlWithoutQuestionMark()
 {
     if (defined('PMA_TEST_HEADERS')) {
         runkit_constant_redefine('SID', md5('test_hash'));
         $testUri = 'http://testurl.com/test.php';
         $header = array('Location: ' . $testUri . '?' . SID);
         PMA_sendHeaderLocation($testUri);
         // sets $GLOBALS['header']
         $this->assertEquals($header, $GLOBALS['header']);
     } else {
         $this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
     }
 }
開發者ID:bamarni,項目名稱:phpmyadmin,代碼行數:18,代碼來源:PMA_headerLocation_test.php


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