本文整理汇总了PHP中loader::_option方法的典型用法代码示例。如果您正苦于以下问题:PHP loader::_option方法的具体用法?PHP loader::_option怎么用?PHP loader::_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类loader
的用法示例。
在下文中一共展示了loader::_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($title, $err_no = 0)
{
if (class_exists('loader', false) && !loader::_option(loader::OPTION_TESTING)) {
$this->log_id = false;
if ($err_no == self::CRITICAL) {
echo "<h1 style='color:darkred'>Danger! {$title} </h1>";
} else {
// override email
if (class_exists('core', 0) && core::selfie()) {
$this->bugs_email = core::selfie()->cfg('email', $this->bugs_email);
}
// log if logger available
if ($this->logable && class_exists('core', 0) && ($libs = core::libs()) && $libs->is_registered('logger') && ($logger = core::lib('logger'))) {
$this->log_id = $logger->error($title, $err_no, $this->getTraceAsString());
}
}
}
parent::__construct($title, $err_no);
self::$last_exception = $this;
}
示例2: __construct
/**
* constructor
* $params goes to ->cfg('options.$')
* @throws exception
*/
public function __construct($params = array())
{
self::time_check('core-boot');
// bogus: fix loop with get_instance
if (!self::$_instance) {
self::$_instance = $this;
}
$initilize_after_load = $params === true;
if (empty($params) && !is_array($params)) {
$params = array();
}
$cfg_file = @$params['config-file'] ?: 'engine';
$cfg_file = loader::get_docs() . $cfg_file . '.cfg';
if (fs::file_exists($cfg_file)) {
// echo('[error] Configuration file not found');
$this->init_config(parse_ini_file($cfg_file, true));
}
// override core-config
if (!empty($params['config'])) {
$this->config = array_merge($this->config, $params['config']);
}
// multiconfig config/domain.engine.cfg
$host = @$_SERVER['HTTP_HOST'];
$host = strpos($host, 'www.') === 0 ? substr($host, 4) : $host;
if ($this->cfg('multidomain_config', false) && $host) {
$host = str_replace(':', '.', $host);
// localhost:8002
$host_config = loader::get_docs() . $host . '.engine.cfg';
if (fs::file_exists($host_config)) {
$this->init_config(parse_ini_file($host_config, true), abs_config::INIT_APPEND);
}
}
setlocale(LC_ALL, $locale = $this->cfg('locale', 'ru_RU.UTF8'));
if (loader::is_windows()) {
list($lang, $codeset) = explode('.', $locale);
$lang = substr($lang, 0, 2);
putenv('LANG=' . $lang . '.' . $codeset);
putenv('LANGUAGE=' . $lang . '.' . $codeset);
//bind_textdomain_codeset('mydomain', $codeset);
}
if (fs::file_exists($libs_file = loader::get_docs() . 'libs.cfg')) {
self::$system_libs = parse_ini_file($libs_file, true);
}
self::$libs = new core_libs();
$duagent = $this->cfg('debugger_agent', 'iamdebugger');
// compare only lside of agent, because firephp or something add its stuff to end
if (isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($duagent)) === $duagent || !empty($params['debug'])) {
self::set_debug(!empty($params['debug']) ? $params['debug'] : $this->cfg('debug', self::E_INFO));
if (!self::is_debug()) {
self::register_lib('console', new SatCMS\Modules\Core\Console\FakeConsole());
} else {
if (array_key_exists('console', self::$system_libs)) {
// load external console
self::lib('console');
} else {
// bind console (modules/core/console)
self::register_lib('console', new Debug_HackerConsole_Main(!$this->cfg('no_console') && !loader::in_shell() && !loader::in_ajax() || loader::in_ajax() && $this->cfg('debug_ajax', false)));
}
}
} else {
if (!loader::in_shell()) {
self::$_debug_level = false;
//@todo fix blank page on errors without debug enabled
ini_set('display_errors', 'off');
} else {
// enable debug messages in shell
self::set_debug($this->cfg('shell_debug_level', self::E_INFO));
}
}
if (self::is_debug() && (!loader::in_ajax() || $this->cfg('debug_ajax', false)) && !loader::_option(loader::OPTION_TESTING) && class_exists('\\Whoops\\Run')) {
$whoops = new \Whoops\Run();
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
$whoops->register();
$this->set_cfg_var('with_debugger', true);
}
// build module
parent::__construct(loader::get_public(loader::DIR_MODULES) . __CLASS__ . '/', array('options' => $params));
if ($initilize_after_load) {
$this->init();
}
}