本文整理汇总了PHP中CString::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP CString::isValid方法的具体用法?PHP CString::isValid怎么用?PHP CString::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
//.........这里部分代码省略.........
}
if (isset($this->m_intValidMin) && $value < $this->m_intValidMin || isset($this->m_intValidMax) && $value > $this->m_intValidMax) {
$success = false;
return $this->m_defaultValue;
}
if (isset($this->m_intClampingMin) && $value < $this->m_intClampingMin) {
$value = $this->m_intClampingMin;
}
if (isset($this->m_intClampingMax) && $value > $this->m_intClampingMax) {
$value = $this->m_intClampingMax;
}
return $value;
}
if ($this->m_expectedType == self::FLOAT) {
if (!CRegex::find($inputString, "/^-?(?!0(?!\\b))\\d*\\.?\\d+(e[\\-+]?\\d+)?\\z/i")) {
$success = false;
return $this->m_defaultValue;
}
$value = CString::toFloat($inputString);
if (isset($this->m_floatValidMin) && $value < $this->m_floatValidMin || isset($this->m_floatValidMax) && $value > $this->m_floatValidMax) {
$success = false;
return $this->m_defaultValue;
}
if (isset($this->m_floatClampingMin) && $value < $this->m_floatClampingMin) {
$value = $this->m_floatClampingMin;
}
if (isset($this->m_floatClampingMax) && $value > $this->m_floatClampingMax) {
$value = $this->m_floatClampingMax;
}
return $value;
}
if ($this->m_expectedType == self::CSTRING) {
$value = $inputString;
if (!CString::isValid($value)) {
$success = false;
return $this->m_defaultValue;
}
if (!$this->m_keepAbnormalNewlines) {
$value = CString::normNewlines($value);
}
if (!$this->m_keepNonPrintable) {
if (!$this->m_keepTabsAndNewlines) {
$value = CRegex::remove($value, "/[\\x00-\\x1F\\x7F-\\xFF]/");
} else {
$value = CRegex::remove($value, "/[\\x00-\\x1F\\x7F-\\xFF](?<![\\x09\\x0A\\x0D])/");
}
} else {
if (!$this->m_keepTabsAndNewlines) {
$value = CRegex::remove($value, "/[\\x09\\x0A\\x0D]/");
}
}
if (!$this->m_keepSideSpacing) {
$value = CString::trim($value);
}
if (!$this->m_keepExtraSpacing) {
$value = CString::normSpacing($value);
}
return $value;
}
if ($this->m_expectedType == self::CUSTRING) {
$value = $inputString;
if (!CUString::isValid($value)) {
$success = false;
return $this->m_defaultValue;
}
if (!$this->m_keepAbnormalNewlines) {