本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::readLLfile方法的具体用法?PHP GeneralUtility::readLLfile怎么用?PHP GeneralUtility::readLLfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::readLLfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* The main render method of this ViewHelper.
*
* @return array|string
*/
public function render()
{
$path = $this->getResolvedPath();
$languageKey = $this->getLanguageKey();
$locallang = GeneralUtility::readLLfile($path, $languageKey);
$labels = $this->getLabelsByLanguageKey($locallang, $languageKey);
$labels = $this->getLabelsFromTarget($labels);
return $this->renderChildrenWithVariableOrReturnInput($labels);
}
示例2: includeLocalLang
public function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal') . 'Resources/Private/Language/locallang_plugin.xml';
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 4006000) {
$localizationParser = new \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser();
$LOCAL_LANG = $localizationParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
} else {
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang);
}
return $LOCAL_LANG;
}
示例3: needAdditionalData
/**
* Determine if additional data is needed
*
* @return bool If additional data is needed true gets returned
*/
public function needAdditionalData()
{
$basePath = PATH_TXCOMMERCE . 'Resources/Private/Language/locallang_creditcard.xml';
foreach ($this->parentObject->LOCAL_LANG as $llKey => $_) {
$newLl = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($basePath, $llKey);
$this->LOCAL_LANG[$llKey] = $newLl[$llKey];
}
if ($this->parentObject->altLLkey) {
$tempLocalLang = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($basePath, $this->parentObject->altLLkey);
$this->LOCAL_LANG = array_merge(is_array($this->LOCAL_LANG) ? $this->LOCAL_LANG : array(), $tempLocalLang);
}
if ($this->provider !== NULL) {
return $this->provider->needAdditionalData();
}
return TRUE;
}
示例4: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
* @return The array with language labels
*/
function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'locallang.xml';
// TYPO3 V6 fix
// $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);
//$version=class_exists('t3lib_utility_VersionNumber') ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) : \TYPO3\CMS\Core\Utility\GeneralUtility::int_from_ver(TYPO3_version);
// TYPO3 V7 fix
$version = class_exists('t3lib_utility_VersionNumber') ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) : TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
if ($version >= 4007000) {
//$localizationParser= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_l10n_parser_Llxml');
//$LOCAL_LANG=$localizationParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
// TYPO3 V7 fix
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang);
} else {
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);
}
return $LOCAL_LANG;
}
示例5: render
/**
* Renders else-child or else-argument if variable $item is in $list
*
* @param string $list
* @param string $item
* @return string
*/
public function render()
{
$item = $this->arguments['item'];
$as = $this->arguments['as'];
$plugin = $this->arguments['plugin'];
$ctype = $this->arguments['ctype'];
// plugin
if ($plugin === TRUE) {
foreach ($GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] as $itemKey => $itemValue) {
if (trim($itemValue[1]) == $item['list_type']) {
preg_match('/EXT:(.*?)\\//', $itemValue[0], $ext);
preg_match('/^LLL:(EXT:.*?):(.*)/', $itemValue[0], $llfile);
$localLang = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llfile[1], $GLOBALS['LANG']->lang);
$item['iconext'] = tx_additionalreports_util::getExtIcon($ext[1]);
$item['extension'] = $ext[1];
$item['plugin'] = $GLOBALS['LANG']->getLLL($llfile[2], $localLang) . ' (' . $item['list_type'] . ')';
} else {
$item['plugin'] = $item['list_type'];
}
}
}
// CType
if ($ctype === TRUE) {
foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $itemValue) {
if ($itemValue[1] != '--div--') {
if (trim($itemValue[1]) == $item['CType']) {
preg_match('/^LLL:(EXT:.*?):(.*)/', $itemValue[0], $llfile);
$localLang = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llfile[1], $GLOBALS['LANG']->lang);
$item['iconext'] = tx_additionalreports_util::getContentTypeIcon($itemValue[2]);
$item['ctype'] = $GLOBALS['LANG']->getLLL($llfile[2], $localLang) . ' (' . $item['CType'] . ')';
} else {
$item['ctype'] = $item['CType'];
}
}
}
}
$item = array_merge($item, tx_additionalreports_main::getContentInfos($item));
if ($this->templateVariableContainer->exists($as)) {
$this->templateVariableContainer->remove($as);
}
$this->templateVariableContainer->add($as, $item);
}
示例6: main
/**
* Returns TRUE if the plugin is available and correctly initialized
*
* @param object Reference to parent object, which is an instance of the htmlArea RTE
* @return boolean TRUE if this plugin object should be made available in the current environment and is correctly initialized
*/
public function main($parentObject)
{
global $TYPO3_CONF_VARS, $LANG, $TSFE;
$this->htmlAreaRTE = $parentObject;
$this->rteExtensionKey =& $this->htmlAreaRTE->ID;
$this->thisConfig =& $this->htmlAreaRTE->thisConfig;
$this->toolbar =& $this->htmlAreaRTE->toolbar;
$this->LOCAL_LANG =& $this->htmlAreaRTE->LOCAL_LANG;
// Set the value of this boolean based on the initial value of $this->pluginButtons
$this->pluginAddsButtons = !empty($this->pluginButtons);
// Check if the plugin should be disabled in frontend
if ($this->htmlAreaRTE->is_FE() && $TYPO3_CONF_VARS['EXTCONF'][$this->rteExtensionKey]['plugins'][$this->pluginName]['disableInFE']) {
return FALSE;
}
// Localization array must be initialized here
if ($this->relativePathToLocallangFile) {
if ($this->htmlAreaRTE->is_FE()) {
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->LOCAL_LANG, \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language));
} else {
$LANG->includeLLFile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile);
}
}
return TRUE;
}
示例7: pi_loadLL
/**
* Loads local-language values by looking for a "locallang" file in the
* plugin class directory ($this->scriptRelPath) and if found includes it.
* Also locallang values set in the TypoScript property "_LOCAL_LANG" are
* merged onto the values found in the "locallang" file.
* Supported file extensions xlf, xml, php
*
* @return void
*/
public function pi_loadLL()
{
if (!$this->LOCAL_LANG_loaded && $this->scriptRelPath) {
$basePath = 'EXT:' . $this->extKey . '/' . dirname($this->scriptRelPath) . '/locallang.xml';
// Read the strings in the required charset (since TYPO3 4.2)
$this->LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($basePath, $this->LLkey, $GLOBALS['TSFE']->renderCharset);
if ($this->altLLkey) {
$this->LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($basePath, $this->altLLkey);
}
// Overlaying labels from TypoScript (including fictitious language keys for non-system languages!):
$confLL = $this->conf['_LOCAL_LANG.'];
if (is_array($confLL)) {
foreach ($confLL as $languageKey => $languageArray) {
// Don't process label if the langue is not loaded
$languageKey = substr($languageKey, 0, -1);
if (is_array($languageArray) && is_array($this->LOCAL_LANG[$languageKey])) {
// Remove the dot after the language key
foreach ($languageArray as $labelKey => $labelValue) {
if (!is_array($labelValue)) {
$this->LOCAL_LANG[$languageKey][$labelKey][0]['target'] = $labelValue;
$this->LOCAL_LANG_charset[$languageKey][$labelKey] = 'utf-8';
}
}
}
}
}
}
$this->LOCAL_LANG_loaded = 1;
}
示例8: readLLfile
/**
* Includes a locallang file and returns the $LOCAL_LANG array found inside.
*
* @param string $fileRef Input is a file-reference to be a 'local_lang' file containing a $LOCAL_LANG array
* @return array value of $LOCAL_LANG found in the included file, empty if non found
*/
protected function readLLfile($fileRef)
{
if ($this->lang !== 'default') {
$languages = array_reverse($this->languageDependencies);
} else {
$languages = array('default');
}
$localLanguage = array();
foreach ($languages as $language) {
$tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->charSet);
$localLanguage['default'] = $tempLL['default'];
if (!isset($localLanguage[$this->lang])) {
$localLanguage[$this->lang] = $localLanguage['default'];
}
if ($this->lang !== 'default' && isset($tempLL[$language])) {
// Merge current language labels onto labels from previous language
// This way we have a labels with fall back applied
ArrayUtility::mergeRecursiveWithOverrule($localLanguage[$this->lang], $tempLL[$language], TRUE, FALSE);
}
}
return $localLanguage;
}
示例9: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
function includeLocalLang()
{
$llFile = t3lib_extMgm::extPath('rgsmoothgallery') . 'locallang.xml';
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang);
return $LOCAL_LANG;
}
示例10: includeLanguageFileForInline
/**
* Include language file for inline usage
*
* @param string $fileRef
* @param string $selectionPrefix
* @param string $stripFromSelectionName
* @param integer $errorMode
* @return void
* @throws RuntimeException
*/
protected function includeLanguageFileForInline($fileRef, $selectionPrefix = '', $stripFromSelectionName = '', $errorMode = 0)
{
if (!isset($this->lang) || !isset($this->charSet)) {
throw new \RuntimeException('Language and character encoding are not set.', 1284906026);
}
$labelsFromFile = array();
$allLabels = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($fileRef, $this->lang, $this->charSet, $errorMode);
// Regular expression to strip the selection prefix and possibly something from the label name:
$labelPattern = '#^' . preg_quote($selectionPrefix, '#') . '(' . preg_quote($stripFromSelectionName, '#') . ')?#';
if ($allLabels !== FALSE) {
// Merge language specific translations:
if ($this->lang !== 'default' && isset($allLabels[$this->lang])) {
$labels = array_merge($allLabels['default'], $allLabels[$this->lang]);
} else {
$labels = $allLabels['default'];
}
// Iterate through all locallang labels:
foreach ($labels as $label => $value) {
if ($selectionPrefix === '') {
$labelsFromFile[$label] = $value;
} elseif (strpos($label, $selectionPrefix) === 0) {
$key = preg_replace($labelPattern, '', $label);
$labelsFromFile[$label] = $value;
}
}
$this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $labelsFromFile);
}
}
示例11: drawMap
/**
* Main function to draw the map. Outputs all the necessary HTML and
* Javascript to draw the map in the frontend or backend.
*
* @access public
* @return string HTML and Javascript markup to draw the map.
*/
function drawMap()
{
// TODO: devlog start
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': starting map drawing', 'wec_map_api');
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': API key: ' . $this->key, 'wec_map_api');
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': domain: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'), 'wec_map_api');
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': map type: ' . $this->type, 'wec_map_api');
}
// devlog end
$lang = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:wec_map/map_service/google/locallang.xml', $this->lang);
$hasThingsToDisplay = $this->hasThingsToDisplay();
$hasHeightWidth = $this->hasHeightWidth();
// make sure we have markers to display and an API key
if ($hasThingsToDisplay && $hasHeightWidth) {
// auto center and zoom if necessary
$this->autoCenterAndZoom();
$htmlContent = $this->mapDiv();
$get = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged('tx_wecmap_api');
// if we're forcing static display, skip the js
if ($this->static && ($this->staticMode == 'force' || $this->staticUrlParam && intval($get['static']) == 1)) {
return $htmlContent;
}
$scheme = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
// get the correct API URL
$apiURL = $scheme . 'maps.googleapis.com/maps/api/js?sensor=false&language=' . $this->lang . '&libraries=places';
if (tx_wecmap_backend::getExtConf('useOwnJS')) {
$mmURL = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('wec_map') . 'contribJS/markermanager.js';
$ibURL = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('wec_map') . 'contribJS/infobubble.js';
$omURL = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('wec_map') . 'contribJS/oms.min.js';
} else {
$mmURL = $scheme . 'google-maps-utility-library-v3.googlecode.com/svn/tags/markermanager/1.0/src/markermanager.js';
$ibURL = $scheme . 'google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js';
$omURL = $scheme . 'jawj.github.com/OverlappingMarkerSpiderfier/bin/oms.min.js';
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': loading API from URL: ' . $apiURL, 'wec_map_api');
}
/* If we're in the frontend, use TSFE. Otherwise, include JS manually. */
$jsDir = tx_wecmap_backend::getExtConf('jsDir');
if (empty($jsDir)) {
$jsDir = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('wec_map') . 'res/';
}
$jsFile = $jsDir . 'wecmap.js';
$jsFile2 = $jsDir . 'copyrights.js';
$jsFile3 = $jsDir . 'wecmap_backend.js';
if (TYPO3_MODE == 'FE') {
$GLOBALS['TSFE']->additionalHeaderData['wec_map_googleMaps'] = '<script src="' . $apiURL . '" type="text/javascript"></script>' . '<script src="' . $mmURL . '" type="text/javascript"></script>' . '<script src="' . $ibURL . '" type="text/javascript"></script>' . '<script src="' . $omURL . '" type="text/javascript"></script>';
$GLOBALS['TSFE']->additionalHeaderData['wec_map'] = ($jsFile ? '<script src="' . $jsFile . '" type="text/javascript"></script>' : '') . ($jsFile2 ? '<script src="' . $jsFile2 . '" type="text/javascript"></script>' : '');
} else {
$htmlContent .= '<script src="' . $apiURL . '" type="text/javascript"></script>';
if (tx_wecmap_backend::getExtConf('useOwnJS')) {
$htmlContent .= '<script src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $mmURL . '" type="text/javascript"></script>';
$htmlContent .= '<script src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $ibURL . '" type="text/javascript"></script>';
$htmlContent .= '<script src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $omURL . '" type="text/javascript"></script>';
} else {
$htmlContent .= '<script src="' . $mmURL . '" type="text/javascript"></script>';
$htmlContent .= '<script src="' . $ibURL . '" type="text/javascript"></script>';
$htmlContent .= '<script src="' . $omURL . '" type="text/javascript"></script>';
}
$htmlContent .= ($jsFile ? '<script src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $jsFile . '" type="text/javascript"></script>' : '') . ($jsFile2 ? '<script src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $jsFile2 . '" type="text/javascript"></script>' : '') . ($jsFile3 ? '<script src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $jsFile3 . '" type="text/javascript"></script>' : '');
}
if ($this->enableOverlappingMarkerManager) {
$mapOptions['enableOverlappingMarkerManager'] = true;
}
$jsContent = array();
$jsContent[] = $this->js_createLabels($lang);
$jsContent[] = '';
$jsContent[] = $this->js_drawMapStart($mapOptions);
$jsContent[] = $this->js_newGDirections();
$jsContent[] = $this->js_setCenter($this->lat, $this->long, $this->zoom, $this->type);
if (is_array($this->controls)) {
$jsContent = array_merge($jsContent, $this->controls);
}
$jsContent[] = $this->js_icons();
if (is_array($this->groups)) {
foreach ($this->groups as $key => $group) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': adding ' . $group->getMarkerCount() . ' markers from group ' . $group->id, 'wec_map_api');
}
$jsContent = array_merge($jsContent, $group->drawMarkerJS());
$jsContent[] = '';
}
}
$jsContent[] = $this->js_initialOpenInfoWindow();
$jsContent[] = $this->js_addKMLOverlay();
$jsContent[] = $this->js_loadCalls();
$jsContent[] = $this->js_drawMapEnd();
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': finished map drawing', 'wec_map_api');
}
// get our content out of the array into a string
$jsContentString = implode(chr(10), $jsContent);
//.........这里部分代码省略.........
示例12: drawRTE
/**
* Draws the RTE as an iframe
*
* @param object Reference to parent object, which is an instance of the TCEforms.
* @param string The table name
* @param string The field name
* @param array The current row from which field is being rendered
* @param array Array of standard content for rendering form fields from TCEforms. See TCEforms for details on this. Includes for instance the value and the form field name, java script actions and more.
* @param array "special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
* @param array Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
* @param string Record "type" field value.
* @param string Relative path for images/links in RTE; this is used when the RTE edits content from static files where the path of such media has to be transformed forth and back!
* @param integer PID value of record (true parent page id)
* @return string HTML code for RTE!
* @todo Define visibility
*/
public function drawRTE(&$parentObject, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue)
{
global $TSFE, $TYPO3_CONF_VARS, $TYPO3_DB;
$this->TCEform = $parentObject;
$this->client = $this->clientInfo();
$this->typoVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
/* =======================================
* INIT THE EDITOR-SETTINGS
* =======================================
*/
// Get the path to this extension:
$this->extHttpPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->ID);
// Get the site URL
$this->siteURL = $GLOBALS['TSFE']->absRefPrefix ?: '';
// Get the host URL
$this->hostURL = '';
// Element ID + pid
$this->elementId = $PA['itemFormElName'];
$this->elementParts[0] = $table;
$this->elementParts[1] = $row['uid'];
$this->tscPID = $thePidValue;
$this->thePid = $thePidValue;
// Record "type" field value:
$this->typeVal = $RTEtypeVal;
// TCA "type" value for record
// RTE configuration
$pageTSConfig = $TSFE->getPagesTSconfig();
if (is_array($pageTSConfig) && is_array($pageTSConfig['RTE.'])) {
$this->RTEsetup = $pageTSConfig['RTE.'];
}
if (is_array($thisConfig) && !empty($thisConfig)) {
$this->thisConfig = $thisConfig;
} elseif (is_array($this->RTEsetup['default.']) && is_array($this->RTEsetup['default.']['FE.'])) {
$this->thisConfig = $this->RTEsetup['default.']['FE.'];
}
// Special configuration (line) and default extras:
$this->specConf = $specConf;
if ($this->thisConfig['forceHTTPS']) {
$this->extHttpPath = preg_replace('/^(http|https)/', 'https', $this->extHttpPath);
$this->siteURL = preg_replace('/^(http|https)/', 'https', $this->siteURL);
$this->hostURL = preg_replace('/^(http|https)/', 'https', $this->hostURL);
}
// Register RTE windows:
$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
$textAreaId = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $PA['itemFormElName']);
$textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId)) . '_' . strval($this->TCEform->RTEcounter);
/* =======================================
* LANGUAGES & CHARACTER SETS
* =======================================
*/
// Language
$TSFE->initLLvars();
$this->language = $TSFE->lang;
$this->LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:' . $this->ID . '/locallang.xml', $this->language);
if ($this->language == 'default' || !$this->language) {
$this->language = 'en';
}
$this->contentLanguageUid = max($row['sys_language_uid'], 0);
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
if ($this->contentLanguageUid) {
$tableA = 'sys_language';
$tableB = 'static_languages';
$languagesUidsList = $this->contentLanguageUid;
$selectFields = $tableA . '.uid,' . $tableB . '.lg_iso_2,' . $tableB . '.lg_country_iso_2,' . $tableB . '.lg_typo3';
$tableAB = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
$whereClause = $tableA . '.uid IN (' . $languagesUidsList . ') ';
$whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($tableA);
$whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableA);
$res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
while ($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
$this->contentISOLanguage = strtolower(trim($languageRow['lg_iso_2']) . (trim($languageRow['lg_country_iso_2']) ? '_' . trim($languageRow['lg_country_iso_2']) : ''));
$this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
}
} else {
$this->contentISOLanguage = $GLOBALS['TSFE']->sys_language_isocode ?: 'en';
$selectFields = 'lg_iso_2, lg_typo3';
$tableAB = 'static_languages';
$whereClause = 'lg_iso_2 = ' . $TYPO3_DB->fullQuoteStr(strtoupper($this->contentISOLanguage), $tableAB);
$res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
while ($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
$this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
}
}
}
//.........这里部分代码省略.........
示例13: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('gorillary') . 'locallang.xml';
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang);
return $LOCAL_LANG;
}
示例14: readLLfile
/**
* Includes a locallang file and returns the $LOCAL_LANG array found inside - works for frontend and backend.
* This method provides a TYPO3_MODE independent version of the seperate TYPO3 FE/BE methods getLLL().
*
* @param string reference to a relative filename to include (if exists): that file is expected to be a 'local_lang' file containing a $LOCAL_LANG array
* @return array $LOCAL_LANG array found in the included file if that array is found, otherwise an empty array
* @see tslib_fe::readLLfile() = TYPO3 FE method
* @see language::readLLfile() = TYPO3 BE method
* @author Rainer Kuhn
*/
public static function readLLfile($llFile)
{
$llArray = array();
// TYPO3 Frontend mode
if (TYPO3_MODE == 'FE' && is_object($GLOBALS['TSFE'])) {
$llArray = $GLOBALS['TSFE']->readLLfile($llFile);
// TYPO3 Backend mode
} elseif (is_object($GLOBALS['LANG'])) {
// $llArray = $GLOBALS['LANG']->readLLfile($llFile);
// as the function readLLfile is protected in the latest TYPO3 version we read the ll file directly
$llArray = GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang, $GLOBALS['LANG']->charSet);
} else {
throw new \PunktDe\PtExtbase\Exception\Exception('No valid TSFE or LANG object found!');
}
return $llArray;
}
示例15: buildJSLangArray
/**
* Return a Javascript localization array for the plugin
*
* @param string $plugin: identification string of the plugin
* @return string Javascript localization array
* @todo Define visibility
*/
public function buildJSLangArray($plugin)
{
$extensionKey = is_object($this->registeredPlugins[$plugin]) ? $this->registeredPlugins[$plugin]->getExtensionKey() : $this->ID;
$LOCAL_LANG = GeneralUtility::readLLfile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $plugin . '/locallang.xlf', $this->language, 'utf-8', 1);
$JSLanguageArray = 'HTMLArea.I18N["' . $plugin . '"] = new Object();' . LF;
if (is_array($LOCAL_LANG)) {
if (!empty($LOCAL_LANG[$this->language])) {
$defaultLocalLang = $LOCAL_LANG['default'];
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultLocalLang, $LOCAL_LANG[$this->language], TRUE, FALSE);
$LOCAL_LANG[$this->language] = $defaultLocalLang;
} else {
$LOCAL_LANG[$this->language] = $LOCAL_LANG['default'];
}
$JSLanguageArray .= 'HTMLArea.I18N["' . $plugin . '"] = ' . json_encode($LOCAL_LANG[$this->language]) . ';' . LF;
}
return $JSLanguageArray;
}