-
Notifications
You must be signed in to change notification settings - Fork 3
/
Plugin.php
88 lines (80 loc) · 2.51 KB
/
Plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* <i>JixinParser->superLink();</i><br>无需再记忆短代码,只要输入符合解析规则的链接,就可解析为对应的卡片😎 <a href="https://github.com/ShangJixin/Typecho-Plugin-superLink">去 Github 仓库查看 superLink 支持了哪些解析 ›</a>
*
* @package superLink
* @author 尚寂新
* @version 1.6
* @link https://github.com/ShangJixin/Typecho-Plugin-superLink
*/
class superLink_Plugin implements Typecho_Plugin_Interface
{
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx= array("superLink_Plugin", 'render');
Typecho_Plugin::factory('Widget_Archive')->header = array(__CLASS__, 'header');
Typecho_Plugin::factory('Widget_Archive')->footer = array(__CLASS__, 'footer');
}
/**
* 禁用插件方法,如果禁用失败,直接抛出异常
*
* @static
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function deactivate(){}
/**
* 获取插件配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form 配置面板
* @return void
*/
public static function config(Typecho_Widget_Helper_Form $form){}
/**
* 个人用户的配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form
* @return void
*/
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
/**
* 插件实现方法
*
* @access public
* @return void
*/
public static function render($text, Widget_Abstract_Contents $archive){
//$text = "Plugin";
//JixinParser
require_once('JixinParser.php');
$JixinParser = new JixinParser;
$text = $JixinParser->superLink($text);
return $text;
}
/**
* 为header添加css文件
*
* @return void
*/
public static function header() {
echo '<link rel="stylesheet" href="'.Helper::options()->pluginUrl .'/superLink/superlink.css?ver=2024.01.14.02" />';
}
/**
* 为footer添加js文件
*
* @return void
*/
public static function footer() {
echo '<script src="'.Helper::options()->pluginUrl .'/superLink/superlink.js?ver=2024.01.19.01"></script>';
}
}