本文整理汇总了PHP中language::set_language方法的典型用法代码示例。如果您正苦于以下问题:PHP language::set_language方法的具体用法?PHP language::set_language怎么用?PHP language::set_language使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类language
的用法示例。
在下文中一共展示了language::set_language方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSiteLanguage
function getSiteLanguage($get = null)
{
$default = array('dir' => 'dutch', 'id' => '1', 'code' => 'nl');
if (!tep_session_is_registered('language') || isset($_GET['language'])) {
if (!tep_session_is_registered('language')) {
tep_session_register('language');
tep_session_register('languages_id');
tep_session_register('languages_code');
}
include DIR_WS_CLASSES . 'language.php';
$lng = new language();
if (isset($_GET['language']) && tep_not_null($_GET['language'])) {
$lng->set_language($_GET['language']);
} else {
$lng->get_browser_language();
if (empty($lng)) {
$lng->set_language(DEFAULT_LANGUAGE);
}
}
$default = array('dir' => $lng->language['directory'], 'id' => $lng->language['id'], 'code' => $lng->language['code']);
}
if ($get && isset($default[$get])) {
return $default[$get];
}
return $default;
}
示例2: fetchProduct
/**
* Fetches the product and adds it as an article to the klarna class. No need to return any data.
* Articles need to be set for fraud purpose, incorrect article means no_risk invoice. Hereby klarna will not take any risks.
*
* @param mixed $mProductId The product identified. Either int or string. Adapted according shop functionality
* @param Klarna $oKlarna The Klarna class object. Used to set any articles
* @return void
*/
protected function fetchProduct($mProductId)
{
global $currencies, $currency;
include DIR_WS_CLASSES . 'language.php';
$lng = new language();
if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
$lng->set_language($HTTP_GET_VARS['language']);
} else {
$lng->get_browser_language();
}
$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $mProductId . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
$aProduct_info = tep_db_fetch_array($product_info_query);
$sArtNo = MODULE_PAYMENT_KLARNA_ARTNO == 'id' || MODULE_PAYMENT_KLARNA_ARTNO == '' ? $aProduct_info['id'] : $aProduct_info['name'];
$iTax = tep_get_tax_rate($aProduct_info['products_tax_class_id']);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$iPrice_with_tax = $currencies->get_value($currency) * $aProduct_info['products_price'];
} else {
$iPrice_with_tax = $currencies->get_value($currency) * $aProduct_info['products_price'] * ($iTax / 100 + 1);
}
// Add goods
$this->oKlarna->addArticle(1, $sArtNo, $aProduct_info['products_name'], $iPrice_with_tax, $iTax, 0, KlarnaFlags::INC_VAT);
$this->iSum += $iPrice_with_tax;
}
示例3: shoppingCart
// create the shopping cart
if (!isset($_SESSION['cart']) || !is_object($_SESSION['cart']) || get_class($_SESSION['cart']) != 'shoppingCart') {
$_SESSION['cart'] = new shoppingCart();
}
// include currencies class and create an instance
require 'includes/classes/currencies.php';
$currencies = new currencies();
// include the mail classes
require 'includes/classes/mime.php';
require 'includes/classes/email.php';
// set the language
if (!isset($_SESSION['language']) || isset($_GET['language'])) {
include 'includes/classes/language.php';
$lng = new language();
if (isset($_GET['language']) && !empty($_GET['language'])) {
$lng->set_language($_GET['language']);
} else {
$lng->get_browser_language();
}
$_SESSION['language'] = $lng->language['directory'];
$_SESSION['languages_id'] = $lng->language['id'];
}
// include the language translations
$_system_locale_numeric = setlocale(LC_NUMERIC, 0);
require 'includes/languages/' . basename($_SESSION['language']) . '.php';
setlocale(LC_NUMERIC, $_system_locale_numeric);
// Prevent LC_ALL from setting LC_NUMERIC to a locale with 1,0 float/decimal values instead of 1.0 (see bug #634)
// currency
if (!isset($_SESSION['currency']) || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']) {
if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) {
$_SESSION['currency'] = $_GET['currency'];
示例4: currencies
// include currencies class and create an instance
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
// include the mail classes
require DIR_WS_CLASSES . 'mime.php';
require DIR_WS_CLASSES . 'email.php';
// set the language
if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
tep_session_register('language');
tep_session_register('languages_id');
}
include DIR_WS_CLASSES . 'language.php';
$lng = new language();
if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
$lng->set_language($HTTP_GET_VARS['language']);
} else {
$lng->get_browser_language();
}
$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
}
// include the language translations
require DIR_WS_LANGUAGES . $language . '.php';
// currency
if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
if (!tep_session_is_registered('currency')) {
tep_session_register('currency');
}
if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
$currency = $HTTP_GET_VARS['currency'];
示例5: initLanguage
function initLanguage()
{
if ($this->isMobile() && !isset($_SESSION['language'])) {
$lng = new language();
if (LANGUAGE_DEFAULT_SELECTOR == 'Browser') {
$lng->get_browser_language();
} else {
$lng->set_language(DEFAULT_LANGUAGE);
}
$language_code = zen_not_null($lng->language['code']) ? $lng->language['code'] : 'en';
$mobile_language_code = $language_code . MOBILE_LANGUAGE_CODE_SUFFIX;
$mobile_language = $this->db->Execute("select * from " . TABLE_LANGUAGES . " where code = '" . zen_db_prepare_input($mobile_language_code) . "'");
if ($mobile_language->RecordCount() > 0) {
$_SESSION['language'] = $mobile_language->fields['directory'];
$_SESSION['languages_id'] = $mobile_language->fields['languages_id'];
$_SESSION['languages_code'] = $mobile_language->fields['code'];
}
}
}
示例6: die
<?php
/**
* initialise language handling
* see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @todo ICW(SECURITY) is it worth having a sanitizer for $_GET['language'] ?
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: init_languages.php 2753 2005-12-31 19:17:17Z wilt $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (!isset($_SESSION['language']) || isset($_GET['language'])) {
$lng = new language();
if (isset($_GET['language']) && zen_not_null($_GET['language'])) {
$lng->set_language($_GET['language']);
} else {
if (LANGUAGE_DEFAULT_SELECTOR == 'Browser') {
$lng->get_browser_language();
} else {
$lng->set_language(DEFAULT_LANGUAGE);
}
}
$_SESSION['language'] = zen_not_null($lng->language['directory']) ? $lng->language['directory'] : 'english';
$_SESSION['languages_id'] = zen_not_null($lng->language['id']) ? $lng->language['id'] : 1;
$_SESSION['languages_code'] = zen_not_null($lng->language['code']) ? $lng->language['code'] : 'en';
}
示例7: init
//.........这里部分代码省略.........
$spider_flag = false;
if (!empty($user_agent)) {
foreach (file(OSCOM::BASE_DIR . 'spiders.txt') as $spider) {
if (!empty($spider)) {
if (strpos($user_agent, $spider) !== false) {
$spider_flag = true;
break;
}
}
}
}
if ($spider_flag === false) {
tep_session_start();
}
} else {
tep_session_start();
}
$this->ignored_actions[] = session_name();
// initialize a session token
if (!isset($_SESSION['sessiontoken'])) {
$_SESSION['sessiontoken'] = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
}
// set SID once, even if empty
$SID = defined('SID') ? SID : '';
// verify the ssl_session_id if the feature is enabled
if ($request_type == 'SSL' && SESSION_CHECK_SSL_SESSION_ID == 'True' && ENABLE_SSL == true && session_status() === PHP_SESSION_ACTIVE) {
if (!isset($_SESSION['SSL_SESSION_ID'])) {
$_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
}
if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
tep_session_destroy();
OSCOM::redirect('ssl_check.php');
}
}
// verify the browser user agent if the feature is enabled
if (SESSION_CHECK_USER_AGENT == 'True') {
if (!isset($_SESSION['SESSION_USER_AGENT'])) {
$_SESSION['SESSION_USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
}
if ($_SESSION['SESSION_USER_AGENT'] != $_SERVER['HTTP_USER_AGENT']) {
tep_session_destroy();
OSCOM::redirect('index.php', 'Account&LogIn');
}
}
// verify the IP address if the feature is enabled
if (SESSION_CHECK_IP_ADDRESS == 'True') {
if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
$_SESSION['SESSION_IP_ADDRESS'] = tep_get_ip_address();
}
if ($_SESSION['SESSION_IP_ADDRESS'] != tep_get_ip_address()) {
tep_session_destroy();
OSCOM::redirect('index.php', 'Account&LogIn');
}
}
// create the shopping cart
if (!isset($_SESSION['cart']) || !is_object($_SESSION['cart']) || get_class($_SESSION['cart']) != 'shoppingCart') {
$_SESSION['cart'] = new \shoppingCart();
}
// include currencies class and create an instance
$currencies = new \currencies();
// set the language
if (!isset($_SESSION['language']) || isset($_GET['language'])) {
$lng = new \language();
if (isset($_GET['language']) && !empty($_GET['language'])) {
$lng->set_language($_GET['language']);
} else {
$lng->get_browser_language();
}
$_SESSION['language'] = $lng->language['directory'];
$_SESSION['languages_id'] = $lng->language['id'];
}
// include the language translations
$system_locale_numeric = setlocale(LC_NUMERIC, 0);
include OSCOM::BASE_DIR . 'languages/' . $_SESSION['language'] . '.php';
setlocale(LC_NUMERIC, $system_locale_numeric);
// Prevent LC_ALL from setting LC_NUMERIC to a locale with 1,0 float/decimal values instead of 1.0 (see bug #634)
// currency
if (!isset($_SESSION['currency']) || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']) {
if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) {
$_SESSION['currency'] = $_GET['currency'];
} else {
$_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && $currencies->is_set(LANGUAGE_CURRENCY) ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
}
// navigation history
if (!isset($_SESSION['navigation']) || !is_object($_SESSION['navigation']) || get_class($_SESSION['navigation']) != 'navigationHistory') {
$_SESSION['navigation'] = new \navigationHistory();
}
$_SESSION['navigation']->add_current_page();
$messageStack = new \messageStack();
tep_update_whos_online();
tep_activate_banners();
tep_expire_banners();
tep_expire_specials();
$oscTemplate = new \oscTemplate();
$breadcrumb = new \breadcrumb();
$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, OSCOM::link('index.php'));
Registry::set('Hooks', new Hooks());
}
示例8: zen_restore_language
function zen_restore_language($language = '')
{
include_once DIR_WS_CLASSES . 'language.php';
$lng = new language();
if (isset($language) && zen_not_null($language)) {
$lng->set_language($language);
} else {
$lng->get_browser_language();
$lng->set_language(DEFAULT_LANGUAGE);
}
$_SESSION['language'] = $lng->language['directory'];
$_SESSION['languages_id'] = $lng->language['id'];
}
示例9: explode
$allowed_shops_array = explode(',', ALLOWED_SHOPS);
}
// set the language
if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
tep_session_register('language');
tep_session_register('languages_id');
}
include DIR_WS_CLASSES . 'language.php';
$lng = new language();
if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
# $lng->set_language($HTTP_GET_VARS['language']);
} else {
# $lng->get_browser_language();
}
$lng->set_language('');
$language = $lng->language['code'];
$languages_id = $lng->language['id'];
}
if ($language == '') {
$language = DEFAULT_LANGUAGE;
$languages_id = $lang['languages_id'];
}
// include the language translations
require DIR_WS_LANGUAGES . 'lang.php';
$current_page = basename($PHP_SELF);
if (file_exists(DIR_WS_LANGUAGES . 'lang/' . $current_page)) {
include DIR_WS_LANGUAGES . 'lang/' . $current_page;
}
// set the secret key
if (isset($HTTP_GET_VARS['some_secret_key']) && tep_not_null($HTTP_GET_VARS['some_secret_key'])) {
示例10: page
<?php
$page_security = 10;
$path_to_root = "..";
include $path_to_root . "/includes/session.inc";
page(tr("Display Setup"));
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/admin/db/company_db.inc";
//-------------------------------------------------------------------------------------------------
if (isset($_POST['setprefs'])) {
$theme = user_theme();
set_user_prefs($_POST['prices'], $_POST['Quantities'], $_POST['Rates'], $_POST['Percent'], check_value('show_gl'), check_value('show_codes'), $_POST['date_format'], $_POST['date_sep'], $_POST['tho_sep'], $_POST['dec_sep'], $_POST['theme'], $_POST['page_size']);
language::set_language($_POST['language']);
flush_dir($comp_path . '/' . user_company() . '/js_cache');
if (user_theme() != $theme) {
reload_page("");
}
display_notification_centered(tr("Display settings have been updated."));
}
start_form();
start_table($table_style2);
table_section_title(tr("Decimal Places"));
text_row_ex(tr("Prices/Amounts:"), 'prices', 5, 5, user_price_dec());
text_row_ex(tr("Quantities:"), 'Quantities', 5, 5, user_qty_dec());
text_row_ex(tr("Exchange Rates:"), 'Rates', 5, 5, user_exrate_dec());
text_row_ex(tr("Percentages:"), 'Percent', 5, 5, user_percent_dec());
table_section_title(tr("Dateformat and Separators"));
dateformats_list_row(tr("Dateformat:"), "date_format", user_date_format());
dateseps_list_row(tr("Date Separator:"), "date_sep", user_date_sep());
/* The array $dateseps is set up in config.php for modifications
示例11: init
protected function init()
{
global $request_type, $cookie_domain, $cookie_path, $PHP_SELF, $login_request, $messageStack, $cfgModules;
Registry::set('Cache', new Cache());
$OSCOM_Db = Db::initialize();
Registry::set('Db', $OSCOM_Db);
// TODO legacy
tep_db_connect() or die('Unable to connect to database server!');
// set the application parameters
$Qcfg = $OSCOM_Db->get('configuration', ['configuration_key as k', 'configuration_value as v']);
//, null, null, null, 'configuration'); // TODO add cache when supported by admin
while ($Qcfg->fetch()) {
define($Qcfg->value('k'), $Qcfg->value('v'));
}
// Used in the "Backup Manager" to compress backups
define('LOCAL_EXE_GZIP', 'gzip');
define('LOCAL_EXE_GUNZIP', 'gunzip');
define('LOCAL_EXE_ZIP', 'zip');
define('LOCAL_EXE_UNZIP', 'unzip');
// Define how do we update currency exchange rates
// Possible values are 'oanda' 'xe' or ''
define('CURRENCY_SERVER_PRIMARY', 'oanda');
define('CURRENCY_SERVER_BACKUP', 'xe');
// set the type of request (secure or not)
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
$request_type = 'SSL';
$cookie_domain = HTTPS_COOKIE_DOMAIN;
$cookie_path = HTTPS_COOKIE_PATH;
} else {
$request_type = 'NONSSL';
$cookie_domain = HTTP_COOKIE_DOMAIN;
$cookie_path = HTTP_COOKIE_PATH;
}
// set php_self in the global scope
$req = parse_url($_SERVER['SCRIPT_NAME']);
$PHP_SELF = substr($req['path'], $request_type == 'SSL' ? strlen(DIR_WS_HTTPS_ADMIN) : strlen(DIR_WS_ADMIN));
// set the session name and save path
tep_session_name('oscomadminid');
tep_session_save_path(SESSION_WRITE_DIRECTORY);
// set the session cookie parameters
// set the session cookie parameters
session_set_cookie_params(0, $cookie_path, $cookie_domain);
if (function_exists('ini_set')) {
ini_set('session.use_only_cookies', SESSION_FORCE_COOKIE_USE == 'True' ? 1 : 0);
}
// lets start our session
tep_session_start();
// TODO remove when no more global sessions exist
foreach ($_SESSION as $k => $v) {
$GLOBALS[$k] =& $_SESSION[$k];
}
// set the language
if (!isset($_SESSION['language']) || isset($_GET['language'])) {
$lng = new \language();
if (isset($_GET['language']) && !empty($_GET['language'])) {
$lng->set_language($_GET['language']);
} else {
$lng->get_browser_language();
}
$_SESSION['language'] = $lng->language['directory'];
$_SESSION['languages_id'] = $lng->language['id'];
}
// redirect to login page if administrator is not yet logged in
if (!isset($_SESSION['admin'])) {
$redirect = false;
$current_page = $PHP_SELF;
// if the first page request is to the login page, set the current page to the index page
// so the redirection on a successful login is not made to the login page again
if ($current_page == FILENAME_LOGIN && !isset($_SESSION['redirect_origin'])) {
$current_page = FILENAME_DEFAULT;
}
if ($current_page != FILENAME_LOGIN) {
if (!isset($_SESSION['redirect_origin'])) {
$_SESSION['redirect_origin'] = ['page' => $current_page, 'get' => []];
}
// try to automatically login with the HTTP Authentication values if it exists
if (!isset($_SESSION['auth_ignore'])) {
if (isset($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']) && !empty($_SERVER['PHP_AUTH_PW'])) {
$_SESSION['redirect_origin']['auth_user'] = $_SERVER['PHP_AUTH_USER'];
$_SESSION['redirect_origin']['auth_pw'] = $_SERVER['PHP_AUTH_PW'];
}
}
$redirect = true;
}
if (!isset($login_request) || isset($_GET['login_request']) || isset($_POST['login_request']) || isset($_COOKIE['login_request']) || isset($_SESSION['login_request']) || isset($_FILES['login_request']) || isset($_SERVER['login_request'])) {
$redirect = true;
}
if ($redirect == true) {
tep_redirect(tep_href_link(FILENAME_LOGIN, isset($_SESSION['redirect_origin']['auth_user']) ? 'action=process' : ''));
}
}
// include the language translations
$_system_locale_numeric = setlocale(LC_NUMERIC, 0);
require DIR_FS_ADMIN . 'includes/languages/' . $_SESSION['language'] . '.php';
setlocale(LC_NUMERIC, $_system_locale_numeric);
// Prevent LC_ALL from setting LC_NUMERIC to a locale with 1,0 float/decimal values instead of 1.0 (see bug #634)
$current_page = basename($PHP_SELF);
if (file_exists(DIR_FS_ADMIN . 'includes/languages/' . $_SESSION['language'] . '/' . $current_page)) {
include DIR_FS_ADMIN . 'includes/languages/' . $_SESSION['language'] . '/' . $current_page;
}
//.........这里部分代码省略.........
示例12: define
} else {
$_SESSION['tpl'] = DEFAULT_TPL;
$_GET['tpl'] = '';
}
}
define('SELECTED_TPL', $_SESSION['tpl']);
} else {
define('SELECTED_TPL', DEFAULT_TPL);
}
// require the language class and create an instance
include DIR_WS_CLASSES . 'language.php';
$lng = new language();
// set the language
if (!isset($_SESSION['language']) || isset($_GET['lnc'])) {
if (isset($_GET['lnc']) && xos_not_null($_GET['lnc'])) {
$lng->set_language($_GET['lnc']);
} else {
$lng->get_browser_language();
}
$_SESSION['language'] = $lng->language['directory'];
$_SESSION['languages_id'] = $lng->language['id'];
$_SESSION['languages_code'] = $lng->language['code'];
}
// create the shopping cart & fix the cart if necesary
if (!is_object($_SESSION['cart'])) {
$_SESSION['cart'] = new shoppingCart();
}
// include currencies class and create an instance
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
// include the language translations