这是本文档旧的修订版!


插件接口及功能列表

Widget内置的接口

在Typecho中只要这个类是继承自Typecho_Widget基类,它就默认具备了这个插件接口。接口开发者可以使用这个接口无缝地向当前的Class中注入方法

比如我要给Widget_Archive类增加一个方法获取当前文章的字数(charactersNum),只需要在你的插件`activate`方法中声明

Typecho_Plugin::factory('Widget_Archive')->___charactersNum = array('MyPlugin', 'charactersNum');

注意,我们在方法名前面加三个下划线表示这是一个内部方法。而实现这个方法也很简单,因为系统会将当前的对象作为参数传递给你

public static function charactersNum($archive)
{
    return mb_strlen($archive->text, 'UTF-8');
}

那么这个方法就已经植入到Widget_Archive中去了,你在模版中可以直接调用如下代码输出它

<?php $this->charactersNum(); ?>

句柄接口

Widget_Archive

接口 参数 描述 因为继承同样具有此接口的句柄
indexHandle Widget_Archive对象
$select
error404Handle Widget_Archive对象
$select
singleHandle Widget_Archive对象
$select
categoryHandle Widget_Archive对象
$select
tagHandle Widget_Archive对象
$select
authorHandle Widget_Archive对象
$select
dateHandle Widget_Archive对象
$select
search $keywords
Widget_Archive对象
searchHandle Widget_Archive对象
$select
query Widget_Archive对象
$select
select Widget_Archive对象
handleInit Widget_Archive对象
$select
handle $parameter->type
Widget_Archive对象
$select
pageNav $currentPage
$total
$parameter->pageSize
$prev
$next
$splitPage
$splitWord
headerOptions $allows
Widget_Archive对象
header $header
Widget_Archive对象
footer Widget_Archive对象
beforeRender Widget_Archive对象
afterRender Widget_Archive对象
commentFeedItem $feedType
$comments
feedItem $feedType
Widget_Archive对象

Widget_Feedback

接口 参数 描述 因为继承同样具有此接口的句柄
comment $comment
$content
finishComment Widget_Feedback对象
trackback $trackback
$content
finishTrackback Widget_Feedback对象

Widget_Login

接口 参数 描述 因为继承同样具有此接口的句柄
loginFail $user
$request->name
$request->password
1 == $request->remember
loginSucceed $user
$request->name
$request->password
1 == $request->remember

Widget_Logout

接口 参数 描述 因为继承同样具有此接口的句柄
logout

Widget_Register

接口 参数 描述 因为继承同样具有此接口的句柄
register $dataStruct
finishRegister Widget_Register对象

Widget_Upload

接口 参数 描述 因为继承同样具有此接口的句柄
beforeUpload $result
upload Widget_Upload对象
beforeModify $result
modify Widget_Upload对象

Widget_User

接口 参数 描述 因为继承同样具有此接口的句柄
login $name
$password
$temporarily
$expire
hashValidate $password
$user['password']
loginSucceed Widget_User对象
$name
$password
$temporarily
$expire
loginFail Widget_User对象
$name
$password
$temporarily
$expire
logout

Widget_XmlRpc

接口 参数 描述 因为继承同样具有此接口的句柄
textFilter $input['text']
Widget_XmlRpc对象
upload Widget_XmlRpc对象
pingback $pingback
$post
finishPingback Widget_XmlRpc对象

Widget_Abstract_Comments

接口 参数 描述 因为继承同样具有此接口的句柄
content $text
Widget_Abstract_Comments对象
Widget_Feedback
Widget_Comments_Admin
Widget_Comments_Archive
Widget_Comments_Edit
Widget_Comments_Ping
Widget_Comments_Recent
contentEx $text
Widget_Abstract_Comments对象
Widget_Feedback
Widget_Comments_Admin
Widget_Comments_Archive
Widget_Comments_Edit
Widget_Comments_Ping
Widget_Comments_Recent
filter $value
Widget_Abstract_Comments对象
Widget_Feedback
Widget_Comments_Admin
Widget_Comments_Archive
Widget_Comments_Edit
Widget_Comments_Ping
Widget_Comments_Recent
gravatar $size
$rating
$default
Widget_Abstract_Comments对象
Widget_Feedback
Widget_Comments_Admin
Widget_Comments_Archive
Widget_Comments_Edit
Widget_Comments_Ping
Widget_Comments_Recent
autoP $text Widget_Feedback
Widget_Comments_Admin
Widget_Comments_Archive
Widget_Comments_Edit
Widget_Comments_Ping
Widget_Comments_Recent
markdown $text Widget_Feedback
Widget_Comments_Admin
Widget_Comments_Archive
Widget_Comments_Edit
Widget_Comments_Ping
Widget_Comments_Recent

Widget_Abstract_Contents

接口 参数 描述 因为继承同样具有此接口的句柄
excerpt $text
Widget_Abstract_Contents对象
Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
excerptEx $excerpt
Widget_Abstract_Contents对象
Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
content $text
Widget_Abstract_Contents对象
Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
contentEx $content
Widget_Abstract_Contents对象
Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
isFieldReadOnly $name Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
filter $value
Widget_Abstract_Contents对象
Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
title $title
Widget_Abstract_Contents对象
Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
autoP $text Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author
markdown $text Widget_Archive
Widget_Upload
Widget_XmlRpc
Widget_Contents_Related
Widget_Contents_Attachment_Admin
Widget_Contents_Attachment_Related
Widget_Contents_Attachment_Unattached
Widget_Contents_Page_List
Widget_Contents_Post_Admin
Widget_Contents_Page_Admin
Widget_Contents_Post_Edit
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
Widget_Contents_Post_Recent
Widget_Contents_Related_Author

Widget_Abstract_Metas

接口 参数 描述 因为继承同样具有此接口的句柄
filter $value
Widget_Abstract_Metas对象
Widget_Metas_Category_Edit
Widget_Metas_Category_List
Widget_Metas_Category_Admin
Widget_Metas_Tag_Cloud
Widget_Metas_Tag_Admin
Widget_Metas_Tag_Edit

Widget_Abstract_Users

接口 参数 描述 因为继承同样具有此接口的句柄
filter $value
Widget_Abstract_Users对象
Widget_Login
Widget_Logout
Widget_Register
Widget_Users_Admin
Widget_Users_Author
Widget_Users_Edit
Widget_Users_Profile

Widget_Comments_Archive

接口 参数 描述 因为继承同样具有此接口的句柄
listComments $singleCommentOptions
Widget_Comments_Archive对象
reply $word
Widget_Comments_Archive对象
cancelReply $word
Widget_Comments_Archive对象

Widget_Comments_Edit

接口 参数 描述 因为继承同样具有此接口的句柄
mark $comment
Widget_Comments_Edit对象
$status
delete $comment
Widget_Comments_Edit对象
finishDelete $comment
Widget_Comments_Edit对象
edit $comment
Widget_Comments_Edit对象
finishEdit Widget_Comments_Edit对象
comment $comment
Widget_Comments_Edit对象
finishComment Widget_Comments_Edit对象

Widget_Contents_Attachment_Edit

接口 参数 描述 因为继承同样具有此接口的句柄
delete $post
Widget_Contents_Attachment_Edit对象
finishDelete $post
Widget_Contents_Attachment_Edit对象
delete $post
Widget_Contents_Attachment_Edit对象
finishDelete $post
Widget_Contents_Attachment_Edit对象

Widget_Contents_Page_Edit

接口 参数 描述 因为继承同样具有此接口的句柄
write $contents
Widget_Contents_Page_Edit对象
finishPublish $contents
Widget_Contents_Page_Edit对象
finishSave $contents
Widget_Contents_Page_Edit对象
delete $page
Widget_Contents_Page_Edit对象
finishDelete $page
Widget_Contents_Page_Edit对象

Widget_Contents_Post_Edit

接口 参数 描述 因为继承同样具有此接口的句柄
getDefaultFieldItems $layout Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
write $contents
Widget_Contents_Post_Edit对象
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
finishPublish $contents
Widget_Contents_Post_Edit对象
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
finishSave $contents
Widget_Contents_Post_Edit对象
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
delete $post
Widget_Contents_Post_Edit对象
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit
finishDelete $post
Widget_Contents_Post_Edit对象
Widget_Contents_Attachment_Edit
Widget_Contents_Page_Edit

Widget_Metas_Category_List

接口 参数 描述 因为继承同样具有此接口的句柄
listCategories $categoryOptions
Widget_Metas_Category_List对象
Widget_Metas_Category_Admin

打印/导出
语言
 ?