Discuz5.5.0代碼高亮顯示+運(yùn)行代碼框合成插件 下載第2/4頁
更新時間:2007年07月17日 00:00:00 作者:
(2)/include/discuzcode.func.php
①找到:
復(fù)制代碼 代碼如下:
if(!defined('IN_DISCUZ')) {
前面添加
復(fù)制代碼 代碼如下:
include_once('geshi.php');
②將下面這段代碼放在其它函數(shù)結(jié)束的地方添加,比如:
找到:
復(fù)制代碼 代碼如下:
return ($htmlon || $allowhtml) && $parsetype != 1 ? $message : nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message));}
在后面添加:
//分析語言高亮顯示
復(fù)制代碼 代碼如下:
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(); }
相關(guān)文章
php循環(huán)輸出數(shù)據(jù)庫內(nèi)容的代碼
今天書寫php的循環(huán)輸出內(nèi)容,總發(fā)現(xiàn)第一篇不能現(xiàn)實(shí),原來是用php do while語句,后來改成while所以出現(xiàn)這個問題,都怪學(xué)藝不精啊,特整理下2008-05-05php curl中g(shù)zip的壓縮性能測試實(shí)例分析
這篇文章主要介紹了php curl中g(shù)zip的壓縮性能測試,結(jié)合實(shí)例形式分析了php使用curl的gzip壓縮耗時與效率,需要的朋友可以參考下2016-11-11php中靜態(tài)類與靜態(tài)變量用法的區(qū)別分析
這篇文章主要介紹了php中靜態(tài)類與靜態(tài)變量用法的區(qū)別,以實(shí)例形式較為詳細(xì)的分析了php中靜態(tài)類與靜態(tài)變量的定義、功能及使用技巧,需要的朋友可以參考下2015-01-01php數(shù)組函數(shù)array_key_exists()小結(jié)
本文給大家匯總介紹了php數(shù)組函數(shù)array_key_exists()的相關(guān)知識以及與in_array的性能對比,與isset的區(qū)別分析,非常的詳細(xì),有需要的小伙伴可以參考下。2015-12-12淺談php中fopen不能創(chuàng)建中文文件名文件的問題
下面小編就為大家?guī)硪黄獪\談php中fopen不能創(chuàng)建中文文件名文件的問題。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-02-02