コード例 #1
0
 function pi_loadLL()
 {
     $filename = 'pi1/locallang.xml';
     //		d($filename);
     //		$filename = realpath($filename);
     //		d($filename);
     $default = 'default';
     $content = t3lib_div::readLLfile($filename, $default);
     $this->LL = $content[$default];
     foreach ($this->LL as &$assoc) {
         $assoc = $assoc[0]['target'];
     }
 }
 /**
  * Translate a given string in the current language
  *
  * @param string $string
  * @return string
  */
 static function locallizeString($locallangString)
 {
     // handler whole LLL String
     if (strpos($locallangString, 'LLL:') !== 0) {
         $result = $locallangString;
     } else {
         switch (TYPO3_MODE) {
             case 'FE':
                 // FE
                 if ($GLOBALS['TSFE']) {
                     $lcObj = t3lib_div::makeInstance('tslib_cObj');
                     $result = $lcObj->TEXT(array('data' => $locallangString));
                 } else {
                     $LANG = t3lib_div::makeInstance('language');
                     $LANG->init($language_key);
                     $result = $LANG->getLLL($locallang_key, t3lib_div::readLLfile(t3lib_div::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 = t3lib_div::makeInstance('language');
                 $LANG->init($language_key);
                 $result = $LANG->getLLL($locallang_key, t3lib_div::readLLfile(t3lib_div::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_LocallizationHelper::locallizeSubstring', $result);
     return $result;
 }
コード例 #3
0
 /**
  * Translate a given string in the current language
  *
  * @param string $string
  * @return 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 = t3lib_div::makeInstance('tslib_cObj');
             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 = t3lib_div::makeInstance('language');
             $LANG->init($language_key);
             return $LANG->getLLL($locallang_key, t3lib_div::readLLfile(t3lib_div::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet));
         default:
             return $locallang_string;
     }
 }
コード例 #4
0
 /**
  * Read locallang files - for frontend applications
  *
  * @param	string		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.
  */
 function readLLfile($fileRef)
 {
     return t3lib_div::readLLfile($fileRef, $this->lang, $this->renderCharset);
 }
コード例 #5
0
    /**
     * 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!
     */
    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 = t3lib_div::int_from_ver(TYPO3_version);
        /* =======================================
         * INIT THE EDITOR-SETTINGS
         * =======================================
         */
        // Get the path to this extension:
        $this->extHttpPath = t3lib_extMgm::siteRelPath($this->ID);
        // Get the site URL
        $this->siteURL = $GLOBALS['TSFE']->absRefPrefix ? $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;
        } else {
            if (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 = t3lib_div::readLLfile('EXT:' . $this->ID . '/locallang.xml', $this->language);
        if ($this->language == 'default' || !$this->language) {
            $this->language = 'en';
        }
        $this->contentLanguageUid = $row['sys_language_uid'] > 0 ? $row['sys_language_uid'] : 0;
        if (t3lib_extMgm::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 .= t3lib_BEfunc::BEenableFields($tableA);
                $whereClause .= t3lib_BEfunc::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 ? $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 ? $this->contentISOLanguage : ($GLOBALS['TSFE']->sys_language_isocode ? $GLOBALS['TSFE']->sys_language_isocode : 'en');
        $this->contentTypo3Language = $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->metaCharset : $TSFE->renderCharset;
        // Set the charset of the content
        $this->contentCharset = $TSFE->csConvObj->charSetArray[$this->contentTypo3Language];
        $this->contentCharset = $this->contentCharset ? $this->contentCharset : 'iso-8859-1';
        $this->contentCharset = trim($TSFE->config['config']['metaCharset']) ? trim($TSFE->config['config']['metaCharset']) : $this->contentCharset;
        /* =======================================
         * TOOLBAR CONFIGURATION
         * =======================================
         */
        $this->initializeToolbarConfiguration();
        /* =======================================
         * SET STYLES
         * =======================================
         */
        $width = 460 + ($this->TCEform->docLarge ? 150 : 0);
        if (isset($this->thisConfig['RTEWidthOverride'])) {
            if (strstr($this->thisConfig['RTEWidthOverride'], '%')) {
                if ($this->client['browser'] != 'msie') {
                    $width = intval($this->thisConfig['RTEWidthOverride']) > 0 ? $this->thisConfig['RTEWidthOverride'] : '100%';
                }
            } else {
                $width = intval($this->thisConfig['RTEWidthOverride']) > 0 ? intval($this->thisConfig['RTEWidthOverride']) : $width;
            }
        }
        $RTEWidth = strstr($width, '%') ? $width : $width . 'px';
        $editorWrapWidth = strstr($width, '%') ? $width : $width + 2 . 'px';
        $height = 380;
        $RTEHeightOverride = intval($this->thisConfig['RTEHeightOverride']);
        $height = $RTEHeightOverride > 0 ? $RTEHeightOverride : $height;
        $RTEHeight = $height . 'px';
        $editorWrapHeight = $height + 2 . 'px';
        $this->RTEWrapStyle = $this->RTEWrapStyle ? $this->RTEWrapStyle : ($this->RTEdivStyle ? $this->RTEdivStyle : 'height:' . $editorWrapHeight . '; width:' . $editorWrapWidth . ';');
        $this->RTEdivStyle = $this->RTEdivStyle ? $this->RTEdivStyle : 'position:relative; left:0px; top:0px; height:' . $RTEHeight . '; width:' . $RTEWidth . '; border: 1px solid black;';
        /* =======================================
         * LOAD JS, CSS and more
         * =======================================
         */
        $pageRenderer = $this->getPageRenderer();
        // Preloading the pageStyle and including RTE skin stylesheets
        $this->addPageStyle();
        $this->addSkin();
        // Re-initialize the scripts array so that only the cumulative set of plugins of the last RTE on the page is used
        $this->cumulativeScripts[$this->TCEform->RTEcounter] = array();
        $this->includeScriptFiles($this->TCEform->RTEcounter);
        $this->buildJSMainLangFile($this->TCEform->RTEcounter);
        // 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 (!$GLOBALS['TSFE']->isINTincScript() || !is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.'])) {
            $pageRenderer->loadExtJs();
            $pageRenderer->enableExtJSQuickTips();
            if (!$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['enableCompressedScripts']) {
                $pageRenderer->enableExtJsDebug();
            }
        }
        $pageRenderer->addCssFile($this->siteURL . 't3lib/js/extjs/ux/resize.css');
        $pageRenderer->addJsFile($this->siteURL . 't3lib/js/extjs/ux/ext.resizable.js');
        $pageRenderer->addJsFile($this->siteURL . '/t3lib/js/extjs/notifications.js');
        if ($this->TCEform->RTEcounter == 1) {
            $this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->wrapCDATA($this->loadJScode($this->TCEform->RTEcounter));
        }
        $this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter);
        if ($GLOBALS['TSFE']->isINTincScript()) {
            $GLOBALS['TSFE']->additionalHeaderData['rtehtmlarea'] = $pageRenderer->render();
        }
        /* =======================================
         * 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) . '">' . t3lib_div::formatForTextarea($value) . '</textarea>
			</div>' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? '<div id="HTMLAreaLog"></div>' : '') . '
			';
        return $item;
    }
コード例 #6
0
ファイル: lang.php プロジェクト: NaveedWebdeveloper/Test
 /**
  * Includes a locallang file and returns the $LOCAL_LANG array found inside.
  *
  * @param	string		Input is a file-reference (see t3lib_div::getFileAbsFileName) which, if exists, is included. That file is expected to be a 'local_lang' file containing a $LOCAL_LANG array.
  * @return	array		Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array
  * @access	private
  */
 protected function readLLfile($fileRef)
 {
     return t3lib_div::readLLfile($fileRef, $this->lang, $this->charSet);
 }
コード例 #7
0
 /**
  * used since TYPO3 4.6
  * Loads local-language values by looking for a "locallang.php" file in the plugin class directory ($langObj->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.xml" file.
  *
  * @param	object		tx_div2007_alpha_language_base or a tslib_pibase object
  * @param	string		language file to load
  * @param	boolean		If TRUE, then former language items can be overwritten from the new file
  * @return	boolean
  */
 public static function loadLL_fh002($langObj, $langFileParam = '', $overwrite = TRUE)
 {
     $result = FALSE;
     if (is_object($langObj)) {
         $typoVersion = tx_div2007_core::getTypoVersion();
         $langFile = $langFileParam ? $langFileParam : 'locallang.xml';
         if (substr($langFile, 0, 4) === 'EXT:' || substr($langFile, 0, 5) === 'typo3' || substr($langFile, 0, 9) === 'fileadmin') {
             $basePath = $langFile;
         } else {
             $basePath = t3lib_extMgm::extPath($langObj->extKey) . ($langObj->scriptRelPath ? dirname($langObj->scriptRelPath) . '/' : '') . $langFile;
         }
         // Read the strings in the required charset (since TYPO3 4.2)
         $tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $langObj->LLkey, $GLOBALS['TSFE']->renderCharset);
         if (count($langObj->LOCAL_LANG) && is_array($tempLOCAL_LANG)) {
             foreach ($langObj->LOCAL_LANG as $langKey => $tempArray) {
                 if (is_array($tempLOCAL_LANG[$langKey])) {
                     if ($overwrite) {
                         $langObj->LOCAL_LANG[$langKey] = array_merge($langObj->LOCAL_LANG[$langKey], $tempLOCAL_LANG[$langKey]);
                     } else {
                         $langObj->LOCAL_LANG[$langKey] = array_merge($tempLOCAL_LANG[$langKey], $langObj->LOCAL_LANG[$langKey]);
                     }
                 }
             }
         } else {
             $langObj->LOCAL_LANG = $tempLOCAL_LANG;
         }
         if ($langObj->altLLkey) {
             $tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $langObj->altLLkey, $GLOBALS['TSFE']->renderCharset);
             if (count($langObj->LOCAL_LANG) && is_array($tempLOCAL_LANG)) {
                 foreach ($langObj->LOCAL_LANG as $langKey => $tempArray) {
                     if (is_array($tempLOCAL_LANG[$langKey])) {
                         if ($overwrite) {
                             $langObj->LOCAL_LANG[$langKey] = array_merge($langObj->LOCAL_LANG[$langKey], $tempLOCAL_LANG[$langKey]);
                         } else {
                             $langObj->LOCAL_LANG[$langKey] = array_merge($tempLOCAL_LANG[$langKey], $langObj->LOCAL_LANG[$langKey]);
                         }
                     }
                 }
             } else {
                 $langObj->LOCAL_LANG = $tempLOCAL_LANG;
             }
         }
         // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!):
         $confLL = $langObj->conf['_LOCAL_LANG.'];
         if (is_array($confLL)) {
             foreach ($confLL as $languageKey => $languageArray) {
                 if (is_array($languageArray)) {
                     $languageKey = substr($languageKey, 0, -1);
                     $charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
                     // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset"
                     // and if that is not set, assumed to be that of the individual system languages
                     if (!$charset) {
                         $charset = $GLOBALS['TSFE']->csConvObj->charSetArray[$languageKey];
                     }
                     // Remove the dot after the language key
                     foreach ($languageArray as $labelKey => $labelValue) {
                         if (is_array($labelValue)) {
                             foreach ($labelValue as $labelKey2 => $labelValue2) {
                                 if (is_array($labelValue2)) {
                                     foreach ($labelValue2 as $labelKey3 => $labelValue3) {
                                         if (is_array($labelValue3)) {
                                             foreach ($labelValue3 as $labelKey4 => $labelValue4) {
                                                 if (is_array($labelValue4)) {
                                                 } else {
                                                     if ($typoVersion >= 4006000) {
                                                         $langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3 . $labelKey4][0]['target'] = $labelValue4;
                                                     } else {
                                                         $langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3 . $labelKey4] = $labelValue4;
                                                     }
                                                     if ($languageKey != 'default') {
                                                         $langObj->LOCAL_LANG_charset[$languageKey][$labelKey . $labelKey2 . $labelKey3 . $labelKey4] = $charset;
                                                         // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                                                     }
                                                 }
                                             }
                                         } else {
                                             if ($typoVersion >= 4006000) {
                                                 $langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3][0]['target'] = $labelValue3;
                                             } else {
                                                 $langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3] = $labelValue3;
                                             }
                                             if ($languageKey != 'default') {
                                                 $langObj->LOCAL_LANG_charset[$languageKey][$labelKey . $labelKey2 . $labelKey3] = $charset;
                                                 // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                                             }
                                         }
                                     }
                                 } else {
                                     if ($typoVersion >= 4006000) {
                                         $langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2][0]['target'] = $labelValue2;
                                     } else {
                                         $langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2] = $labelValue2;
                                     }
                                     if ($languageKey != 'default') {
                                         $langObj->LOCAL_LANG_charset[$languageKey][$labelKey . $labelKey2] = $charset;
                                         // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                                     }
                                 }
                             }
                         } else {
                             if ($typoVersion >= 4006000) {
                                 $langObj->LOCAL_LANG[$languageKey][$labelKey][0]['target'] = $labelValue;
                             } else {
                                 $langObj->LOCAL_LANG[$languageKey][$labelKey] = $labelValue;
                             }
                             if ($languageKey != 'default') {
                                 $langObj->LOCAL_LANG_charset[$languageKey][$labelKey] = $charset;
                                 // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                             }
                         }
                     }
                 }
             }
         }
         $langObj->LOCAL_LANG_loaded = 1;
         $result = TRUE;
     } else {
         $output = 'error in call of tx_div2007_alpha::loadLL_fh002: parameter $langObj is not an object';
         debug($output, '$output');
         // keep this
     }
     return $result;
 }
コード例 #8
0
 /**
  * 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('t3pimper') . 'locallang.xml';
     $LOCAL_LANG = t3lib_div::readLLfile($llFile, $GLOBALS['LANG']->lang);
     return $LOCAL_LANG;
 }
コード例 #9
0
 /**
  * Loads local-language values by looking for a "locallang.php" (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.php" file.
  *
  * @return void
  * @author Christopher Hlubek <*****@*****.**>
  * @author Bastian Waidelich <*****@*****.**>
  */
 protected static function initializeLocalization($extensionName)
 {
     if (isset(self::$LOCAL_LANG[$extensionName])) {
         return;
     }
     $locallangPathAndFilename = 'EXT:' . t3lib_div::camelCaseToLowerCaseUnderscored($extensionName) . '/' . self::$locallangPath . 'locallang.xml';
     self::setLanguageKeys();
     $renderCharset = TYPO3_MODE === 'FE' ? $GLOBALS['TSFE']->renderCharset : $GLOBALS['LANG']->charSet;
     self::$LOCAL_LANG[$extensionName] = t3lib_div::readLLfile($locallangPathAndFilename, self::$languageKey, $renderCharset);
     if (self::$alternativeLanguageKey !== '') {
         $alternativeLocalLang = t3lib_div::readLLfile($locallangPathAndFilename, self::$alternativeLanguageKey);
         self::$LOCAL_LANG[$extensionName] = array_merge(self::$LOCAL_LANG[$extensionName], $alternativeLocalLang);
     }
     self::loadTypoScriptLabels($extensionName);
 }
コード例 #10
0
 /**
  * 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 = t3lib_div::readLLfile($basePath, $this->LLkey, $GLOBALS['TSFE']->renderCharset);
         $alternativeLanguageKeys = t3lib_div::trimExplode(',', $this->altLLkey, TRUE);
         foreach ($alternativeLanguageKeys as $languageKey) {
             $tempLL = t3lib_div::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;
 }
コード例 #11
0
 /**
  * Return a Javascript localization array for the plugin
  *
  * @param	string		$plugin: identification string of the plugin
  *
  * @return	string		Javascript localization array
  */
 function buildJSLangArray($plugin)
 {
     $LOCAL_LANG = FALSE;
     $extensionKey = is_object($this->registeredPlugins[$plugin]) ? $this->registeredPlugins[$plugin]->getExtensionKey() : $this->ID;
     $LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language, 'utf-8', 1);
     $linebreak = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : LF;
     $JSLanguageArray = 'HTMLArea.I18N["' . $plugin . '"] = new Object();' . $linebreak;
     if (is_array($LOCAL_LANG)) {
         if (!empty($LOCAL_LANG[$this->language])) {
             $LOCAL_LANG[$this->language] = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG['default'], $LOCAL_LANG[$this->language]);
         } else {
             $LOCAL_LANG[$this->language] = $LOCAL_LANG['default'];
         }
         $JSLanguageArray .= 'HTMLArea.I18N["' . $plugin . '"] = ' . json_encode($LOCAL_LANG[$this->language]) . ';' . LF;
     }
     return $JSLanguageArray;
 }
コード例 #12
0
 /**
  * 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()) {
             $this->LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($this->LOCAL_LANG, t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language));
         } else {
             $LANG->includeLLFile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile);
         }
     }
     return true;
 }
コード例 #13
0
 /**
  * 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 = t3lib_div::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), Tx_Extbase_Utility_Localization::translate($key, 'extension_builder'));
         }
     }
 }
コード例 #14
0
 /**
  * Includes locallang files and returns raw $LOCAL_LANG array
  *
  * @param	string		Absolute reference to the php locallang file.
  * @return	array		LOCAL-LANG array from php file (with all possible sub-files for languages included)
  */
 function getLLarray($phpFile)
 {
     $LOCAL_LANG = t3lib_div::readLLfile($phpFile, $GLOBALS['LANG']->lang, $GLOBALS['LANG']->charSet);
     if (defined('TYPO3_languages')) {
         $languages = explode('|', TYPO3_languages);
         foreach ($languages as $langKey) {
             // Localized addition?
             $lFileRef = $this->localizedFileRef($phpFile, $langKey);
             if ($lFileRef && (string) $LOCAL_LANG[$langKey] == 'EXT') {
                 $llang = t3lib_div::readLLfile($lFileRef, $GLOBALS['LANG']->lang, $GLOBALS['LANG']->charSet);
                 $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG, $llang);
             }
         }
     }
     return $LOCAL_LANG;
 }
コード例 #15
0
 /**
  * Main function to get the FLV player working
  *
  * @param   string     $originalUrl: The uriginal url of the video
  * @param   array      $params: Possible configuration
  */
 function user_images($originalUrl, $conf)
 {
     $GLOBALS['TSFE']->additionalCSS['rgmediaimages'] = '.rgmi { text-align:center;}';
     require_once t3lib_extMgm::extPath('rgmediaimages') . '/class.tx_rgmediaimages_api.php';
     $this->media = t3lib_div::makeInstance('tx_rgmediaimages_api');
     // include the SWF Object File
     $this->media->initSwfObject();
     // set a unique ID
     $this->media->setUniqueID($this->cObj->data['uid']);
     // set no flash text
     $locallang = t3lib_div::readLLfile('EXT:rgmediaimages/locallang.xml', $GLOBALS['TSFE']->lang);
     $noFlashText = $locallang[$GLOBALS['TSFE']->lang]['noflash'] != '' ? $locallang[$GLOBALS['TSFE']->lang]['noflash'] : $locallang['default']['noflash'];
     $this->media->setNoFlashText($noFlashText);
     // url to the media file
     $url = htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $originalUrl);
     // configuration through the Content Element
     $pluginConf = $this->cObj->stdWrap($conf['override'], $conf['override.']);
     $pluginConf = explode(',', $pluginConf);
     $pluginConf2 = array();
     foreach ($pluginConf as $key => $value) {
         $value = str_replace('http://', '', trim($value));
         $split = explode(':', $value);
         $pluginConf2[$split[0]] = trim($split[1]);
     }
     // get width / height
     $widthBE = intval($this->cObj->data['imagewidth']);
     $conf['conf.']['width'] = $widthBE != 0 ? $widthBE : intval($conf['conf.']['width']);
     $heightBE = intval($this->cObj->data['imageheight']);
     $conf['conf.']['height'] = $heightBE != 0 ? $heightBE : intval($conf['conf.']['height']);
     // merge the configuration from the CE and from TS
     $c = array_merge($conf['conf.'], $pluginConf2);
     $config = $this->media->getConfiguration($c);
     // callback, needs the EXT:rgmediaimagescallback
     if (t3lib_extMgm::isLoaded('rgmediaimagescallback') && $c['callback'] == 1 && 1 == 2) {
         $urlParameter = '%26file=' . $originalUrl . '%26uid=' . $this->cObj->data['uid'] . '%26pid=' . $GLOBALS['TSFE']->id;
         $securityKey = md5($urlParameter . $GLOBALS["TYPO3_CONF_VARS"]["SYS"]["encryptionKey"]);
         $urlParameter .= '%26key=' . $securityKey;
         $config['trackback'] = 'title="' . htmlspecialchars($url) . '"&id=' . md5($originalUrl) . '&callback=' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?eID=callback' . $urlParameter;
     }
     // height / width for the player
     $height2 = explode('=', $config['height']);
     $width2 = explode('=', $config['width']);
     // check for mootools
     $this->media->checkForMootools($c['mootools']);
     /****************************************
      * FLV & mp3 files, played with the JW FLV Player
      ************************/
     if (substr($originalUrl, -4) != '.rgg') {
         // if mp3 and 1pixelout is activated, use it
         if (strtolower(substr($originalUrl, -4)) == '.mp3' && $conf['conf.']['use1PixelOut'] == 1) {
             $video = $this->media->getMp3($url, $conf['conf.']['useSwfObject'], $conf['confmp3.']);
             // include flash as plain
         } elseif (strtolower(substr($originalUrl, -4)) == '.swf') {
             $video = $this->media->getFlash($url, $width2[1], $height2[1], $conf['conf.']['useSwfObject']);
             // use FLV JW Player
         } else {
             // output as swfObject
             if ($c['useSwfObject'] == 1) {
                 $video = $this->media->getVideoSwfObj($url, $config, $width2[1], $height2[1]);
                 // output as embed
             } else {
                 $video = $this->media->getVideoEmbed($url, $configuration, $width2[1], $height2[1]);
             }
             /* // if the callback is enabled
                if (t3lib_extMgm::isLoaded('rgmediaimagescallback') && $c['callback']==1) {
                  $old = 'Uhrzeit gecached: '. strftime('%D - %H:%M:%S',time()) . '<br />';
              		$new= 'Uhrzeit ungecached: '. $this->callUserINT('getTime',$config) . '<br />';
              		$confDownloads['uid'] =  $this->cObj->data['uid'];
              		$confDownloads['uniquekey'] = $securityKey;
              		$confDownloads['title'] = $originalUrl;
              		$downloadRates = $this->callUserINT('downloadRates',$confDownloads);    
                }
                */
         }
     } else {
         // checks if a video is found
         $found = false;
         // get the file
         $filename = htmlspecialchars(trim($c['file']));
         $rtmp = htmlspecialchars(trim($c['rtmp']));
         // embed a rtmp stream
         if ($rtmp != '') {
             $found = true;
             $video = $this->media->getRtmpSwfObj($rtmp, $config, $width2[1], $height2[1]);
         }
         /****************************************
          * search for the supported hosters
          ************************/
         if (!$found) {
             $obj = $this->media->getVideos($filename, $width2[1], $height2[1], $c);
             if ($obj != '') {
                 $found = 1;
                 $video = $this->media->getVideoSwfObj($filename, $config, $width = '', $height = '', $obj);
             }
         }
         /****************************************
          * search for the supported files: wmv, mov, flv, mp3
          ************************/
         if (!$found) {
             // flv and m4v
             if (strtolower(substr($filename, -4) == '.flv') || strtolower(substr($filename, -4) == '.m4v')) {
                 $found = true;
                 $video = $this->media->getVideoSwfObj($filename, $config, $width2[1], $height2[1], '');
                 // swf (plain flash)
             } elseif (strtolower(substr($filename, -4)) == '.swf') {
                 $found = true;
                 $video = $this->media->getFlash($filename, $width2[1], $height2[1], $conf['conf.']['useSwfObject']);
                 // mov (quicktime)
             } elseif (strtolower(substr($filename, -4)) == '.wmv') {
                 $found = true;
                 $video = $this->media->getWmv($filename, $width2[1], $height2[1]);
                 // mov (quicktime)
             } elseif (strtolower(substr($filename, -4)) == '.mov') {
                 $found = true;
                 $video = $this->media->getMov($filename, $width2[1], $height2[1]);
                 // mp3
             } elseif (strtolower(substr($filename, -4)) == '.mp3') {
                 $found = true;
                 // use 1pixelout
                 if ($conf['conf.']['use1PixelOut'] == 1) {
                     $video = $this->media->getMp3($filename, $conf['conf.']['use1PixelOut'], $conf['confmp3.']);
                 } else {
                     $video = $this->media->getVideoSwfObj($filename, $config, $width2[1], $height2[1], '');
                 }
             }
         }
         /****************************************
          * Display iframes and content elements
          ************************/
         // if none of the hosters, check for other stuff
         if (!$found) {
             // content elements
             if (substr($filename, 0, 10) == 'tt_content') {
                 $filename = explode('tt_content', $filename);
                 $video = $this->media->getCE($filename[1], $width2[1], $height2[1]);
             }
             // iframes
             if (substr($filename, 0, 6) == 'iframe') {
                 $filename = explode('iframe', $filename);
                 $video = $this->media->getIframe($filename[1], $width2[1], $height2[1]);
             }
         }
     }
     // end else
     // Adds hook for processing of extra media files
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rgmediaimages']['extraMediaHook'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rgmediaimages']['extraMediaHook'] as $_classRef) {
             $_procObj =& t3lib_div::getUserObj($_classRef);
             $video = $_procObj->extraMediaProcessor($video, $config, $width, $height, $originalUrl, $this);
         }
     }
     return $video . $downloadRates;
 }
コード例 #16
0
 /**
  * Loads local-language values by looking for a "locallang.php" 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.php" file.
  *
  * @return	void
  */
 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 = t3lib_div::readLLfile($basePath, $this->LLkey, $GLOBALS['TSFE']->renderCharset);
         if ($this->altLLkey) {
             $tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $this->altLLkey);
             $this->LOCAL_LANG = array_merge(is_array($this->LOCAL_LANG) ? $this->LOCAL_LANG : array(), $tempLOCAL_LANG);
         }
         // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!):
         $confLL = $this->conf['_LOCAL_LANG.'];
         if (is_array($confLL)) {
             foreach ($confLL as $k => $lA) {
                 if (is_array($lA)) {
                     $k = substr($k, 0, -1);
                     foreach ($lA as $llK => $llV) {
                         if (!is_array($llV)) {
                             $this->LOCAL_LANG[$k][$llK] = $llV;
                             // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages
                             $this->LOCAL_LANG_charset[$k][$llK] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] : $GLOBALS['TSFE']->csConvObj->charSetArray[$k];
                         }
                     }
                 }
             }
         }
     }
     $this->LOCAL_LANG_loaded = 1;
 }
コード例 #17
0
ファイル: TranslatorRegistry.php プロジェクト: Konafets/oelib
 /**
  * Returns the localized labels from an extension's language file.
  *
  * @param string $extensionName
  *        the extension name to get the localized labels from file for,
  *        must not be empty, the corresponding extension must be loaded
  *
  * @return string[] the localized labels from an extension's language file, will be empty if there are none
  */
 private function getLocalizedLabelsFromFile($extensionName)
 {
     if ($extensionName === '') {
         throw new InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489618);
     }
     $languageFile = t3lib_extmgm::extPath($extensionName) . self::LANGUAGE_FILE_PATH;
     $localizedLabels = t3lib_div::readLLfile($languageFile, $this->languageKey, $this->renderCharset);
     if ($this->alternativeLanguageKey !== '') {
         $alternativeLocalizedLabels = t3lib_div::readLLfile($languageFile, $this->alternativeLanguageKey, $this->renderCharset);
         $localizedLabels = array_merge($alternativeLocalizedLabels, is_array($localizedLabels) ? $localizedLabels : array());
     }
     return $localizedLabels;
 }
コード例 #18
0
    /**
     * Tests the locallangXMLOverride feature of readLLfile()
     * @test
     */
    public function readLLfileLocallangXMLOverride()
    {
        $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';
        t3lib_div::writeFileToTypo3tempDir($file, $xml);
        // get default value
        $defaultLL = t3lib_div::readLLfile('EXT:lang/locallang_core.xml', 'default');
        // set override file
        $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:lang/locallang_core.xml'][$unique] = $file;
        // get override value
        $overrideLL = t3lib_div::readLLfile('EXT:lang/locallang_core.xml', 'default');
        $this->assertNotEquals($overrideLL['default']['buttons.logout'], '');
        $this->assertNotEquals($defaultLL['default']['buttons.logout'], $overrideLL['default']['buttons.logout']);
        $this->assertEquals($overrideLL['default']['buttons.logout'], 'EXIT');
        unlink($file);
    }
コード例 #19
0
 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 = t3lib_div::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);
     }
 }
コード例 #20
0
 /**
  * Loads local-language values by looking for a "locallang.php" 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.php" file.
  * Allows to add a language file name like this: 'EXT:tt_products/locallang_db.xml'
  *
  * @param	object		tx_div2007_alpha_language_base object
  * @param	string		relative path and filename of the language file
  * @param	boolean		overwrite ... if current settings should be overwritten
  *
  * @return	void
  */
 function loadLL_fh001(&$langObj, $langFileParam, $overwrite = TRUE)
 {
     global $TSFE;
     if (is_object($langObj)) {
         $langFile = $langFileParam ? $langFileParam : 'locallang.php';
         if (substr($langFile, 0, 4) === 'EXT:' || substr($langFile, 0, 5) === 'typo3' || substr($langFile, 0, 9) === 'fileadmin') {
             $basePath = $langFile;
         } else {
             $basePath = t3lib_extMgm::extPath($langObj->extKey) . ($langObj->scriptRelPath ? dirname($langObj->scriptRelPath) . '/' : '') . $langFile;
         }
         // php or xml as source: In any case the charset will be that of the system language.
         // However, this function guarantees only return output for default language plus the specified language (which is different from how 3.7.0 dealt with it)
         $tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $langObj->LLkey, $TSFE->renderCharset);
         if (count($langObj->LOCAL_LANG) && is_array($tempLOCAL_LANG)) {
             foreach ($langObj->LOCAL_LANG as $langKey => $tempArray) {
                 if (is_array($tempLOCAL_LANG[$langKey])) {
                     if ($overwrite) {
                         $langObj->LOCAL_LANG[$langKey] = array_merge($langObj->LOCAL_LANG[$langKey], $tempLOCAL_LANG[$langKey]);
                     } else {
                         $langObj->LOCAL_LANG[$langKey] = array_merge($tempLOCAL_LANG[$langKey], $langObj->LOCAL_LANG[$langKey]);
                     }
                 }
             }
         } else {
             $langObj->LOCAL_LANG = $tempLOCAL_LANG;
         }
         if ($langObj->altLLkey) {
             $tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $langObj->altLLkey, $TSFE->renderCharset);
             if (count($langObj->LOCAL_LANG) && is_array($tempLOCAL_LANG)) {
                 foreach ($langObj->LOCAL_LANG as $langKey => $tempArray) {
                     if (is_array($tempLOCAL_LANG[$langKey])) {
                         if ($overwrite) {
                             $langObj->LOCAL_LANG[$langKey] = array_merge($langObj->LOCAL_LANG[$langKey], $tempLOCAL_LANG[$langKey]);
                         } else {
                             $langObj->LOCAL_LANG[$langKey] = array_merge($tempLOCAL_LANG[$langKey], $langObj->LOCAL_LANG[$langKey]);
                         }
                     }
                 }
             } else {
                 $langObj->LOCAL_LANG = $tempLOCAL_LANG;
             }
         }
         // Overlaying labels from TypoScript (including fictious language keys for non-system languages!):
         if (is_array($langObj->conf['_LOCAL_LANG.'])) {
             foreach ($langObj->conf['_LOCAL_LANG.'] as $k => $lA) {
                 if (is_array($lA)) {
                     $k = substr($k, 0, -1);
                     foreach ($lA as $llK => $llV) {
                         if (is_array($llV)) {
                             foreach ($llV as $llk2 => $llV2) {
                                 if (is_array($llV2)) {
                                     foreach ($llV2 as $llk3 => $llV3) {
                                         if (is_array($llV3)) {
                                             foreach ($llV3 as $llk4 => $llV4) {
                                                 if (is_array($llV4)) {
                                                 } else {
                                                     $langObj->LOCAL_LANG[$k][$llK . $llk2 . $llk3 . $llk4] = $llV4;
                                                     if ($k != 'default') {
                                                         $langObj->LOCAL_LANG_charset[$k][$llK . $llk2 . $llk3 . $llk4] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
                                                         // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                                                     }
                                                 }
                                             }
                                         } else {
                                             $langObj->LOCAL_LANG[$k][$llK . $llk2 . $llk3] = $llV3;
                                             if ($k != 'default') {
                                                 $langObj->LOCAL_LANG_charset[$k][$llK . $llk2 . $llk3] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
                                                 // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                                             }
                                         }
                                     }
                                 } else {
                                     $langObj->LOCAL_LANG[$k][$llK . $llk2] = $llV2;
                                     if ($k != 'default') {
                                         $langObj->LOCAL_LANG_charset[$k][$llK . $llk2] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
                                         // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                                     }
                                 }
                             }
                         } else {
                             $langObj->LOCAL_LANG[$k][$llK] = $llV;
                             if ($k != 'default') {
                                 $langObj->LOCAL_LANG_charset[$k][$llK] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
                                 // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $output = 'error in call of tx_div2007_alpha::loadLL_fh001: parameter $langObj is not an object';
         debug($output, '$output');
         // keep this
     }
 }
コード例 #21
0
 /**
  * Resolves a label given through a full LLL path by loading the specified
  * local lang file and then returning the requested label.
  *
  * @param	string	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 = $file = t3lib_div::getFileAbsFileName(implode(':', $pathParts));
     if (!isset($this->localLang[$path])) {
         // do some nice caching
         $this->localLang[$path] = t3lib_div::readLLfile($path, $this->llKey, $GLOBALS['TSFE']->renderCharset);
     }
     return $this->getLabel($path, $labelKey);
 }
コード例 #22
0
 /**
  * Loads local-language values by looking for a "locallang.php" 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.php" file.
  *
  * @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 = t3lib_div::readLLfile($basePath, $this->LLkey, $GLOBALS['TSFE']->renderCharset);
         if ($this->altLLkey) {
             $this->LOCAL_LANG = t3lib_div::readLLfile($basePath, $this->altLLkey);
         }
         //compatibility to pre 4.6.x locallang handling
         if (!t3lib_div::compat_version('4.6.0')) {
             $tempLocalLang = $this->LOCAL_LANG;
             unset($this->LOCAL_LANG);
             foreach ($tempLocalLang as $langKey => $langArr) {
                 foreach ($langArr as $labelK => $labelV) {
                     $this->LOCAL_LANG[$langKey][$labelK][0]['target'] = $labelV;
                 }
             }
         }
         // 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;
                             // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset"
                             // and if that is not set, assumed to be that of the individual system languages
                             if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']) {
                                 $this->LOCAL_LANG_charset[$languageKey][$labelKey] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
                             } else {
                                 $this->LOCAL_LANG_charset[$languageKey][$labelKey] = $GLOBALS['TSFE']->csConvObj->charSetArray[$languageKey];
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->LOCAL_LANG_loaded = 1;
 }