Exemplo n.º 1
0
function replacement($content, $bbcode = true)
{
    $pagebg = PAGEBG;
    $border = BORDER;
    $bg1 = BG_1;
    $bghead = BGHEAD;
    $bgcat = BGCAT;
    if ($bbcode) {
        $content = codereplace($content);
        $content = imgreplace($content);
        $content = quotereplace($content);
        $content = urlreplace($content);
        $content = preg_replace_callback("#(^|<[^\"=]{1}>|\\s|\\[b|i|u\\]][^<a.*>])(http://|https://|ftp://|mailto:|news:|www.)([^\\s<>|\$]+)#si", "linkreplace", $content);
        $content = preg_replace("#\\[email\\](.*?)\\[/email\\]#sie", "'<a href=\"mailto:'.mail_protect(fixJavaEvents('\\1')).'\">'.fixJavaEvents('\\1').'</a>'", $content);
        $content = preg_replace("#\\[email=(.*?)\\](.*?)\\[/email\\]#sie", "'<a href=\"mailto:'.mail_protect(fixJavaEvents('\\1')).'\">\\2</a>'", $content);
        $content = preg_replace_callback("#<a\\b[^>]*>(.*?)</a>#si", "cut_urls", $content);
        while (preg_match("#\\[size=(.*?)\\](.*?)\\[/size\\]#si", $content)) {
            $content = preg_replace("#\\[size=(.*?)\\](.*?)\\[/size\\]#si", "<font size=\"\\1\">\\2</font>", $content);
        }
        while (preg_match("#\\[color=(.*?)\\](.*?)\\[/color\\]#si", $content)) {
            $content = preg_replace("#\\[color=(.*?)\\](.*?)\\[/color\\]#si", "<font color=\"\\1\">\\2</font>", $content);
        }
        while (preg_match("#\\[font=(.*?)\\](.*?)\\[/font\\]#si", $content)) {
            $content = preg_replace("#\\[font=(.*?)\\](.*?)\\[/font\\]#si", "<font face=\"\\1\">\\2</font>", $content);
        }
        while (preg_match("#\\[align=(.*?)\\](.*?)\\[/align\\]#si", $content)) {
            $content = preg_replace("#\\[align=(.*?)\\](.*?)\\[/align\\]#si", "<div align=\"\\1\">\\2</div>", $content);
        }
        $content = preg_replace("#\\[b\\](.*?)\\[/b\\]#si", "<b>\\1</b>", $content);
        $content = preg_replace("#\\[i\\](.*?)\\[/i\\]#si", "<i>\\1</i>", $content);
        $content = preg_replace("#\\[u\\](.*?)\\[/u\\]#si", "<u>\\1</u>", $content);
        $content = preg_replace("#\\[s\\](.*?)\\[/s\\]#si", "<s>\\1</s>", $content);
        $content = preg_replace("#\\[list\\][\\s]{0,}(.*?)\\[/list\\]#si", "<ul class='list'>\\1</ul>", $content);
        $content = preg_replace("#\\[list=1\\][\\s]{0,}(.*?)\\[/list=1\\]#si", "<ol class='list_num'>\\1</ol>", $content);
        $content = preg_replace("#\\[list=a\\][\\s]{0,}(.*?)\\[/list=a\\]#si", "<ol type=\"a\" class='list_alpha'>\\1</ol>", $content);
        $content = preg_replace("#\\[\\*\\](.*?)\\[/\\*\\](\\s){0,}#si", "<li>\\1</li>", $content);
        $content = preg_replace("#\\[br]#si", "<br />", $content);
        $content = preg_replace("#\\[hr]#si", "<hr />", $content);
        $content = preg_replace("#\\[center]#si", "<center>", $content);
        $content = preg_replace("#\\[/center]#si", "</center>", $content);
    }
    $content = preg_replace("#\\[SMILE=(.*?)\\](.*?)\\[/SMILE\\]#si", '<img src="\\2" alt="\\1" border="0" />', $content);
    return $content;
}
Exemplo n.º 2
0
function replacement($content, $bbcode = true)
{
    $pagebg = PAGEBG;
    $border = BORDER;
    $bg1 = BG_1;
    $bghead = BGHEAD;
    $bgcat = BGCAT;
    if ($bbcode) {
        $content = codereplace($content);
        $content = imgreplace($content);
        $content = quotereplace($content);
        $content = urlreplace($content);
        $content = tubereplace($content);
        $content = hidereplace($content);
        $content = preg_replace_callback("#(^|<[^\"=]{1}>|\\s|\\[b|i|u\\]][^<a.*>])(http://|https://|ftp://|mailto:|news:|www.)([^\\s<>|\$]+)#si", "linkreplace", $content);
        $content = preg_replace("#\\[email\\](.*?)\\[/email\\]#sie", "'<a href=\"mailto:'.mail_protect(fixJavaEvents('\\1')).'\">'.fixJavaEvents('\\1').'</a>'", $content);
        $content = preg_replace("#\\[email=(.*?)\\](.*?)\\[/email\\]#sie", "'<a href=\"mailto:'.mail_protect(fixJavaEvents('\\1')).'\">\\2</a>'", $content);
        $content = preg_replace_callback("#<a\\b[^>]*>(.*?)</a>#si", "cut_urls", $content);
        while (preg_match("#\\[size=(.*?)\\](.*?)\\[/size\\]#si", $content)) {
            $content = preg_replace("#\\[size=(.*?)\\](.*?)\\[/size\\]#si", "<font size=\"\\1\">\\2</font>", $content);
        }
        while (preg_match("#\\[color=(.*?)\\](.*?)\\[/color\\]#si", $content)) {
            $content = preg_replace("#\\[color=(.*?)\\](.*?)\\[/color\\]#si", "<font color=\"\\1\">\\2</font>", $content);
        }
        while (preg_match("#\\[font=(.*?)\\](.*?)\\[/font\\]#si", $content)) {
            $content = preg_replace("#\\[font=(.*?)\\](.*?)\\[/font\\]#si", "<font face=\"\\1\">\\2</font>", $content);
        }
        while (preg_match("#\\[align=(.*?)\\](.*?)\\[/align\\]#si", $content)) {
            $content = preg_replace("#\\[align=(.*?)\\](.*?)\\[/align\\]#si", "<div align=\"\\1\">\\2</div>", $content);
        }
        while (preg_match("#\\[heading=(.*?)\\](.*?)\\[/heading\\]#si", $content)) {
            $content = preg_replace("#\\[heading=(.*?)\\](.*?)\\[/heading\\]#si", "<\\1>\\2</\\1>", $content);
        }
        $content = preg_replace("#\\[b\\](.*?)\\[/b\\]#si", "<b>\\1</b>", $content);
        $content = preg_replace("#\\[i\\](.*?)\\[/i\\]#si", "<i>\\1</i>", $content);
        $content = preg_replace("#\\[u\\](.*?)\\[/u\\]#si", "<u>\\1</u>", $content);
        $content = preg_replace("#\\[s\\](.*?)\\[/s\\]#si", "<s>\\1</s>", $content);
        $content = preg_replace("#\\[list\\][\\s]{0,}(.*?)\\[/list\\]#si", "<ul class='list'>\\1</ul>", $content);
        $content = preg_replace("#\\[list=1\\][\\s]{0,}(.*?)\\[/list=1\\]#si", "<ol class='list_num'>\\1</ol>", $content);
        $content = preg_replace("#\\[list=a\\][\\s]{0,}(.*?)\\[/list=a\\]#si", "<ol type=\"a\" class='list_alpha'>\\1</ol>", $content);
        $content = preg_replace("#\\[\\*\\](.*?)\\[/\\*\\](\\s){0,}#si", "<li>\\1</li>", $content);
        $content = preg_replace("#\\[br]#si", "<br />", $content);
        $content = preg_replace("#\\[hr]#si", "<hr />", $content);
        /* START BBCODE MOD */
        $content = preg_replace("#\\[sub\\](.*?)\\[/sub\\]#si", "<sub>\\1</sub>", $content);
        $content = preg_replace("#\\[sup\\](.*?)\\[/sup\\]#si", "<sup>\\1</sup>", $content);
        $content = preg_replace("#\\[caps\\](.*?)\\[/caps\\]#si", "<span style='text-transform:uppercase;'>\\1</span>", $content);
        $content = preg_replace("#\\[low\\](.*?)\\[/low\\]#si", "<span style='text-transform:lowercase;'>\\1</span>", $content);
        $content = preg_replace("#\\[spc=(.*?)\\](.*?)\\[/spc\\]#si", "<span style='letter-spacing:\\1px;'>\\2</span>", $content);
        $content = preg_replace("#\\[anchor=(.*?)\\]#si", "<a id=\"\\1\"></a>", $content);
        $content = preg_replace("#\\[left\\](.*?)\\[/left\\]#si", "<div style='float: left; padding:1px;'>\\1</div>", $content);
        $content = preg_replace("#\\[right\\](.*?)\\[/right\\]#si", "<div style='float: right; padding:1px;'>\\1</div>", $content);
        $content = preg_replace("#\\[table\\](.*?)\\[/table\\]#si", "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\\1</table>", $content);
        $content = preg_replace("#\\[tr\\](.*?)\\[/tr\\]#si", "<tr>\\1</tr>", $content);
        $content = preg_replace("#\\[td\\](.*?)\\[/td\\]#si", "<td>\\1</td>", $content);
        $content = preg_replace("#\\[bgcolor=(.*?)\\](.*?)\\[/bgcolor\\]#si", "<span style='background-color:\\1;'>\\2</span>", $content);
        $content = preg_replace_callback("#\\[PHP\\](.*?)\\[/PHP\\]#si", "highlight_php", $content);
        /* END BBCODE MOD */
        $content = preg_replace("#\\[center]#si", "<center>", $content);
        $content = preg_replace("#\\[/center]#si", "</center>", $content);
    }
    $content = preg_replace("#\\[SMILE=(.*?)\\](.*?)\\[/SMILE\\]#si", '<img src="\\2" alt="\\1" border="0" />', $content);
    return $content;
}
Exemplo n.º 3
0
function htmloutput($text) {
	$text = codereplace ( $text );
	$text = smileys ( $text );
	$text = replacement ( $text );
	$text = nl2br ( $text );
	
	return $text;
}