discuz 里面发帖,编辑好了的帖子如 :发表 意见:表情:lol  :funk:  :curse: 图片 [attachimg]63[/attachimg] 
附件[attach]64[/attach]   代码[code]<?php echo '你好!';?>[/code]
这些在数据库都是以标签形式存储的,在查看帖子时 它会自动转换成图片链接以显示图片,或显示附件,等等。我想知道这些转换是在哪里进行处理的?假如我将这里编辑好的内容 赋给一个JS 变量 var  message  ,我该怎么处理成要显示的内容 即将那些标签等转换了,帖子的空行 ,换行 都在,请问要怎么处理?
高手帮忙弄一下!谢谢!

解决方案 »

  1.   

    include/editor.func.php文件的内容为:<?php/*
    [Discuz!] (C)2001-2009 Comsenz Inc.
    This is NOT a freeware, use is subject to license terms $Id: editor.func.php 16688 2008-11-14 06:41:07Z cnteacher $
    */if(!defined('IN_DISCUZ')) {
    exit('Access Denied');
    }function absoluteurl($url) {
    global $boardurl;
    if($url{0} == '/') {
    return 'http://'.$_SERVER['HTTP_HOST'].$url;
    } else {
    return $boardurl.$url;
    }
    }function atag($aoptions, $text) {
    $href = getoptionvalue('href', $aoptions); if(substr($href, 0, 7) == 'mailto:') {
    $tag = 'email';
    $href = substr($href, 7);
    } else {
    $tag = 'url';
    if(!preg_match("/^[a-z0-9]+:/i", $href)) {
    $href = absoluteurl($href);
    }
    } return "[$tag=$href]".trim(recursion('a', $text, 'atag'))."[/$tag]";
    }
    很多方法。。大伙研究
    function tabletag($attributes) {
    $attributes = stripslashes($attributes);
    $width = '';
    if(preg_match("/width=([\"|\']?)(\d{1,4}%?)(\\1)/is", $attributes, $matches)) {
    $width = substr($matches[2], -1) == '%' ? (substr($matches[2], 0, -1) <= 98 ? $matches[2] : '98%') : ($matches[2] <= 560 ? $matches[2] : '560');
    } elseif(preg_match("/width\s?:\s?(\d{1,4})([px|%])/is", $attributes, $matches)) {
    $width = $matches[2] == '%' ? ($matches[1] <= 98 ? $matches[1] : '98%') : ($matches[1] <= 560 ? $matches[1] : '560');
    }
    if(preg_match("/(?:background|background-color|bgcolor)[:=]\s*([\"']?)((rgb\(\d{1,3}%?,\s*\d{1,3}%?,\s*\d{1,3}%?\))|(#[0-9a-fA-F]{3,6})|([a-zA-Z]{1,20}))(\\1)/i", $attributes, $matches)) {
    $bgcolor = $matches[2];
    $width = $width ? $width : '98%';
    } else {
    $bgcolor = '';
    }
    return $bgcolor ? "[table=$width,$bgcolor]" :($width ? "[table=$width]" : '[table]');
    }function tdtag($attributes) {
    $value = array('colspan' => 1, 'rowspan' => 1, 'width' => '');
    preg_match_all("/(colspan|rowspan|width)=([\"|\']?)(\d{1,4}%?)(\\2)/is", stripslashes($attributes), $matches);
    if(is_array($matches[1])) {
    foreach($matches[1] AS $key => $attribute) {
    $value[strtolower($attribute)] = $matches[3][$key];
    }
    }
    @extract($value);
    return $width == '' ? ($colspan == 1 && $rowspan == 1 ? '[td]' : "[td=$colspan,$rowspan]") : "[td=$colspan,$rowspan,$width]";
    }?>有很多'tag'。。我相信楼主说的东西。。80%的可能性在这里。。仔细研究下。。说不清两个小时就搞定了。。