| Next revision | Previous revision |
| scriptlog:lib:core:formvalidator [2026/09/26 09:09] – admin admin | scriptlog:lib:core:formvalidator [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Core Class | | | ''@category'' | Core Class | |
| | ''@author'' | SchizoDuckie | | | ''@author'' | SchizoDuckie | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@see'' | https://stackoverflow.com/questions/737385/easiest-form-validation-library-for-php#738510 | | | ''@see'' | https://stackoverflow.com/questions/737385/easiest-form-validation-library-for-php#738510 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| //None.// | //None.// |
| |
| ======= Properties (1) ======= | ======= Properties (8) ======= |
| |
| ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | ''public static'' | ''static'' | ''$regexes'' | ''array( 'date' => "^[0-9]{4}[-/][0-9]{1,2}[-/][0-9]{1,2}\$",…'' | 20 | | | ''public static'' | ''static'' | ''$regexes'' | ''array( 'date' => "^[0-9]{4}[-/][0-9]{1,2}[-/][0-9]{1,2}\$",…'' | 20 | |
| | | ''private'' | ''(untyped)'' | ''$validations'' | | 37 | |
| | | ''private'' | ''(untyped)'' | ''$sanitations'' | | 39 | |
| | | ''private'' | ''(untyped)'' | ''$mandatories'' | | 41 | |
| | | ''private'' | ''(untyped)'' | ''$equal'' | | 43 | |
| | | ''private'' | ''(untyped)'' | ''$errors'' | | 45 | |
| | | ''private'' | ''(untyped)'' | ''$corrects'' | | 47 | |
| | | ''protected'' | ''(untyped)'' | ''$fields'' | | 49 | |
| |
| ======= Methods (7) ======= | ======= Methods (7) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | (undocumented) | 51 | | | public | ''__construct()'' | (undocumented) | 51 | |
| | public | ''validate()'' | Validates an array of items (if needed) and returns true or false | 68 | | | public | ''validate()'' | Validates an array of items (if needed) and returns true or false | 68 | |
| | public | ''getJSON()'' | (undocumented) | 126 | | | public | ''getJSON()'' | (undocumented) | 126 | |
| | public | ''sanitize()'' | Sanatizes an array of items according to the $this->sanitations | 159 | | | public | ''sanitize()'' | Sanatizes an array of items according to the $this->sanitations | 159 | |
| | private | ''addError()'' | Adds an error to the errors array. | 177 | | | private | ''addError()'' | Adds an error to the errors array. | 177 | |
| | private static | ''sanitizeItem()'' | Sanatize a single var according to $type. | 187 | | | private static | ''sanitizeItem()'' | Sanatize a single var according to $type. | 187 | |
| | public static | ''validateItem()'' | Validates a single var according to $type. | 223 | | | public static | ''validateItem()'' | Validates a single var according to $type. | 223 | |
| |
| |
| //lines 51–59 (9)// | //lines 51–59 (9)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$validations'' | ''(untyped)'' | ''array()'' | //none// | | | ''$validations'' | ''(untyped)'' | ''array()'' | //none// | |
| | ''$mandatories'' | ''(untyped)'' | ''array()'' | //none// | | | ''$mandatories'' | ''(untyped)'' | ''array()'' | //none// | |
| | ''$sanitations'' | ''(untyped)'' | ''array()'' | //none// | | | ''$sanitations'' | ''(untyped)'' | ''array()'' | //none// | |
| | ''$equal'' | ''(untyped)'' | ''array()'' | //none// | | | ''$equal'' | ''(untyped)'' | ''array()'' | //none// | |
| |
| |
| Also the types of non mandatory fields were not checked. | Also the types of non mandatory fields were not checked. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$items'' | ''(untyped)'' | //required// | //none// | | | ''$items'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| $sanitations = array('fieldname', 'otherfieldname'=>'float'); | $sanitations = array('fieldname', 'otherfieldname'=>'float'); |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$items'' | ''(untyped)'' | //required// | //none// | | | ''$items'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Adds an error to the errors array. | Adds an error to the errors array. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$field'' | ''(untyped)'' | //required// | //none// | | | ''$field'' | ''(untyped)'' | //required// | //none// | |
| | ''$type'' | ''(untyped)'' | '''string''' | //none// | | | ''$type'' | ''(untyped)'' | '''string''' | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Allows for static calling to allow simple sanatization | Allows for static calling to allow simple sanatization |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$var'' | ''(untyped)'' | //required// | //none// | | | ''$var'' | ''(untyped)'' | //required// | //none// | |
| | ''$type'' | ''(untyped)'' | //required// | //none// | | | ''$type'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Allows for static calling to allow simple validation. | Allows for static calling to allow simple validation. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$var'' | ''(untyped)'' | //required// | //none// | | | ''$var'' | ''(untyped)'' | //required// | //none// | |
| | ''$type'' | ''(untyped)'' | //required// | //none// | | | ''$type'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |