[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include(PLOG_CLASS_PATH."class/data/validator/rules/rule.class.php"); 4 5 define( "ERROR_RULE_VALUE_IS_EMPTY", "error_rule_value_is_empty"); 6 7 /** 8 * \ingroup Validator_Rules 9 * 10 * Validates if a string is empty or not 11 */ 12 class NonEmptyRule extends Rule 13 { 14 /** 15 * Initializes the rule 16 */ 17 function NonEmptyRule() 18 { 19 $this->Rule(); 20 } 21 22 /** 23 * Returns true if the value is not empty or false otherwise. If empty, 24 * the error ERROR_RULE_VALUE_IS_EMPTY will be set. 25 * 26 * @param value the string that we'd like to validate 27 * @return true if successful or false otherwise 28 */ 29 function validate($value) 30 { 31 if( $value == null || $value == "" || trim($value) == "" ) { 32 $this->_setError( ERROR_RULE_VALUE_IS_EMPTY ); 33 return false; 34 } 35 else { 36 return true; 37 } 38 } 39 } 40 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |