Added feature #16381: Optimize stdWrap usage for TypoScript content element MEDIA...
authorSteffen Kamper <info@sk-typo3.de>
Wed, 17 Nov 2010 14:32:56 +0000 (14:32 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 17 Nov 2010 14:32:56 +0000 (14:32 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9457 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/content/class.tslib_content_media.php

index b266339..337923c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
 
 2010-11-17  Steffen Kamper  <steffen@typo3.org>
 
+       * Added feature #16381: Optimize stdWrap usage for TypoScript content element MEDIA (Thanks to Jo Hasenau)
        * Fixed bug #16435: Headers in GridView are rendered wrong
        * Follow-up to #16315: fixed an issue in ext_conf_template with mod menu
        * Fixed bug #16434: GridView does not show cells if they are not mapped to any column
index 368f746..91cfaec 100644 (file)
 class tslib_content_Media extends tslib_content_Abstract {
 
        /**
-        * Rendering the cObject, TEXT
+        * Rendering the cObject, MEDIA
         *
         * @param       array           Array of TypoScript properties
         * @return      string          Output
         */
        public function render($conf = array()) {
                $content = '';
-               $flexParams = $this->cObj->stdWrap($conf['flexParams'], $conf['flexParams.']);
+               $flexParams = isset($conf['flexParams.'])
+                       ? $this->cObj->stdWrap($conf['flexParams'], $conf['flexParams.'])
+                       : $conf['flexParams'];
                if (substr($flexParams, 0, 1) === '<') {
                                // it is a content element
                        $this->cObj->readFlexformIntoConf($flexParams, $conf['parameter.']);
-                       $url = $conf['parameter.']['mmFile'];
-                       $url = $this->cObj->stdWrap($url, $conf['file.']);
+                       $url = isset($conf['file.'])
+                               ? $this->cObj->stdWrap($conf['parameter.']['mmFile'], $conf['file.'])
+                               : $conf['parameter.']['mmFile'];
+                       $mmFile = $url;
                } else {
                                // it is a TS object
-                       $url = $this->cObj->stdWrap($conf['file'], $conf['file.']);
+                       $url = isset($conf['file.'])
+                               ? $this->cObj->stdWrap($conf['file'], $conf['file.'])
+                               : $conf['file'];
                }
 
                $mode = is_file(PATH_site . $url) ? 'file' : 'url';
@@ -72,9 +78,14 @@ class tslib_content_Media extends tslib_content_Abstract {
                        ));
                }
 
-               $renderType = $conf['renderType'];
-               if (isset($conf['parameter.']['mmRenderType'])) {
-                       $renderType = $conf['parameter.']['mmRenderType'];
+               $renderType = isset($conf['renderType.'])
+                       ? $this->cObj->stdWrap($conf['renderType'], $conf['renderType.'])
+                       : $conf['renderType'];
+               $mmRenderType = isset($conf['parameter.']['mmRenderType.'])
+                       ? $this->cObj->stdWrap($conf['parameter.']['mmRenderType'], $conf['parameter.']['mmRenderType.'])
+                       : $conf['parameter.']['mmRenderType'];
+               if ($mmRenderType) {
+                       $renderType = $mmRenderType;
                }
                if ($renderType === 'auto') {
                                // default renderType is swf
@@ -85,25 +96,49 @@ class tslib_content_Media extends tslib_content_Abstract {
                        }
                }
 
-               $forcePlayer = isset($conf['parameter.']['mmFile']) ? intval($conf['parameter.']['mmforcePlayer']) : $conf['forcePlayer'];
-               $conf['forcePlayer'] = $forcePlayer;
+               $mmForcePlayer = isset($conf['parameter.']['mmforcePlayer.'])
+                       ? $this->cObj->stdWrap($conf['parameter.']['mmforcePlayer'], $conf['parameter.']['mmforcePlayer.'])
+                       : $conf['parameter.']['mmforcePlayer'];
 
-               $conf['type'] = isset($conf['parameter.']['mmType']) ? $conf['parameter.']['mmType'] : $conf['type'];
+               $forcePlayer = $mmFile ? intval($mmForcePlayer) : $conf['forcePlayer'];
+               $conf['forcePlayer'] = isset($conf['forcePlayer.'])
+                       ? $this->cObj->stdWrap($forcePlayer, $conf['forcePlayer.'])
+                       : $forcePlayer;
+
+               $mmType = isset($conf['parameter.']['mmType.'])
+                       ? $this->cObj->stdWrap($conf['parameter.']['mmType'], $conf['parameter.']['mmType.'])
+                       : $conf['parameter.']['mmType'];
+
+               $type = isset($conf['type.'])
+                       ? $this->cObj->stdWrap($conf['type'], $conf['type.'])
+                       : $conf['type'];
+
+               $conf['type'] = $mmType ? $mmType : $type;
                $mime = $renderType . 'object';
                $typeConf = $conf['mimeConf.'][$mime . '.'][$conf['type'] . '.'] ? $conf['mimeConf.'][$mime . '.'][$conf['type'] . '.'] : array();
                $conf['predefined'] = array();
 
-               $width = intval($conf['parameter.']['mmWidth']);
-               $height = intval($conf['parameter.']['mmHeight']);
+               $width = isset($conf['parameter.']['mmWidth.'])
+                       ? intval($this->cObj->stdWrap($conf['parameter.']['mmWidth'], $conf['parameter.']['mmWidth.']))
+                       : intval($conf['parameter.']['mmWidth']);
+               $height = isset($conf['parameter.']['mmHeight.'])
+                       ? intval($this->cObj->stdWrap($conf['parameter.']['mmHeight'], $conf['parameter.']['mmHeight.']))
+                       : intval($conf['parameter.']['mmHeight']);
                if ($width) {
                        $conf['width'] = $width;
                } else {
-                       $conf['width'] = intval($conf['width']) ? $conf['width'] : $typeConf['defaultWidth'];
+                       $width = isset($conf['width.'])
+                               ? intval($this->cObj->stdWrap($conf['width'], $conf['width.']))
+                               : intval($conf['width']);
+                       $conf['width'] = $width ? $width : $typeConf['defaultWidth'];
                }
                if ($height) {
                        $conf['height'] = $height;
                } else {
-                       $conf['height'] = intval($conf['height']) ? $conf['height'] : $typeConf['defaultHeight'];
+                       $height = isset($conf['height.'])
+                               ? intval($this->cObj->stdWrap($conf['height'], $conf['height.']))
+                               : intval($conf['width']);
+                       $conf['height'] = $height ? $height : $typeConf['defaultHeight'];
                }
 
                if (is_array($conf['parameter.']['mmMediaOptions'])) {
@@ -196,7 +231,7 @@ class tslib_content_Media extends tslib_content_Abstract {
                                }
                }
 
-               if ($conf['stdWrap.']) {
+               if (isset($conf['stdWrap.'])) {
                        $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
                }
 
@@ -210,4 +245,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/conte
        include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_media.php']);
 }
 
-?>
\ No newline at end of file
+?>