[TASK] Use arrays in str_replace() calls 81/26481/8
authorMichiel Roos <michiel@maxserv.nl>
Wed, 18 Dec 2013 21:46:49 +0000 (22:46 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Wed, 8 Jan 2014 12:33:13 +0000 (13:33 +0100)
Multiple consecutive calls to str_replace can be replaced with a single
call if the subject is the same.

This will speed up the replacement and in some cases has the benefit of
being able to return or use the result of the str_replace directly without
creating an intermediate variable.

Bad:
$lala = 'something';
$lala = str_replace('so', 'the', $lala);
$lala = str_replace('me', ' ', $lala);
$lala = str_replace('thing', 'other', $lala);

Good:
$lala = str_replace(
  array('so', 'me', 'thing'),
  array('the', ' ', 'other'),
  'something'
);

Change-Id: I1a2b99cce1444d3d2191eba8674f74aa2f74f0e8
Resolves: #54500
Releases: 6.2
Reviewed-on: https://review.typo3.org/26481
Reviewed-by: Markus Klein
Tested-by: Markus Klein
27 files changed:
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/core/Classes/Cache/CacheManager.php
typo3/sysext/core/Classes/Error/DebugExceptionHandler.php
typo3/sysext/core/Classes/Html/HtmlParser.php
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Request.php
typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php
typo3/sysext/form/Classes/Validation/BetweenValidator.php
typo3/sysext/form/Classes/Validation/FloatValidator.php
typo3/sysext/form/Classes/Validation/IntegerValidator.php
typo3/sysext/form/Classes/Validation/LengthValidator.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/ContentObject/FormContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/ImageMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/QuicktimeObjectContentObject.php
typo3/sysext/frontend/Classes/ContentObject/SearchResultContentObject.php
typo3/sysext/frontend/Classes/Controller/DataSubmissionController.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php
typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php
typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php
typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php

index 51720ac..569fad3 100644 (file)
@@ -5212,11 +5212,23 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                }
                foreach ($arr as $k => $v) {
                        // Make substitutions:
                }
                foreach ($arr as $k => $v) {
                        // Make substitutions:
-                       $arr[$k] = str_replace('###PAGE_TITLE###', $pageTitle, $arr[$k]);
-                       $arr[$k] = str_replace('###ID_NEW_INDICATOR###', $newLabel, $arr[$k]);
-                       $arr[$k] = str_replace('###RECORD_LABEL###', $rLabel, $arr[$k]);
-                       $arr[$k] = str_replace('###TABLE_TITLE###', htmlspecialchars($this->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), $arr[$k]);
-                       $arr[$k] = str_replace('###RECORD_ICON###', IconUtility::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec))), $arr[$k]);
+                       $arr[$k] = str_replace(
+                               array(
+                                       '###PAGE_TITLE###',
+                                       '###ID_NEW_INDICATOR###',
+                                       '###RECORD_LABEL###',
+                                       '###TABLE_TITLE###',
+                                       '###RECORD_ICON###'
+                               ),
+                               array(
+                                       $pageTitle,
+                                       $newLabel,
+                                       $rLabel,
+                                       htmlspecialchars($this->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
+                                       IconUtility::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec)))
+                               ),
+                               $arr[$k]
+                       );
                }
                return $arr;
        }
                }
                return $arr;
        }
@@ -5251,15 +5263,29 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
         * @todo Define visibility
         */
        public function rplColorScheme($inTemplate) {
         * @todo Define visibility
         */
        public function rplColorScheme($inTemplate) {
-               // Colors:
-               $inTemplate = str_replace('###BGCOLOR###', $this->colorScheme[0] ? ' bgcolor="' . $this->colorScheme[0] . '"' : '', $inTemplate);
-               $inTemplate = str_replace('###BGCOLOR_HEAD###', $this->colorScheme[1] ? ' bgcolor="' . $this->colorScheme[1] . '"' : '', $inTemplate);
-               $inTemplate = str_replace('###FONTCOLOR_HEAD###', $this->colorScheme[3], $inTemplate);
-               // Classes:
-               $inTemplate = str_replace('###CLASSATTR_1###', $this->classScheme[0] ? ' class="' . $this->classScheme[0] . '"' : '', $inTemplate);
-               $inTemplate = str_replace('###CLASSATTR_2###', $this->classScheme[1] ? ' class="' . $this->classScheme[1] . '"' : '', $inTemplate);
-               $inTemplate = str_replace('###CLASSATTR_4###', $this->classScheme[3] ? ' class="' . $this->classScheme[3] . '"' : '', $inTemplate);
-               return $inTemplate;
+               return str_replace(
+                       array(
+                               // Colors:
+                               '###BGCOLOR###',
+                               '###BGCOLOR_HEAD###',
+                               '###FONTCOLOR_HEAD###',
+                               // Classes:
+                               '###CLASSATTR_1###',
+                               '###CLASSATTR_2###',
+                               '###CLASSATTR_4###'
+                       ),
+                       array(
+                               // Colors:
+                               $this->colorScheme[0] ? ' bgcolor="' . $this->colorScheme[0] . '"' : '',
+                               $this->colorScheme[1] ? ' bgcolor="' . $this->colorScheme[1] . '"' : '',
+                               $this->colorScheme[3],
+                               // Classes:
+                               $this->classScheme[0] ? ' class="' . $this->classScheme[0] . '"' : '',
+                               $this->classScheme[1] ? ' class="' . $this->classScheme[1] . '"' : '',
+                               $this->classScheme[3] ? ' class="' . $this->classScheme[3] . '"' : ''
+                       ),
+                       $inTemplate
+               );
        }
 
        /**
        }
 
        /**
@@ -5666,8 +5692,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                // $this->additionalJS_submit:
                if ($this->additionalJS_submit) {
                        $additionalJS_submit = implode('', $this->additionalJS_submit);
                // $this->additionalJS_submit:
                if ($this->additionalJS_submit) {
                        $additionalJS_submit = implode('', $this->additionalJS_submit);
-                       $additionalJS_submit = str_replace(CR, '', $additionalJS_submit);
-                       $additionalJS_submit = str_replace(LF, '', $additionalJS_submit);
+                       $additionalJS_submit = str_replace(array(CR, LF), '', $additionalJS_submit);
                        $out .= '
                        TBE_EDITOR.addActionChecks("submit", "' . addslashes($additionalJS_submit) . '");
                        ';
                        $out .= '
                        TBE_EDITOR.addActionChecks("submit", "' . addslashes($additionalJS_submit) . '");
                        ';
index cb3d4d3..c48e04b 100644 (file)
@@ -3206,16 +3206,29 @@ class BackendUtility {
                        }
                        $whereClause = implode('', $whereClauseParts);
                }
                        }
                        $whereClause = implode('', $whereClauseParts);
                }
-               $whereClause = str_replace('###CURRENT_PID###', intval($tsConfig['_CURRENT_PID']), $whereClause);
-               $whereClause = str_replace('###THIS_UID###', intval($tsConfig['_THIS_UID']), $whereClause);
-               $whereClause = str_replace('###THIS_CID###', intval($tsConfig['_THIS_CID']), $whereClause);
-               $whereClause = str_replace('###STORAGE_PID###', intval($tsConfig['_STORAGE_PID']), $whereClause);
-               $whereClause = str_replace('###SITEROOT###', intval($tsConfig['_SITEROOT']), $whereClause);
-               $whereClause = str_replace('###PAGE_TSCONFIG_ID###', intval($tsConfig[$field]['PAGE_TSCONFIG_ID']), $whereClause);
-               $whereClause = str_replace('###PAGE_TSCONFIG_IDLIST###', $GLOBALS['TYPO3_DB']->cleanIntList($tsConfig[$field]['PAGE_TSCONFIG_IDLIST']), $whereClause);
-               $whereClause = str_replace('###PAGE_TSCONFIG_STR###', $GLOBALS['TYPO3_DB']->quoteStr($tsConfig[$field]['PAGE_TSCONFIG_STR'], $table), $whereClause);
-
-               return $whereClause;
+               return str_replace (
+                       array (
+                               '###CURRENT_PID###',
+                               '###THIS_UID###',
+                               '###THIS_CID###',
+                               '###STORAGE_PID###',
+                               '###SITEROOT###',
+                               '###PAGE_TSCONFIG_ID###',
+                               '###PAGE_TSCONFIG_IDLIST###',
+                               '###PAGE_TSCONFIG_STR###'
+                       ),
+                       array(
+                               intval($tsConfig['_CURRENT_PID']),
+                               intval($tsConfig['_THIS_UID']),
+                               intval($tsConfig['_THIS_CID']),
+                               intval($tsConfig['_STORAGE_PID']),
+                               intval($tsConfig['_SITEROOT']),
+                               intval($tsConfig[$field]['PAGE_TSCONFIG_ID']),
+                               $GLOBALS['TYPO3_DB']->cleanIntList($tsConfig[$field]['PAGE_TSCONFIG_IDLIST']),
+                               $GLOBALS['TYPO3_DB']->quoteStr($tsConfig[$field]['PAGE_TSCONFIG_STR'], $table)
+                       ),
+                       $whereClause
+               );
        }
 
        /**
        }
 
        /**
index 9b0591a..469d499 100644 (file)
@@ -193,8 +193,7 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface {
                                        $pathAndFilename = str_replace(FLOW3_PATH_PACKAGES, '', $pathAndFilename);
                                        $matches = array();
                                        if (preg_match('/[^\\/]+\\/(.+)\\/(Classes|Tests)\\/(.+)\\.php/', $pathAndFilename, $matches) === 1) {
                                        $pathAndFilename = str_replace(FLOW3_PATH_PACKAGES, '', $pathAndFilename);
                                        $matches = array();
                                        if (preg_match('/[^\\/]+\\/(.+)\\/(Classes|Tests)\\/(.+)\\.php/', $pathAndFilename, $matches) === 1) {
-                                               $classNameWithUnderscores = str_replace('/', '_', $matches[1] . '_' . ($matches[2] === 'Tests' ? 'Tests_' : '') . $matches[3]);
-                                               $classNameWithUnderscores = str_replace('.', '_', $classNameWithUnderscores);
+                                               $classNameWithUnderscores = str_replace(array('/', '.'), '_', $matches[1] . '_' . ($matches[2] === 'Tests' ? 'Tests_' : '') . $matches[3]);
                                                $modifiedClassNamesWithUnderscores[$classNameWithUnderscores] = TRUE;
                                                // If an aspect was modified, the whole code cache needs to be flushed, so keep track of them:
                                                if (substr($classNameWithUnderscores, -6, 6) === 'Aspect') {
                                                $modifiedClassNamesWithUnderscores[$classNameWithUnderscores] = TRUE;
                                                // If an aspect was modified, the whole code cache needs to be flushed, so keep track of them:
                                                if (substr($classNameWithUnderscores, -6, 6) === 'Aspect') {
index 24c0821..9949b22 100644 (file)
@@ -157,9 +157,16 @@ Uncaught TYPO3 Exception ' . $exceptionCodeNumber . $exception->getMessage() . L
                                                        $arguments .= '<span style="color:#FF8700;"><em>' . get_class($argument) . '</em></span>';
                                                } elseif (is_string($argument)) {
                                                        $preparedArgument = strlen($argument) < 100 ? $argument : substr($argument, 0, 50) . '#tripleDot#' . substr($argument, -50);
                                                        $arguments .= '<span style="color:#FF8700;"><em>' . get_class($argument) . '</em></span>';
                                                } elseif (is_string($argument)) {
                                                        $preparedArgument = strlen($argument) < 100 ? $argument : substr($argument, 0, 50) . '#tripleDot#' . substr($argument, -50);
-                                                       $preparedArgument = htmlspecialchars($preparedArgument);
-                                                       $preparedArgument = str_replace('#tripleDot#', '<span style="color:white;">&hellip;</span>', $preparedArgument);
-                                                       $preparedArgument = str_replace(LF, '<span style="color:white;">&crarr;</span>', $preparedArgument);
+                                                       $preparedArgument = str_replace(
+                                                               array(
+                                                                       '#tripleDot#',
+                                                                       LF),
+                                                               array(
+                                                                       '<span style="color:white;">&hellip;</span>',
+                                                                       '<span style="color:white;">&crarr;</span>'
+                                                               ),
+                                                               htmlspecialchars($preparedArgument)
+                                                       );
                                                        $arguments .= '"<span style="color:#FF8700;" title="' . htmlspecialchars($argument) . '">' . $preparedArgument . '</span>"';
                                                } elseif (is_numeric($argument)) {
                                                        $arguments .= '<span style="color:#FF8700;">' . (string) $argument . '</span>';
                                                        $arguments .= '"<span style="color:#FF8700;" title="' . htmlspecialchars($argument) . '">' . $preparedArgument . '</span>"';
                                                } elseif (is_numeric($argument)) {
                                                        $arguments .= '<span style="color:#FF8700;">' . (string) $argument . '</span>';
index 78c7722..d0f1c5c 100644 (file)
@@ -202,6 +202,8 @@ class HtmlParser {
        static public function substituteMarkerArray($content, $markContentArray, $wrap = '', $uppercase = FALSE, $deleteUnused = FALSE) {
                if (is_array($markContentArray)) {
                        $wrapArr = GeneralUtility::trimExplode('|', $wrap);
        static public function substituteMarkerArray($content, $markContentArray, $wrap = '', $uppercase = FALSE, $deleteUnused = FALSE) {
                if (is_array($markContentArray)) {
                        $wrapArr = GeneralUtility::trimExplode('|', $wrap);
+                       $search = array();
+                       $replace = array();
                        foreach ($markContentArray as $marker => $markContent) {
                                if ($uppercase) {
                                        // use strtr instead of strtoupper to avoid locale problems with Turkish
                        foreach ($markContentArray as $marker => $markContent) {
                                if ($uppercase) {
                                        // use strtr instead of strtoupper to avoid locale problems with Turkish
@@ -210,8 +212,11 @@ class HtmlParser {
                                if (count($wrapArr) > 0) {
                                        $marker = $wrapArr[0] . $marker . $wrapArr[1];
                                }
                                if (count($wrapArr) > 0) {
                                        $marker = $wrapArr[0] . $marker . $wrapArr[1];
                                }
-                               $content = str_replace($marker, $markContent, $content);
+                               $search[] = $marker;
+                               $replace[] = $markContent;
                        }
                        }
+                       $content = str_replace($search, $replace, $content);
+                       unset($search, $replace);
                        if ($deleteUnused) {
                                if (empty($wrap)) {
                                        $wrapArr = array('###', '###');
                        if ($deleteUnused) {
                                if (empty($wrap)) {
                                        $wrapArr = array('###', '###');
@@ -985,10 +990,7 @@ class HtmlParser {
                } elseif ($dir == 2) {
                        $value = GeneralUtility::deHSCentities(htmlspecialchars($value));
                } elseif ($dir == -1) {
                } elseif ($dir == 2) {
                        $value = GeneralUtility::deHSCentities(htmlspecialchars($value));
                } elseif ($dir == -1) {
-                       $value = str_replace('&gt;', '>', $value);
-                       $value = str_replace('&lt;', '<', $value);
-                       $value = str_replace('&quot;', '"', $value);
-                       $value = str_replace('&amp;', '&', $value);
+                       $value = GeneralUtility::htmlspecialchars_decode($value);
                }
                return $value;
        }
                }
                return $value;
        }
index bdd15ec..e1cd01a 100644 (file)
@@ -287,15 +287,14 @@ class ExtendedTemplateService extends \TYPO3\CMS\Core\TypoScript\TemplateService
        public function substituteCMarkers($all) {
                switch ($this->constantMode) {
                        case 'const':
        public function substituteCMarkers($all) {
                switch ($this->constantMode) {
                        case 'const':
-                               $all = str_replace('##' . $this->Cmarker . '_B##', '<font color="green"><strong>', $all);
-                               $all = str_replace('##' . $this->Cmarker . '_E##', '</strong></font>', $all);
-                               break;
                        case 'subst':
                        case 'subst':
-                               $all = str_replace('##' . $this->Cmarker . '_B##', '<font color="green"><strong>', $all);
-                               $all = str_replace('##' . $this->Cmarker . '_E##', '</strong></font>', $all);
+                               $all = str_replace(
+                                       array('##' . $this->Cmarker . '_B##', '##' . $this->Cmarker . '_E##'),
+                                       array('<font color="green"><strong>', '</strong></font>'),
+                                       $all
+                               );
                                break;
                        default:
                                break;
                        default:
-                               $all = $all;
                }
                return $all;
        }
                }
                return $all;
        }
index 4d2307b..69a0511 100644 (file)
@@ -1009,11 +1009,12 @@ class GeneralUtility {
         * @return string Converted result.
         */
        static public function htmlspecialchars_decode($value) {
         * @return string Converted result.
         */
        static public function htmlspecialchars_decode($value) {
-               $value = str_replace('&gt;', '>', $value);
-               $value = str_replace('&lt;', '<', $value);
-               $value = str_replace('&quot;', '"', $value);
-               $value = str_replace('&amp;', '&', $value);
-               return $value;
+               return str_replace(
+                       array('&gt;', '&lt;', '&quot;', '&amp;'),
+                       array('>', '<', '"', '&'),
+                       $value
+               );
+
        }
 
        /**
        }
 
        /**
index abe4dea..c04bab6 100644 (file)
@@ -1033,11 +1033,19 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                                $images = $this->cObj->stdWrap($images, $conf['imageStdWrapNoWidth.']);
                        }
                }
                                $images = $this->cObj->stdWrap($images, $conf['imageStdWrapNoWidth.']);
                        }
                }
-               $output = $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.']);
-               $output = str_replace('###TEXT###', $content, $output);
-               $output = str_replace('###IMAGES###', $images, $output);
-               $output = str_replace('###CLASSES###', $class, $output);
-               return $output;
+               return str_replace(
+                       array(
+                               '###TEXT###',
+                               '###IMAGES###',
+                               '###CLASSES###'
+                       ),
+                       array(
+                               $content,
+                               $images,
+                               $class
+                       ),
+                       $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.'])
+               );
        }
 
        /***********************************
        }
 
        /***********************************
index ce90210..01f72c5 100644 (file)
@@ -486,12 +486,21 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                        $possibleViewName = $this->viewObjectNamePattern;
                }
 
                        $possibleViewName = $this->viewObjectNamePattern;
                }
 
-               $extensionName = $this->request->getControllerExtensionName();
-               $possibleViewName = str_replace('@extension', $extensionName, $possibleViewName);
-               $possibleViewName = str_replace('@controller', $this->request->getControllerName(), $possibleViewName);
-               $possibleViewName = str_replace('@action', ucfirst($this->request->getControllerActionName()), $possibleViewName);
+               $possibleViewName = str_replace(
+                       array(
+                               '@extension',
+                               '@controller',
+                               '@action'
+                       ),
+                       array(
+                               $this->request->getControllerExtensionName(),
+                               $this->request->getControllerName(),
+                               ucfirst($this->request->getControllerActionName())
+                       ),
+                       $possibleViewName
+               );
                $format = $this->request->getFormat();
                $format = $this->request->getFormat();
-               $viewObjectName = str_replace('@format', ucfirst($this->request->getFormat()), $possibleViewName);
+               $viewObjectName = str_replace('@format', ucfirst($format), $possibleViewName);
                if (class_exists($viewObjectName) === FALSE) {
                        $viewObjectName = str_replace('@format', '', $possibleViewName);
                }
                if (class_exists($viewObjectName) === FALSE) {
                        $viewObjectName = str_replace('@format', '', $possibleViewName);
                }
index 1eebca4..6a3c799 100644 (file)
@@ -167,21 +167,43 @@ class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface {
        public function getControllerObjectName() {
                if (NULL !== $this->controllerVendorName) {
                        // It's safe to assume a namespaced name as namespaced names have to follow PSR-0
        public function getControllerObjectName() {
                if (NULL !== $this->controllerVendorName) {
                        // It's safe to assume a namespaced name as namespaced names have to follow PSR-0
-                       $lowercaseObjectName = str_replace('@extension', $this->controllerExtensionName, $this->namespacedControllerObjectNamePattern);
-                       $lowercaseObjectName = str_replace('@subpackage', $this->controllerSubpackageKey, $lowercaseObjectName);
-                       $lowercaseObjectName = str_replace('@controller', $this->controllerName, $lowercaseObjectName);
-                       $lowercaseObjectName = str_replace('@vendor', $this->controllerVendorName, $lowercaseObjectName);
-                       $lowercaseObjectName = str_replace('\\\\', '\\', $lowercaseObjectName);
+                       $objectName = str_replace(
+                               array(
+                                       '@extension',
+                                       '@subpackage',
+                                       '@controller',
+                                       '@vendor',
+                                       '\\\\'
+                               ),
+                               array(
+                                       $this->controllerExtensionName,
+                                       $this->controllerSubpackageKey,
+                                       $this->controllerName,
+                                       $this->controllerVendorName,
+                                       '\\'
+                               ),
+                               $this->namespacedControllerObjectNamePattern
+                       );
                } else {
                } else {
-                       $lowercaseObjectName = str_replace('@extension', $this->controllerExtensionName, $this->controllerObjectNamePattern);
-                       $lowercaseObjectName = str_replace('@subpackage', $this->controllerSubpackageKey, $lowercaseObjectName);
-                       $lowercaseObjectName = str_replace('@controller', $this->controllerName, $lowercaseObjectName);
-                       $lowercaseObjectName = str_replace('__', '_', $lowercaseObjectName);
+                       $objectName = str_replace(
+                               array(
+                                       '@extension',
+                                       '@subpackage',
+                                       '@controller',
+                                       '__'
+                               ),
+                               array(
+                                       $this->controllerExtensionName,
+                                       $this->controllerSubpackageKey,
+                                       $this->controllerName,
+                                       '_'
+                               ),
+                               $this->controllerObjectNamePattern
+                       );
                }
                // TODO implement getCaseSensitiveObjectName()
                }
                // TODO implement getCaseSensitiveObjectName()
-               $objectName = $lowercaseObjectName;
                if ($objectName === FALSE) {
                if ($objectName === FALSE) {
-                       throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchControllerException('The controller object "' . $lowercaseObjectName . '" does not exist.', 1220884009);
+                       throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchControllerException('The controller object "' . $objectName . '" does not exist.', 1220884009);
                }
                return $objectName;
        }
                }
                return $objectName;
        }
index d8d8320..93f97f6 100644 (file)
@@ -272,8 +272,17 @@ class TemplateParser {
         * inserting the correct namespace separator.
         */
        public function __construct() {
         * inserting the correct namespace separator.
         */
        public function __construct() {
-               self::$SCAN_PATTERN_NAMESPACEDECLARATION = str_replace('LEGACY_NAMESPACE_SEPARATOR', preg_quote(\TYPO3\CMS\Fluid\Fluid::LEGACY_NAMESPACE_SEPARATOR), self::$SCAN_PATTERN_NAMESPACEDECLARATION);
-               self::$SCAN_PATTERN_NAMESPACEDECLARATION = str_replace('FLUID_NAMESPACE_SEPARATOR', preg_quote(\TYPO3\CMS\Fluid\Fluid::NAMESPACE_SEPARATOR), self::$SCAN_PATTERN_NAMESPACEDECLARATION);
+               self::$SCAN_PATTERN_NAMESPACEDECLARATION = str_replace(
+                       array(
+                               'LEGACY_NAMESPACE_SEPARATOR',
+                               'FLUID_NAMESPACE_SEPARATOR'
+                       ),
+                       array(
+                               preg_quote(\TYPO3\CMS\Fluid\Fluid::LEGACY_NAMESPACE_SEPARATOR),
+                               preg_quote(\TYPO3\CMS\Fluid\Fluid::NAMESPACE_SEPARATOR)
+                       ),
+                       self::$SCAN_PATTERN_NAMESPACEDECLARATION
+               );
        }
 
        /**
        }
 
        /**
index 16664e7..f628c1e 100644 (file)
@@ -148,9 +148,11 @@ class BetweenValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator impl
         * @return string Message text with substituted markers
         */
        protected function substituteValues($message) {
         * @return string Message text with substituted markers
         */
        protected function substituteValues($message) {
-               $message = str_replace('%minimum', $this->minimum, $message);
-               $message = str_replace('%maximum', $this->maximum, $message);
-               return $message;
+               return str_replace(
+                       array('%minimum', '%maximum'),
+                       array($this->minimum, $this->maximum),
+                       $message
+               );
        }
 
 }
        }
 
 }
index d79c862..a19e5ab 100644 (file)
@@ -41,10 +41,21 @@ class FloatValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator {
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        $locale = localeconv();
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        $locale = localeconv();
-                       $valueFiltered = str_replace($locale['thousands_sep'], '', $value);
-                       $valueFiltered = str_replace($locale['mon_thousands_sep'], '', $value);
-                       $valueFiltered = str_replace($locale['decimal_point'], '.', $valueFiltered);
-                       $valueFiltered = str_replace($locale['mon_decimal_point'], '.', $valueFiltered);
+                       $valueFiltered = str_replace(
+                               array(
+                                       $locale['thousands_sep'],
+                                       $locale['mon_thousands_sep'],
+                                       $locale['decimal_point'],
+                                       $locale['mon_decimal_point']
+                               ),
+                               array(
+                                       '',
+                                       '',
+                                       '.',
+                                       '.'
+                               ),
+                               $value
+                       );
                        if ($valueFiltered != strval(floatval($valueFiltered))) {
                                return FALSE;
                        }
                        if ($valueFiltered != strval(floatval($valueFiltered))) {
                                return FALSE;
                        }
index b7e2053..c34b95e 100644 (file)
@@ -41,10 +41,21 @@ class IntegerValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator {
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        $locale = localeconv();
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        $locale = localeconv();
-                       $valueFiltered = str_replace($locale['thousands_sep'], '', $value);
-                       $valueFiltered = str_replace($locale['mon_thousands_sep'], '', $value);
-                       $valueFiltered = str_replace($locale['decimal_point'], '.', $valueFiltered);
-                       $valueFiltered = str_replace($locale['mon_decimal_point'], '.', $valueFiltered);
+                       $valueFiltered = str_replace(
+                               array(
+                                       $locale['thousands_sep'],
+                                       $locale['mon_thousands_sep'],
+                                       $locale['decimal_point'],
+                                       $locale['mon_decimal_point']
+                               ),
+                               array(
+                                       '',
+                                       '',
+                                       '.',
+                                       '.'
+                               ),
+                               $value
+                       );
                        if (strval(intval($valueFiltered)) != $valueFiltered) {
                                return FALSE;
                        }
                        if (strval(intval($valueFiltered)) != $valueFiltered) {
                                return FALSE;
                        }
index 9cde9ea..2faf628 100644 (file)
@@ -135,9 +135,11 @@ class LengthValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator {
         * @return string Message text with substituted markers
         */
        protected function substituteValues($message) {
         * @return string Message text with substituted markers
         */
        protected function substituteValues($message) {
-               $message = str_replace('%minimum', $this->minimum, $message);
-               $message = str_replace('%maximum', $this->maximum, $message);
-               return $message;
+               return str_replace(
+                       array('%minimum', '%maximum'),
+                       array($this->minimum, $this->maximum),
+                       $message
+               );
        }
 
 }
        }
 
 }
index 9302080..a54b364 100644 (file)
@@ -6171,9 +6171,17 @@ class ContentObjectRenderer {
                                                // If link is to a access restricted page which should be redirected, then find new URL:
                                                if ($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] && $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] !== 'NONE' && !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
                                                        $thePage = $GLOBALS['TSFE']->sys_page->getPage($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages']);
                                                // If link is to a access restricted page which should be redirected, then find new URL:
                                                if ($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] && $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] !== 'NONE' && !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
                                                        $thePage = $GLOBALS['TSFE']->sys_page->getPage($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages']);
-                                                       $addParams = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages_addParams'];
-                                                       $addParams = str_replace('###RETURN_URL###', rawurlencode($this->lastTypoLinkUrl), $addParams);
-                                                       $addParams = str_replace('###PAGE_ID###', $page['uid'], $addParams);
+                                                       $addParams = str_replace(
+                                                               array(
+                                                                       '###RETURN_URL###',
+                                                                       '###PAGE_ID###'
+                                                               ),
+                                                               array(
+                                                                       rawurlencode($this->lastTypoLinkUrl),
+                                                                       $page['uid']
+                                                               ),
+                                                               $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages_addParams']
+                                                       );
                                                        $this->lastTypoLinkUrl = $this->getTypoLink_URL($thePage['uid'] . ($theTypeP ? ',' . $theTypeP : ''), $addParams, $target);
                                                        $this->lastTypoLinkUrl = $this->forceAbsoluteUrl($this->lastTypoLinkUrl, $conf);
                                                        $this->lastTypoLinkLD['totalUrl'] = $this->lastTypoLinkUrl;
                                                        $this->lastTypoLinkUrl = $this->getTypoLink_URL($thePage['uid'] . ($theTypeP ? ',' . $theTypeP : ''), $addParams, $target);
                                                        $this->lastTypoLinkUrl = $this->forceAbsoluteUrl($this->lastTypoLinkUrl, $conf);
                                                        $this->lastTypoLinkLD['totalUrl'] = $this->lastTypoLinkUrl;
index 45ddaf6..799968b 100644 (file)
@@ -511,11 +511,20 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                                        $result = $labelLayout;
                                                }
                                        }
                                                        $result = $labelLayout;
                                                }
                                        }
-                                       $result = str_replace('###FIELD###', $fieldCode, $result);
-                                       $result = str_replace('###LABEL###', $labelCode, $result);
-                                       $result = str_replace('###COMMENT###', $commentCode, $result);
                                        //RTF
                                        //RTF
-                                       $content .= $result;
+                                       $content .= str_replace(
+                                               array(
+                                                       '###FIELD###',
+                                                       '###LABEL###',
+                                                       '###COMMENT###'
+                                               ),
+                                               array(
+                                                       $fieldCode,
+                                                       $labelCode,
+                                                       $commentCode
+                                               ),
+                                               $result
+                                       );
                                }
                        }
                }
                                }
                        }
                }
index 3216bd2..ed395b9 100644 (file)
@@ -1357,9 +1357,17 @@ class AbstractMenuContentObject {
                // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
                if ($this->mconf['showAccessRestrictedPages'] && $this->mconf['showAccessRestrictedPages'] !== 'NONE' && !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
                        $thePage = $this->sys_page->getPage($this->mconf['showAccessRestrictedPages']);
                // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
                if ($this->mconf['showAccessRestrictedPages'] && $this->mconf['showAccessRestrictedPages'] !== 'NONE' && !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
                        $thePage = $this->sys_page->getPage($this->mconf['showAccessRestrictedPages']);
-                       $addParams = $this->mconf['showAccessRestrictedPages.']['addParams'];
-                       $addParams = str_replace('###RETURN_URL###', rawurlencode($LD['totalURL']), $addParams);
-                       $addParams = str_replace('###PAGE_ID###', $page['uid'], $addParams);
+                       $addParams = str_replace(
+                               array(
+                                       '###RETURN_URL###',
+                                       '###PAGE_ID###'
+                               ),
+                               array(
+                                       rawurlencode($LD['totalURL']),
+                                       $page['uid']
+                               ),
+                               $this->mconf['showAccessRestrictedPages.']['addParams']
+                       );
                        $LD = $this->menuTypoLink($thePage, $mainTarget, '', '', '', $addParams, $typeOverride);
                }
        }
                        $LD = $this->menuTypoLink($thePage, $mainTarget, '', '', '', $addParams, $typeOverride);
                }
        }
index 3278f7a..db09953 100644 (file)
@@ -177,12 +177,14 @@ class ImageMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abst
                                }
                                $gifCreator->start($conf, $GLOBALS['TSFE']->page);
                                // calculations
                                }
                                $gifCreator->start($conf, $GLOBALS['TSFE']->page);
                                // calculations
-                               $sum = array(0, 0, 0, 0);
                                foreach ($waArr as $key => $val) {
                                        if ($dConf[$key] = $itemsConf[$key]['distrib']) {
                                                $textBB = $gifCreator->objBB[$val['textNum']];
                                foreach ($waArr as $key => $val) {
                                        if ($dConf[$key] = $itemsConf[$key]['distrib']) {
                                                $textBB = $gifCreator->objBB[$val['textNum']];
-                                               $dConf[$key] = str_replace('textX', $textBB[0], $dConf[$key]);
-                                               $dConf[$key] = str_replace('textY', $textBB[1], $dConf[$key]);
+                                               $dConf[$key] = str_replace(
+                                                       array('textX', 'textY'),
+                                                       array($textBB[0], $textBB[1]),
+                                                       $dConf[$key]
+                                               );
                                                $dConf[$key] = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $gifCreator->calcOffset($dConf[$key]));
                                        }
                                }
                                                $dConf[$key] = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $gifCreator->calcOffset($dConf[$key]));
                                        }
                                }
index bc1e9c8..dfd3290 100644 (file)
@@ -76,9 +76,17 @@ class QuicktimeObjectContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abs
                }
                $params = ($params ? substr($params, 0, -2) : '') . LF . $qtObject . '.write("' . $replaceElementIdString . '");';
                $alternativeContent = isset($conf['alternativeContent.']) ? $this->cObj->stdWrap($conf['alternativeContent'], $conf['alternativeContent.']) : $conf['alternativeContent'];
                }
                $params = ($params ? substr($params, 0, -2) : '') . LF . $qtObject . '.write("' . $replaceElementIdString . '");';
                $alternativeContent = isset($conf['alternativeContent.']) ? $this->cObj->stdWrap($conf['alternativeContent'], $conf['alternativeContent.']) : $conf['alternativeContent'];
-               $layout = isset($conf['layout.']) ? $this->cObj->stdWrap($conf['layout'], $conf['layout.']) : $conf['layout'];
-               $layout = str_replace('###ID###', $replaceElementIdString, $layout);
-               $layout = str_replace('###QTOBJECT###', '<div id="' . $replaceElementIdString . '">' . $alternativeContent . '</div>', $layout);
+               $layout = str_replace(
+                       array(
+                               '###ID###',
+                               '###QTOBJECT###'
+                       ),
+                       array(
+                               $replaceElementIdString,
+                               '<div id="' . $replaceElementIdString . '">' . $alternativeContent . '</div>'
+                       ),
+                       isset($conf['layout.']) ? $this->cObj->stdWrap($conf['layout'], $conf['layout.']) : $conf['layout']
+               );
                $width = isset($conf['width.']) ? $this->cObj->stdWrap($conf['width'], $conf['width.']) : $conf['width'];
                if (!$width) {
                        $width = $conf[$type . '.']['defaultWidth'];
                $width = isset($conf['width.']) ? $this->cObj->stdWrap($conf['width'], $conf['width.']) : $conf['width'];
                if (!$width) {
                        $width = $conf[$type . '.']['defaultWidth'];
index 872ecb9..81c9b4e 100644 (file)
@@ -238,10 +238,19 @@ class SearchResultContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstra
                                $targetPart = $LD['target'] ? ' target="' . htmlspecialchars($LD['target']) . '"' : '';
                                $urlParams = $this->cObj->URLqMark($LD['totalURL'], '&sword=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sword')) . '&scols=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('scols')) . '&stype=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('stype')) . '&scount=' . $total);
                                // substitution:
                                $targetPart = $LD['target'] ? ' target="' . htmlspecialchars($LD['target']) . '"' : '';
                                $urlParams = $this->cObj->URLqMark($LD['totalURL'], '&sword=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sword')) . '&scols=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('scols')) . '&stype=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('stype')) . '&scount=' . $total);
                                // substitution:
-                               $result = $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.'], 'layout');
-                               $result = str_replace('###RANGELOW###', $rangeLow, $result);
-                               $result = str_replace('###RANGEHIGH###', $rangeHigh, $result);
-                               $result = str_replace('###TOTAL###', $total, $result);
+                               $result = str_replace(
+                                       array(
+                                               '###RANGELOW###',
+                                               '###RANGEHIGH###',
+                                               '###TOTAL###'
+                                       ),
+                                       array(
+                                               $rangeLow,
+                                               $rangeHigh,
+                                               $total
+                                       ),
+                                       $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.'], 'layout')
+                               );
                                if ($rangeHigh < $total) {
                                        $next = $this->cObj->cObjGetSingle($conf['next'], $conf['next.'], 'next');
                                        $next = '<a href="' . htmlspecialchars(($urlParams . '&spointer=' . ($spointer + $theRange))) . '"' . $targetPart . $GLOBALS['TSFE']->ATagParams . '>' . $next . '</a>';
                                if ($rangeHigh < $total) {
                                        $next = $this->cObj->cObjGetSingle($conf['next'], $conf['next.'], 'next');
                                        $next = '<a href="' . htmlspecialchars(($urlParams . '&spointer=' . ($spointer + $theRange))) . '"' . $targetPart . $GLOBALS['TSFE']->ATagParams . '>' . $next . '</a>';
index e009928..8615e60 100644 (file)
@@ -267,8 +267,11 @@ class DataSubmissionController {
                if ($this->autoRespondMessage) {
                        $theParts = explode('/', $this->autoRespondMessage, 2);
                        $theParts[0] = str_replace('###SUBJECT###', $this->subject, $theParts[0]);
                if ($this->autoRespondMessage) {
                        $theParts = explode('/', $this->autoRespondMessage, 2);
                        $theParts[0] = str_replace('###SUBJECT###', $this->subject, $theParts[0]);
-                       $theParts[1] = str_replace('/', LF, $theParts[1]);
-                       $theParts[1] = str_replace('###MESSAGE###', $this->plainContent, $theParts[1]);
+                       $theParts[1] = str_replace(
+                               array('/', '###MESSAGE###'),
+                               array(LF, $this->plainContent),
+                               $theParts[1]
+                       );
                        /** @var $autoRespondMail \TYPO3\CMS\Core\Mail\MailMessage */
                        $autoRespondMail = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
                        $autoRespondMail->setTo($this->fromAddress)->setSubject($theParts[0])->setFrom($this->recipient)->setBody($theParts[1]);
                        /** @var $autoRespondMail \TYPO3\CMS\Core\Mail\MailMessage */
                        $autoRespondMail = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
                        $autoRespondMail->setTo($this->fromAddress)->setSubject($theParts[0])->setFrom($this->recipient)->setBody($theParts[1]);
index 7698dfc..b4aa062 100644 (file)
@@ -1919,10 +1919,17 @@ class TypoScriptFrontendController {
                } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($code, 'READFILE:')) {
                        $readFile = GeneralUtility::getFileAbsFileName(trim(substr($code, 9)));
                        if (@is_file($readFile)) {
                } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($code, 'READFILE:')) {
                        $readFile = GeneralUtility::getFileAbsFileName(trim(substr($code, 9)));
                        if (@is_file($readFile)) {
-                               $fileContent = GeneralUtility::getUrl($readFile);
-                               $fileContent = str_replace('###CURRENT_URL###', GeneralUtility::getIndpEnv('REQUEST_URI'), $fileContent);
-                               $fileContent = str_replace('###REASON###', htmlspecialchars($reason), $fileContent);
-                               echo $fileContent;
+                               echo str_replace(
+                                       array(
+                                               '###CURRENT_URL###',
+                                               '###REASON###'
+                                       ),
+                                       array(
+                                               GeneralUtility::getIndpEnv('REQUEST_URI'),
+                                               htmlspecialchars($reason)
+                                       ),
+                                       GeneralUtility::getUrl($readFile)
+                               );
                        } else {
                                throw new \RuntimeException('Configuration Error: 404 page "' . $readFile . '" could not be found.', 1294587214);
                        }
                        } else {
                                throw new \RuntimeException('Configuration Error: 404 page "' . $readFile . '" could not be found.', 1294587214);
                        }
@@ -3405,10 +3412,19 @@ class TypoScriptFrontendController {
                $this->recursivelyReplaceIntPlaceholdersInContent();
                $GLOBALS['TT']->push('Substitute header section');
                $this->INTincScript_loadJSCode();
                $this->recursivelyReplaceIntPlaceholdersInContent();
                $GLOBALS['TT']->push('Substitute header section');
                $this->INTincScript_loadJSCode();
-               $this->content = $this->getPageRenderer()->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config['INTincScript_ext']['divKey']);
-               $this->content = str_replace('<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->', $this->convOutputCharset(implode(LF, $this->additionalHeaderData), 'HD'), $this->content);
-               $this->content = str_replace('<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->', $this->convOutputCharset(implode(LF, $this->additionalFooterData), 'FD'), $this->content);
-               $this->content = str_replace('<!--TDS_' . $this->config['INTincScript_ext']['divKey'] . '-->', $this->convOutputCharset($this->divSection, 'TDS'), $this->content);
+               $this->content = str_replace(
+                       array(
+                               '<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->',
+                               '<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->',
+                               '<!--TDS_' . $this->config['INTincScript_ext']['divKey'] . '-->'
+                       ),
+                       array(
+                               $this->convOutputCharset(implode(LF, $this->additionalHeaderData), 'HD'),
+                               $this->convOutputCharset(implode(LF, $this->additionalFooterData), 'FD'),
+                               $this->convOutputCharset($this->divSection, 'TDS'),
+                       ),
+                       $this->getPageRenderer()->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config['INTincScript_ext']['divKey'])
+               );
                // Replace again, because header and footer data and page renderer replacements may introduce additional placeholders (see #44825)
                $this->recursivelyReplaceIntPlaceholdersInContent();
                $this->setAbsRefPrefix();
                // Replace again, because header and footer data and page renderer replacements may introduce additional placeholders (see #44825)
                $this->recursivelyReplaceIntPlaceholdersInContent();
                $this->setAbsRefPrefix();
@@ -4103,20 +4119,38 @@ if (version == "n3") {
         * @todo Define visibility
         */
        public function setAbsRefPrefix() {
         * @todo Define visibility
         */
        public function setAbsRefPrefix() {
-               if ($this->absRefPrefix) {
-                       $this->content = str_replace('"typo3temp/', '"' . $this->absRefPrefix . 'typo3temp/', $this->content);
-                       $this->content = str_replace('"typo3conf/ext/', '"' . $this->absRefPrefix . 'typo3conf/ext/', $this->content);
-                       $this->content = str_replace('"' . TYPO3_mainDir . 'contrib/', '"' . $this->absRefPrefix . TYPO3_mainDir . 'contrib/', $this->content);
-                       $this->content = str_replace('"' . TYPO3_mainDir . 'ext/', '"' . $this->absRefPrefix . TYPO3_mainDir . 'ext/', $this->content);
-                       $this->content = str_replace('"' . TYPO3_mainDir . 'sysext/', '"' . $this->absRefPrefix . TYPO3_mainDir . 'sysext/', $this->content);
-                       $this->content = str_replace('"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '"' . $this->absRefPrefix . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], $this->content);
-                       $this->content = str_replace('"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'], '"' . $this->absRefPrefix . $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'], $this->content);
-                       // Process additional directories
-                       $directories = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['additionalAbsRefPrefixDirectories'], TRUE);
-                       foreach ($directories as $directory) {
-                               $this->content = str_replace('"' . $directory, '"' . $this->absRefPrefix . $directory, $this->content);
-                       }
+               if (!$this->absRefPrefix) {
+                       return;
                }
                }
+               $search = array(
+                       '"typo3temp/',
+                       '"typo3conf/ext/',
+                       '"' . TYPO3_mainDir . 'contrib/',
+                       '"' . TYPO3_mainDir . 'ext/',
+                       '"' . TYPO3_mainDir . 'sysext/',
+                       '"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
+                       '"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']
+               );
+               $replace = array(
+                       '"' . $this->absRefPrefix . 'typo3temp/',
+                       '"' . $this->absRefPrefix . 'typo3conf/ext/',
+                       '"' . $this->absRefPrefix . TYPO3_mainDir . 'contrib/',
+                       '"' . $this->absRefPrefix . TYPO3_mainDir . 'ext/',
+                       '"' . $this->absRefPrefix . TYPO3_mainDir . 'sysext/',
+                       '"' . $this->absRefPrefix . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
+                       '"' . $this->absRefPrefix . $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']
+               );
+               // Process additional directories
+               $directories = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['additionalAbsRefPrefixDirectories'], TRUE);
+               foreach ($directories as $directory) {
+                       $search[] = '"' . $directory;
+                       $replace[] = '"' . $this->absRefPrefix . $directory;
+               }
+               $this->content = str_replace(
+                       $search,
+                       $replace,
+                       $this->content
+               );
        }
 
        /**
        }
 
        /**
index 7697fe8..e4ce04e 100644 (file)
@@ -1626,9 +1626,11 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
                        ' . implode('', $links) . '
                </ul>';
                }
                        ' . implode('', $links) . '
                </ul>';
                }
-               $label = $this->pi_getLL('pi_list_browseresults_display', 'Displaying results ###TAG_BEGIN###%s to %s###TAG_END### out of ###TAG_BEGIN###%s###TAG_END###');
-               $label = str_replace('###TAG_BEGIN###', '<strong>', $label);
-               $label = str_replace('###TAG_END###', '</strong>', $label);
+               $label = str_replace(
+                       array('###TAG_BEGIN###', '###TAG_END###'),
+                       array('<strong>', '</strong>'),
+                       $this->pi_getLL('pi_list_browseresults_display', 'Displaying results ###TAG_BEGIN###%s to %s###TAG_END### out of ###TAG_BEGIN###%s###TAG_END###')
+               );
                $sTables = '<div' . $this->pi_classParam('browsebox') . '>' . ($showResultCount ? '<p>' . sprintf($label, $pR1, min(array($this->internal['res_count'], $pR2)), $this->internal['res_count']) . $addString . '</p>' : '') . $addPart . '</div>';
                return $sTables;
        }
                $sTables = '<div' . $this->pi_classParam('browsebox') . '>' . ($showResultCount ? '<p>' . sprintf($label, $pR1, min(array($this->internal['res_count'], $pR2)), $this->internal['res_count']) . $addString . '</p>' : '') . $addPart . '</div>';
                return $sTables;
        }
index 39659ac..77dbe2d 100644 (file)
@@ -206,42 +206,86 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
                if (is_array($errorParams['page'])) {
                        switch ($errorType['page']) {
                                case self::DELETED:
                if (is_array($errorParams['page'])) {
                        switch ($errorType['page']) {
                                case self::DELETED:
-                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagedeleted');
-                                       $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
-                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                                       $errorPage = str_replace(
+                                               array(
+                                                       '###title###',
+                                                       '###uid###'
+                                               ),
+                                               array(
+                                                       $errorParams['page']['title'],
+                                                       $errorParams['page']['uid']
+                                               ),
+                                               $GLOBALS['LANG']->getLL('list.report.pagedeleted')
+                                       );
                                break;
                                case self::HIDDEN:
                                break;
                                case self::HIDDEN:
-                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotvisible');
-                                       $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
-                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                                       $errorPage = str_replace(
+                                               array(
+                                                       '###title###',
+                                                       '###uid###'
+                                               ),
+                                               array(
+                                                       $errorParams['page']['title'],
+                                                       $errorParams['page']['uid']
+                                               ),
+                                               $GLOBALS['LANG']->getLL('list.report.pagenotvisible')
+                                       );
                                break;
                                default:
                                break;
                                default:
-                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotexisting');
-                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                                       $errorPage = str_replace(
+                                               '###uid###',
+                                               $errorParams['page']['uid'],
+                                               $GLOBALS['LANG']->getLL('list.report.pagenotexisting')
+                                       );
                        }
                }
                if (is_array($errorParams['content'])) {
                        switch ($errorType['content']) {
                                case self::DELETED:
                        }
                }
                if (is_array($errorParams['content'])) {
                        switch ($errorType['content']) {
                                case self::DELETED:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentdeleted');
-                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                                       $errorContent = str_replace(
+                                               array(
+                                                       '###title###',
+                                                       '###uid###'
+                                               ),
+                                               array(
+                                                       $errorParams['content']['title'],
+                                                       $errorParams['content']['uid']
+                                               ),
+                                               $GLOBALS['LANG']->getLL('list.report.contentdeleted')
+                                       );
                                break;
                                case self::HIDDEN:
                                break;
                                case self::HIDDEN:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotvisible');
-                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                                       $errorContent = str_replace(
+                                               array(
+                                                       '###title###',
+                                                       '###uid###'
+                                               ),
+                                               array(
+                                                       $errorParams['content']['title'],
+                                                       $errorParams['content']['uid']
+                                               ),
+                                               $GLOBALS['LANG']->getLL('list.report.contentnotvisible')
+                                       );
                                break;
                                case self::MOVED:
                                break;
                                case self::MOVED:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentmoved');
-                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                                       $errorContent = str_replace('###wrongpage###', $errorParams['content']['wrongPage'], $errorContent);
-                                       $errorContent = str_replace('###rightpage###', $errorParams['content']['rightPage'], $errorContent);
+                                       $errorContent = str_replace(
+                                               array(
+                                                       '###title###',
+                                                       '###uid###',
+                                                       '###wrongpage###',
+                                                       '###rightpage###'
+                                               ),
+                                               array(
+                                                       $errorParams['content']['title'],
+                                                       $errorParams['content']['uid'],
+                                                       $errorParams['content']['wrongPage'],
+                                                       $errorParams['content']['rightPage']
+                                               ),
+                                               $GLOBALS['LANG']->getLL('list.report.contentmoved')
+                                       );
                                break;
                                default:
                                break;
                                default:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotexisting');
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $GLOBALS['LANG']->getLL('list.report.contentnotexisting'));
                        }
                }
                if (isset($errorPage) && isset($errorContent)) {
                        }
                }
                if (isset($errorPage) && isset($errorContent)) {
index 83102f7..0291a59 100644 (file)
@@ -118,13 +118,20 @@ class LinkHandler extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
                }
                switch ($errorType) {
                        case self::DELETED:
                }
                switch ($errorType) {
                        case self::DELETED:
-                               $response = $GLOBALS['LANG']->getLL('list.report.rowdeleted');
-                               $response = str_replace('###title###', $title, $response);
-                               $response = str_replace('###uid###', $errorParams['uid'], $response);
+                               $response = str_replace(
+                                       array(
+                                               '###title###',
+                                               '###uid###'
+                                       ),
+                                       array(
+                                               $title,
+                                               $errorParams['uid']
+                                       ),
+                                       $GLOBALS['LANG']->getLL('list.report.rowdeleted')
+                               );
                                break;
                        default:
                                break;
                        default:
-                               $response = $GLOBALS['LANG']->getLL('list.report.rownotexisting');
-                               $response = str_replace('###uid###', $errorParams['uid'], $response);
+                               $response = str_replace('###uid###', $errorParams['uid'], $GLOBALS['LANG']->getLL('list.report.rownotexisting'));
                }
                return $response;
        }
                }
                return $response;
        }
index 00fa4fb..46cb67b 100644 (file)
@@ -399,10 +399,12 @@ var selectedDictionary = "' . $this->dictionary . '";
                                        if ($dictionaryContent[1]) {
                                                // Isolate the character set
                                                $dictionaryContent = GeneralUtility::trimExplode(LF, $dictionaryContent[1]);
                                        if ($dictionaryContent[1]) {
                                                // Isolate the character set
                                                $dictionaryContent = GeneralUtility::trimExplode(LF, $dictionaryContent[1]);
-                                               $characterSet = $dictionaryContent[0];
                                                // Fix Aspell character set oddity (i.e. iso8859-1)
                                                // Fix Aspell character set oddity (i.e. iso8859-1)
-                                               $characterSet = str_replace('iso', 'iso-', $characterSet);
-                                               $characterSet = str_replace('--', '-', $characterSet);
+                                               $characterSet = str_replace(
+                                                       array('iso', '--'),
+                                                       array('iso-', '-'),
+                                                       $dictionaryContent[0]
+                                               );
                                        }
                                        if (!$characterSet) {
                                                GeneralUtility::sysLog('SpellChecker main dictionary character set retrieval error: ' . $dictionaryContent[1], $this->extKey, GeneralUtility::SYSLOG_SEVERITY_ERROR);
                                        }
                                        if (!$characterSet) {
                                                GeneralUtility::sysLog('SpellChecker main dictionary character set retrieval error: ' . $dictionaryContent[1], $this->extKey, GeneralUtility::SYSLOG_SEVERITY_ERROR);