Permalink
Browse files

MDL-26380 improve perf of mediaplugin filter if no links found in text

  • Loading branch information...
1 parent d911c72 commit e68789c559f9a7633789d39bf3e23ae543b40923 @skodak skodak committed Feb 12, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 filter/mediaplugin/filter.php
@@ -46,6 +46,11 @@ function filter($text, array $options = array()) {
// non string data can not be filtered anyway
return $text;
}
+ if (stripos($text, '</a>') === false) {
+ // performance shortcut - all regexes bellow end with the </a> tag,
+ // if not present nothing can match
+ return $text;
+ }
$newtext = $text; // fullclone is slow and not needed here
if (!empty($CFG->filter_mediaplugin_enable_mp3)) {

0 comments on commit e68789c

Please sign in to comment.