Discuz5.5.0代码高亮显示+运行代码框合成插件 下载第2/4页

 更新时间:2007年07月17日 00:00:00   作者:  

(2)/include/discuzcode.func.php
①找到:
复制代码 代码如下:

if(!defined('IN_DISCUZ')) {

前面添加
复制代码 代码如下:

include_once('geshi.php'); 

②将下面这段代码放在其它函数结束的地方添加,比如:
找到:
复制代码 代码如下:

return ($htmlon || $allowhtml) && $parsetype != 1 ? $message : nl2br(str_replace(array("\t", '   ', '  '), array('            ', '     ', '    '), $message));}

在后面添加:
//分析语言高亮显示  
复制代码 代码如下:

function paste_language($language,$text)        {                 $text = str_replace("  ", "  ", $text);                 $text = str_replace("&gt;", ">", $text);                $text = str_replace("&lt;", "<", $text);                $text = str_replace("&", "&", $text);                 $text = str_replace(""", '"', $text);                  $text =& new geshi($text,$language);           // Enable line numbers. We want fancy line numbers, and we want every 5th line number to be fancy                $text->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);                 $text->set_overall_style('font:12px Verdana, Courier, monospace; color: #000066; border: 1px solid #d0d0d0; background-color: #fff;', true);                 $text->set_line_style('font:12px Verdana, Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);                $text->set_code_style('font:12px Verdana, Courier, monospace; color: #000020;', 'color: #000020;');                 $text->set_link_styles(GESHI_LINK, 'color: #000060;');                $text->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');                 $text->set_header_content('54geek.com &copy; 2007. 代码语言:'.$language);                $text->set_header_content_style('font-family:  Arial,Verdana,sans-serif; color: #808080; font-size: 12px; background-color: #f0f0ff; border-bottom: 1px dotted #d0d0d0; padding: 2px;');                 $text->set_footer_content('Parsed in <TIME> seconds,  using GeSHi <VERSION>');                $text->set_footer_content_style('font-family:  Arial,Verdana,sans-serif; color: #808080; font-size: 12px; background-color: #f0f0ff; border-top: 1px dotted #d0d0d0; padding: 2px;');                //echo "$text->parse_code()";                //return  preg_replace("#&lt;br /&gt;#", "", $text->parse_code());                return $text->parse_code();        }

相关文章

最新评论