本文整理匯總了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) {