phplibrary/core/safecollection.php
Фёдор Подлеснов 651a841187 Удалил json.php
2016-07-21 14:17:03 +03:00

35 lines
721 B
PHP

<?php
require_once 'core/collection.php';
class SafeCollection extends Collection
{
protected function _clean()
{
if(get_magic_quotes_gpc()) {
$this->data = $this->_stripSlashes($this->data);
}
$this->data = $this->data;
}
function import(array $data)
{
parent::import($data);
$this->_clean();
}
/**
* Strip slashes code from php.net website.
*
* @param mixed $value
* @return array
*/
protected function _stripSlashes($value)
{
if(is_array($value)) {
return array_map(array($this,'_stripSlashes'), $value);
} else {
return stripslashes($value);
}
}
}