]*>.*<\\/code>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr);// loop stuff for ($i = 0; $i < $stop; $i++) { $content = $textarr[$i]; if (preg_match("/^(]*>.*<\\/code>)/Us", $content, $code)) { // If it's a code $content = '[code]' . base64_encode($code[1]) . '[/code]'; } $output .= $content; } return $output; } ### unmask code ### function pri_cae_unmask($text, $replace = false, $addpre = false) { global $pri_cae_use_geshi, $pri_cae_geshi_path; $textarr = preg_split("/(\\[code\\].*\\[\\/code\\])/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr);// loop stuff for ($i = 0; $i < $stop; $i++) { $content = $textarr[$i]; if (preg_match("/^\\[code\\](.*)\\[\\/code\\]/Us", $content, $code)) { // If it's a code $content = base64_decode($code[1]); preg_match("#^$#', '', $content); $content = preg_replace('#^]*>#', '', $content); if ($replace) { $content = preg_replace('#^\s+#', '', $content); $content = preg_replace('#\s+$#', '', $content); if ($language && $pri_cae_use_geshi) { $geshi = new GeSHi($content, $language, $pri_cae_geshi_path . "/geshi/"); #if (preg_match('#\n#', $content)) { # $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); #} #$geshi->enable_classes(); $content = $geshi->parse_code(); $content = preg_replace('##', '', $content); $content = preg_replace('##', '', $content); $content = '' . $content . ''; } else { $content = preg_replace("/\\r/", '', $content); $content = preg_replace("/^\\s*?\\n/", "\n", $content); $content = preg_replace("/&/", '&', $content); $content = preg_replace("//", '>', $content); $content = '' . $content . ''; } if ($addpre) { if (preg_match('/\\n/', $content)) { $content = "
" . $content . "
"; } } } else { if ($language) { $content = "" . $content . ""; } else { $content = "" . $content . ""; } } } $output .= $content; } $output = preg_replace('|

\s*

|', "
", $output);
	$output = preg_replace('|
\s*

|', "
", $output); return $output; } ### unmask and do replacement ### function pri_cae_unmask_replace($text) { return pri_cae_unmask($text, true); } ### unmask and do replacement, plus enclose in
 ###
function pri_cae_unmask_replace_addpre($text) {
	return pri_cae_unmask($text, true, true);
}


add_filter('content_save_pre', 'pri_cae_mask', 28);
add_filter('content_save_pre', 'pri_cae_unmask', 72);
add_filter('the_content', 'pri_cae_mask', 1);
add_filter('the_content', 'pri_cae_unmask_replace', 99);

add_filter('excerpt_save_pre', 'pri_cae_mask', 28);
add_filter('excerpt_save_pre', 'pri_cae_unmask', 72);
add_filter('the_excerpt', 'pri_cae_mask', 1);
add_filter('the_excerpt', 'pri_cae_unmask_replace', 99);

add_filter('pre_comment_content', 'pri_cae_mask', 4);
add_filter('pre_comment_content', 'pri_cae_unmask', 36);
add_filter('comment_save_pre', 'pri_cae_mask', 28);
add_filter('comment_save_pre', 'pri_cae_unmask', 72);
add_filter('comment_text', 'pri_cae_mask', 1);
add_filter('comment_text', 'pri_cae_unmask_replace_addpre', 99);