-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsettings.php
More file actions
75 lines (64 loc) · 1.52 KB
/
settings.php
File metadata and controls
75 lines (64 loc) · 1.52 KB
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
<?php
class Settings
{
public $fcmAccessKey;
public $mobileTags;
public $sendOnUpdate;
/**
* Constructor
*/
public function __construct()
{
$this->fcmAccessKey = get_option('wppn_fcm_access_key');
$this->mobileTags = explode(',', get_option('wppn_posts_mobile_tags'));
$this->sendOnUpdate = get_option('wppn_send_on_update') === 'on';
}
public function init()
{
// register a new setting for "reading" page
register_setting('general', 'wppn_fcm_access_key');
register_setting('general', 'wppn_posts_mobile_tags');
register_setting('general', 'wppn_send_on_update');
add_settings_section(
'wppn_section',
'WP Push Notify',
[$this, 'sectionDescription'],
'general'
);
add_settings_field(
'wppn_fcm_access_key',
'FCM Access Key',
[$this, 'inputFcmAccessKey'],
'general',
'wppn_section'
);
add_settings_field(
'wppn_posts_mobile_tags',
'Post tags',
[$this, 'inputPostTags'],
'general',
'wppn_section'
);
add_settings_field(
'wppn_send_on_update',
'Send on post update',
[$this, 'inputSendOnUpdate'],
'general',
'wppn_section'
);
}
public function inputFcmAccessKey()
{
include 'include/input-fcm-access-key.php';
}
public function inputPostTags()
{
include 'include/input-post-tags.php';
}
public function inputSendOnUpdate()
{
include 'include/input-send-on-update.php';
}
public function sectionDescription()
{ }
}