/** * @fn test_check_math * @short Test method for check_math. */ public function test_check_math() { Antispam::init_math_test(); $_POST = array('antispam_math_result' => Antispam::$first_operand + Antispam::$second_operand); $this->assertTrue(Antispam::check_math(), 'Condition is false'); $_POST = array('antispam_math_result' => Antispam::$first_operand + Antispam::$second_operand + 1); $this->assertFalse(Antispam::check_math(), 'Condition is true'); }
/** * @fn init_math_test * @short Filter method that initializes the Antispam math test for commenting articles. */ protected function init_math_test() { Antispam::init_math_test(); }
/** * @fn lost_password * @short Action method to request a new password. */ function lost_password() { $this->set_title("Emeraldion Lodge - " . l('Retrieve lost password')); Antispam::init_math_test(); }
</div> </div> <p class="form-left"> <label class="left-aligned required" for="f_text"><?php echo l("Message"); ?> </label> <textarea name="text" id="f_text" rows="10" cols="48"></textarea> </p> <p class="form-left padded-to-label"> <label for="f_antispam_math_result" class="required"> <?php echo l("Antispam question:"); ?> <?php Antispam::init_math_test(); echo Antispam::$first_operand; ?> + <?php echo Antispam::$second_operand; ?> = ? </label> <input type="text" aria-required="true" name="antispam_math_result" id="f_antispam_math_result" size="3" /> </p> <p class="lighter padded-to-label"> <?php echo l("An asterisk (*) denotes a required field."); ?> </p>