Project

General

Profile

Feature #20284 » new_media_v13.diff

Administrator Admin, 2009-05-08 19:35

View differences:

t3lib/class.t3lib_tsparser_ext.php (working copy)
'ctable' => Array('Content: \'Table\'', 'mf'),
'cuploads' => Array('Content: \'Filelinks\'', 'mg'),
'cmultimedia' => Array('Content: \'Multimedia\'', 'mh'),
'cmedia' => Array('Content: \'Media\'', 'mr'),
'cmailform' => Array('Content: \'Form\'', 'mi'),
'csearch' => Array('Content: \'Search\'', 'mj'),
'clogin' => Array('Content: \'Login\'', 'mk'),
typo3/sysext/cms/ext_localconf.php (working copy)
CType = multimedia
}
}
media {
icon = gfx/c_wiz/multimedia.gif
title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_media_title
description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_media_description
tt_content_defValues {
CType = media
}
}
menu {
icon = gfx/c_wiz/sitemap2.gif
title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_sitemap_title
......
}
}
special.show = uploads,multimedia,menu,html
special.show = uploads,media,menu,html
forms.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms
forms.elements {
typo3/sysext/cms/ext_tables.php (working copy)
# TYPO3 SVN ID: $Id$
if (!defined ('TYPO3_MODE')) die ('Access denied.');
include_once(t3lib_extMgm::extPath($_EXTKEY) . 'tslib/hooks/class.tx_cms_mediaitems.php');
if (TYPO3_MODE == 'BE') {
t3lib_extMgm::addModule('web','layout','top',t3lib_extMgm::extPath($_EXTKEY).'layout/');
t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_layout','EXT:cms/locallang_csh_weblayout.xml');
typo3/sysext/cms/flexform_media.xml (revision 0)
<?xml version="1.0" encoding="utf-8"?>
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:cms/locallang_ttc.xml:media.options</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<mmFile>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.url</label>
<config>
<type>input</type>
<size>60</size>
<eval>trim</eval>
<default></default>
<wizards type="array">
<_PADDING>2</_PADDING>
<link type="array">
<type>popup</type>
<title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
<icon>link_popup.gif</icon>
<script>browse_links.php?mode=wizard&amp;act=file|url</script>
<params type="array">
<blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
<allowedExtensions>class,swf,swa,dcr,wav,avi,au,mov,asf,mpg,wmv,mp3,mp4,m4v,flv</allowedExtensions>
</params>
<JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
</link>
</wizards>
</config>
</TCEforms>
</mmFile>
<mmforcePlayer>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.forcePlayer</label>
<config>
<type>check</type>
</config>
</TCEforms>
</mmforcePlayer>
<mmType>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.type</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.type.video</numIndex>
<numIndex index="1">video</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.type.audio</numIndex>
<numIndex index="1">audio</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</mmType>
<mmWidth>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.width</label>
<config>
<type>input</type>
<size>8</size>
<max>5</max>
<eval>trim</eval>
</config>
</TCEforms>
</mmWidth>
<mmHeight>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.height</label>
<config>
<type>input</type>
<size>8</size>
<max>5</max>
<eval>trim</eval>
</config>
</TCEforms>
</mmHeight>
<mmRenderType>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.renderType</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.renderType.auto</numIndex>
<numIndex index="1">auto</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.renderType.swf</numIndex>
<numIndex index="1">swf</numIndex>
</numIndex>
<numIndex index="2">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.renderType.qt</numIndex>
<numIndex index="1">qt</numIndex>
</numIndex>
<numIndex index="3">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.renderType.embed</numIndex>
<numIndex index="1">embed</numIndex>
</numIndex>
</items>
<itemsProcFunc>tx_cms_mediaItems->customMediaRenderTypes</itemsProcFunc>
</config>
</TCEforms>
</mmRenderType>
<mmMediaOptions>
<tx_templavoila>
<title>LLL:EXT:cms/locallang_ttc.xml:media.additionalOptions</title>
</tx_templavoila>
<type>array</type>
<section>1</section>
<el>
<mmMediaOptionsContainer>
<type>array</type>
<tx_templavoila>
<title>LLL:EXT:cms/locallang_ttc.xml:media.params</title>
</tx_templavoila>
<el>
<mmParamName>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.params.option</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.autoPlay</numIndex>
<numIndex index="1">autoplay</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.loop</numIndex>
<numIndex index="1">loop</numIndex>
</numIndex>
<numIndex index="2">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.quality</numIndex>
<numIndex index="1">quality</numIndex>
</numIndex>
<numIndex index="3">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.preview</numIndex>
<numIndex index="1">preview</numIndex>
</numIndex>
<numIndex index="4">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.allowScriptAccess</numIndex>
<numIndex index="1">allowscriptaccess</numIndex>
</numIndex>
<numIndex index="5">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.allowFullScreen</numIndex>
<numIndex index="1">allowFullScreen</numIndex>
</numIndex>
</items>
<itemsProcFunc>tx_cms_mediaItems->customMediaParams</itemsProcFunc>
</config>
</TCEforms>
</mmParamName>
<mmParamSet>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.params.setTo</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.on</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.off</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
<numIndex index="2">
<numIndex index="0">LLL:EXT:cms/locallang_ttc.xml:media.params.valueEntry</numIndex>
<numIndex index="1">2</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</mmParamSet>
<mmParamValue>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.params.value</label>
<config>
<type>input</type>
<size>16</size>
<default></default>
</config>
</TCEforms>
</mmParamValue>
</el>
</mmMediaOptionsContainer>
<mmMediaCustomParameterContainer>
<type>array</type>
<tx_templavoila>
<title>LLL:EXT:cms/locallang_ttc.xml:media.params.customEntry</title>
</tx_templavoila>
<el>
<mmParamCustomEntry>
<TCEforms>
<label>LLL:EXT:cms/locallang_ttc.xml:media.params.customEntryLabel</label>
<config>
<type>text</type>
<rows>6</rows>
<cols>60</cols>
</config>
</TCEforms>
</mmParamCustomEntry>
</el>
</mmMediaCustomParameterContainer>
</el>
</mmMediaOptions>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
typo3/sysext/cms/layout/locallang_db_new_content_el.xml (working copy)
<label index="special_filelinks_description">Makes a list of files for download.</label>
<label index="special_multimedia_title">Multimedia</label>
<label index="special_multimedia_description">Inserts a media element like a Flash animation, audio file or video clip.</label>
<label index="special_media_title">Media</label>
<label index="special_media_description">Inserts a media element like a Flash animation, audio file or video clip.</label>
<label index="special_swfobject_title">Inserts a Flash media element.</label>
<label index="special_swfobject_description">Inserts Flash media element, audio file or video clip.</label>
<label index="special_qtobject_title">Inserts a Quicktime element.</label>
<label index="special_qtobject_description">Inserts a Quicktime element like a Quicktime audio file or video clip (*.mov).</label>
<label index="special_sitemap_title">Sitemap</label>
<label index="special_sitemap_description">Creates a sitemap of the website.</label>
<label index="special_plainHTML_title">Plain HTML</label>
typo3/sysext/cms/locallang_ttc.xml (working copy)
<label index="CType.I.15">Script</label>
<label index="CType.I.16">Divider</label>
<label index="CType.I.17">HTML</label>
<label index="CType.I.18">Media</label>
<label index="CType.div.standard">Standard</label>
<label index="CType.div.lists">Lists</label>
<label index="CType.div.forms">Forms</label>
......
<label index="tabs.text">Text</label>
<label index="tabs.media">Media</label>
<label index="tabs.plugin">Plugin</label>
<label index="media.options">Media Options</label>
<label index="media.url">relative Path of Media File or URL</label>
<label index="media.browseUrlTitle">Select File or URL</label>
<label index="media.width">Media Width</label>
<label index="media.height">Media Height</label>
<label index="media.forcePlayer">Use Player (You can force it with using URL)</label>
<label index="media.type">Media Type</label>
<label index="media.type.video">Video</label>
<label index="media.type.audio">Audio</label>
<label index="media.renderType">Render Type</label>
<label index="media.renderType.auto">Auto</label>
<label index="media.renderType.swf">Shockwave Flash Browser Plugin</label>
<label index="media.renderType.qt">QuickTime Browser Plugin</label>
<label index="media.renderType.embed">HTML Embed Element</label>
<label index="media.additionalOptions">Additional Parameters</label>
<label index="media.params">Media Parameter</label>
<label index="media.params.option">Option</label>
<label index="media.params.setTo">Set to</label>
<label index="media.params.on">On</label>
<label index="media.params.off">Off</label>
<label index="media.params.valueEntry">Value Entry</label>
<label index="media.params.value">Value</label>
<label index="media.params.autoPlay">AutoPlay</label>
<label index="media.params.loop">Loop</label>
<label index="media.params.quality">Quality</label>
<label index="media.params.preview">Preview Video</label>
<label index="media.params.bgColor">Background Color</label>
<label index="media.params.allowScriptAccess">Allow ScriptAccess</label>
<label index="media.params.allowFullScreen">Allow Fullscreen</label>
<label index="media.alternativeContent">Alternative Content</label>
<label index="media.params.customEntry">Custom Parameters</label>
<label index="media.params.customEntryLabel">Enter flashvars, params or attributes</label>
<label index="media.noFile">ERROR: Missing URL or File!</label>
</languageKey>
</data>
</T3locallang>
typo3/sysext/cms/tbl_tt_content.php (working copy)
array('LLL:EXT:cms/locallang_ttc.xml:CType.I.10', 'login', 'i/tt_content_login.gif'),
array('LLL:EXT:cms/locallang_ttc.xml:CType.div.special', '--div--'),
array('LLL:EXT:cms/locallang_ttc.xml:CType.I.7', 'multimedia', 'i/tt_content_mm.gif'),
array('LLL:EXT:cms/locallang_ttc.xml:CType.I.18', 'media', 'i/tt_content_mm.gif'),
array('LLL:EXT:cms/locallang_ttc.xml:CType.I.11', 'splash', 'i/tt_content_news.gif'),
array('LLL:EXT:cms/locallang_ttc.xml:CType.I.12', 'menu', 'i/tt_content_menu.gif'),
array('LLL:EXT:cms/locallang_ttc.xml:CType.I.13', 'shortcut', 'i/tt_content_shortcut.gif'),
......
'config' => Array (
'type' => 'group',
'internal_type' => 'file',
'allowed' => 'txt,html,htm,class,swf,swa,dcr,wav,avi,au,mov,asf,mpg,wmv,mp3',
'allowed' => 'txt,html,htm,class,swf,swa,dcr,wav,avi,au,mov,asf,mpg,wmv,mp3,mp4,m4v',
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
'uploadfolder' => 'uploads/media',
'size' => '2',
......
</ROOT>
</T3DataStructure>
',
',media' => file_get_contents(t3lib_extMgm::extPath('cms') . 'flexform_media.xml'),
)
)
),
......
--div--;LLL:EXT:cms/locallang_ttc.xml:CType.I.7, multimedia;;;;3-3-3, bodytext;LLL:EXT:lang/locallang_general.php:LGL.parameters;;nowrap,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime'
),
'media' => Array(
'showitem' => 'CType;;4;;1-1-1, hidden, header;;3;;2-2-2, linkToTop;;;;3-3-3,
--div--;LLL:EXT:cms/locallang_ttc.xml:CType.I.18, pi_flexform;;;;3-3-3,
bodytext;LLL:EXT:cms/locallang_ttc.xml:media.alternativeContent;9;richtext:rte_transform[flag=rte_enabled|mode=ts_css];4-4-4,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime'
),
'script' => Array(
'showitem' => 'CType;;4;;1-1-1, hidden, header;LLL:EXT:lang/locallang_general.php:LGL.name;;;2-2-2,
--div--;LLL:EXT:cms/locallang_ttc.xml:CType.I.15, select_key;;;;3-3-3, pages;;12, bodytext;LLL:EXT:lang/locallang_general.php:LGL.parameters;;nowrap,
typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
case 'MULTIMEDIA':
$content.=$this->MULTIMEDIA($conf);
break;
case 'MEDIA':
$content.=$this->MEDIA($conf);
break;
case 'SWFOBJECT':
$content.=$this->SWFOBJECT($conf);
break;
case 'QTOBJECT':
$content.=$this->QTOBJECT($conf);
break;
default:
// call hook functions for extra processing
if($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
......
* @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=374&cHash=efd88ab4a9
*/
function MULTIMEDIA($conf) {
$content='';
$content='';
$filename=$this->stdWrap($conf['file'],$conf['file.']);
$incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
if ($incFile) {
$fileinfo = t3lib_div::split_fileref($incFile);
$incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
if ($incFile) {
$fileinfo = t3lib_div::split_fileref($incFile);
if (t3lib_div::inList('txt,html,htm',$fileinfo['fileext'])) {
$content = $GLOBALS['TSFE']->tmpl->fileContent($incFile);
} else {
} else {
// default params...
$parArray=array();
$parArray=array();
// src is added
$parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix.$incFile.'"';
if (t3lib_div::inList('au,wav,mp3',$fileinfo['fileext'])) {
}
if (t3lib_div::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext'])) {
$parArray['width'] = 'width="200"';
$parArray['height'] = 'height="200"';
$parArray['width'] = 'width="' . ($conf['width'] ? $conf['width'] : 200) . '"';
$parArray['height'] = 'height="' . ($conf['height'] ? $conf['height'] : 200) . '"';
}
if (t3lib_div::inList('swf,swa,dcr',$fileinfo['fileext'])) {
$parArray['quality'] = 'quality="high"';
}
if (t3lib_div::inList('class',$fileinfo['fileext'])) {
$parArray['width'] = 'width="200"';
$parArray['height'] = 'height="200"';
$parArray['width'] = 'width="' . ($conf['width'] ? $conf['width'] : 200) . '"';
$parArray['height'] = 'height="' . ($conf['height'] ? $conf['height'] : 200) . '"';
}
// fetching params
......
return $content;
}
/**
* Rendering the cObject, SWFOBJECT
*
* @param array Array of TypoScript properties
* @return string Output
*/
function MEDIA($conf) {
$content = '';
$flexParams = $this->stdWrap($conf['flexParams'], $conf['flexParams.']);
if (substr($flexParams, 0, 1) === '<') {
// it is a content element
$this->readFlexformIntoConf($flexParams, $conf['parameter.']);
$url = $conf['parameter.']['mmFile'];
} else {
// it is a TS object
$url = $this->stdWrap($conf['file'], $conf['file.']);
}
$mode = @file_exists(PATH_site . $url) ? 'file' : 'url';
if ($mode === 'file') {
$filename = $GLOBALS['TSFE']->tmpl->getFileName($url);
$fileinfo = t3lib_div::split_fileref($filename);
$conf['file'] = $url;
} else {
$conf['file'] = $url;
if ($conf['parameter.']['mmforcePlayer'] || $conf['forcePlayer']) {
$mode = 'file';
}
}
$conf['type'] = isset($conf['parameter.']['mmType']) ? $conf['parameter.']['mmType'] : $conf['type'];
$typeConf = $conf[$conf['type'] . '.'];
$conf['predefined'] = array();
$renderType = 'auto';
if (isset($conf['parameter.']['mmRenderType'])) {
$renderType = $conf['parameter.']['mmRenderType'];
}
$width = intval($conf['parameter.']['mmWidth']);
$height = intval($conf['parameter.']['mmHeight']);
if ($width) {
$conf['width'] = $width;
} else {
$conf['width'] = intval($conf['width']) ? $conf['width'] : $typeConf['defaultWidth'];
}
if ($height) {
$conf['height'] = $height;
} else {
$conf['height'] = intval($conf['height']) ? $conf['height'] : $typeConf['defaultHeight'];
}
if (is_array($conf['parameter.']['mmMediaOptions.'])) {
$params = array();
foreach ($conf['parameter.']['mmMediaOptions.'] as $key => $value) {
if (is_array($value)) {
if (isset($value['mmParamCustomEntry'])) {
//custom parameter entry
$rawTS = $value['mmParamCustomEntry'];
//read and merge
$tmp = t3lib_div::trimExplode(chr(10), $rawTS);
if (count($tmp)) {
foreach ($tmp as $tsLine) {
if (substr($tsLine, 0, 1) != '#' && $pos = strpos($tsLine, '.')) {
$parts[0] = substr($tsLine, 0, $pos);
$parts[1] = substr($tsLine, $pos + 1);
$valueParts = t3lib_div::trimExplode('=', $parts[1], true);
switch (strtolower($parts[0])) {
case 'flashvars':
$conf['flashvars.'][$valueParts[0]] = $valueParts[1];
break;
case 'params':
$conf['params.'][$valueParts[0]] = $valueParts[1];
break;
case 'attributes':
$conf['attributes.'][$valueParts[0]] = $valueParts[1];
break;
}
}
}
}
} else {
if (isset($value['mmParamSet'])) {
$pName = $value['mmParamName'];
$pSet = $value['mmParamSet'];
$pValue = $pSet == 2 ? $value['mmParamValue'] : ($pSet == 0 ? 'false' : 'true');
$conf['predefined'][$pName] = $pValue;
}
}
}
}
}
// render MEDIA
if ($mode == 'url' && $url != '') {
// url is called direct, not with player
$conf = array_merge($conf['mimeConf.']['swfobject.'], $conf);
$conf[$conf['type'] . '.']['player'] = strpos($url, '://') === false ? 'http://' . $url : $url;
$conf['file'] = '';
$conf['installUrl'] = 'null';
$conf['flashvars'] = array_merge((array) $conf['flashvars'], $conf['predefined']);
$content = $this->SWFOBJECT($conf);
} else {
if ($mode == 'url' && $url == '' && !$conf['allowEmptyUrl']) {
return '<p style="background-color: yellow;">' . $GLOBALS['TSFE']->sL('LLL:EXT:cms/locallang_ttc.xml:media.noFile', true) . '</p>';
}
if ($renderType === 'auto') {
$handler = array_keys($conf['fileExtHandler.']);
if (in_array($fileinfo['fileext'], $handler)) {
$renderType = strtolower($conf['fileExtHandler.'][$fileinfo['fileext']]);
}
}
switch ($renderType) {
case 'swf':
$conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $conf[$conf['type'] . '.']);
$conf = array_merge($conf['mimeConf.']['swfobject.'], $conf);
unset($conf['mimeConf.']);
$conf['flashvars.'] = array_merge((array) $conf['flashvars.'], $conf['predefined']);
$content = $this->SWFOBJECT($conf);
break;
case 'qt':
$conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $conf[$conf['type'] . '.']);
$conf = array_merge($conf['mimeConf.']['qtobject.'], $conf);
unset($conf['mimeConf.']);
$conf['params.'] = array_merge((array) $conf['params.'], $conf['predefined']);
$content = $this->QTOBJECT($conf);
break;
case 'embed':
$paramsArray = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.'], $conf['predefined']);
$conf['params']= '';
foreach ($paramsArray as $key => $value) {
$conf['params'] .= $key . '=' . $value . chr(10);
}
$content = $this->MULTIMEDIA($conf);
break;
default:
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'] as $classRef) {
$hookObj = &t3lib_div::getUserObj($classRef);
$conf['file'] = $url;
$content = $hookObj->customMediaRender($renderType, &$conf);
}
}
}
}
return $content;
}
/**
* Rendering the cObject, SWFOBJECT
*
* @param array Array of TypoScript properties
* @return string Output
*/
function SWFOBJECT($conf) {
$content = '';
$flashvars = $params = $attributes = '';
$filename = $this->stdWrap($conf['file'], $conf['file.']);
$typeConf = $conf[$conf['type'] . '.'];
//add SWFobject js-file
$GLOBALS['TSFE']->additionalHeaderData['SWFobject'] = '<script src="' . $GLOBALS['TSFE']->absRefPrefix . 'typo3/contrib/flashmedia/swfobject/swfobject.js"></script>';
if ($filename) {
$conf['flashvars.']['file'] = $GLOBALS['TSFE']->absRefPrefix . $filename;
}
// merge with default parameters
$conf['flashvars.'] = array_merge((array) $typeConf['default.']['flashvars.'], (array) $conf['flashvars.']);
$conf['params.'] = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.']);
$conf['attributes.'] = array_merge((array) $typeConf['default.']['attributes.'], (array) $conf['attributes.']);
if (is_array($conf['flashvars.'])) {
$this->arrayKeyMap($conf['flashvars.'], $typeConf['mapping.']['flashvars.']);
foreach ($conf['flashvars.'] as $key => $value) {
$flashvars .= $key . ': "' . $value . '",';
}
}
$flashvars = 'var flashvars = {' . ($flashvars ? (substr($flashvars, -1) == ',' ? substr(trim($flashvars), 0, -1) : $flashvars) : '') . '};';
if (is_array($conf['params.'])) {
$this->arrayKeyMap($conf['params.'], $typeConf['mapping.']['params.']);
foreach ($conf['params.'] as $key => $value) {
$params .= $key . ': "' . $value . '",';
}
$params = substr(trim($params), 0, -1);
}
$params = 'var params = {' . ($params ? $params : '') . '};';
if (is_array($conf['attributes.'])) {
$this->arrayKeyMap($conf['attributes.'], $typeConf['attributes.']['params.']);
foreach ($conf['attributes.'] as $key => $value) {
$attributes .= $key . ': "' . $value . '",';
}
}
$attributes = 'var attributes = {' . ($attributes ? (substr($attributes, -1 === ',' ? substr($attributes, 0, -1) : $attributes)) : '') . '};';
$flashVersion = $this->stdWrap($conf['flashVersion'], $conf['flashVersion.']);
if (!$flashVersion) {
$flashVersion = '9';
}
$replaceElemIdStr = uniqid('mmswf');
$GLOBALS['TSFE']->register['MMSWFID'] = $replaceElemIdStr;
$layout = $this->stdWrap($conf['layout'], $conf['layout.']);
$layout = str_replace('###ID###', $replaceElemIdStr, $layout);
$layout = str_replace('###SWFOBJECT###', '<div id="' . $replaceElemIdStr . '">' . $alternativeContent . '</div>', $layout);
$alternativeContent = $this->stdWrap($conf['alternativeContent'], $conf['alternativeContent.']);
$width = $this->stdWrap($conf['width'], $conf['width.']);
$height = $this->stdWrap($conf['height'], $conf['height.']);
$width = $width ? $width : $conf[$conf['type'] . '.']['defaultWidth'];
$height = $height ? $height : $conf[$conf['type'] . '.']['defaultHeight'];
$player = $this->stdWrap($conf[$conf['type'] . '.']['player'], $conf[$conf['type'] . '.']['player.']);
$installUrl = $conf['installUrl'] ? $conf['installUrl'] : $GLOBALS['TSFE']->absRefPrefix . 'typo3/contrib/flashmedia/swfobject/expressInstall.swf';
$embed = 'swfobject.embedSWF("' . $player . '", "' . $replaceElemIdStr . '", "' . $width . '", "' . $height . '",
"' . $flashVersion . '", "' . $installUrl . '", flashvars, params, attributes);';
$content = $layout . '
<script type="text/javascript">
' . $flashvars . '
' . $params . '
' . $attributes . '
' . $embed . '
</script>';
return $content;
}
/**
* Rendering the cObject, QTOBJECT
*
* @param array Array of TypoScript properties
* @return string Output
*/
function QTOBJECT($conf) {
$content = '';
$params = '';
$filename = $this->stdWrap($conf['file'],$conf['file.']);
$incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
if ($incFile) {
$filename = $incFile;
$fileinfo = t3lib_div::split_fileref($filename);
}
$typeConf = $conf[$conf['type'] . '.'];
//add QTobject js-file
$GLOBALS['TSFE']->additionalHeaderData['qtobject'] = '<script src="' . $GLOBALS['TSFE']->absRefPrefix . 'typo3/contrib/flashmedia/qtobject/qtobject.js"></script>';
$replaceElemIdStr = uniqid('mmqt');
$GLOBALS['TSFE']->register['MMQTID'] = $replaceElemIdStr;
$qtObject = 'QTObject' . $replaceElemIdStr;
// merge with default parameters
$conf['params.'] = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.']);
if (is_array($conf['params.'])) {
$this->arrayKeyMap($conf['params.'], $typeConf['mapping.']['params.']);
foreach ($conf['params.'] as $key => $value) {
$params .= $qtObject . '.addParam("' .$key . '", "' . $value . '");' . chr(10);
}
}
$params = ($params ? substr($params, 0, -2) : '') . chr(10) . $qtObject . '.write("' . $replaceElemIdStr . '");';
$layout = $this->stdWrap($conf['layout'], $conf['layout.']);
$alternativeContent = $this->stdWrap($conf['alternativeContent'], $conf['alternativeContent.']);
if (strpos($layout, '###ID###')) {
$layout = str_replace('###ID###', $replaceElemIdStr, $layout);
} else {
$layout = str_replace('###QTOBJECT###', '<div id="' . $replaceElemIdStr . '">' . $alternativeContent . '</div>', $layout);
}
$width = $this->stdWrap($conf['width'], $conf['width.']);
$height = $this->stdWrap($conf['height'], $conf['height.']);
$width = $width ? $width : $conf[$conf['type'] . '.']['defaultWidth'];
$height = $height ? $height : $conf[$conf['type'] . '.']['defaultHeight'];
$embed = 'var ' . $qtObject . ' = new QTObject("' . $GLOBALS['TSFE']->absRefPrefix . $filename . '", "' . $replaceElemIdStr . '", "' . $width . '", "' . $height . '");';
$content = $layout . '
<script type="text/javascript">
' . $embed . '
' . $params . '
</script>';
return $content;
}
......
* Various helper functions for content objects:
*
************************************/
/**
* Converts a given config in Flexform to a conf-Array
* @param string Flexform data
* @param array Array to write the data into, by reference
* @param boolean is set if called recursive. Don't call function with this parameter, it's used inside the function only
* @access public
*
*/
function readFlexformIntoConf($flexData, &$conf, $recursive=0) {
if ($recursive === 0) {
$flexData = t3lib_div::xml2array($flexData, 'T3');
}
if (is_array($flexData)) {
if (isset($flexData['data']['sDEF']['lDEF'])) {
$flexData = $flexData['data']['sDEF']['lDEF'];
}
foreach ($flexData as $key => $value) {
if (is_array($value['el']) && count($value['el']) > 0) {
foreach ($value['el'] as $ekey => $element) {
if (isset($element['vDEF'])) {
$conf[$ekey] = $element['vDEF'];
} else {
$this->readFlexformIntoConf($element, $conf[$key . '.'][$ekey . '.'], 1);
}
}
} else {
$this->readFlexformIntoConf($value['el'], $conf[$key . '.'], 1);
}
if ($value['vDEF']) {
$conf[$key] = $value['vDEF'];
}
}
}
}
/**
* Rename array keys with a given mapping table
* @param array Array by reference which should be remapped
* @param mixed if Array it is used for key renaming
*/
function arrayKeyMap(&$array, $mappingTable) {
if (is_array($mappingTable)) {
foreach ($mappingTable as $old => $new) {
if ($new && isset($array[$old])) {
$array[$new] = $array[$old];
unset ($array[$old]);
}
}
}
}
/**
* Returns all parents of the given PID (Page UID) list
*
* @param string A list of page Content-Element PIDs (Page UIDs) / stdWrap
typo3/sysext/cms/tslib/hooks/class.tx_cms_mediaitems.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Adds extra fields into 'media' flexform
*
* @package TYPO3
* @subpackage cms
*/
class tx_cms_mediaItems {
/**
* Load extra render types if they exist
*
* @param array $params: Existing types by reference
* @param array $conf: config array
*/
public function customMediaRenderTypes(&$params, $conf) {
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRenderTypes'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRenderTypes'] as $classRef) {
$hookObj = &t3lib_div::getUserObj($classRef);
$hookObj->customMediaRenderTypes($params, $conf);
}
}
}
/**
* Load extra predefined media params if they exist
*
* @param array $params: Existing types by reference
* @param array $conf: config array
*/
public function customMediaParams(&$params, $conf) {
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaParams'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaParams'] as $classRef) {
$hookObj = &t3lib_div::getUserObj($classRef);
$hookObj->customMediaParams($params, $conf);
}
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/hooks/class.tx_cms_mediaitems.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/hooks/class.tx_cms_mediaitems.php']);
}
?>
typo3/sysext/css_styled_content/pageTSconfig.txt (working copy)
text_size.disabled=1
image_frames.disabled = 1
CType.removeItems = div,rte,script,splash
CType.removeItems = div,rte,script,splash,swfobject,qtobject,multimedia
}
typo3/sysext/css_styled_content/static/constants.txt (working copy)
target = {$PAGE_TARGET}
}
styles.content.media {
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
videoPlayer = typo3/contrib/flashmedia/flvplayer.swf
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
defaultVideoWidth = 600
# cat=content/cMedia; type=int+; label= Video Media Height: define the default height for the media-object
defaultVideoHeight = 400
# cat=content/cMedia; type=int+; label= Audio Media Width: define the default width for the media-object
audioPlayer = typo3/contrib/flashmedia/player.swf
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
defaultAudioWidth = 300
# cat=content/cMedia; type=int+; label= Audio Media Height: define the default height for the media-object
defaultAudioHeight = 30
}
# cat=advanced/links; type=small; label= Target for internal links: Should match the name of the content PAGE-object in TypoScript when used with frames. Most cases: set to "" (empty). If you have frames in the template set to "page"
PAGE_TARGET =
typo3/sysext/css_styled_content/static/setup.txt (working copy)
}
}
# *****************
# CType: swfobject
# *****************
tt_content.swfobject = COA
tt_content.swfobject {
10 = < lib.stdheader
20 = SWFOBJECT
20 {
file =
width =
height =
flexParams.field = pi_flexform
alternativeContent.field = bodytext
layout = ###SWFOBJECT###
video {
player = {$styles.content.media.videoPlayer}
defaultWidth = {$styles.content.media.defaultVideoWidth}
defaultHeight = {$styles.content.media.defaultVideoHeight}
default {
params.quality = high
params.menu = false
params.allowScriptAccess = sameDomain
params.allowFullScreen = true
}
mapping {
}
}
audio {
player = {$styles.content.media.audioPlayer}
defaultWidth = {$styles.content.media.defaultAudioWidth}
defaultHeight = {$styles.content.media.defaultAudioHeight}
default {
params.quality = high
params.allowScriptAccess = sameDomain
params.menu = false
}
mapping {
flashvars.file = soundFile
}
}
}
20.stdWrap {
editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | SWFobject element:
}
}
# *****************
# CType: qtobject
# *****************
tt_content.qtobject = COA
tt_content.qtobject {
10 = < lib.stdheader
20 = QTOBJECT
20 {
file =
width =
height =
flexParams.field = pi_flexform
alternativeContent.field = bodytext
layout = ###QTOBJECT###
video {
player = {$styles.content.media.videoPlayer}
defaultWidth = {$styles.content.media.defaultVideoWidth}
defaultHeight = {$styles.content.media.defaultVideoHeight}
default {
params.quality = high
params.menu = false
params.allowScriptAccess = sameDomain
params.allowFullScreen = true
}
mapping {
}
}
audio {
player = {$styles.content.media.audioPlayer}
defaultWidth = {$styles.content.media.defaultAudioWidth}
defaultHeight = {$styles.content.media.defaultAudioHeight}
default {
params.quality = high
params.allowScriptAccess = sameDomain
params.menu = false
}
mapping {
flashvars.file = soundFile
}
}
}
20.stdWrap {
editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | QTobject element:
}
}
# *****************
# CType: media
# *****************
tt_content.media = COA
tt_content.media {
10 = < lib.stdheader
20 = MEDIA
20 {
flexParams.field = pi_flexform
alternativeContent < tt_content.text.20
alternativeContent.field = bodytext
type = video
renderType = auto
allowEmptyUrl = 0
fileExtHandler {
default = MEDIA
mp3 = SWF
mp4 = SWF
m4v = SWF
mov = QT
avi = MEDIA
asf = MEDIA
class = MEDIA
swa = SWF
flv = SWF
}
mimeConf.swfobject < tt_content.swfobject.20
mimeConf.qtobject < tt_content.qtobject.20
}
20.stdWrap {
editIcons = tt_content: pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | Media element:
}
}
# ******************
# CType: mailform
# ******************
typo3/sysext/css_styled_content/static/v3.8/constants.txt (working copy)
target = {$PAGE_TARGET}
}
styles.content.media {
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
videoPlayer = typo3/contrib/flashmedia/flvplayer.swf
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
defaultVideoWidth = 600
# cat=content/cMedia; type=int+; label= Video Media Height: define the default height for the media-object
defaultVideoHeight = 400
# cat=content/cMedia; type=int+; label= Audio Media Width: define the default width for the media-object
audioPlayer = typo3/contrib/flashmedia/player.swf
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
defaultAudioWidth = 300
# cat=content/cMedia; type=int+; label= Audio Media Height: define the default height for the media-object
defaultAudioHeight = 30
}
# cat=advanced/links; type=small; label= Target for internal links: Should match the name of the content PAGE-object in TypoScript when used with frames. Most cases: Set to "page" if you have frames in the template. If not, set to "" (empty)
PAGE_TARGET = page
typo3/sysext/css_styled_content/static/v3.8/setup.txt (working copy)
}
}
# *****************
# CType: swfobject
# *****************
tt_content.swfobject = COA
tt_content.swfobject {
10 = < lib.stdheader
20 = SWFOBJECT
20 {
file =
width =
height =
flexParams.field = pi_flexform
alternativeContent.field = bodytext
layout = ###SWFOBJECT###
video {
player = {$styles.content.media.videoPlayer}
defaultWidth = {$styles.content.media.defaultVideoWidth}
defaultHeight = {$styles.content.media.defaultVideoHeight}
default {
params.quality = high
params.menu = false
params.allowScriptAccess = sameDomain
params.allowFullScreen = true
}
mapping {
}
}
audio {
player = {$styles.content.media.audioPlayer}
defaultWidth = {$styles.content.media.defaultAudioWidth}
defaultHeight = {$styles.content.media.defaultAudioHeight}
default {
params.quality = high
params.allowScriptAccess = sameDomain
params.menu = false
}
mapping {
flashvars.file = soundFile
}
}
}
20.stdWrap {
editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | SWFobject element:
}
}
# *****************
# CType: qtobject
# *****************
tt_content.qtobject = COA
tt_content.qtobject {
10 = < lib.stdheader
20 = QTOBJECT
20 {
file =
width =
height =
flexParams.field = pi_flexform
alternativeContent.field = bodytext
layout = ###QTOBJECT###
video {
player = {$styles.content.media.videoPlayer}
defaultWidth = {$styles.content.media.defaultVideoWidth}
defaultHeight = {$styles.content.media.defaultVideoHeight}
default {
params.quality = high
params.menu = false
params.allowScriptAccess = sameDomain
params.allowFullScreen = true
}
mapping {
}
}
audio {
player = {$styles.content.media.audioPlayer}
defaultWidth = {$styles.content.media.defaultAudioWidth}
defaultHeight = {$styles.content.media.defaultAudioHeight}
default {
params.quality = high
params.allowScriptAccess = sameDomain
params.menu = false
}
mapping {
flashvars.file = soundFile
}
}
}
20.stdWrap {
editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | QTobject element:
}
}
# *****************
# CType: media
# *****************
tt_content.media = COA
tt_content.media {
10 = < lib.stdheader
20 = MEDIA
20 {
flexParams.field = pi_flexform
alternativeContent < tt_content.text.20
alternativeContent.field = bodytext
type = video
renderType = auto
allowEmptyUrl = 0
fileExtHandler {
default = MEDIA
mp3 = SWF
mp4 = SWF
m4v = SWF
mov = QT
avi = MEDIA
asf = MEDIA
class = MEDIA
swa = SWF
flv = SWF
}
mimeConf.swfobject < tt_content.swfobject.20
mimeConf.qtobject < tt_content.qtobject.20
}
20.stdWrap {
editIcons = tt_content: pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | Media element:
}
}
# ******************
# CType: mailform
# ******************
typo3/sysext/css_styled_content/static/v3.9/constants.txt (working copy)
target = {$PAGE_TARGET}
}
styles.content.media {
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
videoPlayer = typo3/contrib/flashmedia/flvplayer.swf
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
defaultVideoWidth = 600
# cat=content/cMedia; type=int+; label= Video Media Height: define the default height for the media-object
defaultVideoHeight = 400
# cat=content/cMedia; type=int+; label= Audio Media Width: define the default width for the media-object
audioPlayer = typo3/contrib/flashmedia/player.swf
# cat=content/cMedia; type=int+; label= Video Media Width: define the default width for the media-object
defaultAudioWidth = 300
# cat=content/cMedia; type=int+; label= Audio Media Height: define the default height for the media-object
defaultAudioHeight = 30
}
# cat=advanced/links; type=small; label= Target for internal links: Should match the name of the content PAGE-object in TypoScript when used with frames. Most cases: Set to "page" if you have frames in the template. If not, set to "" (empty)
PAGE_TARGET = page
typo3/sysext/css_styled_content/static/v3.9/setup.txt (working copy)
}
# *****************
# CType: swfobject
# *****************
tt_content.swfobject = COA
tt_content.swfobject {
10 = < lib.stdheader
20 = SWFOBJECT
20 {
file =
width =
height =
flexParams.field = pi_flexform
alternativeContent.field = bodytext
layout = ###SWFOBJECT###
video {
player = {$styles.content.media.videoPlayer}
defaultWidth = {$styles.content.media.defaultVideoWidth}
defaultHeight = {$styles.content.media.defaultVideoHeight}
default {
params.quality = high
params.menu = false
params.allowScriptAccess = sameDomain
params.allowFullScreen = true
}
mapping {
}
}
audio {
player = {$styles.content.media.audioPlayer}
defaultWidth = {$styles.content.media.defaultAudioWidth}
defaultHeight = {$styles.content.media.defaultAudioHeight}
default {
params.quality = high
params.allowScriptAccess = sameDomain
params.menu = false
}
mapping {
flashvars.file = soundFile
}
}
}
20.stdWrap {
editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | SWFobject element:
}
}
# *****************
# CType: qtobject
# *****************
tt_content.qtobject = COA
tt_content.qtobject {
10 = < lib.stdheader
20 = QTOBJECT
20 {
file =
width =
height =
flexParams.field = pi_flexform
alternativeContent.field = bodytext
layout = ###QTOBJECT###
video {
player = {$styles.content.media.videoPlayer}
defaultWidth = {$styles.content.media.defaultVideoWidth}
defaultHeight = {$styles.content.media.defaultVideoHeight}
default {
params.quality = high
params.menu = false
params.allowScriptAccess = sameDomain
params.allowFullScreen = true
}
mapping {
}
}
audio {
player = {$styles.content.media.audioPlayer}
defaultWidth = {$styles.content.media.defaultAudioWidth}
defaultHeight = {$styles.content.media.defaultAudioHeight}
default {
params.quality = high
params.allowScriptAccess = sameDomain
params.menu = false
}
mapping {
flashvars.file = soundFile
}
}
}
20.stdWrap {
editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
prefixComment = 2 | QTobject element:
}
}
# *****************
# CType: media
# *****************
tt_content.media = COA
tt_content.media {
10 = < lib.stdheader
20 = MEDIA
20 {
flexParams.field = pi_flexform
alternativeContent < tt_content.text.20
alternativeContent.field = bodytext
type = video
renderType = auto
allowEmptyUrl = 0
fileExtHandler {
default = MEDIA
mp3 = SWF
mp4 = SWF
m4v = SWF
mov = QT
... This diff was truncated because it exceeds the maximum size that can be displayed.
(6-6/7)