脚本格式<?php//全局嵌入点类(必须存在)class plugin_identifier { function HookId_1() { ...... return ...; } function HookId_2() { ...... return ...; } ......//脚本嵌入点类class plugin_identifier_CURSCRIPT extends plugin_identifier { function HookId_1() { ...... return ...; } function HookId_2() { ...... return ...; } ......}?>
插件嵌入点列表
- plugin_
- identifier
- CURSCRIPT
- HookId
函数名 | 调用位置 | 声明位置 | 第一个参数含义 |
HookId() | 所有模块执行前被调用 | 脚本嵌入点类 |
|
HookId_output() | 模块执行完毕,模板输出前被调用 | 脚本嵌入点类 | array('template' => 当前要输出的模版,'message' => showmessage 的信息内容,'values' => showmessage 的信息变量,)
|
global_HookId() | 模块执行完毕,模板输出前被调用 | 全局嵌入点类 |
|
HookId_message() | showmessage() 执行时调用 | 脚本嵌入点类 | array('param' => showmessage() 函数的参数数组,)
|
ad_adId() | 相应的广告位中调用函数名为广告位脚本 ID如:ad_headerbanner()
| 全局嵌入点类脚本嵌入点类
| array('params' => 广告位参数,'content' => 当前广告位原本将要显示的内容,)
|
common() | 所有模块执行前被调用 | 全局嵌入点类 |
|
discuzcode() | discuzcode() 函数执行时调用用于在帖子内容解析时嵌入自己的功能,函数中 $_G['discuzcodemessage'] 变量为待解析的字串
| 全局嵌入点类 | array('param' => caller 函数的参数数组,'caller' => caller 函数,此嵌入点被哪个函数调用'discuzcode' 被 discuzcode() 调用'messagecutstr' 被 messagecutstr() 调用)
|
deletethread() | deletethread() 函数执行时调用用于在主题删除前后嵌入自己的功能,此函数将在 deletethread() 中被调用 2 次,函数中 $_G['deletethreadtids'] 变量为待处理的 TID 数组
| 全局嵌入点类 | array('param' => deletethread() 函数的参数数组,'step' => 删除的步骤'check' 检测步骤'delete' 删除步骤)
|
deletepost() | deletepost() 函数执行时调用用于在帖子删除前后嵌入自己的功能,此函数将在 deletepost() 中被调用 2 次,函数中 $_G['deletepostids'] 变量为待处理的 ID 数组
| 全局嵌入点类 | array('param' => deletepost() 函数的参数数组,'step' => 删除的步骤'check' 检测步骤'delete' 删除步骤)
|
avatar()(X2.5 新增)
| avatar() 函数执行时调用用于在头像调用时嵌入自己的功能,函数中 $_G['hookavatar'] 变量为新头像返回值
| 全局嵌入点类 | array('param' => avatar() 函数的参数数组
) |
要查看所有的预定义嵌入点,请打开 config/config_global.php 文件,将文件结尾添加的设计者模式值改成“2”,然后更新缓存即可。在页面源码中查找"<hook>"可搜索到嵌入点。(详细内容可参阅的《插件嵌入点列表》)
$_config['plugindeveloper'] = 2;预定义的嵌入点会在页面预置好的位置输出函数返回的内容。函数返回值类型如果是 array 且是空值的,必须输出一个空数组,如:
return array();函数名并不限于以上列表,您可以自定义,只要符合以下规则,函数就会在适当的地方被调用。
function CURMODULE_USERDEFINE[_output]()CURMODULE 指明了此函数在哪个模块执行,可通过常量 CURMODULE 得到当前页面的 CURMODULE 值。 USERDEFINE 可自定义,如果函数名以“_output”结尾则会在模板输出前调用,否则会在模块执行前调用。如:attachment_test() 函数会在论坛的下载附件的时候执行。“_output”结尾的函数的第一个参数为数组,含义为 array('template' => 要输出的模板名, 'message' => showmessage 的文字) 如:以下函数将在登录的时候输出调试文字
function logging_test_output($a) { print_r($a); print_r($_POST);}plugin_identifier 类中的其它函数为了便于阅读建议以“_”开头,如:
<?phpclass plugin_sample { function _updatecache() { ...... return ...; }}class plugin_sample_forum extends plugin_sample { function viewthread_posttop() { ...... return ...; } ......}?>
插件嵌入点列表
- 全局(common/)
extcredits.htm string spacecp_credit_extra faq.htm string faq_extra footer.htm string global_footer string global_footerlink header.htm string global_cpnav_top (X2.5) string global_cpnav_extra1 string global_cpnav_extra2 string global_usernav_extra1 string global_usernav_extra2 string global_usernav_extra3 string global_usernav_extra4 (X2.5) string global_nav_extra (X2.5) string global_header userabout.htm array global_userabout_top string userapp_menu_top string userapp_menu_middle array global_userabout_bottom- 论坛(forum/)
- 群组(group/)
- 家园(home/)
- 注册/登录(member/)
- 门户(portal/)
- 排行榜(ranklist/)
- 搜索(search/)
- 应用(userapp/)
- 手机全局(mobile/common/)
- 手机论坛(mobile/forum/)
- 论坛(forum/)
收藏的用户(0)
X
正在加载信息~
评论
发新帖
主题数 8 |
帖子数 3 |
精华数 0 |
注册排名 1 |
作者最近主题
相关贴子
- 柒瑞赛事竞猜 年度版6plush v6.6 价值488.88元
- 开源[1314]帖子图片隐藏 1.0.0 DZ学习研究交流
- DC帖子付费可见 商业版v1.1.8 DZ学习研究交流
- 啦啦外卖2.2.4基础版
- 微擎功能模块,万能客服21.0.0+PC端插件3.8.0,开源版
- S!弹出框 S! 多样弹窗DZ学习研究交流(全网首发)
- 【飞鸟】同城活动 运营版 1.1.1 DZ学习研究交流 · 插件
- 小说阅读器 专业版 最新版本的有吗
- 老街亨利集团开户【抠薇289★105★5534】
- 我付费,怎么没有赠送的礼包,
- discuz x3.4 dz的标签分词服务器挂了吗?自动获取标签怎么都不行?
- 360云盘下载失效,请麻烦提供下载,谢谢
- 【求点贡献】【超人】微社区 商业版-6.0 《仅要1贡献》
- 站长文报道报道 能加贡献吗
- 我要上头条 2.0 免费发布
- 《注册短信验证》全功能版使用视频教程-插件使用概述和说明
- 克米设计V3.1帖子页面出现您访问的页面无手机页面 是否进一步访问电脑版
- 米花微信同城社区附近商圈6.6.5修复版,小程序后台+前端源码,增加诸多功能
- DZ学习研究交流的S!微信砍价/助力 2.1.1 PHP5.2 PHP5.3
- 第37团:DZ学习研究交流克米-努比亚微资讯 商业版_GBK