cvs: pear /Validate Validate.php

From: Date: Mon, 08 Nov 2004 10:03:16 +0000
Subject: cvs: pear /Validate Validate.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25769@lists.php.net to get a copy of this message
dufuz Mon Nov 8 05:03:16 2004 EDT Modified files: /pear/Validate Validate.php Log: update phpdoc for the uri function http://cvs.php.net/diff.php/pear/Validate/Validate.php?r1=1.44&r2=1.45&ty=u Index: pear/Validate/Validate.php diff -u pear/Validate/Validate.php:1.44 pear/Validate/Validate.php:1.45 --- pear/Validate/Validate.php:1.44 Mon Nov 8 04:38:29 2004 +++ pear/Validate/Validate.php Mon Nov 8 05:03:15 2004 @@ -17,7 +17,7 @@ // | Pierre-Alain Joye <paj@pearfr.org> | // +----------------------------------------------------------------------+ // -// $Id: Validate.php,v 1.44 2004/11/08 09:38:29 dufuz Exp $ +// $Id: Validate.php,v 1.45 2004/11/08 10:03:15 dufuz Exp $ // // Methods for common data validations // @@ -47,7 +47,7 @@ * 'min' minimun value * 'max' maximum value */ - function number($number, $options=array()) + function number($number, $options = array()) { $decimal = $dec_prec = $min = $max = null; if (is_array($options)) { @@ -134,6 +134,13 @@ /** * Validate an URI (RFC2396) + * This function will validate 'foobarstring' by default, to get it to validate + * only http, https, ftp and such you have to pass it in the allowed_schemes + * option, like this: + * <code> + * $options = array('allowed_schemes' => array('http', 'https', 'ftp')) + * var_dumpn(Validate::uri('http://www.example.org'), $options); + * </code> * * @param string $url URI to validate * @param array $options Options used by the validation method. @@ -153,11 +160,11 @@ } if (preg_match( '!^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?!', - $url,$matches)) + $url, $matches)) { $scheme = $matches[2]; $authority = $matches[4]; - if ( is_array($allowed_schemes) && + if (is_array($allowed_schemes) && !in_array($scheme,$allowed_schemes) ) { return false;

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