r55876 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55875‎ | r55876 | r55877 >
Date:14:32, 6 September 2009
Author:happy-melon
Status:resolved
Tags:
Comment:
Allow password fields to be served by HTMLForm.
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -21,6 +21,7 @@
2222 'int' => 'HTMLIntField',
2323 'float' => 'HTMLFloatField',
2424 'info' => 'HTMLInfoField',
 25+ 'password' => 'HTMLPasswordField',
2526 'selectorother' => 'HTMLSelectOrOtherField',
2627 # HTMLTextField will output the correct type="" attribute automagically.
2728 # There are about four zillion other HTML 5 input types, like url, but
@@ -515,6 +516,9 @@
516517 }
517518
518519 class HTMLTextField extends HTMLFormField {
 520+ # Override in derived classes to use other Xml::... functions
 521+ protected $mFunction = 'input';
 522+
519523 function getSize() {
520524 return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45;
521525 }
@@ -562,7 +566,8 @@
563567 }
564568 }
565569
566 - return Xml::input(
 570+ $func = $this->mFunction;
 571+ return Xml::$func(
567572 $this->mName,
568573 $this->getSize(),
569574 $value,
@@ -571,6 +576,10 @@
572577 }
573578 }
574579
 580+class HTMLPasswordField extends HTMLTextField {
 581+ protected $mFunction = 'password';
 582+}
 583+
575584 class HTMLFloatField extends HTMLTextField {
576585 function getSize() {
577586 return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 20;

Follow-up revisions

RevisionCommit summaryAuthorDate
r55879Reimplement r55876 properlysimetrical15:07, 6 September 2009

Status & tagging log