1
Line line [ code] [ /code] is really annoying.
Sorry for presenting the annoying stuff to you again.
However, with this YetAnotherAnnoying, you will find that you can make it!
just follow me:
1 xoops/class/module.textsanitizer.php, line 398
change the function codeConv() with
function codeConv($text, $xcode = 1, $image = 1){
if($xcode != 0){
$patterns = "/[code](.*)[/code]/esU";
if ($image != 0) {
// image allowed
//$replacements = "''.MyTextSanitizer::codeSanitizer('$1').'
'";
$replacements = "'xoopsCode">'.MyTextSanitizer::codeSanitizer('$1').'
'";
// hack for [code] rendering by -- phppp
//$text =& $this->xoopsCodeDecode($text);
} else {
// image not allowed
//$replacements = "''.MyTextSanitizer::codeSanitizer('$1', 0).'
'";
$replacements = "'xoopsCode">'.MyTextSanitizer::codeSanitizer('$1', 0).'
'";
// hack for [code] rendering by -- phppp
//$text =& $this->xoopsCodeDecode($text, 0);
}
$text = preg_replace($patterns, $replacements, $text);
}
return $text;
}
2 at the end of your xoops/xoops.css, add:
/*xoops code rendering by phppp*/
/* The scripts are suggested to be added to each theme/style.css, styleNN.css, styleMAC.css if you prefer different styles for different themes, especially if the width is different*/
pre.xoopscode {
font-size: 12px;
font-family: FixedSys, "Courier New",Courier,monospace;
background: #fffff8;
border: 1px solid #6C87B0;
color: #385a72;
width: 500px;
height: 200px;
margin: 1em;
overflow: auto;
padding: 3px 3px 3px 3px;
}
/*xoops code rendering by phppp*/
How does it work? check the following URL you will find out the effect:
https://xoops.org.cn/modules/newbb/viewtopic.php?topic_id=1089&forum=4