[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)
commitff2933b80b0b1cca49bc4360da80ac9d186dd320
treeff97abe6c4afd9308e64821e0412556f8b447160
parent2917b0745dbe038c10e13f5910776dfb02371b12
[TASK] Use arrays in str_replace() calls

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