// Emoticons and images
$text = preg_replace("/\[xemo=(.*?)\](.*?)\[\/xemo\]/i", '<img src="http://2wapworld.com/emoticons/$2" alt="$1"/>', $text);
$text = preg_replace("/\[postimage=(.*?)\](.*?)\[\/postimage=(.*?)\]/i", '<a href="/get$1/file.jpg"><img src="max.php?width=200&height=200&filename=http://2wapworld.com/$2" alt="$1"/></a> <a href="posts.php?&attid=$1&tid=$3&act=fileinfo">[i]</a>', $text);
// Quotes
$text = self::bbcode_quote($text);
// Code blocks with language
$text = preg_replace_callback('/\[code=([a-z0-9]+)\](.*?)\[\/code\]/is', function($matches) {
$language = htmlspecialchars($matches[1], ENT_QUOTES, 'UTF-8'
;
$code = htmlspecialchars($matches[2], ENT_QUOTES, 'UTF-8'
;
$code = trim($code);
return '<pre class="bg-dark text-light p-3 rounded" style="overflow-x: auto;"><code class="language-' . $language . '">' . $code . '</code></pre>';
}, $text);
// Code blocks without language
$text = preg_replace_callback('/\[code\](.*?)\[\/code\]/is', function($matches) {
$code = htmlspecialchars($matches[1], ENT_QUOTES, 'UTF-8'
;
$code = trim($code);
return '<pre class="bg-dark text-light p-3 rounded" style="overflow-x: auto;"><code>' . $code . '</code></pre>';
}, $text);