Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Split Validate_AR/Validate

  • Loading branch information...
commit 738e05684b99d9753aec628733f7d82b782bd5d2 1 parent 9f22b5f
Daniel O'Connor CloCkWeRX authored

Showing 156 changed files with 0 additions and 57,239 deletions. Show diff stats Hide diff stats

  1. +0 34 README.ADD_LOCALE
  2. +0 11 TODO
  3. +0 1,149 Validate.php
  4. +0 135 Validate/AT.php
  5. +0 467 Validate/BE.php
  6. +0 271 Validate/CA.php
  7. +0 158 Validate/CH.php
  8. +0 73 Validate/DE.php
  9. +0 159 Validate/DK.php
  10. +0 291 Validate/ES.php
  11. +0 682 Validate/FI.php
  12. +0 109 Validate/Finance.php
  13. +0 260 Validate/Finance/CreditCard.php
  14. +0 717 Validate/Finance/IBAN.php
  15. +0 76 Validate/Finance/ISIN.php
  16. +0 504 Validate/IE.php
  17. +0 153 Validate/IR.php
  18. +0 367 Validate/ISPN.php
  19. +0 540 Validate/IT.php
  20. +0 81 Validate/LI.php
  21. +0 56 Validate/LU.php
  22. +0 221 Validate/LV.php
  23. +0 56 Validate/NO.php
  24. +0 361 Validate/NZ.php
  25. +0 101 Validate/SE.php
  26. +0 242 Validate/UK.php
  27. +0 320 Validate/UK/carReg.php
  28. +0 583 Validate/US.php
  29. +0 240 Validate/World.php
  30. +0 297 Validate/esMX.php
  31. +0 344 Validate/ptBR.php
  32. +0 2,057 data/AT_postcodes.txt
  33. +0 2,853 data/BE_postcodes.txt
  34. +0 3,509 data/CH_postcodes.txt
  35. +0 22 data/IE_postcodes.txt
  36. +0 987 data/NZ_postcodes.txt
  37. +0 29,111 data/esMX_postcodes.txt
  38. +0 109 docs/Example_Locale.php
  39. +0 73 docs/Validate_BE.txt
  40. +0 55 docs/sample_multiple.php
  41. +0 78 docs/validate_it_examples.php
  42. +0 471 package.xml
  43. +0 92 package_AT.xml
  44. +0 162 package_BE.xml
  45. +0 114 package_CA.xml
  46. +0 122 package_CH.xml
  47. +0 94 package_CreditCard.xml
  48. +0 77 package_DE.xml
  49. +0 87 package_DK.xml
  50. +0 124 package_ES.xml
  51. +0 156 package_FI.xml
  52. +0 129 package_FR.xml
  53. +0 178 package_Finance.xml
  54. +0 121 package_IE.xml
  55. +0 58 package_IR.xml
  56. +0 126 package_ISPN.xml
  57. +0 53 package_IT.xml
  58. +0 81 package_LI.xml
  59. +0 81 package_LU.xml
  60. +0 79 package_LV.xml
  61. +0 81 package_NO.xml
  62. +0 63 package_NZ.xml
  63. +0 81 package_SE.xml
  64. +0 130 package_UK.xml
  65. +0 119 package_US.xml
  66. +0 88 package_esMX.xml
  67. +0 156 package_ptBR.xml
  68. +0 312 tests/Validate_NZ.phpt
  69. +0 14 tests/bug11592.phpt
  70. +0 11 tests/bug12279.phpt
  71. +0 11 tests/bug13633.phpt
  72. +0 10 tests/bug14075.phpt
  73. +0 43 tests/bug14535.phpt
  74. +0 24 tests/bug17279.phpt
  75. +0 19 tests/bug7038.phpt
  76. +0 23 tests/bug7176.phpt
  77. +0 13 tests/bug7531.phpt
  78. +0 26 tests/bug7648.phpt
  79. +0 17 tests/bug8073.phpt
  80. +0 11 tests/bug8629.phpt
  81. +0 13 tests/bug8851.phpt
  82. +0 11 tests/bug8853.phpt
  83. +0 214 tests/credit_card.phpt
  84. +0 166 tests/email.phpt
  85. +0 49 tests/email_domaincheck.phpt
  86. +0 60 tests/multicard.phpt
  87. +0 53 tests/multiple.phpt
  88. +0 52 tests/number.phpt
  89. +0 252 tests/product_numbers.phpt
  90. BIN  tests/ptBR.phpt
  91. +0 39 tests/rfc822nok.phpt
  92. +0 63 tests/rfc822ok.phpt
  93. +0 98 tests/testdate.phpt
  94. +0 55 tests/testdate_minmax.phpt
  95. +0 87 tests/uri.phpt
  96. +0 48 tests/uri_domaincheck.phpt
  97. +0 120 tests/validate_AT.phpt
  98. +0 58 tests/validate_BE_bank_codes.phpt
  99. +0 53 tests/validate_BE_bank_transfer_message.phpt
  100. +0 33 tests/validate_BE_functions.inc.php
  101. +0 44 tests/validate_BE_national_id.phpt
  102. +0 96 tests/validate_BE_phone_numbers.phpt
  103. +0 65 tests/validate_BE_post_code.phpt
  104. +0 65 tests/validate_BE_post_code_strong.phpt
  105. +0 55 tests/validate_BE_ssn.phpt
  106. +0 49 tests/validate_BE_vat.phpt
  107. +0 491 tests/validate_CA.phpt
  108. +0 74 tests/validate_CH.phpt
  109. +0 56 tests/validate_DE.phpt
  110. +0 110 tests/validate_DK.phpt
  111. +0 45 tests/validate_ES_ccc.phpt
  112. +0 105 tests/validate_ES_cif.phpt
  113. +0 53 tests/validate_ES_dni.phpt
  114. +0 45 tests/validate_ES_postalCode.phpt
  115. +0 59 tests/validate_ES_ssn.phpt
  116. +0 49 tests/validate_FI_bankAccount.phpt
  117. +0 63 tests/validate_FI_bikeLicensePlate.phpt
  118. +0 47 tests/validate_FI_businessId.phpt
  119. +0 87 tests/validate_FI_carLicensePlate.phpt
  120. +0 54 tests/validate_FI_creditCard.phpt
  121. +0 41 tests/validate_FI_finuid.phpt
  122. +0 47 tests/validate_FI_partyId.phpt
  123. +0 55 tests/validate_FI_phoneNumber.phpt
  124. +0 73 tests/validate_FI_pin.phpt
  125. +0 69 tests/validate_FI_postalCode.phpt
  126. +0 49 tests/validate_FI_refNum.phpt
  127. +0 47 tests/validate_FI_vatNumber.phpt
  128. +0 169 tests/validate_Finance.phpt
  129. +0 50 tests/validate_IE_IBAN.phpt
  130. +0 51 tests/validate_IE_bankAC.phpt
  131. +0 33 tests/validate_IE_drive.phpt
  132. +0 50 tests/validate_IE_licensePlate.phpt
  133. +0 35 tests/validate_IE_passport.phpt
  134. +0 57 tests/validate_IE_phoneNumber.phpt
  135. +0 41 tests/validate_IE_post_code.phpt
  136. +0 38 tests/validate_IE_ppsn.phpt
  137. +0 37 tests/validate_IE_swift.phpt
  138. +0 48 tests/validate_IE_vatNumber.phpt
  139. +0 70 tests/validate_IN_region.phpt
  140. +0 48 tests/validate_IR_alphaNumeric.phpt
  141. +0 44 tests/validate_IR_creditCard.phpt
  142. +0 60 tests/validate_IR_mobileNumber.phpt
  143. +0 42 tests/validate_IR_numeric.phpt
  144. +0 80 tests/validate_IR_phoneNumber.phpt
  145. +0 40 tests/validate_IR_postalCode.phpt
  146. +0 50 tests/validate_IR_ssn.phpt
  147. +0 32 tests/validate_ISIN.phpt
  148. +0 59 tests/validate_LI_postalcodes.phpt
  149. +0 37 tests/validate_LU_postalcodes.phpt
  150. +0 37 tests/validate_NO_postalcodes.phpt
  151. +0 37 tests/validate_SE_counties.phpt
  152. +0 43 tests/validate_SE_postalcodes.phpt
  153. +0 238 tests/validate_UK.phpt
  154. +0 328 tests/validate_US.phpt
  155. +0 157 tests/validate_esMX.phpt
  156. +0 42 tests/validate_functions.inc
34 README.ADD_LOCALE
... ... @@ -1,34 +0,0 @@
1   -If you like to add Validate subpackages for a country or
2   -some specific (like Finance) needs, please send a mail
3   -to the pear-dev Mailing list to discuss it.
4   -
5   -There is no need to create a proposal. There is no vote
6   -or other community requests to add a locale to validate.
7   -
8   -We do not have many requirements, but the following must
9   -be fullfilled:
10   -
11   -- Validate API compliant
12   -- No conflict with existing sub packages
13   -- If possible more than one maintainer (asking other
14   - validate_xx maintainers help)
15   -- PEAR CS
16   -
17   -Only the current active leads of Validate can agree or
18   -not to publish a subpackage (actually pajoye, dufuz).
19   -
20   -If you need an starting point then take a look at Example_Locale.php in
21   -the docs dir (http://cvs.php.net/pear/Validate/docs/)
22   -You can take that file to have something to start from and also to have
23   -three functions to start implementing before doing your first release.
24   -
25   -To make things even easier then you just go in there and replace [Your Name]
26   -with your real name <example@example.org> with your email (but still keeping
27   -the <> around the email) and [LocaleName] should be replaced with your locale
28   -name, like say HU or IS or such.
29   -
30   -Now you just have to implement those functions and write further info for each
31   -function where relevant (some countries have more requirements than others
32   -and the end developer has to know those things, urls to those infos are also fine)
33   -and if you have any extra functions in mind then just go and implement
34   -those also! ;)
11 TODO
... ... @@ -1,11 +0,0 @@
1   -Date:
2   -Create warnings for ambiguous date format with %j, or %n (currently test 5,6 and 7 failed)
3   -Adding 'r' format (RFC 822)
4   -
5   -More Countries support
6   -Mail on peardev if you are interested to add validations for your area
7   -
8   -Update banks SWIFT or IBANN validation for each country (when possible)
9   -
10   -Check that for the postal codes:
11   -http://www.magma.ca/~djcl/postcd.txt
1,149 Validate.php
... ... @@ -1,1149 +0,0 @@
1   -<?php
2   -/**
3   - * Validation class
4   - *
5   - * Copyright (c) 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox, Amir Saied
6   - *
7   - * This source file is subject to the New BSD license, That is bundled
8   - * with this package in the file LICENSE, and is available through
9   - * the world-wide-web at
10   - * http://www.opensource.org/licenses/bsd-license.php
11   - * If you did not receive a copy of the new BSDlicense and are unable
12   - * to obtain it through the world-wide-web, please send a note to
13   - * pajoye@php.net so we can mail you a copy immediately.
14   - *
15   - * Author: Tomas V.V.Cox <cox@idecnet.com>
16   - * Pierre-Alain Joye <pajoye@php.net>
17   - * Amir Mohammad Saied <amir@php.net>
18   - *
19   - *
20   - * Package to validate various datas. It includes :
21   - * - numbers (min/max, decimal or not)
22   - * - email (syntax, domain check)
23   - * - string (predifined type alpha upper and/or lowercase, numeric,...)
24   - * - date (min, max, rfc822 compliant)
25   - * - uri (RFC2396)
26   - * - possibility valid multiple data with a single method call (::multiple)
27   - *
28   - * @category Validate
29   - * @package Validate
30   - * @author Tomas V.V.Cox <cox@idecnet.com>
31   - * @author Pierre-Alain Joye <pajoye@php.net>
32   - * @author Amir Mohammad Saied <amir@php.net>
33   - * @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
34   - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
35   - * @version CVS: $Id$
36   - * @link http://pear.php.net/package/Validate
37   - */
38   -
39   -// {{{ Constants
40   -/**
41   - * Methods for common data validations
42   - */
43   -define('VALIDATE_NUM', '0-9');
44   -define('VALIDATE_SPACE', '\s');
45   -define('VALIDATE_ALPHA_LOWER', 'a-z');
46   -define('VALIDATE_ALPHA_UPPER', 'A-Z');
47   -define('VALIDATE_ALPHA', VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);
48   -define('VALIDATE_EALPHA_LOWER', VALIDATE_ALPHA_LOWER . 'áéíóúýàèìòùäëïöüÿâêîôûãñõ¨åæç½ðøþß');
49   -define('VALIDATE_EALPHA_UPPER', VALIDATE_ALPHA_UPPER . 'ÁÉÍÓÚÝÀÈÌÒÙÄËÏÖܾÂÊÎÔÛÃÑÕ¦ÅÆǼÐØÞ');
50   -define('VALIDATE_EALPHA', VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);
51   -define('VALIDATE_PUNCTUATION', VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');
52   -define('VALIDATE_NAME', VALIDATE_EALPHA . VALIDATE_SPACE . "'" . '\-');
53   -define('VALIDATE_STREET', VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");
54   -
55   -define('VALIDATE_ITLD_EMAILS', 1);
56   -define('VALIDATE_GTLD_EMAILS', 2);
57   -define('VALIDATE_CCTLD_EMAILS', 4);
58   -define('VALIDATE_ALL_EMAILS', 8);
59   -// }}}
60   -
61   -/**
62   - * Validation class
63   - *
64   - * Package to validate various datas. It includes :
65   - * - numbers (min/max, decimal or not)
66   - * - email (syntax, domain check)
67   - * - string (predifined type alpha upper and/or lowercase, numeric,...)
68   - * - date (min, max)
69   - * - uri (RFC2396)
70   - * - possibility valid multiple data with a single method call (::multiple)
71   - *
72   - * @category Validate
73   - * @package Validate
74   - * @author Tomas V.V.Cox <cox@idecnet.com>
75   - * @author Pierre-Alain Joye <pajoye@php.net>
76   - * @author Amir Mohammad Saied <amir@php.net>
77   - * @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
78   - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
79   - * @version Release: @package_version@
80   - * @link http://pear.php.net/package/Validate
81   - */
82   -class Validate
83   -{
84   - // {{{ International, Generic and Country code TLDs
85   - /**
86   - * International Top-Level Domain
87   - *
88   - * This is an array of the known international
89   - * top-level domain names.
90   - *
91   - * @access protected
92   - * @var array $_iTld (International top-level domains)
93   - */
94   - var $_itld = array(
95   - 'arpa',
96   - 'root',
97   - );
98   -
99   - /**
100   - * Generic top-level domain
101   - *
102   - * This is an array of the official
103   - * generic top-level domains.
104   - *
105   - * @access protected
106   - * @var array $_gTld (Generic top-level domains)
107   - */
108   - var $_gtld = array(
109   - 'aero',
110   - 'biz',
111   - 'cat',
112   - 'com',
113   - 'coop',
114   - 'edu',
115   - 'gov',
116   - 'info',
117   - 'int',
118   - 'jobs',
119   - 'mil',
120   - 'mobi',
121   - 'museum',
122   - 'name',
123   - 'net',
124   - 'org',
125   - 'pro',
126   - 'travel',
127   - 'asia',
128   - 'post',
129   - 'tel',
130   - 'geo',
131   - );
132   -
133   - /**
134   - * Country code top-level domains
135   - *
136   - * This is an array of the official country
137   - * codes top-level domains
138   - *
139   - * @access protected
140   - * @var array $_ccTld (Country Code Top-Level Domain)
141   - */
142   - var $_cctld = array(
143   - 'ac',
144   - 'ad','ae','af','ag',
145   - 'ai','al','am','an',
146   - 'ao','aq','ar','as',
147   - 'at','au','aw','ax',
148   - 'az','ba','bb','bd',
149   - 'be','bf','bg','bh',
150   - 'bi','bj','bm','bn',
151   - 'bo','br','bs','bt',
152   - 'bu','bv','bw','by',
153   - 'bz','ca','cc','cd',
154   - 'cf','cg','ch','ci',
155   - 'ck','cl','cm','cn',
156   - 'co','cr','cs','cu',
157   - 'cv','cx','cy','cz',
158   - 'de','dj','dk','dm',
159   - 'do','dz','ec','ee',
160   - 'eg','eh','er','es',
161   - 'et','eu','fi','fj',
162   - 'fk','fm','fo','fr',
163   - 'ga','gb','gd','ge',
164   - 'gf','gg','gh','gi',
165   - 'gl','gm','gn','gp',
166   - 'gq','gr','gs','gt',
167   - 'gu','gw','gy','hk',
168   - 'hm','hn','hr','ht',
169   - 'hu','id','ie','il',
170   - 'im','in','io','iq',
171   - 'ir','is','it','je',
172   - 'jm','jo','jp','ke',
173   - 'kg','kh','ki','km',
174   - 'kn','kp','kr','kw',
175   - 'ky','kz','la','lb',
176   - 'lc','li','lk','lr',
177   - 'ls','lt','lu','lv',
178   - 'ly','ma','mc','md',
179   - 'me','mg','mh','mk',
180   - 'ml','mm','mn','mo',
181   - 'mp','mq','mr','ms',
182   - 'mt','mu','mv','mw',
183   - 'mx','my','mz','na',
184   - 'nc','ne','nf','ng',
185   - 'ni','nl','no','np',
186   - 'nr','nu','nz','om',
187   - 'pa','pe','pf','pg',
188   - 'ph','pk','pl','pm',
189   - 'pn','pr','ps','pt',
190   - 'pw','py','qa','re',
191   - 'ro','rs','ru','rw',
192   - 'sa','sb','sc','sd',
193   - 'se','sg','sh','si',
194   - 'sj','sk','sl','sm',
195   - 'sn','so','sr','st',
196   - 'su','sv','sy','sz',
197   - 'tc','td','tf','tg',
198   - 'th','tj','tk','tl',
199   - 'tm','tn','to','tp',
200   - 'tr','tt','tv','tw',
201   - 'tz','ua','ug','uk',
202   - 'us','uy','uz','va',
203   - 'vc','ve','vg','vi',
204   - 'vn','vu','wf','ws',
205   - 'ye','yt','yu','za',
206   - 'zm','zw',
207   - );
208   - // }}}
209   -
210   - /**
211   - * Validate a tag URI (RFC4151)
212   - *
213   - * @param string $uri tag URI to validate
214   - *
215   - * @return boolean true if valid tag URI, false if not
216   - *
217   - * @access private
218   - */
219   - function __uriRFC4151($uri)
220   - {
221   - $datevalid = false;
222   - if (preg_match(
223   - '/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $uri, $matches)) {
224   - $date = $matches['date'];
225   - $date6 = strtotime($date);
226   - if ((strlen($date) == 4) && $date <= date('Y')) {
227   - $datevalid = true;
228   - } elseif ((strlen($date) == 7) && ($date6 < strtotime("now"))) {
229   - $datevalid = true;
230   - } elseif ((strlen($date) == 10) && ($date6 < strtotime("now"))) {
231   - $datevalid = true;
232   - }
233   - if (self::email($matches['name'])) {
234   - $namevalid = true;
235   - } else {
236   - $namevalid = self::email('info@' . $matches['name']);
237   - }
238   - return $datevalid && $namevalid;
239   - } else {
240   - return false;
241   - }
242   - }
243   -
244   - /**
245   - * Validate a number
246   - *
247   - * @param string $number Number to validate
248   - * @param array $options array where:
249   - * 'decimal' is the decimal char or false when decimal
250   - * not allowed.
251   - * i.e. ',.' to allow both ',' and '.'
252   - * 'dec_prec' Number of allowed decimals
253   - * 'min' minimum value
254   - * 'max' maximum value
255   - *
256   - * @return boolean true if valid number, false if not
257   - *
258   - * @access public
259   - */
260   - function number($number, $options = array())
261   - {
262   - $decimal = $dec_prec = $min = $max = null;
263   - if (is_array($options)) {
264   - extract($options);
265   - }
266   -
267   - $dec_prec = $dec_prec ? "{1,$dec_prec}" : '+';
268   - $dec_regex = $decimal ? "[$decimal][0-9]$dec_prec" : '';
269   -
270   - if (!preg_match("|^[-+]?\s*[0-9]+($dec_regex)?\$|", $number)) {
271   - return false;
272   - }
273   -
274   - if ($decimal != '.') {
275   - $number = strtr($number, $decimal, '.');
276   - }
277   -
278   - $number = (float)str_replace(' ', '', $number);
279   - if ($min !== null && $min > $number) {
280   - return false;
281   - }
282   -
283   - if ($max !== null && $max < $number) {
284   - return false;
285   - }
286   - return true;
287   - }
288   -
289   - /**
290   - * Converting a string to UTF-7 (RFC 2152)
291   - *
292   - * @param string $string string to be converted
293   - *
294   - * @return string converted string
295   - *
296   - * @access private
297   - */
298   - function __stringToUtf7($string)
299   - {
300   - $return = '';
301   - $utf7 = array(
302   - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
303   - 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
304   - 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
305   - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
306   - 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
307   - '3', '4', '5', '6', '7', '8', '9', '+', ','
308   - );
309   -
310   -
311   - $state = 0;
312   -
313   - if (!empty($string)) {
314   - $i = 0;
315   - while ($i <= strlen($string)) {
316   - $char = substr($string, $i, 1);
317   - if ($state == 0) {
318   - if ((ord($char) >= 0x7F) || (ord($char) <= 0x1F)) {
319   - if ($char) {
320   - $return .= '&';
321   - }
322   - $state = 1;
323   - } elseif ($char == '&') {
324   - $return .= '&-';
325   - } else {
326   - $return .= $char;
327   - }
328   - } elseif (($i == strlen($string) ||
329   - !((ord($char) >= 0x7F)) || (ord($char) <= 0x1F))) {
330   - if ($state != 1) {
331   - if (ord($char) > 64) {
332   - $return .= '';
333   - } else {
334   - $return .= $utf7[ord($char)];
335   - }
336   - }
337   - $return .= '-';
338   - $state = 0;
339   - } else {
340   - switch($state) {
341   - case 1:
342   - $return .= $utf7[ord($char) >> 2];
343   - $residue = (ord($char) & 0x03) << 4;
344   - $state = 2;
345   - break;
346   - case 2:
347   - $return .= $utf7[$residue | (ord($char) >> 4)];
348   - $residue = (ord($char) & 0x0F) << 2;
349   - $state = 3;
350   - break;
351   - case 3:
352   - $return .= $utf7[$residue | (ord($char) >> 6)];
353   - $return .= $utf7[ord($char) & 0x3F];
354   - $state = 1;
355   - break;
356   - }
357   - }
358   - $i++;
359   - }
360   - return $return;
361   - }
362   - return '';
363   - }
364   -
365   - /**
366   - * Validate an email according to full RFC822 (inclusive human readable part)
367   - *
368   - * @param string $email email to validate,
369   - * will return the address for optional dns validation
370   - * @param array $options email() options
371   - *
372   - * @return boolean true if valid email, false if not
373   - *
374   - * @access private
375   - */
376   - function __emailRFC822(&$email, &$options)
377   - {
378   - static $address = null;
379   - static $uncomment = null;
380   - if (!$address) {
381   - // atom = 1*<any CHAR except specials, SPACE and CTLs>
382   - $atom = '[^][()<>@,;:\\".\s\000-\037\177-\377]+\s*';
383   - // qtext = <any CHAR excepting <">, ; => may be folded
384   - // "\" & CR, and including linear-white-space>
385   - $qtext = '[^"\\\\\r]';
386   - // quoted-pair = "\" CHAR ; may quote any char
387   - $quoted_pair = '\\\\.';
388   - // quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or
389   - // ; quoted chars.
390   - $quoted_string = '"(?:' . $qtext . '|' . $quoted_pair . ')*"\s*';
391   - // word = atom / quoted-string
392   - $word = '(?:' . $atom . '|' . $quoted_string . ')';
393   - // local-part = word *("." word) ; uninterpreted
394   - // ; case-preserved
395   - $local_part = $word . '(?:\.\s*' . $word . ')*';
396   - // dtext = <any CHAR excluding "[", ; => may be folded
397   - // "]", "\" & CR, & including linear-white-space>
398   - $dtext = '[^][\\\\\r]';
399   - // domain-literal = "[" *(dtext / quoted-pair) "]"
400   - $domain_literal = '\[(?:' . $dtext . '|' . $quoted_pair . ')*\]\s*';
401   - // sub-domain = domain-ref / domain-literal
402   - // domain-ref = atom ; symbolic reference
403   - $sub_domain = '(?:' . $atom . '|' . $domain_literal . ')';
404   - // domain = sub-domain *("." sub-domain)
405   - $domain = $sub_domain . '(?:\.\s*' . $sub_domain . ')*';
406   - // addr-spec = local-part "@" domain ; global address
407   - $addr_spec = $local_part . '@\s*' . $domain;
408   - // route = 1#("@" domain) ":" ; path-relative
409   - $route = '@' . $domain . '(?:,@\s*' . $domain . ')*:\s*';
410   - // route-addr = "<" [route] addr-spec ">"
411   - $route_addr = '<\s*(?:' . $route . ')?' . $addr_spec . '>\s*';
412   - // phrase = 1*word ; Sequence of words
413   - $phrase = $word . '+';
414   - // mailbox = addr-spec ; simple address
415   - // / phrase route-addr ; name & addr-spec
416   - $mailbox = '(?:' . $addr_spec . '|' . $phrase . $route_addr . ')';
417   - // group = phrase ":" [#mailbox] ";"
418   - $group = $phrase . ':\s*(?:' . $mailbox . '(?:,\s*' . $mailbox . ')*)?;\s*';
419   - // address = mailbox ; one addressee
420   - // / group ; named list
421   - $address = '/^\s*(?:' . $mailbox . '|' . $group . ')$/';
422   -
423   - $uncomment =
424   - '/((?:(?:\\\\"|[^("])*(?:' . $quoted_string .
425   - ')?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/';
426   - }
427   - // strip comments
428   - $email = preg_replace($uncomment, '$1 ', $email);
429   - return preg_match($address, $email);
430   - }
431   -
432   - /**
433   - * Full TLD Validation function
434   - *
435   - * This function is used to make a much more proficient validation
436   - * against all types of official domain names.
437   - *
438   - * @param string $email The email address to check.
439   - * @param array $options The options for validation
440   - *
441   - * @access protected
442   - *
443   - * @return bool True if validating succeeds
444   - */
445   - function _fullTLDValidation($email, $options)
446   - {
447   - $validate = array();
448   - if(!empty($options["VALIDATE_ITLD_EMAILS"])) array_push($validate, 'itld');
449   - if(!empty($options["VALIDATE_GTLD_EMAILS"])) array_push($validate, 'gtld');
450   - if(!empty($options["VALIDATE_CCTLD_EMAILS"])) array_push($validate, 'cctld');
451   -
452   - if (count($validate) === 0) {
453   - array_push($validate, 'itld', 'gtld', 'cctld');
454   - }
455   -
456   - $self = new Validate;
457   -
458   - $toValidate = array();
459   -
460   - foreach ($validate as $valid) {
461   - $tmpVar = '_' . (string)$valid;
462   -
463   - $toValidate[$valid] = $self->{$tmpVar};
464   - }
465   -
466   - $e = $self->executeFullEmailValidation($email, $toValidate);
467   -
468   - return $e;
469   - }
470   -
471   - /**
472   - * Execute the validation
473   - *
474   - * This function will execute the full email vs tld
475   - * validation using an array of tlds passed to it.
476   - *
477   - * @param string $email The email to validate.
478   - * @param array $arrayOfTLDs The array of the TLDs to validate
479   - *
480   - * @access public
481   - *
482   - * @return true or false (Depending on if it validates or if it does not)
483   - */
484   - function executeFullEmailValidation($email, $arrayOfTLDs)
485   - {
486   - $emailEnding = explode('.', $email);
487   - $emailEnding = $emailEnding[count($emailEnding)-1];
488   - foreach ($arrayOfTLDs as $validator => $keys) {
489   - if (in_array($emailEnding, $keys)) {
490   - return true;
491   - }
492   - }
493   - return false;
494   - }
495   -
496   - /**
497   - * Validate an email
498   - *
499   - * @param string $email email to validate
500   - * @param mixed boolean (BC) $check_domain Check or not if the domain exists
501   - * array $options associative array of options
502   - * 'check_domain' boolean Check or not if the domain exists
503   - * 'use_rfc822' boolean Apply the full RFC822 grammar
504   - *
505   - * Ex.
506   - * $options = array(
507   - * 'check_domain' => 'true',
508   - * 'fullTLDValidation' => 'true',
509   - * 'use_rfc822' => 'true',
510   - * 'VALIDATE_GTLD_EMAILS' => 'true',
511   - * 'VALIDATE_CCTLD_EMAILS' => 'true',
512   - * 'VALIDATE_ITLD_EMAILS' => 'true',
513   - * );
514   - *
515   - * @return boolean true if valid email, false if not
516   - *
517   - * @access public
518   - */
519   - function email($email, $options = null)
520   - {
521   - $check_domain = false;
522   - $use_rfc822 = false;
523   - if (is_bool($options)) {
524   - $check_domain = $options;
525   - } elseif (is_array($options)) {
526   - extract($options);
527   - }
528   -
529   - /**
530   - * Check for IDN usage so we can encode the domain as Punycode
531   - * before continuing.
532   - */
533   - $hasIDNA = false;
534   -
535   - if (Validate::_includePathFileExists('Net/IDNA.php')) {
536   - include_once('Net/IDNA.php');
537   - $hasIDNA = true;
538   - }
539   -
540   - if ($hasIDNA === true) {
541   - if (strpos($email, '@') !== false) {
542   - $tmpEmail = explode('@', $email);
543   - $domain = array_pop($tmpEmail);
544   -
545   - // Check if the domain contains characters > 127 which means
546   - // it's an idn domain name.
547   - $chars = count_chars($domain, 1);
548   - if (!empty($chars) && max(array_keys($chars)) > 127) {
549   - $idna =& Net_IDNA::singleton();
550   - $domain = $idna->encode($domain);
551   - }
552   -
553   - array_push($tmpEmail, $domain);
554   - $email = implode('@', $tmpEmail);
555   - }
556   - }
557   -
558   - /**
559   - * @todo Fix bug here.. even if it passes this, it won't be passing
560   - * The regular expression below
561   - */
562   - if (isset($fullTLDValidation)) {
563   - //$valid = Validate::_fullTLDValidation($email, $fullTLDValidation);
564   - $valid = Validate::_fullTLDValidation($email, $options);
565   -
566   - if (!$valid) {
567   - return false;
568   - }
569   - }
570   -
571   - // the base regexp for address
572   - $regex = '&^(?: # recipient:
573   - ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")| #1 quoted name
574   - ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)*)) #2 OR dot-atom
575   - @(((\[)? #3 domain, 4 as IPv4, 5 optionally bracketed
576   - (?:(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\.){3}
577   - (?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))))(?(5)\])|
578   - ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-z0-9]*[a-z0-9])?) #6 domain as hostname
579   - \.((?:([^- ])[-a-z]*[-a-z]))) #7 TLD
580   - $&xi';
581   -
582   - //checks if exists the domain (MX or A)
583   - if ($use_rfc822? Validate::__emailRFC822($email, $options) :
584   - preg_match($regex, $email)) {
585   - if ($check_domain && function_exists('checkdnsrr')) {
586   - $domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email)));
587   - if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
588   - return true;
589   - }
590   - return false;
591   - }
592   - return true;
593   - }
594   - return false;
595   - }
596   -
597   - /**
598   - * Validate a string using the given format 'format'
599   - *
600   - * @param string $string String to validate
601   - * @param array $options Options array where:
602   - * 'format' is the format of the string
603   - * Ex:VALIDATE_NUM . VALIDATE_ALPHA (see constants)
604   - * 'min_length' minimum length
605   - * 'max_length' maximum length
606   - *
607   - * @return boolean true if valid string, false if not
608   - *
609   - * @access public
610   - */
611   - function string($string, $options)
612   - {
613   - $format = null;
614   - $min_length = 0;
615   - $max_length = 0;
616   -
617   - if (is_array($options)) {
618   - extract($options);
619   - }
620   -
621   - if ($format && !preg_match("|^[$format]*\$|s", $string)) {
622   - return false;
623   - }
624   -
625   - if ($min_length && strlen($string) < $min_length) {
626   - return false;
627   - }
628   -
629   - if ($max_length && strlen($string) > $max_length) {
630   - return false;
631   - }
632   -
633   - return true;
634   - }
635   -
636   - /**
637   - * Validate an URI (RFC2396)
638   - * This function will validate 'foobarstring' by default, to get it to validate
639   - * only http, https, ftp and such you have to pass it in the allowed_schemes
640   - * option, like this:
641   - * <code>
642   - * $options = array('allowed_schemes' => array('http', 'https', 'ftp'))
643   - * var_dump(Validate::uri('http://www.example.org', $options));
644   - * </code>
645   - *
646   - * NOTE 1: The rfc2396 normally allows middle '-' in the top domain
647   - * e.g. http://example.co-m should be valid
648   - * However, as '-' is not used in any known TLD, it is invalid
649   - * NOTE 2: As double shlashes // are allowed in the path part, only full URIs
650   - * including an authority can be valid, no relative URIs
651   - * the // are mandatory (optionally preceeded by the 'sheme:' )
652   - * NOTE 3: the full complience to rfc2396 is not achieved by default
653   - * the characters ';/?:@$,' will not be accepted in the query part
654   - * if not urlencoded, refer to the option "strict'"
655   - *
656   - * @param string $url URI to validate
657   - * @param array $options Options used by the validation method.
658   - * key => type
659   - * 'domain_check' => boolean
660   - * Whether to check the DNS entry or not
661   - * 'allowed_schemes' => array, list of protocols
662   - * List of allowed schemes ('http',
663   - * 'ssh+svn', 'mms')
664   - * 'strict' => string the refused chars
665   - * in query and fragment parts
666   - * default: ';/?:@$,'
667   - * empty: accept all rfc2396 foreseen chars
668   - *
669   - * @return boolean true if valid uri, false if not
670   - *
671   - * @access public
672   - */
673   - function uri($url, $options = null)
674   - {
675   - $strict = ';/?:@$,';
676   - $domain_check = false;
677   - $allowed_schemes = null;
678   - if (is_array($options)) {
679   - extract($options);
680   - }
681   - if (is_array($allowed_schemes) &&
682   - in_array("tag", $allowed_schemes)
683   - ) {
684   - if (strpos($url, "tag:") === 0) {
685   - return self::__uriRFC4151($url);
686   - }
687   - }
688   -
689   - if (preg_match(
690   - '&^(?:([a-z][-+.a-z0-9]*):)? # 1. scheme
691   - (?:// # authority start
692   - (?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:\&=+$,])*)@)? # 2. authority-userinfo
693   - (?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?) # 3. authority-hostname OR
694   - |([0-9]{1,3}(?:\.[0-9]{1,3}){3})) # 4. authority-ipv4
695   - (?::([0-9]*))?) # 5. authority-port
696   - ((?:/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*/?)? # 6. path
697   - (?:\?([^#]*))? # 7. query
698   - (?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();/?:@\&=+$,])*))? # 8. fragment
699   - $&xi', $url, $matches)) {
700   - $scheme = isset($matches[1]) ? $matches[1] : '';
701   - $authority = isset($matches[3]) ? $matches[3] : '' ;
702   - if (is_array($allowed_schemes) &&
703   - !in_array($scheme, $allowed_schemes)
704   - ) {
705   - return false;
706   - }
707   - if (!empty($matches[4])) {
708   - $parts = explode('.', $matches[4]);
709   - foreach ($parts as $part) {
710   - if ($part > 255) {
711   - return false;
712   - }
713   - }
714   - } elseif ($domain_check && function_exists('checkdnsrr')) {
715   - if (!checkdnsrr($authority, 'A')) {
716   - return false;
717   - }
718   - }
719   - if ($strict) {
720   - $strict = '#[' . preg_quote($strict, '#') . ']#';
721   - if ((!empty($matches[7]) && preg_match($strict, $matches[7]))
722   - || (!empty($matches[8]) && preg_match($strict, $matches[8]))) {
723   - return false;
724   - }
725   - }
726   - return true;
727   - }
728   - return false;
729   - }
730   -
731   - /**
732   - * Validate date and times. Note that this method need the Date_Calc class
733   - *
734   - * @param string $date Date to validate
735   - * @param array $options array options where :
736   - * 'format' The format of the date (%d-%m-%Y)
737   - * or rfc822_compliant
738   - * 'min' The date has to be greater
739   - * than this array($day, $month, $year)
740   - * or PEAR::Date object
741   - * 'max' The date has to be smaller than
742   - * this array($day, $month, $year)
743   - * or PEAR::Date object
744   - *
745   - * @return boolean true if valid date/time, false if not
746   - *
747   - * @access public
748   - */
749   - function date($date, $options)
750   - {
751   - $max = false;
752   - $min = false;
753   - $format = '';
754   -
755   - if (is_array($options)) {
756   - extract($options);
757   - }
758   -
759   - if (strtolower($format) == 'rfc822_compliant') {
760   - $preg = '&^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),) \s+
761   - (?:(\d{2})?) \s+
762   - (?:(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)?) \s+
763   - (?:(\d{2}(\d{2})?)?) \s+
764   - (?:(\d{2}?)):(?:(\d{2}?))(:(?:(\d{2}?)))? \s+
765   - (?:[+-]\d{4}|UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Za-ik-z])$&xi';
766   -
767   - if (!preg_match($preg, $date, $matches)) {
768   - return false;
769   - }
770   -
771   - $year = (int)$matches[4];
772   - $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
773   - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
774   - $month = array_keys($months, $matches[3]);
775   - $month = (int)$month[0]+1;
776   - $day = (int)$matches[2];
777   - $weekday = $matches[1];
778   - $hour = (int)$matches[6];
779   - $minute = (int)$matches[7];
780   - isset($matches[9]) ? $second = (int)$matches[9] : $second = 0;
781   -
782   - if ((strlen($year) != 4) ||
783   - ($day > 31 || $day < 1)||
784   - ($hour > 23) ||
785   - ($minute > 59) ||
786   - ($second > 59)) {
787   - return false;
788   - }
789   - } else {
790   - $date_len = strlen($format);
791   - for ($i = 0; $i < $date_len; $i++) {
792   - $c = $format{$i};
793   - if ($c == '%') {
794   - $next = $format{$i + 1};
795   - switch ($next) {
796   - case 'j':
797   - case 'd':
798   - if ($next == 'j') {
799   - $day = (int)Validate::_substr($date, 1, 2);
800   - } else {
801   - $day = (int)Validate::_substr($date, 0, 2);
802   - }
803   - if ($day < 1 || $day > 31) {
804   - return false;
805   - }
806   - break;
807   - case 'm':
808   - case 'n':
809   - if ($next == 'm') {
810   - $month = (int)Validate::_substr($date, 0, 2);
811   - } else {
812   - $month = (int)Validate::_substr($date, 1, 2);
813   - }
814   - if ($month < 1 || $month > 12) {
815   - return false;
816   - }
817   - break;
818   - case 'Y':
819   - case 'y':
820   - if ($next == 'Y') {
821   - $year = Validate::_substr($date, 4);
822   - $year = (int)$year?$year:'';
823   - } else {
824   - $year = (int)(substr(date('Y'), 0, 2) .
825   - Validate::_substr($date, 2));
826   - }
827   - if (strlen($year) != 4 || $year < 0 || $year > 9999) {
828   - return false;
829   - }
830   - break;
831   - case 'g':
832   - case 'h':
833   - if ($next == 'g') {
834   - $hour = Validate::_substr($date, 1, 2);
835   - } else {
836   - $hour = Validate::_substr($date, 2);
837   - }
838   - if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 12) {
839   - return false;
840   - }
841   - break;
842   - case 'G':
843   - case 'H':
844   - if ($next == 'G') {
845   - $hour = Validate::_substr($date, 1, 2);
846   - } else {
847   - $hour = Validate::_substr($date, 2);
848   - }
849   - if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 24) {
850   - return false;
851   - }
852   - break;
853   - case 's':
854   - case 'i':
855   - $t = Validate::_substr($date, 2);
856   - if (!preg_match('/^\d+$/', $t) || $t < 0 || $t > 59) {
857   - return false;
858   - }
859   - break;
860   - default:
861   - trigger_error("Not supported char `$next' after % in offset " . ($i+2), E_USER_WARNING);
862   - }
863   - $i++;
864   - } else {
865   - //literal
866   - if (Validate::_substr($date, 1) != $c) {
867   - return false;
868   - }
869   - }
870   - }
871   - }
872   - // there is remaing data, we don't want it
873   - if (strlen($date) && (strtolower($format) != 'rfc822_compliant')) {
874   - return false;
875   - }
876   -
877   - if (isset($day) && isset($month) && isset($year)) {
878   - if (!checkdate($month, $day, $year)) {
879   - return false;
880   - }
881   -
882   - if (strtolower($format) == 'rfc822_compliant') {
883   - if ($weekday != date("D", mktime(0, 0, 0, $month, $day, $year))) {
884   - return false;
885   - }
886   - }
887   -
888   - if ($min) {
889   - include_once 'Date/Calc.php';
890   - if (is_a($min, 'Date') &&
891   - (Date_Calc::compareDates($day, $month, $year,
892   - $min->getDay(), $min->getMonth(), $min->getYear()) < 0)
893   - ) {
894   - return false;
895   - } elseif (is_array($min) &&
896   - (Date_Calc::compareDates($day, $month, $year,
897   - $min[0], $min[1], $min[2]) < 0)
898   - ) {
899   - return false;
900   - }
901   - }
902   -
903   - if ($max) {
904   - include_once 'Date/Calc.php';
905   - if (is_a($max, 'Date') &&
906   - (Date_Calc::compareDates($day, $month, $year,
907   - $max->getDay(), $max->getMonth(), $max->getYear()) > 0)
908   - ) {
909   - return false;
910   - } elseif (is_array($max) &&
911   - (Date_Calc::compareDates($day, $month, $year,
912   - $max[0], $max[1], $max[2]) > 0)
913   - ) {
914   - return false;
915   - }
916   - }
917   - }
918   -
919   - return true;
920   - }
921   -
922   - /**
923   - * Substr
924   - *
925   - * @param string &$date Date
926   - * @param string $num Length
927   - * @param string $opt Unknown
928   - *
929   - * @access private
930   - * @return string
931   - */
932   - function _substr(&$date, $num, $opt = false)
933   - {
934   - if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{'.$opt.'}/', $date, $m)) {
935   - $ret = $m[0];
936   - } else {
937   - $ret = substr($date, 0, $num);
938   - }
939   - $date = substr($date, strlen($ret));
940   - return $ret;
941   - }
942   -
943   - function _modf($val, $div)
944   - {
945   - if (function_exists('bcmod')) {
946   - return bcmod($val, $div);
947   - } elseif (function_exists('fmod')) {
948   - return fmod($val, $div);
949   - }
950   - $r = $val / $div;
951   - $i = intval($r);
952   - return intval($val - $i * $div + .1);
953   - }
954   -
955   - /**
956   - * Calculates sum of product of number digits with weights
957   - *
958   - * @param string $number number string
959   - * @param array $weights reference to array of weights
960   - *
961   - * @access protected
962   - *
963   - * @return int returns product of number digits with weights
964   - */
965   - function _multWeights($number, &$weights)
966   - {
967   - if (!is_array($weights)) {
968   - return -1;
969   - }
970   - $sum = 0;
971   -
972   - $count = min(count($weights), strlen($number));
973   - if ($count == 0) { // empty string or weights array
974   - return -1;
975   - }
976   - for ($i = 0; $i < $count; ++$i) {
977   - $sum += intval(substr($number, $i, 1)) * $weights[$i];
978   - }
979   -
980   - return $sum;
981   - }
982   -
983   - /**
984   - * Calculates control digit for a given number
985   - *
986   - * @param string $number number string
987   - * @param array $weights reference to array of weights
988   - * @param int $modulo (optionsl) number
989   - * @param int $subtract (optional) number
990   - * @param bool $allow_high (optional) true if function can return number higher than 10
991   - *
992   - * @access protected
993   - *
994   - * @return int -1 calculated control number is returned
995   - */
996   - function _getControlNumber($number, &$weights, $modulo = 10, $subtract = 0, $allow_high = false)
997   - {
998   - // calc sum
999   - $sum = Validate::_multWeights($number, $weights);
1000   - if ($sum == -1) {
1001   - return -1;
1002   - }
1003   - $mod = Validate::_modf($sum, $modulo); // calculate control digit
1004   -
1005   - if ($subtract > $mod && $mod > 0) {
1006   - $mod = $subtract - $mod;
1007   - }
1008   - if ($allow_high === false) {
1009   - $mod %= 10; // change 10 to zero
1010   - }
1011   - return $mod;
1012   - }
1013   -
1014   - /**
1015   - * Validates a number
1016   - *
1017   - * @param string $number number to validate
1018   - * @param array $weights reference to array of weights
1019   - * @param int $modulo (optional) number
1020   - * @param int $subtract (optional) number
1021   - *
1022   - * @access protected
1023   - *
1024   - * @return bool true if valid, false if not
1025   - */
1026   - function _checkControlNumber($number, &$weights, $modulo = 10, $subtract = 0)
1027   - {
1028   - if (strlen($number) < count($weights)) {
1029   - return false;
1030   - }
1031   - $target_digit = substr($number, count($weights), 1);
1032   - $control_digit = Validate::_getControlNumber($number, $weights, $modulo, $subtract, $modulo > 10);
1033   -
1034   - if ($control_digit == -1) {
1035   - return false;
1036   - }
1037   - if ($target_digit === 'X' && $control_digit == 10) {
1038   - return true;
1039   - }
1040   - if ($control_digit != $target_digit) {
1041   - return false;
1042   - }
1043   - return true;
1044   - }
1045   -
1046   - /**
1047   - * Bulk data validation for data introduced in the form of an
1048   - * assoc array in the form $var_name => $value.
1049   - * Can be used on any of Validate subpackages
1050   - *
1051   - * @param array $data Ex: array('name' => 'toto', 'email' => 'toto@thing.info');
1052   - * @param array $val_type Contains the validation type and all parameters used in.
1053   - * 'val_type' is not optional
1054   - * others validations properties must have the same name as the function
1055   - * parameters.
1056   - * Ex: array('toto'=>array('type'=>'string','format'='toto@thing.info','min_length'=>5));
1057   - * @param boolean $remove if set, the elements not listed in data will be removed
1058   - *
1059   - * @return array value name => true|false the value name comes from the data key
1060   - *
1061   - * @access public
1062   - */
1063   - function multiple(&$data, &$val_type, $remove = false)
1064   - {
1065   - $keys = array_keys($data);
1066   - $valid = array();
1067   -
1068   - foreach ($keys as $var_name) {
1069   - if (!isset($val_type[$var_name])) {
1070   - if ($remove) {
1071   - unset($data[$var_name]);
1072