Плагин FixedPre от Боба Рэя. Немного изменил, чтобы обрабатывал <code> и <pre>.
Для просмотра ссылки Войди или Зарегистрируйся
В оригинале нужно использовать <span class="fixedpre"> ... </<span>
if (! function_exists('quote_meta') ) {
function quote_meta($a) {
$lhs = array("<", ">", "[", "]", "!", "{", "}", "`", "*", "~");
$rhs = array("<", ">", "[", "]", "!", "{", "}", "`", "*", "~");
$b = str_replace("&", "\255", $a[2]); //save "&"
$lhs_preg = array('|<!(!*)fixedpre>|', '|<!(!*)/fixedpre>|');
$rhs_preg = array('<$1fixedpre>', '<$1/fixedpre>');
$b = preg_replace($lhs_preg, $rhs_preg, $b);
$b = str_replace($lhs, $rhs, $b);
/* restore '&' as '&' and wrap in span tag */
return str_replace("\255", "&", $b);
}
}
$output =& $modx->documentOutput;
//$output = preg_replace_callback("#(<fixedpre>)(.*?)(</fixedpre>)#s", "quote_meta", $output);
$output = preg_replace_callback(\"#(<pre>)(.*?)(</pre>)#s\", \"quote_meta\", $output);
$output = preg_replace_callback(\"#(<code>)(.*?)(</code>)#s\", \"quote_meta\", $output);