/** * Protect a array of strings from possible hacker (i.e. escape possible harmfull chars) * (this has been moved from PHPDS_query) * @version 1.1 * @date 20111010 (v1.1) (greg) added "quote" parameter * @author greg * @param $a array, the strings to protect * @param $quote string, the quotes to add to each non-numerical scalar value * @return array, the same string but safe */ public function protectArray(array $a, $quote = '') { foreach ($a as $index => $value) { $v = null; if (is_array($value)) { $v = $this->protectArray($value); } if (is_scalar($value)) { $v = $this->connector->protect($value); if (!is_numeric($v) && $quote) { $v = $quote . $v . $quote; } } if (!empty($v)) { $a[$index] = $v; } } return $a; }