MediaWiki  REL1_24
HTMLSelectLimitField.php
Go to the documentation of this file.
00001 <?php
00002 
00006 class HTMLSelectLimitField extends HTMLSelectField {
00015     function validate( $value, $alldata ) {
00016         if ( $value == '' ) {
00017             return true;
00018         }
00019 
00020         // Let folks pick an explicit limit not from our list, as long as it's a real numbr.
00021         if ( !in_array( $value, $this->mParams['options'] )
00022             && $value == intval( $value )
00023             && $value > 0
00024         ) {
00025             // This adds the explicitly requested limit value to the drop-down,
00026             // then makes sure it's sorted correctly so when we output the list
00027             // later, the custom option doesn't just show up last.
00028             $this->mParams['options'][$this->mParent->getLanguage()->formatNum( $value )] =
00029                 intval( $value );
00030             asort( $this->mParams['options'] );
00031         }
00032 
00033         return true;
00034     }
00035 }