elkarte/Elkarte — pull request #903 by Spuds (2013-10-16 12:45:59+00:00)
Title: Updates to the DataValidator.class.php

Blame @emanuele45 for this one :smile:

This adds some new functionality to the validation class, plus I found a couple off small errors / tweaks that I found.

This add the ability to validate each csv or array field against the parent validation/sanitation
````
$data[a] = '123,456,7890';
$validation->input_processing(array('a' => 'csv'); // need to hint the data to enable breakdown
$valid->validation_rules('a' => 'max_length[3]'); // one or many rules
$valid->sanitation_rules('a' => 'trim|strtoupper'); // however you want to clean it
$valid->validate($data); // this will return false since 7890 is > 3
````
Adds a new static method for quick inline or simple use
````
$_POST['username'] = ' itsme';
if (Data_Validator::is_valid($_POST, array('username' => 'required|alpha_numeric'), array('username' => 'trim|strtoupper'))) {do stuff}
```
This will fail and $_POST['username'] will now contain 'ITSME' (the sanitized value), this is different than the long version which leaves the original data untouched and gives access to the sanitized values.