Index: mod1/class.tx_extdeveval_sprites.php =================================================================== --- mod1/class.tx_extdeveval_sprites.php (Revision 0) +++ mod1/class.tx_extdeveval_sprites.php (Revision 0) @@ -0,0 +1,84 @@ + +* All rights reserved +* +* This script is part of the TYPO3 project. The TYPO3 project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ +/** + * generates sprites for t3skin and extensions + * + * + * @author Steffen Ritter + */ + +/** + * gerating sprites of records + * + * @package TYPO3 + * @subpackage tx_extdeveval + */ +class tx_extdeveval_sprites { + + /** + * The main function in the class + * + * @return string HTML content + */ + function t3skinSprite() { + if (t3lib_div::_POST('generate') == 'GENERATE') { + $output = ''; + $generator = t3lib_div::makeInstance("t3lib_SpriteManager_SpriteGenerator", 't3skin'); + $error = FALSE; + $error = $error || ! unlink(PATH_typo3 . 'sysext/t3skin/stylesheets/ie6/z_t3-icons-gifSprites.css'); + $error = $error || ! unlink(PATH_typo3 . 'sysext/t3skin/stylesheets/sprites/t3skin.css'); + $error = $error || ! unlink(PATH_typo3 . 'sysext/t3skin/images/sprites/t3skin.png'); + $error = $error || ! unlink(PATH_typo3 . 'sysext/t3skin/images/sprites/t3skin.gif'); + $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/')); + + $error = $error || ! rename($data['cssGif'], PATH_typo3 . 'sysext/t3skin/stylesheets/ie6/z_t3-icons-gifSprites.css'); + $stddbContents = file_get_contents(PATH_site . 't3lib/stddb/tables.php'); + $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); + + $error = $error || ! t3lib_div::writeFile(PATH_site . 't3lib/stddb/tables.php', $stddbContents); + if ($error) { + $output .= 'An error occured'; + } else { + $output .= 'Sprites successfully regenerated'; + } + } else { + $output = '
'; + } + + return $output; + } +} + + +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/extdeveval/mod1/class.tx_extdeveval_sprites.php']) { + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/extdeveval/mod1/class.tx_extdeveval_sprites.php']); +} +?> \ No newline at end of file Index: mod1/index.php =================================================================== --- mod1/index.php (Revision 37161) +++ mod1/index.php (Arbeitskopie) @@ -105,6 +105,7 @@ '12' => 'Table Icon Listing ', '15' => 'Dump template tables', '17' => 'Raw DB Edit', + '18' => 'Generate Sprites for T3Skin', '16' => 'phpinfo()', ), 'extScope' => array( @@ -521,7 +522,16 @@ $content = $inst->main(); $this->content.=$this->doc->section('',$content,0,1); break; - default: + case 18: + $content = 'regenerate the sprites for t3skin (core). WARNING: Core files will be modified.
'; + $this->content.=$this->doc->section('Edit',$content,0,1); + + require_once('./class.tx_extdeveval_sprites.php'); + $inst = t3lib_div::makeInstance('tx_extdeveval_sprites'); + $content = $inst->t3skinSprite(); + $this->content.=$this->doc->section('',$content,0,1); + break; + default: $this->content.= $this->extObjContent(); break; }