@@ -49,20 +49,13 @@ public static function deactivate(){}
49
49
* @return void
50
50
*/
51
51
public static function config (Typecho_Widget_Helper_Form $ form ){
52
- /** 列表A标签点赞的class */
53
- $ listLikeClass = new Typecho_Widget_Helper_Form_Element_Text (
54
- 'listClass ' , NULL ,'list-like ' ,
55
- _t ('列表点赞A标签的class ' ),
56
- _t ('列表页点赞的自定义样式,默认为.list-like可自写CSS样式 ' )
57
- );
58
- $ form ->addInput ($ listLikeClass );
59
52
/** 文章页A标签点赞的class */
60
- $ postLikeClass = new Typecho_Widget_Helper_Form_Element_Text (
61
- 'postClass ' ,NULL ,'post-like ' ,
62
- _t ('文章点赞A标签的class ' ),
63
- _t ('文章页点赞的自定义样式 ,默认为.post-like可自写CSS样式 ' )
53
+ $ likeClass = new Typecho_Widget_Helper_Form_Element_Text (
54
+ 'likeClass ' ,NULL ,'post-like ' ,
55
+ _t ('点赞A标签的class ' ),
56
+ _t ('点赞的自定义样式 ,默认为.post-like。可自定义CSS样式,无需加. ' )
64
57
);
65
- $ form ->addInput ($ postLikeClass );
58
+ $ form ->addInput ($ likeClass );
66
59
}
67
60
68
61
/**
@@ -85,15 +78,16 @@ public static function personalConfig(Typecho_Widget_Helper_Form $form){
85
78
* 输出: 0
86
79
*
87
80
* @access public
88
- * @param bool $link 是否输入链接 (false为显示纯数字,用于自定义显示样式 )
81
+ * @param bool $link 是否输入链接 (false为显示纯数字)
89
82
* @return string
90
83
*/
91
84
public static function theLikes ($ link = true ){
92
85
$ db = Typecho_Db::get ();
93
86
$ cid = Typecho_Widget::widget ('Widget_Archive ' )->cid ;
94
87
$ row = $ db ->fetchRow ($ db ->select ('likes ' )->from ('table.contents ' )->where ('cid = ? ' , $ cid ));
95
88
if ($ link ){
96
- echo '<a href="javascript:;" class="post-like" data-pid=" ' .$ cid .'"><i class="fa-thumbs-up"></i>赞 (<span> ' .$ row ['likes ' ].'</span>)</a> ' ;
89
+ $ settings = Helper::options ()->plugin ('Likes ' );
90
+ echo '<a href="javascript:;" class=" ' .$ settings ->likeClass .'" data-pid=" ' .$ cid .'"><i class="fa-thumbs-up"></i>赞 (<span> ' .$ row ['likes ' ].'</span>)</a> ' ;
97
91
}else {
98
92
return $ row ['likes ' ];
99
93
}
@@ -111,10 +105,9 @@ public static function theLikes($link = true){
111
105
* @param string $after 后字串
112
106
* @return string
113
107
*/
114
- public static function theMostLiked ($ limit = 10 , $ shownum = true , $ before = '<br/> - ( 访问 : ' , $ after = ' 次 ) ' )
108
+ public static function theMostLiked ($ limit = 10 , $ shownum = true , $ before = '<br/> - ( 点赞 : ' , $ after = ' 次 ) ' )
115
109
{
116
110
$ db = Typecho_Db::get ();
117
- $ options = Typecho_Widget::widget ('Widget_Options ' );
118
111
$ limit = is_numeric ($ limit ) ? $ limit : 10 ;
119
112
$ posts = $ db ->fetchAll ($ db ->select ()->from ('table.contents ' )
120
113
->where ('type = ? AND status = ? AND password IS NULL ' , 'post ' , 'publish ' )
0 commit comments