mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-47962 filter_glossary: only prepare_phrases_for_filtering once
This commit is contained in:
parent
2abf8fbf86
commit
c01503de75
@ -135,6 +135,8 @@ class filter_glossary extends moodle_text_filter {
|
||||
// when you have two terms like 'Moodle' and 'Moodle 3.5'. You want the longest match.
|
||||
usort($conceptlist, 'filter_glossary::sort_entries_by_length');
|
||||
|
||||
$conceptlist = filter_prepare_phrases_for_filtering($conceptlist);
|
||||
|
||||
$tocache = new stdClass();
|
||||
$tocache->cacheuserid = $USER->id;
|
||||
$tocache->cachecourseid = $courseid;
|
||||
@ -155,7 +157,7 @@ class filter_glossary extends moodle_text_filter {
|
||||
|
||||
if (!empty($GLOSSARY_EXCLUDEENTRY)) {
|
||||
foreach ($conceptlist as $key => $filterobj) {
|
||||
if ($filterobj->conceptid == $GLOSSARY_EXCLUDEENTRY) {
|
||||
if (is_object($filterobj) && $filterobj->conceptid == $GLOSSARY_EXCLUDEENTRY) {
|
||||
unset($conceptlist[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -1261,7 +1261,9 @@ function filter_phrases($text, $linkarray, $ignoretagsopen = null, $ignoretagscl
|
||||
$ignoretags = array(); // To store all the enclosig tags to be completely ignored.
|
||||
$tags = array(); // To store all the simple tags to be ignored.
|
||||
|
||||
$linkarray = filter_prepare_phrases_for_filtering($linkarray);
|
||||
if (!isset($linkarray['__preparedmarker'])) {
|
||||
$linkarray = filter_prepare_phrases_for_filtering($linkarray);
|
||||
}
|
||||
|
||||
if (!$overridedefaultignore) {
|
||||
// A list of open/close tags that we should not replace within.
|
||||
@ -1305,7 +1307,11 @@ function filter_phrases($text, $linkarray, $ignoretagsopen = null, $ignoretagscl
|
||||
}
|
||||
|
||||
// Time to cycle through each phrase to be linked.
|
||||
foreach ($linkarray as $linkobject) {
|
||||
foreach ($linkarray as $key => $linkobject) {
|
||||
if ($key === '__preparedmarker') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($linkobject->workregexp === null) {
|
||||
continue;
|
||||
}
|
||||
@ -1427,13 +1433,11 @@ function filter_prepare_phrases_for_filtering(array $linkarray) {
|
||||
}
|
||||
}
|
||||
|
||||
$linkarray['__preparedmarker'] = 1;
|
||||
|
||||
return $linkarray;
|
||||
}
|
||||
|
||||
function filter_prepare_phrases_for_replacement() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove duplicate from a list of {@link filterobject}.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user