[!!!][TASK] Move MediaWizard functionality to EXT:mediace 90/37890/3
authorBenjamin Mack <benni@typo3.org>
Mon, 16 Mar 2015 17:32:31 +0000 (18:32 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 25 Mar 2015 18:50:55 +0000 (19:50 +0100)
In order to move all existing "media" functionality in its separate extension
the last part (MediaWizard functionality) is moved as well.

All leftover class alias maps are streamlined as well, thus, marking
the last change of migrating all media-related code to a
separate system extension.

Releases: master
Resolves: #65778
Change-Id: I0ec7a3070c9033e87c7d68b609295e8414350e28
Reviewed-on: http://review.typo3.org/37890
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
15 files changed:
typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-65778-MediaWizardProviderMovedToSystemExtension.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProvider.php [deleted file]
typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProviderInterface.php [deleted file]
typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProviderManager.php [deleted file]
typo3/sysext/frontend/Tests/Unit/MediaWizard/MediaWizardProviderTest.php [deleted file]
typo3/sysext/frontend/ext_localconf.php
typo3/sysext/mediace/Classes/ContentObject/MediaContentObject.php
typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProvider.php [new file with mode: 0644]
typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProviderInterface.php [new file with mode: 0644]
typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProviderManager.php [new file with mode: 0644]
typo3/sysext/mediace/Migrations/Code/ClassAliasMap.php
typo3/sysext/mediace/Tests/Unit/MediaWizard/MediaWizardProviderTest.php [new file with mode: 0644]
typo3/sysext/mediace/composer.json
typo3/sysext/mediace/ext_localconf.php

index 18a9c18..e5c8b22 100644 (file)
@@ -965,24 +965,24 @@ return array(
        'tslib_content_File' => \TYPO3\CMS\Frontend\ContentObject\FileContentObject::class,
        'tslib_content_fileLinkHook' => \TYPO3\CMS\Frontend\ContentObject\FileLinkHookInterface::class,
        'tslib_content_Files' => \TYPO3\CMS\Frontend\ContentObject\FilesContentObject::class,
        'tslib_content_File' => \TYPO3\CMS\Frontend\ContentObject\FileContentObject::class,
        'tslib_content_fileLinkHook' => \TYPO3\CMS\Frontend\ContentObject\FileLinkHookInterface::class,
        'tslib_content_Files' => \TYPO3\CMS\Frontend\ContentObject\FilesContentObject::class,
-       'tslib_content_FlowPlayer' => \TYPO3\CMS\Frontend\ContentObject\FlowPlayerContentObject::class,
+       'tslib_content_FlowPlayer' => \TYPO3\CMS\Mediace\ContentObject\FlowPlayerContentObject::class,
        'tslib_content_FluidTemplate' => \TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class,
        'tslib_content_Form' => \TYPO3\CMS\Compatibility6\ContentObject\FormContentObject::class,
        'tslib_content_HierarchicalMenu' => \TYPO3\CMS\Frontend\ContentObject\HierarchicalMenuContentObject::class,
        'tslib_content_HorizontalRuler' => \TYPO3\CMS\Compatibility6\ContentObject\HorizontalRulerContentObject::class,
        'tslib_content_Image' => \TYPO3\CMS\Frontend\ContentObject\ImageContentObject::class,
        'tslib_content_ImageResource' => \TYPO3\CMS\Frontend\ContentObject\ImageResourceContentObject::class,
        'tslib_content_FluidTemplate' => \TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class,
        'tslib_content_Form' => \TYPO3\CMS\Compatibility6\ContentObject\FormContentObject::class,
        'tslib_content_HierarchicalMenu' => \TYPO3\CMS\Frontend\ContentObject\HierarchicalMenuContentObject::class,
        'tslib_content_HorizontalRuler' => \TYPO3\CMS\Compatibility6\ContentObject\HorizontalRulerContentObject::class,
        'tslib_content_Image' => \TYPO3\CMS\Frontend\ContentObject\ImageContentObject::class,
        'tslib_content_ImageResource' => \TYPO3\CMS\Frontend\ContentObject\ImageResourceContentObject::class,
-       'tslib_content_ImageText' => \TYPO3\CMS\Frontend\ContentObject\ImageTextContentObject::class,
+       'tslib_content_ImageText' => \TYPO3\CMS\Compatibility6\ContentObject\ImageTextContentObject::class,
        'tslib_content_LoadRegister' => \TYPO3\CMS\Frontend\ContentObject\LoadRegisterContentObject::class,
        'tslib_content_LoadRegister' => \TYPO3\CMS\Frontend\ContentObject\LoadRegisterContentObject::class,
-       'tslib_content_Media' => \TYPO3\CMS\Frontend\ContentObject\MediaContentObject::class,
-       'tslib_content_Multimedia' => \TYPO3\CMS\Frontend\ContentObject\MultimediaContentObject::class,
+       'tslib_content_Media' => \TYPO3\CMS\Mediace\ContentObject\MediaContentObject::class,
+       'tslib_content_Multimedia' => \TYPO3\CMS\Mediace\ContentObject\MultimediaContentObject::class,
        'tslib_content_OffsetTable' => \TYPO3\CMS\Compatibility6\ContentObject\OffsetTableContentObject::class,
        'tslib_content_OffsetTable' => \TYPO3\CMS\Compatibility6\ContentObject\OffsetTableContentObject::class,
-       'tslib_content_QuicktimeObject' => \TYPO3\CMS\Frontend\ContentObject\QuicktimeObjectContentObject::class,
+       'tslib_content_QuicktimeObject' => \TYPO3\CMS\Mediace\ContentObject\QuicktimeObjectContentObject::class,
        'tslib_content_Records' => \TYPO3\CMS\Frontend\ContentObject\RecordsContentObject::class,
        'tslib_content_RestoreRegister' => \TYPO3\CMS\Frontend\ContentObject\RestoreRegisterContentObject::class,
        'tslib_content_ScalableVectorGraphics' => \TYPO3\CMS\Frontend\ContentObject\ScalableVectorGraphicsContentObject::class,
        'tslib_content_Records' => \TYPO3\CMS\Frontend\ContentObject\RecordsContentObject::class,
        'tslib_content_RestoreRegister' => \TYPO3\CMS\Frontend\ContentObject\RestoreRegisterContentObject::class,
        'tslib_content_ScalableVectorGraphics' => \TYPO3\CMS\Frontend\ContentObject\ScalableVectorGraphicsContentObject::class,
-       'tslib_content_SearchResult' => \TYPO3\CMS\Frontend\ContentObject\SearchResultContentObject::class,
-       'tslib_content_ShockwaveFlashObject' => \TYPO3\CMS\Frontend\ContentObject\ShockwaveFlashObjectContentObject::class,
+       'tslib_content_SearchResult' => \TYPO3\CMS\Compatibility6\ContentObject\SearchResultContentObject::class,
+       'tslib_content_ShockwaveFlashObject' => \TYPO3\CMS\Mediace\ContentObject\ShockwaveFlashObjectContentObject::class,
        'tslib_content_Template' => \TYPO3\CMS\Frontend\ContentObject\TemplateContentObject::class,
        'tslib_content_Text' => \TYPO3\CMS\Frontend\ContentObject\TextContentObject::class,
        'tslib_content_User' => \TYPO3\CMS\Frontend\ContentObject\UserContentObject::class,
        'tslib_content_Template' => \TYPO3\CMS\Frontend\ContentObject\TemplateContentObject::class,
        'tslib_content_Text' => \TYPO3\CMS\Frontend\ContentObject\TextContentObject::class,
        'tslib_content_User' => \TYPO3\CMS\Frontend\ContentObject\UserContentObject::class,
@@ -994,7 +994,7 @@ return array(
        'tslib_jsmenu' => \TYPO3\CMS\Frontend\ContentObject\Menu\JavaScriptMenuContentObject::class,
        'tslib_tmenu' => \TYPO3\CMS\Frontend\ContentObject\Menu\TextMenuContentObject::class,
        'tslib_tableOffset' => \TYPO3\CMS\Compatibility6\ContentObject\OffsetTableContentObject::class,
        'tslib_jsmenu' => \TYPO3\CMS\Frontend\ContentObject\Menu\JavaScriptMenuContentObject::class,
        'tslib_tmenu' => \TYPO3\CMS\Frontend\ContentObject\Menu\TextMenuContentObject::class,
        'tslib_tableOffset' => \TYPO3\CMS\Compatibility6\ContentObject\OffsetTableContentObject::class,
-       'tslib_search' => \TYPO3\CMS\Frontend\ContentObject\SearchResultContentObject::class,
+       'tslib_search' => \TYPO3\CMS\Compatibility6\ContentObject\SearchResultContentObject::class,
        'tslib_controlTable' => \TYPO3\CMS\Compatibility6\ContentObject\TableRenderer::class,
        'tslib_ExtDirectEid' => \TYPO3\CMS\Frontend\Controller\ExtDirectEidController::class,
        'tx_cms_webinfo_page' => \TYPO3\CMS\Frontend\Controller\PageInformationController::class,
        'tslib_controlTable' => \TYPO3\CMS\Compatibility6\ContentObject\TableRenderer::class,
        'tslib_ExtDirectEid' => \TYPO3\CMS\Frontend\Controller\ExtDirectEidController::class,
        'tx_cms_webinfo_page' => \TYPO3\CMS\Frontend\Controller\PageInformationController::class,
@@ -1005,9 +1005,9 @@ return array(
        'tx_cms_mediaItems' => \TYPO3\CMS\Frontend\Hooks\MediaItemHooks::class,
        'tx_cms_treelistCacheUpdate' => \TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::class,
        'tslib_gifBuilder' => \TYPO3\CMS\Frontend\Imaging\GifBuilder::class,
        'tx_cms_mediaItems' => \TYPO3\CMS\Frontend\Hooks\MediaItemHooks::class,
        'tx_cms_treelistCacheUpdate' => \TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::class,
        'tslib_gifBuilder' => \TYPO3\CMS\Frontend\Imaging\GifBuilder::class,
-       'tslib_mediaWizardCoreProvider' => \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider::class,
-       'tslib_mediaWizardProvider' => \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderInterface::class,
-       'tslib_mediaWizardManager' => \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderManager::class,
+       'tslib_mediaWizardCoreProvider' => \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProvider::class,
+       'tslib_mediaWizardProvider' => \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderInterface::class,
+       'tslib_mediaWizardManager' => \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderManager::class,
        't3lib_cacheHash' => \TYPO3\CMS\Frontend\Page\CacheHashCalculator::class,
        'tslib_frameset' => \TYPO3\CMS\Frontend\Page\FramesetRenderer::class,
        'TSpagegen' => \TYPO3\CMS\Frontend\Page\PageGenerator::class,
        't3lib_cacheHash' => \TYPO3\CMS\Frontend\Page\CacheHashCalculator::class,
        'tslib_frameset' => \TYPO3\CMS\Frontend\Page\FramesetRenderer::class,
        'TSpagegen' => \TYPO3\CMS\Frontend\Page\PageGenerator::class,
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-65778-MediaWizardProviderMovedToSystemExtension.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-65778-MediaWizardProviderMovedToSystemExtension.rst
new file mode 100644 (file)
index 0000000..88ba787
--- /dev/null
@@ -0,0 +1,28 @@
+===================================================================================
+Breaking: #65778 - MediaWizard functionality is moved to system extension "mediace"
+===================================================================================
+
+Description
+===========
+
+The Media Wizard Provider for the "media" Content Element Type is moved to the same system extension.
+
+Impact
+======
+
+Any extensions registering their own Media Wizards need to install the system extension "mediace" and define a dependency
+to this extension.
+
+
+Affected installations
+======================
+
+TYPO3 CMS 7 installations using the "MEDIA" cObject or having Content Elements of CType "media" or "multimedia" with
+custom media wizard providers.
+
+
+Migration
+=========
+
+Make sure to install the system extension "mediace" and rename the function calls to use the new classes, see
+the file ``ext_localconf.php`` of the extension "mediace" for example usage.
diff --git a/typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProvider.php b/typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProvider.php
deleted file mode 100644 (file)
index cef03dc..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\MediaWizard;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Contains an implementation of the mediaWizardProvider supporting some
- * well known providers.
- *
- * @author Aishwara M.B.<aishu.moorthy@gmail.com>
- * @author Steffen Kamper <info@sk-typo3.de>
- * @author Ernesto Baschny <ernst@cron-it.de>
- */
-class MediaWizardProvider implements MediaWizardProviderInterface {
-
-       /**
-        * @var array List of providers we can handle in this class
-        */
-       protected $providers = array(
-               'youtube',
-               'youtu',
-               'dailymotion',
-               'sevenload',
-               'vimeo',
-               'clipfish',
-               'google',
-               'metacafe',
-               'myvideo',
-               'liveleak',
-               'veoh'
-       );
-
-       /**
-        * Checks if we have a valid method for processing a given URL.
-        *
-        * This is done by analysing the hostname of the URL and checking if it contains
-        * any of our provider tags defined in $this->providers.
-        *
-        * @param string $url
-        * @return string
-        */
-       protected function getMethod($url) {
-               $urlInfo = @parse_url($url);
-               if ($urlInfo === FALSE) {
-                       return NULL;
-               }
-               // The URL passed might not contain http:// prefix
-               if (!isset($urlInfo['host'])) {
-                       $urlInfo = @parse_url('http://' . $url);
-               }
-               if (empty($urlInfo['host'])) {
-                       return NULL;
-               }
-               $hostName = GeneralUtility::trimExplode('.', $urlInfo['host'], TRUE);
-               foreach ($this->providers as $provider) {
-                       $functionName = 'process_' . $provider;
-                       if (in_array($provider, $hostName) && is_callable(array($this, $functionName))) {
-                               return $functionName;
-                       }
-               }
-               return NULL;
-       }
-
-       /***********************************************
-        *
-        * Implementation of MediaWizardProviderInterface
-        *
-        ***********************************************/
-       /**
-        * @param string $url
-        * @return bool
-        * @see MediaWizardProviderInterface::canHandle
-        */
-       public function canHandle($url) {
-               return $this->getMethod($url) !== NULL;
-       }
-
-       /**
-        * @param string $url URL to rewrite
-        * @return string The rewritten URL
-        * @see MediaWizardProviderInterface::rewriteUrl
-        */
-       public function rewriteUrl($url) {
-               $method = $this->getMethod($url);
-               return $this->{$method}($url);
-       }
-
-       /***********************************************
-        *
-        * Providers URL rewriting:
-        *
-        ***********************************************/
-       /**
-        * Parse youtube url
-        *
-        * @param string $url
-        * @return string processed url
-        */
-       protected function process_youtube($url) {
-               $videoId = '';
-
-               $pattern = '%
-               ^(?:https?://)?                                                                 # Optional URL scheme Either http or https
-               (?:www\.)?                                                                              # Optional www subdomain
-               (?:                                                                                             # Group host alternatives:
-                       youtu\.be/                                                                      #  Either youtu.be/,
-                       |youtube(?:                                                                     #  or youtube.com/
-                               -nocookie                                                               #   optional nocookie domain
-                       )?\.com/(?:
-                               [^/]+/.+/                                                               #   Either /something/other_params/ for channels,
-                               |(?:v|e(?:                                                              #   or v/ or e/,
-                                       mbed                                                            #    optional mbed for embed/
-                               )?)/
-                               |.*[?&]v=                                                               #   or ?v= or ?other_param&v=
-                       )
-               )                                                                                               # End host alternatives.
-               ([^"&?/ ]{11})                                                                  # 11 characters (Length of Youtube video ids).
-               (?:.+)?$                                                                                # Optional other ending URL parameters.
-               %xs';
-               if (preg_match($pattern, $url, $matches)) {
-                       $videoId = $matches[1];
-               }
-
-               if ($videoId) {
-                       $url = $this->getUrlSchema() . 'www.youtube.com/v/' . $videoId . '?fs=1';
-               }
-               return $url;
-       }
-
-       /**
-        * Parse youtube short url
-        *
-        * @param string $url
-        * @return string processed url
-        */
-       protected function process_youtu($url) {
-               return $this->process_youtube($url);
-       }
-
-       /**
-        * 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 $this->getUrlSchema() . '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
-        *
-        * Supports:
-        * - http://vimeo.com/hd#<id>
-        * - http://vimeo.com/<id>
-        * - http://player.vimeo.com/video/<id>
-        *
-        * @param string $url
-        * @return string processed url
-        */
-       protected function process_vimeo($url) {
-               if (preg_match('/[\\/#](\\d+)$/', $url, $matches)) {
-                       $videoId = $matches[1];
-                       $url = $this->getUrlSchema() . 'vimeo.com/moogaloop.swf?clip_id=' . $videoId . '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1';
-               }
-               return $url;
-       }
-
-       /**
-        * Parse clipfish url
-        *
-        * @param string $url
-        * @return string processed url
-        */
-       protected function process_clipfish($url) {
-               if (preg_match('/video([^(\\&|$)]*)/', $url, $matches)) {
-                       $parts = explode('/', $matches[1]);
-                       $videoId = $parts[1];
-                       $url = 'http://www.clipfish.de/cfng/flash/clipfish_player_3.swf?as=0&r=1&noad=1&fs=1&vid=' . $videoId;
-               }
-               return $url;
-       }
-
-       /**
-        * Parse google url
-        *
-        * @param string $url
-        * @return string processed url
-        */
-       protected function process_google($url) {
-               if (preg_match('/docid=([^(\\&|$)]*)/', $url, $matches)) {
-                       $videoId = $matches[1];
-                       $url = $this->getUrlSchema() . 'video.google.com/googleplayer.swf?docid=' . $videoId;
-               }
-               return $url;
-       }
-
-       /**
-        * Parse metacafe url
-        *
-        * @param string $url
-        * @return string processed url
-        */
-       protected function process_metacafe($url) {
-               if (preg_match('/watch([^(\\&|$)]*)/', $url, $matches)) {
-                       $parts = explode('/', $matches[1]);
-                       $videoId = $parts[1];
-                       $url = 'http://www.metacafe.com/fplayer/' . $videoId . '/.swf';
-               }
-               return $url;
-       }
-
-       /**
-        * 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 $this->getUrlSchema() . '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;
-       }
-
-       /**
-        * Get the correct url schema
-        *
-        * @return string
-        */
-       protected function getUrlSchema() {
-               return GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
-       }
-
-}
diff --git a/typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProviderInterface.php b/typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProviderInterface.php
deleted file mode 100644 (file)
index 41599f8..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\MediaWizard;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Interface for classes which hook into tslib_mediawizard adding additional
- * media wizard providers
- *
- * @author Ernesto Baschny <ernst@cron-it.de>
- */
-interface MediaWizardProviderInterface {
-
-       /**
-        * Tells the calling party if we can handle the URL passed to the constructor
-        *
-        * @param string $url URL to be handled
-        * @return bool
-        */
-       public function canHandle($url);
-
-       /**
-        * Rewrites a media provider URL into a canonized form that can be embedded
-        *
-        * @param string $url URL to be handled
-        * @return string Canonized URL that can be used to embed
-        */
-       public function rewriteUrl($url);
-
-}
diff --git a/typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProviderManager.php b/typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProviderManager.php
deleted file mode 100644 (file)
index ae2f0d3..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\MediaWizard;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Manager to register and call registered media wizard providers
- *
- * @author Ernesto Baschny <ernst@cron-it.de>
- * @static
- */
-class MediaWizardProviderManager {
-
-       /**
-        * @var array All class names of registered providers
-        */
-       static protected $providers = array();
-
-       /**
-        * @var array Instances of registered providers, set up on first call of getValidMediaWizardProvider()
-        */
-       static protected $providerObjects = array();
-
-       /**
-        * Allows extensions to register themselves as media wizard providers
-        *
-        * @param string $className A class implementing MediaWizardProviderInterface
-        * @throws \UnexpectedValueException
-        * @return void
-        */
-       static public function registerMediaWizardProvider($className) {
-               self::$providers[] = $className;
-       }
-
-       /**
-        * Instantiate all registered media wizard providers
-        *
-        * @throws \UnexpectedValueException
-        */
-       static protected function instantiateMediaWizardProviders() {
-               $providerClassNames = array_unique(self::$providers);
-               foreach ($providerClassNames as $className) {
-                       if (!isset(self::$providerObjects[$className])) {
-                               $provider = GeneralUtility::makeInstance($className);
-                               if (!$provider instanceof MediaWizardProviderInterface) {
-                                       throw new \UnexpectedValueException($className . ' is registered as a mediaWizardProvider, so it must implement interface ' . MediaWizardProviderInterface::class, 1285022360);
-                               }
-                               self::$providerObjects[$className] = $provider;
-                       }
-               }
-       }
-
-       /**
-        * Return a media wizard provider that can handle given URL
-        *
-        * @param string $url
-        * @return MediaWizardProviderInterface|NULL A valid mediaWizardProvider that can handle this URL
-        */
-       static public function getValidMediaWizardProvider($url) {
-               self::instantiateMediaWizardProviders();
-               // Go through registered providers in reverse order (last one registered wins)
-               $providers = array_reverse(self::$providerObjects, TRUE);
-               foreach ($providers as $provider) {
-                       /** @var $provider MediaWizardProviderInterface */
-                       if ($provider->canHandle($url)) {
-                               return $provider;
-                       }
-               }
-               // No provider found
-               return NULL;
-       }
-
-}
diff --git a/typo3/sysext/frontend/Tests/Unit/MediaWizard/MediaWizardProviderTest.php b/typo3/sysext/frontend/Tests/Unit/MediaWizard/MediaWizardProviderTest.php
deleted file mode 100644 (file)
index 97f922f..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\Tests\Unit\MediaWizard;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Testcase for TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider
- *
- * @author Sebastian Fischer <typo3@marketing-factory.de>
- */
-class MediaWizardProviderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
-
-       /**
-        * @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider
-        */
-       protected $subject;
-
-       /**
-        * Setup
-        */
-       protected function setUp() {
-               $this->subject = $this->getAccessibleMock(\TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider::class, array('dummy'), array(), '', FALSE);
-       }
-
-       /**
-        * @return array
-        */
-       public function process_youtubeDataProvider() {
-               return array(
-                       'http://youtu.be/2PMeCSQ--08' => array(
-                               'http://youtu.be/2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/embed/2PMeCSQ--08' => array(
-                               'http://www.youtube.com/embed/2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/watch?v=2PMeCSQ--08' => array(
-                               'http://www.youtube.com/watch?v=2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/?v=2PMeCSQ--08' => array(
-                               'http://www.youtube.com/?v=2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/v/2PMeCSQ--08' => array(
-                               'http://www.youtube.com/v/2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/e/2PMeCSQ--08' => array(
-                               'http://www.youtube.com/e/2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/watch?feature=player_embedded&v=2PMeCSQ--08' => array(
-                               'http://www.youtube.com/watch?feature=player_embedded&v=2PMeCSQ--08',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-                       'http://www.youtube.com/watch?v=2PMeCSQ--08&list=PLGWGc5dfbzn_pvtJg7XskLva9XZpNTI88' => array(
-                               'http://www.youtube.com/watch?v=2PMeCSQ--08&list=PLGWGc5dfbzn_pvtJg7XskLva9XZpNTI88',
-                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
-                       ),
-               );
-       }
-
-       /**
-        * Test for process youtube
-        *
-        * @param string $url
-        * @param string $expected
-        * @return void
-        * @dataProvider process_youtubeDataProvider
-        * @test
-        */
-       public function process_youtube($url, $expected) {
-               $result = $this->subject->_call('process_youtube', $url);
-               $this->assertEquals($expected, $result);
-       }
-
-}
index c3ba367..3fdfc5f 100644 (file)
@@ -17,9 +17,6 @@ if (TYPO3_MODE === 'FE') {
        // Register eID provider for ExtDirect for the frontend
        $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['ExtDirect'] = 'EXT:frontend/Resources/PHP/Eid/ExtDirect.php';
 
        // Register eID provider for ExtDirect for the frontend
        $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['ExtDirect'] = 'EXT:frontend/Resources/PHP/Eid/ExtDirect.php';
 
-       // Register the core media wizard provider
-       \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderManager::registerMediaWizardProvider(\TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider::class);
-
        // Register all available content objects
        $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'], array(
                'TEXT'             => \TYPO3\CMS\Frontend\ContentObject\TextContentObject::class,
        // Register all available content objects
        $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'], array(
                'TEXT'             => \TYPO3\CMS\Frontend\ContentObject\TextContentObject::class,
index f92f1e2..08b86ee 100644 (file)
@@ -170,7 +170,7 @@ class MediaContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConte
                                $conf['forcePlayer'] = 0;
                                $renderType = 'swf';
                        } elseif (isset($conf['file']) && strpos($conf['file'], '://') !== FALSE) {
                                $conf['forcePlayer'] = 0;
                                $renderType = 'swf';
                        } elseif (isset($conf['file']) && strpos($conf['file'], '://') !== FALSE) {
-                               $mediaWizard = \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderManager::getValidMediaWizardProvider($conf['file']);
+                               $mediaWizard = \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderManager::getValidMediaWizardProvider($conf['file']);
                                if ($mediaWizard !== NULL) {
                                        $conf['installUrl'] = 'null';
                                        $conf['forcePlayer'] = 0;
                                if ($mediaWizard !== NULL) {
                                        $conf['installUrl'] = 'null';
                                        $conf['forcePlayer'] = 0;
@@ -243,8 +243,8 @@ class MediaContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConte
                // because the file value can possibly have link parameters, use explode to split all values
                $fileParts = explode(' ', $file);
 
                // because the file value can possibly have link parameters, use explode to split all values
                $fileParts = explode(' ', $file);
 
-               /** @var $mediaWizard \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderInterface */
-               $mediaWizard = \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderManager::getValidMediaWizardProvider($fileParts[0]);
+               /** @var $mediaWizard \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderInterface */
+               $mediaWizard = \TYPO3\CMS\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);
                // Get the path relative to the page currently outputted
                if (substr($fileParts[0], 0, 5) === 'file:') {
                        $fileUid = substr($fileParts[0], 5);
diff --git a/typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProvider.php b/typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProvider.php
new file mode 100644 (file)
index 0000000..f1f5e41
--- /dev/null
@@ -0,0 +1,292 @@
+<?php
+namespace TYPO3\CMS\Mediace\MediaWizard;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/**
+ * Contains an implementation of the mediaWizardProvider supporting some
+ * well known providers.
+ *
+ * @author Aishwara M.B.<aishu.moorthy@gmail.com>
+ * @author Steffen Kamper <info@sk-typo3.de>
+ * @author Ernesto Baschny <ernst@cron-it.de>
+ */
+class MediaWizardProvider implements MediaWizardProviderInterface {
+
+       /**
+        * @var array List of providers we can handle in this class
+        */
+       protected $providers = array(
+               'youtube',
+               'youtu',
+               'dailymotion',
+               'sevenload',
+               'vimeo',
+               'clipfish',
+               'google',
+               'metacafe',
+               'myvideo',
+               'liveleak',
+               'veoh'
+       );
+
+       /**
+        * Checks if we have a valid method for processing a given URL.
+        *
+        * This is done by analysing the hostname of the URL and checking if it contains
+        * any of our provider tags defined in $this->providers.
+        *
+        * @param string $url
+        * @return string
+        */
+       protected function getMethod($url) {
+               $urlInfo = @parse_url($url);
+               if ($urlInfo === FALSE) {
+                       return NULL;
+               }
+               // The URL passed might not contain http:// prefix
+               if (!isset($urlInfo['host'])) {
+                       $urlInfo = @parse_url('http://' . $url);
+               }
+               if (empty($urlInfo['host'])) {
+                       return NULL;
+               }
+               $hostName = GeneralUtility::trimExplode('.', $urlInfo['host'], TRUE);
+               foreach ($this->providers as $provider) {
+                       $functionName = 'process_' . $provider;
+                       if (in_array($provider, $hostName) && is_callable(array($this, $functionName))) {
+                               return $functionName;
+                       }
+               }
+               return NULL;
+       }
+
+       /***********************************************
+        *
+        * Implementation of MediaWizardProviderInterface
+        *
+        ***********************************************/
+       /**
+        * @param string $url
+        * @return bool
+        * @see MediaWizardProviderInterface::canHandle
+        */
+       public function canHandle($url) {
+               return $this->getMethod($url) !== NULL;
+       }
+
+       /**
+        * @param string $url URL to rewrite
+        * @return string The rewritten URL
+        * @see MediaWizardProviderInterface::rewriteUrl
+        */
+       public function rewriteUrl($url) {
+               $method = $this->getMethod($url);
+               return $this->{$method}($url);
+       }
+
+       /***********************************************
+        *
+        * Providers URL rewriting:
+        *
+        ***********************************************/
+       /**
+        * Parse youtube url
+        *
+        * @param string $url
+        * @return string processed url
+        */
+       protected function process_youtube($url) {
+               $videoId = '';
+
+               $pattern = '%
+               ^(?:https?://)?                                                                 # Optional URL scheme Either http or https
+               (?:www\.)?                                                                              # Optional www subdomain
+               (?:                                                                                             # Group host alternatives:
+                       youtu\.be/                                                                      #  Either youtu.be/,
+                       |youtube(?:                                                                     #  or youtube.com/
+                               -nocookie                                                               #   optional nocookie domain
+                       )?\.com/(?:
+                               [^/]+/.+/                                                               #   Either /something/other_params/ for channels,
+                               |(?:v|e(?:                                                              #   or v/ or e/,
+                                       mbed                                                            #    optional mbed for embed/
+                               )?)/
+                               |.*[?&]v=                                                               #   or ?v= or ?other_param&v=
+                       )
+               )                                                                                               # End host alternatives.
+               ([^"&?/ ]{11})                                                                  # 11 characters (Length of Youtube video ids).
+               (?:.+)?$                                                                                # Optional other ending URL parameters.
+               %xs';
+               if (preg_match($pattern, $url, $matches)) {
+                       $videoId = $matches[1];
+               }
+
+               if ($videoId) {
+                       $url = $this->getUrlSchema() . 'www.youtube.com/v/' . $videoId . '?fs=1';
+               }
+               return $url;
+       }
+
+       /**
+        * Parse youtube short url
+        *
+        * @param string $url
+        * @return string processed url
+        */
+       protected function process_youtu($url) {
+               return $this->process_youtube($url);
+       }
+
+       /**
+        * 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 $this->getUrlSchema() . '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
+        *
+        * Supports:
+        * - http://vimeo.com/hd#<id>
+        * - http://vimeo.com/<id>
+        * - http://player.vimeo.com/video/<id>
+        *
+        * @param string $url
+        * @return string processed url
+        */
+       protected function process_vimeo($url) {
+               if (preg_match('/[\\/#](\\d+)$/', $url, $matches)) {
+                       $videoId = $matches[1];
+                       $url = $this->getUrlSchema() . 'vimeo.com/moogaloop.swf?clip_id=' . $videoId . '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1';
+               }
+               return $url;
+       }
+
+       /**
+        * Parse clipfish url
+        *
+        * @param string $url
+        * @return string processed url
+        */
+       protected function process_clipfish($url) {
+               if (preg_match('/video([^(\\&|$)]*)/', $url, $matches)) {
+                       $parts = explode('/', $matches[1]);
+                       $videoId = $parts[1];
+                       $url = 'http://www.clipfish.de/cfng/flash/clipfish_player_3.swf?as=0&r=1&noad=1&fs=1&vid=' . $videoId;
+               }
+               return $url;
+       }
+
+       /**
+        * Parse google url
+        *
+        * @param string $url
+        * @return string processed url
+        */
+       protected function process_google($url) {
+               if (preg_match('/docid=([^(\\&|$)]*)/', $url, $matches)) {
+                       $videoId = $matches[1];
+                       $url = $this->getUrlSchema() . 'video.google.com/googleplayer.swf?docid=' . $videoId;
+               }
+               return $url;
+       }
+
+       /**
+        * Parse metacafe url
+        *
+        * @param string $url
+        * @return string processed url
+        */
+       protected function process_metacafe($url) {
+               if (preg_match('/watch([^(\\&|$)]*)/', $url, $matches)) {
+                       $parts = explode('/', $matches[1]);
+                       $videoId = $parts[1];
+                       $url = 'http://www.metacafe.com/fplayer/' . $videoId . '/.swf';
+               }
+               return $url;
+       }
+
+       /**
+        * 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 $this->getUrlSchema() . '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;
+       }
+
+       /**
+        * Get the correct url schema
+        *
+        * @return string
+        */
+       protected function getUrlSchema() {
+               return GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
+       }
+
+}
diff --git a/typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProviderInterface.php b/typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProviderInterface.php
new file mode 100644 (file)
index 0000000..5f2a3a8
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace TYPO3\CMS\Mediace\MediaWizard;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Interface for classes which hook into tslib_mediawizard adding additional
+ * media wizard providers
+ *
+ * @author Ernesto Baschny <ernst@cron-it.de>
+ */
+interface MediaWizardProviderInterface {
+
+       /**
+        * Tells the calling party if we can handle the URL passed to the constructor
+        *
+        * @param string $url URL to be handled
+        * @return bool
+        */
+       public function canHandle($url);
+
+       /**
+        * Rewrites a media provider URL into a canonized form that can be embedded
+        *
+        * @param string $url URL to be handled
+        * @return string Canonized URL that can be used to embed
+        */
+       public function rewriteUrl($url);
+
+}
diff --git a/typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProviderManager.php b/typo3/sysext/mediace/Classes/MediaWizard/MediaWizardProviderManager.php
new file mode 100644 (file)
index 0000000..a26dd7c
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+namespace TYPO3\CMS\Mediace\MediaWizard;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/**
+ * Manager to register and call registered media wizard providers
+ *
+ * @author Ernesto Baschny <ernst@cron-it.de>
+ * @static
+ */
+class MediaWizardProviderManager {
+
+       /**
+        * @var array All class names of registered providers
+        */
+       static protected $providers = array();
+
+       /**
+        * @var array Instances of registered providers, set up on first call of getValidMediaWizardProvider()
+        */
+       static protected $providerObjects = array();
+
+       /**
+        * Allows extensions to register themselves as media wizard providers
+        *
+        * @param string $className A class implementing MediaWizardProviderInterface
+        * @throws \UnexpectedValueException
+        * @return void
+        */
+       static public function registerMediaWizardProvider($className) {
+               self::$providers[] = $className;
+       }
+
+       /**
+        * Instantiate all registered media wizard providers
+        *
+        * @throws \UnexpectedValueException
+        */
+       static protected function instantiateMediaWizardProviders() {
+               $providerClassNames = array_unique(self::$providers);
+               foreach ($providerClassNames as $className) {
+                       if (!isset(self::$providerObjects[$className])) {
+                               $provider = GeneralUtility::makeInstance($className);
+                               if (!$provider instanceof MediaWizardProviderInterface) {
+                                       throw new \UnexpectedValueException($className . ' is registered as a mediaWizardProvider, so it must implement interface ' . MediaWizardProviderInterface::class, 1285022360);
+                               }
+                               self::$providerObjects[$className] = $provider;
+                       }
+               }
+       }
+
+       /**
+        * Return a media wizard provider that can handle given URL
+        *
+        * @param string $url
+        * @return MediaWizardProviderInterface|NULL A valid mediaWizardProvider that can handle this URL
+        */
+       static public function getValidMediaWizardProvider($url) {
+               self::instantiateMediaWizardProviders();
+               // Go through registered providers in reverse order (last one registered wins)
+               $providers = array_reverse(self::$providerObjects, TRUE);
+               foreach ($providers as $provider) {
+                       /** @var $provider MediaWizardProviderInterface */
+                       if ($provider->canHandle($url)) {
+                               return $provider;
+                       }
+               }
+               // No provider found
+               return NULL;
+       }
+
+}
index 7b9ee72..bf86d73 100644 (file)
@@ -5,4 +5,7 @@ return array(
        'TYPO3\\CMS\\Frontend\\ContentObject\\MultimediaContentObject' => \TYPO3\CMS\Mediace\ContentObject\MultimediaContentObject::class,
        'TYPO3\\CMS\\Frontend\\ContentObject\\QuicktimeObjectContentObject' => \TYPO3\CMS\Mediace\ContentObject\QuicktimeObjectContentObject::class,
        'TYPO3\\CMS\\Frontend\\ContentObject\\ShockwaveFlashObjectContentObject' => \TYPO3\CMS\Mediace\ContentObject\ShockwaveFlashObjectContentObject::class,
        'TYPO3\\CMS\\Frontend\\ContentObject\\MultimediaContentObject' => \TYPO3\CMS\Mediace\ContentObject\MultimediaContentObject::class,
        'TYPO3\\CMS\\Frontend\\ContentObject\\QuicktimeObjectContentObject' => \TYPO3\CMS\Mediace\ContentObject\QuicktimeObjectContentObject::class,
        'TYPO3\\CMS\\Frontend\\ContentObject\\ShockwaveFlashObjectContentObject' => \TYPO3\CMS\Mediace\ContentObject\ShockwaveFlashObjectContentObject::class,
+       'TYPO3\\CMS\\Frontend\\MediaWizard\MediaWizardProvider' => \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProvider::class,
+       'TYPO3\\CMS\\Frontend\\MediaWizard\MediaWizardProviderInterface' => \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderInterface::class,
+       'TYPO3\\CMS\\Frontend\\MediaWizard\MediaWizardProviderManager' => \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderManager::class,
 );
 );
diff --git a/typo3/sysext/mediace/Tests/Unit/MediaWizard/MediaWizardProviderTest.php b/typo3/sysext/mediace/Tests/Unit/MediaWizard/MediaWizardProviderTest.php
new file mode 100644 (file)
index 0000000..76f1cee
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+namespace TYPO3\CMS\Mediace\Tests\Unit\MediaWizard;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Testcase for TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider
+ *
+ * @author Sebastian Fischer <typo3@marketing-factory.de>
+ */
+class MediaWizardProviderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
+
+       /**
+        * @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\TYPO3\CMS\Mediace\MediaWizard\MediaWizardProvider
+        */
+       protected $subject;
+
+       /**
+        * Setup
+        */
+       protected function setUp() {
+               $this->subject = $this->getAccessibleMock(\TYPO3\CMS\Mediace\MediaWizard\MediaWizardProvider::class, array('dummy'), array(), '', FALSE);
+       }
+
+       /**
+        * @return array
+        */
+       public function process_youtubeDataProvider() {
+               return array(
+                       'http://youtu.be/2PMeCSQ--08' => array(
+                               'http://youtu.be/2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/embed/2PMeCSQ--08' => array(
+                               'http://www.youtube.com/embed/2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/watch?v=2PMeCSQ--08' => array(
+                               'http://www.youtube.com/watch?v=2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/?v=2PMeCSQ--08' => array(
+                               'http://www.youtube.com/?v=2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/v/2PMeCSQ--08' => array(
+                               'http://www.youtube.com/v/2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/e/2PMeCSQ--08' => array(
+                               'http://www.youtube.com/e/2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/watch?feature=player_embedded&v=2PMeCSQ--08' => array(
+                               'http://www.youtube.com/watch?feature=player_embedded&v=2PMeCSQ--08',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+                       'http://www.youtube.com/watch?v=2PMeCSQ--08&list=PLGWGc5dfbzn_pvtJg7XskLva9XZpNTI88' => array(
+                               'http://www.youtube.com/watch?v=2PMeCSQ--08&list=PLGWGc5dfbzn_pvtJg7XskLva9XZpNTI88',
+                               'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
+                       ),
+               );
+       }
+
+       /**
+        * Test for process youtube
+        *
+        * @param string $url
+        * @param string $expected
+        * @return void
+        * @dataProvider process_youtubeDataProvider
+        * @test
+        */
+       public function process_youtube($url, $expected) {
+               $result = $this->subject->_call('process_youtube', $url);
+               $this->assertEquals($expected, $result);
+       }
+
+}
index 3e773da..3a38518 100644 (file)
                "psr-4": {
                        "TYPO3\\CMS\\Mediace\\": "Classes/"
                }
                "psr-4": {
                        "TYPO3\\CMS\\Mediace\\": "Classes/"
                }
+       },
+       "autoload-dev": {
+               "psr-4": {
+                       "TYPO3\\CMS\\Mediace\\Tests\\": "Tests/"
+               }
        }
 }
        }
 }
index 49d133f..7dfe09c 100644 (file)
@@ -24,3 +24,8 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['QTOBJECT']   = \TYPO3\CMS\M
 // 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');
 // 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
+       \TYPO3\CMS\Mediace\MediaWizard\MediaWizardProviderManager::registerMediaWizardProvider(\TYPO3\CMS\Mediace\MediaWizard\MediaWizardProvider::class);
+}