Merge pull request #5 from Martimiz/fixdeprecations

MINOR: fixed deprecated code in MathSpamProtectorField
This commit is contained in:
Will Rossiter 2012-07-11 01:08:38 -07:00
commit 0b28f5f32c

View File

@ -18,20 +18,19 @@ class MathSpamProtectorField extends SpamProtectorField {
* *
* @return HTML * @return HTML
*/ */
function Field() { function Field($properties = array()) {
if(self::is_enabled()) { if(self::is_enabled()) {
$attributes = array( $attributes = array(
'type' => 'text', 'type' => 'text',
'class' => 'text ' . ($this->extraClass() ? $this->extraClass() : ''), 'class' => 'text ' . ($this->extraClass() ? $this->extraClass() : ''),
'id' => $this->id(), 'id' => $this->id(),
'name' => $this->Name(), 'name' => $this->getName(),
'value' => $this->Value(), 'value' => $this->Value(),
'title' => $this->Title(), 'title' => $this->Title(),
'tabindex' => $this->getTabIndex(), 'tabindex' => $this->getAttribute('tabindex'),
'maxlength' => ($this->maxLength) ? $this->maxLength : null, 'maxlength' => ($this->maxLength) ? $this->maxLength : null,
'size' => ($this->maxLength) ? min( $this->maxLength, 30 ) : null 'size' => ($this->maxLength) ? min( $this->maxLength, 30 ) : null
); );
return $this->createTag('input', $attributes); return $this->createTag('input', $attributes);
} }
} }
@ -47,7 +46,7 @@ class MathSpamProtectorField extends SpamProtectorField {
/** /**
* Validates the value submitted by the user with the one saved * Validates the value submitted by the user with the one saved
* into the {@link Session} and then notify callback object * into the {@link Session} and then notify callback object
* with the spam checking result. * with the spam checking result.
* *
* @return bool * @return bool
@ -60,8 +59,7 @@ class MathSpamProtectorField extends SpamProtectorField {
$this->name, $this->name,
_t( _t(
'MathSpamProtectionField.INCORRECTSOLUTION', 'MathSpamProtectionField.INCORRECTSOLUTION',
"Incorrect solution to the spam protection question, please try again.", "Incorrect solution to the spam protection question, please try again."
PR_MEDIUM
), ),
"error" "error"
); );