脚本格式<?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 |
作者最近主题
相关贴子
- 为什么加QQ群没有反应??
- 球星蓝科技的旅游模板
- 微信婚恋交友平台 3.0 DZ学习研究交流
- Discuz! PageSpeed论坛加速模块发布更新1.12.34.2稳定版(2017.06.19更新)
- 【飞鸟】支付中心 独享版 1.7.4 DZ学习研究交流
- S!主题列表页图片 2.0 DZ学习研究交流
- a'ゞ★→こ 空心印っ xiaolongjcw@vip.qq.com(1353968410) 待处理
- aijiacms添加小区失败
- 【CSU】担保交易 未加密 DZ学习研究交流
- 老街皇家利华大酒店微信【抠薇289★105★5534】
- 赞助我们 V2.1.1.1价值18.8元
- 我已经付款18元,但还没有贡献
- it618视频直播学院 音频点播直播 v4.0 DZ学习研究交流 · 插件(全网首发)
- 请问,怎么开启独立的移动端域名?
- 一键切换简繁体 2.5加强版 免费下载
- 奉献给论坛几个插件,麻烦站长窝开源下
- [转载]Discuz!X微信公众平台接口开发框架 For NodeJS
- 超级VIP用户组购买 打包版 DZ学习研究交流(2015.7.2更新)
- 底部工具_通用版 1.0.1 DZ学习研究交流 免费下载
- 犀牛活动首页DIY