Skip to content

Commit

Permalink
filter MDL-23903 fixed problems with youtube handling in the multimed…
Browse files Browse the repository at this point in the history
…ia filter
  • Loading branch information
Andrew Davis committed Aug 25, 2010
1 parent bbf2773 commit 4842422
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions filter/mediaplugin/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ function filter($text) {
}

if (!empty($CFG->filter_mediaplugin_enable_youtube)) {
$search = '/<a.*?href="([^<]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
//see MDL-23903 for description of recent changes to this regex
//$search = '/<a.*?href="([^<]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
$search = '/<a[^>]*href="([^<]*?)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);

$search = '/<a.*?href="([^<]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
Expand Down Expand Up @@ -258,7 +260,7 @@ function filter_mediaplugin_youtube_callback($link, $autostart=false) {

$site = addslashes_js($link[1]);
$url = addslashes_js($link[2]);
$info = addslashes_js($link[3]);
$info = addslashes_js(strip_tags($link[3]));//strip out html tags as they won't work in the title attribute

return '<object title="'.$info.'"
class="mediaplugin mediaplugin_youtube" type="application/x-shockwave-flash"
Expand Down

0 comments on commit 4842422

Please sign in to comment.