-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathPlugin.php
44 lines (39 loc) · 993 Bytes
/
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
<?php
/**
* Parsedown
*
* @package Parsedown Plugin
* @author Kokororin
* @version 1.0
* @link https://kotori.love
*/
class Parsedown_Plugin implements Typecho_Plugin_Interface
{
/**
* 激活插件
*/
public static function activate()
{
Typecho_Plugin::factory('Widget_Abstract_Contents')->markdown = array('Parsedown_Plugin', 'markdown');
Typecho_Plugin::factory('Widget_Abstract_Comments')->markdown = array('Parsedown_Plugin', 'markdown');
}
/**
* 禁用插件
*/
public static function deactivate()
{}
/**
* 插件设置
*/
public static function config(Typecho_Widget_Helper_Form $form)
{}
public static function personalConfig(Typecho_Widget_Helper_Form $form)
{}
public static function markdown($text)
{
require_once dirname(__FILE__) . '/Parsedown.php';
return Parsedown::instance()
->setBreaksEnabled(true)
->text($text);
}
}