Version Description
- Added escaping to fields in OneSignal config to remove invalid characters, bug fixes
Download this release
Release Info
Developer | OneSignal |
Plugin | OneSignal – Free Web Push Notifications |
Version | 1.17.8 |
Comparing to | |
See all releases |
Code changes from version 1.17.7 to 1.17.8
- notice.js +2 -1
- onesignal-admin.php +4 -4
- onesignal-public.php +285 -289
- onesignal.php +1 -1
- readme.txt +5 -1
- views/config.php +142 -82
notice.js
CHANGED
@@ -149,7 +149,8 @@ function notice() {
|
|
149 |
notice_text +
|
150 |
recipients +
|
151 |
" recipient" +
|
152 |
-
plural
|
|
|
153 |
{
|
154 |
id:'onesignal-notice',
|
155 |
isDismissible: true
|
149 |
notice_text +
|
150 |
recipients +
|
151 |
" recipient" +
|
152 |
+
plural +
|
153 |
+
". Go to your app's \"Delivery\" tab to check sent and scheduled messages: https://app.onesignal.com/apps/",
|
154 |
{
|
155 |
id:'onesignal-notice',
|
156 |
isDismissible: true
|
onesignal-admin.php
CHANGED
@@ -773,8 +773,8 @@ class OneSignal_Admin
|
|
773 |
'contents' => array('en' => $notif_content),
|
774 |
);
|
775 |
|
776 |
-
if ($new_status == 'future'
|
777 |
-
if ($old_uuid_array[0] != $uuid) {
|
778 |
self::cancel_scheduled_notification($post);
|
779 |
}
|
780 |
|
@@ -926,7 +926,7 @@ class OneSignal_Admin
|
|
926 |
if ($recipient_count != 0) {
|
927 |
set_transient('onesignal_transient_success', '<div class="components-notice is-success is-dismissible">
|
928 |
<div class="components-notice__content">
|
929 |
-
<p><strong>OneSignal Push:</strong><em> Successfully '.$sent_or_scheduled.' a notification to '.$recipient_count.' recipients
|
930 |
</div>
|
931 |
</div>', 86400);
|
932 |
} else {
|
@@ -959,7 +959,7 @@ class OneSignal_Admin
|
|
959 |
|
960 |
public static function cancel_scheduled_notification($post)
|
961 |
{
|
962 |
-
$notification_id = get_post_meta($post->ID, 'notification_id')
|
963 |
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
964 |
|
965 |
$onesignal_delete_url = 'https://onesignal.com/api/v1/notifications/'.$notification_id.'?app_id='.$onesignal_wp_settings['app_id'];
|
773 |
'contents' => array('en' => $notif_content),
|
774 |
);
|
775 |
|
776 |
+
if ($new_status == 'future') {
|
777 |
+
if ($old_uuid_array && $old_uuid_array[0] != $uuid) {
|
778 |
self::cancel_scheduled_notification($post);
|
779 |
}
|
780 |
|
926 |
if ($recipient_count != 0) {
|
927 |
set_transient('onesignal_transient_success', '<div class="components-notice is-success is-dismissible">
|
928 |
<div class="components-notice__content">
|
929 |
+
<p><strong>OneSignal Push:</strong><em> Successfully '.$sent_or_scheduled.' a notification to '.$recipient_count.' recipients. Go to your app\'s "Delivery" tab to check sent and scheduled messages: <a target="_blank" href="https://app.onesignal.com/apps/">https://app.onesignal.com/apps/</a></em></p>
|
930 |
</div>
|
931 |
</div>', 86400);
|
932 |
} else {
|
959 |
|
960 |
public static function cancel_scheduled_notification($post)
|
961 |
{
|
962 |
+
$notification_id = get_post_meta($post->ID, 'notification_id', true);
|
963 |
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
964 |
|
965 |
$onesignal_delete_url = 'https://onesignal.com/api/v1/notifications/'.$notification_id.'?app_id='.$onesignal_wp_settings['app_id'];
|
onesignal-public.php
CHANGED
@@ -1,114 +1,121 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
defined(
|
4 |
-
|
5 |
-
function onesignal_debug() {
|
6 |
-
if (!defined('ONESIGNAL_DEBUG') && !class_exists('WDS_Log_Post')) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
$numargs = func_num_args();
|
10 |
-
$arg_list = func_get_args();
|
11 |
-
$bt = debug_backtrace();
|
12 |
-
$output = '[' . $bt[1]['function'] . '] ';
|
13 |
-
for ($i = 0; $i < $numargs; $i ++) {
|
14 |
-
$arg = $arg_list[ $i ];
|
15 |
-
|
16 |
-
if (is_string($arg)) {
|
17 |
-
$arg_output = $arg;
|
18 |
-
} else {
|
19 |
-
$arg_output = var_export($arg, true);
|
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 |
-
function onesignal_debug_post($post)
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
'Post Date' => $post->post_date,
|
50 |
'Modified Date' => $post->post_modified,
|
51 |
'Title' => $post->post_title,
|
52 |
'Status:' => $post->post_status,
|
53 |
-
'Type:' => $post->post_type));
|
54 |
}
|
55 |
|
56 |
-
class OneSignal_Public
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
add_action('wp_head', array(__CLASS__, 'onesignal_header'), 10);
|
62 |
-
}
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
if ($onesignal_wp_settings !== false && array_key_exists('gcm_sender_id', $onesignal_wp_settings)) {
|
68 |
-
$gcm_sender_id = $onesignal_wp_settings['gcm_sender_id'];
|
69 |
-
} else {
|
70 |
-
$gcm_sender_id = 'WORDPRESS_NO_SENDER_ID_ENTERED';
|
71 |
}
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
<link rel="manifest"
|
75 |
-
href="<?php echo
|
76 |
<?php
|
77 |
-
|
78 |
-
|
79 |
<link rel="manifest"
|
80 |
-
href="<?php echo
|
81 |
<?php
|
|
|
82 |
}
|
83 |
-
}
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
<meta name="onesignal" content="wordpress-plugin"/>
|
89 |
<?php
|
90 |
-
|
91 |
|
92 |
-
|
93 |
-
|
|
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
?>
|
105 |
<?php
|
106 |
if (defined('ONESIGNAL_DEBUG') && defined('ONESIGNAL_LOCAL')) {
|
107 |
echo '<script src="https://localhost:3001/sdks/OneSignalSDK.js" async></script>';
|
108 |
-
|
109 |
echo '<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script>';
|
110 |
-
|
111 |
-
?>
|
112 |
<script>
|
113 |
|
114 |
window.OneSignal = window.OneSignal || [];
|
@@ -120,282 +127,271 @@ class OneSignal_Public {
|
|
120 |
|
121 |
<?php
|
122 |
|
123 |
-
if ($onesignal_wp_settings['default_icon'] !=
|
124 |
-
|
125 |
}
|
126 |
|
127 |
-
if ($onesignal_wp_settings['default_url'] !=
|
128 |
-
|
129 |
-
}
|
130 |
-
|
131 |
-
|
132 |
-
}
|
133 |
-
?>
|
134 |
var oneSignal_options = {};
|
135 |
window._oneSignalInitOptions = oneSignal_options;
|
136 |
|
137 |
<?php
|
138 |
echo "oneSignal_options['wordpress'] = true;\n";
|
139 |
-
echo "oneSignal_options['appId'] = '"
|
140 |
|
141 |
-
if ($onesignal_wp_settings[
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
echo "oneSignal_options['autoRegister'] = false;\n";
|
146 |
}
|
147 |
|
148 |
-
if ($onesignal_wp_settings[
|
149 |
-
|
150 |
-
|
151 |
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
}
|
158 |
|
159 |
-
if ($onesignal_wp_settings[
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
}
|
167 |
-
|
168 |
-
|
169 |
-
echo "oneSignal_options['welcomeNotification']['disable'] = true;\n";
|
170 |
}
|
171 |
|
172 |
-
if ($onesignal_wp_settings[
|
173 |
-
|
174 |
-
}
|
175 |
-
|
176 |
-
echo "oneSignal_options['path'] = \"" . $current_plugin_url . "sdk_files/\";\n";
|
177 |
}
|
178 |
|
179 |
-
if (@$onesignal_wp_settings[
|
180 |
-
|
181 |
}
|
182 |
|
183 |
-
if ($onesignal_wp_settings[
|
184 |
-
|
185 |
-
}
|
186 |
-
|
187 |
-
echo "oneSignal_options['persistNotification'] = true;\n";
|
188 |
}
|
189 |
|
190 |
echo "oneSignal_options['promptOptions'] = { };\n";
|
191 |
-
if (array_key_exists('prompt_customize_enable', $onesignal_wp_settings) && $onesignal_wp_settings[
|
192 |
-
|
193 |
-
|
194 |
-
}
|
195 |
-
if ($onesignal_wp_settings["prompt_example_notification_title_desktop"] != "") {
|
196 |
-
echo "oneSignal_options['promptOptions']['exampleNotificationTitleDesktop'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_example_notification_title_desktop"]) . "';\n";
|
197 |
-
}
|
198 |
-
if ($onesignal_wp_settings["prompt_example_notification_message_desktop"] != "") {
|
199 |
-
echo "oneSignal_options['promptOptions']['exampleNotificationMessageDesktop'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_example_notification_message_desktop"]) . "';\n";
|
200 |
-
}
|
201 |
-
if ($onesignal_wp_settings["prompt_example_notification_title_mobile"] != "") {
|
202 |
-
echo "oneSignal_options['promptOptions']['exampleNotificationTitleMobile'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_example_notification_title_mobile"]) . "';\n";
|
203 |
-
}
|
204 |
-
if ($onesignal_wp_settings["prompt_example_notification_message_mobile"] != "") {
|
205 |
-
echo "oneSignal_options['promptOptions']['exampleNotificationMessageMobile'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_example_notification_message_mobile"]) . "';\n";
|
206 |
-
}
|
207 |
-
if ($onesignal_wp_settings["prompt_example_notification_caption"] != "") {
|
208 |
-
echo "oneSignal_options['promptOptions']['exampleNotificationCaption'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_example_notification_caption"]) . "';\n";
|
209 |
-
}
|
210 |
-
if ($onesignal_wp_settings["prompt_accept_button_text"] != "") {
|
211 |
-
echo "oneSignal_options['promptOptions']['acceptButtonText'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_accept_button_text"]) . "';\n";
|
212 |
-
}
|
213 |
-
if ($onesignal_wp_settings["prompt_cancel_button_text"] != "") {
|
214 |
-
echo "oneSignal_options['promptOptions']['cancelButtonText'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_cancel_button_text"]) . "';\n";
|
215 |
-
}
|
216 |
-
if ($onesignal_wp_settings["prompt_site_name"] != "") {
|
217 |
-
echo "oneSignal_options['promptOptions']['siteName'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_site_name"]) . "';\n";
|
218 |
-
}
|
219 |
-
if ($onesignal_wp_settings["prompt_auto_accept_title"] != "") {
|
220 |
-
echo "oneSignal_options['promptOptions']['autoAcceptTitle'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["prompt_auto_accept_title"]) . "';\n";
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
if (array_key_exists('notifyButton_enable', $onesignal_wp_settings) && $onesignal_wp_settings["notifyButton_enable"] == "1") {
|
225 |
-
echo "oneSignal_options['notifyButton'] = { };\n";
|
226 |
-
echo "oneSignal_options['notifyButton']['enable'] = true;\n";
|
227 |
-
|
228 |
-
|
229 |
-
if (array_key_exists('notifyButton_position', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_position'] != "") {
|
230 |
-
echo "oneSignal_options['notifyButton']['position'] = '" . $onesignal_wp_settings["notifyButton_position"] . "';\n";
|
231 |
-
}
|
232 |
-
if (array_key_exists('notifyButton_theme', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_theme'] != "") {
|
233 |
-
echo "oneSignal_options['notifyButton']['theme'] = '" . $onesignal_wp_settings["notifyButton_theme"] . "';\n";
|
234 |
-
}
|
235 |
-
if (array_key_exists('notifyButton_size', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_size'] != "") {
|
236 |
-
echo "oneSignal_options['notifyButton']['size'] = '" . $onesignal_wp_settings["notifyButton_size"] . "';\n";
|
237 |
-
}
|
238 |
-
|
239 |
-
if ($onesignal_wp_settings["notifyButton_prenotify"] == "1") {
|
240 |
-
echo "oneSignal_options['notifyButton']['prenotify'] = true;\n";
|
241 |
-
} else {
|
242 |
-
echo "oneSignal_options['notifyButton']['prenotify'] = false;\n";
|
243 |
-
}
|
244 |
-
|
245 |
-
if ($onesignal_wp_settings["notifyButton_showAfterSubscribed"] !== true) {
|
246 |
-
echo "oneSignal_options['notifyButton']['displayPredicate'] = function() {
|
247 |
-
return OneSignal.isPushNotificationsEnabled()
|
248 |
-
.then(function(isPushEnabled) {
|
249 |
-
return !isPushEnabled;
|
250 |
-
});
|
251 |
-
};\n";
|
252 |
-
}
|
253 |
-
|
254 |
-
if ($onesignal_wp_settings["use_modal_prompt"] == "1") {
|
255 |
-
echo "oneSignal_options['notifyButton']['modalPrompt'] = true;\n";
|
256 |
-
}
|
257 |
-
|
258 |
-
if ($onesignal_wp_settings["notifyButton_showcredit"] == "1") {
|
259 |
-
echo "oneSignal_options['notifyButton']['showCredit'] = true;\n";
|
260 |
-
} else {
|
261 |
-
echo "oneSignal_options['notifyButton']['showCredit'] = false;\n";
|
262 |
-
}
|
263 |
-
|
264 |
-
if (array_key_exists('notifyButton_customize_enable', $onesignal_wp_settings) && $onesignal_wp_settings["notifyButton_customize_enable"] == "1") {
|
265 |
-
echo "oneSignal_options['notifyButton']['text'] = {};\n";
|
266 |
-
if ($onesignal_wp_settings["notifyButton_message_prenotify"] != "") {
|
267 |
-
echo "oneSignal_options['notifyButton']['text']['message.prenotify'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["notifyButton_message_prenotify"]) . "';\n";
|
268 |
-
}
|
269 |
-
if ($onesignal_wp_settings["notifyButton_tip_state_unsubscribed"] != "") {
|
270 |
-
echo "oneSignal_options['notifyButton']['text']['tip.state.unsubscribed'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["notifyButton_tip_state_unsubscribed"]) . "';\n";
|
271 |
-
}
|
272 |
-
if ($onesignal_wp_settings["notifyButton_tip_state_subscribed"] != "") {
|
273 |
-
echo "oneSignal_options['notifyButton']['text']['tip.state.subscribed'] = '" . OneSignalUtils::html_safe($onesignal_wp_settings["notifyButton_tip_state_subscribed"]) . "';\n";
|
274 |
}
|
275 |
-
if ($onesignal_wp_settings[
|
276 |
-
|
277 |
}
|
278 |
-
if ($onesignal_wp_settings[
|
279 |
-
|
280 |
}
|
281 |
-
if ($onesignal_wp_settings[
|
282 |
-
|
283 |
}
|
284 |
-
if ($onesignal_wp_settings[
|
285 |
-
|
286 |
}
|
287 |
-
if ($onesignal_wp_settings[
|
288 |
-
|
289 |
}
|
290 |
-
if ($onesignal_wp_settings[
|
291 |
-
|
292 |
}
|
293 |
-
if ($onesignal_wp_settings[
|
294 |
-
|
295 |
}
|
296 |
-
if ($onesignal_wp_settings[
|
297 |
-
|
298 |
}
|
299 |
-
if ($onesignal_wp_settings[
|
300 |
-
|
301 |
}
|
302 |
-
|
303 |
|
304 |
-
|
305 |
-
echo "oneSignal_options['notifyButton']
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
echo "oneSignal_options['notifyButton']['colors']['circle.foreground'] = '" . $onesignal_wp_settings["notifyButton_color_foreground"] . "';\n";
|
311 |
-
}
|
312 |
-
if ($onesignal_wp_settings["notifyButton_color_badge_background"] != "") {
|
313 |
-
echo "oneSignal_options['notifyButton']['colors']['badge.background'] = '" . $onesignal_wp_settings["notifyButton_color_badge_background"] . "';\n";
|
314 |
-
}
|
315 |
-
if ($onesignal_wp_settings["notifyButton_color_badge_foreground"] != "") {
|
316 |
-
echo "oneSignal_options['notifyButton']['colors']['badge.foreground'] = '" . $onesignal_wp_settings["notifyButton_color_badge_foreground"] . "';\n";
|
317 |
-
}
|
318 |
-
if ($onesignal_wp_settings["notifyButton_color_badge_border"] != "") {
|
319 |
-
echo "oneSignal_options['notifyButton']['colors']['badge.bordercolor'] = '" . $onesignal_wp_settings["notifyButton_color_badge_border"] . "';\n";
|
320 |
}
|
321 |
-
if ($onesignal_wp_settings[
|
322 |
-
|
323 |
}
|
324 |
-
if ($onesignal_wp_settings[
|
325 |
-
|
326 |
}
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
329 |
}
|
330 |
-
|
331 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
}
|
333 |
-
|
334 |
-
|
|
|
335 |
}
|
336 |
-
}
|
337 |
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
}
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
}
|
346 |
-
|
347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
}
|
349 |
-
}
|
350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
}
|
352 |
|
353 |
$use_custom_sdk_init = $onesignal_wp_settings['use_custom_sdk_init'];
|
354 |
if (!$use_custom_sdk_init) {
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
?>
|
360 |
OneSignal.init(window._oneSignalInitOptions);
|
361 |
<?php
|
362 |
-
|
363 |
-
|
364 |
/* OneSignal: onesignal_initialize_sdk filter preventing SDK initialization. */
|
365 |
<?php
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
oneSignal_options['autoRegister'] = false;
|
371 |
OneSignal.showHttpPrompt();
|
372 |
OneSignal.init(window._oneSignalInitOptions);
|
373 |
<?php
|
374 |
-
|
375 |
-
|
376 |
OneSignal.init(window._oneSignalInitOptions);
|
377 |
<?php
|
|
|
378 |
}
|
379 |
-
}
|
380 |
} else {
|
381 |
-
|
382 |
/* OneSignal: Using custom SDK initialization. */
|
383 |
<?php
|
384 |
-
}
|
385 |
-
?>
|
386 |
});
|
387 |
|
388 |
function documentInitOneSignal() {
|
389 |
var oneSignal_elements = document.getElementsByClassName("OneSignal-prompt");
|
390 |
|
391 |
<?php
|
392 |
-
if ($onesignal_wp_settings[
|
393 |
-
|
394 |
-
}
|
395 |
-
|
396 |
-
|
397 |
-
}
|
398 |
-
?>
|
399 |
for(var i = 0; i < oneSignal_elements.length; i++)
|
400 |
oneSignal_elements[i].addEventListener('click', oneSignalLinkClickHandler, false);
|
401 |
}
|
@@ -411,6 +407,6 @@ class OneSignal_Public {
|
|
411 |
</script>
|
412 |
|
413 |
<?php
|
414 |
-
|
415 |
}
|
416 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
defined('ABSPATH') or die('This page may not be accessed directly.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
function onesignal_debug()
|
6 |
+
{
|
7 |
+
if (!defined('ONESIGNAL_DEBUG') && !class_exists('WDS_Log_Post')) {
|
8 |
+
return;
|
9 |
}
|
10 |
+
$numargs = func_num_args();
|
11 |
+
$arg_list = func_get_args();
|
12 |
+
$bt = debug_backtrace();
|
13 |
+
$output = '['.$bt[1]['function'].'] ';
|
14 |
+
for ($i = 0; $i < $numargs; ++$i) {
|
15 |
+
$arg = $arg_list[$i];
|
16 |
+
|
17 |
+
if (is_string($arg)) {
|
18 |
+
$arg_output = $arg;
|
19 |
+
} else {
|
20 |
+
$arg_output = var_export($arg, true);
|
21 |
+
}
|
22 |
+
|
23 |
+
if ($arg === '') {
|
24 |
+
$arg_output = '""';
|
25 |
+
} elseif ($arg === null) {
|
26 |
+
$arg_output = 'null';
|
27 |
+
}
|
28 |
|
29 |
+
$output = $output.$arg_output.' ';
|
30 |
+
}
|
31 |
+
$output = substr($output, 0, -1);
|
32 |
+
$output = substr($output, 0, 1024); // Restrict messages to 1024 characters in length
|
33 |
+
if (defined('ONESIGNAL_DEBUG')) {
|
34 |
+
error_log('OneSignal: '.$output);
|
35 |
+
}
|
36 |
+
if (class_exists('WDS_Log_Post')) {
|
37 |
+
$num_log_posts = wp_count_posts('wdslp-wds-log', 'readable');
|
38 |
+
// Limit the total number of log entries to 500
|
39 |
+
if ($num_log_posts && property_exists($num_log_posts, 'publish') && $num_log_posts->publish < 500) {
|
40 |
+
WDS_Log_Post::log_message($output, '', 'general');
|
41 |
+
}
|
42 |
}
|
|
|
43 |
}
|
44 |
|
45 |
+
function onesignal_debug_post($post)
|
46 |
+
{
|
47 |
+
if (!$post) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
return onesignal_debug('Post:', array('ID' => $post->ID,
|
52 |
'Post Date' => $post->post_date,
|
53 |
'Modified Date' => $post->post_modified,
|
54 |
'Title' => $post->post_title,
|
55 |
'Status:' => $post->post_status,
|
56 |
+
'Type:' => $post->post_type, ));
|
57 |
}
|
58 |
|
59 |
+
class OneSignal_Public
|
60 |
+
{
|
61 |
+
public function __construct()
|
62 |
+
{
|
63 |
+
}
|
|
|
|
|
64 |
|
65 |
+
public static function init()
|
66 |
+
{
|
67 |
+
add_action('wp_head', array(__CLASS__, 'onesignal_header'), 10);
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
+
|
70 |
+
public static function insert_onesignal_header_manifest($onesignal_wp_settings, $current_plugin_url)
|
71 |
+
{
|
72 |
+
$use_custom_manifest = $onesignal_wp_settings['use_custom_manifest'];
|
73 |
+
$custom_manifest_url = $onesignal_wp_settings['custom_manifest_url'];
|
74 |
+
if ($onesignal_wp_settings !== false && array_key_exists('gcm_sender_id', $onesignal_wp_settings)) {
|
75 |
+
$gcm_sender_id = $onesignal_wp_settings['gcm_sender_id'];
|
76 |
+
} else {
|
77 |
+
$gcm_sender_id = 'WORDPRESS_NO_SENDER_ID_ENTERED';
|
78 |
+
}
|
79 |
+
if ($use_custom_manifest) {
|
80 |
+
?>
|
81 |
<link rel="manifest"
|
82 |
+
href="<?php echo $custom_manifest_url; ?>"/>
|
83 |
<?php
|
84 |
+
} else {
|
85 |
+
?>
|
86 |
<link rel="manifest"
|
87 |
+
href="<?php echo $current_plugin_url.'sdk_files/manifest.json.php?gcm_sender_id='.$gcm_sender_id; ?>"/>
|
88 |
<?php
|
89 |
+
}
|
90 |
}
|
|
|
91 |
|
92 |
+
// For easier debugging of sites by identifying them as WordPress
|
93 |
+
public static function insert_onesignal_stamp()
|
94 |
+
{
|
95 |
+
?>
|
96 |
<meta name="onesignal" content="wordpress-plugin"/>
|
97 |
<?php
|
98 |
+
}
|
99 |
|
100 |
+
public static function onesignal_header()
|
101 |
+
{
|
102 |
+
$onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
103 |
|
104 |
+
if ($onesignal_wp_settings['subdomain'] == '') {
|
105 |
+
if (strpos(ONESIGNAL_PLUGIN_URL, 'http://localhost') === false && strpos(ONESIGNAL_PLUGIN_URL, 'http://127.0.0.1') === false) {
|
106 |
+
$current_plugin_url = preg_replace("/(http:\/\/)/i", 'https://', ONESIGNAL_PLUGIN_URL);
|
107 |
+
} else {
|
108 |
+
$current_plugin_url = ONESIGNAL_PLUGIN_URL;
|
109 |
+
}
|
110 |
+
OneSignal_Public::insert_onesignal_stamp();
|
111 |
+
OneSignal_Public::insert_onesignal_header_manifest($onesignal_wp_settings, $current_plugin_url);
|
112 |
+
} ?>
|
|
|
113 |
<?php
|
114 |
if (defined('ONESIGNAL_DEBUG') && defined('ONESIGNAL_LOCAL')) {
|
115 |
echo '<script src="https://localhost:3001/sdks/OneSignalSDK.js" async></script>';
|
116 |
+
} else {
|
117 |
echo '<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script>';
|
118 |
+
} ?>
|
|
|
119 |
<script>
|
120 |
|
121 |
window.OneSignal = window.OneSignal || [];
|
127 |
|
128 |
<?php
|
129 |
|
130 |
+
if ($onesignal_wp_settings['default_icon'] != '') {
|
131 |
+
echo 'OneSignal.setDefaultIcon("'.OneSignalUtils::decode_entities($onesignal_wp_settings['default_icon'])."\");\n";
|
132 |
}
|
133 |
|
134 |
+
if ($onesignal_wp_settings['default_url'] != '') {
|
135 |
+
echo 'OneSignal.setDefaultNotificationUrl("'.OneSignalUtils::decode_entities($onesignal_wp_settings['default_url']).'");';
|
136 |
+
} else {
|
137 |
+
echo 'OneSignal.setDefaultNotificationUrl("'.OneSignalUtils::decode_entities(get_site_url())."\");\n";
|
138 |
+
} ?>
|
|
|
|
|
139 |
var oneSignal_options = {};
|
140 |
window._oneSignalInitOptions = oneSignal_options;
|
141 |
|
142 |
<?php
|
143 |
echo "oneSignal_options['wordpress'] = true;\n";
|
144 |
+
echo "oneSignal_options['appId'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['app_id'])."';\n";
|
145 |
|
146 |
+
if ($onesignal_wp_settings['prompt_auto_register'] == '1') {
|
147 |
+
echo "oneSignal_options['autoRegister'] = true;\n";
|
148 |
+
} else {
|
149 |
+
echo "oneSignal_options['autoRegister'] = false;\n";
|
|
|
150 |
}
|
151 |
|
152 |
+
if ($onesignal_wp_settings['use_http_permission_request'] == '1') {
|
153 |
+
echo "oneSignal_options['httpPermissionRequest'] = { };\n";
|
154 |
+
echo "oneSignal_options['httpPermissionRequest']['enable'] = true;\n";
|
155 |
|
156 |
+
if (array_key_exists('customize_http_permission_request', $onesignal_wp_settings) && $onesignal_wp_settings['customize_http_permission_request'] == '1') {
|
157 |
+
echo "oneSignal_options['httpPermissionRequest']['modalTitle'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['http_permission_request_modal_title'])."\";\n";
|
158 |
+
echo "oneSignal_options['httpPermissionRequest']['modalMessage'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['http_permission_request_modal_message'])."\";\n";
|
159 |
+
echo "oneSignal_options['httpPermissionRequest']['modalButtonText'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['http_permission_request_modal_button_text'])."\";\n";
|
160 |
+
}
|
161 |
}
|
162 |
|
163 |
+
if ($onesignal_wp_settings['send_welcome_notification'] == '1') {
|
164 |
+
echo "oneSignal_options['welcomeNotification'] = { };\n";
|
165 |
+
echo "oneSignal_options['welcomeNotification']['title'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['welcome_notification_title'])."\";\n";
|
166 |
+
echo "oneSignal_options['welcomeNotification']['message'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['welcome_notification_message'])."\";\n";
|
167 |
+
if ($onesignal_wp_settings['welcome_notification_url'] != '') {
|
168 |
+
echo "oneSignal_options['welcomeNotification']['url'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['welcome_notification_url'])."\";\n";
|
169 |
+
}
|
170 |
+
} else {
|
171 |
+
echo "oneSignal_options['welcomeNotification'] = { };\n";
|
172 |
+
echo "oneSignal_options['welcomeNotification']['disable'] = true;\n";
|
|
|
173 |
}
|
174 |
|
175 |
+
if ($onesignal_wp_settings['subdomain'] != '') {
|
176 |
+
echo "oneSignal_options['subdomainName'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['subdomain'])."\";\n";
|
177 |
+
} else {
|
178 |
+
echo "oneSignal_options['path'] = \"".$current_plugin_url."sdk_files/\";\n";
|
|
|
179 |
}
|
180 |
|
181 |
+
if (@$onesignal_wp_settings['safari_web_id']) {
|
182 |
+
echo "oneSignal_options['safari_web_id'] = \"".OneSignalUtils::html_safe($onesignal_wp_settings['safari_web_id'])."\";\n";
|
183 |
}
|
184 |
|
185 |
+
if ($onesignal_wp_settings['persist_notifications'] == 'platform-default') {
|
186 |
+
echo "oneSignal_options['persistNotification'] = false;\n";
|
187 |
+
} elseif ($onesignal_wp_settings['persist_notifications'] == 'yes-all') {
|
188 |
+
echo "oneSignal_options['persistNotification'] = true;\n";
|
|
|
189 |
}
|
190 |
|
191 |
echo "oneSignal_options['promptOptions'] = { };\n";
|
192 |
+
if (array_key_exists('prompt_customize_enable', $onesignal_wp_settings) && $onesignal_wp_settings['prompt_customize_enable'] == '1') {
|
193 |
+
if ($onesignal_wp_settings['prompt_action_message'] != '') {
|
194 |
+
echo "oneSignal_options['promptOptions']['actionMessage'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_action_message'])."';\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
+
if ($onesignal_wp_settings['prompt_example_notification_title_desktop'] != '') {
|
197 |
+
echo "oneSignal_options['promptOptions']['exampleNotificationTitleDesktop'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_example_notification_title_desktop'])."';\n";
|
198 |
}
|
199 |
+
if ($onesignal_wp_settings['prompt_example_notification_message_desktop'] != '') {
|
200 |
+
echo "oneSignal_options['promptOptions']['exampleNotificationMessageDesktop'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_example_notification_message_desktop'])."';\n";
|
201 |
}
|
202 |
+
if ($onesignal_wp_settings['prompt_example_notification_title_mobile'] != '') {
|
203 |
+
echo "oneSignal_options['promptOptions']['exampleNotificationTitleMobile'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_example_notification_title_mobile'])."';\n";
|
204 |
}
|
205 |
+
if ($onesignal_wp_settings['prompt_example_notification_message_mobile'] != '') {
|
206 |
+
echo "oneSignal_options['promptOptions']['exampleNotificationMessageMobile'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_example_notification_message_mobile'])."';\n";
|
207 |
}
|
208 |
+
if ($onesignal_wp_settings['prompt_example_notification_caption'] != '') {
|
209 |
+
echo "oneSignal_options['promptOptions']['exampleNotificationCaption'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_example_notification_caption'])."';\n";
|
210 |
}
|
211 |
+
if ($onesignal_wp_settings['prompt_accept_button_text'] != '') {
|
212 |
+
echo "oneSignal_options['promptOptions']['acceptButtonText'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_accept_button_text'])."';\n";
|
213 |
}
|
214 |
+
if ($onesignal_wp_settings['prompt_cancel_button_text'] != '') {
|
215 |
+
echo "oneSignal_options['promptOptions']['cancelButtonText'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_cancel_button_text'])."';\n";
|
216 |
}
|
217 |
+
if ($onesignal_wp_settings['prompt_site_name'] != '') {
|
218 |
+
echo "oneSignal_options['promptOptions']['siteName'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_site_name'])."';\n";
|
219 |
}
|
220 |
+
if ($onesignal_wp_settings['prompt_auto_accept_title'] != '') {
|
221 |
+
echo "oneSignal_options['promptOptions']['autoAcceptTitle'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['prompt_auto_accept_title'])."';\n";
|
222 |
}
|
223 |
+
}
|
224 |
|
225 |
+
if (array_key_exists('notifyButton_enable', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_enable'] == '1') {
|
226 |
+
echo "oneSignal_options['notifyButton'] = { };\n";
|
227 |
+
echo "oneSignal_options['notifyButton']['enable'] = true;\n";
|
228 |
+
|
229 |
+
if (array_key_exists('notifyButton_position', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_position'] != '') {
|
230 |
+
echo "oneSignal_options['notifyButton']['position'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_position'])."';\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
+
if (array_key_exists('notifyButton_theme', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_theme'] != '') {
|
233 |
+
echo "oneSignal_options['notifyButton']['theme'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_theme'])."';\n";
|
234 |
}
|
235 |
+
if (array_key_exists('notifyButton_size', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_size'] != '') {
|
236 |
+
echo "oneSignal_options['notifyButton']['size'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_size'])."';\n";
|
237 |
}
|
238 |
+
|
239 |
+
if ($onesignal_wp_settings['notifyButton_prenotify'] == '1') {
|
240 |
+
echo "oneSignal_options['notifyButton']['prenotify'] = true;\n";
|
241 |
+
} else {
|
242 |
+
echo "oneSignal_options['notifyButton']['prenotify'] = false;\n";
|
243 |
}
|
244 |
+
|
245 |
+
if ($onesignal_wp_settings['notifyButton_showAfterSubscribed'] !== true) {
|
246 |
+
echo "oneSignal_options['notifyButton']['displayPredicate'] = function() {
|
247 |
+
return OneSignal.isPushNotificationsEnabled()
|
248 |
+
.then(function(isPushEnabled) {
|
249 |
+
return !isPushEnabled;
|
250 |
+
});
|
251 |
+
};\n";
|
252 |
}
|
253 |
+
|
254 |
+
if ($onesignal_wp_settings['use_modal_prompt'] == '1') {
|
255 |
+
echo "oneSignal_options['notifyButton']['modalPrompt'] = true;\n";
|
256 |
}
|
|
|
257 |
|
258 |
+
if ($onesignal_wp_settings['notifyButton_showcredit'] == '1') {
|
259 |
+
echo "oneSignal_options['notifyButton']['showCredit'] = true;\n";
|
260 |
+
} else {
|
261 |
+
echo "oneSignal_options['notifyButton']['showCredit'] = false;\n";
|
262 |
}
|
263 |
+
|
264 |
+
if (array_key_exists('notifyButton_customize_enable', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_customize_enable'] == '1') {
|
265 |
+
echo "oneSignal_options['notifyButton']['text'] = {};\n";
|
266 |
+
if ($onesignal_wp_settings['notifyButton_message_prenotify'] != '') {
|
267 |
+
echo "oneSignal_options['notifyButton']['text']['message.prenotify'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_message_prenotify'])."';\n";
|
268 |
+
}
|
269 |
+
if ($onesignal_wp_settings['notifyButton_tip_state_unsubscribed'] != '') {
|
270 |
+
echo "oneSignal_options['notifyButton']['text']['tip.state.unsubscribed'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_tip_state_unsubscribed'])."';\n";
|
271 |
+
}
|
272 |
+
if ($onesignal_wp_settings['notifyButton_tip_state_subscribed'] != '') {
|
273 |
+
echo "oneSignal_options['notifyButton']['text']['tip.state.subscribed'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_tip_state_subscribed'])."';\n";
|
274 |
+
}
|
275 |
+
if ($onesignal_wp_settings['notifyButton_tip_state_blocked'] != '') {
|
276 |
+
echo "oneSignal_options['notifyButton']['text']['tip.state.blocked'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_tip_state_blocked'])."';\n";
|
277 |
+
}
|
278 |
+
if ($onesignal_wp_settings['notifyButton_message_action_subscribed'] != '') {
|
279 |
+
echo "oneSignal_options['notifyButton']['text']['message.action.subscribed'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_message_action_subscribed'])."';\n";
|
280 |
+
}
|
281 |
+
if ($onesignal_wp_settings['notifyButton_message_action_resubscribed'] != '') {
|
282 |
+
echo "oneSignal_options['notifyButton']['text']['message.action.resubscribed'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_message_action_resubscribed'])."';\n";
|
283 |
+
}
|
284 |
+
if ($onesignal_wp_settings['notifyButton_message_action_unsubscribed'] != '') {
|
285 |
+
echo "oneSignal_options['notifyButton']['text']['message.action.unsubscribed'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_message_action_unsubscribed'])."';\n";
|
286 |
+
}
|
287 |
+
if ($onesignal_wp_settings['notifyButton_dialog_main_title'] != '') {
|
288 |
+
echo "oneSignal_options['notifyButton']['text']['dialog.main.title'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_dialog_main_title'])."';\n";
|
289 |
+
}
|
290 |
+
if ($onesignal_wp_settings['notifyButton_dialog_main_button_subscribe'] != '') {
|
291 |
+
echo "oneSignal_options['notifyButton']['text']['dialog.main.button.subscribe'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_dialog_main_button_subscribe'])."';\n";
|
292 |
+
}
|
293 |
+
if ($onesignal_wp_settings['notifyButton_dialog_main_button_unsubscribe'] != '') {
|
294 |
+
echo "oneSignal_options['notifyButton']['text']['dialog.main.button.unsubscribe'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_dialog_main_button_unsubscribe'])."';\n";
|
295 |
+
}
|
296 |
+
if ($onesignal_wp_settings['notifyButton_dialog_blocked_title'] != '') {
|
297 |
+
echo "oneSignal_options['notifyButton']['text']['dialog.blocked.title'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_dialog_blocked_title'])."';\n";
|
298 |
+
}
|
299 |
+
if ($onesignal_wp_settings['notifyButton_dialog_blocked_message'] != '') {
|
300 |
+
echo "oneSignal_options['notifyButton']['text']['dialog.blocked.message'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_dialog_blocked_message'])."';\n";
|
301 |
+
}
|
302 |
}
|
303 |
+
|
304 |
+
if (array_key_exists('notifyButton_customize_colors_enable', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_customize_colors_enable'] == '1') {
|
305 |
+
echo "oneSignal_options['notifyButton']['colors'] = {};\n";
|
306 |
+
if ($onesignal_wp_settings['notifyButton_color_background'] != '') {
|
307 |
+
echo "oneSignal_options['notifyButton']['colors']['circle.background'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_background'])."';\n";
|
308 |
+
}
|
309 |
+
if ($onesignal_wp_settings['notifyButton_color_foreground'] != '') {
|
310 |
+
echo "oneSignal_options['notifyButton']['colors']['circle.foreground'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_foreground'])."';\n";
|
311 |
+
}
|
312 |
+
if ($onesignal_wp_settings['notifyButton_color_badge_background'] != '') {
|
313 |
+
echo "oneSignal_options['notifyButton']['colors']['badge.background'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_badge_background'])."';\n";
|
314 |
+
}
|
315 |
+
if ($onesignal_wp_settings['notifyButton_color_badge_foreground'] != '') {
|
316 |
+
echo "oneSignal_options['notifyButton']['colors']['badge.foreground'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_badge_foreground'])."';\n";
|
317 |
+
}
|
318 |
+
if ($onesignal_wp_settings['notifyButton_color_badge_border'] != '') {
|
319 |
+
echo "oneSignal_options['notifyButton']['colors']['badge.bordercolor'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_badge_border'])."';\n";
|
320 |
+
}
|
321 |
+
if ($onesignal_wp_settings['notifyButton_color_pulse'] != '') {
|
322 |
+
echo "oneSignal_options['notifyButton']['colors']['pulse.color'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_pulse'])."';\n";
|
323 |
+
}
|
324 |
+
if ($onesignal_wp_settings['notifyButton_color_popup_button_background'] != '') {
|
325 |
+
echo "oneSignal_options['notifyButton']['colors']['dialog.button.background'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_popup_button_background'])."';\n";
|
326 |
+
}
|
327 |
+
if ($onesignal_wp_settings['notifyButton_color_popup_button_background_hover'] != '') {
|
328 |
+
echo "oneSignal_options['notifyButton']['colors']['dialog.button.background.hovering'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_popup_button_background_hover'])."';\n";
|
329 |
+
}
|
330 |
+
if ($onesignal_wp_settings['notifyButton_color_popup_button_background_active'] != '') {
|
331 |
+
echo "oneSignal_options['notifyButton']['colors']['dialog.button.background.active'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_popup_button_background_active'])."';\n";
|
332 |
+
}
|
333 |
+
if ($onesignal_wp_settings['notifyButton_color_popup_button_color'] != '') {
|
334 |
+
echo "oneSignal_options['notifyButton']['colors']['dialog.button.foreground'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_color_popup_button_color'])."';\n";
|
335 |
+
}
|
336 |
}
|
|
|
337 |
|
338 |
+
if (array_key_exists('notifyButton_customize_offset_enable', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_customize_offset_enable'] == '1') {
|
339 |
+
echo "oneSignal_options['notifyButton']['offset'] = {};\n";
|
340 |
+
if ($onesignal_wp_settings['notifyButton_offset_bottom'] != '') {
|
341 |
+
echo "oneSignal_options['notifyButton']['offset']['bottom'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_offset_bottom'])."';\n";
|
342 |
+
}
|
343 |
+
if ($onesignal_wp_settings['notifyButton_offset_left'] != '') {
|
344 |
+
echo "oneSignal_options['notifyButton']['offset']['left'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_offset_left'])."';\n";
|
345 |
+
}
|
346 |
+
if ($onesignal_wp_settings['notifyButton_offset_right'] != '') {
|
347 |
+
echo "oneSignal_options['notifyButton']['offset']['right'] = '".OneSignalUtils::html_safe($onesignal_wp_settings['notifyButton_offset_right'])."';\n";
|
348 |
+
}
|
349 |
+
}
|
350 |
}
|
351 |
|
352 |
$use_custom_sdk_init = $onesignal_wp_settings['use_custom_sdk_init'];
|
353 |
if (!$use_custom_sdk_init) {
|
354 |
+
if (has_filter('onesignal_initialize_sdk')) {
|
355 |
+
onesignal_debug('Applying onesignal_initialize_sdk filter.');
|
356 |
+
if (apply_filters('onesignal_initialize_sdk', $onesignal_wp_settings)) {
|
357 |
+
// If the filter returns "$do_initialize_sdk: true", initialize the web SDK
|
358 |
?>
|
359 |
OneSignal.init(window._oneSignalInitOptions);
|
360 |
<?php
|
361 |
+
} else {
|
362 |
+
?>
|
363 |
/* OneSignal: onesignal_initialize_sdk filter preventing SDK initialization. */
|
364 |
<?php
|
365 |
+
}
|
366 |
+
} else {
|
367 |
+
if (array_key_exists('use_slidedown_permission_message_for_https', $onesignal_wp_settings) && $onesignal_wp_settings['use_slidedown_permission_message_for_https'] == '1') {
|
368 |
+
?>
|
369 |
oneSignal_options['autoRegister'] = false;
|
370 |
OneSignal.showHttpPrompt();
|
371 |
OneSignal.init(window._oneSignalInitOptions);
|
372 |
<?php
|
373 |
+
} else {
|
374 |
+
?>
|
375 |
OneSignal.init(window._oneSignalInitOptions);
|
376 |
<?php
|
377 |
+
}
|
378 |
}
|
|
|
379 |
} else {
|
380 |
+
?>
|
381 |
/* OneSignal: Using custom SDK initialization. */
|
382 |
<?php
|
383 |
+
} ?>
|
|
|
384 |
});
|
385 |
|
386 |
function documentInitOneSignal() {
|
387 |
var oneSignal_elements = document.getElementsByClassName("OneSignal-prompt");
|
388 |
|
389 |
<?php
|
390 |
+
if ($onesignal_wp_settings['use_modal_prompt'] == '1') {
|
391 |
+
echo "var oneSignalLinkClickHandler = function(event) { OneSignal.push(['registerForPushNotifications', {modalPrompt: true}]); event.preventDefault(); };";
|
392 |
+
} else {
|
393 |
+
echo "var oneSignalLinkClickHandler = function(event) { OneSignal.push(['registerForPushNotifications']); event.preventDefault(); };";
|
394 |
+
} ?>
|
|
|
|
|
395 |
for(var i = 0; i < oneSignal_elements.length; i++)
|
396 |
oneSignal_elements[i].addEventListener('click', oneSignalLinkClickHandler, false);
|
397 |
}
|
407 |
</script>
|
408 |
|
409 |
<?php
|
410 |
+
}
|
411 |
}
|
412 |
?>
|
onesignal.php
CHANGED
@@ -6,7 +6,7 @@ defined( 'ABSPATH' ) or die('This page may not be accessed directly.');
|
|
6 |
* Plugin Name: OneSignal Push Notifications
|
7 |
* Plugin URI: https://onesignal.com/
|
8 |
* Description: Free web push notifications.
|
9 |
-
* Version: 1.17.
|
10 |
* Author: OneSignal
|
11 |
* Author URI: https://onesignal.com
|
12 |
* License: MIT
|
6 |
* Plugin Name: OneSignal Push Notifications
|
7 |
* Plugin URI: https://onesignal.com/
|
8 |
* Description: Free web push notifications.
|
9 |
+
* Version: 1.17.8
|
10 |
* Author: OneSignal
|
11 |
* Author URI: https://onesignal.com
|
12 |
* License: MIT
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://onesignal.com
|
|
4 |
Tags: chrome, firefox, safari, push, push notifications, push notification, chrome push, safari push, firefox push, notification, notifications, web push, notify, mavericks, android, android push, android notifications, android notification, mobile notification, mobile notifications, mobile, desktop notification, roost, goroost, desktop notifications, gcm, push messages, onesignal
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.2.1
|
7 |
-
Stable tag: 1.17.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -65,6 +65,10 @@ HTTPS Setup Video: [youtube https://www.youtube.com/watch?v=BeTZ2KgytC0]
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
68 |
= 1.17.7 =
|
69 |
|
70 |
- Fixed bug from 1.17.6 where updating old posts would result in 400 level errors
|
4 |
Tags: chrome, firefox, safari, push, push notifications, push notification, chrome push, safari push, firefox push, notification, notifications, web push, notify, mavericks, android, android push, android notifications, android notification, mobile notification, mobile notifications, mobile, desktop notification, roost, goroost, desktop notifications, gcm, push messages, onesignal
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.2.1
|
7 |
+
Stable tag: 1.17.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.17.8 =
|
69 |
+
|
70 |
+
- Added escaping to fields in OneSignal config to remove invalid characters, bug fixes
|
71 |
+
|
72 |
= 1.17.7 =
|
73 |
|
74 |
- Fixed bug from 1.17.6 where updating old posts would result in 400 level errors
|
views/config.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
defined(
|
4 |
|
5 |
if (!OneSignalUtils::can_modify_plugin_settings()) {
|
6 |
-
|
7 |
-
|
8 |
}
|
9 |
|
10 |
// The user is just viewing the config page; this page cannot be accessed directly
|
@@ -82,10 +82,10 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
82 |
<h4>HTTP Sites:</h4>
|
83 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-bottom: 0 !important; padding-bottom: 0 !important;">
|
84 |
<div class="center aligned column">
|
85 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
86 |
</div>
|
87 |
<div class="center aligned column">
|
88 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
89 |
</div>
|
90 |
</div>
|
91 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-top: 0 !important; padding-top: 0 !important;">
|
@@ -99,10 +99,10 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
99 |
<h4>HTTPS Sites:</h4>
|
100 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-bottom: 0 !important; padding-bottom: 0 !important;">
|
101 |
<div class="center aligned column">
|
102 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
103 |
</div>
|
104 |
<div class="center aligned column">
|
105 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
106 |
</div>
|
107 |
</div>
|
108 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-top: 0 !important; padding-top: 0 !important;">
|
@@ -147,7 +147,7 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
147 |
<dd>
|
148 |
<p>Log in to your OneSignal account, and navigate to the <em>App Settings</em> page of the app you configured in this guide.</p>
|
149 |
<p>You should be on this page:</p>
|
150 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
151 |
<p>Click <strong>Configure</strong> on the platform <em>Apple Safari</em>.</p>
|
152 |
</dd>
|
153 |
</div>
|
@@ -155,10 +155,10 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
155 |
<dt>2</dt>
|
156 |
<dd>
|
157 |
<p>In this step, we'll focus on filling out the <em>Site Name</em> and <em>Site URL</em> fields.</p>
|
158 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
159 |
<p>For the <strong>Site Name</strong>, enter a name you'd like your users to see.</p>
|
160 |
<p>In the following sample image, <em>OneSignal</em> is the site name:</p>
|
161 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
162 |
<p>For the <strong>Site URL</strong>, enter the URL to your site's domain. The purpose of this field is to prevent other sites from hijacking your keys to impersonate you and send push notifications on your behalf. Please note:</p>
|
163 |
<ul>
|
164 |
<li>
|
@@ -183,7 +183,7 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
183 |
<dt>3</dt>
|
184 |
<dd>
|
185 |
<p>In this step, we'll focus on uploading your Safari notification icons.</p>
|
186 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
187 |
<p>Please have your icon in the following sizes:</p>
|
188 |
<ul>
|
189 |
<li>16 × 16</li>
|
@@ -206,7 +206,7 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
206 |
<dt>5</dt>
|
207 |
<dd>
|
208 |
<p><strong>Refresh</strong> the page, and then copy the <strong>Safari Web ID</strong> you see to the <em>Configuration</em> tab.</p>
|
209 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
210 |
<p>That's it for setting up Safari push!</p>
|
211 |
</dd>
|
212 |
</div>
|
@@ -219,21 +219,21 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
219 |
</div>
|
220 |
<div class="ui tab borderless shadowless segment" style="z-index: 1;" data-tab="setup/3">
|
221 |
<p>This section shows push notifications working for <em>Chrome</em>, <em>Safari</em>, and <em>Firefox</em> in <em>HTTP</em> and <em>HTTPS</em> mode.</p>
|
222 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
223 |
<p></p>
|
224 |
<dl>
|
225 |
<div class="ui horizontal divider">Subscription Bell</div>
|
226 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
227 |
<div class="ui horizontal divider">Chrome (HTTP)</div>
|
228 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
229 |
<div class="ui horizontal divider">Chrome (HTTPS)</div>
|
230 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
231 |
<div class="ui horizontal divider">Safari (HTTP & HTTPS)</div>
|
232 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
233 |
<div class="ui horizontal divider">Firefox (HTTP)</div>
|
234 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
235 |
<div class="ui horizontal divider">Firefox (HTTPS)</div>
|
236 |
-
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
237 |
</dl>
|
238 |
</div>
|
239 |
</div>
|
@@ -254,8 +254,12 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
254 |
<div class="ui borderless shadowless segment">
|
255 |
<div class="field">
|
256 |
<div class="ui toggle checkbox">
|
257 |
-
<input type="checkbox" name="is_site_https" <?php if (@$onesignal_wp_settings['is_site_https_firsttime'] === 'unset') {
|
258 |
-
|
|
|
|
|
|
|
|
|
259 |
</div>
|
260 |
</div>
|
261 |
<div class="ui inline subdomain-http nag">
|
@@ -274,25 +278,25 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
274 |
<div class="field">
|
275 |
<label>Google Project Number<i class="tiny circular help icon link" role="popup" data-title="Google Project Number" data-content="Your Google Project Number. Do NOT change this as it can cause all existing subscribers to become unreachable." data-variation="wide"></i></label>
|
276 |
<p class="hidden danger-label" data-target="[name=gcm_sender_id]">WARNING: Changing this causes all existing subscribers to become unreachable. Please do not change unless instructed to do so!</p>
|
277 |
-
<input type="text" name="gcm_sender_id" placeholder="#############" value="<?php echo $onesignal_wp_settings['gcm_sender_id'] ?>">
|
278 |
</div>
|
279 |
<?php endif; ?>
|
280 |
<div class="field">
|
281 |
<label>App ID<i class="tiny circular help icon link" role="popup" data-title="App ID" data-content="Your 36 character alphanumeric app ID. You can find this in App Settings > Keys & IDs." data-variation="wide"></i></label>
|
282 |
-
<input type="text" name="app_id" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" value="<?php echo $onesignal_wp_settings['app_id'] ?>">
|
283 |
</div>
|
284 |
<div class="field">
|
285 |
<label>REST API Key<i class="tiny circular help icon link" role="popup" data-title="Rest API Key" data-content="Your 48 character alphanumeric REST API Key. You can find this in App Settings > Keys & IDs." data-variation="wide"></i></label>
|
286 |
-
<input type="text" name="app_rest_api_key" placeholder="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" value="<?php echo $onesignal_wp_settings['app_rest_api_key'] ?>">
|
287 |
</div>
|
288 |
<div class="field subdomain-feature">
|
289 |
<label>OneSignal Label<i class="tiny circular help icon link" role="popup" data-title="Subdomain" data-content="The label you chose for your site. You can find this in Step 2. Wordpress Site Setup" data-variation="wide"></i></label>
|
290 |
-
<input type="text" name="subdomain" placeholder="example" value="<?php echo $onesignal_wp_settings['subdomain'] ?>">
|
291 |
<div class="callout info">Once your site is public, <strong>do not change your label</strong>. If you do, users will receive duplicate notifications.</div>
|
292 |
</div>
|
293 |
<div class="field">
|
294 |
<label>Safari Web ID<i class="tiny circular help icon link" role="popup" data-title="Safari Web ID" data-content="Your Safari Web ID. You can find this on Setup > Safari Push > Step 5." data-variation="wide"></i></label>
|
295 |
-
<input type="text" name="safari_web_id" placeholder="web.com.example" value="<?php echo @$onesignal_wp_settings['safari_web_id']; ?>">
|
296 |
</div>
|
297 |
</div>
|
298 |
<div class="ui dividing header">
|
@@ -304,13 +308,17 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
304 |
<div class="ui borderless shadowless segment">
|
305 |
<div class="field">
|
306 |
<div class="ui toggle checkbox">
|
307 |
-
<input type="checkbox" name="showNotificationIconFromPostThumbnail" value="true" <?php if ($onesignal_wp_settings['showNotificationIconFromPostThumbnail']) {
|
|
|
|
|
308 |
<label>Use the post's featured image for the notification icon<i class="tiny circular help icon link" role="popup" data-title="Use post featured image for notification icon" data-content="If checked, use the post's featured image in the notification icon (small icon). Chrome and Firefox Desktop supported." data-variation="wide"></i></label>
|
309 |
</div>
|
310 |
</div>
|
311 |
<div class="field">
|
312 |
<div class="ui toggle checkbox">
|
313 |
-
<input type="checkbox" name="showNotificationImageFromPostThumbnail" value="true" <?php if ($onesignal_wp_settings['showNotificationImageFromPostThumbnail']) {
|
|
|
|
|
314 |
<label>Use the post's featured image for Chrome's large notification image<i class="tiny circular help icon link" role="popup" data-title="Use post featured image for notification image (Chrome only)" data-html="<p>If checked, use the post's featured image in the notification large image (Chrome only). See <a target='docs' href='https://documentation.onesignal.com/docs/web-push-notification-icons#section-image'>our documentation on web push images</a>.</p>" data-variation="wide"></i></label>
|
315 |
</div>
|
316 |
</div>
|
@@ -341,8 +349,8 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
341 |
value="platform-default"
|
342 |
<?php
|
343 |
if ((array_key_exists('persist_notifications', $onesignal_wp_settings) &&
|
344 |
-
$onesignal_wp_settings['persist_notifications'] ==
|
345 |
-
|
346 |
}
|
347 |
?>>Yes
|
348 |
</option>
|
@@ -350,8 +358,8 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
350 |
value="yes-except-notification-manager-platforms"
|
351 |
<?php
|
352 |
if ((array_key_exists('persist_notifications', $onesignal_wp_settings) &&
|
353 |
-
$onesignal_wp_settings['persist_notifications'] ==
|
354 |
-
|
355 |
}
|
356 |
?>>Yes on Mac OS X. No on other platforms.
|
357 |
</option>
|
@@ -359,8 +367,8 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
359 |
value="yes-all"
|
360 |
<?php
|
361 |
if ((array_key_exists('persist_notifications', $onesignal_wp_settings) &&
|
362 |
-
$onesignal_wp_settings['persist_notifications'] ==
|
363 |
-
|
364 |
}
|
365 |
?>>No
|
366 |
</option>
|
@@ -368,11 +376,13 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
368 |
</div>
|
369 |
<div class="field">
|
370 |
<label>Notification Title<i class="tiny circular help icon link" role="popup" data-html="The notification title to use for all outgoing notifications. Defaults to your site's title." data-variation="wide"></i></label>
|
371 |
-
<input type="text" name="notification_title" placeholder="<?php echo OneSignalUtils::decode_entities(get_bloginfo('name')) ?>" value="<?php echo @$onesignal_wp_settings['notification_title']; ?>">
|
372 |
</div>
|
373 |
<div class="field">
|
374 |
<div class="ui toggle checkbox">
|
375 |
-
<input type="checkbox" name="send_to_mobile_platforms" value="true" <?php if ($onesignal_wp_settings['send_to_mobile_platforms']) {
|
|
|
|
|
376 |
<label>Send notifications additionally to iOS & Android platforms<i class="tiny circular help icon link" role="popup" data-title="Deliver to iOS & Android" data-html="<p>If checked, the notification will also be sent to Android and iOS <em>if you have those platforms enabled</em> in addition to your web push users. <strong class='least-strong'>Your OneSignal app must have either an active iOS or an Android platform and you must have either iOS or Android users for this to work</strong>.</p>" data-variation="wide"></i></label>
|
377 |
</div>
|
378 |
</div>
|
@@ -384,21 +394,25 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
384 |
</div>
|
385 |
</div>
|
386 |
<div class="ui borderless shadowless segment">
|
387 |
-
<img class="img-responsive no-center" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
388 |
<div class="explanation">
|
389 |
<p>Control the way visitors are prompted to subscribe. The Subscription Bell is an interactive widget your site visitors can use to manage their push notification subscription status. The Subscription Bell can be used to initially subscribe to push notifications, and to unsubscribe.</p>
|
390 |
</div>
|
391 |
|
392 |
<div class="field modal-prompt-feature">
|
393 |
<div class="ui toggle checkbox">
|
394 |
-
<input type="checkbox" name="use_modal_prompt" value="true" <?php if ($onesignal_wp_settings['use_modal_prompt']) {
|
|
|
|
|
395 |
<label>Use an alternate full-screen prompt when requesting subscription permission (incompatible with Subscription Bell and auto-prompting)</label>
|
396 |
</div>
|
397 |
</div>
|
398 |
<div class="field auto-register-feature">
|
399 |
<div class="field">
|
400 |
<div class="ui toggle checkbox">
|
401 |
-
<input type="checkbox" name="prompt_auto_register" value="true" <?php if ($onesignal_wp_settings['prompt_auto_register']) {
|
|
|
|
|
402 |
<label>
|
403 |
Automatically prompt new site visitors to subscribe to push notifications
|
404 |
<i class="tiny circular help icon link"
|
@@ -407,12 +421,12 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
407 |
<p>If enabled, your site will automatically present the following without any code required:</p>
|
408 |
<p>HTTPS Sites:
|
409 |
<img
|
410 |
-
src='<?php echo ONESIGNAL_PLUGIN_URL.
|
411 |
width=400>
|
412 |
</p>
|
413 |
<p>HTTP Sites:
|
414 |
<img
|
415 |
-
src='<?php echo ONESIGNAL_PLUGIN_URL.
|
416 |
width=400>
|
417 |
</p>"
|
418 |
width=450
|
@@ -424,72 +438,102 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
424 |
</div>
|
425 |
<div class="field slidedown-permission-message-https-feature">
|
426 |
<div class="ui toggle checkbox">
|
427 |
-
<input type="checkbox" name="use_slidedown_permission_message_for_https" value="true" <?php if (array_key_exists('use_slidedown_permission_message_for_https', $onesignal_wp_settings) && $onesignal_wp_settings['use_slidedown_permission_message_for_https']) {
|
|
|
|
|
428 |
<label>Show the Slide Prompt before prompting users to subscribe<i class="tiny circular help icon link" role="popup" data-title="Slide Prompt for HTTPS Sites" data-content="If checked, the Slide Prompt will be shown before the browser's permission request. Please note that this Slide Prompt cannot replace the browser's native permission request. The browser's native permission request must always be finally shown before the user can be subscribed." data-variation="wide"></i></label>
|
429 |
</div>
|
430 |
</div>
|
431 |
<div class="field">
|
432 |
<div class="ui toggle checkbox">
|
433 |
-
<input type="checkbox" name="notifyButton_enable" value="true" <?php if (array_key_exists('notifyButton_enable', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_enable']) {
|
|
|
|
|
434 |
<label>Enable the Subscription Bell<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell" data-content="If checked, the Subscription Bell and its resources will be loaded into your website." data-variation="wide"></i></label>
|
435 |
</div>
|
436 |
</div>
|
437 |
<div class="field nb-feature">
|
438 |
<div class="ui toggle checkbox">
|
439 |
-
<input type="checkbox" name="notifyButton_showAfterSubscribed" value="true" <?php if (array_key_exists('notifyButton_showAfterSubscribed', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_showAfterSubscribed']) {
|
|
|
|
|
440 |
<label>Show the Subscription Bell after users have subscribed<i class="tiny circular help icon link" role="popup" data-html="<p>If checked, the Subscription Bell will continue to be shown on all pages after the user subscribes.</p><p>If unchecked, the Subscription Bell will be hidden not be shown after the user subscribes and refreshes the page.</p>" data-variation="wide"></i></label>
|
441 |
</div>
|
442 |
</div>
|
443 |
<div class="field nb-feature">
|
444 |
<div class="ui toggle checkbox">
|
445 |
-
<input type="checkbox" name="notifyButton_prenotify" value="true" <?php if (array_key_exists('notifyButton_prenotify', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_prenotify']) {
|
446 |
-
|
|
|
|
|
447 |
</div>
|
448 |
</div>
|
449 |
<div class="field nb-feature">
|
450 |
<div class="ui toggle checkbox">
|
451 |
-
<input type="checkbox" name="notifyButton_showcredit" value="true" <?php if (array_key_exists('notifyButton_showcredit', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_showcredit']) {
|
|
|
|
|
452 |
<label>Show the OneSignal logo on the Subscription Bell dialog</label>
|
453 |
</div>
|
454 |
</div>
|
455 |
<div class="field nb-feature">
|
456 |
<div class="ui toggle checkbox">
|
457 |
-
<input type="checkbox" name="notifyButton_customize_enable" value="true" <?php if (array_key_exists('notifyButton_customize_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_customize_enable']) {
|
|
|
|
|
458 |
<label>Customize the Subscription Bell text</label>
|
459 |
</div>
|
460 |
</div>
|
461 |
<div class="field nb-feature">
|
462 |
<div class="ui toggle checkbox">
|
463 |
-
<input type="checkbox" name="notifyButton_customize_offset_enable" value="true" <?php if (array_key_exists('notifyButton_customize_offset_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_customize_offset_enable']) {
|
|
|
|
|
464 |
<label>Customize the Subscription Bell offset position</label>
|
465 |
</div>
|
466 |
</div>
|
467 |
<div class="field nb-feature">
|
468 |
<div class="ui toggle checkbox">
|
469 |
-
<input type="checkbox" name="notifyButton_customize_colors_enable" value="true" <?php if (array_key_exists('notifyButton_customize_colors_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_customize_colors_enable']) {
|
|
|
|
|
470 |
<label>Customize the Subscription Bell theme colors</label>
|
471 |
</div>
|
472 |
</div>
|
473 |
<div class="inline-setting short field nb-feature">
|
474 |
<label class="inline-setting">Size:</label>
|
475 |
<select class="ui dropdown" name="notifyButton_size">
|
476 |
-
<option value="small" <?php if (array_key_exists('notifyButton_size', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_size'] ==
|
477 |
-
|
478 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
</select>
|
480 |
</div>
|
481 |
<div class="inline-setting short field nb-feature">
|
482 |
<label class="inline-setting">Position:</label>
|
483 |
<select class="ui dropdown" name="notifyButton_position">
|
484 |
-
<option value="bottom-left" <?php if (array_key_exists('notifyButton_position', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_position'] ==
|
485 |
-
|
|
|
|
|
|
|
|
|
486 |
</select>
|
487 |
</div>
|
488 |
<div class="inline-setting short field nb-feature">
|
489 |
<label class="inline-setting">Theme:</label>
|
490 |
<select class="ui dropdown" name="notifyButton_theme">
|
491 |
-
<option value="default" <?php if ((array_key_exists('notifyButton_theme', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_theme'] ==
|
492 |
-
|
|
|
|
|
|
|
|
|
493 |
</select>
|
494 |
</div>
|
495 |
<div class="ui segment nb-feature nb-position-feature">
|
@@ -501,15 +545,15 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
501 |
<p class="small normal-weight lato">You can override the Subscription Bell's offset position in the X and Y direction using CSS-valid position values. For example, <code>20px</code> is the default value.</p>
|
502 |
<div class="field nb-feature nb-position-feature">
|
503 |
<label>Bottom offset<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Bottom Offset" data-content="The distance to offset the Subscription Bell from the bottom of the page. For example, <code>20px</code> is the default value." data-variation="wide"></i></label>
|
504 |
-
<input type="text" name="notifyButton_offset_bottom" placeholder="20px" value="<?php echo @$onesignal_wp_settings['notifyButton_offset_bottom']; ?>">
|
505 |
</div>
|
506 |
<div class="field nb-feature nb-position-feature nb-position-bottom-left-feature">
|
507 |
<label>Left offset<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Left Offset" data-content="The distance to offset the Subscription Bell from the left of the page. For example, <code>20px</code> is the default value." data-variation="wide"></i></label>
|
508 |
-
<input type="text" name="notifyButton_offset_left" placeholder="20px" value="<?php echo @$onesignal_wp_settings['notifyButton_offset_left']; ?>">
|
509 |
</div>
|
510 |
<div class="field nb-feature nb-position-feature nb-position-bottom-right-feature">
|
511 |
<label>Right offset<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Right Offset" data-content="The distance to offset the Subscription Bell from the right of the page. For example, <code>20px</code> is the default value." data-variation="wide"></i></label>
|
512 |
-
<input type="text" name="notifyButton_offset_right" placeholder="20px" value="<?php echo @$onesignal_wp_settings['notifyButton_offset_right']; ?>">
|
513 |
</div>
|
514 |
</div>
|
515 |
|
@@ -522,43 +566,43 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
522 |
<p class="small normal-weight lato">You can override the theme's colors by entering your own. Use any CSS-valid color. For example, <code>white</code>, <code>#FFFFFF</code>, <code>#FFF</code>, <code>rgb(255, 255, 255)</code>, <code>rgba(255, 255, 255, 1.0)</code>, and <code>transparent</code> are all valid values.</p>
|
523 |
<div class="field nb-feature nb-color-feature">
|
524 |
<label>Main button background color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Background Color" data-content="The background color of the main Subscription Bell." data-variation="wide"></i></label>
|
525 |
-
<input type="text" name="notifyButton_color_background" placeholder="#e54b4d" value="<?php echo @$onesignal_wp_settings['notifyButton_color_background']; ?>">
|
526 |
</div>
|
527 |
<div class="field nb-feature nb-color-feature">
|
528 |
<label>Main button foreground color (main bell icon and inner circle)<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Foreground Color" data-content="The color of the bell icon and inner circle on the main Subscription Bell." data-variation="wide"></i></label>
|
529 |
-
<input type="text" name="notifyButton_color_foreground" placeholder="white" value="<?php echo @$onesignal_wp_settings['notifyButton_color_foreground']; ?>">
|
530 |
</div>
|
531 |
<div class="field nb-feature nb-color-feature">
|
532 |
<label>Pre-notify badge background color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Badge Background Color" data-content="The background color of the small secondary circle on the main Subscription Bell. This badge is shown to first-time site visitors only." data-variation="wide"></i></label>
|
533 |
-
<input type="text" name="notifyButton_color_badge_background" placeholder="black" value="<?php echo @$onesignal_wp_settings['notifyButton_color_badge_background']; ?>">
|
534 |
</div>
|
535 |
<div class="field nb-feature nb-color-feature">
|
536 |
<label>Pre-notify badge foreground color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Badge Foreground Color" data-content="The text color on the small secondary circle on the main Subscription Bell. This badge is shown to first-time site visitors only." data-variation="wide"></i></label>
|
537 |
-
<input type="text" name="notifyButton_color_badge_foreground" placeholder="white" value="<?php echo @$onesignal_wp_settings['notifyButton_color_badge_foreground']; ?>">
|
538 |
</div>
|
539 |
<div class="field nb-feature nb-color-feature">
|
540 |
<label>Pre-notify badge border color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Badge Border Color" data-content="The border color of the small secondary circle on the main Subscription Bell. This badge is shown to first-time site visitors only." data-variation="wide"></i></label>
|
541 |
-
<input type="text" name="notifyButton_color_badge_border" placeholder="white" value="<?php echo @$onesignal_wp_settings['notifyButton_color_badge_border']; ?>">
|
542 |
</div>
|
543 |
<div class="field nb-feature nb-color-feature">
|
544 |
<label>Pulse animation color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Pulse Animation Color" data-content="The color of the quickly expanding circle that's used as an animation when a user clicks on the Subscription Bell." data-variation="wide"></i></label>
|
545 |
-
<input type="text" name="notifyButton_color_pulse" placeholder="#e54b4d" value="<?php echo @$onesignal_wp_settings['notifyButton_color_pulse']; ?>">
|
546 |
</div>
|
547 |
<div class="field nb-feature nb-color-feature">
|
548 |
<label>Popup action button background color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Background Color" data-content="The color of the action button (SUBSCRIBE/UNSUBSCRIBE) on the Subscription Bell popup." data-variation="wide"></i></label>
|
549 |
-
<input type="text" name="notifyButton_color_popup_button_background" placeholder="#e54b4d" value="<?php echo @$onesignal_wp_settings['notifyButton_color_popup_button_background']; ?>">
|
550 |
</div>
|
551 |
<div class="field nb-feature nb-color-feature">
|
552 |
<label>Popup action button background color (on hover)<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Background Color (on hover)" data-content="The color of the action button (SUBSCRIBE/UNSUBSCRIBE) on the Subscription Bell popup when you hover over the button." data-variation="wide"></i></label>
|
553 |
-
<input type="text" name="notifyButton_color_popup_button_background_hover" placeholder="#CC3234" value="<?php echo @$onesignal_wp_settings['notifyButton_color_popup_button_background_hover']; ?>">
|
554 |
</div>
|
555 |
<div class="field nb-feature nb-color-feature">
|
556 |
<label>Popup action button background color (on click)<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Background Color (on click)" data-content="The color of the action button (SUBSCRIBE/UNSUBSCRIBE) on the Subscription Bell popup when you hold down the mouse." data-variation="wide"></i></label>
|
557 |
-
<input type="text" name="notifyButton_color_popup_button_background_active" placeholder="#B2181A" value="<?php echo @$onesignal_wp_settings['notifyButton_color_popup_button_background_active']; ?>">
|
558 |
</div>
|
559 |
<div class="field nb-feature nb-color-feature">
|
560 |
<label>Popup action button text color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Text Color" data-content="The color of the quickly expanding circle that's used as an animation when a user clicks on the Subscription Bell." data-variation="wide"></i></label>
|
561 |
-
<input type="text" name="notifyButton_color_popup_button_color" placeholder="white" value="<?php echo @$onesignal_wp_settings['notifyButton_color_popup_button_color']; ?>">
|
562 |
</div>
|
563 |
</div>
|
564 |
|
@@ -625,12 +669,14 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
625 |
HTTP Pop-Up Settings
|
626 |
</div>
|
627 |
</div>
|
628 |
-
<img class="img-responsive no-center" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
629 |
<div class="ui borderless shadowless segment" style="position: relative;">
|
630 |
<p class="lato">These settings modify the HTTP Pop-Up Prompt and button text for all users. Use this to localize the HTTP Pop-Up Prompt to your language. All fields here are limited in the length of text they can display.</p>
|
631 |
<div class="field">
|
632 |
<div class="ui toggle checkbox">
|
633 |
-
<input type="checkbox" name="prompt_customize_enable" value="true" <?php if (array_key_exists('prompt_customize_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['prompt_customize_enable']) {
|
|
|
|
|
634 |
<label>Customize the HTTP Pop-Up Prompt text</label>
|
635 |
</div>
|
636 |
</div>
|
@@ -683,13 +729,15 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
683 |
</div>
|
684 |
</div>
|
685 |
<div class="ui borderless shadowless segment" style="position: relative;">
|
686 |
-
<img class="img-responsive no-center" src="<?php echo ONESIGNAL_PLUGIN_URL.
|
687 |
<div class="explanation">
|
688 |
<p>A welcome notification is sent to new visitors after subscribing. A new visitor is someone who hasn't previously registered. If a user's browser cache is cleared, the user is considered new again.</p>
|
689 |
</div>
|
690 |
<div class="field">
|
691 |
<div class="ui toggle checkbox">
|
692 |
-
<input type="checkbox" name="send_welcome_notification" value="true" <?php if ($onesignal_wp_settings['send_welcome_notification']) {
|
|
|
|
|
693 |
<label>Send new users a welcome push notification after subscribing<i class="tiny circular help icon link" role="popup" data-title="Welcome Notification" data-content="If enabled, your site will send a welcome push notification to new site visitors who have just subscribed. The message is customizable below."></i></label>
|
694 |
</div>
|
695 |
</div>
|
@@ -715,13 +763,17 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
715 |
<div class="ui borderless shadowless segment">
|
716 |
<div class="field">
|
717 |
<div class="ui toggle checkbox">
|
718 |
-
<input type="checkbox" name="notification_on_post" value="true" <?php if ($onesignal_wp_settings['notification_on_post']) {
|
|
|
|
|
719 |
<label>Automatically send a push notification when I create a post from the WordPress editor<i class="tiny circular help icon link" role="popup" data-title="Automatic Push from WordPress Editor" data-content="If checked, when you create a new post from WordPress's editor, the checkbox 'Send notification on post publish/update' will be automatically checked. The checkbox can be unchecked to prevent sending a notification." data-variation="wide"></i></label>
|
720 |
</div>
|
721 |
</div>
|
722 |
<div class="field">
|
723 |
<div class="ui toggle checkbox">
|
724 |
-
<input type="checkbox" name="notification_on_post_from_plugin" value="true" <?php if (@$onesignal_wp_settings['notification_on_post_from_plugin']) {
|
|
|
|
|
725 |
<label>Automatically send a push notification when I publish a post from 3<sup>rd</sup> party plugins<i class="tiny circular help icon link" role="popup" data-title="Automatic Push outside WordPress Editor" data-content="If checked, when a post is created outside of WordPress's editor, a push notification will automatically be sent. Must be the built-in WordPress post type 'post' and the post must be published." data-variation="wide"></i></label>
|
726 |
</div>
|
727 |
</div>
|
@@ -747,35 +799,43 @@ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
|
|
747 |
<div class="ui borderless shadowless segment">
|
748 |
<div class="field">
|
749 |
<label>Additional Custom Post Types for Automatic Notifications Created From Plugins<i class="tiny circular help icon link" role="popup" data-html="Enter a comma-separated list of custom post type names. Anytime a post is published with one of the listed post types, a notification will be sent to all your users. <strong class='least-strong'>The setting</strong> <em>Automatically send a push notification when I publish a post from 3rd party plugins</em> <strong class='least-strong'>must be enabled for this feature to work</strong>." data-variation="wide"></i></label>
|
750 |
-
<input type="text" placeholder="forum,reply,topic (comma separated, no spaces between commas)" name="allowed_custom_post_types" value="<?php echo @$onesignal_wp_settings['allowed_custom_post_types']; ?>">
|
751 |
</div>
|
752 |
<?php if (OneSignalUtils::url_contains_parameter(ONESIGNAL_URI_REVEAL_PROJECT_NUMBER)): ?>
|
753 |
<div class="field">
|
754 |
<div class="ui toggle checkbox">
|
755 |
-
<input type="checkbox" name="show_gcm_sender_id" value="true" <?php if ($onesignal_wp_settings['show_gcm_sender_id']) {
|
|
|
|
|
756 |
<label>Use my own Google Project Number<i class="tiny circular help icon link" role="popup" data-title="Providing Your Own Web Push Keys" data-content="Check this if you'd like to provide your own Google Project Number."></i></label>
|
757 |
</div>
|
758 |
</div>
|
759 |
<?php endif; ?>
|
760 |
<div class="field custom-manifest-feature">
|
761 |
<label>Custom manifest.json URL<i class="tiny circular help icon link" role="popup" data-html="<p>Enter the complete URL to your existing manifest.json file to be used in place of our own. Your URL's domain should match that of your main site that users are visiting.</p><p>e.g. <code>https://yoursite.com/manifest.json</code></p>" data-variation="wide"></i></label>
|
762 |
-
<input type="text" placeholder="https://yoursite.com/manifest.json" name="custom_manifest_url" value="<?php echo @$onesignal_wp_settings['custom_manifest_url']; ?>">
|
763 |
</div>
|
764 |
<div class="field">
|
765 |
<div class="ui toggle checkbox">
|
766 |
-
<input type="checkbox" name="use_custom_manifest" value="true" <?php if ($onesignal_wp_settings['use_custom_manifest']) {
|
|
|
|
|
767 |
<label>Use my own manifest.json<i class="tiny circular help icon link" role="popup" data-title="Providing Your Own manifest.json File" data-content="Check this if you have an existing manifest.json file you'd like to use instead of ours. You might check this if you have existing icons defined in your manifest."></i></label>
|
768 |
</div>
|
769 |
</div>
|
770 |
<div class="field">
|
771 |
<div class="ui toggle checkbox">
|
772 |
-
<input type="checkbox" name="use_custom_sdk_init" value="true" <?php if ($onesignal_wp_settings['use_custom_sdk_init']) {
|
|
|
|
|
773 |
<label>Disable OneSignal initialization<i class="tiny circular help icon link" role="popup" data-title="Disable OneSignal Initialization" data-content="Check this if you'd like to disable OneSignal's normal initialization. Useful if you are adding a custom initialization script. All the options you've set here in the WordPress plugin will be accessible in a global variable window._oneSignalInitOptions."></i></label>
|
774 |
</div>
|
775 |
</div>
|
776 |
<div class="field">
|
777 |
<div class="ui toggle checkbox">
|
778 |
-
<input type="checkbox" name="show_notification_send_status_message" value="true" <?php if ($onesignal_wp_settings['show_notification_send_status_message']) {
|
|
|
|
|
779 |
<label>Show status message after sending notifications<i class="tiny circular help icon link" role="popup" data-title="Show Notification Send Status Message" data-content="If enabled, a notice at the top of your admin interface will show 'Successfully sent a notification to # recipients.' after our plugin sends a notification."></i></label>
|
780 |
</div>
|
781 |
</div>
|
1 |
<?php
|
2 |
|
3 |
+
defined('ABSPATH') or die('This page may not be accessed directly.');
|
4 |
|
5 |
if (!OneSignalUtils::can_modify_plugin_settings()) {
|
6 |
+
// Exit if the current user does not have permission
|
7 |
+
die('Insufficient permissions to access config page.');
|
8 |
}
|
9 |
|
10 |
// The user is just viewing the config page; this page cannot be accessed directly
|
82 |
<h4>HTTP Sites:</h4>
|
83 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-bottom: 0 !important; padding-bottom: 0 !important;">
|
84 |
<div class="center aligned column">
|
85 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/http-prompt.png'; ?>" width="100%">
|
86 |
</div>
|
87 |
<div class="center aligned column">
|
88 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/bell.jpg'; ?>" width="60%">
|
89 |
</div>
|
90 |
</div>
|
91 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-top: 0 !important; padding-top: 0 !important;">
|
99 |
<h4>HTTPS Sites:</h4>
|
100 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-bottom: 0 !important; padding-bottom: 0 !important;">
|
101 |
<div class="center aligned column">
|
102 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/https-prompt.png'; ?>" width="100%">
|
103 |
</div>
|
104 |
<div class="center aligned column">
|
105 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/bell.jpg'; ?>" width="60%">
|
106 |
</div>
|
107 |
</div>
|
108 |
<div class="relative ui two column middle aligned very relaxed stackable grid" style="margin-top: 0 !important; padding-top: 0 !important;">
|
147 |
<dd>
|
148 |
<p>Log in to your OneSignal account, and navigate to the <em>App Settings</em> page of the app you configured in this guide.</p>
|
149 |
<p>You should be on this page:</p>
|
150 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/safari-1.jpg'; ?>">
|
151 |
<p>Click <strong>Configure</strong> on the platform <em>Apple Safari</em>.</p>
|
152 |
</dd>
|
153 |
</div>
|
155 |
<dt>2</dt>
|
156 |
<dd>
|
157 |
<p>In this step, we'll focus on filling out the <em>Site Name</em> and <em>Site URL</em> fields.</p>
|
158 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/safari-2.jpg'; ?>">
|
159 |
<p>For the <strong>Site Name</strong>, enter a name you'd like your users to see.</p>
|
160 |
<p>In the following sample image, <em>OneSignal</em> is the site name:</p>
|
161 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/safari-prompt.jpg'; ?>" width="450">
|
162 |
<p>For the <strong>Site URL</strong>, enter the URL to your site's domain. The purpose of this field is to prevent other sites from hijacking your keys to impersonate you and send push notifications on your behalf. Please note:</p>
|
163 |
<ul>
|
164 |
<li>
|
183 |
<dt>3</dt>
|
184 |
<dd>
|
185 |
<p>In this step, we'll focus on uploading your Safari notification icons.</p>
|
186 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/safari-3.jpg'; ?>">
|
187 |
<p>Please have your icon in the following sizes:</p>
|
188 |
<ul>
|
189 |
<li>16 × 16</li>
|
206 |
<dt>5</dt>
|
207 |
<dd>
|
208 |
<p><strong>Refresh</strong> the page, and then copy the <strong>Safari Web ID</strong> you see to the <em>Configuration</em> tab.</p>
|
209 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/safari-4.jpg'; ?>">
|
210 |
<p>That's it for setting up Safari push!</p>
|
211 |
</dd>
|
212 |
</div>
|
219 |
</div>
|
220 |
<div class="ui tab borderless shadowless segment" style="z-index: 1;" data-tab="setup/3">
|
221 |
<p>This section shows push notifications working for <em>Chrome</em>, <em>Safari</em>, and <em>Firefox</em> in <em>HTTP</em> and <em>HTTPS</em> mode.</p>
|
222 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/web-push.jpg'; ?>">
|
223 |
<p></p>
|
224 |
<dl>
|
225 |
<div class="ui horizontal divider">Subscription Bell</div>
|
226 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/notify-button.jpg'; ?>">
|
227 |
<div class="ui horizontal divider">Chrome (HTTP)</div>
|
228 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/chrome-http.jpg'; ?>">
|
229 |
<div class="ui horizontal divider">Chrome (HTTPS)</div>
|
230 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/chrome-https.jpg'; ?>">
|
231 |
<div class="ui horizontal divider">Safari (HTTP & HTTPS)</div>
|
232 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/safari-https.jpg'; ?>">
|
233 |
<div class="ui horizontal divider">Firefox (HTTP)</div>
|
234 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/firefox-http.jpg'; ?>">
|
235 |
<div class="ui horizontal divider">Firefox (HTTPS)</div>
|
236 |
+
<img class="img-responsive" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/firefox-https.jpg'; ?>">
|
237 |
</dl>
|
238 |
</div>
|
239 |
</div>
|
254 |
<div class="ui borderless shadowless segment">
|
255 |
<div class="field">
|
256 |
<div class="ui toggle checkbox">
|
257 |
+
<input type="checkbox" name="is_site_https" <?php if (@$onesignal_wp_settings['is_site_https_firsttime'] === 'unset') {
|
258 |
+
echo 'data-unset="true"';
|
259 |
+
} if (@$onesignal_wp_settings['is_site_https']) {
|
260 |
+
echo 'checked';
|
261 |
+
} ?>>
|
262 |
+
<label>My site uses an HTTPS connection (SSL)<i class="tiny circular help icon link" role="popup" data-html="<p>Check this if your site uses HTTPS:</p><img src='<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/https-url.png'; ?>' width=619>" data-variation="flowing"></i></label>
|
263 |
</div>
|
264 |
</div>
|
265 |
<div class="ui inline subdomain-http nag">
|
278 |
<div class="field">
|
279 |
<label>Google Project Number<i class="tiny circular help icon link" role="popup" data-title="Google Project Number" data-content="Your Google Project Number. Do NOT change this as it can cause all existing subscribers to become unreachable." data-variation="wide"></i></label>
|
280 |
<p class="hidden danger-label" data-target="[name=gcm_sender_id]">WARNING: Changing this causes all existing subscribers to become unreachable. Please do not change unless instructed to do so!</p>
|
281 |
+
<input type="text" name="gcm_sender_id" placeholder="#############" value="<?php echo esc_attr($onesignal_wp_settings['gcm_sender_id']); ?>">
|
282 |
</div>
|
283 |
<?php endif; ?>
|
284 |
<div class="field">
|
285 |
<label>App ID<i class="tiny circular help icon link" role="popup" data-title="App ID" data-content="Your 36 character alphanumeric app ID. You can find this in App Settings > Keys & IDs." data-variation="wide"></i></label>
|
286 |
+
<input type="text" name="app_id" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" value="<?php echo esc_attr($onesignal_wp_settings['app_id']); ?>">
|
287 |
</div>
|
288 |
<div class="field">
|
289 |
<label>REST API Key<i class="tiny circular help icon link" role="popup" data-title="Rest API Key" data-content="Your 48 character alphanumeric REST API Key. You can find this in App Settings > Keys & IDs." data-variation="wide"></i></label>
|
290 |
+
<input type="text" name="app_rest_api_key" placeholder="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" value="<?php echo esc_attr($onesignal_wp_settings['app_rest_api_key']); ?>">
|
291 |
</div>
|
292 |
<div class="field subdomain-feature">
|
293 |
<label>OneSignal Label<i class="tiny circular help icon link" role="popup" data-title="Subdomain" data-content="The label you chose for your site. You can find this in Step 2. Wordpress Site Setup" data-variation="wide"></i></label>
|
294 |
+
<input type="text" name="subdomain" placeholder="example" value="<?php echo esc_attr($onesignal_wp_settings['subdomain']); ?>">
|
295 |
<div class="callout info">Once your site is public, <strong>do not change your label</strong>. If you do, users will receive duplicate notifications.</div>
|
296 |
</div>
|
297 |
<div class="field">
|
298 |
<label>Safari Web ID<i class="tiny circular help icon link" role="popup" data-title="Safari Web ID" data-content="Your Safari Web ID. You can find this on Setup > Safari Push > Step 5." data-variation="wide"></i></label>
|
299 |
+
<input type="text" name="safari_web_id" placeholder="web.com.example" value="<?php echo esc_attr(@$onesignal_wp_settings['safari_web_id']); ?>">
|
300 |
</div>
|
301 |
</div>
|
302 |
<div class="ui dividing header">
|
308 |
<div class="ui borderless shadowless segment">
|
309 |
<div class="field">
|
310 |
<div class="ui toggle checkbox">
|
311 |
+
<input type="checkbox" name="showNotificationIconFromPostThumbnail" value="true" <?php if ($onesignal_wp_settings['showNotificationIconFromPostThumbnail']) {
|
312 |
+
echo 'checked';
|
313 |
+
} ?>>
|
314 |
<label>Use the post's featured image for the notification icon<i class="tiny circular help icon link" role="popup" data-title="Use post featured image for notification icon" data-content="If checked, use the post's featured image in the notification icon (small icon). Chrome and Firefox Desktop supported." data-variation="wide"></i></label>
|
315 |
</div>
|
316 |
</div>
|
317 |
<div class="field">
|
318 |
<div class="ui toggle checkbox">
|
319 |
+
<input type="checkbox" name="showNotificationImageFromPostThumbnail" value="true" <?php if ($onesignal_wp_settings['showNotificationImageFromPostThumbnail']) {
|
320 |
+
echo 'checked';
|
321 |
+
} ?>>
|
322 |
<label>Use the post's featured image for Chrome's large notification image<i class="tiny circular help icon link" role="popup" data-title="Use post featured image for notification image (Chrome only)" data-html="<p>If checked, use the post's featured image in the notification large image (Chrome only). See <a target='docs' href='https://documentation.onesignal.com/docs/web-push-notification-icons#section-image'>our documentation on web push images</a>.</p>" data-variation="wide"></i></label>
|
323 |
</div>
|
324 |
</div>
|
349 |
value="platform-default"
|
350 |
<?php
|
351 |
if ((array_key_exists('persist_notifications', $onesignal_wp_settings) &&
|
352 |
+
$onesignal_wp_settings['persist_notifications'] == 'platform-default')) {
|
353 |
+
echo 'selected';
|
354 |
}
|
355 |
?>>Yes
|
356 |
</option>
|
358 |
value="yes-except-notification-manager-platforms"
|
359 |
<?php
|
360 |
if ((array_key_exists('persist_notifications', $onesignal_wp_settings) &&
|
361 |
+
$onesignal_wp_settings['persist_notifications'] == 'yes-except-notification-manager-platforms')) {
|
362 |
+
echo 'selected';
|
363 |
}
|
364 |
?>>Yes on Mac OS X. No on other platforms.
|
365 |
</option>
|
367 |
value="yes-all"
|
368 |
<?php
|
369 |
if ((array_key_exists('persist_notifications', $onesignal_wp_settings) &&
|
370 |
+
$onesignal_wp_settings['persist_notifications'] == 'yes-all')) {
|
371 |
+
echo 'selected';
|
372 |
}
|
373 |
?>>No
|
374 |
</option>
|
376 |
</div>
|
377 |
<div class="field">
|
378 |
<label>Notification Title<i class="tiny circular help icon link" role="popup" data-html="The notification title to use for all outgoing notifications. Defaults to your site's title." data-variation="wide"></i></label>
|
379 |
+
<input type="text" name="notification_title" placeholder="<?php echo OneSignalUtils::decode_entities(get_bloginfo('name')); ?>" value="<?php echo esc_attr(@$onesignal_wp_settings['notification_title']); ?>">
|
380 |
</div>
|
381 |
<div class="field">
|
382 |
<div class="ui toggle checkbox">
|
383 |
+
<input type="checkbox" name="send_to_mobile_platforms" value="true" <?php if ($onesignal_wp_settings['send_to_mobile_platforms']) {
|
384 |
+
echo 'checked';
|
385 |
+
} ?>>
|
386 |
<label>Send notifications additionally to iOS & Android platforms<i class="tiny circular help icon link" role="popup" data-title="Deliver to iOS & Android" data-html="<p>If checked, the notification will also be sent to Android and iOS <em>if you have those platforms enabled</em> in addition to your web push users. <strong class='least-strong'>Your OneSignal app must have either an active iOS or an Android platform and you must have either iOS or Android users for this to work</strong>.</p>" data-variation="wide"></i></label>
|
387 |
</div>
|
388 |
</div>
|
394 |
</div>
|
395 |
</div>
|
396 |
<div class="ui borderless shadowless segment">
|
397 |
+
<img class="img-responsive no-center" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/nb-unsubscribe.png'; ?>" width="234">
|
398 |
<div class="explanation">
|
399 |
<p>Control the way visitors are prompted to subscribe. The Subscription Bell is an interactive widget your site visitors can use to manage their push notification subscription status. The Subscription Bell can be used to initially subscribe to push notifications, and to unsubscribe.</p>
|
400 |
</div>
|
401 |
|
402 |
<div class="field modal-prompt-feature">
|
403 |
<div class="ui toggle checkbox">
|
404 |
+
<input type="checkbox" name="use_modal_prompt" value="true" <?php if ($onesignal_wp_settings['use_modal_prompt']) {
|
405 |
+
echo 'checked';
|
406 |
+
} ?>>
|
407 |
<label>Use an alternate full-screen prompt when requesting subscription permission (incompatible with Subscription Bell and auto-prompting)</label>
|
408 |
</div>
|
409 |
</div>
|
410 |
<div class="field auto-register-feature">
|
411 |
<div class="field">
|
412 |
<div class="ui toggle checkbox">
|
413 |
+
<input type="checkbox" name="prompt_auto_register" value="true" <?php if ($onesignal_wp_settings['prompt_auto_register']) {
|
414 |
+
echo 'checked';
|
415 |
+
} ?>>
|
416 |
<label>
|
417 |
Automatically prompt new site visitors to subscribe to push notifications
|
418 |
<i class="tiny circular help icon link"
|
421 |
<p>If enabled, your site will automatically present the following without any code required:</p>
|
422 |
<p>HTTPS Sites:
|
423 |
<img
|
424 |
+
src='<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/chrome-https.jpg'; ?>'
|
425 |
width=400>
|
426 |
</p>
|
427 |
<p>HTTP Sites:
|
428 |
<img
|
429 |
+
src='<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/http-prompt.png'; ?>'
|
430 |
width=400>
|
431 |
</p>"
|
432 |
width=450
|
438 |
</div>
|
439 |
<div class="field slidedown-permission-message-https-feature">
|
440 |
<div class="ui toggle checkbox">
|
441 |
+
<input type="checkbox" name="use_slidedown_permission_message_for_https" value="true" <?php if (array_key_exists('use_slidedown_permission_message_for_https', $onesignal_wp_settings) && $onesignal_wp_settings['use_slidedown_permission_message_for_https']) {
|
442 |
+
echo 'checked';
|
443 |
+
} ?>>
|
444 |
<label>Show the Slide Prompt before prompting users to subscribe<i class="tiny circular help icon link" role="popup" data-title="Slide Prompt for HTTPS Sites" data-content="If checked, the Slide Prompt will be shown before the browser's permission request. Please note that this Slide Prompt cannot replace the browser's native permission request. The browser's native permission request must always be finally shown before the user can be subscribed." data-variation="wide"></i></label>
|
445 |
</div>
|
446 |
</div>
|
447 |
<div class="field">
|
448 |
<div class="ui toggle checkbox">
|
449 |
+
<input type="checkbox" name="notifyButton_enable" value="true" <?php if (array_key_exists('notifyButton_enable', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_enable']) {
|
450 |
+
echo 'checked';
|
451 |
+
} ?>>
|
452 |
<label>Enable the Subscription Bell<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell" data-content="If checked, the Subscription Bell and its resources will be loaded into your website." data-variation="wide"></i></label>
|
453 |
</div>
|
454 |
</div>
|
455 |
<div class="field nb-feature">
|
456 |
<div class="ui toggle checkbox">
|
457 |
+
<input type="checkbox" name="notifyButton_showAfterSubscribed" value="true" <?php if (array_key_exists('notifyButton_showAfterSubscribed', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_showAfterSubscribed']) {
|
458 |
+
echo 'checked';
|
459 |
+
} ?>>
|
460 |
<label>Show the Subscription Bell after users have subscribed<i class="tiny circular help icon link" role="popup" data-html="<p>If checked, the Subscription Bell will continue to be shown on all pages after the user subscribes.</p><p>If unchecked, the Subscription Bell will be hidden not be shown after the user subscribes and refreshes the page.</p>" data-variation="wide"></i></label>
|
461 |
</div>
|
462 |
</div>
|
463 |
<div class="field nb-feature">
|
464 |
<div class="ui toggle checkbox">
|
465 |
+
<input type="checkbox" name="notifyButton_prenotify" value="true" <?php if (array_key_exists('notifyButton_prenotify', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_prenotify']) {
|
466 |
+
echo 'checked';
|
467 |
+
} ?>>
|
468 |
+
<label>Show first-time site visitors an unread message icon<i class="tiny circular help icon link" role="popup" data-html="<p>If checked, a circle indicating 1 unread message will be shown:</p><img src='<?php echo ONESIGNAL_PLUGIN_URL.'views/images/bell-prenotify.jpg'; ?>' width=56><p>A message will be displayed when they hover over the Subscription Bell. This message can be customized below.</p>" data-variation="wide"></i></label>
|
469 |
</div>
|
470 |
</div>
|
471 |
<div class="field nb-feature">
|
472 |
<div class="ui toggle checkbox">
|
473 |
+
<input type="checkbox" name="notifyButton_showcredit" value="true" <?php if (array_key_exists('notifyButton_showcredit', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_showcredit']) {
|
474 |
+
echo 'checked';
|
475 |
+
} ?>>
|
476 |
<label>Show the OneSignal logo on the Subscription Bell dialog</label>
|
477 |
</div>
|
478 |
</div>
|
479 |
<div class="field nb-feature">
|
480 |
<div class="ui toggle checkbox">
|
481 |
+
<input type="checkbox" name="notifyButton_customize_enable" value="true" <?php if (array_key_exists('notifyButton_customize_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_customize_enable']) {
|
482 |
+
echo 'checked';
|
483 |
+
} ?>>
|
484 |
<label>Customize the Subscription Bell text</label>
|
485 |
</div>
|
486 |
</div>
|
487 |
<div class="field nb-feature">
|
488 |
<div class="ui toggle checkbox">
|
489 |
+
<input type="checkbox" name="notifyButton_customize_offset_enable" value="true" <?php if (array_key_exists('notifyButton_customize_offset_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_customize_offset_enable']) {
|
490 |
+
echo 'checked';
|
491 |
+
} ?>>
|
492 |
<label>Customize the Subscription Bell offset position</label>
|
493 |
</div>
|
494 |
</div>
|
495 |
<div class="field nb-feature">
|
496 |
<div class="ui toggle checkbox">
|
497 |
+
<input type="checkbox" name="notifyButton_customize_colors_enable" value="true" <?php if (array_key_exists('notifyButton_customize_colors_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['notifyButton_customize_colors_enable']) {
|
498 |
+
echo 'checked';
|
499 |
+
} ?>>
|
500 |
<label>Customize the Subscription Bell theme colors</label>
|
501 |
</div>
|
502 |
</div>
|
503 |
<div class="inline-setting short field nb-feature">
|
504 |
<label class="inline-setting">Size:</label>
|
505 |
<select class="ui dropdown" name="notifyButton_size">
|
506 |
+
<option value="small" <?php if (array_key_exists('notifyButton_size', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_size'] == 'small') {
|
507 |
+
echo 'selected';
|
508 |
+
} ?>>Small</option>
|
509 |
+
<option value="medium" <?php if ((array_key_exists('notifyButton_size', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_size'] == 'medium') || !array_key_exists('notifyButton_theme', $onesignal_wp_settings)) {
|
510 |
+
echo 'selected';
|
511 |
+
} ?>>Medium</option>
|
512 |
+
<option value="large" <?php if (array_key_exists('notifyButton_size', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_size'] == 'large') {
|
513 |
+
echo 'selected';
|
514 |
+
} ?>>Large</option>
|
515 |
</select>
|
516 |
</div>
|
517 |
<div class="inline-setting short field nb-feature">
|
518 |
<label class="inline-setting">Position:</label>
|
519 |
<select class="ui dropdown" name="notifyButton_position">
|
520 |
+
<option value="bottom-left" <?php if (array_key_exists('notifyButton_position', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_position'] == 'bottom-left') {
|
521 |
+
echo 'selected';
|
522 |
+
} ?>>Bottom Left</option>
|
523 |
+
<option value="bottom-right" <?php if ((array_key_exists('notifyButton_position', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_position'] == 'bottom-right') || !array_key_exists('notifyButton_position', $onesignal_wp_settings)) {
|
524 |
+
echo 'selected';
|
525 |
+
} ?>>Bottom Right</option>
|
526 |
</select>
|
527 |
</div>
|
528 |
<div class="inline-setting short field nb-feature">
|
529 |
<label class="inline-setting">Theme:</label>
|
530 |
<select class="ui dropdown" name="notifyButton_theme">
|
531 |
+
<option value="default" <?php if ((array_key_exists('notifyButton_theme', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_theme'] == 'default') || !array_key_exists('notifyButton_theme', $onesignal_wp_settings)) {
|
532 |
+
echo 'selected';
|
533 |
+
} ?>>Red</option>
|
534 |
+
<option value="inverse" <?php if (array_key_exists('notifyButton_theme', $onesignal_wp_settings) && $onesignal_wp_settings['notifyButton_theme'] == 'inverse') {
|
535 |
+
echo 'selected';
|
536 |
+
} ?>>White</option>
|
537 |
</select>
|
538 |
</div>
|
539 |
<div class="ui segment nb-feature nb-position-feature">
|
545 |
<p class="small normal-weight lato">You can override the Subscription Bell's offset position in the X and Y direction using CSS-valid position values. For example, <code>20px</code> is the default value.</p>
|
546 |
<div class="field nb-feature nb-position-feature">
|
547 |
<label>Bottom offset<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Bottom Offset" data-content="The distance to offset the Subscription Bell from the bottom of the page. For example, <code>20px</code> is the default value." data-variation="wide"></i></label>
|
548 |
+
<input type="text" name="notifyButton_offset_bottom" placeholder="20px" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_offset_bottom']); ?>">
|
549 |
</div>
|
550 |
<div class="field nb-feature nb-position-feature nb-position-bottom-left-feature">
|
551 |
<label>Left offset<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Left Offset" data-content="The distance to offset the Subscription Bell from the left of the page. For example, <code>20px</code> is the default value." data-variation="wide"></i></label>
|
552 |
+
<input type="text" name="notifyButton_offset_left" placeholder="20px" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_offset_left']); ?>">
|
553 |
</div>
|
554 |
<div class="field nb-feature nb-position-feature nb-position-bottom-right-feature">
|
555 |
<label>Right offset<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Right Offset" data-content="The distance to offset the Subscription Bell from the right of the page. For example, <code>20px</code> is the default value." data-variation="wide"></i></label>
|
556 |
+
<input type="text" name="notifyButton_offset_right" placeholder="20px" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_offset_right']); ?>">
|
557 |
</div>
|
558 |
</div>
|
559 |
|
566 |
<p class="small normal-weight lato">You can override the theme's colors by entering your own. Use any CSS-valid color. For example, <code>white</code>, <code>#FFFFFF</code>, <code>#FFF</code>, <code>rgb(255, 255, 255)</code>, <code>rgba(255, 255, 255, 1.0)</code>, and <code>transparent</code> are all valid values.</p>
|
567 |
<div class="field nb-feature nb-color-feature">
|
568 |
<label>Main button background color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Background Color" data-content="The background color of the main Subscription Bell." data-variation="wide"></i></label>
|
569 |
+
<input type="text" name="notifyButton_color_background" placeholder="#e54b4d" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_background']); ?>">
|
570 |
</div>
|
571 |
<div class="field nb-feature nb-color-feature">
|
572 |
<label>Main button foreground color (main bell icon and inner circle)<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Foreground Color" data-content="The color of the bell icon and inner circle on the main Subscription Bell." data-variation="wide"></i></label>
|
573 |
+
<input type="text" name="notifyButton_color_foreground" placeholder="white" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_foreground']); ?>">
|
574 |
</div>
|
575 |
<div class="field nb-feature nb-color-feature">
|
576 |
<label>Pre-notify badge background color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Badge Background Color" data-content="The background color of the small secondary circle on the main Subscription Bell. This badge is shown to first-time site visitors only." data-variation="wide"></i></label>
|
577 |
+
<input type="text" name="notifyButton_color_badge_background" placeholder="black" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_badge_background']); ?>">
|
578 |
</div>
|
579 |
<div class="field nb-feature nb-color-feature">
|
580 |
<label>Pre-notify badge foreground color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Badge Foreground Color" data-content="The text color on the small secondary circle on the main Subscription Bell. This badge is shown to first-time site visitors only." data-variation="wide"></i></label>
|
581 |
+
<input type="text" name="notifyButton_color_badge_foreground" placeholder="white" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_badge_foreground']); ?>">
|
582 |
</div>
|
583 |
<div class="field nb-feature nb-color-feature">
|
584 |
<label>Pre-notify badge border color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Badge Border Color" data-content="The border color of the small secondary circle on the main Subscription Bell. This badge is shown to first-time site visitors only." data-variation="wide"></i></label>
|
585 |
+
<input type="text" name="notifyButton_color_badge_border" placeholder="white" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_badge_border']); ?>">
|
586 |
</div>
|
587 |
<div class="field nb-feature nb-color-feature">
|
588 |
<label>Pulse animation color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Pulse Animation Color" data-content="The color of the quickly expanding circle that's used as an animation when a user clicks on the Subscription Bell." data-variation="wide"></i></label>
|
589 |
+
<input type="text" name="notifyButton_color_pulse" placeholder="#e54b4d" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_pulse']); ?>">
|
590 |
</div>
|
591 |
<div class="field nb-feature nb-color-feature">
|
592 |
<label>Popup action button background color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Background Color" data-content="The color of the action button (SUBSCRIBE/UNSUBSCRIBE) on the Subscription Bell popup." data-variation="wide"></i></label>
|
593 |
+
<input type="text" name="notifyButton_color_popup_button_background" placeholder="#e54b4d" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_popup_button_background']); ?>">
|
594 |
</div>
|
595 |
<div class="field nb-feature nb-color-feature">
|
596 |
<label>Popup action button background color (on hover)<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Background Color (on hover)" data-content="The color of the action button (SUBSCRIBE/UNSUBSCRIBE) on the Subscription Bell popup when you hover over the button." data-variation="wide"></i></label>
|
597 |
+
<input type="text" name="notifyButton_color_popup_button_background_hover" placeholder="#CC3234" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_popup_button_background_hover']); ?>">
|
598 |
</div>
|
599 |
<div class="field nb-feature nb-color-feature">
|
600 |
<label>Popup action button background color (on click)<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Background Color (on click)" data-content="The color of the action button (SUBSCRIBE/UNSUBSCRIBE) on the Subscription Bell popup when you hold down the mouse." data-variation="wide"></i></label>
|
601 |
+
<input type="text" name="notifyButton_color_popup_button_background_active" placeholder="#B2181A" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_popup_button_background_active']); ?>">
|
602 |
</div>
|
603 |
<div class="field nb-feature nb-color-feature">
|
604 |
<label>Popup action button text color<i class="tiny circular help icon link" role="popup" data-title="Subscription Bell Popup - Action Button Text Color" data-content="The color of the quickly expanding circle that's used as an animation when a user clicks on the Subscription Bell." data-variation="wide"></i></label>
|
605 |
+
<input type="text" name="notifyButton_color_popup_button_color" placeholder="white" value="<?php echo esc_attr(@$onesignal_wp_settings['notifyButton_color_popup_button_color']); ?>">
|
606 |
</div>
|
607 |
</div>
|
608 |
|
669 |
HTTP Pop-Up Settings
|
670 |
</div>
|
671 |
</div>
|
672 |
+
<img class="img-responsive no-center" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/http-prompt.jpg'; ?>" width="360">
|
673 |
<div class="ui borderless shadowless segment" style="position: relative;">
|
674 |
<p class="lato">These settings modify the HTTP Pop-Up Prompt and button text for all users. Use this to localize the HTTP Pop-Up Prompt to your language. All fields here are limited in the length of text they can display.</p>
|
675 |
<div class="field">
|
676 |
<div class="ui toggle checkbox">
|
677 |
+
<input type="checkbox" name="prompt_customize_enable" value="true" <?php if (array_key_exists('prompt_customize_enable', $onesignal_wp_settings) && @$onesignal_wp_settings['prompt_customize_enable']) {
|
678 |
+
echo 'checked';
|
679 |
+
} ?>>
|
680 |
<label>Customize the HTTP Pop-Up Prompt text</label>
|
681 |
</div>
|
682 |
</div>
|
729 |
</div>
|
730 |
</div>
|
731 |
<div class="ui borderless shadowless segment" style="position: relative;">
|
732 |
+
<img class="img-responsive no-center" src="<?php echo ONESIGNAL_PLUGIN_URL.'views/images/settings/welcome-notification.jpg'; ?>" width="360">
|
733 |
<div class="explanation">
|
734 |
<p>A welcome notification is sent to new visitors after subscribing. A new visitor is someone who hasn't previously registered. If a user's browser cache is cleared, the user is considered new again.</p>
|
735 |
</div>
|
736 |
<div class="field">
|
737 |
<div class="ui toggle checkbox">
|
738 |
+
<input type="checkbox" name="send_welcome_notification" value="true" <?php if ($onesignal_wp_settings['send_welcome_notification']) {
|
739 |
+
echo 'checked';
|
740 |
+
} ?>>
|
741 |
<label>Send new users a welcome push notification after subscribing<i class="tiny circular help icon link" role="popup" data-title="Welcome Notification" data-content="If enabled, your site will send a welcome push notification to new site visitors who have just subscribed. The message is customizable below."></i></label>
|
742 |
</div>
|
743 |
</div>
|
763 |
<div class="ui borderless shadowless segment">
|
764 |
<div class="field">
|
765 |
<div class="ui toggle checkbox">
|
766 |
+
<input type="checkbox" name="notification_on_post" value="true" <?php if ($onesignal_wp_settings['notification_on_post']) {
|
767 |
+
echo 'checked';
|
768 |
+
} ?>>
|
769 |
<label>Automatically send a push notification when I create a post from the WordPress editor<i class="tiny circular help icon link" role="popup" data-title="Automatic Push from WordPress Editor" data-content="If checked, when you create a new post from WordPress's editor, the checkbox 'Send notification on post publish/update' will be automatically checked. The checkbox can be unchecked to prevent sending a notification." data-variation="wide"></i></label>
|
770 |
</div>
|
771 |
</div>
|
772 |
<div class="field">
|
773 |
<div class="ui toggle checkbox">
|
774 |
+
<input type="checkbox" name="notification_on_post_from_plugin" value="true" <?php if (@$onesignal_wp_settings['notification_on_post_from_plugin']) {
|
775 |
+
echo 'checked';
|
776 |
+
} ?>>
|
777 |
<label>Automatically send a push notification when I publish a post from 3<sup>rd</sup> party plugins<i class="tiny circular help icon link" role="popup" data-title="Automatic Push outside WordPress Editor" data-content="If checked, when a post is created outside of WordPress's editor, a push notification will automatically be sent. Must be the built-in WordPress post type 'post' and the post must be published." data-variation="wide"></i></label>
|
778 |
</div>
|
779 |
</div>
|
799 |
<div class="ui borderless shadowless segment">
|
800 |
<div class="field">
|
801 |
<label>Additional Custom Post Types for Automatic Notifications Created From Plugins<i class="tiny circular help icon link" role="popup" data-html="Enter a comma-separated list of custom post type names. Anytime a post is published with one of the listed post types, a notification will be sent to all your users. <strong class='least-strong'>The setting</strong> <em>Automatically send a push notification when I publish a post from 3rd party plugins</em> <strong class='least-strong'>must be enabled for this feature to work</strong>." data-variation="wide"></i></label>
|
802 |
+
<input type="text" placeholder="forum,reply,topic (comma separated, no spaces between commas)" name="allowed_custom_post_types" value="<?php echo esc_attr(@$onesignal_wp_settings['allowed_custom_post_types']); ?>">
|
803 |
</div>
|
804 |
<?php if (OneSignalUtils::url_contains_parameter(ONESIGNAL_URI_REVEAL_PROJECT_NUMBER)): ?>
|
805 |
<div class="field">
|
806 |
<div class="ui toggle checkbox">
|
807 |
+
<input type="checkbox" name="show_gcm_sender_id" value="true" <?php if ($onesignal_wp_settings['show_gcm_sender_id']) {
|
808 |
+
echo 'checked';
|
809 |
+
} ?>>
|
810 |
<label>Use my own Google Project Number<i class="tiny circular help icon link" role="popup" data-title="Providing Your Own Web Push Keys" data-content="Check this if you'd like to provide your own Google Project Number."></i></label>
|
811 |
</div>
|
812 |
</div>
|
813 |
<?php endif; ?>
|
814 |
<div class="field custom-manifest-feature">
|
815 |
<label>Custom manifest.json URL<i class="tiny circular help icon link" role="popup" data-html="<p>Enter the complete URL to your existing manifest.json file to be used in place of our own. Your URL's domain should match that of your main site that users are visiting.</p><p>e.g. <code>https://yoursite.com/manifest.json</code></p>" data-variation="wide"></i></label>
|
816 |
+
<input type="text" placeholder="https://yoursite.com/manifest.json" name="custom_manifest_url" value="<?php echo esc_attr(@$onesignal_wp_settings['custom_manifest_url']); ?>">
|
817 |
</div>
|
818 |
<div class="field">
|
819 |
<div class="ui toggle checkbox">
|
820 |
+
<input type="checkbox" name="use_custom_manifest" value="true" <?php if ($onesignal_wp_settings['use_custom_manifest']) {
|
821 |
+
echo 'checked';
|
822 |
+
} ?>>
|
823 |
<label>Use my own manifest.json<i class="tiny circular help icon link" role="popup" data-title="Providing Your Own manifest.json File" data-content="Check this if you have an existing manifest.json file you'd like to use instead of ours. You might check this if you have existing icons defined in your manifest."></i></label>
|
824 |
</div>
|
825 |
</div>
|
826 |
<div class="field">
|
827 |
<div class="ui toggle checkbox">
|
828 |
+
<input type="checkbox" name="use_custom_sdk_init" value="true" <?php if ($onesignal_wp_settings['use_custom_sdk_init']) {
|
829 |
+
echo 'checked';
|
830 |
+
} ?>>
|
831 |
<label>Disable OneSignal initialization<i class="tiny circular help icon link" role="popup" data-title="Disable OneSignal Initialization" data-content="Check this if you'd like to disable OneSignal's normal initialization. Useful if you are adding a custom initialization script. All the options you've set here in the WordPress plugin will be accessible in a global variable window._oneSignalInitOptions."></i></label>
|
832 |
</div>
|
833 |
</div>
|
834 |
<div class="field">
|
835 |
<div class="ui toggle checkbox">
|
836 |
+
<input type="checkbox" name="show_notification_send_status_message" value="true" <?php if ($onesignal_wp_settings['show_notification_send_status_message']) {
|
837 |
+
echo 'checked';
|
838 |
+
} ?>>
|
839 |
<label>Show status message after sending notifications<i class="tiny circular help icon link" role="popup" data-title="Show Notification Send Status Message" data-content="If enabled, a notice at the top of your admin interface will show 'Successfully sent a notification to # recipients.' after our plugin sends a notification."></i></label>
|
840 |
</div>
|
841 |
</div>
|