[BUGFIX] Media element does not recognize short YouTube links
authorRobert Heel <rheel@1drop.de>
Tue, 17 Jan 2012 13:57:35 +0000 (14:57 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 7 Mar 2012 07:44:42 +0000 (08:44 +0100)
Change-Id: Id4d67ee57f72a9475abaaa7762cbc42572d38e51
Fixes: #33089
Releases: 4.8, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/9408
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/cms/tslib/class.tslib_mediawizardcoreprovider.php

index 15c5d96..857d7e6 100644 (file)
@@ -41,6 +41,7 @@ class tslib_mediaWizardCoreProvider implements tslib_mediaWizardProvider {
         */
        protected $providers = array(
                'youtube',
+               'youtu',
                'dailymotion',
                'sevenload',
                'vimeo',
@@ -119,8 +120,8 @@ class tslib_mediaWizardCoreProvider implements tslib_mediaWizardProvider {
                                // it's a channel
                        $parts = explode('/', $url);
                        $videoId = $parts[count($parts) - 1];
-               } elseif (preg_match('/v=([^(\&|$)]*)/', $url, $matches)) {
-                       $videoId = $matches[1];
+               } elseif (preg_match('/(v=|v\/|.be\/)([^(\&|$)]*)/', $url, $matches)) {
+                       $videoId = $matches[2];
                }
 
                if ($videoId) {
@@ -130,6 +131,16 @@ class tslib_mediaWizardCoreProvider implements tslib_mediaWizardProvider {
        }
 
        /**
+        * 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