源程序:
function form_wikitext($attrs) {
// mandatory attributes
unset($attrs['name']);
unset($attrs['id']);
return '';
}
function form_wikitext($attrs) {
// mandatory attributes
unset($attrs['name']);
unset($attrs['id']);
return '';
}
2.3.3:在/lib/tpl/dokuwiki/main.php添加xheditor包
2.3.4.在/inc/parser/xhtml.php里更改cdata函数
源程序:function cdata($text) {
$this->doc .= $this->_xmlEntities($text);
}
替换程序:
function cdata($text) {
$this->doc.=$text;
}
替换原因是:因为以前是纯字符编辑器,会将一些特殊符号进行过滤,比如:<>等等.而替换之后的xheditor本身已经做了一次过滤了,再次过滤就会导致字符<变成<,因此去掉这段之后,就只过滤一次
2.3.5.添加js代码
$(function(){
$('#elm1').xheditor({
localUrlTest:/^https?:\/\/[^\/]*?(xheditor\.com)\//i,
remoteImgSaveUrl:'lib/xheditor1-saveremoteimg.php?prefix='
});
});
2.3.6:配置php截图上传代码:
/lib/xheditor-1.1.14/demos/saveremoteimg.php.在文件底部修改代码:for($i=0;$i<$urlCount;$i++){
$localUrl=saveRemoteImg($arrUrls[$i]);
if($localUrl)$arrUrls[$i]=$localUrl;
}
echo implode('|',$arrUrls);
for($i=0;$i<$urlCount;$i++){
$localUrl=saveRemoteImg($arrUrls[$i]);
if($localUrl)$arrUrls[$i]=$localUrl;
}
foreach($arrUrls as $key=>$vo){
$arrUrls[$key]=$_GET['prefix'].'lib/xheditor-1.1.14/demos/'.$vo;
}
echo implode('|',$arrUrls);
2.3.7:将上传的图片去掉多余的”符号
图片上传,发布之后.在调用图片时,会多一个中文”符号,需要修改语言包/inc/lang/zh/lang.php$lang['doublequoteopening'] = '“';
$lang['doublequoteclosing'] = '”';
$lang['doublequoteopening'] = '';
$lang['doublequoteclosing'] = '';
.btnCode {
background:transparent url(../images/code.gif) no-repeat 16px 16px;
background-position:2px 2px;}
标签在dokuwiki下,会嵌套,导致样式会出现两个边框.
pre pre{box-shadow:none;border:0px;margin:0;padding:0;}
span{font-style:normal;}
function split($subject, &$split) {
if (count($this->_patterns) == 0) {
return false;
}
if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
if(function_exists('preg_last_error')){
$err = preg_last_error();
switch($err){
case PREG_BACKTRACK_LIMIT_ERROR:
msg('A PCRE backtrack error occured. Try to increase the pcre.backtrack_limit in php.ini',-1);
break;
case PREG_RECURSION_LIMIT_ERROR:
msg('A PCRE recursion error occured. Try to increase the pcre.recursion_limit in php.ini',-1);
break;
case PREG_BAD_UTF8_ERROR:
msg('A PCRE UTF-8 error occured. This might be caused by a faulty plugin',-1);
break;
case PREG_INTERNAL_ERROR:
msg('A PCRE internal error occured. This might be caused by a faulty plugin',-1);
break;
}
}
$split = array($subject, "", "");
return false;
}
$idx = count($matches)-2;
list($pre, $post) = preg_split($this->_patterns[$idx].$this->_getPerlMatchingFlags(), $subject, 2);
$split = array($pre, $matches[0], $post);
return isset($this->_labels[$idx]) ? $this->_labels[$idx] : true;
}
function split($subject, &$split) {
if (count($this->_patterns) == 0) {
return false;
}
if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
if(function_exists('preg_last_error')){
$err = preg_last_error();
switch($err){
case PREG_BACKTRACK_LIMIT_ERROR:
msg('A PCRE backtrack error occured. Try to increase the pcre.backtrack_limit in php.ini',-1);
break;
case PREG_RECURSION_LIMIT_ERROR:
msg('A PCRE recursion error occured. Try to increase the pcre.recursion_limit in php.ini',-1);
break;
case PREG_BAD_UTF8_ERROR:
msg('A PCRE UTF-8 error occured. This might be caused by a faulty plugin',-1);
break;
case PREG_INTERNAL_ERROR:
msg('A PCRE internal error occured. This might be caused by a faulty plugin',-1);
break;
}
}
$split = array($subject, "", "");
return false;
}
$idx = count($matches)-2;
list($pre, $post) = preg_split($this->_patterns[$idx].$this->_getPerlMatchingFlags(), $subject, 2);
if(substr($this->_patterns[$idx].$this->_getPerlMatchingFlags(),0,5)=='(\/\/'){
$pre='//'.$pre;
}
$split = array($pre, $matches[0], $post);
return isset($this->_labels[$idx]) ? $this->_labels[$idx] : true;
}
function emphasis_open() {
$this->doc .= '';
}
function emphasis_close() {
$this->doc .= '';
}
function emphasis_open() {
//$this->doc .= '';
}
function emphasis_close() {
//$this->doc .= '';
}
4.1.1:插入界面
4.1.2:插入整体效果图
4.2.1:随意截图
4.2.2:发布效果
5.3.2:代码高亮那块是采用Google的prettify.js,那块实际上是用js来修改源代码,在一些关键字的地方加上一些标签和css属性,于是就产生了高亮,关于这块,我是比较担心兼容性问题的(单个页面不担心,但是wiki也引入一堆js,但是目前看来,我测试了几次,都没什么问题,那应该不会出现了)