[TASK] Cleanup phpDoc to match CGL
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Imaging / GifBuilder.php
index 447f661..3b2ca6c 100644 (file)
@@ -1,49 +1,35 @@
 <?php
 namespace TYPO3\CMS\Frontend\Imaging;
 
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
- *  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.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
+/**
+ * This file is part of the TYPO3 CMS project.
  *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
  *
- *  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.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
  *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
+ * GIFBUILDER
+ *
  * Generating gif/png-files from TypoScript
  * Used by the menu-objects and imgResource in TypoScript.
  *
- * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * GIFBUILDER extension class.
  * This class allows for advanced rendering of images with various layers of images, text and graphical primitives.
  * The concept is known from TypoScript as "GIFBUILDER" where you can define a "numerical array" (TypoScript term as well) of "GIFBUILDER OBJECTS" (like "TEXT", "IMAGE", etc.) and they will be rendered onto an image one by one.
  * The name "GIFBUILDER" comes from the time where GIF was the only file format supported. PNG is just as well to create today (configured with TYPO3_CONF_VARS[GFX])
- * Not all instances of this class is truely building gif/png files by layers; You may also see the class instantiated for the purpose of using the scaling functions in the parent class, t3lib_stdGraphic.
+ * Not all instances of this class is truely building gif/png files by layers; You may also see the class instantiated for the purpose of using the scaling functions in the parent class.
  *
  * Here is an example of how to use this class (from tslib_content.php, function getImgResource):
  *
- * $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
+ * $gifCreator = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
  * $gifCreator->init();
  * $theImage='';
  * if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
@@ -59,69 +45,69 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
        // Internal
        // the main image
        /**
-        * @todo Define visibility
+        * @var string
         */
        public $im = '';
 
        // the image-width
        /**
-        * @todo Define visibility
+        * @var int
         */
        public $w = 0;
 
        // the image-height
        /**
-        * @todo Define visibility
+        * @var int
         */
        public $h = 0;
 
        // map-data
        /**
-        * @todo Define visibility
+        * @var string
         */
        public $map;
 
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $workArea;
 
        // This holds the operational setup for gifbuilder. Basically this is a TypoScript array with properties.
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $setup = array();
 
        // Contains all text strings used on this image
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $combinedTextStrings = array();
 
        // Contains all filenames (basename without extension) used on this image
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $combinedFileNames = array();
 
        // This is the array from which data->field: [key] is fetched. So this is the current record!
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $data = array();
 
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $objBB = array();
 
        /**
-        * @todo Define visibility
+        * @var string
         */
        public $myClassName = 'gifbuilder';
 
        /**
-        * @todo Define visibility
+        * @var array
         */
        public $charRangeMap = array();
 
@@ -129,19 +115,18 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * Initialization of the GIFBUILDER objects, in particular TEXT and IMAGE. This includes finding the bounding box, setting dimensions and offset values before the actual rendering is started.
         * Modifies the ->setup, ->objBB internal arrays
         * Should be called after the ->init() function which initializes the parent class functions/variables in general.
-        * The class tslib_gmenu also uses gifbuilder and here there is an interesting use since the function findLargestDims() from that class calls the init() and start() functions to find the total dimensions before starting the rendering of the images.
+        * The class \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject also uses gifbuilder and here there is an interesting use since the function findLargestDims() from that class calls the init() and start() functions to find the total dimensions before starting the rendering of the images.
         *
         * @param array $conf TypoScript properties for the GIFBUILDER session. Stored internally in the variable ->setup
-        * @param array $data The current data record from tslib_cObj. Stored internally in the variable ->data
+        * @param array $data The current data record from \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer. Stored internally in the variable ->data
         * @return void
-        * @see tslib_cObj::getImgResource(), tslib_gmenu::makeGifs(), tslib_gmenu::findLargestDims()
-        * @todo Define visibility
+        * @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getImgResource(), \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject::makeGifs(), \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject::findLargestDims()
         */
        public function start($conf, $data) {
                if (is_array($conf)) {
                        $this->setup = $conf;
                        $this->data = $data;
-                       $this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
+                       $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                        $this->cObj->start($this->data);
                        // Hook preprocess gifbuilder conf
                        // Added by Julle for 3.8.0
@@ -152,7 +137,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_gifbuilder.php']['gifbuilder-ConfPreProcess'])) {
                                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_gifbuilder.php']['gifbuilder-ConfPreProcess'] as $_funcRef) {
                                        $_params = $this->setup;
-                                       $this->setup = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
+                                       $this->setup = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
                                }
                        }
                        // Initializing global Char Range Map
@@ -166,7 +151,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                                                $this->charRangeMap[$cRMkey]['charMapConfig'] = $cRMcfg['charMapConfig.'];
                                                $this->charRangeMap[$cRMkey]['cfgKey'] = substr($cRMcfgkey, 0, -1);
                                                $this->charRangeMap[$cRMkey]['multiplicator'] = (double) $cRMcfg['fontSizeMultiplicator'];
-                                               $this->charRangeMap[$cRMkey]['pixelSpace'] = intval($cRMcfg['pixelSpaceFontSizeRef']);
+                                               $this->charRangeMap[$cRMkey]['pixelSpace'] = (int)$cRMcfg['pixelSpaceFontSizeRef'];
                                        }
                                }
                        }
@@ -199,46 +184,46 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                        // The Bounding Box for the objects is stored in an array
                        foreach ($sKeyArray as $theKey) {
                                $theValue = $this->setup[$theKey];
-                               if (intval($theKey) && ($conf = $this->setup[$theKey . '.'])) {
+                               if ((int)$theKey && ($conf = $this->setup[$theKey . '.'])) {
                                        // Swipes through TEXT and IMAGE-objects
                                        switch ($theValue) {
-                                       case 'TEXT':
-                                               if ($this->setup[$theKey . '.'] = $this->checkTextObj($conf)) {
-                                                       // Adjust font width if max size is set:
-                                                       $maxWidth = isset($this->setup[$theKey . '.']['maxWidth.']) ? $this->cObj->stdWrap($this->setup[$theKey . '.']['maxWidth'], $this->setup[$theKey . '.']['maxWidth.']) : $this->setup[$theKey . '.']['maxWidth'];
-                                                       if ($maxWidth) {
-                                                               $this->setup[$theKey . '.']['fontSize'] = $this->fontResize($this->setup[$theKey . '.']);
+                                               case 'TEXT':
+                                                       if ($this->setup[$theKey . '.'] = $this->checkTextObj($conf)) {
+                                                               // Adjust font width if max size is set:
+                                                               $maxWidth = isset($this->setup[$theKey . '.']['maxWidth.']) ? $this->cObj->stdWrap($this->setup[$theKey . '.']['maxWidth'], $this->setup[$theKey . '.']['maxWidth.']) : $this->setup[$theKey . '.']['maxWidth'];
+                                                               if ($maxWidth) {
+                                                                       $this->setup[$theKey . '.']['fontSize'] = $this->fontResize($this->setup[$theKey . '.']);
+                                                               }
+                                                               // Calculate bounding box:
+                                                               $txtInfo = $this->calcBBox($this->setup[$theKey . '.']);
+                                                               $this->setup[$theKey . '.']['BBOX'] = $txtInfo;
+                                                               $this->objBB[$theKey] = $txtInfo;
+                                                               $this->setup[$theKey . '.']['imgMap'] = 0;
                                                        }
-                                                       // Calculate bounding box:
-                                                       $txtInfo = $this->calcBBox($this->setup[$theKey . '.']);
-                                                       $this->setup[$theKey . '.']['BBOX'] = $txtInfo;
-                                                       $this->objBB[$theKey] = $txtInfo;
-                                                       $this->setup[$theKey . '.']['imgMap'] = 0;
-                                               }
-                                               break;
-                                       case 'IMAGE':
-                                               $fileInfo = $this->getResource($conf['file'], $conf['file.']);
-                                               if ($fileInfo) {
-                                                       $this->combinedFileNames[] = preg_replace('/\\.[[:alnum:]]+$/', '', basename($fileInfo[3]));
-                                                       $this->setup[$theKey . '.']['file'] = $fileInfo[3];
-                                                       $this->setup[$theKey . '.']['BBOX'] = $fileInfo;
-                                                       $this->objBB[$theKey] = $fileInfo;
-                                                       if ($conf['mask']) {
-                                                               $maskInfo = $this->getResource($conf['mask'], $conf['mask.']);
-                                                               if ($maskInfo) {
-                                                                       $this->setup[$theKey . '.']['mask'] = $maskInfo[3];
-                                                               } else {
-                                                                       $this->setup[$theKey . '.']['mask'] = '';
+                                                       break;
+                                               case 'IMAGE':
+                                                       $fileInfo = $this->getResource($conf['file'], $conf['file.']);
+                                                       if ($fileInfo) {
+                                                               $this->combinedFileNames[] = preg_replace('/\\.[[:alnum:]]+$/', '', basename($fileInfo[3]));
+                                                               $this->setup[$theKey . '.']['file'] = $fileInfo[3];
+                                                               $this->setup[$theKey . '.']['BBOX'] = $fileInfo;
+                                                               $this->objBB[$theKey] = $fileInfo;
+                                                               if ($conf['mask']) {
+                                                                       $maskInfo = $this->getResource($conf['mask'], $conf['mask.']);
+                                                                       if ($maskInfo) {
+                                                                               $this->setup[$theKey . '.']['mask'] = $maskInfo[3];
+                                                                       } else {
+                                                                               $this->setup[$theKey . '.']['mask'] = '';
+                                                                       }
                                                                }
+                                                       } else {
+                                                               unset($this->setup[$theKey . '.']);
                                                        }
-                                               } else {
-                                                       unset($this->setup[$theKey . '.']);
-                                               }
-                                               break;
+                                                       break;
                                        }
                                        // Checks if disabled is set... (this is also done in menu.php / imgmenu!!)
                                        if ($conf['if.']) {
-                                               $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
+                                               $cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                                                $cObj->start($this->data);
                                                if (!$cObj->checkIf($conf['if.'])) {
                                                        unset($this->setup[$theKey]);
@@ -259,71 +244,71 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                        $this->setup['workArea'] = $this->calcOffset($this->setup['workArea']);
                        foreach ($sKeyArray as $theKey) {
                                $theValue = $this->setup[$theKey];
-                               if (intval($theKey) && ($conf = $this->setup[$theKey . '.'])) {
+                               if ((int)$theKey && ($conf = $this->setup[$theKey . '.'])) {
                                        switch ($theValue) {
-                                       case 'TEXT':
+                                               case 'TEXT':
 
-                                       case 'IMAGE':
-                                               if (isset($this->setup[$theKey . '.']['offset.'])) {
-                                                       $this->setup[$theKey . '.']['offset'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['offset'], $this->setup[$theKey . '.']['offset.']);
-                                               }
-                                               if ($this->setup[$theKey . '.']['offset']) {
-                                                       $this->setup[$theKey . '.']['offset'] = $this->calcOffset($this->setup[$theKey . '.']['offset']);
-                                               }
-                                               break;
-                                       case 'BOX':
+                                               case 'IMAGE':
+                                                       if (isset($this->setup[$theKey . '.']['offset.'])) {
+                                                               $this->setup[$theKey . '.']['offset'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['offset'], $this->setup[$theKey . '.']['offset.']);
+                                                       }
+                                                       if ($this->setup[$theKey . '.']['offset']) {
+                                                               $this->setup[$theKey . '.']['offset'] = $this->calcOffset($this->setup[$theKey . '.']['offset']);
+                                                       }
+                                                       break;
+                                               case 'BOX':
 
-                                       case 'ELLIPSE':
-                                               if (isset($this->setup[$theKey . '.']['dimensions.'])) {
-                                                       $this->setup[$theKey . '.']['dimensions'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['dimensions'], $this->setup[$theKey . '.']['dimensions.']);
-                                               }
-                                               if ($this->setup[$theKey . '.']['dimensions']) {
-                                                       $this->setup[$theKey . '.']['dimensions'] = $this->calcOffset($this->setup[$theKey . '.']['dimensions']);
-                                               }
-                                               break;
-                                       case 'WORKAREA':
-                                               if (isset($this->setup[$theKey . '.']['set.'])) {
-                                                       $this->setup[$theKey . '.']['set'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['set'], $this->setup[$theKey . '.']['set.']);
-                                               }
-                                               if ($this->setup[$theKey . '.']['set']) {
-                                                       $this->setup[$theKey . '.']['set'] = $this->calcOffset($this->setup[$theKey . '.']['set']);
-                                               }
-                                               break;
-                                       case 'CROP':
-                                               if (isset($this->setup[$theKey . '.']['crop.'])) {
-                                                       $this->setup[$theKey . '.']['crop'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['crop'], $this->setup[$theKey . '.']['crop.']);
-                                               }
-                                               if ($this->setup[$theKey . '.']['crop']) {
-                                                       $this->setup[$theKey . '.']['crop'] = $this->calcOffset($this->setup[$theKey . '.']['crop']);
-                                               }
-                                               break;
-                                       case 'SCALE':
-                                               if (isset($this->setup[$theKey . '.']['width.'])) {
-                                                       $this->setup[$theKey . '.']['width'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['width'], $this->setup[$theKey . '.']['width.']);
-                                               }
-                                               if ($this->setup[$theKey . '.']['width']) {
-                                                       $this->setup[$theKey . '.']['width'] = $this->calcOffset($this->setup[$theKey . '.']['width']);
-                                               }
-                                               if (isset($this->setup[$theKey . '.']['height.'])) {
-                                                       $this->setup[$theKey . '.']['height'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['height'], $this->setup[$theKey . '.']['height.']);
-                                               }
-                                               if ($this->setup[$theKey . '.']['height']) {
-                                                       $this->setup[$theKey . '.']['height'] = $this->calcOffset($this->setup[$theKey . '.']['height']);
-                                               }
-                                               break;
+                                               case 'ELLIPSE':
+                                                       if (isset($this->setup[$theKey . '.']['dimensions.'])) {
+                                                               $this->setup[$theKey . '.']['dimensions'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['dimensions'], $this->setup[$theKey . '.']['dimensions.']);
+                                                       }
+                                                       if ($this->setup[$theKey . '.']['dimensions']) {
+                                                               $this->setup[$theKey . '.']['dimensions'] = $this->calcOffset($this->setup[$theKey . '.']['dimensions']);
+                                                       }
+                                                       break;
+                                               case 'WORKAREA':
+                                                       if (isset($this->setup[$theKey . '.']['set.'])) {
+                                                               $this->setup[$theKey . '.']['set'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['set'], $this->setup[$theKey . '.']['set.']);
+                                                       }
+                                                       if ($this->setup[$theKey . '.']['set']) {
+                                                               $this->setup[$theKey . '.']['set'] = $this->calcOffset($this->setup[$theKey . '.']['set']);
+                                                       }
+                                                       break;
+                                               case 'CROP':
+                                                       if (isset($this->setup[$theKey . '.']['crop.'])) {
+                                                               $this->setup[$theKey . '.']['crop'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['crop'], $this->setup[$theKey . '.']['crop.']);
+                                                       }
+                                                       if ($this->setup[$theKey . '.']['crop']) {
+                                                               $this->setup[$theKey . '.']['crop'] = $this->calcOffset($this->setup[$theKey . '.']['crop']);
+                                                       }
+                                                       break;
+                                               case 'SCALE':
+                                                       if (isset($this->setup[$theKey . '.']['width.'])) {
+                                                               $this->setup[$theKey . '.']['width'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['width'], $this->setup[$theKey . '.']['width.']);
+                                                       }
+                                                       if ($this->setup[$theKey . '.']['width']) {
+                                                               $this->setup[$theKey . '.']['width'] = $this->calcOffset($this->setup[$theKey . '.']['width']);
+                                                       }
+                                                       if (isset($this->setup[$theKey . '.']['height.'])) {
+                                                               $this->setup[$theKey . '.']['height'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['height'], $this->setup[$theKey . '.']['height.']);
+                                                       }
+                                                       if ($this->setup[$theKey . '.']['height']) {
+                                                               $this->setup[$theKey . '.']['height'] = $this->calcOffset($this->setup[$theKey . '.']['height']);
+                                                       }
+                                                       break;
                                        }
                                }
                        }
                        // Get trivial data
-                       $XY = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->setup['XY']);
-                       $maxWidth = isset($this->setup['maxWidth.']) ? intval($this->cObj->stdWrap($this->setup['maxWidth'], $this->setup['maxWidth.'])) : intval($this->setup['maxWidth']);
-                       $maxHeight = isset($this->setup['maxHeight.']) ? intval($this->cObj->stdWrap($this->setup['maxHeight'], $this->setup['maxHeight.'])) : intval($this->setup['maxHeight']);
-                       $XY[0] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($XY[0], 1, $maxWidth ? $maxWidth : 2000);
-                       $XY[1] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($XY[1], 1, $maxHeight ? $maxHeight : 2000);
+                       $XY = GeneralUtility::intExplode(',', $this->setup['XY']);
+                       $maxWidth = isset($this->setup['maxWidth.']) ? (int)$this->cObj->stdWrap($this->setup['maxWidth'], $this->setup['maxWidth.']) : (int)$this->setup['maxWidth'];
+                       $maxHeight = isset($this->setup['maxHeight.']) ? (int)$this->cObj->stdWrap($this->setup['maxHeight'], $this->setup['maxHeight.']) : (int)$this->setup['maxHeight'];
+                       $XY[0] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($XY[0], 1, $maxWidth ?: 2000);
+                       $XY[1] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($XY[1], 1, $maxHeight ?: 2000);
                        $this->XY = $XY;
                        $this->w = $XY[0];
                        $this->h = $XY[1];
-                       $this->OFFSET = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->setup['offset']);
+                       $this->OFFSET = GeneralUtility::intExplode(',', $this->setup['offset']);
                        // this sets the workArea
                        $this->setWorkArea($this->setup['workArea']);
                        // this sets the default to the current;
@@ -338,7 +323,6 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         *
         * @return string The filename for the created GIF/PNG file. The filename will be prefixed "GB_
         * @see make(), fileName()
-        * @todo Define visibility
         */
        public function gifBuild() {
                if ($this->setup) {
@@ -366,7 +350,6 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * @return void
         * @access private
         * @see gifBuild()
-        * @todo Define visibility
         */
        public function make() {
                // Get trivial data
@@ -399,105 +382,111 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                        $sKeyArray = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($this->setup);
                        foreach ($sKeyArray as $theKey) {
                                $theValue = $this->setup[$theKey];
-                               if (intval($theKey) && ($conf = $this->setup[$theKey . '.'])) {
-                                       $isStdWrapped = array();
-                                       foreach ($conf as $key => $value) {
-                                               $parameter = rtrim($key, '.');
-                                               if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
-                                                       $conf[$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
-                                                       $isStdWrapped[$parameter] = 1;
+                               if ((int)$theKey && ($conf = $this->setup[$theKey . '.'])) {
+                                       // apply stdWrap to all properties, except for TEXT objects
+                                       // all properties of the TEXT sub-object have already been stdWrap-ped
+                                       // before in ->checkTextObj()
+                                       if ($theValue !== 'TEXT') {
+                                               $isStdWrapped = array();
+                                               foreach ($conf as $key => $value) {
+                                                       $parameter = rtrim($key, '.');
+                                                       if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
+                                                               $conf[$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
+                                                               $isStdWrapped[$parameter] = 1;
+                                                       }
                                                }
                                        }
+
                                        switch ($theValue) {
-                                       case 'IMAGE':
-                                               if ($conf['mask']) {
-                                                       $this->maskImageOntoImage($this->im, $conf, $this->workArea);
-                                               } else {
-                                                       $this->copyImageOntoImage($this->im, $conf, $this->workArea);
-                                               }
-                                               break;
-                                       case 'TEXT':
-                                               if (!$conf['hide']) {
-                                                       if (is_array($conf['shadow.'])) {
-                                                               $isStdWrapped = array();
-                                                               foreach ($conf['shadow.'] as $key => $value) {
-                                                                       $parameter = rtrim($key, '.');
-                                                                       if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
-                                                                               $conf['shadow.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
-                                                                               $isStdWrapped[$parameter] = 1;
+                                               case 'IMAGE':
+                                                       if ($conf['mask']) {
+                                                               $this->maskImageOntoImage($this->im, $conf, $this->workArea);
+                                                       } else {
+                                                               $this->copyImageOntoImage($this->im, $conf, $this->workArea);
+                                                       }
+                                                       break;
+                                               case 'TEXT':
+                                                       if (!$conf['hide']) {
+                                                               if (is_array($conf['shadow.'])) {
+                                                                       $isStdWrapped = array();
+                                                                       foreach ($conf['shadow.'] as $key => $value) {
+                                                                               $parameter = rtrim($key, '.');
+                                                                               if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
+                                                                                       $conf['shadow.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
+                                                                                       $isStdWrapped[$parameter] = 1;
+                                                                               }
                                                                        }
+                                                                       $this->makeShadow($this->im, $conf['shadow.'], $this->workArea, $conf);
                                                                }
-                                                               $this->makeShadow($this->im, $conf['shadow.'], $this->workArea, $conf);
-                                                       }
-                                                       if (is_array($conf['emboss.'])) {
-                                                               $isStdWrapped = array();
-                                                               foreach ($conf['emboss.'] as $key => $value) {
-                                                                       $parameter = rtrim($key, '.');
-                                                                       if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
-                                                                               $conf['emboss.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
-                                                                               $isStdWrapped[$parameter] = 1;
+                                                               if (is_array($conf['emboss.'])) {
+                                                                       $isStdWrapped = array();
+                                                                       foreach ($conf['emboss.'] as $key => $value) {
+                                                                               $parameter = rtrim($key, '.');
+                                                                               if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
+                                                                                       $conf['emboss.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
+                                                                                       $isStdWrapped[$parameter] = 1;
+                                                                               }
                                                                        }
+                                                                       $this->makeEmboss($this->im, $conf['emboss.'], $this->workArea, $conf);
                                                                }
-                                                               $this->makeEmboss($this->im, $conf['emboss.'], $this->workArea, $conf);
-                                                       }
-                                                       if (is_array($conf['outline.'])) {
-                                                               $isStdWrapped = array();
-                                                               foreach ($conf['outline.'] as $key => $value) {
-                                                                       $parameter = rtrim($key, '.');
-                                                                       if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
-                                                                               $conf['outline.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
-                                                                               $isStdWrapped[$parameter] = 1;
+                                                               if (is_array($conf['outline.'])) {
+                                                                       $isStdWrapped = array();
+                                                                       foreach ($conf['outline.'] as $key => $value) {
+                                                                               $parameter = rtrim($key, '.');
+                                                                               if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
+                                                                                       $conf['outline.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
+                                                                                       $isStdWrapped[$parameter] = 1;
+                                                                               }
                                                                        }
+                                                                       $this->makeOutline($this->im, $conf['outline.'], $this->workArea, $conf);
                                                                }
-                                                               $this->makeOutline($this->im, $conf['outline.'], $this->workArea, $conf);
+                                                               $conf['imgMap'] = 1;
+                                                               $this->makeText($this->im, $conf, $this->workArea);
                                                        }
-                                                       $conf['imgMap'] = 1;
-                                                       $this->makeText($this->im, $conf, $this->workArea);
-                                               }
-                                               break;
-                                       case 'OUTLINE':
-                                               if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
-                                                       $this->makeOutline($this->im, $conf, $this->workArea, $txtConf);
-                                               }
-                                               break;
-                                       case 'EMBOSS':
-                                               if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
-                                                       $this->makeEmboss($this->im, $conf, $this->workArea, $txtConf);
-                                               }
-                                               break;
-                                       case 'SHADOW':
-                                               if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
-                                                       $this->makeShadow($this->im, $conf, $this->workArea, $txtConf);
-                                               }
-                                               break;
-                                       case 'BOX':
-                                               $this->makeBox($this->im, $conf, $this->workArea);
-                                               break;
-                                       case 'EFFECT':
-                                               $this->makeEffect($this->im, $conf);
-                                               break;
-                                       case 'ADJUST':
-                                               $this->adjust($this->im, $conf);
-                                               break;
-                                       case 'CROP':
-                                               $this->crop($this->im, $conf);
-                                               break;
-                                       case 'SCALE':
-                                               $this->scale($this->im, $conf);
-                                               break;
-                                       case 'WORKAREA':
-                                               if ($conf['set']) {
-                                                       // this sets the workArea
-                                                       $this->setWorkArea($conf['set']);
-                                               }
-                                               if (isset($conf['clear'])) {
-                                                       // This sets the current to the default;
-                                                       $this->workArea = $this->defaultWorkArea;
-                                               }
-                                               break;
-                                       case 'ELLIPSE':
-                                               $this->makeEllipse($this->im, $conf, $this->workArea);
-                                               break;
+                                                       break;
+                                               case 'OUTLINE':
+                                                       if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
+                                                               $this->makeOutline($this->im, $conf, $this->workArea, $txtConf);
+                                                       }
+                                                       break;
+                                               case 'EMBOSS':
+                                                       if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
+                                                               $this->makeEmboss($this->im, $conf, $this->workArea, $txtConf);
+                                                       }
+                                                       break;
+                                               case 'SHADOW':
+                                                       if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
+                                                               $this->makeShadow($this->im, $conf, $this->workArea, $txtConf);
+                                                       }
+                                                       break;
+                                               case 'BOX':
+                                                       $this->makeBox($this->im, $conf, $this->workArea);
+                                                       break;
+                                               case 'EFFECT':
+                                                       $this->makeEffect($this->im, $conf);
+                                                       break;
+                                               case 'ADJUST':
+                                                       $this->adjust($this->im, $conf);
+                                                       break;
+                                               case 'CROP':
+                                                       $this->crop($this->im, $conf);
+                                                       break;
+                                               case 'SCALE':
+                                                       $this->scale($this->im, $conf);
+                                                       break;
+                                               case 'WORKAREA':
+                                                       if ($conf['set']) {
+                                                               // this sets the workArea
+                                                               $this->setWorkArea($conf['set']);
+                                                       }
+                                                       if (isset($conf['clear'])) {
+                                                               // This sets the current to the default;
+                                                               $this->workArea = $this->defaultWorkArea;
+                                                       }
+                                                       break;
+                                               case 'ELLIPSE':
+                                                       $this->makeEllipse($this->im, $conf, $this->workArea);
+                                                       break;
                                        }
                                }
                        }
@@ -512,7 +501,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                                // Multiple transparent colors are set. This is done via the trick that all transparent colors get
                                // converted to one color and then this one gets set as transparent as png/gif can just have one
                                // transparent color.
-                               $Tcolor = $this->unifyColors($this->im, $this->setup['transparentColor_array'], intval($this->setup['transparentColor.']['closest']));
+                               $Tcolor = $this->unifyColors($this->im, $this->setup['transparentColor_array'], (int)$this->setup['transparentColor.']['closest']);
                                if ($Tcolor >= 0) {
                                        imagecolortransparent($this->im, $Tcolor);
                                }
@@ -535,10 +524,9 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * @param array $conf GIFBUILDER object TypoScript properties
         * @return array Modified $conf array IF the "text" property is not blank
         * @access private
-        * @todo Define visibility
         */
        public function checkTextObj($conf) {
-               $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
+               $cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                $cObj->start($this->data);
                $isStdWrapped = array();
                foreach ($conf as $key => $value) {
@@ -550,7 +538,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                }
                $conf['fontFile'] = $this->checkFile($conf['fontFile']);
                if (!$conf['fontFile']) {
-                       $conf['fontFile'] = 't3lib/fonts/nimbus.ttf';
+                       $conf['fontFile'] = 'typo3/sysext/core/Resources/Private/Font/nimbus.ttf';
                }
                if (!$conf['iterations']) {
                        $conf['iterations'] = 1;
@@ -573,7 +561,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                $this->combinedTextStrings[] = strip_tags($conf['text']);
                // Max length = 100 if automatic line braks are not defined:
                if (!isset($conf['breakWidth']) || !$conf['breakWidth']) {
-                       $tlen = intval($conf['textMaxLength']) ? intval($conf['textMaxLength']) : 100;
+                       $tlen = (int)$conf['textMaxLength'] ?: 100;
                        if ($this->nativeCharset) {
                                $conf['text'] = $this->csConvObj->substr($this->nativeCharset, $conf['text'], 0, $tlen);
                        } else {
@@ -632,14 +620,13 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * @param string $string The string to resolve/calculate the result of. The string is divided by a comma first and each resulting part is calculated into an integer.
         * @return string The resolved string with each part (separated by comma) returned separated by comma
         * @access private
-        * @todo Define visibility
         */
        public function calcOffset($string) {
                $value = array();
-               $numbers = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->calculateFunctions($string));
+               $numbers = GeneralUtility::trimExplode(',', $this->calculateFunctions($string));
                foreach ($numbers as $key => $val) {
-                       if ((string) $val == (string) intval($val)) {
-                               $value[$key] = intval($val);
+                       if ((string)$val == (string)(int)$val) {
+                               $value[$key] = (int)$val;
                        } else {
                                $value[$key] = $this->calculateValue($val);
                        }
@@ -649,20 +636,20 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
        }
 
        /**
-        * Returns an "imgResource" creating an instance of the tslib_cObj class and calling tslib_cObj::getImgResource
+        * Returns an "imgResource" creating an instance of the ContentObjectRenderer class and calling ContentObjectRenderer::getImgResource
         *
         * @param string $file Filename value OR the string "GIFBUILDER", see documentation in TSref for the "datatype" called "imgResource
         * @param array $fileArray TypoScript properties passed to the function. Either GIFBUILDER properties or imgResource properties, depending on the value of $file (whether that is "GIFBUILDER" or a file reference)
-        * @return array Returns an array with file information if an image was returned. Otherwise FALSE.
+        * @return array|NULL Returns an array with file information from ContentObjectRenderer::getImgResource()
         * @access private
-        * @see tslib_cObj::getImgResource()
-        * @todo Define visibility
+        * @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getImgResource()
         */
        public function getResource($file, $fileArray) {
-               if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->imageFileExt, $fileArray['ext'])) {
+               if (!GeneralUtility::inList($this->imageFileExt, $fileArray['ext'])) {
                        $fileArray['ext'] = $this->gifExtension;
                }
-               $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
+               /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
+               $cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                $cObj->start($this->data);
                return $cObj->getImgResource($file, $fileArray);
        }
@@ -673,8 +660,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * @param string $file The resource value.
         * @return string Returns the relative filepath
         * @access private
-        * @see t3lib_TStemplate::getFileName()
-        * @todo Define visibility
+        * @see \TYPO3\CMS\Core\TypoScript\TemplateService::getFileName()
         */
        public function checkFile($file) {
                return $GLOBALS['TSFE']->tmpl->getFileName($file);
@@ -686,19 +672,18 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * @param string $pre Filename prefix, eg. "GB_
         * @return string The relative filepath (relative to PATH_site)
         * @access private
-        * @todo Define visibility
         */
        public function fileName($pre) {
                $meaningfulPrefix = '';
                if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']) {
                        /** @var $basicFileFunctions \TYPO3\CMS\Core\Utility\File\BasicFileUtility */
-                       $basicFileFunctions = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
+                       $basicFileFunctions = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
                        $meaningfulPrefix = implode('_', array_merge($this->combinedTextStrings, $this->combinedFileNames));
                        $meaningfulPrefix = $basicFileFunctions->cleanFileName($meaningfulPrefix);
-                       $meaningfulPrefixLength = intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']);
+                       $meaningfulPrefixLength = (int)$GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'];
                        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
                                /** @var $t3libCsInstance \TYPO3\CMS\Core\Charset\CharsetConverter */
-                               $t3libCsInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
+                               $t3libCsInstance = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
                                $meaningfulPrefix = $t3libCsInstance->substr('utf-8', $meaningfulPrefix, 0, $meaningfulPrefixLength);
                        } else {
                                $meaningfulPrefix = substr($meaningfulPrefix, 0, $meaningfulPrefixLength);
@@ -709,7 +694,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                // Not only the wrong glyphs are printed but also some memory stack overflow resulted in strange additional
                // chars - and finally the reason for this investigation: The Bounding box data was changing all the time
                // resulting in new images being generated all the time. With PHP4 it works fine.
-               return $this->tempPath . $pre . $meaningfulPrefix . \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5(serialize($this->setup)) . '.' . $this->extension();
+               return $this->tempPath . $pre . $meaningfulPrefix . GeneralUtility::shortMD5(serialize($this->setup)) . '.' . $this->extension();
        }
 
        /**
@@ -717,24 +702,22 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         *
         * @return string Extension; "jpg" or "gif"/"png
         * @access private
-        * @todo Define visibility
         */
        public function extension() {
                switch (strtolower($this->setup['format'])) {
-               case 'jpg':
-
-               case 'jpeg':
-                       return 'jpg';
-                       break;
-               case 'png':
-                       return 'png';
-                       break;
-               case 'gif':
-                       return 'gif';
-                       break;
-               default:
-                       return $this->gifExtension;
-                       break;
+                       case 'jpg':
+
+                       case 'jpeg':
+                               return 'jpg';
+                               break;
+                       case 'png':
+                               return 'png';
+                               break;
+                       case 'gif':
+                               return 'gif';
+                               break;
+                       default:
+                               return $this->gifExtension;
                }
        }
 
@@ -742,17 +725,17 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * Calculates the value concerning the dimensions of objects.
         *
         * @param string $string The string to be calculated (e.g. "[20.h]+13")
-        * @return integer The calculated value (e.g. "23")
+        * @return int The calculated value (e.g. "23")
         * @see calcOffset()
         */
        protected function calculateValue($string) {
                $calculatedValue = 0;
-               $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::splitCalc($string, '+-*/%');
+               $parts = GeneralUtility::splitCalc($string, '+-*/%');
                foreach ($parts as $part) {
                        $theVal = $part[1];
                        $sign = $part[0];
-                       if ((string) intval($theVal) == (string) $theVal) {
-                               $theVal = intval($theVal);
+                       if (((string)(int)$theVal) == ((string)$theVal)) {
+                               $theVal = (int)$theVal;
                        } elseif ('[' . substr($theVal, 1, -1) . ']' == $theVal) {
                                $objParts = explode('.', substr($theVal, 1, -1));
                                $theVal = 0;
@@ -764,7 +747,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                                        } elseif ($objParts[1] == 'lineHeight') {
                                                $theVal = $this->objBB[$objParts[0]][2]['lineHeight'];
                                        }
-                                       $theVal = intval($theVal);
+                                       $theVal = (int)$theVal;
                                }
                        } elseif (floatval($theVal)) {
                                $theVal = floatval($theVal);
@@ -806,15 +789,12 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         * Calculates the maximum of a set of values defined like "[10.h],[20.h],1000"
         *
         * @param string $string The string to be used to calculate the maximum (e.g. "[10.h],[20.h],1000")
-        * @return integer The maxium value of the given comma separated and calculated values
+        * @return int The maxium value of the given comma separated and calculated values
         */
        protected function calculateMaximum($string) {
-               $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->calcOffset($string), TRUE);
+               $parts = GeneralUtility::trimExplode(',', $this->calcOffset($string), TRUE);
                $maximum = count($parts) ? max($parts) : 0;
                return $maximum;
        }
 
 }
-
-
-?>
\ No newline at end of file