Re: cvs: pear /Validate/Validate AT.php

From: Date: Wed, 30 Aug 2006 10:33:14 +0000
Subject: Re: cvs: pear /Validate/Validate AT.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-41918@lists.php.net to get a copy of this message
So.. .. "-" is no longer allowed? On 8/30/06, Byron Adams <badams@php.net> wrote:
badams Wed Aug 30 09:35:30 2006 UTC Modified files:
    /pear/Validate/Validate	AT.php
Log: - Optimized Region http://cvs.php.net/viewvc.cgi/pear/Validate/Validate/AT.php?r1=1.20&r2=1.21&diff_format=u Index: pear/Validate/Validate/AT.php diff -u pear/Validate/Validate/AT.php:1.20 pear/Validate/Validate/AT.php:1.21 --- pear/Validate/Validate/AT.php:1.20 Sun Aug 27 04:11:48 2006 +++ pear/Validate/Validate/AT.php Wed Aug 30 09:35:30 2006 @@ -25,7 +25,7 @@ * @copyright 1997-2005 Michael Wallner * @copyright (c) 2006 Byron Adams
  * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD
License
- * @version    CVS: $Id: AT.php,v 1.20 2006/08/27 04:11:48 badams Exp $
+ * @version    CVS: $Id: AT.php,v 1.21 2006/08/30 09:35:30 badams Exp $
  * @link       http://pear.php.net/package/Validate_AT
*/ @@ -113,11 +113,12 @@
     */
     function region($region)
     {
-        $region = str_replace(
-           array("AU","-"," "),
-           "",
-           strtoupper($region));
-
-       return ($region > 0 && $region < 10);
- }
+        $region = str_ireplace("AU","",$region);
+
+        if (!ctype_digit($region)) {
+            return false;
+        }
+
+        return ($region > 0 && $region < 10);
+    }
} -- PEAR CVS Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.cvs (#41918) next »