Follow-up to #15663: SpriteGenerator adds empty folder to spritebase, which results...
authorSteffen Kamper <info@sk-typo3.de>
Sun, 17 Oct 2010 09:39:09 +0000 (09:39 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sun, 17 Oct 2010 09:39:09 +0000 (09:39 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9118 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/spritemanager/class.t3lib_spritemanager_spritegenerator.php

index 6a58d84..37ccb76 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-10-17  Steffen Kamper  <steffen@typo3.org>
 
+       * Follow-up to #15663: SpriteGenerator adds empty folder to spritebase, which results in wrong css (Thanks to Steffen Ritter)
        * Fixed bug #16023: Deprecate unused / old files in typo3/ that belong to the old, removed backend
 
 2010-10-17  Ernesto Baschny  <ernst@cron-it.de>
index b7d44a7..4982170 100644 (file)
@@ -56,7 +56,7 @@ class t3lib_spritemanager_SpriteGenerator {
         */
        protected $templateIcon = '.###NAMESPACE###-###ICONNAME### {
        background-position: -###LEFT###px -###TOP###px;
-       ###SIZE_INFO###
+###SIZE_INFO###
 }
 ';
 
@@ -363,9 +363,12 @@ class t3lib_spritemanager_SpriteGenerator {
                }
 
                foreach ($this->iconsData as $key => $data) {
+                       $temp = $data['iconNameParts'];
+                       array_shift($temp);
+                       $cssName = implode('-' , $temp);
                        $markerArrayIcons = array(
                                '###NAMESPACE###'       => $this->nameSpace,
-                               '###ICONNAME###'        => $data['singleName'],
+                               '###ICONNAME###'        => $cssName,
                                '###LEFT###'            => $data['left'],
                                '###TOP###'             => $data['top'],
                                '###SIZE_INFO###'       => ''
@@ -564,11 +567,17 @@ class t3lib_spritemanager_SpriteGenerator {
         */
        protected function buildFileInformationCache(array $files) {
                foreach ($files as $iconName => $iconFile) {
-                       $fileInfo = pathinfo(PATH_site . $iconFile);
-                       $imageInfo = getimagesize(PATH_site . $iconFile);
+               
+                       $iconNameParts = t3lib_div::trimExplode('-', $iconName);
+                       if(!in_array($iconNameParts[0], $this->spriteBases)) {
+                               $this->spriteBases[] = $iconNameParts[0];
+                       }
+                       $fileInfo = @pathinfo(PATH_site . $iconFile);
+                       $imageInfo = @getimagesize(PATH_site . $iconFile);
 
                        $this->iconsData[$iconName] = array(
                                'iconName'              => $iconName,
+                               'iconNameParts' => $iconNameParts,
                                'singleName'    => $fileInfo['filename'],
                                'fileExtension' => $fileInfo['extension'],
                                'fileName'              => PATH_site . $iconFile,