Ejemplo n.º 1
0
    /**
     * Render videos from various video portals
     *
     * @param Tx_News_Domain_Model_Media $element
     * @param integer $width
     * @param integer $height
     * @return string
     */
    public function render(Tx_News_Domain_Model_Media $element, $width, $height)
    {
        $content = $finalUrl = '';
        $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
        // get the correct rewritten url
        $mediaWizard = tslib_mediaWizardManager::getValidMediaWizardProvider($url);
        if ($mediaWizard !== NULL) {
            $finalUrl = $mediaWizard->rewriteUrl($url);
        }
        // override width & height if both are set
        if ($element->getWidth() > 0 && $element->getHeight() > 0) {
            $width = $element->getWidth();
            $height = $element->getHeight();
        }
        if (!empty($finalUrl)) {
            $GLOBALS['TSFE']->getPageRenderer()->addJsFile('typo3conf/ext/news/Resources/Public/JavaScript/Contrib/swfobject-2-2.js');
            $uniqueDivId = 'mediaelement' . md5($element->getUid() . uniqid());
            $content .= '<div id="' . $uniqueDivId . '"></div>
						<script type="text/javascript">
							var params = { allowScriptAccess: "always" };
							var atts = { id: "' . $uniqueDivId . '" };
							swfobject.embedSWF("' . htmlspecialchars($finalUrl) . '",
							"' . $uniqueDivId . '", "' . (int) $width . '", "' . (int) $height . '", "8", null, null, params, atts);
						</script>';
        }
        return $content;
    }
Ejemplo n.º 2
0
	forms.show = mailform,search,login

	plugins.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:plugins
	plugins.elements {
		general {
			icon = gfx/c_wiz/user_defined.gif
			title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:plugins_general_title
			description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:plugins_general_description
			tt_content_defValues.CType = list
		}
	}
	plugins.show = *
}

');
$TYPO3_CONF_VARS['SYS']['contentTable'] = 'tt_content';
$TYPO3_CONF_VARS['FE']['eID_include']['tx_cms_showpic'] = 'EXT:cms/tslib/showpic.php';
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['compat_version']['cms'] = array('title' => 'CMS Frontend', 'version' => 4000000, 'description' => '<ul>' . '<li><p>Word separator character for simulateStaticDocument is changed from ' . 'underscore (_) to hyphen (-) to make URLs more friendly for search engines' . 'URLs that are already existing (e.g. external links to your site) will still work like before.</p>' . '<p>You can set the separator character back to an underscore by putting the following line into the ' . '<strong>Setup</strong> section of your Page TypoScript template:</p>' . '<p style="margin-top: 5px; white-space: nowrap;"><code>config.simulateStaticDocuments_replacementChar = _</code></p></li>' . '<li><p>CSS Stylesheets and JavaScript are put into an external file by default.</p>' . '<p>Technically, that means that the default value of "config.inlineStyle2TempFile" is now set to "1" and that of "config.removeDefaultJS" to "external"</p></li>' . '</ul>');
// registering hooks for the treelist cache
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:cms/tslib/hooks/class.tx_cms_treelistcacheupdate.php:&tx_cms_treelistCacheUpdate';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'EXT:cms/tslib/hooks/class.tx_cms_treelistcacheupdate.php:&tx_cms_treelistCacheUpdate';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'][] = 'EXT:cms/tslib/hooks/class.tx_cms_treelistcacheupdate.php:&tx_cms_treelistCacheUpdate';
if (TYPO3_MODE === 'FE') {
    // Register the core media wizard provider
    tslib_mediaWizardManager::registerMediaWizardProvider('tslib_mediaWizardCoreProvider');
    // register eID provider for ExtDirect for the frontend
    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['ExtDirect'] = PATH_tslib . 'extdirecteid.php';
}
// register search keys
$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['page'] = 'pages';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['content'] = 'tt_content';
 /**
  * Rendering the cObject, MEDIA
  *
  * @param	array		Array of TypoScript properties
  * @return	string		Output
  */
 public function render($conf = array())
 {
     $content = $mmFile = '';
     $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 = isset($conf['file.']) ? $this->cObj->stdWrap($conf['parameter.']['mmFile'], $conf['file.']) : $conf['parameter.']['mmFile'];
         $mmFile = $url;
     } else {
         // it is a TS object
         $url = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file'];
     }
     $mode = is_file(PATH_site . $url) ? 'file' : 'url';
     $fileinfo = NULL;
     if ($mode === 'file') {
         // render FILE
         $filename = $GLOBALS['TSFE']->tmpl->getFileName($url);
         $fileinfo = t3lib_div::split_fileref($filename);
         $conf['file'] = $filename;
     } else {
         // render URL
         // use media wizard to extract video from URL
         $mediaWizard = tslib_mediaWizardManager::getValidMediaWizardProvider($url);
         if ($mediaWizard !== NULL) {
             $url = $mediaWizard->rewriteUrl($url);
         }
         $conf['file'] = $this->cObj->typoLink_URL(array('parameter' => $url));
     }
     $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
         $renderType = 'swf';
         $handler = array_keys($conf['fileExtHandler.']);
         if (is_array($fileinfo) && in_array($fileinfo['fileext'], $handler)) {
             $renderType = strtolower($conf['fileExtHandler.'][$fileinfo['fileext']]);
         }
     }
     $mmForcePlayer = isset($conf['parameter.']['mmforcePlayer.']) ? $this->cObj->stdWrap($conf['parameter.']['mmforcePlayer'], $conf['parameter.']['mmforcePlayer.']) : $conf['parameter.']['mmforcePlayer'];
     $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 = 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 {
         $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 {
         $height = isset($conf['height.']) ? intval($this->cObj->stdWrap($conf['height'], $conf['height.'])) : intval($conf['height']);
         $conf['height'] = $height ? $height : $typeConf['defaultHeight'];
     }
     if (is_array($conf['parameter.']['mmMediaOptions'])) {
         $params = $parts = array();
         foreach ($conf['parameter.']['mmMediaOptions'] as $key => $value) {
             if ($key == 'mmMediaCustomParameterContainer') {
                 foreach ($value as $val) {
                     //custom parameter entry
                     $rawTS = $val['mmParamCustomEntry'];
                     //read and merge
                     $tmp = t3lib_div::trimExplode(LF, $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;
                                 }
                             }
                         }
                     }
                 }
             } elseif ($key == 'mmMediaOptionsContainer') {
                 foreach ($value as $val) {
                     if (isset($val['mmParamSet'])) {
                         $pName = $val['mmParamName'];
                         $pSet = $val['mmParamSet'];
                         $pValue = $pSet == 2 ? $val['mmParamValue'] : ($pSet == 0 ? 'false' : 'true');
                         $conf['predefined'][$pName] = $pValue;
                     }
                 }
             }
         }
     }
     // render MEDIA
     if ($mode == 'url' && !$forcePlayer) {
         // url is called direct, not with player
         if ($url == '' && !$conf['allowEmptyUrl']) {
             return '<p style="background-color: yellow;">' . $GLOBALS['TSFE']->sL('LLL:EXT:cms/locallang_ttc.xml:media.noFile', TRUE) . '</p>';
         }
         $conf = array_merge((array) $conf['mimeConf.']['swfobject.'], $conf);
         $conf[$conf['type'] . '.']['player'] = strpos($url, '://') === FALSE ? 'http://' . $url : $url;
         $conf['installUrl'] = 'null';
         $conf['flashvars'] = array_merge((array) $conf['flashvars'], $conf['predefined']);
     }
     switch ($renderType) {
         case 'swf':
             $conf[$conf['type'] . '.'] = array_merge((array) $conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf);
             $conf = array_merge((array) $conf['mimeConf.']['swfobject.'], $conf);
             unset($conf['mimeConf.']);
             $conf['flashvars.'] = array_merge((array) $conf['flashvars.'], $conf['predefined']);
             $content = $this->cObj->SWFOBJECT($conf);
             break;
         case 'qt':
             $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf);
             $conf = array_merge($conf['mimeConf.']['qtobject.'], $conf);
             unset($conf['mimeConf.']);
             $conf['params.'] = array_merge((array) $conf['params.'], $conf['predefined']);
             $content = $this->cObj->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 . LF;
             }
             $content = $this->cObj->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;
                     $conf['mode'] = $mode;
                     $content = $hookObj->customMediaRender($renderType, $conf, $this);
                 }
             }
     }
     if (isset($conf['stdWrap.'])) {
         $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
     }
     return $content;
 }