[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)
committerXavier Perseguers <xavier@typo3.org>
Tue, 6 Mar 2012 09:12:22 +0000 (10:12 +0100)
Change-Id: I97a0071aec31b6d45ee4a164bb0dc2ffafacd03c
Fixes: #33089
Releases: 4.8, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7828
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
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