本文整理汇总了PHP中setLanguage函数的典型用法代码示例。如果您正苦于以下问题:PHP setLanguage函数的具体用法?PHP setLanguage怎么用?PHP setLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLanguage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->loadTemplate();
$this->language = setLanguage($this->languages);
$this->readCurrentSite();
$this->replaceCurrentSite();
$this->handleRegisterPopup();
$this->switchSite();
}
示例2: die
<h1>Install Symphony <em>Version ' . kVERSION . '</em></h1>
<h2>Outstanding Requirements</h2>
<p>Symphony needs the following requirements satisfied before installation can proceed.</p>
<dl>
<dt><abbr title="PHP: Hypertext Pre-processor">PHP</abbr> 5.2 or above</dt>
<dd>Symphony needs a recent version of <abbr title="PHP: Hypertext Pre-processor">PHP</abbr>.</dd>
</dl>
</body>
</html>';
die($code);
}
// Check and set language
if (setLanguage() === NULL) {
$code = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Outstanding Requirements</title>
<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
</head>
<body>
<h1>Install Symphony <em>Version ' . kVERSION . '</em></h1>
<h2>Outstanding Requirements</h2>
<p>Symphony needs at least one language file to be present before installation can proceed.</p>
</body>
示例3: session_start
<?php
session_start();
define('URL_PREFIX', '../');
require URL_PREFIX . 'fcms.php';
setLanguage();
isLoggedIn('inc/');
$currentUserId = (int) $_SESSION['fcms_id'];
echo '
<!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="' . T_pgettext('Language Code for this translation', 'lang') . '" lang="' . T_pgettext('Language Code for this translation', 'lang') . '">
<head>
<title>' . getSiteName() . ' - ' . T_('powered by') . ' ' . getCurrentVersion() . '</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="Ryan Haudenschilt" />
<link rel="stylesheet" type="text/css" href="../ui/themes/default/style.css"/>
<link rel="shortcut icon" href="../ui/favicon.ico"/>';
// TODO
// Move css to fcms-core
echo '
<style type="text/css">
html { background: #fff; }
body { width: 350px; margin: 0; padding: 15px; text-align: left; font: 14px/20px Verdana, Tahoma, Arial, sans-serif; border: none; background: #fff; }
h1 { font: bold 20px/30px Verdana, Tahoma, Arial, sans-serif; }
h2 { font: bold 18px/30px Verdana, Tahoma, Arial, sans-serif; }
h3 { font: bold 16px/30px Verdana, Tahoma, Arial, sans-serif; }
</style>
</head>
<body>
<h1>' . T_('BBCode Help') . '</h1>
<p>' . T_('BBCode is a easy way to format text. Check out the examples below, the first line shows the bbcode and the second line show the output.') . '</p>
示例4: setLanguage
<?php
require_once "includes/php_utils.php";
//require './vendor/autoload.php';
// i18n:
$language = setLanguage();
$nameErr = $emailErr = "";
$clientName = defaultVal($_SESSION, "clientName", "");
$clientEmail = defaultVal($_SESSION, "clientEmail", "");
$clientComment = defaultVal($_SESSION, "clientComment", "");
// The form has been submitted. Do error correction, and act on data if it's good
if ($_SERVER["REQUEST_METHOD"] == "POST") {
echo 'Form got submitted' . "<br>";
// Verify client name
$clientName = filter_input(INPUT_POST, 'clientName', FILTER_SANITIZE_STRING);
if (empty($clientName)) {
$nameErr = _("nom_obligatoire");
} else {
if (!preg_match("/^[a-zA-Z0-9 .]*\$/", $clientName)) {
$nameErr = _("courriel_chars");
$clientName = "";
//$nameErr = "Only letters, numbers and white space allowed";
}
}
// Verify client email
$clientEmail = filter_input(INPUT_POST, 'clientEmail', FILTER_SANITIZE_STRING);
if (empty($clientEmail)) {
$emailErr = _("courriel_obligatoire");
} else {
if (!filter_var($clientEmail, FILTER_VALIDATE_EMAIL)) {
$emailErr = _("courriel_invalide");
示例5: preg_replace
$bestLangPageId = $multilinguallib->selectLangObj($type, $pageId, $_REQUEST['language']);
if ($pageId != $bestLangPageId) {
if (!empty($param['page_id'])) {
$orig_url = preg_replace('/(.*[&?]page_id=)' . $pageId . '(.*)/', '${1}' . $bestLangPageId . '$2', $orig_url);
} elseif (!empty($param['articleId'])) {
$orig_url = preg_replace('/(.*[&?]articleId=)' . $pageId . '(.*)/', '${1}' . $bestLangPageId . '$2', $orig_url);
} else {
$newPage = urlencode($tikilib->get_page_name_from_id($bestLangPageId));
$orig_url = preg_replace('/(.*[&?]page=)' . preg_quote($page) . '(.*)/', '${1}' . "{$newPage}" . '$2', $orig_url);
$orig_url = preg_replace('/(.*)(tiki-index.php)$/', "\$1\$2?page={$newPage}", $orig_url);
}
}
$orig_url = preg_replace('/(.*)no_bl=y&(.*)/', '$1$2', $orig_url);
$orig_url = preg_replace('/(.*)&no_bl=y(.*)/', '$1$2', $orig_url);
if ($prefs['feature_sefurl'] == 'y') {
include_once 'tiki-sefurl.php';
$orig_url = filter_out_sefurl($orig_url);
}
if ($item_url) {
if ($prefs['feature_sefurl'] == 'y') {
$orig_url = $orig_url . "?" . $item_url;
} elseif (!strstr($_SERVER['HTTP_REFERER'], 'tiki-index.php') && !strstr($_SERVER['HTTP_REFERER'], 'tiki-read_article.php')) {
$orig_url = $orig_url . "&" . $item_url;
}
}
}
if (isset($_GET['language'])) {
setLanguage($_GET['language']);
}
header("location: {$orig_url}");
exit;
示例6: setLanguage
$smarty->assign('email', $_REQUEST['user']);
} else {
$smarty->assign('email', $info['email']);
}
$smarty->assign('mid', 'tiki-change_password.tpl');
$smarty->display("tiki.tpl");
die;
} else {
$user = $_REQUEST['user'];
$userAutoLoggedIn = TRUE;
$_SESSION["{$user_cookie_site}"] = $user;
TikiLib::lib('menu')->empty_menu_cache();
}
}
if ($language = $tikilib->get_user_preference($user, 'language')) {
setLanguage($language);
}
if (!empty($prefs['url_after_validation']) && !$wasAdminValidation) {
$target = $prefs['url_after_validation'];
$access->redirect($target);
} elseif ($userAutoLoggedIn == TRUE) {
$access->redirect($prefs['tikiIndex'], tra("Account validated successfully."));
} else {
$smarty->assign('msg', tra("Account validated successfully."));
$smarty->assign('mid', 'tiki-information.tpl');
$smarty->display("tiki.tpl");
die;
}
} else {
if ($error == PASSWORD_INCORRECT) {
$error = tra("Invalid username or password");
示例7: ob_start
ob_start();
// initialize
require _base_ . '/lib/lib.bootstrap.php';
Boot::init(BOOT_DATETIME);
// not a pagewriter but something similar
$GLOBALS['operation_result'] = '';
if (!function_exists("docebo_out")) {
function docebo_cout($string)
{
$GLOBALS['operation_result'] .= $string;
}
}
require_once _adm_ . '/lib/lib.permission.php';
require_once _base_ . '/lib/lib.pagewriter.php';
//--- here the specific code ---------------------------------------------------
setLanguage('english');
function getReportRecipients($id_rep)
{
//get month, day
$arr_days = array();
$arr_months = array();
$output = array();
//check for daily
$recipients = array();
$qry = "SELECT * FROM %lms_report_schedule WHERE period LIKE '%day%' AND id_report_filter={$id_rep} AND enabled = 1";
$res = sql_query($qry);
while ($row = sql_fetch_assoc($res)) {
$qry2 = "SELECT id_user FROM %lms_report_schedule_recipient WHERE id_report_schedule=" . $row['id_report_schedule'];
$res2 = sql_query($qry2);
while (list($recipient) = sql_fetch_row($res2)) {
$recipients[] = $recipient;
示例8: stdClass
require_once "libs/contentManager.php";
$oRequest = new stdClass();
$oRequest->request = $oPage->path;
$aInit['session']->request = $oRequest;
$html = _getPage($aInit, $oPage->path);
$aInit['session']->last_request = $oPage->path;
$aInit['memcache']->set($aInit['session']->id, $aInit['session']);
echo $html;
})->setName($oPage->path);
}
// build the language and country route
$locales = $aInit['memcache']->get(APP_ID . '_locales');
foreach ($locales as $locale) {
$app->get('/' . $locale, function () use($app, $aInit, $locale) {
_setLocale($aInit, $locale);
setLanguage($aInit, substr($locale, 0, 2));
// reload the page with the last loaded page
require_once "libs/contentManager.php";
$oRequest = new stdClass();
$oRequest->request = $aInit['session']->last_request;
$aInit['session']->request = $oRequest;
$html = _getPage($aInit, $oRequest->request);
echo $html;
})->setName('/' . $locale);
}
$countries = $aInit['memcache']->get(APP_ID . '_countries');
foreach ($countries as $country) {
$app->get('/' . $country, function () use($app, $aInit, $country) {
setCountry($aInit, $country);
// reload the page with the last loaded page
require_once "libs/contentManager.php";
示例9: init
/**
* init
*
* @param string $dir
*
* @return void
*/
function init($dir = '')
{
setLanguage();
isLoggedIn($dir);
checkScheduler($dir);
}
示例10: startOrongo
/**
*Starts Orongo! :)
* @param String $paramCurrentPage the current page
*/
function startOrongo($paramCurrentPage = 'anonymous')
{
session_start();
define("ROOT", dirname(__FILE__));
define("LIB", ROOT . "/lib");
define("ADMIN", ROOT . "/orongo-admin");
define("CONFIG", ROOT . "/config.php");
define('RANK_ADMIN', 3);
define('RANK_WRITER', 2);
define('RANK_USER', 1);
define('ARTICLE_NOT_EXIST', 2100);
define('PAGE_NOT_EXIST', 3100);
define('USER_NOT_EXIST', 4100);
define('COMMENT_NOT_EXIST', 5100);
error_reporting(E_ALL);
if (file_exists("orongo-install.php")) {
die("If you didn't install OrongoCMS yet, proceed to the <a href='orongo-install.php'>installer</a><br/>If you installed it, please delete orongo-install.php");
}
if (!file_exists(CONFIG)) {
die("config.php (" . CONFIG . ") was missing!");
}
require_once CONFIG;
require LIB . '/function_load.php';
try {
load(LIB);
} catch (Exception $e) {
die($e->getMessage());
}
setDatabase(new Database(CONFIG));
try {
setLanguage(new Language(ADMIN . '/lang/' . Settings::getLanguageName()));
} catch (Exception $e) {
$msgbox = new MessageBox();
$msgbox->bindException($e);
die($msgbox->getImports() . $msgbox->toHTML());
}
setCurrentPage($paramCurrentPage);
$style = null;
try {
$style = Settings::getStyle();
} catch (Exception $e) {
$msgbox = new MessageBox();
$msgbox->bindException($e);
die($msgbox->getImports() . $msgbox->toHTML());
}
setMenu(new Menu());
setStyle($style);
setDisplay(new Display($style->getStylePath()));
setUser(handleSessions());
if (defined('HACK_PLUGINS') && HACK_PLUGINS == true) {
Plugin::hackKeys();
}
try {
setPlugins(Plugin::getActivatedPlugins('orongo-admin/'));
} catch (Exception $e) {
$msgbox = new MessageBox();
$msgbox->bindException($e);
getDisplay()->addObject($msgbox);
}
//getLanguage()->setTempLanguage(ADMIN . '/lang/en_US');
OrongoDefaultEventHandlers::init();
}
示例11: elseif
} elseif ($_GET['action'] == 'setLowPriorityUserInformation') {
setLowPriorityUserInformation($_SESSION['user']['id'], $_POST['statusMessage'], $_POST['imageId']);
} elseif ($_GET['action'] == 'searchMessages') {
searchMessages($_POST['string'], $_POST['caseSensitive'], (int) $_POST['userId']);
} elseif ($_GET['action'] == 'setTopic') {
setTopic($_POST['topic'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'setChatName') {
setChatName($_POST['chatName'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'setChatImage') {
setChatImage($_POST['image'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getChatImage') {
getChatImage();
} elseif ($_GET['action'] == 'getChatInformation') {
getChatInformation();
} elseif ($_GET['action'] == 'setLanguage') {
setLanguage($_SESSION['user']['id'], $_POST['language']);
} elseif ($_GET['action'] == 'setIsTyping') {
setIsTyping($_SESSION['user']['id'], $_POST['isTyping']);
} elseif ($_GET['action'] == 'checkUserActivity') {
checkUserActivity($_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getUser') {
getUser();
} elseif ($_GET['action'] == 'upload') {
uploadFile($_FILES['files'], $_SESSION['user']['id'], $_POST['share'], $_POST['uploadType']);
} elseif ($_GET['action'] == 'pingServer') {
printJson('{"running": true}');
} elseif ($_GET['action'] == 'shareUploadedFile') {
shareAlreadyUploadedFile($_POST['fileId'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getRecentlyEditedMessages') {
getRecentlyEditedMessages();
}
示例12: setLanguage
<?php
if (isset($_GET['js'])) {
$jsFileName = $_GET['js'];
include 'class/template.class.php';
include 'include/functions.inc.php';
$language = setLanguage(array('en', 'de'));
$js = new Template();
$js->setFolder('js/');
$js->setFileExtension('.js');
$js->readTpl($jsFileName);
$js->tplReplace('lang', $language);
$js->translateTemplate();
$js->printTemplate();
}
示例13: err_handler_stathtml
*/
function err_handler_stathtml($errno, $errmsg, $filename, $linenum)
{
$date = date('Y-m-d H:i:s (T)');
$err = "{$date}\r\n";
$err .= "{$errmsg}\r\n";
$err .= "{$filename}\r\n";
$err .= "on line: {$linenum}\r\n";
$err .= "\r\n\r\n";
file_put_contents('./app/log/html5.log', $err, FILE_APPEND);
}
# Текущий URL кабинета
$urlHost = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'];
# Создали экземпляр класса SystemClass
$systemClass = new SystemsClass();
# Получаем массив с полными путями для запросов к бекенду
$billLink = $systemClass->getBillLink($urlHost);
# Получаем входные Get/Post
$paramsInput = $systemClass->get_input_data();
# Создали экземпляр класса CabinetClass
$cabinetClass = new CabinetClass($billLink, $paramsInput);
# Выбор локализации:
setLanguage($cabinetClass->_attributesOut);
# Start обработчика запроса и информации
$cabinetClass->proceedRequest();
# Страница которую необходимо вывести на экран
$page = $cabinetClass->_outPage;
# Вывод шаблона
$tpl = new TemplateClass($cabinetClass->_attributesOut['config']['path_template']);
$tpl->set('val', $cabinetClass->attributesArrayOut());
$tpl->display($page);
示例14: GetAvailableLanguages
/**
* Collect the available languages (translations) and return those in an array.
*/
function GetAvailableLanguages()
{
$sl = array();
if ($handle = opendir(BASE_PATH . '/lib/languages')) {
while (false !== ($file = readdir($handle))) {
// Filter out irrelevant files && dirs
if ($file != "." && $file != ".." && strmatch_tail($file, ".inc.php")) {
$f = substr($file, 0, strpos($file, '.'));
$sl[$f] = setLanguage($f);
// making sure language support is indeed in sync in code and definition files:
if ($sl[$f]['lang'] != $f) {
die("CCMS code has not been updated to support language: language code=" . $f);
}
}
}
}
return $sl;
}
示例15: setLanguage
$smarty->refreshLanguage();
return $tikilib->set_user_preference($user, 'language', $localeIdentifier);
} else {
return false;
}
}
if ($prefs['feature_multilingual'] != 'y') {
// change_language depends on feature_multilingual.
$prefs['change_language'] = 'n';
}
if ($prefs['change_language'] == 'y') {
// $noSwitchLang = true; // Uncomment to disable switchLang
if (isset($_GET['switchLang']) && !isset($noSwitchLang)) {
// Special feature to allow creating Tiki links that also permanently switch the language of the user following the link.
// Tiki does not create such links. See http://doc.tiki.org/i18n+Admin#Goodies
setLanguage($_GET['switchLang']);
} elseif ($prefs['feature_detect_language'] == 'y' and !$tikilib->userHasPreference('language')) {
// Detect browser language
$browser_language = detect_browser_language();
if (isValidLocale($browser_language)) {
$prefs['language'] = $browser_language;
}
}
} else {
$prefs['language'] = $prefs['site_language'];
}
if (!isValidLocale($prefs['language'])) {
// Override broken user locales
setLanguage($prefs['site_language']);
}
TikiLib::lib('multilingual')->setupBiDi();