马上注册,免费下载更多dz插件网资源。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
接上面的内容:https://www.dz-x.net/t/171006/1/1
第3步:统一处理登录/游客内容找到 $needpay_7ree 判断之前,添加统一解码流程(替代原有的两个分支中不同的解码方式)。 修改前:$needpay_7ree 的两个分支处理逻辑不同。
修改后:先对 $this_7ree['message'] 进行循环解码,然后统一进行 discuzcode、反转义、清理CSS。 找到如下代码段(大约100-130行): php
if($needpay_7ree){ // 游客截取内容分支 ...} else { // 登录完整内容分支 ...}
替换为: php
// 统一循环解码(处理多重HTML实体)$prev = '';while ($prev !== $this_7ree['message') { $prev = $this_7ree['message'; $this_7ree['message' = html_entity_decode($this_7ree['message', ENT_QUOTES, 'UTF-8');}// 统一调用discuzcode和反转义$main_message_7ree = discuzcode($this_7ree['message');$main_message_7ree = htmlspecialchars_decode($main_message_7ree, ENT_QUOTES);// 清理冲突CSS$main_message_7ree = cleanDangerousCSS_7ree($main_message_7ree);if($needpay_7ree){ // 游客截取:从已处理好的内容中截取 $length = mb_strlen($main_message_7ree, $substr_char_7ree); $cut_length = max(200, intval($length * 0.3)); $main_message_7ree = mb_substr($main_message_7ree, 0, $cut_length, $substr_char_7ree); // 截取后保留换行 $main_message_7ree = nl2br($main_message_7ree); $free_read_7ree = surplus_freeRead_7ree();}// 注意:$needpay_7ree 为 false 时,$main_message_7ree 已包含完整处理后的内容
同时删除原有的 addCodeTag_7ree 等多余处理。 第4步:修复模板输出变量(若使用手机模板)检查手机端模板 template/touch/library_7ree/page_7ree.htm,将 {$this_7ree['message']} 改为 {$main_message_7ree}。 第5步:清除Discuz模板缓存后台 → 工具 → 更新缓存 → 勾选“模板缓存” → 提交。
或手动删除 data/template/ 目录下相关缓存文件。 验证方法所涉及的文件source/plugin/aieditor_7ree/include/library_7ree/page_7ree.php(核心逻辑) template/touch/library_7ree/page_7ree.htm(手机端模板变量) source/plugin/aieditor_7ree/include/library_7ree/home_7ree.php(首页列表,配套修复)
以上步骤彻底解决了文库详情页的HTML源码显示问题。
©DZ插件网所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。 本站内容为站长个人技术研究记录或网络,不提供用户交互功能,所有内容版权归原作者所有。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,得到更好的正版服务。 您在本站任何的赞助购买、下载、查阅、回复等行为等均表示接受并同意签订《DZ插件网免责声明协议》。 如有侵权请邮件与我们联系处理: discuzaddons@vip.qq.com 并出示相关证明以便删除。敬请谅解!
|