本文整理汇总了PHP中VmConfig::vmlang方法的典型用法代码示例。如果您正苦于以下问题:PHP VmConfig::vmlang方法的具体用法?PHP VmConfig::vmlang怎么用?PHP VmConfig::vmlang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmConfig
的用法示例。
在下文中一共展示了VmConfig::vmlang方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$vmlang) {
return self::$vmlang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = vRequest::getString('vmlang', false);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
self::$vmlangTag = $siteLang;
self::$vmlang = strtolower(strtr($siteLang, '-', '_'));
self::$defaultLang = strtolower(strtr($defaultLang, '-', '_'));
vmdebug('$siteLang: ' . $siteLang . ' self::$_jpConfig->lang ' . self::$vmlang);
//@deprecated just fallback
defined('VMLANG') or define('VMLANG', self::$vmlang);
return self::$vmlang;
}
示例2: paste
/**
* Paste the table in json format
*
*/
public function paste()
{
// TODO Test user ?
$json = array();
$json['fields'] = 'error';
$json['msg'] = 'Invalid Token';
$json['structure'] = 'empty';
if (!vRequest::vmCheckToken(-1)) {
echo json_encode($json);
jexit();
}
$lang = vRequest::getvar('lg');
$langs = VmConfig::get('active_languages', array());
$language = JFactory::getLanguage();
if (!in_array($lang, $langs)) {
$json['msg'] = 'Invalid language ! ' . $lang;
$json['langs'] = $langs;
echo json_encode($json);
jexit();
}
$lang = strtolower($lang);
// Remove tag if defaut or
// if ($language->getDefault() == $lang ) $dblang ='';
$dblang = strtr($lang, '-', '_');
VmConfig::$vmlang = $dblang;
$id = vRequest::getInt('id', 0);
$viewKey = vRequest::getCmd('editView');
// TODO temp trick for vendor
if ($viewKey == 'vendor') {
$id = 1;
}
$tables = array('category' => 'categories', 'product' => 'products', 'manufacturer' => 'manufacturers', 'manufacturercategories' => 'manufacturercategories', 'vendor' => 'vendors', 'paymentmethod' => 'paymentmethods', 'shipmentmethod' => 'shipmentmethods');
if (!array_key_exists($viewKey, $tables)) {
$json['msg'] = "Invalid view " . $viewKey;
echo json_encode($json);
jExit();
}
$tableName = '#__virtuemart_' . $tables[$viewKey] . '_' . $dblang;
$db = JFactory::getDBO();
$q = 'select * FROM `' . $tableName . '` where `virtuemart_' . $viewKey . '_id` =' . $id;
$db->setQuery($q);
$m = VmModel::getModel('coupon');
$table = $m->getTable($tables[$viewKey]);
$table->load($id);
$json['fields'] = $table->loadFieldValues();
//if ($json['fields'] = $db->loadAssoc()) {
if ($table->getLoaded()) {
$json['structure'] = 'filled';
$json['msg'] = vmText::_('COM_VIRTUEMART_SELECTED_LANG') . ':' . $lang;
} else {
$json['structure'] = 'empty';
$db->setQuery('SHOW COLUMNS FROM ' . $tableName);
$tableDescribe = $db->loadAssocList();
array_shift($tableDescribe);
$fields = array();
foreach ($tableDescribe as $key => $val) {
$fields[$val['Field']] = $val['Field'];
}
$json['fields'] = $fields;
$json['msg'] = vmText::sprintf('COM_VIRTUEMART_LANG_IS_EMPTY', $lang, vmText::_('COM_VIRTUEMART_' . strtoupper($viewKey)));
}
echo json_encode($json);
jExit();
}
示例3: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$vmlang) {
return self::$vmlang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = vRequest::getString('vmlang', false);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (self::$jDefLang = self::get('vmDefLang', false)) {
self::$jDefLang = strtolower(strtr(self::$jDefLang, '-', '_'));
} else {
self::$jDefLang = strtolower(strtr($defaultLang, '-', '_'));
}
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
self::$vmLangSelected = $siteLang;
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
self::$vmlangTag = $siteLang;
if (count($langs) > 1) {
$lfbs = self::get('vm_lfbs');
vmdebug('my lfbs ' . $lfbs);
if (!empty($lfbs)) {
$pairs = explode(';', $lfbs);
if ($pairs and count($pairs) > 0) {
$fbsAssoc = array();
foreach ($pairs as $pair) {
$kv = explode('~', $pair);
if ($kv and count($kv) === 2) {
$fbsAssoc[$kv[0]] = $kv[1];
}
}
if (isset($fbsAssoc[$siteLang])) {
$defaultLang = $fbsAssoc[$siteLang];
}
self::set('fbsAssoc', $fbsAssoc);
}
}
// this code is uses logic derived from language filter plugin in j3 and should work on most 2.5 versions as well
if (class_exists('JLanguageHelper') && method_exists('JLanguageHelper', 'getLanguages')) {
$languages = JLanguageHelper::getLanguages('lang_code');
$ltag = JFactory::getLanguage()->getTag();
self::$vmlangSef = $languages[$ltag]->sef;
}
}
self::$vmlang = strtolower(strtr($siteLang, '-', '_'));
self::$defaultLang = strtolower(strtr($defaultLang, '-', '_'));
vmdebug('$siteLang: ' . $siteLang . ' self::$vmlangSef: ' . self::$vmlangSef . ' self::$_jpConfig->lang ' . self::$vmlang . ' DefLang ' . self::$defaultLang);
//@deprecated just fallback
defined('VMLANG') or define('VMLANG', self::$vmlang);
return self::$vmlang;
}
示例4: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$lang) {
return self::$lang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = JRequest::getString('vmlang', FALSE);
//vmdebug('My $siteLang by JRequest::getString("vmlang",JRequest::getString("lang")) '.$siteLang);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
if (JVM_VERSION === 1) {
// try to find in session lang
// this work with joomfish j1.5 (application.data.lang)
$session = JFactory::getSession();
$registry = $session->get('registry');
$siteLang = $registry->getValue('application.data.lang');
} else {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
//vmdebug('My selected language by JFactory::getLanguage()->getTag() '.$siteLang);
}
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
self::$vmlangTag = self::$langTag = $siteLang;
self::$vmlang = self::$lang = strtolower(strtr($siteLang, '-', '_'));
vmdebug('Joomla Language tag: ' . $siteLang . ' Virtuemart is using for db ' . self::$lang);
defined('VMLANG') or define('VMLANG', self::$lang);
return self::$lang;
}
示例5: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$vmlang) {
return self::$vmlang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = vRequest::getString('vmlang', false);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
self::$vmLangSelected = $siteLang;
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
if (count($langs) > 1) {
$lfbs = self::get('vm_lfbs');
vmdebug('my lfbs ' . $lfbs);
if (!empty($lfbs)) {
$fbsAssoc = false;
$pairs = explode(';', $lfbs);
if ($pairs and count($pairs) > 0) {
$fbsAssoc = array();
foreach ($pairs as $pair) {
$kv = explode('~', $pair);
if ($kv and count($kv) === 2) {
$fbsAssoc[$kv[0]] = $kv[1];
}
}
if (isset($fbsAssoc[$siteLang])) {
$defaultLang = $fbsAssoc[$siteLang];
}
}
}
}
self::$vmlangTag = $siteLang;
self::$vmlang = strtolower(strtr($siteLang, '-', '_'));
self::$defaultLang = strtolower(strtr($defaultLang, '-', '_'));
vmdebug('$siteLang: ' . $siteLang . ' self::$_jpConfig->lang ' . self::$vmlang . ' fb ' . self::$defaultLang);
//@deprecated just fallback
defined('VMLANG') or define('VMLANG', self::$vmlang);
return self::$vmlang;
}