本文整理汇总了PHP中GO::initialized方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::initialized方法的具体用法?PHP GO::initialized怎么用?PHP GO::initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::initialized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* This function inititalizes Group-Office. It starts the session,registers
* error logging functions, class autoloading and set's PHP defaults.
*/
public static function init()
{
if (self::$initialized) {
throw new \Exception("Group-Office was already initialized");
}
self::$initialized = true;
//register our custom error handler here
set_error_handler(array('GO', 'errorHandler'));
register_shutdown_function(array('GO', 'shutdown'));
spl_autoload_register(array('GO', 'autoload'));
//Start session here. Important that it's called before \GO::config().
\GO::session();
if (!empty(\GO::config()->debug_usernames)) {
$usernames = explode(',', \GO::config()->debug_usernames);
$currentUserModel = \GO::user();
if (!empty($currentUserModel) && in_array($currentUserModel->username, $usernames)) {
\GO::config()->debug = true;
}
}
if (\GO::config()->debug) {
error_reporting(E_ALL | E_STRICT);
}
if (!self::isInstalled()) {
return;
}
if (\GO::config()->debug) {
self::$_scriptStartTime = \GO\Base\Util\Date::getmicrotime();
}
date_default_timezone_set(\GO::user() ? \GO::user()->timezone : \GO::config()->default_timezone);
//set local to utf-8 so functions will behave consistently
if (!empty(\GO::config()->locale_all)) {
setlocale(LC_CTYPE, \GO::config()->locale_all);
putenv('LC_ALL=' . \GO::config()->locale_all);
} else {
//for escape shell arg
if (!isset(\GO::session()->values['locale_all'])) {
$currentlocale = \GO::session()->values['locale_all'] = setlocale(LC_CTYPE, "0");
if (stripos($currentlocale, 'utf') == false && function_exists('exec')) {
@exec('locale -a', $output);
// var_dump($output);
if (isset($output) && is_array($output)) {
foreach ($output as $locale) {
if (stripos($locale, 'utf') !== false) {
setlocale(LC_CTYPE, $locale);
\GO::session()->values['locale_all'] = $locale;
break;
}
}
}
\GO::debug("WARNING: could not find UTF8 locale. Run locale -a and set \$config['locale_all']. See https://www.group-office.com/wiki/Configuration_file#Localization_settings_list");
}
}
// exit(\GO::session()->values['locale_all']);
setlocale(LC_CTYPE, \GO::session()->values['locale_all']);
putenv('LC_ALL=' . \GO::session()->values['locale_all']);
}
if (!empty(\GO::session()->values['debug'])) {
\GO::config()->debug = true;
}
if (\GO::config()->debug || \GO::config()->debug_log) {
$log = '[' . date('Y-m-d H:i') . '] INIT';
\GO::debug($log);
}
if (\GO::config()->debug_display_errors) {
ini_set("display_errors", "On");
} elseif (PHP_SAPI != 'cli') {
ini_set("display_errors", "Off");
}
if (self::config()->firephp) {
if (self::requireExists('FirePHPCore/fb.php')) {
require_once 'FirePHPCore/fb.php';
}
}
if (!defined('GO_LOADED')) {
//check if old Group-Office.php was loaded
self::_undoMagicQuotes();
//set umask to 0 so we can create new files with mask defined in \GO::config()->file_create_mode
umask(0);
//We use UTF8 by default.
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding("UTF-8");
}
}
//Every logged on user get's a personal temp dir.
if (!empty(self::session()->values['user_id'])) {
self::config()->tmpdir = self::config()->getTempFolder()->path() . '/';
}
if (isset(GO::config()->init_script)) {
require GO::config()->init_script;
}
}