MediaWiki  1.23.2
HTMLFloatField.php
Go to the documentation of this file.
1 <?php
2 
7  function getSize() {
8  return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 20;
9  }
10 
11  function validate( $value, $alldata ) {
12  $p = parent::validate( $value, $alldata );
13 
14  if ( $p !== true ) {
15  return $p;
16  }
17 
18  $value = trim( $value );
19 
20  # http://dev.w3.org/html5/spec/common-microsyntaxes.html#real-numbers
21  # with the addition that a leading '+' sign is ok.
22  if ( !preg_match( '/^((\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?)?$/i', $value ) ) {
23  return $this->msg( 'htmlform-float-invalid' )->parseAsBlock();
24  }
25 
26  # The "int" part of these message names is rather confusing.
27  # They make equal sense for all numbers.
28  if ( isset( $this->mParams['min'] ) ) {
29  $min = $this->mParams['min'];
30 
31  if ( $min > $value ) {
32  return $this->msg( 'htmlform-int-toolow', $min )->parseAsBlock();
33  }
34  }
35 
36  if ( isset( $this->mParams['max'] ) ) {
37  $max = $this->mParams['max'];
38 
39  if ( $max < $value ) {
40  return $this->msg( 'htmlform-int-toohigh', $max )->parseAsBlock();
41  }
42  }
43 
44  return true;
45  }
46 }
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
HTMLTextField
Definition: HTMLTextField.php:3
$value
$value
Definition: styleTest.css.php:45
HTMLFormField\msg
msg()
Get a translated interface message.
Definition: HTMLFormField.php:51
HTMLFloatField\validate
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
Definition: HTMLFloatField.php:11
HTMLFloatField\getSize
getSize()
Definition: HTMLFloatField.php:7