/**
  * Generates the sprites for t3skin.
  *
  * @return	string		HTML content
  */
 public function createSpritesForT3Skin()
 {
     /** @var $generator t3lib_SpriteManager_SpriteGenerator */
     $generator = t3lib_div::makeInstance('t3lib_SpriteManager_SpriteGenerator', 't3skin');
     $this->unlinkT3SkinFiles();
     $data = $generator->setSpriteFolder(TYPO3_mainDir . 'sysext/t3skin/images/sprites/')->setCSSFolder(TYPO3_mainDir . 'sysext/t3skin/stylesheets/sprites/')->setOmmitSpriteNameInIconName(TRUE)->setIncludeTimestampInCSS(TRUE)->generateSpriteFromFolder(array(TYPO3_mainDir . 'sysext/t3skin/images/icons/'));
     $version = Tx_Extdeveval_Compatibility::convertVersionNumberToInteger(TYPO3_version);
     // IE6 fallback sprites have been removed with TYPO3 4.6
     if ($version < 4006000) {
         $gifSpritesPath = PATH_typo3 . 'sysext/t3skin/stylesheets/ie6/z_t3-icons-gifSprites.css';
         if (FALSE === rename($data['cssGif'], $gifSpritesPath)) {
             throw new tx_extdeveval_exception('The file "' . $data['cssGif'] . '" could not be renamed to "' . $gifSpritesPath . '"');
         }
     }
     $stddbPath = PATH_site . 't3lib/stddb/tables.php';
     $stddbContents = file_get_contents($stddbPath);
     $newContent = '$GLOBALS[\'TBE_STYLES\'][\'spriteIconApi\'][\'coreSpriteImageNames\'] = array(' . LF . TAB . '\'' . implode('\',' . LF . TAB . '\'', $data['iconNames']) . '\'' . LF . ');' . LF;
     $stddbContents = preg_replace('/\\$GLOBALS\\[\'TBE_STYLES\'\\]\\[\'spriteIconApi\'\\]\\[\'coreSpriteImageNames\'\\] = array\\([\\s\',\\w-]*\\);/', $newContent, $stddbContents);
     if (FALSE === t3lib_div::writeFile($stddbPath, $stddbContents)) {
         throw new tx_extdeveval_exception('Could not write file "' . $stddbPath . '"');
     }
     $output = 'Sprites successfully regenerated';
     return $output;
 }
 /**
  * Processing of the submitted form; Will create and write the XLIFF file and tell the new file name.
  *
  * @param string $xmlFile Absolute path to the locallang.xml file to convert
  * @param string $newFilename The new file name to write to (absolute path, .xlf ending)
  * @param string $langKey The language key
  * @return string HTML text string message
  */
 protected function renderSaveDone($xmlFile, $newFileName, $langKey)
 {
     // Initialize variables:
     $xml = array();
     $LOCAL_LANG = $this->getLLarray($xmlFile);
     $xml[] = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>';
     $xml[] = '<xliff version="1.0">';
     $xml[] = '	<file source-language="en"' . ($langKey !== 'default' ? ' target-language="' . $langKey . '"' : '') . ' datatype="plaintext" original="messages" date="' . gmdate('Y-m-d\\TH:i:s\\Z') . '"' . ' product-name="' . $this->extension . '">';
     $xml[] = '		<header/>';
     $xml[] = '		<body>';
     $version = Tx_Extdeveval_Compatibility::convertVersionNumberToInteger(TYPO3_version);
     foreach ($LOCAL_LANG[$langKey] as $key => $data) {
         $source = $version < 4006000 ? $LOCAL_LANG['default'][$key] : $data[0]['source'];
         $target = $version < 4006000 ? $data : $data[0]['target'];
         if ($langKey === 'default') {
             $xml[] = '			<trans-unit id="' . $key . '" xml:space="preserve">';
             $xml[] = '				<source>' . htmlspecialchars($source) . '</source>';
             $xml[] = '			</trans-unit>';
         } else {
             $xml[] = '			<trans-unit id="' . $key . '" xml:space="preserve" approved="yes">';
             $xml[] = '				<source>' . htmlspecialchars($source) . '</source>';
             $xml[] = '				<target>' . htmlspecialchars($target) . '</target>';
             $xml[] = '			</trans-unit>';
         }
     }
     $xml[] = '		</body>';
     $xml[] = '	</file>';
     $xml[] = '</xliff>';
     if (!file_exists($newFileName)) {
         # debug(array($XML));
         t3lib_div::writeFile($newFileName, implode(LF, $xml));
         return 'File written to disk: ' . $newFileName;
     }
 }
 /**
  * Determines whether a given TYPO3 version is used.
  *
  * @param string $version
  * @return boolean
  */
 protected function isAtLeastVersion($version)
 {
     return Tx_Extdeveval_Compatibility::convertVersionNumberToInteger(TYPO3_version) >= Tx_Extdeveval_Compatibility::convertVersionNumberToInteger($version);
 }