本文整理汇总了PHP中SanatiseStringToUnix函数的典型用法代码示例。如果您正苦于以下问题:PHP SanatiseStringToUnix函数的具体用法?PHP SanatiseStringToUnix怎么用?PHP SanatiseStringToUnix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SanatiseStringToUnix函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SanatiseStringToMac
/**
* Sanatise all line endings to '\r' Mac format
*
* Function will convert all line ending Mac format '\r'
*
* @access public
* @param string $str The string to convert all line endings to
* @return string The converted string
*/
function SanatiseStringToMac($str)
{
return str_replace("\n", "\r", SanatiseStringToUnix($str));
}
示例2: FormatWYSIWYGHTML
/**
* If the editor is disabled then we'll see if we need to run
* nl2br on the text if it doesn't contain any HTML tags
*/
public function FormatWYSIWYGHTML($HTML)
{
if (GetConfig('UseWYSIWYG')) {
return $HTML;
} else {
// We need to sanitise all the line feeds first to 'nl'
$HTML = SanatiseStringToUnix($HTML);
// Now we can use nl2br()
$HTML = nl2br($HTML);
// But we still need to strip out the new lines as nl2br doesn't really 'replace' the new lines, it just inserts <br />before it
$HTML = str_replace("\n", "", $HTML);
// Fix up new lines and block level elements.
$HTML = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\\s*<br />#i", "\$1", $HTML);
$HTML = preg_replace("#( )+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "\$2", $HTML);
return $HTML;
}
}