[TASK] Remove not needed TemplateService code 44/27244/6
authorBenjamin Mack <benni@typo3.org>
Sat, 1 Feb 2014 21:44:26 +0000 (22:44 +0100)
committerBenjamin Mack <benni@typo3.org>
Fri, 25 Jul 2014 11:41:53 +0000 (13:41 +0200)
The TemplateService class provides its own wrap()
function which is exactly the same as in cObj.
The only instances where the wrap() method is used
is in the MenuContentObjects - however, they can
also access the wrap() function via cObj.

The MenuContentObjects are now using the cObj
function so the duplicate code in TemplateService
can be deprecated.

Resolves: #55567
Releases: 6.3
Change-Id: Iaa7055473f814acc73429f31772d1946c66004f9
Reviewed-on: http://review.typo3.org/27244
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/frontend/Classes/ContentObject/Menu/GraphicalMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/ImageMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/JavaScriptMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php

index 415427c..5f3d2f2 100644 (file)
@@ -1369,10 +1369,12 @@ class TemplateService {
         * @param string $content The content to wrap
         * @param string $wrap The wrap value, eg. "<strong> | </strong>
         * @return string Wrapped input string
+        * @deprecated since TYPO3 CMS 6.3, remove later - use \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::wrap() instead
         * @see \TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject, \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::wrap()
         * @todo Define visibility
         */
        public function wrap($content, $wrap) {
+               GeneralUtility::logDeprecatedFunction();
                if ($wrap) {
                        $wrapArr = explode('|', $wrap);
                        return trim($wrapArr[0]) . $content . trim($wrapArr[1]);
index 69d38f7..176a743 100644 (file)
@@ -444,10 +444,10 @@ class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\
                                        $this->I['theItem'] = implode('', $this->I['parts']);
                                        $this->I['theItem'] = $this->extProc_beforeAllWrap($this->I['theItem'], $key);
                                        // wrap:
-                                       $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'], $this->I['val']['wrap']);
+                                       $this->I['theItem'] = $this->WMcObj->wrap($this->I['theItem'], $this->I['val']['wrap']);
                                        // allWrap:
                                        $allWrap = isset($this->I['val']['allWrap.']) ? $this->WMcObj->stdWrap($this->I['val']['allWrap'], $this->I['val']['allWrap.']) : $this->I['val']['allWrap'];
-                                       $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'], $allWrap);
+                                       $this->I['theItem'] = $this->WMcObj->wrap($this->I['theItem'], $allWrap);
                                        if ($this->I['val']['subst_elementUid']) {
                                                $this->I['theItem'] = str_replace('{elementUid}', $this->I['uid'], $this->I['theItem']);
                                        }
@@ -519,7 +519,7 @@ class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\
                        $this->I['theItem'] .= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
                }
                $part = isset($this->I['val']['wrapItemAndSub.']) ? $this->WMcObj->stdWrap($this->I['val']['wrapItemAndSub'], $this->I['val']['wrapItemAndSub.']) : $this->I['val']['wrapItemAndSub'];
-               $this->WMresult .= $part ? $this->tmpl->wrap($this->I['theItem'], $part) : $this->I['theItem'];
+               $this->WMresult .= $part ? $this->WMcObj->wrap($this->I['theItem'], $part) : $this->I['theItem'];
        }
 
        /**
@@ -549,7 +549,7 @@ class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\
                if (is_array($this->mconf['stdWrap.'])) {
                        $this->WMresult = $this->WMcObj->stdWrap($this->WMresult, $this->mconf['stdWrap.']);
                }
-               return $this->tmpl->wrap($this->WMresult, $this->mconf['wrap']) . $this->WMextraScript;
+               return $this->WMcObj->wrap($this->WMresult, $this->mconf['wrap']) . $this->WMextraScript;
        }
 
 }
index eba9729..02ed094 100644 (file)
@@ -236,7 +236,7 @@ class ImageMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abst
                        }
                        $result .= ' /><map name="' . $menuName . '" id="' . $menuName . '">' . $res['imgMap'] . '</map>';
                        $GLOBALS['TSFE']->imagesOnPage[] = $res['output_file'];
-                       return $this->tmpl->wrap($result, $this->mconf['wrap']);
+                       return $this->WMcObj->wrap($result, $this->mconf['wrap']);
                }
        }
 
index 6ae8db3..0635e8d 100644 (file)
@@ -74,12 +74,12 @@ class JavaScriptMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu
                                        $formCode .= '</option>';
                                }
                                $formCode .= '</select>';
-                               $allFormCode .= $this->tmpl->wrap($formCode, $levelConf['wrap']);
+                               $allFormCode .= $this->WMcObj->wrap($formCode, $levelConf['wrap']);
                        }
-                       $formCode = $this->tmpl->wrap($allFormCode, $this->mconf['wrap']);
+                       $formCode = $this->WMcObj->wrap($allFormCode, $this->mconf['wrap']);
                        $formCode = '<form action="" method="post" style="margin: 0 0 0 0;" name="' . $this->JSMenuName . 'Form">' . $formCode . '</form>';
                        $formCode .= '<script type="text/javascript"> /*<![CDATA[*/ ' . $this->JSMenuName . '.writeOut(1,' . $this->JSMenuName . '.openID,1); /*]]>*/ </script>';
-                       return $this->tmpl->wrap($formCode, $this->mconf['wrapAfterTags']);
+                       return $this->WMcObj->wrap($formCode, $this->mconf['wrapAfterTags']);
                }
        }
 
index 44098de..d561543 100644 (file)
@@ -148,7 +148,7 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                                $this->I['theItem'] = $this->extProc_beforeAllWrap($this->I['theItem'], $key);
                                // allWrap:
                                $allWrap = isset($this->I['val']['allWrap.']) ? $this->WMcObj->stdWrap($this->I['val']['allWrap'], $this->I['val']['allWrap.']) : $this->I['val']['allWrap'];
-                               $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'], $allWrap);
+                               $this->I['theItem'] = $this->WMcObj->wrap($this->I['theItem'], $allWrap);
                                if ($this->I['val']['subst_elementUid']) {
                                        $this->I['theItem'] = str_replace('{elementUid}', $this->I['uid'], $this->I['theItem']);
                                }
@@ -189,7 +189,7 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                }
                $processedPref = isset($this->I['val'][$pref . '.']) ? $this->WMcObj->stdWrap($this->I['val'][$pref], $this->I['val'][$pref . '.']) : $this->I['val'][$pref];
                if (isset($this->I['val'][$pref . 'Wrap'])) {
-                       return $this->tmpl->wrap($res . $processedPref, $this->I['val'][$pref . 'Wrap']);
+                       return $this->WMcObj->wrap($res . $processedPref, $this->I['val'][$pref . 'Wrap']);
                } else {
                        return $res . $processedPref;
                }
@@ -237,7 +237,7 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                        $this->I['theItem'] .= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
                }
                $part = isset($this->I['val']['wrapItemAndSub.']) ? $this->WMcObj->stdWrap($this->I['val']['wrapItemAndSub'], $this->I['val']['wrapItemAndSub.']) : $this->I['val']['wrapItemAndSub'];
-               $this->WMresult .= $part ? $this->tmpl->wrap($this->I['theItem'], $part) : $this->I['theItem'];
+               $this->WMresult .= $part ? $this->WMcObj->wrap($this->I['theItem'], $part) : $this->I['theItem'];
        }
 
        /**
@@ -267,7 +267,7 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                if (is_array($this->mconf['stdWrap.'])) {
                        $this->WMresult = $this->WMcObj->stdWrap($this->WMresult, $this->mconf['stdWrap.']);
                }
-               return $this->tmpl->wrap($this->WMresult, $this->mconf['wrap']) . $this->WMextraScript;
+               return $this->WMcObj->wrap($this->WMresult, $this->mconf['wrap']) . $this->WMextraScript;
        }
 
 }