TYPO3 CMS  TYPO3_6-2
QuicktimeObjectContentObject.php
Go to the documentation of this file.
1 <?php
3 
23 
30  public function render($conf = array()) {
31  $params = ($prefix = '');
32  if ($GLOBALS['TSFE']->baseUrl) {
33  $prefix = $GLOBALS['TSFE']->baseUrl;
34  }
35  if ($GLOBALS['TSFE']->absRefPrefix) {
36  $prefix = $GLOBALS['TSFE']->absRefPrefix;
37  }
38  $type = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
39 
40  // If file is audio and an explicit path has not been set,
41  // take path from audio fallback property
42  if ($type == 'audio' && empty($conf['file'])) {
43  $conf['file'] = $conf['audioFallback'];
44  }
45  $filename = isset( $conf['file.'])
46  ? $this->cObj->stdWrap($conf['file'], $conf['file.'])
47  : $conf['file'];
48 
49  $typeConf = $conf[$type . '.'];
50  // Add QTobject js-file
51  $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/flashmedia/qtobject/qtobject.js');
52  $replaceElementIdString = str_replace('.', '', uniqid('mmqt', TRUE));
53  $GLOBALS['TSFE']->register['MMQTID'] = $replaceElementIdString;
54  $qtObject = 'QTObject' . $replaceElementIdString;
55  // Merge with default parameters
56  $conf['params.'] = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.']);
57  if (is_array($conf['params.'])) {
58  \TYPO3\CMS\Core\Utility\GeneralUtility::remapArrayKeys($conf['params.'], $typeConf['mapping.']['params.']);
59  foreach ($conf['params.'] as $key => $value) {
60  $params .= $qtObject . '.addParam("' . $key . '", "' . $value . '");' . LF;
61  }
62  }
63  $params = ($params ? substr($params, 0, -2) : '') . LF . $qtObject . '.write("' . $replaceElementIdString . '");';
64  $alternativeContent = isset($conf['alternativeContent.']) ? $this->cObj->stdWrap($conf['alternativeContent'], $conf['alternativeContent.']) : $conf['alternativeContent'];
65  $layout = str_replace(
66  array(
67  '###ID###',
68  '###QTOBJECT###'
69  ),
70  array(
71  $replaceElementIdString,
72  '<div id="' . $replaceElementIdString . '">' . $alternativeContent . '</div>'
73  ),
74  isset($conf['layout.']) ? $this->cObj->stdWrap($conf['layout'], $conf['layout.']) : $conf['layout']
75  );
76  $width = isset($conf['width.']) ? $this->cObj->stdWrap($conf['width'], $conf['width.']) : $conf['width'];
77  if (!$width) {
78  $width = $conf[$type . '.']['defaultWidth'];
79  }
80  $height = isset($conf['height.']) ? $this->cObj->stdWrap($conf['height'], $conf['height.']) : $conf['height'];
81  if (!$height) {
82  $height = $conf[$type . '.']['defaultHeight'];
83  }
84  $fullFilename = $filename;
85  // If the file name doesn't contain a scheme, prefix with appropriate data
86  if (strpos($filename, '://') === FALSE && !empty($prefix)) {
87  $fullFilename = $prefix . $filename;
88  }
89  $embed = 'var ' . $qtObject . ' = new QTObject("' . $fullFilename . '", "' . $replaceElementIdString . '", "' . $width . '", "' . $height . '");';
90  $content = $layout . '
91  <script type="text/javascript">
92  ' . $embed . '
93  ' . $params . '
94  </script>';
95  if (isset($conf['stdWrap.'])) {
96  $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
97  }
98  return $content;
99  }
100 
101 }
static remapArrayKeys(&$array, $mappingTable)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]