当前位置: 首页>>代码示例>>PHP>>正文


PHP SEFTools::getLangLongCode方法代码示例

本文整理汇总了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];
 }
开发者ID:01J,项目名称:bealtine,代码行数:67,代码来源:seftools.php

示例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;
     }
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:21,代码来源:joomsef.php

示例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];
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:50,代码来源:seftools.php


注:本文中的SEFTools::getLangLongCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。