/** * extended init * * @param string name of the file (can be a path, if you need this (no check)) * @param string path to the file * @return void */ public function init($file, $path) { // localization files shouldnt be edited if ($this->checkLocalizedFile(basename($file), TYPO3_languages)) { throw new LFException('failure.langfile.notSupported'); } $this->setVar(array('workspace' => 'base')); parent::init($file, $path); }
/** * returns requested information * * @param string * @return void */ public function getVar($info) { if ($info == 'metaFile') { return $this->metaFile; } elseif ($info == 'extName') { return $this->extName; } elseif ($info == 'extPath') { return $this->extPath; } elseif ($info == 'langFile') { return $this->langFile; } else { return parent::getVar($info); } }
/** * extends writing of language files for xll * * @throws LFException raised if parent method fails or the xll file cant be created * @return boolean always true */ public function writeFile() { // create xll directory try { sgLib::createDir($this->absPath, PATH_site); } catch (Exception $e) { throw new LFException('failure.failure', 0, '(' . $e->getMessage() . ')'); } // write xll file try { parent::writeFile(); } catch (LFException $e) { throw $e; } // set only new values in localconf if something changed $relXLLFile = sgLib::trimPath(PATH_site, $this->absFile); if ($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$this->typo3RelFile] == $relXLLFile) { return true; } try { $fileRef = substr($this->typo3RelFile, 0, strrpos($this->typo3RelFile, '.')); $addLine = '$TYPO3_CONF_VARS[\'BE\'][\'XLLfile\'][\'' . $fileRef . '.xml\']'; typo3Lib::writeLocalconf($addLine, $relXLLFile); $GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef . '.xml'] = $relXLLFile; // create alternative $addLine = '$TYPO3_CONF_VARS[\'BE\'][\'XLLfile\'][\'' . $fileRef . '.php\']'; typo3Lib::writeLocalconf($addLine, $relXLLFile); $GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef . '.php'] = $relXLLFile; } catch (Exception $e) { throw new LFException('failure.failure', 0, '(' . $e->getMessage() . ')'); } return true; }