脚本格式<?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 |
作者最近主题
相关贴子
- Discuz!论坛防御CC攻击说明
- 语滴城市门户12 gbk2.0 DZ学习研究交流
- [好团队]QQ机器人 201411110(PHP≤5.2) DZ学习研究交流
- 超级VIP用户组购买 支付宝担保自动发货组件 DZ学习研究交流
- DNF网页版源码
- (自适应手机版)响应式高端名贵手表类网站源码 HTML5手表首饰类网站织梦模板
- 地址失效,麻烦根哥更新下
- 下载链接地址失效了 什么时候能恢复
- 链接地址失效
- 版块导航美化 1.8商业版 DZ学习研究交流人民币
- 西瓜分类信更新申请+公众号登陆问题
- 微信登录 0.2 Discuz!&微社区打通专用插件 Comsenz Inc.官方出品
- 云盘链接失效(第三方微信公众平台)
- GPlay社区江湖Ⅱ V1.4.4 谁要?
- 三瑞---品牌123--优惠券伪静态规则
- 主题列表图片显示 4.4 商业版
- 微赞专用微小区6.71全开源解密版 多商户超市|小区缴费|小区拼车|物业管理|租房
- it618积分抽奖 v1.2--------下载地址
- 仿太平洋亲子网源码,母婴类网站源码,A5热卖,dede内核,某站VIP资源
- 请问这个怎么弄的?