<?php
/**
* This simple class adds/strips slashes recursively
*
* It can be easily extracted from class into the global functions
*/
class voidrslashes
{
function add($array)
{
$ret = array();
foreach ($array as $key => $value)
{
if (is_array($value))
{
$ret[$key] = array_merge($ret[$key], $this->add($value));
continue;
}
$ret[$key] = addslashes($value);
}
return $ret;
}
function strip($array)
{
$ret = array();
foreach ($array as $key => $value)
{
if (is_array($value))
{
$ret[$key] = array_merge($ret[$key], $this->strip($value));
continue;
}
$ret[$key] = stripslashes($value);
}
return $ret;
}
}
?>
|