Esempio n. 1
0
// Register additional content objects
$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['MULTIMEDIA'] = \FoT3\Mediace\ContentObject\MultimediaContentObject::class;
$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['MEDIA'] = \FoT3\Mediace\ContentObject\MediaContentObject::class;
$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['SWFOBJECT'] = \FoT3\Mediace\ContentObject\ShockwaveFlashObjectContentObject::class;
$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['FLOWPLAYER'] = \FoT3\Mediace\ContentObject\FlowPlayerContentObject::class;
$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['QTOBJECT'] = \FoT3\Mediace\ContentObject\QuicktimeObjectContentObject::class;
// Register the "media" CType to the "New Content Element" wizard
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
	mod.wizards.newContentElement.wizardItems {
		special.elements.media {
			iconIdentifier = content-special-media
			title = LLL:EXT:mediace/Resources/Private/Language/locallang.xlf:newContentElementWizard.media.title
			description = LLL:EXT:mediace/Resources/Private/Language/locallang.xlf:newContentElementWizard.media.description
			tt_content_defValues.CType = media
		}
		special.show := addToList(media)
	}
');
// Add Default TypoScript for CType "media" and "multimedia" after default content rendering
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('mediace', 'constants', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:mediace/Configuration/TypoScript/constants.txt">', 'defaultContentRendering');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('mediace', 'setup', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:mediace/Configuration/TypoScript/setup.txt">', 'defaultContentRendering');
if (TYPO3_MODE === 'FE') {
    // Register the basic media wizard provider
    \FoT3\Mediace\MediaWizard\MediaWizardProviderManager::registerMediaWizardProvider(\FoT3\Mediace\MediaWizard\MediaWizardProvider::class);
    // Register FLV validation callback for FLV player
    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['validateHash'] = 'EXT:mediace/Resources/PHP/ValidateHashEID.php';
}
if (TYPO3_MODE === 'BE') {
    // Register for hook to show preview of tt_content element of CType="multimedia" in page module
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['multimedia'] = \FoT3\Mediace\Hooks\PageLayoutView\MultimediaPreviewRenderer::class;
}
Esempio n. 2
0
 /**
  * Resolves the URL of an file
  *
  * @param string $file
  * @return string|NULL
  */
 protected function retrieveMediaUrl($file)
 {
     $returnValue = null;
     // because the file value can possibly have link parameters, use explode to split all values
     $fileParts = explode(' ', $file);
     /** @var $mediaWizard \FoT3\Mediace\MediaWizard\MediaWizardProviderInterface */
     $mediaWizard = \FoT3\Mediace\MediaWizard\MediaWizardProviderManager::getValidMediaWizardProvider($fileParts[0]);
     // Get the path relative to the page currently outputted
     if (substr($fileParts[0], 0, 5) === 'file:') {
         $fileUid = substr($fileParts[0], 5);
         if (!empty($fileUid) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($fileUid)) {
             $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
             if ($fileObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) {
                 $returnValue = $fileObject->getPublicUrl();
             }
         }
     } elseif (is_file(PATH_site . $fileParts[0])) {
         $returnValue = $GLOBALS['TSFE']->tmpl->getFileName($fileParts[0]);
     } elseif ($mediaWizard !== null) {
         $jumpUrlEnabled = $GLOBALS['TSFE']->config['config']['jumpurl_enable'];
         $GLOBALS['TSFE']->config['config']['jumpurl_enable'] = 0;
         $returnValue = $this->cObj->typoLink_URL(array('parameter' => $mediaWizard->rewriteUrl($fileParts[0])));
         $GLOBALS['TSFE']->config['config']['jumpurl_enable'] = $jumpUrlEnabled;
     } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($fileParts[0])) {
         $returnValue = $fileParts[0];
     }
     return $returnValue;
 }