20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
26 $config = parent::loadConfig(dirname(__FILE__));
27 if (empty(
$config[
'highlight'])) {
28 return "<pre>{$source}</pre>";
30 $source = $ts->undoHtmlSpecialChars($source);
31 $source = stripslashes($source);
32 if (
$config[
'highlight'] ==
'geshi') {
48 if (!strpos($text,
"<?php") and (substr($text, 0, 5) !=
"<?php")) {
49 $text =
"<?php " . $text;
53 if (!strpos($text,
"?>")) {
57 $oldlevel = error_reporting(0);
61 $text = str_replace(
"\\",
"XxxX", $text);
63 $buffer = highlight_string($text,
true);
66 $buffer = str_replace(
"XxxX",
"\\", $buffer);
68 error_reporting($oldlevel);
69 $pos_open = $pos_close = 0;
71 $pos_open = strpos($buffer,
'<?php ');
73 if ($addedtag_close) {
74 $pos_close = strrpos($buffer,
'?>');
77 $str_open = ($addedtag_open) ? substr($buffer, 0, $pos_open) :
"";
78 $str_close = ($pos_close) ? substr($buffer, $pos_close + 5) :
"";
80 $length_open = ($addedtag_open) ? $pos_open + 14 : 0;
81 $length_text = ($pos_close) ? $pos_close - $length_open : 0;
82 $str_internal = ($length_text) ? substr($buffer, $length_open, $length_text) : substr($buffer, $length_open);
84 $buffer = $str_open . $str_internal . $str_close;
96 $geshi =
new XoopsGeshi($source,
$language);
99 $geshi->set_header_type(GESHI_HEADER_NONE);
104 $geshi->set_link_target(
"_blank");
107 $code = $geshi->parse_code();