-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetting.php
More file actions
192 lines (179 loc) · 6.18 KB
/
setting.php
File metadata and controls
192 lines (179 loc) · 6.18 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.10/clipboard.min.js"></script>
<script>
var clipboard = new Clipboard('.action')
function show_advances_info() {
document.querySelector('#advanced').style.display = 'block';
document.querySelector('.advanced_info_button_area').style.display = 'none';
}
</script>
<div class="wrap">
<h2>Push7 Setting</h2>
<form action="options.php" method="post">
<?php
settings_fields('push7-settings-group');
do_settings_sections('push7-settings-group');
?>
<table class="form-table">
<tbody>
<tr>
<th>
<label for="blog_title">ブログのタイトル(任意)</label>
</th>
<td>
<?php
if (get_option('push7_blog_title')) {
?>
<input type="text" id="push7_blog_title" class="regular-text" name="push7_blog_title" value="<?= esc_attr( get_option( 'push7_blog_title' ) ); ?>">
<?php
} else {
?>
<input type="text" id="push7_blog_title" class="regular-text" name="push7_blog_title" placeholder="<?= esc_attr( get_option( 'blogname' ) ); ?>">
<?php
}
?>
</td>
</tr>
<tr>
<th>
<label for="appno">App Number</label>
</th>
<td>
<input type="text" id="push7_appno" class="regular-text" name="push7_appno" value="<?= esc_attr(get_option('push7_appno')); ?>">
</td>
</tr>
<tr>
<th>
<label for="apikey">API Key</label>
</th>
<td>
<input type="text" id="push7_apikey" class="regular-text" name="push7_apikey" value="<?= esc_attr(get_option('push7_apikey')); ?>">
</td>
</tr>
<tr>
<th>
<label for="push7_sdk_enabled">
Push7SDKを有効にする
</label>
</th>
<td>
<fieldset>
<label title="true">
<input type="radio" name="push7_sdk_enabled" value="true" <?php checked("true", get_option("push7_sdk_enabled")); ?>>
する
</label>
<br>
<label title="false">
<input type="radio" name="push7_sdk_enabled" value="false" <?php checked("false", get_option("push7_sdk_enabled")); ?>>
しない
</label>
</fieldset>
</td>
</tr>
</tbody>
</table>
<?php
$categories = get_categories();
if (count($categories) !== 0) {
?>
<h2 class="title">カテゴリ毎のプッシュ通知設定</h2>
<table class="form-table">
<tbody>
<tr>
<th>新規投稿時自動プッシュする</th>
<td>
<?php
foreach ($categories as $category) {
$name = "push7_push_ctg_".$category->slug;
?>
<label for="<?= $name; ?>">
<input type="checkbox" name="<?= $name; ?>" value="true" <?php checked("true", get_option($name)) ?>>
<?= $category->name; ?>
</label>
<br>
<?php
}
?>
<p class="description">ここでチェックを外したカテゴリを含んだ投稿は自動でのプッシュ通知が行われません。</p>
</td>
</tr>
</tbody>
</table>
<?php
}
?>
<?php
if (count(Push7::post_types()) >= 2) {
?>
<h2 class="title">投稿タイプ毎のプッシュ通知設定</h2>
<table class="form-table">
<tbody>
<tr>
<th>新規投稿時自動プッシュする</th>
<td>
<?php
foreach (Push7::post_types() as $post_type) {
$name = "push7_push_pt_".$post_type;
?>
<label for="<?= $name; ?>">
<input type="checkbox" name="<?= $name;?>" value="true" <?php checked("true", get_option($name)) ?>>
<?= $post_type === 'post' ? 'post(通常の投稿)' : $post_type; ?>
</label>
<br>
<?php
}
?>
</td>
</tr>
</tbody>
</table>
<?php
}
?>
<div class="advanced_info_button_area">
<button type="button" class="button action" onclick="show_advances_info()">高度な設定を表示する</button>
<p>
基本的に表示する必要はありません。
</p>
</div>
<div id="advanced" style="display: none;">
<h2 class="title">高度な設定</h2>
<table class="form-table">
<tbody>
<tr>
<th>
<label for="push7_sslverify_disabled">
SSLの検証を無効化する
</label>
</th>
<td>
<fieldset>
<label title="true">
<input type="radio" name="push7_sslverify_disabled" value="true" <?php checked("true", get_option("push7_sslverify_disabled")); ?>>
する
</label>
<br>
<label title="false">
<input type="radio" name="push7_sslverify_disabled" value="false" <?php checked("false", get_option("push7_sslverify_disabled")); ?>>
しない
</label>
</fieldset>
<span>(必要のない場合には選択しないでください。)</span>
</td>
</tr>
<tr>
<th>
<label for="push7_sslverify_disabled">
デバッグ情報
</label>
</th>
<td>
<input id="debug_dump" rows="5" value="<?= $this->debug_dump(); ?>"></input>
<button type="button" class="button action" data-clipboard-target="#debug_dump">コピーする</button>
</td>
</tr>
</tbody>
</table>
</div>
<?php submit_button(); ?>
</form>
</div>