本文整理汇总了PHP中core::libs方法的典型用法代码示例。如果您正苦于以下问题:PHP core::libs方法的具体用法?PHP core::libs怎么用?PHP core::libs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::libs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例3: registry
/**
* constructor
* @throws exception
*/
function __construct()
{
$cfg_file = loader::get_docs() . 'engine.cfg';
if (fs::file_exists($cfg_file)) {
// echo('[error] Configuration file not found');
$this->init_config(parse_ini_file($cfg_file, true));
}
if (fs::file_exists($libs_file = loader::get_docs() . 'libs.cfg')) {
self::$system_libs = parse_ini_file($libs_file);
}
self::$libs = new registry();
$duagent = $this->get_cfg_var('debugger_agent', 'iamdebugger');
// compare only lside of agent, cause firephp or something adds its stuff to end
if (!isset($_SERVER['HTTP_USER_AGENT']) || substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($duagent)) != $duagent) {
if (!loader::in_shell()) {
self::$_debug_level = false;
ini_set('display_errors', 'off');
} else {
// enable debug messages in shell
self::set_debug($this->get_cfg_var('shell_debug_level', self::E_INFO));
}
} else {
// disable console when
if ((self::$_debug_level = $this->get_cfg_var('debug')) && !$this->get_cfg_var('no_console') && !loader::in_ajax()) {
self::register_lib('console', new Debug_HackerConsole_Main(!loader::in_shell()));
}
}
// Init cacher
if (self::lib_enabled('cache')) {
$cache = $this->lib('cache');
$cache->set_rate((int) $this->get_cfg_var('cache_rate', 1));
}
/*
@TODO get rid of them, compatibility only?
ident vars
using globals $cmd_{xxx} is depricated
do the $core->get_ident_var('{xxx}') instead;
*/
// @todo use self::TAG_ ..
self::$ident_vars = new registry(array('id' => 0 >= ($tmp = functions::request_var('id', -1)) ? false : $tmp, 'pid' => 0 >= ($tmp = functions::request_var('pid', -1)) ? false : $tmp, 'c' => functions::request_var('c', ''), 'op' => functions::request_var('op', ''), 'do' => functions::request_var('do', ''), 'type' => functions::request_var('type', ''), 'embed' => functions::request_var('embed', ''), 'start' => functions::request_var('start', 0), '2print' => functions::request_var('2print', ''), 'module' => preg_replace('/[^\\w\\d]/', '', functions::request_var('m', ''))));
// construct module
parent::__construct(loader::get_root() . loader::DIR_MODULES . __CLASS__ . '/');
}