Expose $wgMaxArticleSize in siteinfo query api
[mediawiki.git] / includes / htmlform / HTMLSelectLimitField.php
blobe7f1c047ce1e1e55b73286144a6027139cb4ab38
1 <?php
3 /**
4 * A limit dropdown, which accepts any valid number
5 */
6 class HTMLSelectLimitField extends HTMLSelectField {
7 /**
8 * Basically don't do any validation. If it's a number that's fine. Also,
9 * add it to the list if it's not there already
11 * @param string $value
12 * @param array $alldata
13 * @return bool
15 function validate( $value, $alldata ) {
16 if ( $value == '' ) {
17 return true;
20 // Let folks pick an explicit limit not from our list, as long as it's a real numbr.
21 if ( !in_array( $value, $this->mParams['options'] )
22 && $value == intval( $value )
23 && $value > 0
24 ) {
25 // This adds the explicitly requested limit value to the drop-down,
26 // then makes sure it's sorted correctly so when we output the list
27 // later, the custom option doesn't just show up last.
28 $this->mParams['options'][$this->mParent->getLanguage()->formatNum( $value )] =
29 intval( $value );
30 asort( $this->mParams['options'] );
33 return true;