mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-51213 weblib: Allow filter=false option for format_string
And pass this from external_format_string correctly.
This commit is contained in:
parent
3676873566
commit
08bda175de
@ -743,6 +743,7 @@ function external_format_string($str, $contextid, $striplinks = true, $options =
|
||||
if (!$settings->get_raw()) {
|
||||
$context = context::instance_by_id($contextid);
|
||||
$options['context'] = $context;
|
||||
$options['filter'] = $settings->get_filter();
|
||||
$str = format_string($str, $striplinks, $options);
|
||||
}
|
||||
|
||||
|
@ -1354,6 +1354,9 @@ function format_string($string, $striplinks = true, $options = null) {
|
||||
} else if (is_numeric($options['context'])) {
|
||||
$options['context'] = context::instance_by_id($options['context']);
|
||||
}
|
||||
if (!isset($options['filter'])) {
|
||||
$options['filter'] = true;
|
||||
}
|
||||
|
||||
if (!$options['context']) {
|
||||
// We did not find any context? weird.
|
||||
@ -1372,7 +1375,7 @@ function format_string($string, $striplinks = true, $options = null) {
|
||||
// Regular expression moved to its own method for easier unit testing.
|
||||
$string = replace_ampersands_not_followed_by_entity($string);
|
||||
|
||||
if (!empty($CFG->filterall)) {
|
||||
if (!empty($CFG->filterall) && $options['filter']) {
|
||||
$filtermanager = filter_manager::instance();
|
||||
$filtermanager->setup_page_for_filters($PAGE, $options['context']); // Setup global stuff filters may have.
|
||||
$string = $filtermanager->filter_string($string, $options['context']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user