From ae63604f08100435b11406741c08f4970a686fbf Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Wed, 5 Nov 2014 15:52:42 +1300 Subject: [PATCH] Allow question prefix to be replaced --- code/MathSpamProtectorField.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/code/MathSpamProtectorField.php b/code/MathSpamProtectorField.php index 9d23dc0..54ca3ea 100644 --- a/code/MathSpamProtectorField.php +++ b/code/MathSpamProtectorField.php @@ -14,6 +14,13 @@ class MathSpamProtectorField extends TextField { * @var bool $enabled */ private static $enabled = true; + + /** + * @config + * + * @var string + */ + private static $question_prefix; public function Field($properties = array()) { if(Config::inst()->get('MathSpamProtectorField', 'enabled')) { @@ -37,8 +44,14 @@ class MathSpamProtectorField extends TextField { * @return string */ public function Title() { + $prefix = Config::inst()->get('MathSpamProtection', 'question_prefix'); + + if(!$prefix) { + $prefix = _t('MathSpamProtectionField.SPAMQUESTION', "Spam protection question: %s"); + } + return sprintf( - _t('MathSpamProtectionField.SPAMQUESTION', "Spam protection question: %s"), + $prefix, self::get_math_question() ); }