[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/data/validator/rules/ -> uintrule.class.php (source)

   1  <?php
   2  
   3      lt_include(PLOG_CLASS_PATH."class/data/validator/rules/regexprule.class.php");
   4  
   5      define( "UINT_RULE_REG_EXP", "^([0-9]+)$");
   6      define( "ERROR_RULE_UINT_FORMAT_WRONG", "error_rule_uint_format_wrong");
   7  
   8      /**
   9       * \ingroup Validator_Rules
  10       *
  11       * Validates that the given value is an unsigned integer or not. If unsuccessful, the error
  12       * ERROR_RULE_UINT_FORMAT_WRONG will be set.
  13       */
  14      class UIntRule extends RegExpRule
  15      {
  16          /**
  17           * Initialize the rule
  18           */
  19          function UIntRule()
  20          {
  21              $this->RegExpRule(UINT_RULE_REG_EXP, false);
  22          }
  23  
  24          /**
  25           * Checks whether the given value is an unsigned integer
  26           *
  27           * @return True if successful or false otherwise. If unsuccessful, the error
  28           * ERROR_RULE_UINT_FORMAT_WRONG will be set.
  29           */
  30          function validate($value)
  31          {
  32              if (parent::validate($value))
  33              {
  34                  $this->_setError(false);
  35                  return true;
  36              }
  37              else
  38              {
  39                  $this->_setError(ERROR_RULE_UINT_FORMAT_WRONG);
  40                  return false;
  41              }
  42          }
  43      }
  44  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics