mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-37813 remove missing filters when configuring string filters and fix filter uninstall
This commit is contained in:
parent
4e47920f08
commit
a67ea663b1
3 changed files with 59 additions and 14 deletions
|
@ -721,13 +721,23 @@ function filter_get_string_filters() {
|
|||
*/
|
||||
function filter_set_applies_to_strings($filter, $applytostrings) {
|
||||
$stringfilters = filter_get_string_filters();
|
||||
$numstringfilters = count($stringfilters);
|
||||
$prevfilters = $stringfilters;
|
||||
$allfilters = core_component::get_plugin_list('filter');
|
||||
|
||||
if ($applytostrings) {
|
||||
$stringfilters[$filter] = $filter;
|
||||
} else {
|
||||
unset($stringfilters[$filter]);
|
||||
}
|
||||
if (count($stringfilters) != $numstringfilters) {
|
||||
|
||||
// Remove missing filters.
|
||||
foreach ($stringfilters as $filter) {
|
||||
if (!isset($allfilters[$filter])) {
|
||||
unset($stringfilters[$filter]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($prevfilters != $stringfilters) {
|
||||
set_config('stringfilters', implode(',', $stringfilters));
|
||||
set_config('filterall', !empty($stringfilters));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue