home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / QuickForm / Rule.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.2 KB  |  82 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * Abstract base class for QuickForm validation rules 
  6.  * 
  7.  * PHP versions 4 and 5
  8.  *
  9.  * LICENSE: This source file is subject to version 3.01 of the PHP license
  10.  * that is available through the world-wide-web at the following URI:
  11.  * http://www.php.net/license/3_01.txt If you did not receive a copy of
  12.  * the PHP License and are unable to obtain it through the web, please
  13.  * send a note to license@php.net so we can mail you a copy immediately.
  14.  *
  15.  * @category    HTML
  16.  * @package     HTML_QuickForm
  17.  * @author      Bertrand Mansion <bmansion@mamasam.com>
  18.  * @copyright   2001-2007 The PHP Group
  19.  * @license     http://www.php.net/license/3_01.txt PHP License 3.01
  20.  * @version     CVS: $Id: Rule.php,v 1.3 2007/05/29 18:34:36 avb Exp $
  21.  * @link        http://pear.php.net/package/HTML_QuickForm
  22.  */
  23.  
  24. /**
  25.  * Abstract base class for QuickForm validation rules 
  26.  *
  27.  * @category    HTML
  28.  * @package     HTML_QuickForm
  29.  * @author      Bertrand Mansion <bmansion@mamasam.com>
  30.  * @version     Release: 3.2.10
  31.  * @since       3.2
  32.  * @abstract
  33.  */
  34. class HTML_QuickForm_Rule
  35. {
  36.    /**
  37.     * Name of the rule to use in validate method
  38.     *
  39.     * This property is used in more global rules like Callback and Regex
  40.     * to determine which callback and which regex is to be used for validation
  41.     *
  42.     * @var  string
  43.     * @access   public
  44.     */
  45.     var $name;
  46.  
  47.    /**
  48.     * Validates a value
  49.     * 
  50.     * @access public
  51.     * @abstract
  52.     */
  53.     function validate($value)
  54.     {
  55.         return true;
  56.     }
  57.  
  58.    /**
  59.     * Sets the rule name
  60.     *
  61.     * @param  string    rule name
  62.     * @access public
  63.     */
  64.     function setName($ruleName)
  65.     {
  66.         $this->name = $ruleName;
  67.     }
  68.  
  69.     /**
  70.      * Returns the javascript test (the test should return true if the value is INVALID)
  71.      *
  72.      * @param     mixed     Options for the rule
  73.      * @access    public
  74.      * @return    array     first element is code to setup validation, second is the check itself
  75.      * @abstract
  76.      */
  77.     function getValidationScript($options = null)
  78.     {
  79.         return array('', '');
  80.     }
  81. }
  82. ?>