本文整理汇总了PHP中Language::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::setLanguage方法的具体用法?PHP Language::setLanguage怎么用?PHP Language::setLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::setLanguage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: negotiateLanguage
public function negotiateLanguage($profile_id = null)
{
if ($profile_id) {
$this->language->profile_id = $profile_id;
}
$lang = "en-GB";
if ($this->getHeader('Accept-Language', false)) {
$negotiator = new \Negotiation\Negotiator();
$best = $negotiator->getBest($this->getHeader('Accept-Language'), $this->language->getAllLanguageStrings());
if ($best) {
$lang = $best->getValue();
}
}
$this->language->setLanguage($lang, $profile_id);
}
示例2: setConfig
/**
* setConfig
*
* @param string $config
*/
public static function setConfig($config)
{
self::$_config = new Config_Ini($config);
Registry::set('top', '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="vi">
<head><title>Quản lí - Gmanager 0.8.1 beta</title>
<meta http-equiv="Content-Type" content="' . self::getContentType() . '; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="vtr/style.css"/>
<script type="text/javascript" src="js.js"></script>
<script type="text/javascript" src="data/js.source.js"></script></head><body>
<div class="header" align="center"><a href="index.php"><h1>LPanel 2.1</h1></a>
<p align="left"><img src="vtr/img/pma.png" alt=""/> <a href="pma/">P.M.A</a> |
<img src="vtr/icon/SQL.png" alt=""/> <a href="pma/saoluu.php">S.Lưu</a> |
<img src="vtr/img/cpanel.png" alt=""/> <a href="index.php?set">C.đặt</a> |
<img src="vtr/img/exit.png" alt=""/> <a href="index.php?exit">Thoát</a></p></div>
');
Registry::set('foot', '<div class="header" align="center">
<div align="left">
<img src="vtr/img/pma.png" alt=""/> <a href="pma/">P.M.A</a> |
<img src="vtr/icon/SQL.png" alt=""/> <a href="pma/saoluu.php">S.Lưu</a> |
<img src="vtr/img/cpanel.png" alt=""/> <a href="index.php?set">C.đặt</a> |
<img src="vtr/img/exit.png" alt=""/> <a href="index.php?exit">Thoát</a>
</div>
<h2><a href="index.php?info">V2.1 - Tmc</a></h2>
</div></body></html>');
Language::setLanguage(self::get('Gmanager', 'language'));
define('PCLZIP_TEMPORARY_DIR', self::getTemp() . '/');
define('GMANAGER_REQUEST_TIME', time());
mb_internal_encoding('UTF-8');
setlocale(LC_ALL, self::get('PHP', 'locale'));
date_default_timezone_set(self::get('PHP', 'timeZone'));
@set_time_limit(self::get('PHP', 'timeLimit'));
ini_set('max_execution_time', self::get('PHP', 'timeLimit'));
ini_set('memory_limit', self::get('PHP', 'memoryLimit'));
ini_set('error_prepend_string', '<div class="red">');
ini_set('error_append_string', '</div><div class="rb"><br/></div>' . Registry::get('foot'));
ini_set('error_log', Errors::getTraceFile());
set_error_handler('Errors::errorHandler');
if (self::get('Auth', 'enable')) {
Auth::main();
}
Gmanager::getInstance()->init();
}
示例3: addLanguage2
public static function addLanguage2($LangId, $LangTag, $English, $Sinhala, $Tamil, $Bangla, $Nepali, $Lang1, $Lang2, $Lang3)
{
$obj_retResult = new returnResult();
$obj_newLanguage = new Language();
$obj_newLanguage->setLanguage($LangId, $LangTag, $English, $Sinhala, $Tamil, $Bangla, $Nepali, $Lang1, $Lang2, $Lang3);
// $isExist = BL_manageLanguage::isExist($obj_newLanguage->id);
if (!$isExist) {
$obj_retResult_Language = DAL_manageLanguage::addLanguage($obj_newLanguage);
if ($obj_retResult_Language->type == 1) {
$obj_retResult->type = 1;
$obj_retResult->msg = "Success";
$obj_retResult->data = $obj_retResult_Language->data;
} else {
$obj_retResult->type = 0;
$obj_retResult->msg = "Failed";
}
} else {
$obj_retResult->type = 0;
$obj_retResult->msg = "Sorry! Language already exist";
}
return $obj_retResult;
}
示例4: setConfig
/**
* setConfig
*
* @param string $config
*/
public static function setConfig($config)
{
self::$_config = new Config_Ini($config);
Registry::set('top', '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head><title>%title% - Gmanager 0.8.1 beta</title><meta http-equiv="Content-Type" content="' . self::getContentType() . '; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="public/style.min.css"/><script type="text/javascript" src="public/script.min.js"></script></head><body>');
Registry::set('foot', '<div class="w">Powered by Gemorroj<br/><a href="http://wapinet.ru/gmanager/">wapinet.ru</a></div></body></html>');
Language::setLanguage(self::get('Gmanager', 'language'));
define('PCLZIP_TEMPORARY_DIR', self::getTemp() . '/');
define('GMANAGER_REQUEST_TIME', time());
mb_internal_encoding('UTF-8');
setlocale(LC_ALL, self::get('PHP', 'locale'));
date_default_timezone_set(self::get('PHP', 'timeZone'));
@set_time_limit(self::get('PHP', 'timeLimit'));
ini_set('max_execution_time', self::get('PHP', 'timeLimit'));
ini_set('memory_limit', self::get('PHP', 'memoryLimit'));
ini_set('error_log', Errors::getTraceFile());
ini_set('error_prepend_string', '<div class="red">');
ini_set('error_append_string', '</div><div class="rb"><br/></div>' . Registry::get('foot'));
Errors::initHandler();
if (self::get('Auth', 'enable')) {
Auth::main();
}
Gmanager::getInstance()->init();
}
示例5: tryToUseSession
/**
* Try to use current session
* @return boolean
*/
private function tryToUseSession()
{
if (isset($_SESSION['accountid'])) {
DB::getInstance()->stopAddingAccountID();
$Account = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'account` WHERE `id`=' . (int) $_SESSION['accountid'] . ' LIMIT 1')->fetch();
DB::getInstance()->startAddingAccountID();
if ($Account['session_id'] == session_id()) {
$this->setAccount($Account);
$this->updateLastAction();
Language::setLanguage($Account['language'], false);
return true;
} elseif (defined('RUNALYZE_TEST')) {
$this->setAccount($Account);
return true;
} else {
unset($_SESSION['accountid']);
}
}
return false;
}
示例6: buildLanguageMenu
/**
* This method builds a menu.
*
* @access private
* @author Kalmer Piiskop
* @param string $parameters['id'] the ID of the object
* @param boolean $parameters['isError'] Are we in the error state?
* @param string $parameters['type'] the type of the object
* @param string $parameters['suffix'] the suffix
* @param integer $parameters['width'] the width of <code>body</code> in
* pixels
* @return string the parsed menu
* @uses ALIAS_HUMAN_LIST for the translation of the list of humans
* @uses ALIAS_OF_LANGUAGES for the list of languages
* @uses ALT_LANGUAGE for the alternative text of the update indicator
* @uses DOMAIN for addressing
* @uses IMAGES_FOLDER for displaying images
* @uses O_FOLDER for the common files
* @uses LANGUAGE for languages
* @uses TITLE_LANGUAGE for the explanation of the change of the
* language
*/
private static function buildLanguageMenu($parameters)
{
if (!isset($parameters['isError']) || !$parameters['isError']) {
require_once 'HTML/Template/IT.php';
$tpl = new \HTML_Template_IT(sprintf('%1$s/../assets/tpl/%2$u', dirname(__FILE__), $parameters['width']));
$tpl->loadTemplatefile('languages.tpl');
require_once O_FOLDER . '/keeled/Language.php';
$language = new Language();
if (isset($_SESSION['language'])) {
$language->setId($_SESSION['language']);
$idOfLanguageToExclude = $_SESSION['language'];
} else {
$language->setId(DEFAULT_LANGUAGE);
$idOfLanguageToExclude = DEFAULT_LANGUAGE;
}
$language->setLanguage();
require_once O_FOLDER . 'errors/Error.php';
// echo ' 1658: ', $parameters['type'];
$languagesInUse = Language::createLanguagesInUse(array('classes' => array('SystemMenuItem', 'Page', 'PageNews', 'SystemString'), 'idOfLanguageToExclude' => $idOfLanguageToExclude, 'object' => isset($parameters['id']) ? Error::requireFile(array('id' => $parameters['id'], 'type' => $parameters['type'], 'isInstance' => TRUE, 'isToBeCompleted' => TRUE, 'isView' => FALSE)) : NULL));
// echo ' 1675: <pre>';print_r($languageInUse); echo '</pre>';
$numberOfLanguage = 0;
foreach ($languagesInUse as $languageInUse) {
$numberOfLanguage++;
if ($numberOfLanguage < 3) {
switch ($parameters['type']) {
case 'Error':
require_once O_FOLDER . '/keeled/SystemString.php';
$systemString = new SystemString();
$systemString->setId('errors_Error_error');
$systemString->setCompleteSystemString();
$alias = $systemString->translate(array('block' => 'title'));
break;
case 'Feedback':
require_once O_FOLDER . '/keeled/SystemString.php';
$systemString = new SystemString();
$systemString->setId('configuration_formOfFeedback');
$systemString->setCompleteSystemString();
$alias = $systemString->translate(array('block' => 'title'));
break;
case 'Hierarchy':
require_once O_FOLDER . '/keeled/SystemString.php';
$systemString = new SystemString();
$systemString->setId('configuration_hierarchy');
$systemString->setCompleteSystemString();
$alias = $systemString->translate(array('block' => 'title'));
break;
case 'Humans':
require_once O_FOLDER . '/keeled/SystemString.php';
$systemString = new SystemString();
$systemString->setId(ALIAS_HUMAN_LIST);
$systemString->setCompleteSystemString();
$alias = $systemString->translate(array('block' => 'title'));
break;
case 'Pages':
require_once O_FOLDER . '/keeled/SystemString.php';
$systemString = new SystemString();
$systemString->setId('configuration_pages');
$systemString->setCompleteSystemString();
$alias = $systemString->translate(array('block' => 'title'));
break;
case 'SystemStrings':
require_once O_FOLDER . '/keeled/SystemString.php';
$systemString = new SystemString();
$systemString->setId('configuration_systemStrings');
$systemString->setCompleteSystemString();
$alias = $systemString->translate(array('block' => 'title'));
break;
default:
require_once O_FOLDER . '/errors/Error.php';
$object = Error::requireFile(array('id' => $parameters['id'], 'type' => $parameters['type'], 'isInstance' => TRUE, 'isToBeCompleted' => TRUE, 'typeOfError' => 'JSON', 'isInstance' => TRUE, 'isView' => FALSE));
$object->setIdOfLanguage($languageInUse['id']);
$title = $object->translate(array('block' => 'title'));
// echo ' 1717: ', $title;
require_once O_FOLDER . 'Slug.php';
$alias = Slug::slugify(array('original' => $title));
}
$currentLanguage = new Language();
$currentLanguage->setId($languageInUse['id']);
//.........这里部分代码省略.........
示例7: HtmlFormInstallation
session_destroy();
// create form with selectbox where user can select a language
// the possible languages will be read from a xml file
$form = new HtmlFormInstallation('installation-form', 'installation.php?mode=2');
$form->openGroupBox('gbChooseLanguage', $gL10n->get('INS_CHOOSE_LANGUAGE'));
$form->addSelectBoxFromXml('system_language', $gL10n->get('SYS_LANGUAGE'), SERVER_PATH . '/adm_program/languages/languages.xml', 'ISOCODE', 'NAME', array('property' => FIELD_REQUIRED));
$form->closeGroupBox();
$form->addSubmitButton('next_page', $gL10n->get('SYS_NEXT'), array('icon' => 'layout/forward.png'));
$form->show();
} elseif ($getMode === 2) {
// check if a language string was committed
if (!isset($_POST['system_language']) || trim($_POST['system_language']) === '') {
showNotice($gL10n->get('INS_LANGUAGE_NOT_CHOOSEN'), 'installation.php?mode=1', $gL10n->get('SYS_BACK'), 'layout/back.png');
} else {
$_SESSION['language'] = $_POST['system_language'];
$gL10n->setLanguage($_SESSION['language']);
}
// create the text that should be shown in the form
$message = $gL10n->get('INS_WELCOME_TEXT');
// if this is a beta version then show a notice to the user
if (ADMIDIO_VERSION_BETA > 0) {
$message .= '
<div class="alert alert-warning alert-small" role="alert">
<span class="glyphicon glyphicon-warning-sign"></span>' . $gL10n->get('INS_WARNING_BETA_VERSION') . '
</div>';
}
// if safe mode is used then show a notice to the user
if (ini_get('safe_mode') === '1') {
$message .= '
<div class="alert alert-warning alert-small" role="alert">
<span class="glyphicon glyphicon-warning-sign"></span>' . $gL10n->get('INS_WARNING_SAFE_MODE') . '
示例8: parsePostData
/**
* Parse all post values
*/
public function parsePostData()
{
if ($_POST['name'] != SessionAccountHandler::getName()) {
DB::getInstance()->update('account', SessionAccountHandler::getId(), 'name', $_POST['name']);
}
if ($_POST['allow_mails'] != SessionAccountHandler::getAllowMails()) {
DB::getInstance()->update('account', SessionAccountHandler::getId(), 'allow_mails', $_POST['allow_mails']);
}
if ($_POST['language'] != SessionAccountHandler::getLanguage()) {
DB::getInstance()->update('account', SessionAccountHandler::getId(), 'language', $_POST['language']);
Language::setLanguage($_POST['language']);
echo Ajax::wrapJS('document.cookie = "lang=" + encodeURIComponent("' . addslashes($_POST['language']) . '");');
Ajax::setReloadFlag(Ajax::$RELOAD_PAGE);
}
if ($_POST['new_pw'] != '') {
$this->tryToChangePassword();
}
}