本文整理汇总了PHP中SEFTools::getLangLongCode方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::getLangLongCode方法的具体用法?PHP SEFTools::getLangLongCode怎么用?PHP SEFTools::getLangLongCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SEFTools
的用法示例。
在下文中一共展示了SEFTools::getLangLongCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExtTexts
/** Returns the array of texts used by the extension for creating URLs
* in currently selected language (for JoomFish support)
*
* @param string Extension name
* @return array Extension's texts
*/
function getExtTexts($option, $lang = '')
{
$database =& JFactory::getDBO();
static $extTexts;
if ($option == '') {
return false;
}
// Set the language
if ($lang == '') {
$lang = JFactory::getLanguage()->getTag();
}
if (!isset($extTexts)) {
$extTexts = array();
}
if (!isset($extTexts[$option])) {
$extTexts[$option] = array();
}
if (!isset($extTexts[$option][$lang])) {
$extTexts[$option][$lang] = array();
// If lang is different than current language, change it
if ($lang != JFactory::getLanguage()->getTag()) {
$language =& JFactory::getLanguage();
$oldLang = $language->setLanguage($lang);
$language->load();
}
$query = "SELECT `lang_id` AS `id`";
$query .= " FROM `#__languages`";
$query .= " WHERE `lang_code` = " . $database->quote($lang);
$database->setQuery($query);
$lang_id = $database->loadResult();
//$query = "SELECT `id`, `name`, `value` FROM `#__sefexttexts` WHERE `extension` = '$option'";
$query = "SELECT `lang_id`, `name`, `value`";
$query .= " FROM `#__sefexttexts`";
$query .= " WHERE `extension` = " . $database->quote($option);
$query .= " AND (`lang_id` = 0" . ($lang_id ? " OR `lang_id` = " . $lang_id : "") . ")";
$query .= " ORDER BY `lang_id` DESC";
$database->setQuery($query);
$texts = $database->loadObjectList();
/*$ntexts=array();
for($i=0;$i<count($texts);$i++) {
$ntexts[$texts[$i]->lang_id][$texts[$i]->name]=$texts[$i];
}*/
if (is_array($texts) && count($texts) > 0) {
foreach (array_keys($texts) as $i) {
$name = $texts[$i]->name;
//$value = $texts[$i]->value;
if (!isset($extTexts[$option][$lang][$name])) {
$extTexts[$option][$lang][$name] = $texts[$i]->value;
}
//$extTexts[$option][$lang][$name] = $value;
}
}
// Set the language back to previously selected one
if (isset($oldLang) && $oldLang != SEFTools::getLangLongCode()) {
$language =& JFactory::getLanguage();
$language->setLanguage($oldLang);
$language->load();
}
}
return $extTexts[$option][$lang];
}
示例2: _getCustomMenuTitle
function _getCustomMenuTitle($option)
{
$db =& JFactory::getDBO();
$sefConfig =& SEFConfig::getConfig();
$lang = SEFTools::getLangLongCode();
static $titles;
$jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
if (!isset($titles)) {
$titles = array();
}
if (!isset($titles[$lang])) {
$db->setQuery("SELECT `file`, `title`{$jfTranslate} FROM `#__sefexts`");
$titles[$lang] = $db->loadObjectList('file');
}
$file = $option . '.xml';
if (isset($titles[$lang][$file]->title)) {
return $titles[$lang][$file]->title;
} else {
return null;
}
}
示例3: getExtTexts
/** Returns the array of texts used by the extension for creating URLs
* in currently selected language (for JoomFish support)
*
* @param string Extension name
* @return array Extension's texts
*/
function getExtTexts($option, $lang = '')
{
$database = ShlDbHelper::getDb();
static $extTexts;
if ($option == '') {
return false;
}
// Set the language
if ($lang == '') {
$lang = SEFTools::getLangLongCode();
}
if (!isset($extTexts)) {
$extTexts = array();
}
if (!isset($extTexts[$option])) {
$extTexts[$option] = array();
}
if (!isset($extTexts[$option][$lang])) {
$extTexts[$option][$lang] = array();
// If lang is different than current language, change it
if ($lang != SEFTools::getLangLongCode()) {
$language = JFactory::getLanguage();
$oldLang = $language->setLanguage($lang);
$language->load();
}
$query = "SELECT `id`, `name`, `value` FROM `#__sefexttexts` WHERE `extension` = '{$option}'";
$database->setQuery($query);
$texts = $database->loadObjectList();
if (is_array($texts) && count($texts) > 0) {
foreach (array_keys($texts) as $i) {
$name = $texts[$i]->name;
$value = $texts[$i]->value;
$extTexts[$option][$lang][$name] = $value;
}
}
// Set the language back to previously selected one
if (isset($oldLang) && $oldLang != SEFTools::getLangLongCode()) {
$language = JFactory::getLanguage();
$language->setLanguage($oldLang);
$language->load();
}
}
return $extTexts[$option][$lang];
}