/** * 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); }
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; }
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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); } }
/** * 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); // then return it return $htmlContent . \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($jsContentString); } else { if (!$hasThingsToDisplay) { $error = '<p>' . $this->getLL($lang, 'error_nothingToDisplay') . '</p>'; } else { if (!$hasHeightWidth) { $error = '<p>' . $this->getLL($lang, 'error_noHeightWidth') . '</p>'; } } } if (TYPO3_DLOG) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->mapName . ': finished map drawing with errors', 'wec_map_api', 2); } return $error; }
/** * 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'])); } } } $this->contentISOLanguage = $this->contentISOLanguage ?: ($GLOBALS['TSFE']->sys_language_isocode ?: 'en'); $this->contentTypo3Language = $this->contentTypo3Language ?: $GLOBALS['TSFE']->lang; if ($this->contentTypo3Language == 'default') { $this->contentTypo3Language = 'en'; } // Character set $this->charset = $TSFE->renderCharset; $this->OutputCharset = $TSFE->metaCharset ?: $TSFE->renderCharset; // Set the charset of the content $this->contentCharset = $TSFE->csConvObj->charSetArray[$this->contentTypo3Language]; $this->contentCharset = $this->contentCharset ?: 'utf-8'; $this->contentCharset = trim($TSFE->config['config']['metaCharset']) ?: $this->contentCharset; /* ======================================= * TOOLBAR CONFIGURATION * ======================================= */ $this->initializeToolbarConfiguration(); /* ======================================= * SET STYLES * ======================================= */ $width = 610; if (isset($this->thisConfig['RTEWidthOverride'])) { if (strstr($this->thisConfig['RTEWidthOverride'], '%')) { if ($this->client['browser'] != 'msie') { $width = (int) $this->thisConfig['RTEWidthOverride'] > 0 ? $this->thisConfig['RTEWidthOverride'] : '100%'; } } else { $width = (int) $this->thisConfig['RTEWidthOverride'] > 0 ? (int) $this->thisConfig['RTEWidthOverride'] : $width; } } $RTEWidth = strstr($width, '%') ? $width : $width . 'px'; $editorWrapWidth = strstr($width, '%') ? $width : $width + 2 . 'px'; $height = 380; $RTEHeightOverride = (int) $this->thisConfig['RTEHeightOverride']; $height = $RTEHeightOverride > 0 ? $RTEHeightOverride : $height; $RTEHeight = $height . 'px'; $editorWrapHeight = $height + 2 . 'px'; $this->RTEWrapStyle = $this->RTEWrapStyle ?: ($this->RTEdivStyle ?: 'height:' . $editorWrapHeight . '; width:' . $editorWrapWidth . ';'); $this->RTEdivStyle = $this->RTEdivStyle ?: 'position:relative; left:0px; top:0px; height:' . $RTEHeight . '; width:' . $RTEWidth . '; border: 1px solid black;'; /* ======================================= * LOAD JS, CSS and more * ======================================= */ $this->getPageRenderer(); // Register RTE in JS $this->TCEform->additionalJS_post[] = $this->wrapCDATA($this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '', $textAreaId)); // Set the save option for the RTE: $this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId); // Loading ExtJs JavaScript files and inline code, if not configured in TS setup if (!is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.'])) { $this->pageRenderer->loadExtJs(); $this->pageRenderer->enableExtJSQuickTips(); } $this->pageRenderer->addJsFile($this->getFullFileName('typo3/js/extjs/ux/ext.resizable.js')); $this->pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/notifications.js'); // Preloading the pageStyle and including RTE skin stylesheets $this->addPageStyle(); $this->pageRenderer->addCssFile($this->siteURL . 'typo3/contrib/extjs/resources/css/ext-all-notheme.css'); $this->pageRenderer->addCssFile($this->siteURL . 'typo3/sysext/t3skin/extjs/xtheme-t3skin.css'); $this->addSkin(); $this->pageRenderer->addCssFile($this->siteURL . 'typo3/js/extjs/ux/resize.css'); // Add RTE JavaScript $this->addRteJsFiles($this->TCEform->RTEcounter); $this->pageRenderer->addJsFile($this->buildJSMainLangFile($this->TCEform->RTEcounter)); $this->pageRenderer->addJsInlineCode('HTMLArea-init', $this->getRteInitJsCode(), TRUE); /* ======================================= * DRAW THE EDITOR * ======================================= */ // Transform value: $value = $this->transformContent('rte', $PA['itemFormElValue'], $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $thePidValue); // Further content transformation by registered plugins foreach ($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId) && method_exists($plugin, 'transformContent')) { $value = $plugin->transformContent($value); } } // draw the textarea $item = $this->triggerField($PA['itemFormElName']) . ' <div id="pleasewait' . $textAreaId . '" class="pleasewait" style="display: block;" >' . $TSFE->csConvObj->conv($TSFE->getLLL('Please wait', $this->LOCAL_LANG), $this->charset, $TSFE->renderCharset) . '</div> <div id="editorWrap' . $textAreaId . '" class="editorWrap" style="visibility: hidden; ' . htmlspecialchars($this->RTEWrapStyle) . '"> <textarea id="RTEarea' . $textAreaId . '" name="' . htmlspecialchars($PA['itemFormElName']) . '" rows="0" cols="0" style="' . htmlspecialchars($this->RTEdivStyle) . '">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($value) . '</textarea> </div>' . LF; return $item; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * @test */ public function canOverrideLlxml() { $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->llxmlFileNames['locallang']][] = $this->llxmlFileNames['locallang_override']; $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->llxmlFileNames['locallang'], 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->llxmlFileNames['locallang'], 'fr')); $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG'); $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG'); $expectedLabels = array('default' => array('label1' => 'This is my 1st label', 'label2' => 'This is my 2nd label', 'label3' => 'This is label #3'), 'fr' => array('label1' => 'Ceci est mon 1er libellé', 'label2' => 'Ceci est le libellé no. 2', 'label3' => 'Ceci est mon 3e libellé')); foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) { foreach ($expectedLanguageLabels as $key => $expectedLabel) { $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']); } } }
/** * Get all labels from a specific label file, merge default * labels and target language labels. * * @param $fileName * @return array Label keys and values */ protected function getMergedLabelsFromFile($fileName) { $localizationArray = GeneralUtility::readLLfile($fileName, $this->language, 'utf-8', 1); if (is_array($localizationArray) && !empty($localizationArray)) { if (!empty($localizationArray[$this->language])) { $finalLocalLang = $localizationArray['default']; ArrayUtility::mergeRecursiveWithOverrule($finalLocalLang, $localizationArray[$this->language], TRUE, FALSE); $localizationArray[$this->language] = $finalLocalLang; } else { $localizationArray[$this->language] = $localizationArray['default']; } } else { $localizationArray = array(); } return $localizationArray[$this->language]; }
/** * Translate a given string in the current language * * @param string $locallangString * @return string */ static function localizeString($locallangString) { // handler whole LLL String if (strpos($locallangString, 'LLL:') !== 0) { $result = $locallangString; } else { switch (TYPO3_MODE) { case 'FE': $locallangParts = explode(':', $locallangString); array_shift($locallangParts); $locallang_key = array_pop($locallangParts); $locallang_file = implode(':', $locallangParts); $language_key = $GLOBALS['BE_USER']->uc['lang']; // FE if ($GLOBALS['TSFE']) { $lcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $result = $lcObj->TEXT(array('data' => $locallangString)); } else { /** @var \TYPO3\CMS\Lang\LanguageService $LANG */ $LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService'); $LANG->init($language_key); $result = $LANG->getLLL($locallang_key, \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet)); } break; case 'BE': $locallangParts = explode(':', $locallangString); array_shift($locallangParts); $locallang_key = array_pop($locallangParts); $locallang_file = implode(':', $locallangParts); $language_key = $GLOBALS['BE_USER']->uc['lang']; $LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('language'); $LANG->init($language_key); $result = $LANG->getLLL($locallang_key, \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet)); break; default: $result = $locallangString; break; } } /// recursive call for {LLL:} parts $result = preg_replace_callback('/{(LLL:EXT:[^ ]+?:[^ ]+?)}/', 'tx_caretaker_LocalizationHelper::localizeSubstring', $result); return $result; }
/** * @param $filePath * @param $fileId * @return array */ private function getSystemLabelsXliff($filePath, $fileId) { $labels = array(); // Get LanguageFile $languageFile = GeneralUtility::readLLfile($filePath, 'default'); // Language File Available? if ($languageFile) { // Set System Labels $labelData = $languageFile['default']; if (is_array($labelData)) { foreach ($labelData as $labelName => $labelDefault) { $labels[] = array('FileId' => $fileId, 'LabelName' => $labelName, 'LabelDefault' => $labelDefault[0]['source']); } } } return $labels; }
/** * Read locallang files - for frontend applications * * @param string $fileRef Reference to a relative filename to include. * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array. * @todo Define visibility */ public function readLLfile($fileRef) { return \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($fileRef, $this->lang, $this->renderCharset); }
/** * 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 * * @return void */ public function pi_loadLL() { if (!$this->LOCAL_LANG_loaded && $this->scriptRelPath) { $basePath = 'EXT:' . $this->extKey . '/' . dirname($this->scriptRelPath) . '/locallang.xlf'; // Read the strings in the required charset (since TYPO3 4.2) $this->LOCAL_LANG = GeneralUtility::readLLfile($basePath, $this->LLkey, $this->frontendController->renderCharset); $alternativeLanguageKeys = GeneralUtility::trimExplode(',', $this->altLLkey, TRUE); foreach ($alternativeLanguageKeys as $languageKey) { $tempLL = GeneralUtility::readLLfile($basePath, $languageKey); if ($this->LLkey !== 'default' && isset($tempLL[$languageKey])) { $this->LOCAL_LANG[$languageKey] = $tempLL[$languageKey]; } } // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!): if (isset($this->conf['_LOCAL_LANG.'])) { // Clear the "unset memory" $this->LOCAL_LANG_UNSET = array(); foreach ($this->conf['_LOCAL_LANG.'] as $languageKey => $languageArray) { // Remove the dot after the language key $languageKey = substr($languageKey, 0, -1); // Don't process label if the language is not loaded if (is_array($languageArray) && isset($this->LOCAL_LANG[$languageKey])) { foreach ($languageArray as $labelKey => $labelValue) { if (!is_array($labelValue)) { $this->LOCAL_LANG[$languageKey][$labelKey][0]['target'] = $labelValue; if ($labelValue === '') { $this->LOCAL_LANG_UNSET[$languageKey][$labelKey] = ''; } $this->LOCAL_LANG_charset[$languageKey][$labelKey] = 'utf-8'; } } } } } } $this->LOCAL_LANG_loaded = 1; }
/** * Translate a given string in the current language * * @param $locallang_string * @return string * @internal param string $string */ protected function locallizeString($locallang_string) { $locallang_parts = explode(':', $locallang_string); if (array_shift($locallang_parts) != 'LLL') { return $locallang_string; } switch (TYPO3_MODE) { case 'FE': $lcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); return $lcObj->TEXT(array('data' => $locallang_string)); case 'BE': $locallang_key = array_pop($locallang_parts); $locallang_file = implode(':', $locallang_parts); $language_key = $GLOBALS['BE_USER']->uc['lang']; $LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService'); $LANG->init($language_key); return $LANG->getLLL($locallang_key, \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet)); default: return $locallang_string; } }
/** * Resolves a label given through a full LLL path by loading the specified * local lang file and then returning the requested label. * * @param string $path full path specifying a label, LLL:EXT:path/to/locallang.xml:my_label * @return string the requested label */ protected function resolveFullPathLabel($path) { $pathParts = explode(':', $path); $labelKey = array_pop($pathParts); $path = GeneralUtility::getFileAbsFileName(implode(':', $pathParts)); if (!isset($this->localLang[$path])) { // do some nice caching $this->localLang[$path] = GeneralUtility::readLLfile($path, $this->llKey, $GLOBALS['TSFE']->renderCharset); } return $this->getLabel($path, $labelKey); }
/** * @test * @dataProvider numericKeysDataProvider */ public function canTranslateNumericKeys($key, $expectedResult) { $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallangNumericKeys.xml'), 'fr'); $this->assertEquals($expectedResult, $LOCAL_LANG['fr'][$key][0]['target']); }
/** * Read locallang files - for frontend applications * * @param string $fileRef Reference to a relative filename to include. * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array. * @todo Define visibility */ public function readLLfile($fileRef) { if ($this->lang !== 'default') { $languages = array_reverse($this->languageDependencies); // At least we need to have English if (empty($languages)) { $languages[] = 'default'; } } else { $languages = array('default'); } $localLanguage = array(); foreach ($languages as $language) { $tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->renderCharset); $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 label with fall back applied \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($localLanguage[$this->lang], $tempLL[$language], TRUE, FALSE); } } return $localLanguage; }
/** * This method loads the locallang.xml file (default language), and * adds all keys found in it to the TYPO3.settings.extension_builder._LOCAL_LANG object * translated into the current language * * Dots in a key are replaced by a _ * * Example: * error.name becomes TYPO3.settings.extension_builder._LOCAL_LANG.error_name * * @return void */ private function setLocallangSettings() { $LL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:extension_builder/Resources/Private/Language/locallang.xml', 'default'); if (!empty($LL['default']) && is_array($LL['default'])) { foreach ($LL['default'] as $key => $value) { $this->pageRenderer->addInlineSetting('extensionBuilder._LOCAL_LANG', str_replace('.', '_', $key), \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, 'extension_builder')); } } }
/** * This test will make sure method t3lib_div::llXmlAutoFileName() will not prefix twice the * language key to the localization file. * * @test */ public function canOverrideXliffWithFrenchOnly() { $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr']; $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr'); $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG'); $expectedLabels = array('label1' => 'Ceci est mon 1er libellé', 'label2' => 'Ceci est le libellé no. 2', 'label3' => 'Ceci est mon 3e libellé'); foreach ($expectedLabels as $key => $expectedLabel) { $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']); } }
/** * Loads local-language values by looking for a "locallang.xlf" (or "locallang.xml") file in the plugin resources directory and if found includes it. * Also locallang values set in the TypoScript property "_LOCAL_LANG" are merged onto the values found in the "locallang.xlf" file. * * @param string $extensionName * @return void */ protected static function initializeLocalization($extensionName) { if (isset(self::$LOCAL_LANG[$extensionName])) { return; } $locallangPathAndFilename = 'EXT:' . \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName) . '/' . self::$locallangPath . 'locallang.xlf'; self::setLanguageKeys(); $renderCharset = TYPO3_MODE === 'FE' ? $GLOBALS['TSFE']->renderCharset : $GLOBALS['LANG']->charSet; self::$LOCAL_LANG[$extensionName] = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($locallangPathAndFilename, self::$languageKey, $renderCharset); foreach (self::$alternativeLanguageKeys as $language) { $tempLL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($locallangPathAndFilename, $language, $renderCharset); if (self::$languageKey !== 'default' && isset($tempLL[$language])) { self::$LOCAL_LANG[$extensionName][$language] = $tempLL[$language]; } } self::loadTypoScriptLabels($extensionName); }
/** * @test */ public function readLLfileHandlesLocallangXMLOverride() { $unique = uniqid('locallangXMLOverrideTest'); $xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3locallang> <data type="array"> <languageKey index="default" type="array"> <label index="buttons.logout">EXIT</label> </languageKey> </data> </T3locallang>'; $file = PATH_site . 'typo3temp/' . $unique . '.xml'; Utility\GeneralUtility::writeFileToTypo3tempDir($file, $xml); // Make sure there is no cached version of the label $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush(); // Get default value $defaultLL = Utility\GeneralUtility::readLLfile('EXT:lang/locallang_core.xml', 'default'); // Clear language cache again $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush(); // Set override file $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:lang/locallang_core.xml'][$unique] = $file; /** @var $store \TYPO3\CMS\Core\Localization\LanguageStore */ $store = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore'); $store->flushData('EXT:lang/locallang_core.xml'); // Get override value $overrideLL = Utility\GeneralUtility::readLLfile('EXT:lang/locallang_core.xml', 'default'); // Clean up again unlink($file); $this->assertNotEquals($overrideLL['default']['buttons.logout'][0]['target'], ''); $this->assertNotEquals($defaultLL['default']['buttons.logout'][0]['target'], $overrideLL['default']['buttons.logout'][0]['target']); $this->assertEquals($overrideLL['default']['buttons.logout'][0]['target'], 'EXIT'); }
/** * Overwrites pi_loadLL() to handle custom location of language files. * * 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) { list($languageFileName) = explode('/', $this->scriptRelPath); $languageFileName = str_replace('Pi', 'Plugin', $languageFileName); $basePath = 'EXT:' . $this->extKey . '/Resources/Private/Language/' . $languageFileName . '.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); $alternativeLanguageKeys = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->altLLkey, TRUE); foreach ($alternativeLanguageKeys as $languageKey) { $tempLL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($basePath, $languageKey); if ($this->LLkey !== 'default' && isset($tempLL[$languageKey])) { $this->LOCAL_LANG[$languageKey] = $tempLL[$languageKey]; } } // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!): if (isset($this->conf['_LOCAL_LANG.'])) { // Clear the "unset memory" $this->LOCAL_LANG_UNSET = array(); foreach ($this->conf['_LOCAL_LANG.'] as $languageKey => $languageArray) { // Remove the dot after the language key $languageKey = substr($languageKey, 0, -1); // Don't process label if the language is not loaded if (is_array($languageArray) && isset($this->LOCAL_LANG[$languageKey])) { foreach ($languageArray as $labelKey => $labelValue) { if (!is_array($labelValue)) { $this->LOCAL_LANG[$languageKey][$labelKey][0]['target'] = $labelValue; if ($labelValue === '') { $this->LOCAL_LANG_UNSET[$languageKey][$labelKey] = ''; } $this->LOCAL_LANG_charset[$languageKey][$labelKey] = 'utf-8'; } } } } } } $this->LOCAL_LANG_loaded = 1; }