Bug #23535 » 15699.diff
typo3/sysext/cms/ext_autoload.php (working copy) | ||
---|---|---|
'tslib_gmenu_foldout' => PATH_tslib . 'media/scripts/gmenu_foldout.php',
|
||
'tslib_gmenu_layers' => PATH_tslib . 'media/scripts/gmenu_layers.php',
|
||
'tslib_tmenu_layers' => PATH_tslib . 'media/scripts/tmenu_layers.php',
|
||
'tslib_mediawizard' => PATH_tslib . 'class.tslib_mediawizard.php',
|
||
);
|
||
?>
|
typo3/sysext/cms/tslib/class.tslib_content.php (working copy) | ||
---|---|---|
$mode = is_file(PATH_site . $url) ? 'file' : 'url';
|
||
if ($mode === 'file') {
|
||
// render FILE
|
||
$filename = $GLOBALS['TSFE']->tmpl->getFileName($url);
|
||
$fileinfo = t3lib_div::split_fileref($filename);
|
||
$conf['file'] = $filename;
|
||
} else {
|
||
$conf['file'] = $this->typoLink_URL(array(
|
||
'parameter' => $url
|
||
));
|
||
}
|
||
$forcePlayer = isset($conf['parameter.']['mmFile']) ? intval($conf['parameter.']['mmforcePlayer']) : $conf['forcePlayer'];
|
||
$conf['forcePlayer'] = $forcePlayer;
|
||
$renderType = $conf['renderType'];
|
||
if (isset($conf['parameter.']['mmRenderType'])) {
|
||
$renderType = $conf['parameter.']['mmRenderType'];
|
||
... | ... | |
}
|
||
}
|
||
$forcePlayer = isset($conf['parameter.']['mmFile']) ? intval($conf['parameter.']['mmforcePlayer']) : $conf['forcePlayer'];
|
||
$conf['forcePlayer'] = $forcePlayer;
|
||
$conf['type'] = isset($conf['parameter.']['mmType']) ? $conf['parameter.']['mmType'] : $conf['type'];
|
||
$mime = $renderType . 'object';
|
||
$typeConf = $conf['mimeConf.'][$mime . '.'][$conf['type'] . '.'] ? $conf['mimeConf.'][$mime . '.'][$conf['type'] . '.'] : array();
|
||
... | ... | |
$conf['height'] = intval($conf['height']) ? $conf['height'] : $typeConf['defaultHeight'];
|
||
}
|
||
// render URL
|
||
if ($mode !== 'file') {
|
||
// use media wizard to extract video from URL
|
||
$mediaWizard = t3lib_div::makeInstance('tslib_mediaWizard', $conf['width'], $conf['height']);
|
||
$url = $mediaWizard->parseMediaUrl($url);
|
||
$conf['file'] = $this->typoLink_URL(array(
|
||
'parameter' => $url
|
||
));
|
||
}
|
||
if (is_array($conf['parameter.']['mmMediaOptions'])) {
|
||
$params = array();
|
||
foreach ($conf['parameter.']['mmMediaOptions'] as $key => $value) {
|
typo3/sysext/cms/tslib/class.tslib_mediawizard.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2010 Aishwara M.B. (aishu.moorthy@gmail.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!
|
||
***************************************************************/
|
||
/**
|
||
* Contains wizard for media urls
|
||
*
|
||
* $Id: $
|
||
|
||
* @author Aishwara M.B.<aishu.moorthy@gmail.com>
|
||
* @author Steffen Kamper <info@sk-typo3.de>
|
||
*/
|
||
|
||
|
||
class tslib_mediaWizard {
|
||
|
||
protected $provider = array ();
|
||
protected $width;
|
||
protected $height;
|
||
|
||
/**
|
||
* Constructor
|
||
*
|
||
* @param void
|
||
* @return void
|
||
*/
|
||
public function __construct($width, $height) {
|
||
$this->width = $width;
|
||
$this->height = $height;
|
||
|
||
$this->registerProvider();
|
||
}
|
||
|
||
/**
|
||
* Register provider for processing. Add own provider first, then add provider from hooks
|
||
*
|
||
* @param void
|
||
* @return void
|
||
*/
|
||
protected function registerProvider() {
|
||
$this->provider = array (
|
||
'youtube' => 'tslib_mediaWizard',
|
||
'dailymotion' => 'tslib_mediaWizard',
|
||
'sevenload' => 'tslib_mediaWizard',
|
||
'vimeo' => 'tslib_mediaWizard',
|
||
'clipfish' => 'tslib_mediaWizard',
|
||
'mtv' => 'tslib_mediaWizard',
|
||
'google' => 'tslib_mediaWizard',
|
||
'metacafe' => 'tslib_mediaWizard',
|
||
'myvideo' => 'tslib_mediaWizard',
|
||
'liveleak' => 'tslib_mediaWizard',
|
||
'veoh' => 'tslib_mediaWizard'
|
||
)
|
||
|
||
;
|
||
|
||
//add external registered providers
|
||
//must have a static function. E.g. provider is "universe", there must be a function $class::process_universe
|
||
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_mediawizard.php']['mediaProvider'])) {
|
||
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_mediawizard.php']['mediaProvider'] as $provider => $class) {
|
||
$this->provider[$provider] = $class;
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Parse the url with the given providers
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
public function parseMediaUrl($url) {
|
||
$urlInfo = parse_url($url);
|
||
$hostName = t3lib_div::trimExplode('.', $urlInfo['host'], TRUE);
|
||
|
||
foreach ($this->provider as $provider => $class) {
|
||
$provider = strtolower($provider);
|
||
$functionName = 'process_' . $provider;
|
||
if (in_array($provider, $hostName) && is_callable(array (
|
||
$class, $functionName
|
||
))) {
|
||
if ($class === 'tslib_mediaWizard') {
|
||
return $this->$functionName($url);
|
||
} else {
|
||
$instance = t3lib_div::makeInstance($class);
|
||
return $instance->$functionName($url);
|
||
}
|
||
|
||
}
|
||
}
|
||
// no provider found, return unprocessed url
|
||
return $url;
|
||
}
|
||
|
||
/**
|
||
* Parse youtube url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_youtube($url) {
|
||
if (strpos($url, '/user/') !== FALSE) {
|
||
// it's a channel
|
||
$parts = explode('/', $url);
|
||
$videoId = $parts[count($parts) - 1];
|
||
} else {
|
||
preg_match('/v=([^(\&|$)]*)/', $url, $matches);
|
||
$videoId = $matches[1];
|
||
}
|
||
|
||
return 'http://www.youtube.com/v/' . $videoId . '?fs=1';
|
||
}
|
||
|
||
/**
|
||
* Parse dailymotion url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_dailymotion($url) {
|
||
$parts = explode('video/', $url);
|
||
$videoId = $parts[1];
|
||
if (strpos($videoId, '/') !== FALSE) {
|
||
$videoId = substr($videoId, 0, strpos($videoId, '/'));
|
||
}
|
||
|
||
return 'http://www.dailymotion.com/swf/' . $videoId;
|
||
}
|
||
|
||
/**
|
||
* Parse sevenload url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url and preview image
|
||
*/
|
||
protected function process_sevenload($url) {
|
||
$parts = explode('/', $url);
|
||
$videoId = $parts[count($parts) - 1];
|
||
if (strpos($videoId, '-') !== FALSE) {
|
||
$videoId = substr($videoId, 0, strpos($videoId, '-'));
|
||
}
|
||
|
||
return 'http://de.sevenload.com/pl/' . $videoId . '/400x500/swf';
|
||
}
|
||
|
||
/**
|
||
* Parse vimeo url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_vimeo($url) {
|
||
$videoId = str_replace(
|
||
array('http://www.vimeo.com/', 'http://vimeo.com/'),
|
||
array('', ''),
|
||
$url
|
||
);
|
||
|
||
return 'http://vimeo.com/moogaloop.swf?&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=19a3ff&fullscreen=1&clip_id=' .
|
||
$videoId;
|
||
}
|
||
|
||
/**
|
||
* Parse clipfish url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_clipfish($url) {
|
||
preg_match('/video([^(\&|$)]*)/', $url, $matches);
|
||
$parts = explode('/', $matches[1]);
|
||
$videoId = $parts[1];
|
||
|
||
return 'http://www.clipfish.de/cfng/flash/clipfish_player_3.swf?as=0&r=1&noad=1&fs=1&vid=' . $videoId;
|
||
}
|
||
|
||
|
||
/**
|
||
* Parse google url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_google($url) {
|
||
preg_match('/docid=([^(\&|$)]*)/', $url, $matches);
|
||
$videoId = $matches[1];
|
||
|
||
return 'http://video.google.com/googleplayer.swf?docid=' . $videoId;
|
||
}
|
||
|
||
/**
|
||
* Parse metacafe url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
|
||
protected function process_metacafe($url) {
|
||
preg_match('/watch([^(\&|$)]*)/', $url, $matches);
|
||
$parts = explode('/', $matches[1]);
|
||
$videoId = $parts[1];
|
||
|
||
return 'http://www.metacafe.com/fplayer/' . $videoId . '/.swf';
|
||
}
|
||
|
||
/**
|
||
* Parse myvideo url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
|
||
protected function process_myvideo($url) {
|
||
preg_match('/watch([^(\&|$)]*)/', $url, $matches);
|
||
$parts = explode('/', $matches[1]);
|
||
$videoId = $parts[1];
|
||
|
||
return 'http://www.myvideo.de/movie/' . $videoId . '/';
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* Parse liveleak url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_liveleak($url) {
|
||
preg_match('/i=([^(\&|$)]*)/', $url, $matches);
|
||
$videoId = $matches[1];
|
||
|
||
return 'http://www.liveleak.com/e/' . $videoId;
|
||
}
|
||
|
||
/**
|
||
* Parse veoh url
|
||
*
|
||
* @param string $url
|
||
* @return string processed url
|
||
*/
|
||
protected function process_veoh($url) {
|
||
preg_match('/watch\/([^(\&|$)]*)/', $url, $matches);
|
||
$videoId = $matches[1];
|
||
|
||
return 'http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId=' . $videoId;
|
||
}
|
||
|
||
}
|
||
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_mediawizard.php']) {
|
||
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_mediawizard.php']);
|
||
}
|
||
|
||
?>
|