本文整理汇总了PHP中JLanguage::getLanguagePath方法的典型用法代码示例。如果您正苦于以下问题:PHP JLanguage::getLanguagePath方法的具体用法?PHP JLanguage::getLanguagePath怎么用?PHP JLanguage::getLanguagePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLanguage
的用法示例。
在下文中一共展示了JLanguage::getLanguagePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: language
function language()
{
$this->setLayout('default');
$code = JRequest::getString('code');
if (empty($code)) {
acymailing::display('Code not specified', 'error');
return;
}
$file = null;
$file->name = $code;
$path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini';
$file->path = $path;
jimport('joomla.filesystem.file');
$showLatest = true;
$loadLatest = false;
if (JFile::exists($path)) {
$file->content = JFile::read($path);
if (empty($file->content)) {
acymailing::display('File not found : ' . $path, 'error');
}
} else {
$loadLatest = true;
acymailing::display(JText::_('LOAD_ENGLISH_1') . '<br/>' . JText::_('LOAD_ENGLISH_2') . '<br/>' . JText::_('LOAD_ENGLISH_3'), 'info');
$file->content = JFile::read(JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'en-GB' . DS . 'en-GB.com_acymailing.ini');
}
if ($loadLatest or JRequest::getString('task') == 'latest') {
$doc =& JFactory::getDocument();
$doc->addScript(ACYMAILING_UPDATEURL . 'languageload&code=' . JRequest::getString('code'));
$showLatest = false;
} elseif (JRequest::getString('task') == 'save') {
$showLatest = false;
}
$this->assignRef('showLatest', $showLatest);
$this->assignRef('file', $file);
}
示例2: __construct
function __construct(& $subject, $config) {
// Check if Kunena API exists
$api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
if (! is_file ( $api ))
return false;
jimport ( 'joomla.application.component.helper' );
// Check if Kunena component is installed/enabled
if (! JComponentHelper::isEnabled ( 'com_kunena', true )) {
return false;
}
// Load Kunena API
require_once $api;
// Fix Joomla 1.5 bugs and bad performance
$version = new JVersion();
if ($version->RELEASE == '1.5') {
$lang = JFactory::getLanguage();
if (JFactory::getApplication()->isAdmin()) {
$lang->load('com_kunena.menu', JPATH_ADMINISTRATOR);
} else {
$filename = JLanguage::getLanguagePath( JPATH_BASE, $lang->_lang)."/{$lang->_lang}.com_kunena.ini";
$lang->_paths['com_kunena'][$filename] = 1;
}
}
parent::__construct ( $subject, $config );
}
示例3: setFile
/**
*
*
*
*/
protected function setFile()
{
$params = JComponentHelper::getParams('com_languages');
$frontend_lang = $params->get('site', 'en-GB');
$language = JLanguage::getInstance($frontend_lang);
// get language file for edit
$language = JFactory::getLanguage();
$language->load('com_jdownloads');
$lang_file = JLanguage::getLanguagePath(JPATH_SITE);
$lang_file .= DS . $frontend_lang . DS . $frontend_lang . '.com_jdownloads.ini';
@chmod($lang_file, 0755);
clearstatcache();
if (is_writable($lang_file) == false) {
$language_writable = false;
} else {
$language_writable = true;
}
if ($language_writable) {
$f = fopen($lang_file, "r");
$language_text = fread($f, filesize($lang_file));
$this->languagetext = htmlspecialchars($language_text);
} else {
$this->languagetext = '';
}
$this->languagefile = $lang_file;
$this->languagefile_writable = $language_writable;
}
示例4: listslanguagesType
function listslanguagesType()
{
jimport('joomla.filesystem.folder');
$path = JLanguage::getLanguagePath(JPATH_ROOT);
$dirs = JFolder::folders($path);
$this->languages = array();
foreach ($dirs as $dir) {
if (strlen($dir) != 5 || $dir == "xx-XX") {
continue;
}
$xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
$xmlFile = reset($xmlFiles);
if (empty($xmlFile)) {
continue;
}
$data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
$oneLanguage = new stdClass();
$oneLanguage->language = strtolower($dir);
$oneLanguage->name = empty($data['name']) ? $dir : $data['name'];
$this->languages[] = $oneLanguage;
}
if (count($this->languages) < 2) {
return;
}
$this->multipleLang = true;
$this->choice = array();
$this->choice[] = JHTML::_('select.option', 'all', JText::_('ACY_ALL'));
$this->choice[] = JHTML::_('select.option', 'special', JText::_('ACY_CUSTOM'));
$js = "function updateLanguages(){\n\t\t\tchoice = eval('document.adminForm.choice_languages');\n\t\t\tchoiceValue = 'special';\n\t\t\tfor (var i=0; i < choice.length; i++){\n\t\t\t\t if (choice[i].checked){\n\t\t\t\t\t choiceValue = choice[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thiddenVar = document.getElementById('hidden_languages');\n\t\t\tif(choiceValue != 'special'){\n\t\t\t\thiddenVar.value = choiceValue;\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'none';\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'block';\n\t\t\t\tspecialVar = eval('document.adminForm.special_languages');\n\t\t\t\tfinalValue = '';\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\n\t\t\t\t\tif (specialVar[i].checked){\n\t\t\t\t\t\t\t finalValue += specialVar[i].value+',';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thiddenVar.value = finalValue;\n\t\t\t}\n\n\t\t}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
}
示例5: convertLng
function convertLng($data)
{
session_cache_expire(1800000);
$path = JLanguage::getLanguagePath(JPATH_COMPONENT_ADMINISTRATOR) . DS . $data['lng'] . DS . '*.ini';
$dirs = glob($path);
foreach ($dirs as $file) {
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=" . basename($file));
header("Pragma: no-cache");
header("Expires: 0");
$arr = file($file);
foreach ($arr as $line) {
$line = str_replace('"', "'", $line);
// dmp($line);
$ex = explode("=", $line);
// dmp($ex);
if (count($ex) > 1) {
echo $ex[0] . "=";
if (count($ex) > 2) {
unset($ex[0]);
$str = '"' . implode("=", $ex);
$str = str_replace("\r\n", "\"\r\n", $str);
echo $str;
} else {
$str = '"' . $ex[1];
$str = str_replace("\r\n", "\"\r\n", $str);
echo $str;
}
}
}
}
}
示例6: installMessage
function installMessage()
{
$db = JFactory::getDBO();
$lang = JFactory::getLanguage();
$currentlang = $lang->getTag();
$objectReadxmlDetail = new JSNISReadXmlDetails();
$infoXmlDetail = $objectReadxmlDetail->parserXMLDetails();
$langSupport = $infoXmlDetail['langs'];
$registry = new JRegistry();
$newStrings = array();
$path = null;
$realLang = null;
$queries = array();
if (array_key_exists($currentlang, $langSupport)) {
$path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang);
$realLang = $currentlang;
} else {
$filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language';
$foldersLang = $this->getFolder($filepath);
foreach ($foldersLang as $value) {
if (in_array($value, $langSupport) == true) {
$path = JLanguage::getLanguagePath(JPATH_BASE, $value);
$realLang = $value;
break;
}
}
}
$filename = $path . DS . $realLang . '.com_imageshow.ini';
$objJNSUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$content = $objJNSUtils->readFileToString($filename);
if ($content) {
$registry->loadString($content);
$newStrings = $registry->toArray();
if (count($newStrings)) {
if (count($infoXmlDetail['menu'])) {
$queries[] = 'TRUNCATE TABLE #__jsn_imageshow_messages';
foreach ($infoXmlDetail['menu'] as $value) {
$index = 1;
while (isset($newStrings['MESSAGE_' . $value . '_' . $index . '_PRIMARY'])) {
$queries[] = 'INSERT INTO #__jsn_imageshow_messages (msg_screen, published, ordering) VALUES (\'' . $value . '\', 1, ' . $index . ')';
$index++;
}
}
}
}
if (count($queries)) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '') {
$db->setQuery($query);
$db->query();
}
}
}
}
return true;
}
示例7: installMessage
function installMessage()
{
$db =& JFactory::getDBO();
$lang =& JFactory::getLanguage();
$currentlang = $lang->getTag();
$objectReadxmlDetail = new JSNISReadXmlDetails();
$infoXmlDetail = $objectReadxmlDetail->parserXMLDetails();
$langSupport = $infoXmlDetail['langs'];
$registry = new JRegistry();
$newStrings = array();
$path = null;
$realLang = null;
$queries = array();
if (array_key_exists($currentlang, $langSupport)) {
$path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang);
$realLang = $currentlang;
} else {
$filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language';
$foldersLang = $this->getFolder($filepath);
foreach ($foldersLang as $value) {
if (in_array($value, $langSupport) == true) {
$path = JLanguage::getLanguagePath(JPATH_BASE, $value);
$realLang = $value;
break;
}
}
}
$filename = $path . DS . $realLang . '.com_imageshow.ini';
$content = @file_get_contents($filename);
if ($content) {
$registry->loadINI($content);
$newStrings = $registry->toArray();
if (count($newStrings)) {
if (count($infoXmlDetail['menu'])) {
$queries[] = 'TRUNCATE TABLE `#__imageshow_messages`';
foreach ($infoXmlDetail['menu'] as $value) {
$index = 1;
while (isset($newStrings['MESSAGE ' . $value . ' ' . $index . ' PRIMARY'])) {
$queries[] = 'INSERT INTO `#__imageshow_messages` (`msg_id`,`msg_screen`,`published`,`ordering`) VALUES (NULL, "' . $value . '", 1, ' . $index . ')';
$index++;
}
}
}
}
if (count($queries)) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '') {
$db->setQuery($query);
$db->query();
}
}
}
}
return true;
}
示例8: language
function language()
{
$this->setLayout('default');
$code = JRequest::getCmd('code');
if (empty($code)) {
acymailing_display('Code not specified', 'error');
return;
}
$file = new stdClass();
$file->name = $code;
$path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini';
$file->path = $path;
jimport('joomla.filesystem.file');
$showLatest = true;
$loadLatest = false;
if (JFile::exists($path)) {
$file->content = JFile::read($path);
if (empty($file->content)) {
acymailing_display('File not found : ' . $path, 'error');
}
} else {
$loadLatest = true;
acymailing_enqueueMessage(JText::_('LOAD_ENGLISH_1') . '<br />' . JText::_('LOAD_ENGLISH_2') . '<br />' . JText::_('LOAD_ENGLISH_3'), 'info');
$file->content = JFile::read(JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'en-GB' . DS . 'en-GB.com_acymailing.ini');
}
$custompath = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing_custom.ini';
if (JFile::exists($custompath)) {
$file->customcontent = JFile::read($custompath);
}
if ($loadLatest or JRequest::getCmd('task') == 'latest') {
if (file_exists(JPATH_ROOT . DS . 'language' . DS . $code)) {
$doc = JFactory::getDocument();
$doc->addScript(ACYMAILING_UPDATEURL . 'languageload&code=' . JRequest::getCmd('code'));
} else {
acymailing_enqueueMessage('The specified language "' . htmlspecialchars($code, ENT_COMPAT, 'UTF-8') . '" is not installed on your site', 'warning');
}
$showLatest = false;
} elseif (JRequest::getCmd('task') == 'save') {
$showLatest = false;
}
if (JRequest::getString('tmpl') == 'component') {
$acyToolbar = acymailing::get('helper.toolbar');
$acyToolbar->save();
$acyToolbar->custom('share', JText::_('SHARE'), 'share', false);
$acyToolbar->setTitle(JText::_('ACY_FILE') . ' : ' . $this->escape($file->name));
$acyToolbar->topfixed = false;
$acyToolbar->display();
}
$this->assignRef('showLatest', $showLatest);
$this->assignRef('file', $file);
}
示例9: wizard
function wizard()
{
$db = JFactory::getDBO();
hikashop_setTitle(JText::_('HIKA_WIZARD'), 'config', 'update&task=wizard');
if (!HIKASHOP_PHP5) {
$bar =& JToolBar::getInstance('toolbar');
} else {
$bar = JToolBar::getInstance('toolbar');
}
$bar->appendButton('Link', 'hikashop', JText::_('HIKA_SKIP'), hikashop_completeLink('update&task=post_install&fromversion=&update=0'));
$languagesCodes = array();
$languagesNames = array();
if (HIKASHOP_J25) {
$db->setQuery('SELECT * FROM ' . hikashop_table('languages', false) . ' WHERE `published` = 1');
$languages = $db->loadObjectList();
foreach ($languages as $language) {
$path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $language->lang_code . DS . $language->lang_code . '.com_hikashop.ini';
if (!JFile::exists($path)) {
$languagesCodes[] = $language->lang_code;
$languagesNames[] = $language->title;
}
}
}
if (!empty($languagesCodes)) {
$languageCodes = implode('_', $languagesCodes);
}
if (!empty($languagesNames)) {
$languagesNames = implode(', ', $languagesNames);
}
$this->assignRef('languageCodes', $languageCodes);
$this->assignRef('languageNames', $languagesNames);
$fieldsClass = hikashop_get('class.field');
$this->assignRef('fieldsClass', $fieldsClass);
static $Itemid;
if (isset($Itemid) && !empty($Itemid)) {
$url_itemid = '&item_id=' . $Itemid;
} else {
$url_itemid = '';
}
$address = new stdClass();
$extraFields = array();
$extraFields['address'] = $fieldsClass->getFields('frontcomp', $address, 'address', 'update&task=state' . $url_itemid);
$this->assignRef('extraFields', $extraFields);
$this->assignRef('address', $address);
$db->setQuery('SELECT * FROM ' . hikashop_table('currency') . ' WHERE 1 ORDER BY `currency_code`');
$currencies = $db->loadObjectList();
$this->assignRef('currencies', $currencies);
hikashop_loadJslib('jquery');
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('WELCOME_WIZARD', 'success'));
}
示例10: _loadItems
function _loadItems()
{
global $mainframe, $option;
$db = &JFactory::getDBO();
// Get the site languages
$langBDir = JLanguage::getLanguagePath(JPATH_SITE);
$langDirs = JFolder::folders($langBDir);
for ($i=0; $i < count($langDirs); $i++)
{
$lang = new stdClass();
$lang->folder = $langDirs[$i];
$lang->baseDir = $langBDir;
$languages[] = $lang;
}
$rows = array();
$rowid = 0;
foreach ($languages as $language)
{
$files = JFolder::files( $language->baseDir.DS.$language->folder, '\.(com_jce)\.xml$' );
foreach ($files as $file)
{
$data = JApplicationHelper::parseXMLInstallFile($language->baseDir.DS.$language->folder.DS.$file);
$row = new StdClass();
$row->id = $rowid;
$row->language = $language->baseDir.DS.$language->folder;
// If we didn't get valid data from the xml file, move on...
if (!is_array($data)) {
continue;
}
// Populate the row from the xml meta file
foreach($data as $key => $value) {
$row->$key = $value;
}
$row->jname = JString::strtolower( str_replace( " ", "_", $row->name ) );
$rows[] = $row;
$rowid++;
}
}
$this->setState('pagination.total', count($rows));
if($this->_state->get('pagination.limit') > 0) {
$this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') );
} else {
$this->_items = $rows;
}
}
示例11: viewLanguages
/**
* Compiles a list of installed languages
*/
function viewLanguages()
{
global $mainframe, $option;
// Initialize some variables
$db =& JFactory::getDBO();
$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
$rows = array();
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
$rowid = 0;
// Set FTP credentials, if given
jimport('joomla.client.helper');
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
//load folder filesystem class
jimport('joomla.filesystem.folder');
$path = JLanguage::getLanguagePath($client->path);
$dirs = JFolder::folders($path);
foreach ($dirs as $dir) {
$files = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
foreach ($files as $file) {
$data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $file);
$row = new StdClass();
$row->id = $rowid;
$row->language = substr($file, 0, -4);
if (!is_array($data)) {
continue;
}
foreach ($data as $key => $value) {
$row->{$key} = $value;
}
// if current than set published
$params = JComponentHelper::getParams('com_languages');
if ($params->get($client->name, 'en-GB') == $row->language) {
$row->published = 1;
} else {
$row->published = 0;
}
$row->checked_out = 0;
$row->mosname = JString::strtolower(str_replace(" ", "_", $row->name));
$rows[] = $row;
$rowid++;
}
}
jimport('joomla.html.pagination');
$pageNav = new JPagination($rowid, $limitstart, $limit);
$rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
HTML_languages::showLanguages($rows, $pageNav, $option, $client, $ftp);
}
示例12: language
/**
* Loads an aray of javascript language
*
* @params array $langs Array of language files
*
* @return void
*/
public function language($langs)
{
//force array
settype($langs, 'array');
$scripts = '';
$tag = JFactory::getLanguage()->getTag();
$base = JLanguage::getLanguagePath(JPATH_ROOT, $tag);
foreach ($langs as $lang) {
$path = $base . '/' . $tag . '.' . $lang . '.js';
if (is_readable($path)) {
$src = JURI::base() . '/language/' . $tag . '/' . $tag . '.' . $lang . '.js';
$scripts .= '<script type="text/javascript" src="' . $src . '"></script>' . "\n";
}
}
return $scripts;
}
示例13: getList
/**
* Get a list of langpack info
*
* @return array
*/
public function getList()
{
if (!isset($this->_list)) {
$basedir = JLanguage::getLanguagePath(JPATH_SITE);
$dirs = JFolder::folders($basedir, '.', false, false, array('.svn', 'CVS', 'pdf_fonts'));
$this->_list = array();
foreach ($dirs as $dir) {
foreach (JFolder::files($basedir . DS . $dir, '^([-_A-Za-z]*)\\.xml$') as $file) {
if ($data = $this->_parseXml($basedir . DS . $dir . DS . $file)) {
$this->_list[$dir] = $data;
break;
}
}
}
}
return $this->_list;
}
示例14: language
public static function language($value)
{
if (empty($value)) {
return static::value($value);
} else {
$path = JLanguage::getLanguagePath(JPATH_SITE, $value);
$file = "{$value}.xml";
$result = null;
if (is_file("{$path}/{$file}")) {
$result = JLanguage::parseXMLLanguageFile("{$path}/{$file}");
}
if ($result) {
return htmlspecialchars($result['name']);
} else {
return static::value('');
}
}
}
示例15: __construct
function __construct(&$subject, $config)
{
// Check if Kunena API exists
$api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
if (!is_file($api)) {
return false;
}
jimport('joomla.application.component.helper');
// Check if Kunena component is installed/enabled
if (!JComponentHelper::isEnabled('com_kunena', true)) {
return false;
}
// Load Kunena API
require_once $api;
// Do not load if Kunena version is not supported or Kunena is not installed
if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) {
return false;
}
$this->loadLanguage('plg_system_kunena.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_system_kunena.sys', KPATH_ADMIN);
if (version_compare(JVERSION, '1.6', '<')) {
// Joomla 1.5: Fix bugs and bad performance
$lang = JFactory::getLanguage();
if (JFactory::getApplication()->isAdmin()) {
// Load the missing language files in administration
$lang->load('com_kunena.menu', JPATH_ADMINISTRATOR) || $lang->load('com_kunena.menu', KPATH_ADMIN);
$lang->load('com_kunena.sys', JPATH_ADMINISTRATOR) || $lang->load('com_kunena.sys', KPATH_ADMIN);
if (JRequest::getCmd('option') == 'com_plugins' && JRequest::getCmd('view') == 'plugin' && JRequest::getCmd('task') == 'edit') {
// Support for J!1.7 .sys language files
$cid = JRequest::getVar('cid', array(0), '', 'array');
$row = JTable::getInstance('plugin');
$row->load((int) $cid[0]);
$lang->load('plg_' . trim($row->folder) . '_' . trim($row->element) . '.sys', JPATH_ADMINISTRATOR) || $lang->load('plg_' . trim($row->folder) . '_' . trim($row->element) . '.sys', KPATH_ADMIN);
}
} else {
// Never load language file
$filename = JLanguage::getLanguagePath(JPATH_BASE, $lang->_lang) . "/{$lang->_lang}.com_kunena.ini";
$lang->_paths['com_kunena'][$filename] = 1;
}
}
parent::__construct($subject, $config);
}