本文整理汇总了PHP中AppConfig::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP AppConfig::configure方法的具体用法?PHP AppConfig::configure怎么用?PHP AppConfig::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppConfig
的用法示例。
在下文中一共展示了AppConfig::configure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct a new App object
*
* @param String $uri an optional relative URI (e.g. "/folder/file")
*/
public function __construct($uri = NULL)
{
if (is_null($uri)) {
$uri = $_SERVER['REQUEST_URI'];
}
// Setup the config, prefix and assert checks
$config = AppConfig::configure();
load_helper('HTML', 'Text');
load_tools('Log', 'Translate');
$this->error_messages = array();
$this->assert_checking($config);
// Set the content type, folder and file
$uri = preg_replace('/[\\?#].*/', '', $uri);
$content_type = preg_match('/\\.(\\w+)$/', $uri, $matches) ? $matches[1] : DEFAULT_CONTENT_TYPE;
if ($content_type === Symbol::TEST && !Config::get('TESTING_ENABLED')) {
$content_type = DEFAULT_CONTENT_TYPE;
}
$uri = $this->set_lang_and_remove_prefix($uri);
$this->parts = explode('/', $uri);
$folder = $this->get_part(0, TRUE);
// remove any extension
$file = $this->get_part(1, TRUE);
// remove any extension
// Setup the application request environment
$this->content_type = strtolower($content_type);
// e.g. "html", "test"
$this->folder = strlen($folder) > 0 ? $folder : DEFAULT_FOLDER;
$this->file = strlen($file) > 0 ? $file : DEFAULT_FILE;
$this->is_testing = $this->is_testing || array_key($_REQUEST, Symbol::TEST) || $content_type === Symbol::TEST;
if ($this->is_testing) {
Log::type(Symbol::TEST);
}
// If we're testing then use a test database
require_once 'lib/Model.php';
$model = new Model();
$db_test = Config::get('DB_DATABASE_TEST', TRUE);
$db_live = Config::get('DB_DATABASE_LIVE', TRUE);
$database = $this->is_testing ? $db_test : $db_live;
$model->set_database($database);
// Setup the language translations
Translate::add_translations(Config::load('validate'));
Translate::add_translations(Config::load('translate'));
// Register this app as a prop
YAWF::prop(Symbol::APP, $this);
}