[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:09:16 +0000 (10:09 +0100)
Change-Id: I97a0071aec31b6d45ee4a164bb0dc2ffafacd03c
Fixes: #33089
Releases: 4.8, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/9406
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/cms/tslib/class.tslib_mediawizardcoreprovider.php

index 578578c..8259eae 100644 (file)
@@ -43,6 +43,7 @@ class tslib_mediaWizardCoreProvider implements tslib_mediaWizardProvider {
         */
        protected $providers = array(
                'youtube',
+               'youtu',
                'dailymotion',
                'sevenload',
                'vimeo',
@@ -121,8 +122,8 @@ class tslib_mediaWizardCoreProvider implements tslib_mediaWizardProvider {
                                // it's a channel
                        $parts = explode('/', $url);
                        $videoId = $parts[count($parts) - 1];
-               } else if (preg_match('/v=([^(\&|$)]*)/', $url, $matches)) {
-                       $videoId = $matches[1];
+               } elseif (preg_match('/(v=|v\/|.be\/)([^(\&|$)]*)/', $url, $matches)) {
+                       $videoId = $matches[2];
                }
 
                if ($videoId) {
@@ -132,6 +133,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