导读:一、开发插件所需资料与工具 1、DiscuzX3 插件机制插件机制Discuz! 拥有一套完整的插件机制。合理使用插件机制,你可以更好的将自...
好的位置输出函数返回的内容。函数返回值类型如果是 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_qmenu_top (X3) string global_qmenu_bottom (X3) 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 userstatus.htm string global_usernav_extra1 string global_usernav_extra2 string global_usernav_extra3 string global_usernav_extra4 (X2.5)
• 论坛(forum/)
collection_all.htm (X2.5) string collection_index_top string collection_index_bottom collection_comment.htm (X2.5) string collection_nav_extra collection_index.htm (X2.5) string collection_index_top string collection_index_bottom collection_mycollection.htm (X2.5) string collection_index_top string collection_index_bottom collection_nav.htm (X2.5) string collection_nav_extra collection_view.htm (X2.5) string collection_viewoptions string collection_view_top string collection_threadlistbottom string collection_relatedop string collection_view_bottom string collection_side_bottom discuz.htm string index_status_extra string index_nav_extra (X2.5) string index_top string index_catlist_top (X2.5) array index_followcollection_extra (X3) array index_favforum_extra (X2.5) array index_favforum_extra (X3) array index_catlist (X2.5) array index_forum_extra (X2.5) array index_forum_extra (X2.5) array index_datacollection_extra (X3) string index_middle string index_bottom string index_side_top string index_side_bottom discuzcode.htm array viewthread_attach_extra (X2.5) editor_menu_forum.htm string post_image_btn_extra string post_image_tab_extra string post_attach_btn_extra string post_attach_tab_extra forumdisplay.htm string forumdisplay_leftside_top string forumdisplay_leftside_bottom string forumdisplay_forumaction string forumdisplay_modlink string forumdisplay_top string forumdisplay_middle string forumdisplay_postbutton_top string forumdisplay_threadtype_inner (X2.5) string forumdisplay_filter_extra (X2.5) string forumdisplay_threadtype_extra (X2.5) string forumdisplay_bottom string forumdisplay_side_top string forumdisplay_side_bottom forumdisplay_fastpost.htm string forumdisplay_fastpost_content string forumdisplay_fastpost_func_extra string forumdisplay_fastpost_ctrl_extra string