[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 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 10 * 11 * @param string $value 12 * @param array $alldata 13 * @return bool 14 */ 15 function validate( $value, $alldata ) { 16 if ( $value == '' ) { 17 return true; 18 } 19 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'] ); 31 } 32 33 return true; 34 } 35 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |