【反馈】编辑器的小BUG
作者:午夜狂奔 发布时间:2008/7/15 18:18:10 分数:0

编辑文章时,文字元素或图片元素无法居中、居右,编辑时将一段文字或图片设为居中提交后,实际显示出来无效(仍然是默认的居左显示)如下所示:

1、这段文字我是设置了居中的

2、这段文字我是设置了居右的

 
更新时间:2008/7/16 3:53:39


网友跟帖 共5 条 [我也要发表回复]
删除回复游客221.200.41.* - 回复于2008/7/16 21:47:08
1

你把run/function.php中的filter2函数加一句代码:

//过滤函数2
function filter2($text){
  $text=filter_html($text);
  $text=preg_replace('/<\?.*\?>/sU','',$text);
  $text=preg_replace('/<\!--.*-->/sU','',$text);
  $text=preg_replace('/<\!DOCTYPE[^>]*>/i','',$text);
  while(preg_match('/<p(.+)<\/p>/isU',$text,$mat)){
    $text=str_replace($mat[0],'<div'.$mat[1].'</div>',$text);
    unset($mat);
  }

  $text=preg_replace('/<(p|dt|dd)[^>]*>|<\/(p|li|dt|dd)>/i','<br>',$text); //可单个使用的标记处理
  $text=preg_replace('/<li[^>]*>/i','<br>●',$text);
  $text=preg_replace('/<\/?(html|head|meta|link|base|body|title|style|script|noscript|form|iframe|frame|frameset|noframes)[^>]*>/i','',$text);
  while(preg_match('/(<[^>]+)( title| alt| id| name| lang| class| onfinish| onmouse| onexit| onerror| onclick| onkey| onload| onchange| onfocus| onblur)\s*=\s*(("[^">]+")|(\'[^\'>]+\')|[^\s>]+)([^>]*>)/i',$text,$mat)){
    $text=str_replace($mat[0],$mat[1].' '.$mat[6],$text);
    unset($mat);
  }
  while(preg_match('/(<[^>]+)(window\.|javascript:|js:|about:|file:|document\.|vbs:|cookie)([^>]*)/i',$text,$mat)){
    $text=str_replace($mat[0],$mat[1].' '.$mat[3],$text);
    unset($mat);
  }
  $text=preg_replace('/<(w?br(\s\/)?)>/i','[ ]',$text);
  $text=preg_replace('/(\[br\]\s*){10,}/i','[br]',$text);
  $text=preg_replace('/<(hr|img|\/img|input|area|isindex)([^>\[\]]*)>/i','[ ]',$text);
  while(preg_match('/<([a-z]+)[^>\[\]]*>[^><]*<\/
>/i',$text,$mat)){
    $text=str_replace($mat[0],str_replace('>',']',str_replace('<','[',$mat[0])),$text);
    unset($mat);
  }
  while(preg_match('/(\[[^\]]*=\s*)("|\')([^=
\]]+)([^\]]*\])/i',$text,$mat)){
    $text=str_replace($mat[0],$mat[1].'|'.$mat[3].'|'.$mat[4],$text);
    unset($mat);
  }
  while(preg_match('/(\[[^"\'\]]*)("|\')([^\]]*\])/i',$text,$mat)){
    $text=str_replace($mat[0],$mat[1].$mat[3],$text);
    unset($mat);
  }
  $text=str_replace('<','&lt;',$text);
  $text=str_replace('>','&gt;',$text);
  $text=str_replace('\"','"',$text);
  $text=str_replace('"','&quot;',$text);
  $text=str_replace('\'','&#039;',$text);
  $text=str_replace('[','<',$text);
  $text=str_replace(']','>',$text);
  $text=str_replace('|','"',$text);

  $text=filter_badwords($text);  //2.2版加入过滤词汇功能
  return $text;
}
删除回复游客221.200.41.* - 回复于2008/7/16 22:01:50
2本跟帖已被删除或屏蔽
删除回复游客221.200.41.* - 回复于2008/7/16 22:03:51
3本跟帖已被删除或屏蔽
删除回复游客221.200.41.* - 回复于2008/7/16 22:05:35
4
现在好了
好了吗
的确显示正常了
删除回复午夜狂奔 - 回复于2008/7/16 23:52:02
5
好了,现在正常了