Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-26030_m19: fix regex in media filter and removing addslashes to n…

…on-js code
  • Loading branch information...
commit eabab3de5a648a18b2074fbc47e4bc0ca4f2d5f7 1 parent e7d43de
@rwijaya rwijaya authored skodak committed
Showing with 16 additions and 16 deletions.
  1. +16 −16 filter/mediaplugin/filter.php
View
32 filter/mediaplugin/filter.php
@@ -36,39 +36,39 @@ function mediaplugin_filter($courseid, $text) {
$newtext = $text; // fullclone is slow and not needed here
if ($CFG->filter_mediaplugin_enable_mp3) {
- $search = '/<a.*?href="([^<]+\.mp3)"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.mp3)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_mp3_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_ogg) {
- $search = '/<a[^>]*?href="([^<]+\.ogg)"[^>]*>.*?<\/a>/is';
+ $search = '/<a[^>]*?href="([^"]+\.ogg)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_ogg_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_ogv) {
- $search = '/<a[^>]*?href="([^<]+\.ogv)"[^>]*>.*?<\/a>/is';
+ $search = '/<a[^>]*?href="([^"]+\.ogv)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_ogv_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_swf) {
- $search = '/<a.*?href="([^<]+\.swf)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.swf)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_swf_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_flv) {
- $search = '/<a.*?href="([^<]+\.flv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.flv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_flv_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_mov) {
- $search = '/<a.*?href="([^<]+\.mov)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.mov)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
// MDL-18658
- $search = '/<a.*?href="([^<]+\.mp4)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.mp4)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
- $search = '/<a.*?href="([^<]+\.m4v)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.m4v)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
$search = '/<a.*?href="([^<]+\.m4a)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
@@ -76,40 +76,40 @@ function mediaplugin_filter($courseid, $text) {
}
if ($CFG->filter_mediaplugin_enable_wmv) {
- $search = '/<a.*?href="([^<]+\.wmv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.wmv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_wmp_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_mpg) {
- $search = '/<a.*?href="([^<]+\.mpe?g)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.mpe?g)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_avi) {
- $search = '/<a.*?href="([^<]+\.avi)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.avi)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_wmp_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_ram) {
- $search = '/<a.*?href="([^<]+\.ram)"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.ram)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_rpm) {
- $search = '/<a.*?href="([^<]+\.rpm)"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.rpm)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_rm) {
- $search = '/<a.*?href="([^<]+\.rm)"[^>]*>.*?<\/a>/is';
+ $search = '/<a.*?href="([^"]+\.rm)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
}
if (!empty($CFG->filter_mediaplugin_enable_youtube)) {
- $search = '/<a[^>]*?href="([^<]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
+ $search = '/<a[^>]*?href="([^"]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_youtube_callback', $newtext);
- $search = '/<a[^>]*?href="([^<]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
+ $search = '/<a[^>]*?href="([^"]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_youtube_callback', $newtext);
}
Please sign in to comment.
Something went wrong with that request. Please try again.