Cleanup references to versions of TYPO3 CMS lower than 6.2
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 13 Oct 2015 00:24:35 +0000 (00:24 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 13 Oct 2015 00:24:35 +0000 (00:24 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_freecap/trunk@89891 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Classes/Controller/FontMakerController.php
Classes/Controller/ImageGeneratorController.php
Classes/Domain/Repository/WordRepository.php
Classes/Domain/Session/SessionStorage.php
Classes/PiBaseApi.php
Classes/Utility/FontMakingUtility.php
Classes/Utility/ImageContentUtility.php

index dc3b1ff..79d5750 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
        * Move static template registration to TCA overrides
        * Compatibility with TYPO3 CMS 7
        * Improve template handling
+       * Cleanup references to versions of TYPO3 CMS lower than 6.2
        * Update verion to 2.3.0
 
 2015-03-31  Stanislas Rolland  <typo3@sjbr.ca>
index 94af943..8a27844 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\SrFreecap\Controller;
+
 /***************************************************************
  *  Copyright notice
  *
@@ -45,11 +46,7 @@ class FontMakerController  extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContr
         */
        public function newAction(\SJBR\SrFreecap\Domain\Model\Font $font = NULL) {
                if (!is_object($font)) {
-                       if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 6001000) {
-                               $font = $this->objectManager->create('SJBR\\SrFreecap\\Domain\\Model\\Font');
-                       } else {
-                               $font = $this->objectManager->get('SJBR\\SrFreecap\\Domain\\Model\\Font');
-                       }
+                       $font = $this->objectManager->get('SJBR\\SrFreecap\\Domain\\Model\\Font');
                }
                $this->view->assign('font', $font);
        }       
index 1466ad4..80ddfab 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\SrFreecap\Controller;
+
 /***************************************************************
 *  Copyright notice
 *
index e4e45b2..a179a2c 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 namespace SJBR\SrFreecap\Domain\Repository;
-/***************************************************************
+
+/*
  *  Copyright notice
  *
- *  (c) 2012 Stanislas Rolland <typo3@sjbr.ca>
+ *  (c) 2012-2015 Stanislas Rolland <typo3@sjbr.ca>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -24,14 +25,13 @@ namespace SJBR\SrFreecap\Domain\Repository;
  *  GNU General Public License for more details.
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ */
 
 /**
  * Word repository in session storage
- *
- * @author Stanislas Rolland <typo3@sjbr.ca>
  */
-class WordRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
+class WordRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
+{
  
        /**
         * The session sorage handler
@@ -44,7 +44,8 @@ class WordRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
         *
         * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
         */
-       public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = NULL) {
+       public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = NULL)
+       {
                // Get the object manager
                if ($objectManager === NULL) {
                        $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
@@ -59,15 +60,12 @@ class WordRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
         *
         * @return \SJBR\SrFreecap\Domain\Model\Word the stored object
         */
-       public function getWord() {
+       public function getWord()
+       {
                $word = $this->sessionStorage->restoreFromSession();
                // If no Word object is found in session data, initialize a new one
                if (!is_object($word)) {
-                       if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 6001000) {
-                               $word = $this->objectManager->create('SJBR\\SrFreecap\\Domain\\Model\\Word');
-                       } else {
-                               $word = $this->objectManager->get('SJBR\\SrFreecap\\Domain\\Model\\Word');
-                       }
+                       $word = $this->objectManager->get('SJBR\\SrFreecap\\Domain\\Model\\Word');
                }
                return $word;
        }
@@ -78,7 +76,8 @@ class WordRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
         * @param \SJBR\SrFreecap\Domain\Model\Word the object to be stored
         * @return \SJBR\SrFreecap\Domain\Repository\WordRepository
         */
-       public function setWord(\SJBR\SrFreecap\Domain\Model\Word $object) {
+       public function setWord(\SJBR\SrFreecap\Domain\Model\Word $object)
+       {
                $this->sessionStorage->writeToSession($object);
                return $this;
        }
@@ -88,9 +87,9 @@ class WordRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
         *
         * @return \SJBR\SrFreecap\Domain\Repository\WordRepository
         */
-       public function cleanUpWord() {
+       public function cleanUpWord()
+       {
                $this->sessionStorage->cleanUpSession();
                return $this;
        }
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 9ab0344..f2c7afe 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 namespace SJBR\SrFreecap\Domain\Session;
-/***************************************************************
+
+/*
  *  Copyright notice
  *
- *  (c) 2012-2014 Stanislas Rolland <typo3@sjbr.ca>
+ *  (c) 2012-2015 Stanislas Rolland <typo3@sjbr.ca>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -24,13 +25,14 @@ namespace SJBR\SrFreecap\Domain\Session;
  *  GNU General Public License for more details.
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ */
 /**
  * Session storage
  *
  * @author Stanislas Rolland <typo3@sjbr.ca>
  */
-class SessionStorage implements \TYPO3\CMS\Core\SingletonInterface {
+class SessionStorage implements \TYPO3\CMS\Core\SingletonInterface
+{
        
        const SESSIONNAMESPACE = 'tx_srfreecap';
  
@@ -39,7 +41,8 @@ class SessionStorage implements \TYPO3\CMS\Core\SingletonInterface {
         *
         * @return Object the stored object
         */
-       public function restoreFromSession () {
+       public function restoreFromSession()
+       {
                $sessionData = $this->getFrontendUser()->getKey('ses', self::SESSIONNAMESPACE);
                return unserialize($sessionData);
        }
@@ -50,7 +53,8 @@ class SessionStorage implements \TYPO3\CMS\Core\SingletonInterface {
         * @param $object any serializable object to store into the session
         * @return \SJBR\SrFreecap\Domain\Session\SessionStorage
         */
-       public function writeToSession ($object) {
+       public function writeToSession($object)
+       {
                $sessionData = serialize($object);
                $this->getFrontendUser()->setKey('ses', self::SESSIONNAMESPACE, $sessionData);
                return $this;
@@ -61,7 +65,8 @@ class SessionStorage implements \TYPO3\CMS\Core\SingletonInterface {
         *
         * @return \SJBR\SrFreecap\Domain\Session\SessionStorage
         */
-       public function cleanUpSession () {
+       public function cleanUpSession()
+       {
                $this->getFrontendUser()->setKey('ses', self::SESSIONNAMESPACE, NULL);
                return $this;
        }
@@ -72,11 +77,11 @@ class SessionStorage implements \TYPO3\CMS\Core\SingletonInterface {
         * @return      \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthtenication   The current frontend user object
         * @throws      LogicException
         */
-       protected function getFrontendUser () {
+       protected function getFrontendUser()
+       {
                if ($GLOBALS ['TSFE']->fe_user) {
                        return $GLOBALS ['TSFE']->fe_user;
                }
                throw new LogicException ('No Frontentuser found in session!');
        }
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 9c0c8cd..de3c9f3 100644 (file)
@@ -1,35 +1,32 @@
 <?php
 namespace SJBR\SrFreecap;
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2005-2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
-*  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 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!
-***************************************************************/
-/**
- * Integrates freeCap v1.4 into TYPO3 and checks the freeCap CAPTCHA word.
+
+/*
+ *  Copyright notice
  *
+ *  (c) 2005-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  All rights reserved
  *
- * @author     Stanislas Rolland       <typo3(arobas)sjbr.ca>
+ *  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
+ *  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 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!
+ */
+/**
+ * Integrates freeCap v1.4 into TYPO3 and checks the freeCap CAPTCHA word.
  */
 /************************************************************\
 *
@@ -54,7 +51,8 @@ namespace SJBR\SrFreecap;
 *
 *
 \************************************************************/
-class PiBaseApi {
+class PiBaseApi
+{
 
        /**
         * @var string The extension key
@@ -71,7 +69,8 @@ class PiBaseApi {
         *
         * @return array marker array containing the captcha markers to be sustituted in the html template
         */     
-       public function makeCaptcha() {
+       public function makeCaptcha()
+       {
 
                // Get the object manager
                if ($this->objectManager === NULL) {
@@ -80,9 +79,6 @@ class PiBaseApi {
                
                // Get the configuration manager
                $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
-               if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 6002000) {
-                       $configurationManager->injectObjectManager($this->objectManager);
-               }
                
                // Get translation view helper
                $translator = $this->objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
@@ -111,7 +107,8 @@ class PiBaseApi {
         * @param       string          $word: hte word that was entered
         * @return      boolean         true, if the word entered matches the hashes value
         */
-       public function checkWord ($word) {
+       public function checkWord($word)
+       {
                // Get the object manager
                if ($this->objectManager === NULL) {
                        $this->objectManager = new \TYPO3\CMS\Extbase\Object\ObjectManager();
@@ -122,5 +119,4 @@ class PiBaseApi {
                return !$validator->validate($word)->hasErrors();
        }
 }
-class_alias('SJBR\\SrFreecap\\PiBaseApi', 'tx_srfreecap_pi2');
-?>
\ No newline at end of file
+class_alias('SJBR\\SrFreecap\\PiBaseApi', 'tx_srfreecap_pi2');
\ No newline at end of file
index a1fc1b2..6154afa 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace SJBR\SrFreecap\Utility;
-/***************************************************************
+
+/*
  *  Copyright notice
  *
  *  (c) 2012-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
@@ -24,17 +25,16 @@ namespace SJBR\SrFreecap\Utility;
  *  GNU General Public License for more details.
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ */
 
 use \TYPO3\CMS\Core\Utility\GeneralUtility;
 use \TYPO3\CMS\Core\Utility\VersionNumberUtility;
 
 /**
  * Utility for making GD fonts
- *
- * @author     Stanislas Rolland       <typo3(arobas)sjbr.ca>
  */
-class FontMakingUtility {
+class FontMakingUtility
+{
 
        /**
         * Returns an image displaying a list of characters with specified font file and character size
@@ -45,7 +45,8 @@ class FontMakingUtility {
         * @param string $height: height of the image
         * @return array image file info array
         */
-       public static function makeFontImage ($characters, $font, $width = 34, $height = 50) {
+       public static function makeFontImage($characters, $font, $width = 34, $height = 50)
+       {
                
                $size = intval($height * .8);
                $vertOffset = intval($height * .7);
@@ -80,11 +81,7 @@ class FontMakingUtility {
                        $gifObjArray[$ic . '0.']['offset'] = (($ic-1) * $width + $hOffset) . ',' . $vertOffset;
                }
                $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-               if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 6001000) {
-                       $gifCreator = $objectManager->create('SJBR\\SrFreecap\\Utility\\GifBuilderUtility');
-               } else {
-                       $gifCreator = $objectManager->get('SJBR\\SrFreecap\\Utility\\GifBuilderUtility');
-               }
+               $gifCreator = $objectManager->get('SJBR\\SrFreecap\\Utility\\GifBuilderUtility');
                $gifCreator->init();
                if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
                        $gifCreator->start($gifObjArray, array());
@@ -117,7 +114,8 @@ class FontMakingUtility {
        *
        *
        \************************************************************/
-       public static function makeFont ($image, $numchars, $startchar, $pixelwidth, $pixelheight, $endianness = 0) {
+       public static function makeFont($image, $numchars, $startchar, $pixelwidth, $pixelheight, $endianness = 0)
+       {
                $startchar = ord($startchar);
                // encode this at start of font
                if ($endianness) {
index 9631c0e..87a1417 100644 (file)
@@ -1,30 +1,30 @@
 <?php
 namespace SJBR\SrFreecap\Utility;
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2012-2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
-*  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 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!
-***************************************************************/
+
+/*
+ *  Copyright notice
+ *
+ *  (c) 2012-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  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 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!
+ */
 /************************************************************\
 *
 *              freeCap v1.4.1 Copyright 2005 Howard Yeend
@@ -48,10 +48,12 @@ namespace SJBR\SrFreecap\Utility;
 *
 *
 \************************************************************/
+
+use SJBR\SrFreecap\Utility\RandomContentUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Utility dealing with image content
- *
- * @author     Stanislas Rolland       <typo3(arobas)sjbr.ca>
  */
 class ImageContentUtility {
        
@@ -80,10 +82,10 @@ class ImageContentUtility {
         * @param array $fontLocations: array of font files locations
         * @param array $fontWidths: array of font widths
         * @param int $morphfactor: text morphing factor
-        *
         * @return string GD image identifier of noisy background
         */
-       public static function writeWordOnImage ($width, $height, $word, $textColorType, $textPosition, $colorMaximum, $backgroundType, $fontLocations, $fontWidths, $morphFactor = 1) {
+       public static function writeWordOnImage($width, $height, $word, $textColorType, $textPosition, $colorMaximum, $backgroundType, $fontLocations, $fontWidths, $morphFactor = 1)
+       {
 
                $image = ImageCreate($width, $height);
                $image2 = ImageCreate($width, $height);
@@ -102,12 +104,12 @@ class ImageContentUtility {
                ImageFill($image2, 0, 0, $background2);
 
                // Write word in random starting X position
-               $word_start_x = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(5, $textPosition['horizontal']);
+               $word_start_x = RandomContentUtility::getRandomNumberInRange(5, $textPosition['horizontal']);
                // Y positions jiggled about later
                $word_start_y = $textPosition['vertical'];
                // Get uniform color
                if ($textColorType == self::TEXT_COLOR_UNIFORM) {
-                       $textColor = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomColor($colorMaximum['darkness'], $colorMaximum['lightness'], $backgroundType == self::BACKGROUND_TYPE_MORPHED_IMAGE_BLOCKS);
+                       $textColor = RandomContentUtility::getRandomColor($colorMaximum['darkness'], $colorMaximum['lightness'], $backgroundType == self::BACKGROUND_TYPE_MORPHED_IMAGE_BLOCKS);
                        $textColor2 = ImageColorAllocate($image2, $textColor[0], $textColor[1], $textColor[2]);
                }
                // Write each character in different font
@@ -116,10 +118,10 @@ class ImageContentUtility {
                for ($i = 0; $i < strlen($word); $i++) {
                        // Get changing color
                        if ($textColorType == self::TEXT_COLOR_ONE_PER_CHARACTER) {
-                               $textColor = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomColor($colorMaximum['darkness'], $colorMaximum['lightness'], $backgroundType == self::BACKGROUND_TYPE_MORPHED_IMAGE_BLOCKS);
+                               $textColor = RandomContentUtility::getRandomColor($colorMaximum['darkness'], $colorMaximum['lightness'], $backgroundType == self::BACKGROUND_TYPE_MORPHED_IMAGE_BLOCKS);
                                $textColor2 = ImageColorAllocate($image2, $textColor[0], $textColor[1], $textColor[2]);
                        }
-                       $fontIndex = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(0, sizeof($fontLocations)-1);
+                       $fontIndex = RandomContentUtility::getRandomNumberInRange(0, sizeof($fontLocations)-1);
                        $font = ImageLoadFont($fontLocations[$fontIndex]);
                        ImageString($image2, $font, $x_pos, $word_start_y, $word{$i}, $textColor2);
                        $textFontWidths[$i] = $fontWidths[$fontIndex];
@@ -135,7 +137,7 @@ class ImageContentUtility {
                        // Deviate at least 4 pixels between each letter
                        $prev_y = $y_pos;
                        do {
-                               $y_pos = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(-5, 5);
+                               $y_pos = RandomContentUtility::getRandomNumberInRange(-5, 5);
                        } while ($y_pos < $prev_y + 2 && $y_pos > $prev_y - 2);
                        ImageCopy($image, $image2, $x_pos, $y_pos, $x_pos, 0, $textFontWidths[$i], $height);
                        $x_pos += $textFontWidths[$i];
@@ -154,7 +156,7 @@ class ImageContentUtility {
                                // morph x += so that instead of deviating from orig x each time, we deviate from where we last deviated to
                                // get it? instead of a zig zag, we get more of a sine wave.
                                // I wish we could deviate more but it looks crap if we do.
-                               $morph_x += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(-$morphFactor, $morphFactor);
+                               $morph_x += RandomContentUtility::getRandomNumberInRange(-$morphFactor, $morphFactor);
                                // had to change this to ImageCopyMerge when starting using ImageCreateTrueColor
                                // according to the manual; "when (pct is) 100 this function behaves identically to imagecopy()"
                                // but this is NOT true when dealing with transparencies...
@@ -171,7 +173,7 @@ class ImageContentUtility {
                        // Can result in image going too far off on Y-axis;
                        // not much I can do about that, apart from make image bigger
                        // again, I wish I could do 1.5 pixels
-                       $y_pos += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(-1, 1);
+                       $y_pos += RandomContentUtility::getRandomNumberInRange(-1, 1);
                        ImageCopy($image, $image2, $i, $y_pos, $i, 0, $x_chunk, $height);
                }
 
@@ -191,10 +193,10 @@ class ImageContentUtility {
         * @param array $backgroundImages: array of background image file names
         * @param boolean $morphBackground: if TRUE, the background will be morphed
         * @param boolean $blurBackground: if TRUE, the background will be blurred
-        *
         * @return string GD image identifier of noisy background
         */
-       public static function generateNoisyBackground ($width, $height, $word, $backgroundType, $backgroundImages = array(), $morphBackground = TRUE, $blurBackground = TRUE) {
+       public static function generateNoisyBackground($width, $height, $word, $backgroundType, $backgroundImages = array(), $morphBackground = TRUE, $blurBackground = TRUE)
+       {
                $image = ImageCreateTrueColor($width, $height);
                if ($backgroundType != self::BACKGROUND_TYPE_TRANSPARENT) {
 
@@ -218,16 +220,16 @@ class ImageContentUtility {
                        switch ($backgroundType) {
                                case self::BACKGROUND_TYPE_WHITE_WITH_GRID:
                                        // Draw grid on x
-                                       for ($i = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(6, 20); $i < $width*2; $i += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(10, 25)) {
-                                               ImageSetThickness($tempBackground, \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(2, 6));
-                                               $textColor = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomColor(100, 150);
+                                       for ($i = RandomContentUtility::getRandomNumberInRange(6, 20); $i < $width*2; $i += RandomContentUtility::getRandomNumberInRange(10, 25)) {
+                                               ImageSetThickness($tempBackground, RandomContentUtility::getRandomNumberInRange(2, 6));
+                                               $textColor = RandomContentUtility::getRandomColor(100, 150);
                                                $textColor2 = ImageColorAllocate($tempBackground, $textColor[0], $textColor[1], $textColor[2]);
                                                ImageLine($tempBackground, $i, 0, $i, $height*2, $textColor2);
                                        }
                                        // Draw grid on y
-                                       for ($i = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(6, 20); $i < $height*2 ; $i += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(10, 25)) {
-                                               ImageSetThickness($tempBackground, \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(2, 6));
-                                               $textColor = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomColor(100, 150);
+                                       for ($i = RandomContentUtility::getRandomNumberInRange(6, 20); $i < $height*2 ; $i += RandomContentUtility::getRandomNumberInRange(10, 25)) {
+                                               ImageSetThickness($tempBackground, RandomContentUtility::getRandomNumberInRange(2, 6));
+                                               $textColor = RandomContentUtility::getRandomColor(100, 150);
                                                $textColor2 = ImageColorAllocate($tempBackground, $textColor[0], $textColor[1], $textColor[2]);
                                                ImageLine($tempBackground, 0, $i, $width*2, $i , $textColor2);
                                        }
@@ -235,7 +237,7 @@ class ImageContentUtility {
                                case self::BACKGROUND_TYPE_WHITE_WITH_SQUIGGLES:
                                        ImageSetThickness($tempBackground, 4);
                                        for ($i = 0; $i < strlen($word)+1; $i++) {
-                                               $textColor = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomColor(100, 150);
+                                               $textColor = RandomContentUtility::getRandomColor(100, 150);
                                                $textColor2 = ImageColorAllocate($tempBackground, $textColor[0], $textColor[1], $textColor[2]);
                                                $points = Array();
                                                // Draw random squiggle for each character
@@ -243,9 +245,9 @@ class ImageContentUtility {
                                                // keep random so OCR can't say "if found shape has 10 points, ignore it"
                                                // each squiggle will, however, be a closed shape, so OCR could try to find
                                                // line terminations and start from there. (I don't think they're that advanced yet..)
-                                               for ($j = 1; $j < \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(5, 10); $j++) {
-                                                       $points[] = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(1*(20*($i+1)), 1*(50*($i+1)));
-                                                       $points[] = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(30, $height+30);
+                                               for ($j = 1; $j < RandomContentUtility::getRandomNumberInRange(5, 10); $j++) {
+                                                       $points[] = RandomContentUtility::getRandomNumberInRange(1*(20*($i+1)), 1*(50*($i+1)));
+                                                       $points[] = RandomContentUtility::getRandomNumberInRange(30, $height+30);
                                                }
                                                ImagePolygon($tempBackground, $points, intval(sizeof($points)/2), $textColor2);
                                        }
@@ -254,17 +256,17 @@ class ImageContentUtility {
                                        // Take random chunks of $backgroundImages and paste them onto the background
                                        for ($i = 0; $i < sizeof($backgroundImages); $i++) {
                                                // Read each image and its size
-                                               $tempImages[$i] = ImageCreateFromJPEG(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($backgroundImages[$i]));
+                                               $tempImages[$i] = ImageCreateFromJPEG(GeneralUtility::getFileAbsFileName($backgroundImages[$i]));
                                                $tempWidths[$i] = imagesx($tempImages[$i]);
                                                $tempHeights[$i] = imagesy($tempImages[$i]);
                                        }
-                                       $blocksize = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(20, 60);
+                                       $blocksize = RandomContentUtility::getRandomNumberInRange(20, 60);
                                        for ($i = 0; $i < $width*2; $i += $blocksize) {
                                                // Could randomise blocksize here... hardly matters
                                                for ($j = 0; $j < $height*2; $j += $blocksize) {
-                                                       $imageIndex = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(0, sizeof($tempImages)-1);
-                                                       $cut_x = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(0, $tempWidths[$imageIndex]-$blocksize);
-                                                       $cut_y = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(0, $tempHeights[$imageIndex]-$blocksize);
+                                                       $imageIndex = RandomContentUtility::getRandomNumberInRange(0, sizeof($tempImages)-1);
+                                                       $cut_x = RandomContentUtility::getRandomNumberInRange(0, $tempWidths[$imageIndex]-$blocksize);
+                                                       $cut_y = RandomContentUtility::getRandomNumberInRange(0, $tempHeights[$imageIndex]-$blocksize);
                                                        ImageCopy($tempBackground, $tempImages[$imageIndex], $i, $j, $cut_x, $cut_y, $blocksize, $blocksize);
                                                }
                                        }
@@ -286,11 +288,11 @@ class ImageContentUtility {
                                // this is a different and less perfect morph than the one we do on the CAPTCHA
                                // occasonally you get some dark background showing through around the edges
                                // it doesn't need to be perfect as it's only the background.
-                               $morph_chunk = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(1, 5);
+                               $morph_chunk = RandomContentUtility::getRandomNumberInRange(1, 5);
                                $morph_y = 0;
                                for ($x = 0; $x < $width; $x += $morph_chunk) {
-                                       $morph_chunk = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(1, 5);
-                                       $morph_y += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(-1, 1);
+                                       $morph_chunk = RandomContentUtility::getRandomNumberInRange(1, 5);
+                                       $morph_y += RandomContentUtility::getRandomNumberInRange(-1, 1);
                                        ImageCopy($image, $tempBackground, $x, 0, $x+30, 30+$morph_y, $morph_chunk, $height*2);
                                }
                                
@@ -298,8 +300,8 @@ class ImageContentUtility {
                                
                                $morph_x = 0;
                                for ($y = 0; $y <= $height; $y += $morph_chunk) {
-                                       $morph_chunk = \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(1, 5);
-                                       $morph_x += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(-1, 1);
+                                       $morph_chunk = RandomContentUtility::getRandomNumberInRange(1, 5);
+                                       $morph_x += RandomContentUtility::getRandomNumberInRange(-1, 1);
                                        ImageCopy($image, $tempBackground, $morph_x, $y, 0, $y, $width, $morph_chunk);
                                
                                }
@@ -327,10 +329,10 @@ class ImageContentUtility {
         * @param string $backgroundType (see constants)
         * @param int $mergeType: 0 - Background over captcha, 1 - Captcha over background (see constants)
         * @param int $backgroundFadePercentage: fading factor for background    
-        *
         * @return string GD image identifier of merged image
         */
-       public static function mergeCaptchaWithBackground ($width, $height, $captchaImage, $backgroundImage, $backgroundType, $mergeType) {
+       public static function mergeCaptchaWithBackground($width, $height, $captchaImage, $backgroundImage, $backgroundType, $mergeType)
+       {
                if ($backgroundType != self::BACKGROUND_TYPE_TRANSPARENT) {
                        // How faded should the background be? (100=totally gone, 0=bright as the day)
                        // to test how much protection the bg noise gives, take a screenshot of the freeCap image
@@ -346,7 +348,7 @@ class ImageContentUtility {
                                        break;
                        }
                        // Slightly randomize the background fade
-                       $backgroundFadePercentage += \SJBR\SrFreecap\Utility\RandomContentUtility::getRandomNumberInRange(-2, 2);
+                       $backgroundFadePercentage += RandomContentUtility::getRandomNumberInRange(-2, 2);
                        // Fade background
                        if ($backgroundType != self::BACKGROUND_TYPE_MORPHED_IMAGE_BLOCKS) {
                                $tempImage = ImageCreateTrueColor($width, $height);
@@ -375,10 +377,10 @@ class ImageContentUtility {
         * Blurs an image
         *
         * @param string $image: a GD image identifier
-        *
         * @return string GD image identifier of blurred image
         */
-       public static function blurImage($image) {
+       public static function blurImage($image)
+       {
                // w00t. my very own blur function
                // in GD2, there's a gaussian blur function. bunch of bloody show-offs... :-)
 
@@ -415,10 +417,10 @@ class ImageContentUtility {
         *
         * @param string $image: a GD image identifier
         * @param string $imageType: type of image (jpg, gif or png)
-        *
         * @return      void
         */
-       public static function sendImage($image, $imageType) {
+       public static function sendImage($image, $imageType)
+       {
                header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
                header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
                header('Pragma: no-cache');
@@ -439,5 +441,4 @@ class ImageContentUtility {
                                break;
                }
        }
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file