本文整理汇总了PHP中GlobalConfig::GetInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP GlobalConfig::GetInstance方法的具体用法?PHP GlobalConfig::GetInstance怎么用?PHP GlobalConfig::GetInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalConfig
的用法示例。
在下文中一共展示了GlobalConfig::GetInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InitController
/**
* Initializes the controller to be tested and clears all previous
* authentication as well as output variable assignments
*
* @param string name of controller class (ex AccountController)
* @param bool true to clear all authentication
*/
function InitController($classname, $clearAuth = true)
{
$gc = GlobalConfig::GetInstance();
eval('$this->controller = new ' . $classname . '($this->phreezer, $this->renderEngine, $gc->GetContext(), $this->router );');
$this->controller->UnitTestMode = true;
$this->controller->CaptureOutputMode = true;
// clear all previous input
$this->InputClearAll();
// remove any authentication that was hanging around
if ($clearAuth) {
$this->ClearCurrentUser();
}
// get rid of any feedback or warnings
$this->renderEngine->clear("warning");
$this->renderEngine->clear("feedback");
$this->overrideController->OverrideSetContext("feedback", "");
$this->Println("-- Controller '{$classname}' initialized");
}
示例2: Exception
<?php
/** @package Pizzaria Meveana */
/* GlobalConfig object contains all configuration information for the app */
include_once "_global_config.php";
include_once "_app_config.php";
@(include_once "_machine_config.php");
if (!GlobalConfig::$CONNECTION_SETTING) {
throw new Exception('GlobalConfig::$CONNECTION_SETTING is not configured. Are you missing _machine_config.php?');
}
/* require framework libs */
require_once "verysimple/Phreeze/Dispatcher.php";
// the global config is used for all dependency injection
$gc = GlobalConfig::GetInstance();
try {
Dispatcher::Dispatch($gc->GetPhreezer(), $gc->GetRenderEngine(), '', $gc->GetContext(), $gc->GetRouter());
} catch (exception $ex) {
// This is the global error handler which will be called in the event of
// uncaught errors. If the endpoint appears to be an API request then
// render it as JSON, otherwise attempt to render a friendly HTML page
$url = RequestUtil::GetCurrentURL();
$isApiRequest = strpos($url, 'api/') !== false;
if ($isApiRequest) {
$result = new stdClass();
$result->success = false;
$result->message = $ex->getMessage();
$result->data = $ex->getTraceAsString();
@header('HTTP/1.1 401 Unauthorized');
echo json_encode($result);
} else {
$gc->GetRenderEngine()->assign("message", $ex->getMessage());
示例3: SetUrl
/**
* Set the url so that URL params can be read by the Router
* @param string $url
*/
function SetUrl($url)
{
$_REQUEST['_REWRITE_COMMAND'] = $url;
// calling get route is required in order to access params
GlobalConfig::GetInstance()->GetRouter()->GetRoute();
}