Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Validate_Validator_Alnum
  • Validate_Validator_Alpha
  • Validate_Validator_Cp
  • Validate_Validator_Date
  • Validate_Validator_Digit
  • Validate_Validator_Email
  • Validate_Validator_Equal
  • Validate_Validator_Interval
  • Validate_Validator_Time
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Pry Framework
 4:  *
 5:  * LICENSE
 6:  *
 7:  * This source file is subject to the new BSD license that is bundled
 8:  * with this package in the file LICENSE.txt.
 9:  * 
10:  * @version $Revision: 276 $
11:  */
12: 
13: /**
14:  * Validateur Alphabétique.
15:  * Accepte également le -
16:  * @category Pry
17:  * @package Validate
18:  * @subpackage Validate_Validator
19:  * @version 1.0.0 
20:  * @author Olivier ROGER <oroger.fr>
21:  */
22: class Validate_Validator_Alpha extends Validate_Abstract
23: {
24:     /**
25:      * Constructeur. par défaut accepte les espaces
26:      *
27:      * @param boolean $espace
28:      * @access public
29:      */
30:     public function __construct($espace = true)
31:     {
32:         $this->espace = (boolean)$espace;
33:         $this->errorMsg = "n'est pas une valeur alphabétique";
34:     }
35:     
36:     /**
37:      * Vérifie la présence de caractère alphabétique (uniquement)
38:      *
39:      * @param string $string
40:      * @return boolean
41:      */
42:     public function isValid($string)
43:     {
44:         $string = $this->cleanString($string);
45:         //On cherche si on ne trouve pas d alpha. Donc si true = la chaine n'est pas alpha on renvoi false.
46:         if($this->espace)
47:             if(preg_match('/[^a-zA-Z\s\-]/',$string))
48:                 return false;
49:             else
50:                 return true;
51:         else
52:             if(preg_match('/[^a-zA-Z\-]/',$string))
53:                 return false;
54:             else
55:                 return true;
56:     }
57: }
58:  ?>
Pry Framework API documentation generated by ApiGen 2.6.1