本文整理汇总了PHP中TextCleaner::formQuote方法的典型用法代码示例。如果您正苦于以下问题:PHP TextCleaner::formQuote方法的具体用法?PHP TextCleaner::formQuote怎么用?PHP TextCleaner::formQuote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextCleaner
的用法示例。
在下文中一共展示了TextCleaner::formQuote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: codeDecode
/**
* Replace EXMCodes with their equivalent HTML formatting
*
* @param string $text
* @param bool $allowimage Allow images in the text?
* On FALSE, uses links to images.
* @return string
**/
public function codeDecode($text, $allowimage = 1)
{
$patterns = array();
$replacements = array();
//$patterns[] = "/\[code](.*)\[\/code\]/esU";
//$replacements[] = "'<div class=\"exmCode\"><code><pre>'.wordwrap(MyTextSanitizer::htmlSpecialChars('\\1'), 100).'</pre></code></div>'";
// RMV: added new markup for intrasite url (allows easier site moves)
// TODO: automatically convert other URLs to this format if XOOPS_ROOT_PATH matches??
$patterns['patterns'][] = "/\\[siteurl=(['\"]?)([^\"'<>]*)\\1](.*)\\[\\/siteurl\\]/sU";
$patterns['replacements'][] = '<a href="' . XOOPS_ROOT_PATH . '/\\2">\\3</a>';
$patterns['patterns'][] = "/\\[url=(['\"]?)(http[s]?:\\/\\/[^\"'<>]*)\\1](.*)\\[\\/url\\]/sU";
$patterns['replacements'][] = '<a href="\\2" target="_blank">\\3</a>';
$patterns['patterns'][] = "/\\[url=(['\"]?)(ftp?:\\/\\/[^\"'<>]*)\\1](.*)\\[\\/url\\]/sU";
$patterns['replacements'][] = '<a href="\\2" target="_blank">\\3</a>';
$patterns['patterns'][] = "/\\[url=(['\"]?)([^\"'<>]*)\\1](.*)\\[\\/url\\]/sU";
$patterns['replacements'][] = '<a href="http://\\2" target="_blank">\\3</a>';
$patterns['patterns'][] = "/\\[color=(['\"]?)([a-zA-Z0-9]*)\\1](.*)\\[\\/color\\]/sU";
$patterns['replacements'][] = '<span style="color: #\\2;">\\3</span>';
$patterns['patterns'][] = "/\\[size=(['\"]?)([a-z0-9-]*)\\1](.*)\\[\\/size\\]/sU";
$patterns['replacements'][] = '<span style="font-size: \\2;">\\3</span>';
$patterns['patterns'][] = "/\\[font=(['\"]?)([^;<>\\*\\(\\)\"']*)\\1](.*)\\[\\/font\\]/sU";
$patterns['replacements'][] = '<span style="font-family: \\2;">\\3</span>';
$patterns['patterns'][] = "/\\[email]([^;<>\\*\\(\\)\"']*)\\[\\/email\\]/sU";
$patterns['replacements'][] = '<a href="mailto:\\1">\\1</a>';
$patterns['patterns'][] = "/\\[b](.*)\\[\\/b\\]/sU";
$patterns['replacements'][] = '<b>\\1</b>';
$patterns['patterns'][] = "/\\[i](.*)\\[\\/i\\]/sU";
$patterns['replacements'][] = '<i>\\1</i>';
$patterns['patterns'][] = "/\\[u](.*)\\[\\/u\\]/sU";
$patterns['replacements'][] = '<u>\\1</u>';
$patterns['patterns'][] = "/\\[d](.*)\\[\\/d\\]/sU";
$patterns['replacements'][] = '<del>\\1</del>';
$patterns['patterns'][] = "/\\[quote(=*+(.*))]/sU";
$patterns['replacements'][] = '<div class="exmQuote"><blockquote>' . TextCleaner::formQuote('$2') . '<p>';
$patterns['patterns'][] = "/\\[\\/quote]/sU";
$patterns['replacements'][] = '</p></blockquote></div>';
$patterns['patterns'][] = "/\\[img align=(['\"]?)(left|center|right)\\1]([^\"\\(\\)'<>]*)\\[\\/img\\]/sU";
$patterns['patterns'][] = "/\\[img]([^\"\\(\\)'<>]*)\\[\\/img\\]/sU";
$patterns['patterns'][] = "/\\[img align=(['\"]?)(left|center|right)\\1 id=(['\"]?)([0-9]*)\\3]([^\"\\(\\)\\?\\&'<>]*)\\[\\/img\\]/sU";
$patterns['patterns'][] = "/\\[img id=(['\"]?)([0-9]*)\\1]([^\"\\(\\)\\?\\&'<>]*)\\[\\/img\\]/sU";
if ($allowimage != 1) {
$patterns['replacements'][] = '<a href="\\3" target="_blank">\\3</a>';
$patterns['replacements'][] = '<a href="\\1" target="_blank">\\1</a>';
$patterns['replacements'][] = '<a href="' . XOOPS_ROOT_PATH . '/image.php?id=\\4" target="_blank">\\4</a>';
$patterns['replacements'][] = '<a href="' . XOOPS_ROOT_PATH . '/image.php?id=\\2" target="_blank">\\3</a>';
} else {
$patterns['replacements'][] = '<img src="\\3" align="\\2" alt="" />';
$patterns['replacements'][] = '<img src="\\1" alt="" />';
$patterns['replacements'][] = '<img src="' . XOOPS_ROOT_PATH . '/image.php?id=\\4" align="\\2" alt="\\4" />';
$patterns['replacements'][] = '<img src="' . XOOPS_ROOT_PATH . '/image.php?id=\\2" alt="\\3" />';
}
$text = str_replace("", "", $text);
$c = "[-]*";
$patterns['patterns'][] = "/j{$c}a{$c}v{$c}a{$c}s{$c}c{$c}r{$c}i{$c}p{$c}t{$c}:/si";
$patterns['replacements'][] = "(script removed)";
$patterns['patterns'][] = "/a{$c}b{$c}o{$c}u{$c}t{$c}:/si";
$patterns['replacements'][] = "about :";
// More patterns with plugins
$patterns = RMEvents::get()->run_event('rmcommon.get.replace.patterns', $patterns, $this);
$text = preg_replace($patterns['patterns'], $patterns['replacements'], $text);
$text = RMEvents::get()->run_event('rmcommon.code.decode', $text);
return $text;
}