From 572aba072b329fbfd6edd0271b2a49ee64e9128b Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 11 Jul 2024 11:34:15 +0800 Subject: [PATCH 1/1] TEST: Do not commit --- filter/emoticon/classes/text_filter.php | 7 +++++++ filter/emoticon/filterlocalsettings.php | 27 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 filter/emoticon/filterlocalsettings.php diff --git a/filter/emoticon/classes/text_filter.php b/filter/emoticon/classes/text_filter.php index 329545191c..a56ad08d50 100644 --- a/filter/emoticon/classes/text_filter.php +++ b/filter/emoticon/classes/text_filter.php @@ -51,6 +51,13 @@ class text_filter extends \core_filters\text_filter { // be stripped. therefore, we do nothing. return $text; } + + + if (array_key_exists('word', $this->localconfig)) { + $search = $this->localconfig['word']; + return str_replace($search, "Hello $search!", $text); + } + if (in_array($options['originalformat'], explode(',', get_config('filter_emoticon', 'formats')))) { return $this->replace_emoticons($text); } diff --git a/filter/emoticon/filterlocalsettings.php b/filter/emoticon/filterlocalsettings.php new file mode 100644 index 0000000000..2a9a8b9dca --- /dev/null +++ b/filter/emoticon/filterlocalsettings.php @@ -0,0 +1,27 @@ +. + +class emoticon_filter_local_settings_form extends filter_local_settings_form { + protected function definition_inner($mform) { + $mform->addElement( + 'text', + 'word', + 'Word', + ['size' => 20] + ); + $mform->setType('word', PARAM_NOTAGS); + } +} -- 2.42.0