|
@ -1857,6 +1857,15 @@ function markup(&$body, $track_cites = false) { |
|
|
if (mysql_version() < 50503) |
|
|
if (mysql_version() < 50503) |
|
|
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); |
|
|
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); |
|
|
|
|
|
|
|
|
|
|
|
if ($config['markup_code']) { |
|
|
|
|
|
$code_markup = array(); |
|
|
|
|
|
$body = preg_replace_callback($config['markup_code'], function($matches) use (&$code_markup) { |
|
|
|
|
|
$d = count($code_markup); |
|
|
|
|
|
$code_markup[] = $matches; |
|
|
|
|
|
return "<code $d>"; |
|
|
|
|
|
}, $body); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
foreach ($config['markup'] as $markup) { |
|
|
foreach ($config['markup'] as $markup) { |
|
|
if (is_string($markup[1])) { |
|
|
if (is_string($markup[1])) { |
|
|
$body = preg_replace($markup[0], $markup[1], $body); |
|
|
$body = preg_replace($markup[0], $markup[1], $body); |
|
@ -2055,6 +2064,18 @@ function markup(&$body, $track_cites = false) { |
|
|
|
|
|
|
|
|
$body = preg_replace("/\n/", '<br/>', $body); |
|
|
$body = preg_replace("/\n/", '<br/>', $body); |
|
|
|
|
|
|
|
|
|
|
|
// Fix code markup |
|
|
|
|
|
if ($config['markup_code']) { |
|
|
|
|
|
foreach ($code_markup as $id => $val) { |
|
|
|
|
|
$code = isset($val[2]) ? $val[2] : $val[1]; |
|
|
|
|
|
$code_lang = isset($val[2]) ? $val[1] : ""; |
|
|
|
|
|
|
|
|
|
|
|
$code = "<pre class='code lang-$code_lang'>".str_replace(array("\n","\t"), array(" ","	"), htmlspecialchars($code))."</pre>"; |
|
|
|
|
|
|
|
|
|
|
|
$body = str_replace("<code $id>", $code, $body); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if ($config['markup_repair_tidy']) { |
|
|
if ($config['markup_repair_tidy']) { |
|
|
$tidy = new tidy(); |
|
|
$tidy = new tidy(); |
|
|
$body = str_replace("\t", '	', $body); |
|
|
$body = str_replace("\t", '	', $body); |
|
|