Файл: магазин/e-proger/engine/bbcode.class.php
Строк: 20
<?php
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::
Qbbcode
:::::::::::::::::::::::::::::::::::::::::::::::::::::
*/
function parce_bb_code( $text ) {
define( 'ROOT', 'http://' . $_SERVER['HTTP_HOST'] );
$text = strip_tags( $text );
$text = htmlspecialchars( $text );
$text = str_replace( '"', '', $text );
$text = str_replace( "'", '', $text );
$text = preg_replace( "#[(/?)(b|i|u|s|sup|sub|p|li|ul)s*]#is", "<$1$2>", $text );
$text = preg_replace( "#(rn|n|r)#is", "<br />", $text );
$text = preg_replace( "#[list=(1|a|I)](.+?)[/list]#is", "<ol type="\1">\2</ol>", $text );
if ( preg_match( "/<[a-z0-9A-Z]+></[a-z0-9A-Z]+>/", $text ) ) {
exit();
}
/*---Админский код---*/
$text = preg_replace( "#[adm-url=(.+?),(.+?)]#is", "<a href="$1" target="_blank" class="a_box">$2</a>", $text );
/*---Обрабатываем смайлы---*/
if ( $mode == 'all' ) {
$text = get_url( $text );
//$text = preg_replace( "#b(http://)?(https://)?([a-zA-Z0-9.])+([a-zA-Z0-9-])+(.)([a-zA-Z0-9]{2,5})?([a-zA-Z0-9?&-=/._]{2,})#", "<a href="$0" onclick="forum_drweb(this.href);return false;" class="a_box">$0</a>", $text );
if ( preg_match( "#[:(.+?):]#is", $text, $outsmile ) ) {
if ( !is_numeric( $outsmile[1] ) or $outsmile[1] < 1 or $outsmile[1] > 36 ) {
$text = preg_replace( "#[:(.+?):]#is", "", $text );
} else {
$text = preg_replace( "#[:(d+):]#is", '<img src="' . ROOT . '/theme/images/smile/$1.png" />', $text );
}
}
}
if ( $mode == 'forum' ) {
$text = preg_replace( "#[quotet](.+?)[/quotet]#is", "<div class="quotet">\1</div>", $text );
$text = get_url( $text );
if ( preg_match( "#[:(.+?):]#is", $text, $outsmile ) ) {
if ( !is_numeric( $outsmile[1] ) or $outsmile[1] < 1 or $outsmile[1] > 36 ) {
$text = preg_replace( "#[:(.+?):]#is", "", $text );
} else {
$text = preg_replace( "#[:(d+):]#is", '<img src="' . ROOT . '/theme/images/smile/$1.png" />', $text );
}
}
}
return trim( $text );
}
//какие то коды
function parce_html_code( $text ) {
$text = preg_replace( "#<(/?)(b|i|u|s|sup|sub|p|li|ul)s*>#is", "[$1$2]", $text );
$text = preg_replace( "#<br />#is", "n", $text );
$text = preg_replace( "#<ol type="(1|a|I)">(.+?)</ol>#is", "[list=$1]$2[/list]", $text );
$text = preg_replace( "#<a href="(.+?)" onclick="forum_drweb(this.href);return false;" class="a_box">(.+?)</a>#is", "$1", $text );
return $text;
}
?>