-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathclass-wpwsl-general.php
executable file
·63 lines (54 loc) · 1.33 KB
/
class-wpwsl-general.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
<?php
class WPWSL_General
{
private $file_general_tpl = '_general.php';
private $file_edit_tpl = '_edit.php';
private static $_instance;
/**
* Start up
*/
public static function get_instance()
{
if (!isset(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
private function __clone()
{
}
private function __construct()
{
add_action('admin_menu', [
$this,
'add_plugin_page']);
}
/**
* Add page
*/
public function add_plugin_page()
{
// This page will be under Content manage section.
$parent_slug = WPWSL_GENERAL_PAGE;
$page_title = __('WeChat Subscribers', 'WPWSL');
$menu_title = __('Custom Replies', 'WPWSL');
$capability = 'edit_pages';
$menu_slug = WPWSL_GENERAL_PAGE;
add_submenu_page(
$parent_slug, $page_title, $menu_title, $capability, $menu_slug, [
$this,
'create_admin_page']
);
}
/**
* Options page callback
*/
public function create_admin_page()
{
if (isset($_GET['edit'])) {
require_once( $this->file_edit_tpl);
} else {
require_once( $this->file_general_tpl);
}
}
}