本文整理匯總了PHP中IPSText::postParseCleanValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::postParseCleanValue方法的具體用法?PHP IPSText::postParseCleanValue怎麽用?PHP IPSText::postParseCleanValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::postParseCleanValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseCleanValue
/**
* Clean _GET _POST value
*
* @access public
* @param string Input
* @param bool Also run postParseCleanValue
* @return string Cleaned Input
* @since 2.1
*/
public static function parseCleanValue($val, $postParse = true)
{
if ($val == "") {
return "";
}
$val = str_replace(" ", " ", IPSText::stripslashes($val));
# Convert all carriage return combos
$val = str_replace(array("\r\n", "\n\r", "\r"), "\n", $val);
$val = str_replace("&", "&", $val);
$val = str_replace("<!--", "<!--", $val);
$val = str_replace("-->", "-->", $val);
$val = str_ireplace("<script", "<script", $val);
$val = str_replace(">", ">", $val);
$val = str_replace("<", "<", $val);
$val = str_replace('"', """, $val);
$val = str_replace("\n", "<br />", $val);
// Convert literal newlines
$val = str_replace("\$", "$", $val);
$val = str_replace("!", "!", $val);
$val = str_replace("'", "'", $val);
// IMPORTANT: It helps to increase sql query safety.
if (IPS_ALLOW_UNICODE) {
$val = preg_replace("/&#([0-9]+);/s", "&#\\1;", $val);
//-----------------------------------------
// Try and fix up HTML entities with missing ;
//-----------------------------------------
$val = preg_replace("/&#(\\d+?)([^\\d;])/i", "&#\\1;\\2", $val);
}
//-----------------------------------------
// Shortcut to auto run other cleaning
//-----------------------------------------
if ($postParse) {
$val = IPSText::postParseCleanValue($val);
}
return $val;
}