$ret = '';
foreach ( $attribs as $key => $value ) {
+ # For boolean attributes, support array( 'foo' ) instead of
+ # requiring array( 'foo' => 'meaningless' ).
+ if ( is_int( $key )
+ && in_array( strtolower( $value ), self::$boolAttribs ) ) {
+ $key = $value;
+ }
+
+ # Not technically required in HTML 5, but required in XHTML 1.0,
+ # and we'd like consistency and better compression anyway.
+ $key = strtolower( $key );
+
# See the "Attributes" section in the HTML syntax part of HTML 5,
# 9.1.2.3 as of 2009-08-10. Most attributes can have quotation
# marks omitted, but not all. (Although a literal " is not
}
function pretty( $fields ) {
+ global $wgMinimalPasswordLength;
+
$out = '';
foreach ( $fields as $list ) {
list( $name, $label, $type, $value ) = $list;
$field = htmlspecialchars( $value );
} else {
$attribs = array( 'id' => $name );
- # All three fields are required, and we should focus the first
- # (wpPassword)
- $attribs['required'] = '';
+ # The current password field is never required; it's possible
+ # that existing users might have empty passwords on any wiki.
+ # The two other password fields are required if
+ # $wgMinimalPasswordLength > 0 (not allowed to set an empty
+ # password).
+ if ( ( $name == 'wpNewPassword' || $name == 'wpRetype' )
+ && $wgMinimalPasswordLength > 0 ) {
+ $attribs[] = 'required';
+ }
if ( $name == 'wpPassword' ) {
- $attribs['autofocus'] = '';
+ $attribs[] = 'autofocus';
}
$field = Html::input( $name, $value, $type, $attribs );
}