Skip to content

Commit

Permalink
MDL-26380 improve perf of mediaplugin filter if no links found in text
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Feb 12, 2011
1 parent d911c72 commit e68789c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions filter/mediaplugin/filter.php
Expand Up @@ -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)) {
Expand Down

0 comments on commit e68789c

Please sign in to comment.