* change stripTags param.

This commit is contained in:
zhujinyong
2012-07-14 05:22:35 +00:00
parent 23860f35b0
commit e804d246ac
+34 -33
View File
@@ -4,15 +4,15 @@
*
* The author disclaims copyright to this source code. In place of
* a legal notice, here is a blessing:
*
*
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
*/
/**
* The valida clas, checking datas by rules.
*
* The valida class, checking datas by rules.
*
* @package framework
*/
class validater
@@ -229,34 +229,6 @@ class validater
return $var == $value;
}
/**
* Must greater than a value.
*
* @param mixed $var
* @param mixed $value
* @static
* @access public
* @return bool
*/
public static function checkGT($var, $value)
{
return $var > $value;
}
/**
* Must greater than or equal a value.
*
* @param mixed $var
* @param mixed $value
* @static
* @access public
* @return bool
*/
public static function checkGE($var, $value)
{
return $var >= $value;
}
/**
* Call a function to check it.
*
@@ -425,17 +397,46 @@ class fixer
return $this;
}
/**
* Must greater than a value.
*
* @param mixed $var
* @param mixed $value
* @static
* @access public
* @return bool
*/
public static function checkGT($var, $value)
{
return $var > $value;
}
/**
* Must greater than or equal a value.
*
* @param mixed $var
* @param mixed $value
* @static
* @access public
* @return bool
*/
public static function checkGE($var, $value)
{
return $var >= $value;
}
/**
* Strip tags
*
* @param string $fieldName
* @param string $allowableTags
* @access public
* @return object fixer object
*/
public function stripTags($fieldName)
public function stripTags($fieldName, $allowableTags = FILTER_SANITIZE_STRING)
{
$fields = $this->processFields($fieldName);
foreach($fields as $fieldName) $this->data->$fieldName = filter_var($this->data->$fieldName, FILTER_SANITIZE_STRING);
foreach($fields as $fieldName) $this->data->$fieldName = strip_tags($this->data->$fieldName, $allowableTags);
return $this;
}