页面导航: 首页网络编程PHP编程php技巧 → 正文内容

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

发布:dxy 字体:[增加 减小] 类型:转载

(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(">", ">", $text);                $text = str_replace("<", "<", $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 © 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("#<br />#", "", $text->parse_code());                return $text->parse_code();        }

浏览次数:载入中... 打印本文关闭本文返回首页
·在百度中搜索关于“Discuz5.5.0代码高亮显示+运行代码框合成插件 下载”相关内容
·在谷歌中搜索关于“Discuz5.5.0代码高亮显示+运行代码框合成插件 下载”相关内容

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行