public static function cleanArgument($arg_value, $flags = ENT_COMPAT, $encoding = 'UTF-8') 
    {
        if (is_string($arg_value)) {
            $result = stripslashes( htmlspecialchars($arg_value, ENT_COMPAT, $encoding) );
        } elseif (is_array($arg_value)) {
            $result = array();
            foreach($arg_value as $arg=>$value) {
                $result[$arg] = self::cleanArgument($value, $flags, $encoding);
            }
        }
        return $result;
    }