-
Notifications
You must be signed in to change notification settings - Fork 2
/
load.php
47 lines (39 loc) · 1.34 KB
/
load.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
<?php
/**
* 插件装载文件
*
* @package WenPai\PinYin
*/
namespace WenPai\PinYin;
use WenPai\PinYin\Src\{ PinYin, Slug };
/** 载入Composer的自动加载程序 */
require_once 'vendor/autoload.php';
/** 载入公共函数 */
require_once 'src/functions.php';
/** 载入设置项 */
if ( is_admin() && ! ( defined('DOING_AJAX' ) && DOING_AJAX) ) {
require_once 'src/setting.php';
}
/** 载入Meta Box */
if ( is_admin() ) {
require_once 'src/meta-box.php';
}
/** 载入Slug转拼音功能 */
if ( is_admin() ) {
$args = array(
'disable_file_convert' => wppy_get_option( 'disable_file_convert', 'slug_to_pinyin', 'off' ),
'type' => (int)wppy_get_option( 'type', 'slug_to_pinyin', 0 ),
'divider' => wppy_get_option( 'divider', 'slug_to_pinyin', '-' ),
'length' => (int)wppy_get_option( 'length', 'slug_to_pinyin', 60 ),
'baidu_app_id' => wppy_get_option( 'baidu_app_id', 'slug_to_pinyin', '' ),
'baidu_api_key' => wppy_get_option( 'baidu_api_key', 'slug_to_pinyin', '' ),
);
$slug = new Slug( $args );
$slug->register_hook();
}
/** 载入内容注音功能 */
$args = array(
'global_autoload_py' => wppy_get_option( 'global_autoload_py', 'content_add_pinyin', [] ),
);
$pinyin = new PinYin( $args );
$pinyin->register_hook();