From 17687dfe0bb095a8d209270e6f4e263c01eb1d41 Mon Sep 17 00:00:00 2001 From: Benjamin Walker Date: Mon, 5 Aug 2024 15:30:59 +1000 Subject: [PATCH] Fix mute url regex display --- classes/form/override_form.php | 7 ++++--- lang/en/tool_heartbeat.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/form/override_form.php b/classes/form/override_form.php index 02c8876..4593765 100644 --- a/classes/form/override_form.php +++ b/classes/form/override_form.php @@ -61,10 +61,11 @@ public function definition() { $mform->setType('url', PARAM_URL); $urlregex = get_config('tool_heartbeat', 'muteurlregex'); if (!empty($urlregex)) { - $urlregex = stripslashes($urlregex); + // Strip backslashes and remove delimiters from the regex display. + $urlregexdisplay = substr(stripslashes($urlregex), 1, -1); $mform->addRule('url', get_string('required'), 'required', null, 'client'); - $mform->addRule('url', get_string('muteurlregex', 'tool_heartbeat', $urlregex), 'regex', $urlregex, 'client'); - $mform->addElement('static', 'url_help', '', get_string('muteurlregex', 'tool_heartbeat', $urlregex)); + $mform->addRule('url', get_string('muteurlregex', 'tool_heartbeat', $urlregexdisplay), 'regex', $urlregex, 'client'); + $mform->addElement('static', 'url_help', '', get_string('muteurlregex', 'tool_heartbeat', $urlregexdisplay)); } // Override until. diff --git a/lang/en/tool_heartbeat.php b/lang/en/tool_heartbeat.php index 5ab9179..509e052 100644 --- a/lang/en/tool_heartbeat.php +++ b/lang/en/tool_heartbeat.php @@ -97,7 +97,7 @@ $string['editmute'] = 'Edit mute'; $string['overriderestore'] = 'Fields have been pre-filled with information from a previous override.'; $string['noterequired'] = 'Please add some notes'; -$string['muteurlregex'] = 'The URL must match the regex defined in settings: {$a}'; +$string['muteurlregex'] = 'The URL must match the format defined in settings: {$a}'; $string['statusunknown'] = 'Unknown'; $string['settings:mutedefault'] = 'Default mute duration'; $string['settings:mutedefault:desc'] = 'Adjust the default duration of a check mute.';