|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Xavier Perseguers <typo3@perseguers.ch> 00006 * (c) Steffen Kamper <steffen@typo3.org> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * A copy is found in the textfile GPL.txt and important notices to the license 00018 * from the author is found in LICENSE.txt distributed with these scripts. 00019 * 00020 * 00021 * This script is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * This copyright notice MUST APPEAR in all copies of the script! 00027 ***************************************************************/ 00028 00029 /** 00030 * Contains MULTIMEDIA class object. 00031 * 00032 * $Id: class.tslib_content.php 7905 2010-06-13 14:42:33Z ohader $ 00033 * @author Xavier Perseguers <typo3@perseguers.ch> 00034 * @author Steffen Kamper <steffen@typo3.org> 00035 */ 00036 class tslib_content_Multimedia extends tslib_content_Abstract { 00037 00038 /** 00039 * Rendering the cObject, MULTIMEDIA 00040 * 00041 * @param array Array of TypoScript properties 00042 * @return string Output 00043 */ 00044 public function render($conf = array()) { 00045 $content = ''; 00046 $filename = isset($conf['file.']) 00047 ? $this->cObj->stdWrap($conf['file'], $conf['file.']) 00048 : $conf['file']; 00049 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename); 00050 if ($incFile) { 00051 $fileinfo = t3lib_div::split_fileref($incFile); 00052 if (t3lib_div::inList('txt,html,htm', $fileinfo['fileext'])) { 00053 $content = $GLOBALS['TSFE']->tmpl->fileContent($incFile); 00054 } else { 00055 // default params... 00056 $parArray = array(); 00057 // src is added 00058 00059 $width = isset($conf['width.']) 00060 ? $this->cObj->stdWrap($conf['width'], $conf['width.']) 00061 : $conf['width']; 00062 if(!$width) { 00063 $width = 200; 00064 } 00065 00066 $height = isset($conf['height.']) 00067 ? $this->cObj->stdWrap($conf['height'], $conf['height.']) 00068 : $conf['height']; 00069 if(!$height) { 00070 $height = 200; 00071 } 00072 00073 $parArray['src'] = 'src="' . $GLOBALS['TSFE']->absRefPrefix . $incFile . '"'; 00074 if (t3lib_div::inList('au,wav,mp3', $fileinfo['fileext'])) { 00075 } 00076 if (t3lib_div::inList('avi,mov,mpg,asf,wmv', $fileinfo['fileext'])) { 00077 $parArray['width'] = 'width="' . $width . '"'; 00078 $parArray['height'] = 'height="' . $height . '"'; 00079 } 00080 if (t3lib_div::inList('swf,swa,dcr', $fileinfo['fileext'])) { 00081 $parArray['quality'] = 'quality="high"'; 00082 $parArray['width'] = 'width="' . $width . '"'; 00083 $parArray['height'] = 'height="' . $height . '"'; 00084 } 00085 if (t3lib_div::inList('class', $fileinfo['fileext'])) { 00086 $parArray['width'] = 'width="' . $width . '"'; 00087 $parArray['height'] = 'height="' . $height . '"'; 00088 } 00089 00090 // fetching params 00091 $params = isset($conf['params.']) 00092 ? $this->cObj->stdWrap($conf['params'], $conf['params.']) 00093 : $conf['params']; 00094 $lines = explode(LF, $params); 00095 foreach ($lines as $l) { 00096 $parts = explode('=', $l); 00097 $parameter = strtolower(trim($parts[0])); 00098 $value = trim($parts[1]); 00099 if ((string) $value != '') { 00100 $parArray[$parameter] = $parameter . '="' . htmlspecialchars($value) . '"'; 00101 } else { 00102 unset($parArray[$parameter]); 00103 } 00104 } 00105 if ($fileinfo['fileext'] == 'class') { 00106 unset($parArray['src']); 00107 $parArray['code'] = 'code="' . htmlspecialchars($fileinfo['file']) . '"'; 00108 $parArray['codebase'] = 'codebase="' . htmlspecialchars($fileinfo['path']) . '"'; 00109 $content = '<applet ' . implode(' ', $parArray) . '></applet>'; 00110 } else { 00111 $content = '<embed ' . implode(' ', $parArray) . '></embed>'; 00112 } 00113 } 00114 } 00115 00116 if (isset($conf['stdWrap.'])) { 00117 $content = $this->cObj->stdWrap($content, $conf['stdWrap.']); 00118 } 00119 00120 return $content; 00121 } 00122 00123 } 00124 00125 00126 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_multimedia.php'])) { 00127 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_multimedia.php']); 00128 } 00129 00130 ?>
1.8.0