Permalink
Browse files

MDL-34997 youtube filter: keep dimensions working for shortened urls

  • Loading branch information...
1 parent d84df9f commit 70206bbda8b58ce242bba534797eb3570c9463c1 @stronk7 stronk7 committed Sep 4, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 filter/mediaplugin/filter.php
@@ -90,7 +90,7 @@ function filter($text, array $options = array()) {
$search = '/<a\s[^>]*href="(https?:\/\/www\.youtube(-nocookie)?\.com)\/v\/([a-z0-9\-_]+)[^"#]*(#d=([\d]{1,4})x([\d]{1,4}))?[^>]*>([^>]*)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);
- $search = '/<a\s[^>]*href="(https?:\/\/(www\.)?(youtu|y2u)\.be)\/([a-z0-9\-_]+)"[^>]*>([^>]*)<\/a>/is';
+ $search = '/<a\s[^>]*href="(https?:\/\/(www\.)?(youtu|y2u)\.be)\/([a-z0-9\-_]+)[^"#]*(#d=([\d]{1,4})x([\d]{1,4}))?"[^>]*>([^>]*)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_shortened_youtube_callback', $newtext);
$search = '/<a\s[^>]*href="(https?:\/\/www\.youtube(-nocookie)?\.com)\/view_play_list\?p=([a-z0-9\-_]+)[^"#]*(#d=([\d]{1,4})x([\d]{1,4}))?[^>]*>([^>]*)<\/a>/is';
@@ -768,7 +768,7 @@ function filter_mediaplugin_youtube_playlist_callback($link) {
* @return string
*/
function filter_mediaplugin_shortened_youtube_callback($link) {
- $newlink = array($link[0], 'https://www.youtube.com','',$link[4],'','','',$link[5]);
+ $newlink = array($link[0], 'https://www.youtube.com','',$link[4],'',$link[6],$link[7],$link[8]);
return filter_mediaplugin_youtube_callback($newlink);
}

0 comments on commit 70206bb

Please sign in to comment.