76 if(isset($this->type))
80 if(is_string($this->value))
95 $this->column_operation = $operation;
105 if(!isset($this->_value))
130 if($this->value ===
'null')
154 return '(' . implode(
',',
$value) .
')';
166 $column_type = $this->
getType();
167 if($column_type ==
'column_name')
170 return $dbParser->parseExpression(
$value);
177 $columnTypeList = array(
'date' => 1,
'varchar' => 1,
'char' => 1,
'text' => 1,
'bigtext' => 1);
178 if(isset($columnTypeList[$column_type]))
186 foreach(
$value as $key=>$val)
192 if($this->uses_default_value)
196 if($column_type ==
'number')
200 foreach(
$value AS $key => $val)
202 if(isset($val) && $val !==
'')
204 $value[$key] = (int) $val;
225 $regex =
'@((?:[\x00-\x7F]|[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}){1,100})|([\xF0-\xF7][\x80-\xBF]{3})|([\x80-\xBF])|([\xC0-\xFF])@x';
227 $value = preg_replace_callback($regex, array($this,
'utf8Replacer'),
$value);
230 return '\'' .
$value .
'\'';
235 if(strlen($captures[1]))
240 else if(strlen($captures[2]))
243 if(
"\xF3\xB0\x80\x80" <= $captures[2])
265 if(
$type ==
'column_name')
273 if(
$type ==
'number' && !is_numeric(
$value) && $this->uses_default_value)
287 if($this->value === NULL || $this->value ===
'')
289 $this->value = $default_value;
290 $this->uses_default_value = TRUE;
301 if(isset($this->value) && $this->value !=
'')
309 case 'email_address' :
310 if(!preg_match(
'/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val))
313 $this->errorMessage =
new BaseObject(-1, sprintf($lang->filter->invalid_email, $lang->{$key} ? $lang->{$key} : $key));
317 if(!preg_match(
'/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val))
320 $this->errorMessage =
new BaseObject(-1, sprintf(
$lang->filter->invalid_homepage,
$lang->{$key} ?
$lang->{$key} : $key));
325 if(!preg_match(
'/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val))
327 $this->isValid = FALSE;
335 $val = join(
',', $val);
337 if(!preg_match(
'/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val))
339 $this->isValid = FALSE;
344 if(!preg_match(
'/^[a-z]+$/is', $val))
346 $this->isValid = FALSE;
350 case 'alpha_number' :
351 if(!preg_match(
'/^[0-9a-z]+$/is', $val))
353 $this->isValid = FALSE;
354 $this->errorMessage =
new BaseObject(-1, sprintf(
$lang->filter->invalid_alpha_number,
$lang->{$key} ?
$lang->{$key} : $key));
363 if($this->value && (strlen($this->value) > $length))
366 $this->isValid = FALSE;
368 $this->errorMessage =
new BaseObject(-1, sprintf($lang->filter->outofrange, $lang->{$key} ?
$lang->{$key} : $key));
374 if($this->value && (strlen($this->value) < $length))
377 $this->isValid = FALSE;
379 $this->errorMessage =
new BaseObject(-1, sprintf($lang->filter->outofrange, $lang->{$key} ?
$lang->{$key} : $key));
385 if(!isset($this->value))
388 $this->isValid = FALSE;
390 $this->errorMessage =
new BaseObject(-1, sprintf($lang->filter->isnull, $lang->{$key} ?
$lang->{$key} : $key));
_escapeStringValue($value)
checkFilter($filter_type)
getInstance($db_type=NULL)
__construct($name, $value)
setColumnOperation($operation)
ensureDefaultValue($default_value)
if(isset($_REQUEST['encode'])) if(isset($_REQUEST['decode'])) $lang