MediaWiki  1.23.13
HTMLIntField.php
Go to the documentation of this file.
1 <?php
2 
6 class HTMLIntField extends HTMLFloatField {
7  function validate( $value, $alldata ) {
8  $p = parent::validate( $value, $alldata );
9 
10  if ( $p !== true ) {
11  return $p;
12  }
13 
14  # http://dev.w3.org/html5/spec/common-microsyntaxes.html#signed-integers
15  # with the addition that a leading '+' sign is ok. Note that leading zeros
16  # are fine, and will be left in the input, which is useful for things like
17  # phone numbers when you know that they are integers (the HTML5 type=tel
18  # input does not require its value to be numeric). If you want a tidier
19  # value to, eg, save in the DB, clean it up with intval().
20  if ( !preg_match( '/^((\+|\-)?\d+)?$/', trim( $value ) )
21  ) {
22  return $this->msg( 'htmlform-int-invalid' )->parseAsBlock();
23  }
24 
25  return true;
26  }
27 }
HTMLFloatField
A field that will contain a numeric value.
Definition: HTMLFloatField.php:6
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
HTMLIntField
A field that must contain a number.
Definition: HTMLIntField.php:6
HTMLIntField\validate
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
Definition: HTMLIntField.php:7
$value
$value
Definition: styleTest.css.php:45
HTMLFormField\msg
msg()
Get a translated interface message.
Definition: HTMLFormField.php:51