33 public function render($conf = array()) {
38 if (
$GLOBALS[
'TSFE']->absRefPrefix) {
39 $prefix =
$GLOBALS[
'TSFE']->absRefPrefix;
41 $type = isset($conf[
'type.']) ? $this->cObj->stdWrap($conf[
'type'], $conf[
'type.']) : $conf[
'type'];
42 $typeConf = $conf[$type .
'.'];
44 $pageRenderer =
$GLOBALS[
'TSFE']->getPageRenderer();
47 $pageRenderer->addJsFile(TYPO3_mainDir .
'contrib/flashmedia/swfobject/swfobject.js');
48 $player = isset($typeConf[
'player.']) ? $this->cObj->stdWrap($typeConf[
'player'], $typeConf[
'player.']) : $typeConf[
'player'];
49 $installUrl = isset($conf[
'installUrl.']) ? $this->cObj->stdWrap($conf[
'installUrl'], $conf[
'installUrl.']) : $conf[
'installUrl'];
51 $installUrl = $prefix . TYPO3_mainDir .
'contrib/flashmedia/swfobject/expressInstall.swf';
55 if ($type ==
'audio' && empty($conf[
'file'])) {
56 $conf[
'file'] = $conf[
'audioFallback'];
58 $filename = isset($conf[
'file.']) ? $this->cObj->stdWrap($conf[
'file'], $conf[
'file.']) : $conf[
'file'];
59 $forcePlayer = isset($conf[
'forcePlayer.']) ? $this->cObj->stdWrap($conf[
'forcePlayer'], $conf[
'forcePlayer.']) : $conf[
'forcePlayer'];
60 if ($filename && $forcePlayer) {
61 if (strpos($filename,
'://') !== FALSE) {
62 $conf[
'flashvars.'][
'file'] = $filename;
65 $conf[
'flashvars.'][
'file'] = $prefix . $filename;
67 $conf[
'flashvars.'][
'file'] = str_repeat(
'../', substr_count($player,
'/')) . $filename;
74 $conf[
'player'] = $player;
75 $conf[
'installUrl'] = $installUrl;
76 $conf[
'filename'] = $filename;
77 $conf[
'prefix'] = $prefix;
79 $conf[
'flashvars.'] = array_merge((array) $typeConf[
'default.'][
'flashvars.'], (array) $conf[
'flashvars.']);
80 $conf[
'params.'] = array_merge((array) $typeConf[
'default.'][
'params.'], (array) $conf[
'params.']);
81 $conf[
'attributes.'] = array_merge((array) $typeConf[
'default.'][
'attributes.'], (array) $conf[
'attributes.']);
82 $conf[
'embedParams'] =
'flashvars, params, attributes';
83 if (isset($conf[
'flashvars.'][
'file'])) {
84 $conf[
'flashvars.'][
'fileHash'] =
GeneralUtility::hmac($conf[
'flashvars.'][
'file'],
'flashvars');
88 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/hooks/class.tx_cms_mediaitems.php'][
'swfParamTransform'])) {
89 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/hooks/class.tx_cms_mediaitems.php'][
'swfParamTransform'] as $classRef) {
93 if (is_array($conf[
'flashvars.'])) {
96 $flashvars =
'var flashvars = ' . (count($conf[
'flashvars.']) ? json_encode($conf[
'flashvars.']) :
'{}') .
';';
97 if (is_array($conf[
'params.'])) {
100 $params =
'var params = ' . (count($conf[
'params.']) ? json_encode($conf[
'params.']) :
'{}') .
';';
101 if (is_array($conf[
'attributes.'])) {
104 $attributes =
'var attributes = ' . (count($conf[
'attributes.']) ? json_encode($conf[
'attributes.']) :
'{}') .
';';
105 $flashVersion = isset($conf[
'flashVersion.']) ? $this->cObj->stdWrap($conf[
'flashVersion'], $conf[
'flashVersion.']) : $conf[
'flashVersion'];
106 if (!$flashVersion) {
109 $replaceElementIdString = str_replace(
'.',
'', uniqid(
'mmswf', TRUE));
110 $GLOBALS[
'TSFE']->register[
'MMSWFID'] = $replaceElementIdString;
111 $alternativeContent = isset($conf[
'alternativeContent.']) ? $this->cObj->stdWrap($conf[
'alternativeContent'], $conf[
'alternativeContent.']) : $conf[
'alternativeContent'];
112 $layout = isset($conf[
'layout.']) ? $this->cObj->stdWrap($conf[
'layout'], $conf[
'layout.']) : $conf[
'layout'];
113 $content = str_replace(
'###ID###', $replaceElementIdString, $layout);
114 $content = str_replace(
'###SWFOBJECT###',
'<div id="' . $replaceElementIdString .
'">' . $alternativeContent .
'</div>', $content);
115 $width = isset($conf[
'width.']) ? $this->cObj->stdWrap($conf[
'width'], $conf[
'width.']) : $conf[
'width'];
117 $width = $conf[$type .
'.'][
'defaultWidth'];
119 $height = isset($conf[
'height.']) ? $this->cObj->stdWrap($conf[
'height'], $conf[
'height.']) : $conf[
'height'];
121 $height = $conf[$type .
'.'][
'defaultHeight'];
123 $embed =
'swfobject.embedSWF("' . $conf[
'player'] .
'", "' . $replaceElementIdString .
'", "' . $width .
'", "' . $height .
'", 124 "' . $flashVersion .
'", "' . $installUrl .
'", ' . $conf[
'embedParams'] .
');';
125 $script = $flashvars . $params . $attributes . $embed;
126 $pageRenderer->addJsInlineCode($replaceElementIdString, $script);
127 if (isset($conf[
'stdWrap.'])) {
128 $content = $this->cObj->stdWrap($content, $conf[
'stdWrap.']);
static getIndpEnv($getEnvName)
static hmac($input, $additionalSecret='')
static remapArrayKeys(&$array, $mappingTable)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]