本文整理汇总了PHP中Lang::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::initialize方法的具体用法?PHP Lang::initialize怎么用?PHP Lang::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setLanguage
function setLanguage()
{
$lang = 'en';
// Fetch language requests
if (!empty($_REQUEST['lang'])) {
$lang = preg_replace('/[^a-zA-Z\\-]/', NULL, $_REQUEST['lang']);
}
// Set language
try {
Lang::initialize();
Lang::set($lang, false);
} catch (Exception $s) {
return NULL;
}
return true;
}
示例2: __construct
/**
* The Symphony constructor initialises the class variables of Symphony. At present
* constructor has a couple of responsibilities:
* - Start a profiler instance
* - If magic quotes are enabled, clean `$_SERVER`, `$_COOKIE`, `$_GET` and `$_POST` arrays
* - Initialise the correct Language for the currently logged in Author.
* - Start the session and adjust the error handling if the user is logged in
*/
protected function __construct()
{
self::$Profiler = Profiler::instance();
if (get_magic_quotes_gpc()) {
General::cleanArray($_SERVER);
General::cleanArray($_COOKIE);
General::cleanArray($_GET);
General::cleanArray($_POST);
}
// Initialize language management
Lang::initialize();
Lang::set(self::$Configuration->get('lang', 'symphony'));
self::initialiseCookie();
// If the user is not a logged in Author, turn off the verbose error messages.
if (!self::isLoggedIn() && is_null(self::$Author)) {
GenericExceptionHandler::$enabled = false;
}
// Engine is ready.
self::$Profiler->sample('Engine Initialisation');
}
示例3: __construct
/**
* The Symphony constructor initialises the class variables of Symphony.
* It will set the DateTime settings, define new date constants and initialise
* the correct Language for the currently logged in Author. If magic quotes
* are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
* `$_GET` and `$_POST` arrays. The constructor loads in
* the initial Configuration values from the `CONFIG` file
*/
protected function __construct()
{
self::$Profiler = Profiler::instance();
self::$Profiler->sample('Engine Initialisation');
if (get_magic_quotes_gpc()) {
General::cleanArray($_SERVER);
General::cleanArray($_COOKIE);
General::cleanArray($_GET);
General::cleanArray($_POST);
}
$this->initialiseConfiguration();
define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
DateTimeObj::setSettings(self::Configuration()->get('region'));
// Initialize language management
Lang::initialize();
$this->initialiseLog();
GenericExceptionHandler::initialise(self::Log());
GenericErrorHandler::initialise(self::Log());
$this->initialiseDatabase();
$this->initialiseExtensionManager();
$this->initialiseCookie();
// If the user is not a logged in Author, turn off the verbose error messages.
if (!self::isLoggedIn() && is_null($this->Author)) {
GenericExceptionHandler::$enabled = false;
}
// Set system language
Lang::set(self::$Configuration->get('lang', 'symphony'));
}
示例4: initialiseLang
/**
* Initialises the language by looking at the `lang` key,
* passed via GET or POST
*/
public function initialiseLang()
{
$lang = !empty($_REQUEST['lang']) ? preg_replace('/[^a-zA-Z\\-]/', NULL, $_REQUEST['lang']) : 'en';
Lang::initialize();
Lang::set($lang, false);
}
示例5: __construct
/**
* The Symphony constructor initialises the class variables of Symphony.
* It will set the DateTime settings, define new date constants and initialise
* the correct Language for the currently logged in Author. If magic quotes
* are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
* `$_GET` and `$_POST` arrays. The constructor loads in
* the initial Configuration values from the `CONFIG` file
*/
protected function __construct()
{
$this->Profiler = Profiler::instance();
$this->Profiler->sample('Engine Initialisation');
if (get_magic_quotes_gpc()) {
General::cleanArray($_SERVER);
General::cleanArray($_COOKIE);
General::cleanArray($_GET);
General::cleanArray($_POST);
}
// Includes the existing CONFIG file and initialises the Configuration
// by setting the values with the setArray function.
include CONFIG;
self::$Configuration = new Configuration(true);
self::$Configuration->setArray($settings);
DateTimeObj::setDefaultTimezone(self::$Configuration->get('timezone', 'region'));
define_safe('__SYM_DATE_FORMAT__', self::$Configuration->get('date_format', 'region'));
define_safe('__SYM_TIME_FORMAT__', self::$Configuration->get('time_format', 'region'));
define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::$Configuration->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
// Initialize language management
Lang::initialize();
$this->initialiseLog();
GenericExceptionHandler::initialise(self::$Log);
GenericErrorHandler::initialise(self::$Log, self::$Configuration->get('strict_error_handling', 'symphony'));
$this->initialiseDatabase();
$this->initialiseExtensionManager();
$this->initialiseCookie();
// If the user is not a logged in Author, turn off the verbose error
// messages.
if (!self::isLoggedIn() && is_null($this->Author)) {
GenericExceptionHandler::$enabled = false;
}
// Set system language
Lang::set(self::$Configuration->get('lang', 'symphony'));
}