mirror of
https://github.com/Xkeeper0/jul.git
synced 2025-08-01 04:32:03 -07:00
Removing [trope] and switching to preg_replace_callback
This commit is contained in:
@@ -466,6 +466,15 @@ function doreplace($msg, $posts, $days, $username, &$tags = null) {
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
function escape_codeblock($text) {
|
||||
$list = array("[code]", "[/code]", "<", "\\\"" , "\\\\" , "\\'", "[", ":", ")", "_");
|
||||
$list2 = array("", "", "<", "\"", "\\", "\'", "[", ":", ")", "_");
|
||||
|
||||
// @TODO why not just use htmlspecialchars() or htmlentities()
|
||||
return "[quote]<code>". str_replace($list, $list2, $text[0]) ."</code>[/quote]";
|
||||
}
|
||||
|
||||
function doreplace2($msg, $options='0|0'){
|
||||
// options will contain smiliesoff|htmloff
|
||||
$options = explode("|", $options);
|
||||
@@ -475,8 +484,7 @@ function doreplace2($msg, $options='0|0'){
|
||||
|
||||
$list = array("<", "\\\"" , "\\\\" , "\\'", "[", ":", ")", "_");
|
||||
$list2 = array("<", "\"", "\\", "\'", "[", ":", ")", "_");
|
||||
$msg=preg_replace("'\[code\](.*?)\[/code\]'sie",
|
||||
'\''."[quote]<code>".'\''.'.str_replace($list,$list2,\'\\1\').\'</code>[/quote]\'',$msg);
|
||||
$msg=preg_replace_callback("'\[code\](.*?)\[/code\]'si", 'escape_codeblock',$msg);
|
||||
|
||||
|
||||
if ($htmloff) {
|
||||
@@ -514,8 +522,6 @@ function doreplace2($msg, $options='0|0'){
|
||||
$msg=preg_replace("'\[img\](.*?)\[/img\]'si", '<img src=\\1>', $msg);
|
||||
$msg=preg_replace("'\[url\](.*?)\[/url\]'si", '<a href=\\1>\\1</a>', $msg);
|
||||
$msg=preg_replace("'\[url=(.*?)\](.*?)\[/url\]'si", '<a href=\\1>\\2</a>', $msg);
|
||||
$msg=preg_replace("/\[trope\](.*?)\[\/trope\]/sie", "'<a href=\'http://tvtropes.org/pmwiki/pmwiki.php/Main/\\1\'>'.formatting_trope('\\1').'</a>'", $msg);
|
||||
$msg=preg_replace("/\[trope=(.*?)\](.*?)\[\/trope\]/sie", "'<a href=\'http://tvtropes.org/pmwiki/pmwiki.php/Main/\\1\'>\\2</a>'", $msg);
|
||||
$msg=str_replace('http://nightkev.110mb.com/justus_layout.css','about:blank',$msg);
|
||||
|
||||
do {
|
||||
|
Reference in New Issue
Block a user