Zend_Validate-Messages.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.validate.messages">
  4. <title>Validation Messages</title>
  5. <para>
  6. Each validator which is based on <classname>Zend_Validate</classname> provides
  7. one or multiple messages in the case of a failed validation. You can use
  8. this information for setting own messages or when you have to translate
  9. the messages a validator can return. The following table lists all
  10. available messages which are returned by each validator.
  11. </para>
  12. <table id="zend.validate.messages.table">
  13. <title>Available Validation Messages</title>
  14. <tgroup cols="4">
  15. <thead>
  16. <row>
  17. <entry>Validator</entry>
  18. <entry>Constant</entry>
  19. <entry>Message</entry>
  20. </row>
  21. </thead>
  22. <tbody>
  23. <row>
  24. <entry morerows="1" valign="middle">Alnum</entry>
  25. <entry>NOT_ALNUM</entry>
  26. <entry>'%value%' has not only alphabetic and digit characters</entry>
  27. </row>
  28. <row>
  29. <entry>STRING_EMPTY</entry>
  30. <entry>'%value%' is an empty string</entry>
  31. </row>
  32. <row>
  33. <entry morerows="1" valign="middle">Alpha</entry>
  34. <entry>NOT_ALPHA</entry>
  35. <entry>'%value%' has not only alphabetic characters</entry>
  36. </row>
  37. <row>
  38. <entry>STRING_EMPTY</entry>
  39. <entry>'%value%' is an empty string</entry>
  40. </row>
  41. <row>
  42. <entry>Barcode</entry>
  43. <entry>---</entry>
  44. <entry>messages are thrown by a subclass</entry>
  45. </row>
  46. <row>
  47. <entry morerows="2" valign="middle">Barcode_Ean13</entry>
  48. <entry>INVALID</entry>
  49. <entry>'%value%' is an invalid EAN-13 barcode</entry>
  50. </row>
  51. <row>
  52. <entry>INVALID_LENGTH</entry>
  53. <entry>'%value%' should be 13 characters</entry>
  54. </row>
  55. <row>
  56. <entry>NOT_NUMERIC</entry>
  57. <entry>'%value%' should contain only numeric characters</entry>
  58. </row>
  59. <row>
  60. <entry morerows="1" valign="middle">Barcode_UpcA</entry>
  61. <entry>INVALID</entry>
  62. <entry>'%value%' is an invalid UPC-A barcode</entry>
  63. </row>
  64. <row>
  65. <entry>INVALID_LENGTH</entry>
  66. <entry>'%value%' should be 12 characters</entry>
  67. </row>
  68. <row>
  69. <entry morerows="1" valign="middle">Between</entry>
  70. <entry>NOT_BETWEEN</entry>
  71. <entry>'%value%' is not between '%min%' and '%max%', inclusively</entry>
  72. </row>
  73. <row>
  74. <entry>NOT_BETWEEN_STRICT</entry>
  75. <entry>'%value%' is not strictly between '%min%' and '%max%'</entry>
  76. </row>
  77. <row>
  78. <entry morerows="1" valign="middle">Ccnum</entry>
  79. <entry>LENGTH</entry>
  80. <entry>'%value%' must contain between 13 and 19 digits</entry>
  81. </row>
  82. <row>
  83. <entry>CHECKSUM</entry>
  84. <entry>Luhn algorithm (mod-10 checksum) failed on '%value%'</entry>
  85. </row>
  86. <row>
  87. <entry morerows="2" valign="middle">Date</entry>
  88. <entry>FALSEFORMAT</entry>
  89. <entry>'%value%' does not fit given date format</entry>
  90. </row>
  91. <row>
  92. <entry>INVALID</entry>
  93. <entry>'%value%' does not appear to be a valid date</entry>
  94. </row>
  95. <row>
  96. <entry>NOT_YYYY_MM_DD</entry>
  97. <entry>'%value%' is not of the format YYYY-MM-DD</entry>
  98. </row>
  99. <row>
  100. <entry morerows="1" valign="middle">Db_Abstract</entry>
  101. <entry>ERROR_NO_RECORD_FOUND</entry>
  102. <entry>No record matching %value% was found</entry>
  103. </row>
  104. <row>
  105. <entry>ERROR_RECORD_FOUND</entry>
  106. <entry>A record matching %value% was found</entry>
  107. </row>
  108. <row>
  109. <entry morerows="1" valign="middle">Digits</entry>
  110. <entry>NOT_DIGITS</entry>
  111. <entry>'%value%' contains not only digit characters</entry>
  112. </row>
  113. <row>
  114. <entry>STRING_EMPTY</entry>
  115. <entry>'%value%' is an empty string</entry>
  116. </row>
  117. <row>
  118. <entry morerows="7" valign="middle">EmailAddress</entry>
  119. <entry>INVALID</entry>
  120. <entry>
  121. '%value%' is not a valid email address in the basic format
  122. local-part@hostname
  123. </entry>
  124. </row>
  125. <row>
  126. <entry>INVALID_FORMAT</entry>
  127. <entry>'%value%' is not a valid email address in the basic format local-part@hostname</entry>
  128. </row>
  129. <row>
  130. <entry>INVALID_HOSTNAME</entry>
  131. <entry>'%hostname%' is not a valid hostname for email address '%value%'</entry>
  132. </row>
  133. <row>
  134. <entry>INVALID_MX_RECORD</entry>
  135. <entry>
  136. '%hostname%' does not appear to have a valid MX record for the email address
  137. '%value%'
  138. </entry>
  139. </row>
  140. <row>
  141. <entry>DOT_ATOM</entry>
  142. <entry>'%localPart%' not matched against dot-atom format</entry>
  143. </row>
  144. <row>
  145. <entry>QUOTED_STRING</entry>
  146. <entry>'%localPart%' not matched against quoted-string format</entry>
  147. </row>
  148. <row>
  149. <entry>INVALID_LOCAL_PART</entry>
  150. <entry>
  151. '%localPart%' is not a valid local part for email address '%value%'
  152. </entry>
  153. </row>
  154. <row>
  155. <entry>LENGTH_EXCEEDED</entry>
  156. <entry>'%value%' exceeds the allowed length</entry>
  157. </row>
  158. <row>
  159. <entry morerows="1" valign="middle">File_Count</entry>
  160. <entry>TOO_MUCH</entry>
  161. <entry>
  162. Too much files, maximum '%max%' are allowed but '%count%' are given
  163. </entry>
  164. </row>
  165. <row>
  166. <entry>TOO_LESS</entry>
  167. <entry>
  168. Too less files, minimum '%min%' are expected but '%count%' are given
  169. </entry>
  170. </row>
  171. <row>
  172. <entry morerows="2" valign="middle">File_Crc32</entry>
  173. <entry>DOES_NOT_MATCH</entry>
  174. <entry>The file '%value%' does not match the given crc32 hashes</entry>
  175. </row>
  176. <row>
  177. <entry>NOT_DETECTED</entry>
  178. <entry>There was no crc32 hash detected for the given file</entry>
  179. </row>
  180. <row>
  181. <entry>NOT_FOUND</entry>
  182. <entry>The file '%value%' could not be found</entry>
  183. </row>
  184. <row>
  185. <entry morerows="1" valign="middle">File_ExcludeExtension</entry>
  186. <entry>FALSE_EXTENSION</entry>
  187. <entry>The file '%value%' has a false extension</entry>
  188. </row>
  189. <row>
  190. <entry>NOT_FOUND</entry>
  191. <entry>The file '%value%' was not found</entry>
  192. </row>
  193. <row>
  194. <entry morerows="2" valign="middle">File_ExcludeMimeType</entry>
  195. <entry>FALSE_TYPE</entry>
  196. <entry>The file '%value%' has a false mimetype of '%type%'</entry>
  197. </row>
  198. <row>
  199. <entry>NOT_DETECTED</entry>
  200. <entry>The mimetype of file '%value%' could not been detected</entry>
  201. </row>
  202. <row>
  203. <entry>NOT_READABLE</entry>
  204. <entry>The file '%value%' can not be read</entry>
  205. </row>
  206. <row>
  207. <entry morerows="2" valign="middle">File_Exists</entry>
  208. <entry>DOES_NOT_EXIST</entry>
  209. <entry>The file '%value%' does not exist</entry>
  210. </row>
  211. <row>
  212. <entry morerows="1" valign="middle">File_Extension</entry>
  213. <entry>FALSE_EXTENSION</entry>
  214. <entry>The file '%value%' has a false extension</entry>
  215. </row>
  216. <row>
  217. <entry>NOT_FOUND</entry>
  218. <entry>The file '%value%' was not found</entry>
  219. </row>
  220. <row>
  221. <entry morerows="2" valign="middle">File_FilesSize</entry>
  222. <entry>TOO_BIG</entry>
  223. <entry>
  224. All files in sum should have a maximum size of '%max%' but '%size%' were
  225. detected
  226. </entry>
  227. </row>
  228. <row>
  229. <entry>TOO_SMALL</entry>
  230. <entry>
  231. All files in sum should have a minimum size of '%min%' but '%size%' were
  232. detected
  233. </entry>
  234. </row>
  235. <row>
  236. <entry>NOT_READABLE</entry>
  237. <entry>One or more files can not be read</entry>
  238. </row>
  239. <row>
  240. <entry morerows="2" valign="middle">File_Hash</entry>
  241. <entry>DOES_NOT_MATCH</entry>
  242. <entry>The file '%value%' does not match the given hashes</entry>
  243. </row>
  244. <row>
  245. <entry>NOT_DETECTED</entry>
  246. <entry>There was no hash detected for the given file</entry>
  247. </row>
  248. <row>
  249. <entry>NOT_FOUND</entry>
  250. <entry>The file '%value%' could not be found</entry>
  251. </row>
  252. <row>
  253. <entry morerows="5" valign="middle">File_ImageSize</entry>
  254. <entry>WIDTH_TOO_BIG</entry>
  255. <entry>
  256. Maximum allowed width for image '%value%' should be '%maxwidth%' but
  257. '%width%' detected
  258. </entry>
  259. </row>
  260. <row>
  261. <entry>WIDTH_TOO_SMALL</entry>
  262. <entry>
  263. Minimum expected width for image '%value%' should be '%minwidth%' but
  264. '%width%' detected
  265. </entry>
  266. </row>
  267. <row>
  268. <entry>HEIGHT_TOO_BIG</entry>
  269. <entry>
  270. Maximum allowed height for image '%value%' should be '%maxheight%' but
  271. '%height%' detected
  272. </entry>
  273. </row>
  274. <row>
  275. <entry>HEIGHT_TOO_SMALL</entry>
  276. <entry>
  277. Minimum expected height for image '%value%' should be '%minheight%' but
  278. '%height%' detected
  279. </entry>
  280. </row>
  281. <row>
  282. <entry>NOT_DETECTED</entry>
  283. <entry>The size of image '%value%' could not be detected</entry>
  284. </row>
  285. <row>
  286. <entry>NOT_READABLE</entry>
  287. <entry>The image '%value%' can not be read</entry>
  288. </row>
  289. <row>
  290. <entry morerows="2" valign="middle">File_IsCompressed</entry>
  291. <entry>FALSE_TYPE</entry>
  292. <entry>The file '%value%' is not compressed, '%type%' detected</entry>
  293. </row>
  294. <row>
  295. <entry>NOT_DETECTED</entry>
  296. <entry>The mimetype of file '%value%' could not been detected</entry>
  297. </row>
  298. <row>
  299. <entry>NOT_READABLE</entry>
  300. <entry>The file '%value%' can not be read</entry>
  301. </row>
  302. <row>
  303. <entry morerows="2" valign="middle">File_IsImage</entry>
  304. <entry>FALSE_TYPE</entry>
  305. <entry>The file '%value%' is no image, '%type%' detected</entry>
  306. </row>
  307. <row>
  308. <entry>NOT_DETECTED</entry>
  309. <entry>The mimetype of file '%value%' could not been detected</entry>
  310. </row>
  311. <row>
  312. <entry>NOT_READABLE</entry>
  313. <entry>The file '%value%' can not be read</entry>
  314. </row>
  315. <row>
  316. <entry morerows="2" valign="middle">File_Md5</entry>
  317. <entry>DOES_NOT_MATCH</entry>
  318. <entry>The file '%value%' does not match the given md5 hashes</entry>
  319. </row>
  320. <row>
  321. <entry>NOT_DETECTED</entry>
  322. <entry>There was no md5 hash detected for the given file</entry>
  323. </row>
  324. <row>
  325. <entry>NOT_FOUND</entry>
  326. <entry>The file '%value%' could not be found</entry>
  327. </row>
  328. <row>
  329. <entry morerows="2" valign="middle">File_MimeType</entry>
  330. <entry>FALSE_TYPE</entry>
  331. <entry>The file '%value%' has a false mimetype of '%type%'</entry>
  332. </row>
  333. <row>
  334. <entry>NOT_DETECTED</entry>
  335. <entry>The mimetype of file '%value%' could not been detected</entry>
  336. </row>
  337. <row>
  338. <entry>NOT_READABLE</entry>
  339. <entry>The file '%value%' can not be read</entry>
  340. </row>
  341. <row>
  342. <entry>File_NotExists</entry>
  343. <entry>DOES_EXIST</entry>
  344. <entry>The file '%value%' does exist</entry>
  345. </row>
  346. <row>
  347. <entry morerows="2" valign="middle">File_Sha1</entry>
  348. <entry>DOES_NOT_MATCH</entry>
  349. <entry>The file '%value%' does not match the given sha1 hashes</entry>
  350. </row>
  351. <row>
  352. <entry>NOT_DETECTED</entry>
  353. <entry>There was no sha1 hash detected for the given file</entry>
  354. </row>
  355. <row>
  356. <entry>NOT_FOUND</entry>
  357. <entry>The file '%value%' could not be found</entry>
  358. </row>
  359. <row>
  360. <entry morerows="2" valign="middle">File_Size</entry>
  361. <entry>TOO_BIG</entry>
  362. <entry>
  363. Maximum allowed size for file '%value%' is '%max%' but '%size%' detected
  364. </entry>
  365. </row>
  366. <row>
  367. <entry>TOO_SMALL</entry>
  368. <entry>
  369. Minimum expected size for file '%value%' is '%min%' but '%size%' detected
  370. </entry>
  371. </row>
  372. <row>
  373. <entry>NOT_FOUND</entry>
  374. <entry>The file '%value%' could not be found</entry>
  375. </row>
  376. <row>
  377. <entry morerows="9" valign="middle">File_Upload</entry>
  378. <entry>INI_SIZE</entry>
  379. <entry>The file '%value%' exceeds the defined ini size</entry>
  380. </row>
  381. <row>
  382. <entry>FORM_SIZE</entry>
  383. <entry>The file '%value%' exceeds the defined form size</entry>
  384. </row>
  385. <row>
  386. <entry>PARTIAL</entry>
  387. <entry>The file '%value%' was only partially uploaded</entry>
  388. </row>
  389. <row>
  390. <entry>NO_FILE</entry>
  391. <entry>The file '%value%' was not uploaded</entry>
  392. </row>
  393. <row>
  394. <entry>NO_TMP_DIR</entry>
  395. <entry>No temporary directory was found for the file '%value%'</entry>
  396. </row>
  397. <row>
  398. <entry>CANT_WRITE</entry>
  399. <entry>The file '%value%' can't be written</entry>
  400. </row>
  401. <row>
  402. <entry>EXTENSION</entry>
  403. <entry>
  404. The extension returned an error while uploading the file '%value%'
  405. </entry>
  406. </row>
  407. <row>
  408. <entry>ATTACK</entry>
  409. <entry>The file '%value%' was illegal uploaded, possible attack</entry>
  410. </row>
  411. <row>
  412. <entry>FILE_NOT_FOUND</entry>
  413. <entry>The file '%value%' was not found</entry>
  414. </row>
  415. <row>
  416. <entry>UNKNOWN</entry>
  417. <entry>Unknown error while uploading the file '%value%'</entry>
  418. </row>
  419. <row>
  420. <entry morerows="2" valign="middle">File_WordCount</entry>
  421. <entry>TOO_MUCH</entry>
  422. <entry>
  423. Too much words, maximum '%max%' are allowed but '%count%' were counted
  424. </entry>
  425. </row>
  426. <row>
  427. <entry>TOO_LESS</entry>
  428. <entry>
  429. Too less words, minimum '%min%' are expected but '%count%' were counted
  430. </entry>
  431. </row>
  432. <row>
  433. <entry>NOT_FOUND</entry>
  434. <entry>The file '%value%' could not be found</entry>
  435. </row>
  436. <row>
  437. <entry>Float</entry>
  438. <entry>NOT_FLOAT</entry>
  439. <entry>'%value%' does not appear to be a float</entry>
  440. </row>
  441. <row>
  442. <entry>GreaterThan</entry>
  443. <entry>NOT_GREATER</entry>
  444. <entry>'%value%' is not greater than '%min%'</entry>
  445. </row>
  446. <row>
  447. <entry>Hex</entry>
  448. <entry>NOT_HEX</entry>
  449. <entry>'%value%' has not only hexadecimal digit characters</entry>
  450. </row>
  451. <row>
  452. <entry morerows="7" valign="middle">Hostname</entry>
  453. <entry>IP_ADDRESS_NOT_ALLOWED</entry>
  454. <entry>
  455. '%value%' appears to be an IP address, but IP addresses are not allowed
  456. </entry>
  457. </row>
  458. <row>
  459. <entry>UNKNOWN_TLD</entry>
  460. <entry>
  461. '%value%' appears to be a DNS hostname but cannot match TLD against known
  462. list
  463. </entry>
  464. </row>
  465. <row>
  466. <entry>INVALID_DASH</entry>
  467. <entry>
  468. '%value%' appears to be a DNS hostname but contains a dash (-) in an invalid
  469. position
  470. </entry>
  471. </row>
  472. <row>
  473. <entry>INVALID_HOSTNAME_SCHEMA</entry>
  474. <entry>
  475. '%value%' appears to be a DNS hostname but cannot match against hostname
  476. schema for TLD '%tld%'
  477. </entry>
  478. </row>
  479. <row>
  480. <entry>UNDECIPHERABLE_TLD</entry>
  481. <entry>
  482. '%value%' appears to be a DNS hostname but cannot extract TLD part
  483. </entry>
  484. </row>
  485. <row>
  486. <entry>INVALID_HOSTNAME</entry>
  487. <entry>
  488. '%value%' does not match the expected structure for a DNS hostname
  489. </entry>
  490. </row>
  491. <row>
  492. <entry>INVALID_LOCAL_NAME</entry>
  493. <entry>'%value%' does not appear to be a valid local network name</entry>
  494. </row>
  495. <row>
  496. <entry>LOCAL_NAME_NOT_ALLOWED</entry>
  497. <entry>
  498. '%value%' appears to be a local network name but local network names are not
  499. allowed
  500. </entry>
  501. </row>
  502. <row>
  503. <entry morerows="2" valign="middle">Iban</entry>
  504. <entry>NOTSUPPORTED</entry>
  505. <entry>'%value%' does not have IBAN</entry>
  506. </row>
  507. <row>
  508. <entry>FALSEFORMAT</entry>
  509. <entry>'%value%' has a false format</entry>
  510. </row>
  511. <row>
  512. <entry>CHECKFAILED</entry>
  513. <entry>'%value%' has failed the IBAN check</entry>
  514. </row>
  515. <row>
  516. <entry morerows="1" valign="middle">Identical</entry>
  517. <entry>NOT_SAME</entry>
  518. <entry>The token '%token%' does not match the given token '%value%'</entry>
  519. </row>
  520. <row>
  521. <entry>MISSING_TOKEN</entry>
  522. <entry>No token was provided to match against</entry>
  523. </row>
  524. <row>
  525. <entry>InArray</entry>
  526. <entry>NOT_IN_ARRAY</entry>
  527. <entry>'%value%' was not found in the haystack</entry>
  528. </row>
  529. <row>
  530. <entry>Int</entry>
  531. <entry>NOT_INT</entry>
  532. <entry>'%value%' does not appear to be an integer</entry>
  533. </row>
  534. <row>
  535. <entry>Ip</entry>
  536. <entry>NOT_IP_ADDRESS</entry>
  537. <entry>'%value%' does not appear to be a valid IP address</entry>
  538. </row>
  539. <row>
  540. <entry>LessThan</entry>
  541. <entry>NOT_LESS</entry>
  542. <entry>'%value%' is not less than '%max%'</entry>
  543. </row>
  544. <row>
  545. <entry>NotEmpty</entry>
  546. <entry>IS_EMPTY</entry>
  547. <entry>Value is required and can't be empty</entry>
  548. </row>
  549. <row>
  550. <entry>Regex</entry>
  551. <entry>NOT_MATCH</entry>
  552. <entry>'%value%' does not match against pattern '%pattern%'</entry>
  553. </row>
  554. <row>
  555. <entry morerows="1" valign="middle">StringLength</entry>
  556. <entry>TOO_SHORT</entry>
  557. <entry>'%value%' is less than %min% characters long</entry>
  558. </row>
  559. <row>
  560. <entry>TOO_LONG</entry>
  561. <entry>'%value%' is greater than %max% characters long</entry>
  562. </row>
  563. </tbody>
  564. </tgroup>
  565. </table>
  566. <para>
  567. Additionally you can retrieve all message templates of a validator with
  568. the method <code>getMessageTemplates()</code>. It returns you an array
  569. with the messages a validator could return in the case of a failed validation.
  570. </para>
  571. <programlisting language="php"><![CDATA[
  572. $validator = new Zend_Validate_Alnum();
  573. $messages = $validator->getMessageTemplates();
  574. ]]></programlisting>
  575. <sect2 id="zend.validate.messages.limitation">
  576. <title>Limit the size of a validation message</title>
  577. <para>
  578. Sometimes it is necessary to limit the maximum size a validation message can have.
  579. For example when your view allows a maximum size of 100 chars to be rendered on one
  580. line. To simplify the usage, <classname>Zend_Validate</classname> is able to
  581. automatically limit the maximum returned size of a validation message.
  582. </para>
  583. <para>
  584. To get the actual set size use
  585. <methodname>Zend_Validate::getMessageLength()</methodname>. If it is -1, then the
  586. returned message will not be truncated. This is default behaviour.
  587. </para>
  588. <para>
  589. To limit the returned message size use
  590. <methodname>Zend_Validate::setMessageLength()</methodname>. Set it to any integer size
  591. you need. When the returned message exceeds the set size, then the message
  592. will be truncated and the string '<emphasis>...</emphasis>' will be added instead of
  593. the rest of the message.
  594. </para>
  595. <programlisting language="php"><![CDATA[
  596. Zend_Validate::setMessageLength(100);
  597. ]]></programlisting>
  598. <note>
  599. <para>
  600. Note that the set message length is used for all validators, even for self defined ones
  601. as long as they extend <classname>Zend_Validate_Abstract</classname>.
  602. </para>
  603. </note>
  604. </sect2>
  605. </sect1>
  606. <!--
  607. vim:se ts=4 sw=4 et:
  608. -->