Super Progressive Web Apps - Version 2.2.9

Version Description

  • Date: 29.November.2022
  • Enhancement : Security nonce is missing #349
  • Enhancement : Escaping is missing #348
  • Enhancement : Functions must have a prefix #347
  • Enhancement : BFCM internal offer #352
  • BugFixed : Offline pages not working on Android Devices #91
  • BugFixed : In iOS, the splash screen icon does not work #343
  • BugFixed : Error in manifest file "name of shortcut is an empty string" #351
  • BugFixed : APP Screenshots option not working #353
  • BugFixed : The APK has crashed at the user's end, and URL shown inside the APK. #359
Download this release

Release Info

Developer superpwa
Plugin Icon 128x128 Super Progressive Web Apps
Version 2.2.9
Comparing to
See all releases

Code changes from version 2.2.8 to 2.2.9

Files changed (51) hide show
  1. .gitignore +0 -1
  2. 3rd-party/amp.php +114 -114
  3. 3rd-party/index.php +1 -1
  4. 3rd-party/onesignal.php +238 -238
  5. 3rd-party/wonderpush.php +116 -116
  6. 3rd-party/yandex.php +28 -28
  7. README.MD +236 -236
  8. addons/apple-touch-icons.php +421 -412
  9. addons/caching-strategies.php +478 -478
  10. addons/index.php +1 -1
  11. addons/pull-to-refresh.php +387 -387
  12. addons/utm-tracking.php +390 -390
  13. admin/admin-ui-render-addons.php +640 -625
  14. admin/admin-ui-render-settings.php +809 -782
  15. admin/admin-ui-render-upgrade.php +297 -297
  16. admin/admin-ui-setup.php +616 -606
  17. admin/basic-setup.php +493 -493
  18. admin/css/upgrade-ui.css +611 -611
  19. admin/deactivate-feedback.php +37 -36
  20. admin/index.php +1 -1
  21. admin/js/jszip.min.js +198 -198
  22. admin/js/main.js +275 -260
  23. admin/js/pre-cache.js +24 -24
  24. admin/js/superpwa-ptr-lib.min.js +7 -7
  25. admin/make-better-admin.css +41 -41
  26. admin/make-better-admin.js +81 -81
  27. admin/mb-helper-function.php +115 -115
  28. composer.json +27 -27
  29. composer.lock +178 -178
  30. functions/common.php +451 -451
  31. functions/filesystem.php +106 -106
  32. functions/index.php +1 -1
  33. functions/multisite.php +105 -105
  34. includes/index.php +1 -1
  35. index.php +1 -1
  36. languages/index.php +1 -1
  37. languages/super-progressive-web-apps-fr_FR.po +480 -480
  38. languages/super-progressive-web-apps.pot +390 -390
  39. license.txt +281 -281
  40. loader.php +38 -38
  41. phpcs.xml +5 -5
  42. public/amphtml.php +35 -35
  43. public/images/index.php +1 -1
  44. public/images/offers.png +0 -0
  45. public/images/screenshot-472x1024.png +0 -0
  46. public/index.php +1 -1
  47. public/js/index.php +1 -1
  48. public/js/register-sw.js +261 -261
  49. public/manifest.php +482 -466
  50. public/sw.php +496 -481
  51. readme.txt +6 -584
.gitignore DELETED
@@ -1 +0,0 @@
1
- vendor
 
3rd-party/amp.php CHANGED
@@ -1,115 +1,115 @@
1
- <?php
2
- /**
3
- * AMP Support Implementation
4
- *
5
- * @since 2.2
6
- */
7
-
8
- // Exit if accessed directly
9
- if ( ! defined('ABSPATH') ) exit;
10
-
11
- class SUPERPWA_AMP_SW{
12
-
13
- public $is_amp = false;
14
- /**
15
- * Initialize whole front end system
16
- */
17
- public function __construct() {
18
- /* Check & initialize AMP is Activated or not*/
19
- $this->superpwa_is_amp_activated();
20
-
21
- // Change service worker filename to match OneSignal's service worker
22
- //add_filter( 'superpwa_sw_filename', array($this, 'superpwa_amp_sw_filename') );
23
-
24
- add_action('pre_amp_render_post', array($this, 'superpwa_amp_entry_point'));
25
- //Automattic AMP will be done here
26
- add_action('wp', array($this, 'superpwa_automattic_amp_entry_point'));
27
-
28
- }
29
-
30
- public function superpwa_amp_sw_filename( $sw_filename ) {
31
- return 'superpwa-amp-sw' . superpwa_multisite_filename_postfix() . '.js';
32
- }
33
-
34
- public function superpwa_amp_entry_point(){
35
-
36
- add_action('amp_post_template_footer',array($this, 'superpwa_amp_service_worker'), 15);
37
- add_filter('amp_post_template_data',array($this, 'superpwa_service_worker_script'),35);
38
- add_action('amp_post_template_head',array($this, 'superpwa_amp_manifest_json_relink'),1);
39
-
40
- }
41
-
42
- public function superpwa_automattic_amp_entry_point(){
43
- if ( superpwa_is_automattic_amp() ) {
44
-
45
- add_action('wp_footer',array($this, 'superpwa_amp_service_worker'));
46
- add_filter('amp_post_template_data',array($this, 'superpwa_service_worker_script'),35);
47
- //add_action('wp_head',array($this, 'pwaforwp_paginated_post_add_homescreen_amp'),1);
48
- }
49
-
50
- }
51
-
52
- public function superpwa_amp_service_worker(){
53
-
54
- $url = superpwa_site_url();
55
- $home_url = superpwa_home_url();
56
- $swhtml = $url.'superpwa-amp-sw'.superpwa_multisite_filename_postfix().'.html';
57
- $swjs_path_amp = $url.'superpwa-sw'.superpwa_multisite_filename_postfix().'.js';
58
- ?>
59
- <amp-install-serviceworker data-scope="<?php echo trailingslashit($home_url); ?>"
60
- src="<?php echo esc_url_raw($swjs_path_amp); ?>"
61
- data-iframe-src="<?php echo esc_url_raw($swhtml); ?>"
62
- layout="nodisplay">
63
- </amp-install-serviceworker>
64
-
65
- <?php
66
- }
67
-
68
- public function superpwa_amp_manifest_json_relink(){
69
-
70
-
71
- $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
72
- $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
73
-
74
- // theme-color meta tag
75
- if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
76
-
77
- // Get Settings
78
- $settings = superpwa_get_settings();
79
- $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
80
- }
81
-
82
- $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
83
-
84
- $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL;
85
-
86
- echo $tags;
87
-
88
- }
89
-
90
-
91
- public function superpwa_service_worker_script( $data ){
92
-
93
- if ( empty( $data['amp_component_scripts']['amp-install-serviceworker'] ) ) {
94
- $data['amp_component_scripts']['amp-install-serviceworker'] = 'https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js';
95
- }
96
- return $data;
97
-
98
- }
99
-
100
- public function superpwa_is_amp_activated() {
101
-
102
- if ( function_exists( 'ampforwp_is_amp_endpoint' ) || function_exists( 'is_amp_endpoint' ) ) {
103
- $this->is_amp = true;
104
- }
105
-
106
- }
107
-
108
- }
109
-
110
- // Initiate SUPERPWA_AMP_SW Class
111
- function superpwa_amp_sw_init() {
112
-
113
- new SUPERPWA_AMP_SW();
114
- }
115
  add_action( 'init', 'superpwa_amp_sw_init' );
1
+ <?php
2
+ /**
3
+ * AMP Support Implementation
4
+ *
5
+ * @since 2.2
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined('ABSPATH') ) exit;
10
+
11
+ class SUPERPWA_AMP_SW{
12
+
13
+ public $is_amp = false;
14
+ /**
15
+ * Initialize whole front end system
16
+ */
17
+ public function __construct() {
18
+ /* Check & initialize AMP is Activated or not*/
19
+ $this->superpwa_is_amp_activated();
20
+
21
+ // Change service worker filename to match OneSignal's service worker
22
+ //add_filter( 'superpwa_sw_filename', array($this, 'superpwa_amp_sw_filename') );
23
+
24
+ add_action('pre_amp_render_post', array($this, 'superpwa_amp_entry_point'));
25
+ //Automattic AMP will be done here
26
+ add_action('wp', array($this, 'superpwa_automattic_amp_entry_point'));
27
+
28
+ }
29
+
30
+ public function superpwa_amp_sw_filename( $sw_filename ) {
31
+ return 'superpwa-amp-sw' . superpwa_multisite_filename_postfix() . '.js';
32
+ }
33
+
34
+ public function superpwa_amp_entry_point(){
35
+
36
+ add_action('amp_post_template_footer',array($this, 'superpwa_amp_service_worker'), 15);
37
+ add_filter('amp_post_template_data',array($this, 'superpwa_service_worker_script'),35);
38
+ add_action('amp_post_template_head',array($this, 'superpwa_amp_manifest_json_relink'),1);
39
+
40
+ }
41
+
42
+ public function superpwa_automattic_amp_entry_point(){
43
+ if ( superpwa_is_automattic_amp() ) {
44
+
45
+ add_action('wp_footer',array($this, 'superpwa_amp_service_worker'));
46
+ add_filter('amp_post_template_data',array($this, 'superpwa_service_worker_script'),35);
47
+ //add_action('wp_head',array($this, 'pwaforwp_paginated_post_add_homescreen_amp'),1);
48
+ }
49
+
50
+ }
51
+
52
+ public function superpwa_amp_service_worker(){
53
+
54
+ $url = superpwa_site_url();
55
+ $home_url = superpwa_home_url();
56
+ $swhtml = $url.'superpwa-amp-sw'.superpwa_multisite_filename_postfix().'.html';
57
+ $swjs_path_amp = $url.'superpwa-sw'.superpwa_multisite_filename_postfix().'.js';
58
+ ?>
59
+ <amp-install-serviceworker data-scope="<?php echo trailingslashit($home_url); ?>"
60
+ src="<?php echo esc_url_raw($swjs_path_amp); ?>"
61
+ data-iframe-src="<?php echo esc_url_raw($swhtml); ?>"
62
+ layout="nodisplay">
63
+ </amp-install-serviceworker>
64
+
65
+ <?php
66
+ }
67
+
68
+ public function superpwa_amp_manifest_json_relink(){
69
+
70
+
71
+ $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
72
+ $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
73
+
74
+ // theme-color meta tag
75
+ if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
76
+
77
+ // Get Settings
78
+ $settings = superpwa_get_settings();
79
+ $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
80
+ }
81
+
82
+ $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
83
+
84
+ $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL;
85
+
86
+ echo $tags;
87
+
88
+ }
89
+
90
+
91
+ public function superpwa_service_worker_script( $data ){
92
+
93
+ if ( empty( $data['amp_component_scripts']['amp-install-serviceworker'] ) ) {
94
+ $data['amp_component_scripts']['amp-install-serviceworker'] = 'https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js';
95
+ }
96
+ return $data;
97
+
98
+ }
99
+
100
+ public function superpwa_is_amp_activated() {
101
+
102
+ if ( function_exists( 'ampforwp_is_amp_endpoint' ) || function_exists( 'is_amp_endpoint' ) ) {
103
+ $this->is_amp = true;
104
+ }
105
+
106
+ }
107
+
108
+ }
109
+
110
+ // Initiate SUPERPWA_AMP_SW Class
111
+ function superpwa_amp_sw_init() {
112
+
113
+ new SUPERPWA_AMP_SW();
114
+ }
115
  add_action( 'init', 'superpwa_amp_sw_init' );
3rd-party/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
3rd-party/onesignal.php CHANGED
@@ -1,239 +1,239 @@
1
- <?php
2
- /**
3
- * OneSignal integration
4
- *
5
- * @link https://wordpress.org/plugins/onesignal-free-web-push-notifications/
6
- *
7
- * @since 1.6
8
- *
9
- * @function superpwa_onesignal_todo() Compatibility with OneSignal
10
- * @function superpwa_onesignal_add_gcm_sender_id() Add gcm_sender_id to SuperPWA manifest
11
- * @function superpwa_onesignal_sw_filename() Change Service Worker filename to OneSignalSDKWorker.js.php
12
- * @function superpwa_onesignal_sw() Import OneSignal service worker in SuperPWA
13
- * @function superpwa_onesignal_activation() OneSignal activation todo
14
- * @function superpwa_onesignal_deactivation() OneSignal deactivation todo
15
- * @function superpwa_onesignal_admin_notices() Admin notices for OneSignal compatibility
16
- */
17
-
18
- // Exit if accessed directly
19
- if ( ! defined('ABSPATH') ) exit;
20
-
21
- /**
22
- * Compatibility with OneSignal
23
- *
24
- * This was written without a function @since 1.6 but that caused issues in certain cases where
25
- * SuperPWA was loaded before OneSignal. Hooked everything to plugins_loaded @since 2.0.1
26
- *
27
- * @author Arun Basil Lal
28
- *
29
- * @since 2.0.1
30
- */
31
- function superpwa_onesignal_todo() {
32
-
33
- // If OneSignal is installed and active
34
- if ( class_exists( 'OneSignal' ) ) {
35
-
36
- // Filter manifest and service worker for singe websites and not for multisites.
37
- if ( ! is_multisite() ) {
38
-
39
- // Add gcm_sender_id to SuperPWA manifest
40
- add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
41
-
42
- // Change service worker filename to match OneSignal's service worker
43
- add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
44
-
45
- // Import OneSignal service worker in SuperPWA
46
- add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
47
- }else{
48
- //Added filter for multisites
49
- // Add gcm_sender_id to SuperPWA manifest
50
- add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
51
-
52
- // Change service worker filename to match OneSignal's service worker
53
- add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
54
-
55
- // Import OneSignal service worker in SuperPWA
56
- add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
57
- }
58
-
59
-
60
- }
61
- }
62
- add_action( 'plugins_loaded', 'superpwa_onesignal_todo' );
63
-
64
- /**
65
- * Add gcm_sender_id to SuperPWA manifest
66
- *
67
- * OneSignal's gcm_sender_id is 482941778795
68
- *
69
- * @param (array) $manifest Array with the manifest entries passed via the superpwa_manifest filter.
70
- *
71
- * @return (array) Array appended with the gcm_sender_id of OneSignal
72
- *
73
- * @since 1.8
74
- */
75
- function superpwa_onesignal_add_gcm_sender_id( $manifest ) {
76
-
77
- $manifest['gcm_sender_id'] = '482941778795';
78
-
79
- return $manifest;
80
- }
81
-
82
- /**
83
- * Change Service Worker filename to OneSignalSDKWorker.js.php
84
- *
85
- * OneSignalSDKWorker.js.php is the name of the service worker of OneSignal.
86
- * Since only one service worker is allowed in a given scope, OneSignal unregisters all other service workers and registers theirs.
87
- * Having the same name prevents OneSignal from unregistering our service worker.
88
- *
89
- * @link https://documentation.onesignal.com/docs/web-push-setup-faq
90
- *
91
- * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
92
- *
93
- * @return (string) Service worker filename changed to OneSignalSDKWorker.js.php
94
- *
95
- * @since 1.8
96
- */
97
- function superpwa_onesignal_sw_filename( $sw_filename ) {
98
- return 'OneSignalSDKWorker' . superpwa_multisite_filename_postfix() . '.js.php';
99
- }
100
-
101
- /**
102
- * Import OneSignal service worker in SuperPWA
103
- *
104
- * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
105
- *
106
- * @return (string) Import OneSignal's service worker into SuperPWA
107
- *
108
- * @author SuperPWA Team
109
- *
110
- * @since 1.8
111
- * @since 2.0 Removed content-type header for compatibility with dynamic service workers.
112
- * @since 2.0.1 Added back compatibility with static service workers by sending content-type header.
113
- */
114
- function superpwa_onesignal_sw( $sw ) {
115
-
116
- /**
117
- * Checking to see if we are already sending the Content-Type header.
118
- *
119
- * @see superpwa_generate_sw_and_manifest_on_fly()
120
- */
121
- $match = preg_grep( '#Content-Type: text/javascript#i', headers_list() );
122
-
123
- if ( ! empty ( $match ) ) {
124
-
125
- $onesignal = 'importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );' . PHP_EOL;
126
-
127
- return $onesignal . $sw;
128
- }
129
-
130
- $onesignal = '<?php' . PHP_EOL;
131
- $onesignal .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
132
- $onesignal .= 'echo "importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );";' . PHP_EOL;
133
- $onesignal .= '?>' . PHP_EOL . PHP_EOL;
134
-
135
- return $onesignal . $sw;
136
- }
137
-
138
- /**
139
- * OneSignal activation todo
140
- *
141
- * Regenerates SuperPWA manifest with the gcm_sender_id added.
142
- * Delete current service worker.
143
- * Regenerate SuperPWA service worker with the new filename.
144
- *
145
- * @author SuperPWA Team
146
- *
147
- * @since 1.8
148
- * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
149
- */
150
- function superpwa_onesignal_activation() {
151
-
152
- // Do not do anything for multisites
153
- if ( is_multisite() ) {
154
- return;
155
- }
156
-
157
- // Filter in gcm_sender_id to SuperPWA manifest
158
- add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
159
-
160
- // Regenerate SuperPWA manifest
161
- superpwa_generate_manifest();
162
-
163
- // Delete service worker if it exists
164
- superpwa_delete_sw();
165
-
166
- // Change service worker filename to match OneSignal's service worker
167
- add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
168
-
169
- // Import OneSignal service worker in SuperPWA
170
- add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
171
-
172
- // Regenerate SuperPWA service worker
173
- superpwa_generate_sw();
174
- }
175
- add_action( 'activate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_activation', 11 );
176
-
177
- /**
178
- * OneSignal deactivation todo
179
- *
180
- * Regenerates SuperPWA manifest.
181
- * Delete current service worker.
182
- * Regenerate SuperPWA service worker.
183
- *
184
- * @author SuperPWA Team
185
- *
186
- * @since 1.8
187
- * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
188
- */
189
- function superpwa_onesignal_deactivation() {
190
-
191
- // Do not do anything for multisites
192
- if ( is_multisite() ) {
193
- return;
194
- }
195
-
196
- // Remove gcm_sender_id from SuperPWA manifest
197
- remove_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
198
-
199
- // Regenerate SuperPWA manifest
200
- superpwa_generate_manifest();
201
-
202
- // Delete service worker if it exists
203
- superpwa_delete_sw();
204
-
205
- // Restore the default service worker of SuperPWA
206
- remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
207
-
208
- // Remove OneSignal service worker in SuperPWA
209
- remove_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
210
-
211
- // Regenerate SuperPWA service worker
212
- superpwa_generate_sw();
213
- }
214
- add_action( 'deactivate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_deactivation', 11 );
215
-
216
- /**
217
- * Admin notices for OneSignal compatibility
218
- *
219
- * One Single installs, warn users to add SuperPWA manifest as custom manifest in OneSignal settings.
220
- * One multisites, warn users that SuperPWA and OneSignal cannot work together.
221
- *
222
- * @since 1.8.1
223
- * @since 2.1 Removed the notice recommending customers to add manifest to OneSignal.
224
- */
225
- function superpwa_onesignal_admin_notices() {
226
-
227
- // Incompatibility notice for Multisites
228
- if ( is_multisite() && current_user_can( 'manage_options' ) ) {
229
-
230
- echo '<div class="notice notice-warning"><p>' .
231
- sprintf(
232
- __( '<strong>SuperPWA</strong> is not compatible with OneSignal on multisites yet. Disable one of these plugins until the compatibility is available.<br>Please refer to the <a href="%s" target="_blank">OneSignal integration documentation</a> for more info. ', 'super-progressive-web-apps' ),
233
- 'https://superpwa.com/doc/setup-onesignal-with-superpwa/?utm_source=superpwa-plugin&utm_medium=onesignal-multisite-admin-notice#multisites'
234
- ) . '</p></div>';
235
-
236
- // Filter PWA status since PWA is not ready yet.
237
- add_filter( 'superpwa_is_pwa_ready', '__return_false' );
238
- }
239
  }
1
+ <?php
2
+ /**
3
+ * OneSignal integration
4
+ *
5
+ * @link https://wordpress.org/plugins/onesignal-free-web-push-notifications/
6
+ *
7
+ * @since 1.6
8
+ *
9
+ * @function superpwa_onesignal_todo() Compatibility with OneSignal
10
+ * @function superpwa_onesignal_add_gcm_sender_id() Add gcm_sender_id to SuperPWA manifest
11
+ * @function superpwa_onesignal_sw_filename() Change Service Worker filename to OneSignalSDKWorker.js.php
12
+ * @function superpwa_onesignal_sw() Import OneSignal service worker in SuperPWA
13
+ * @function superpwa_onesignal_activation() OneSignal activation todo
14
+ * @function superpwa_onesignal_deactivation() OneSignal deactivation todo
15
+ * @function superpwa_onesignal_admin_notices() Admin notices for OneSignal compatibility
16
+ */
17
+
18
+ // Exit if accessed directly
19
+ if ( ! defined('ABSPATH') ) exit;
20
+
21
+ /**
22
+ * Compatibility with OneSignal
23
+ *
24
+ * This was written without a function @since 1.6 but that caused issues in certain cases where
25
+ * SuperPWA was loaded before OneSignal. Hooked everything to plugins_loaded @since 2.0.1
26
+ *
27
+ * @author Arun Basil Lal
28
+ *
29
+ * @since 2.0.1
30
+ */
31
+ function superpwa_onesignal_todo() {
32
+
33
+ // If OneSignal is installed and active
34
+ if ( class_exists( 'OneSignal' ) ) {
35
+
36
+ // Filter manifest and service worker for singe websites and not for multisites.
37
+ if ( ! is_multisite() ) {
38
+
39
+ // Add gcm_sender_id to SuperPWA manifest
40
+ add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
41
+
42
+ // Change service worker filename to match OneSignal's service worker
43
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
44
+
45
+ // Import OneSignal service worker in SuperPWA
46
+ add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
47
+ }else{
48
+ //Added filter for multisites
49
+ // Add gcm_sender_id to SuperPWA manifest
50
+ add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
51
+
52
+ // Change service worker filename to match OneSignal's service worker
53
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
54
+
55
+ // Import OneSignal service worker in SuperPWA
56
+ add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
57
+ }
58
+
59
+
60
+ }
61
+ }
62
+ add_action( 'plugins_loaded', 'superpwa_onesignal_todo' );
63
+
64
+ /**
65
+ * Add gcm_sender_id to SuperPWA manifest
66
+ *
67
+ * OneSignal's gcm_sender_id is 482941778795
68
+ *
69
+ * @param (array) $manifest Array with the manifest entries passed via the superpwa_manifest filter.
70
+ *
71
+ * @return (array) Array appended with the gcm_sender_id of OneSignal
72
+ *
73
+ * @since 1.8
74
+ */
75
+ function superpwa_onesignal_add_gcm_sender_id( $manifest ) {
76
+
77
+ $manifest['gcm_sender_id'] = '482941778795';
78
+
79
+ return $manifest;
80
+ }
81
+
82
+ /**
83
+ * Change Service Worker filename to OneSignalSDKWorker.js.php
84
+ *
85
+ * OneSignalSDKWorker.js.php is the name of the service worker of OneSignal.
86
+ * Since only one service worker is allowed in a given scope, OneSignal unregisters all other service workers and registers theirs.
87
+ * Having the same name prevents OneSignal from unregistering our service worker.
88
+ *
89
+ * @link https://documentation.onesignal.com/docs/web-push-setup-faq
90
+ *
91
+ * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
92
+ *
93
+ * @return (string) Service worker filename changed to OneSignalSDKWorker.js.php
94
+ *
95
+ * @since 1.8
96
+ */
97
+ function superpwa_onesignal_sw_filename( $sw_filename ) {
98
+ return 'OneSignalSDKWorker' . superpwa_multisite_filename_postfix() . '.js.php';
99
+ }
100
+
101
+ /**
102
+ * Import OneSignal service worker in SuperPWA
103
+ *
104
+ * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
105
+ *
106
+ * @return (string) Import OneSignal's service worker into SuperPWA
107
+ *
108
+ * @author SuperPWA Team
109
+ *
110
+ * @since 1.8
111
+ * @since 2.0 Removed content-type header for compatibility with dynamic service workers.
112
+ * @since 2.0.1 Added back compatibility with static service workers by sending content-type header.
113
+ */
114
+ function superpwa_onesignal_sw( $sw ) {
115
+
116
+ /**
117
+ * Checking to see if we are already sending the Content-Type header.
118
+ *
119
+ * @see superpwa_generate_sw_and_manifest_on_fly()
120
+ */
121
+ $match = preg_grep( '#Content-Type: text/javascript#i', headers_list() );
122
+
123
+ if ( ! empty ( $match ) ) {
124
+
125
+ $onesignal = 'importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );' . PHP_EOL;
126
+
127
+ return $onesignal . $sw;
128
+ }
129
+
130
+ $onesignal = '<?php' . PHP_EOL;
131
+ $onesignal .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
132
+ $onesignal .= 'echo "importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );";' . PHP_EOL;
133
+ $onesignal .= '?>' . PHP_EOL . PHP_EOL;
134
+
135
+ return $onesignal . $sw;
136
+ }
137
+
138
+ /**
139
+ * OneSignal activation todo
140
+ *
141
+ * Regenerates SuperPWA manifest with the gcm_sender_id added.
142
+ * Delete current service worker.
143
+ * Regenerate SuperPWA service worker with the new filename.
144
+ *
145
+ * @author SuperPWA Team
146
+ *
147
+ * @since 1.8
148
+ * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
149
+ */
150
+ function superpwa_onesignal_activation() {
151
+
152
+ // Do not do anything for multisites
153
+ if ( is_multisite() ) {
154
+ return;
155
+ }
156
+
157
+ // Filter in gcm_sender_id to SuperPWA manifest
158
+ add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
159
+
160
+ // Regenerate SuperPWA manifest
161
+ superpwa_generate_manifest();
162
+
163
+ // Delete service worker if it exists
164
+ superpwa_delete_sw();
165
+
166
+ // Change service worker filename to match OneSignal's service worker
167
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
168
+
169
+ // Import OneSignal service worker in SuperPWA
170
+ add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
171
+
172
+ // Regenerate SuperPWA service worker
173
+ superpwa_generate_sw();
174
+ }
175
+ add_action( 'activate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_activation', 11 );
176
+
177
+ /**
178
+ * OneSignal deactivation todo
179
+ *
180
+ * Regenerates SuperPWA manifest.
181
+ * Delete current service worker.
182
+ * Regenerate SuperPWA service worker.
183
+ *
184
+ * @author SuperPWA Team
185
+ *
186
+ * @since 1.8
187
+ * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
188
+ */
189
+ function superpwa_onesignal_deactivation() {
190
+
191
+ // Do not do anything for multisites
192
+ if ( is_multisite() ) {
193
+ return;
194
+ }
195
+
196
+ // Remove gcm_sender_id from SuperPWA manifest
197
+ remove_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
198
+
199
+ // Regenerate SuperPWA manifest
200
+ superpwa_generate_manifest();
201
+
202
+ // Delete service worker if it exists
203
+ superpwa_delete_sw();
204
+
205
+ // Restore the default service worker of SuperPWA
206
+ remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
207
+
208
+ // Remove OneSignal service worker in SuperPWA
209
+ remove_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
210
+
211
+ // Regenerate SuperPWA service worker
212
+ superpwa_generate_sw();
213
+ }
214
+ add_action( 'deactivate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_deactivation', 11 );
215
+
216
+ /**
217
+ * Admin notices for OneSignal compatibility
218
+ *
219
+ * One Single installs, warn users to add SuperPWA manifest as custom manifest in OneSignal settings.
220
+ * One multisites, warn users that SuperPWA and OneSignal cannot work together.
221
+ *
222
+ * @since 1.8.1
223
+ * @since 2.1 Removed the notice recommending customers to add manifest to OneSignal.
224
+ */
225
+ function superpwa_onesignal_admin_notices() {
226
+
227
+ // Incompatibility notice for Multisites
228
+ if ( is_multisite() && current_user_can( 'manage_options' ) ) {
229
+
230
+ echo '<div class="notice notice-warning"><p>' .
231
+ sprintf(
232
+ __( '<strong>SuperPWA</strong> is not compatible with OneSignal on multisites yet. Disable one of these plugins until the compatibility is available.<br>Please refer to the <a href="%s" target="_blank">OneSignal integration documentation</a> for more info. ', 'super-progressive-web-apps' ),
233
+ 'https://superpwa.com/doc/setup-onesignal-with-superpwa/?utm_source=superpwa-plugin&utm_medium=onesignal-multisite-admin-notice#multisites'
234
+ ) . '</p></div>';
235
+
236
+ // Filter PWA status since PWA is not ready yet.
237
+ add_filter( 'superpwa_is_pwa_ready', '__return_false' );
238
+ }
239
  }
3rd-party/wonderpush.php CHANGED
@@ -1,117 +1,117 @@
1
- <?php
2
- /**
3
- * WonderPush integration
4
- *
5
- * @link https://wordpress.org/plugins/wonderpush-web-push-notifications/
6
- *
7
- * @since 2.2.2
8
- *
9
- * @function superpwa_wonderpush_compatibility() Compatibility with WonderPush
10
-
11
- * @function superpwa_wonderpush_sw_filename() Change Service Worker filename to WonderPushSDKWorker.js.php
12
- * @function superpwa_wonderpush_sw() Import WonderPush service worker in SuperPWA
13
- */
14
-
15
- // Exit if accessed directly
16
- if ( ! defined('ABSPATH') ) exit;
17
-
18
- /**
19
- * Compatibility with WonderPush
20
- *
21
- * @since 2.0.2
22
- */
23
- function superpwa_wonderpush_compatibility() {
24
-
25
- // If OneSignal is installed and active
26
- if ( class_exists( 'WonderPushSettings' ) ) {
27
-
28
-
29
- // Change service worker filename to match WonderPush's service worker
30
- add_filter( 'superpwa_sw_filename', 'superpwa_wonderpush_sw_filename' );
31
-
32
- // Import WonderPush service worker in SuperPWA
33
- add_filter( 'superpwa_sw_template', 'superpwa_wonderpush_sw' );
34
- }
35
- }
36
- add_action( 'plugins_loaded', 'superpwa_wonderpush_compatibility' );
37
-
38
-
39
- /**
40
- * Change Service Worker filename to WonderPushSDKWorker.js.php
41
- *
42
- * WonderPushSDKWorker.js.php is the name of the service worker of WonderPush.
43
- * Since only one service worker is allowed in a given scope, WonderPush unregisters all other service workers and registers theirs.
44
- * Having the same name prevents WonderPush from unregistering our service worker.
45
- *
46
- * @link https://documentation.onesignal.com/docs/web-push-setup-faq
47
- *
48
- * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
49
- *
50
- * @return (string) Service worker filename changed to WonderPushSDKWorker.js.php
51
- *
52
- * @since 2.2.2
53
- */
54
- function superpwa_wonderpush_sw_filename( $sw_filename ) {
55
- return 'WonderPushSDKWorker' . superpwa_multisite_filename_postfix() . '.js.php';
56
- }
57
-
58
- /**
59
- * Import WonderPush service worker in SuperPWA
60
- *
61
- * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
62
- *
63
- * @return (string) Import WonderPush's service worker into SuperPWA
64
- *
65
- * @author SuperPWA Team
66
- *
67
- * @since 2.2.2
68
- */
69
- function superpwa_wonderpush_sw( $sw ) {
70
-
71
-
72
- $settings = WonderPushSettings::getSettings();
73
- $access_token = $settings->getAccessToken();
74
-
75
- if(class_exists('WonderPushSettings')){
76
- try {
77
- $app = WonderPushUtils::application_from_access_token($access_token);
78
- } catch (Exception $e) {
79
-
80
- return $sw;
81
- }
82
- if (!$app) return $sw;
83
- $web_key = $app->getWebKey();
84
- }else{
85
- return $sw;
86
- }
87
-
88
-
89
- /**
90
- * Checking to see if we are already sending the Content-Type header.
91
- *
92
- * @see superpwa_generate_sw_and_manifest_on_fly()
93
- */
94
- $match = preg_grep( '#Content-Type: text/javascript#i', headers_list() );
95
-
96
- if ( ! empty ( $match ) ) {
97
-
98
- $wonderpush = 'importScripts(\'https://cdn.by.wonderpush.com/sdk/1.1/wonderpush-loader.min.js\');
99
- WonderPush = self.WonderPush || [];
100
- WonderPush.push([\'init\', {
101
- webKey: \''.$web_key.'\',
102
- }]);' . PHP_EOL;
103
-
104
- return $wonderpush . $sw;
105
- }
106
-
107
- $wonderpush = '<?php' . PHP_EOL;
108
- $wonderpush .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
109
- $wonderpush .= 'echo "importScripts(\'https://cdn.by.wonderpush.com/sdk/1.1/wonderpush-loader.min.js\');
110
- WonderPush = self.WonderPush || [];
111
- WonderPush.push([\'init\', {
112
- webKey: \''.$web_key.'\',
113
- }]);";' . PHP_EOL;
114
- $wonderpush .= '?>' . PHP_EOL . PHP_EOL;
115
-
116
- return $wonderpush . $sw;
117
  }
1
+ <?php
2
+ /**
3
+ * WonderPush integration
4
+ *
5
+ * @link https://wordpress.org/plugins/wonderpush-web-push-notifications/
6
+ *
7
+ * @since 2.2.2
8
+ *
9
+ * @function superpwa_wonderpush_compatibility() Compatibility with WonderPush
10
+
11
+ * @function superpwa_wonderpush_sw_filename() Change Service Worker filename to WonderPushSDKWorker.js.php
12
+ * @function superpwa_wonderpush_sw() Import WonderPush service worker in SuperPWA
13
+ */
14
+
15
+ // Exit if accessed directly
16
+ if ( ! defined('ABSPATH') ) exit;
17
+
18
+ /**
19
+ * Compatibility with WonderPush
20
+ *
21
+ * @since 2.0.2
22
+ */
23
+ function superpwa_wonderpush_compatibility() {
24
+
25
+ // If OneSignal is installed and active
26
+ if ( class_exists( 'WonderPushSettings' ) ) {
27
+
28
+
29
+ // Change service worker filename to match WonderPush's service worker
30
+ add_filter( 'superpwa_sw_filename', 'superpwa_wonderpush_sw_filename' );
31
+
32
+ // Import WonderPush service worker in SuperPWA
33
+ add_filter( 'superpwa_sw_template', 'superpwa_wonderpush_sw' );
34
+ }
35
+ }
36
+ add_action( 'plugins_loaded', 'superpwa_wonderpush_compatibility' );
37
+
38
+
39
+ /**
40
+ * Change Service Worker filename to WonderPushSDKWorker.js.php
41
+ *
42
+ * WonderPushSDKWorker.js.php is the name of the service worker of WonderPush.
43
+ * Since only one service worker is allowed in a given scope, WonderPush unregisters all other service workers and registers theirs.
44
+ * Having the same name prevents WonderPush from unregistering our service worker.
45
+ *
46
+ * @link https://documentation.onesignal.com/docs/web-push-setup-faq
47
+ *
48
+ * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
49
+ *
50
+ * @return (string) Service worker filename changed to WonderPushSDKWorker.js.php
51
+ *
52
+ * @since 2.2.2
53
+ */
54
+ function superpwa_wonderpush_sw_filename( $sw_filename ) {
55
+ return 'WonderPushSDKWorker' . superpwa_multisite_filename_postfix() . '.js.php';
56
+ }
57
+
58
+ /**
59
+ * Import WonderPush service worker in SuperPWA
60
+ *
61
+ * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
62
+ *
63
+ * @return (string) Import WonderPush's service worker into SuperPWA
64
+ *
65
+ * @author SuperPWA Team
66
+ *
67
+ * @since 2.2.2
68
+ */
69
+ function superpwa_wonderpush_sw( $sw ) {
70
+
71
+
72
+ $settings = WonderPushSettings::getSettings();
73
+ $access_token = $settings->getAccessToken();
74
+
75
+ if(class_exists('WonderPushSettings')){
76
+ try {
77
+ $app = WonderPushUtils::application_from_access_token($access_token);
78
+ } catch (Exception $e) {
79
+
80
+ return $sw;
81
+ }
82
+ if (!$app) return $sw;
83
+ $web_key = $app->getWebKey();
84
+ }else{
85
+ return $sw;
86
+ }
87
+
88
+
89
+ /**
90
+ * Checking to see if we are already sending the Content-Type header.
91
+ *
92
+ * @see superpwa_generate_sw_and_manifest_on_fly()
93
+ */
94
+ $match = preg_grep( '#Content-Type: text/javascript#i', headers_list() );
95
+
96
+ if ( ! empty ( $match ) ) {
97
+
98
+ $wonderpush = 'importScripts(\'https://cdn.by.wonderpush.com/sdk/1.1/wonderpush-loader.min.js\');
99
+ WonderPush = self.WonderPush || [];
100
+ WonderPush.push([\'init\', {
101
+ webKey: \''.$web_key.'\',
102
+ }]);' . PHP_EOL;
103
+
104
+ return $wonderpush . $sw;
105
+ }
106
+
107
+ $wonderpush = '<?php' . PHP_EOL;
108
+ $wonderpush .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
109
+ $wonderpush .= 'echo "importScripts(\'https://cdn.by.wonderpush.com/sdk/1.1/wonderpush-loader.min.js\');
110
+ WonderPush = self.WonderPush || [];
111
+ WonderPush.push([\'init\', {
112
+ webKey: \''.$web_key.'\',
113
+ }]);";' . PHP_EOL;
114
+ $wonderpush .= '?>' . PHP_EOL . PHP_EOL;
115
+
116
+ return $wonderpush . $sw;
117
  }
3rd-party/yandex.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
- /**
3
- * yandex integration
4
- *
5
- * @link https://wordpress.org/plugins/onesignal-free-web-push-notifications/
6
- *
7
- * @since 1.6
8
- *
9
- * @function superpwa_yandex_manifest_support() Add array of yandex to SuperPWA manifest as per https://yandex.ru/dev/turboapps/doc/dev/manifest.html
10
- */
11
-
12
- add_filter( 'superpwa_manifest', 'superpwa_yandex_manifest_support' );
13
- function superpwa_yandex_manifest_support( $manifest ){
14
-
15
- // Get Settings
16
- $settings = superpwa_get_settings();
17
- if( isset($settings['yandex_support']) && $settings['yandex_support']==1 ){
18
- $manifest['yandex'] = array(
19
- 'manifest_version' => 1,
20
- 'app_version' => SUPERPWA_VERSION,
21
- 'cache' => array(
22
- 'resources'=> array('/style.css'),
23
- 'ignored_query_params'=> array(),
24
- )
25
- );
26
- }
27
-
28
- return $manifest;
29
  }
1
+ <?php
2
+ /**
3
+ * yandex integration
4
+ *
5
+ * @link https://wordpress.org/plugins/onesignal-free-web-push-notifications/
6
+ *
7
+ * @since 1.6
8
+ *
9
+ * @function superpwa_yandex_manifest_support() Add array of yandex to SuperPWA manifest as per https://yandex.ru/dev/turboapps/doc/dev/manifest.html
10
+ */
11
+
12
+ add_filter( 'superpwa_manifest', 'superpwa_yandex_manifest_support' );
13
+ function superpwa_yandex_manifest_support( $manifest ){
14
+
15
+ // Get Settings
16
+ $settings = superpwa_get_settings();
17
+ if( isset($settings['yandex_support']) && $settings['yandex_support']==1 ){
18
+ $manifest['yandex'] = array(
19
+ 'manifest_version' => 1,
20
+ 'app_version' => SUPERPWA_VERSION,
21
+ 'cache' => array(
22
+ 'resources'=> array('/style.css'),
23
+ 'ignored_query_params'=> array(),
24
+ )
25
+ );
26
+ }
27
+
28
+ return $manifest;
29
  }
README.MD CHANGED
@@ -1,236 +1,236 @@
1
- # Super Progressive Web Apps
2
- <p>
3
- <a href="https://twitter.com/intent/follow?screen_name=superpwa">
4
- <img src="https://img.shields.io/twitter/follow/superpwa.svg?style=social&logo=twitter" alt="follow SuperPWA on Twitter">
5
- </a>
6
- <a href="https://github.com/SuperPWA/Super-Progressive-Web-Apps">
7
- <img src="https://img.shields.io/github/stars/SuperPWA/Super-Progressive-Web-Apps.svg?style=social&logo=github&label=SuperPWA" alt="Star Super Progressive Web Apps">
8
- </a>
9
-
10
-
11
- </p>
12
-
13
- <p align="center">
14
- <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-SuperPWALogo">
15
- <img src="https://pbs.twimg.com/profile_images/975224418543681536/X9-CESOD_400x400.jpg" alt="Super Progressive Web Apps" width=175 height=175>
16
- </a>
17
-
18
- <h3 align="center">Super Progressive Web Apps</h3>
19
-
20
- <p align="center">
21
- SuperPWA helps to convert your WordPress website into Progressive Web Apps easily.
22
- <br>
23
- <br>
24
- <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-viewWeb"><strong>Visit Website »</strong></a>
25
- <br>
26
- <br>
27
- <a href="https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/new?template=bug.md">Report bug</a>
28
- ·
29
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">WordPress Plugin</a>
30
- ·
31
- <a href="https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/">Reviews</a>
32
- ·
33
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/#faq">FAQ</a>
34
- ·
35
- <a href="#-contributions">Contributions</a>
36
- </p>
37
- </p>
38
-
39
-
40
- <p align="center">
41
- <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-LighthouseScore">
42
- <img src="https://lighthouse-badge.appspot.com?score=100" alt="LightHouse Score">
43
- </a>
44
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
45
- <img src="https://img.shields.io/wordpress/plugin/dt/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Downloads">
46
- </a>
47
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
48
- <img src="https://img.shields.io/wordpress/plugin/r/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Rating">
49
- </a>
50
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
51
- <img src="https://img.shields.io/wordpress/plugin/v/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Version">
52
- </a>
53
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
54
- <img src="https://img.shields.io/wordpress/v/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Version">
55
- </a>
56
- </p>
57
-
58
- ## Welcome to the Super PWA GitHub repository
59
-
60
- ⚡️ Demo : <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-WelcomeDemo">superpwa.com</a> [Check Video's to know how it works](#videos-on-how-add-to-home-screen--progressive-web-apps-works-on-different-browsers)
61
-
62
- ## What is Progressive Web Apps
63
- Progressive Web Apps (PWA) is a new technology that creates a middle ground between a website and a mobile app. They are installed on the phone like a normal app (web app) and can be accessed from the home screen.
64
-
65
- Users can come back to your website by launching the app from their home screen and interact with your website through an app-like interface. Your return visitors will experience almost-instant loading times and enjoy the great performance benefits of your PWA!
66
-
67
- <a href="https://superpwa.com?utm_source=github&utm_medium=Readme-what-is-pwa">Super Progressive Web Apps</a> makes it easy for you to convert your WordPress website into a Progressive Web App easily!
68
-
69
- ## ⭐ Support the project
70
- If you feel super excited and want to support us in a small way, please consider starring and/or sharing the repo! This helps us getting known and grow the community.
71
-
72
- <a href="#"><img src="https://raw.githubusercontent.com/josevarghese/Super-Progressive-Web-Apps/master/jose-github-star-gif.gif" alt="Star our repo" width="300px" height="76.95px" /></a>
73
-
74
- Also you can support us via [following on social media's and share about us](#share-via-social-medias-and-spread-superpwa).
75
-
76
- ## 🏗 Installation
77
- Once SuperPWA ⚡️ is installed, users browsing your website from a supported mobile device will see a "Add To Home Screen" notice (from the bottom of the screen) and will be able to 'install your website' on the home screen of their device. Every page visited is stored locally on their device and will be available to read even when they are offline!
78
-
79
- SuperPWA is easy to configure, it takes less than a minute to set-up your Progressive Web App! SuperPWA does a clean uninstall, by removing every database entry and file that it creates. In fact, none of the default settings are saved to the database until you manually save it the first time. Go ahead and give it a try.
80
-
81
- ### 💡 Progressive Web App Minimum Requirments
82
- - [x] Progressive Web Apps require that your WordPress website is served from a secure origin i.e. your website should be HTTPS and not HTTP. If your website isn’t HTTPS, please contact your host about it. You can also ask us [Support Forums](https://wordpress.org/support/plugin/super-progressive-web-apps) if you need help.
83
- </br>
84
-
85
- ##### Videos on How Add to Home Screen & Progressive Web Apps works on Different Browsers
86
-
87
- |<a href="https://www.youtube.com/watch?v=n3TjhNblvqs"><img src="http://i3.ytimg.com/vi/n3TjhNblvqs/maxresdefault.jpg" alt="Google Chrome for Android"/> </br>📽️ Google Chrome for Android| <a href="https://www.youtube.com/watch?v=9v4RwahRQFU"><img src="http://i3.ytimg.com/vi/9v4RwahRQFU/maxresdefault.jpg" alt="Mozilla Firefox for Android" /> </br>📽️ Mozilla Firefox for Android | <a href="https://www.youtube.com/watch?v=V8-AdKxm134"><img src="http://i3.ytimg.com/vi/V8-AdKxm134/maxresdefault.jpg" alt="Microsoft Edge for Android"/> </br>📽️ Microsoft Edge for Android | <a href="https://www.youtube.com/watch?v=Sbhgb6_QKfQ"><img src="http://i3.ytimg.com/vi/Sbhgb6_QKfQ/maxresdefault.jpg" alt="Samung Internet for Android "/> </br>📽️ Samung Internet for Android | <a href="https://www.youtube.com/watch?v=bV8xE6lOdoY"><img src="http://i3.ytimg.com/vi/bV8xE6lOdoY/maxresdefault.jpg" alt="PWA on iOS - Safari Browser"/> </br>📽️ PWA on iOS - Safari Browser |
88
- | :---------: | :---------: | :---------: | :---------: | :---------: |
89
- </br>
90
-
91
- ##### Detailed Documentations for testing PWA on Browsers
92
-
93
- * [PWA on Chrome for Android](https://superpwa.com/doc/test-pwa-google-chrome/)
94
- * [PWA on Desktop - Chrome](https://superpwa.com/doc/test-pwa-on-desktop/)
95
- * [PWA on iOS device - Safari Browser](https://superpwa.com/doc/test-pwa-ios-devices/)
96
- * [PWA on Microsoft Edge Browser for Android](https://superpwa.com/doc/test-pwa-microsoft-edge/)
97
- * [PWA on Samsung Internet Browser for Android](https://superpwa.com/doc/test-pwa-samsung-internet-browser/)
98
-
99
- #### 📦 What's in the box
100
-
101
- Here are the current features of Super Progressive Web Apps:
102
-
103
- * Generate a manifest for your website and add it to the head of your website.
104
- * Set the application icon for your Progressive Web App.
105
- * Set the background color for the splash screen of your Progressive Web App.
106
- * Your website will show the "Add to home screen" notice when accessed in a supported browser.
107
- * Aggressive caching of pages using CacheStorage API.
108
- * Pages once cached are served even if the user is offline.
109
- * Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
110
- * New in version 1.2: Support for theme-color.
111
- * New in version 1.2: Now you can edit the Application Name and Application Short name.
112
- * New in version 1.2: Set the start page of your PWA.
113
- * New in version 1.2: Set Accelerated Mobile Pages (AMP) version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
114
- * New in version 1.3: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
115
- * New in version 1.3: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
116
- * New in version 1.3: Improved in-browser service worker update handling.
117
- * New in version 1.4: You can now set the default orientation of your PWA. Choose from "any" (Follow Device Orientation), "Portrait" and "Landscape".
118
- * New in version 1.4: You can now set the theme_color property in the manifest.
119
- * New in version 1.5: OneSignal integration for Push notifications.
120
- * New in version 1.6: WordPress Multisite Network compatibility.
121
- * New in version 1.7: Add-Ons for SuperPWA is here! Ships with [UTM Tracking Add-On](https://superpwa.com/addons/utm-tracking/?utm_source=GitHub&utm_medium=Readme-version) to track visits coming from your PWA.
122
- * New in version 1.8: Compatibility issues with OneSignal are now resolved!
123
- * New in version 1.8: New Add-On: [Apple Touch Icons](https://superpwa.com/addons/apple-touch-icons/?utm_source=GitHub&utm_medium=Readme-version) that sets your app icons as Apple Touch Icons.
124
- * New in version 2.0: SuperPWA is now compatible with WordPress installed in a sub-folder.
125
- * New in version 2.0: You can now set [display property](https://superpwa.com/doc/web-app-manifest-display-modes/?utm_source=GitHub&utm_medium=Readme-version) from SuperPWA settings.
126
- * New in version 2.1.1: Support for maskabale icons.
127
-
128
- #### 🔮 Upcoming features:
129
- * Offline Indicator Notice.
130
-
131
- ### Device and Browser Support For PWA
132
- | | <img src="https://image.flaticon.com/icons/svg/732/732205.svg" alt="Chrome" width="32px" height="32px" /> Chrome | <img src="https://image.flaticon.com/icons/svg/732/732198.svg" alt="Firefox" width="32px" height="32px" /> Firefox | <img src="https://image.flaticon.com/icons/svg/732/732219.svg" alt="Edge" width="32px" height="32px" /> Edge | <img src="https://camo.githubusercontent.com/3fb130c75d01178836d96dcf3baccbe7b95b3642/68747470733a2f2f696d6167652e666c617469636f6e2e636f6d2f69636f6e732f7376672f3733322f3733323233332e737667" alt="Opera" width="32px" height="32px" /> Opera | <img src="https://image.flaticon.com/icons/svg/732/732241.svg" alt="Safari" width="32px" height="32px" /> Safari |<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Samsung_Internet_Logo.png/800px-Samsung_Internet_Logo.png" alt="Samsung" width="32px" height="32px" /> Samsung | <img src="https://upload.wikimedia.org/wikipedia/en/d/d0/UC_Browser_Logo.png" alt="UC Browser" width="32px" height="32px" /> UC Browser | <img src="https://upload.wikimedia.org/wikipedia/en/a/a5/Brave_Software_Logo.png" alt="Brave" width="32px" height="32px" /> Brave |
133
- | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: |
134
- | Add to Home Screen | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="20px" height="20px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="20px" height="20px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> |
135
- | Service Workers | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> |
136
- | Web Push & Notifications| <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="20px" height="20px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> |
137
- | Payment Request API | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | - | - |
138
- | Meta Theme Color | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | - | - | - | - | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | - | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> |
139
-
140
- </br>
141
-
142
- <p align="center">
143
- <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> Supported
144
- &nbsp;
145
- &nbsp;
146
- &nbsp;
147
- &nbsp;
148
- <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="32px" height="32px" /> Beta or Partial Support
149
- &nbsp;
150
- &nbsp;
151
- &nbsp;
152
- &nbsp;
153
- <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> In Development
154
- </p>
155
-
156
-
157
- Progressive web apps need browsers that support manifests and service workers. Currently Google Chrome (version 57+), Chrome for Android (62), Mozilla Firefox (57), Firefox for Android (58) are the major browsers that support PWA.
158
-
159
- The list is fast growing and is likely to be supported in most major browsers by the end of this year.
160
-
161
- ### Why Build Progressive Web Apps?
162
- [![Why Build Progressive Web Apps](http://i3.ytimg.com/vi/1QILz1lAzWY/maxresdefault.jpg)](https://www.youtube.com/embed/1QILz1lAzWY)
163
-
164
- ### How To Convert Your WordPress Website Into A Progressive Web App
165
-
166
- #### ⚙️ WordPress Installation
167
-
168
- * Visit WordPress Admin > **Plugins** > **Add New**
169
- * Search for **Super Progressive Web Apps**
170
- * Click "**Install Now**" and then "**Activate**" Super Progressive Web Apps
171
-
172
- #### ⚙️ To install manually:
173
-
174
- * Upload super-progressive-web-apps folder to the /wp-content/plugins/ directory on your server
175
- * Go to WordPress Admin > **Plugins**
176
- * Activate **Super Progressive Web Apps** plugin from the list.
177
-
178
- #### Customizing Your Progressive Web App
179
-
180
- Your Progressive Web App should be ready to test with the default settings upon activation. You can customize it further and make it truly your own.
181
-
182
- * Go to WordPress Admin > "**SuperPWA**" > **Settings**
183
- * Set a Background Color for the splash screen to be shown when your PWA is opened on a mobile device.
184
- * Set the Application Icon. This will be the icon of your PWA when it is added to the homescreen in a mobile device. The icon must be a PNG image and exactly 192 x 192 pixels in size.
185
- * Set the Offline Page. This page will be displayed if the user is offline and the page he requested is not cached already. Ideally you should create a dedicated WordPress page and set it here. Within the page you create, you could add a note that reads, "It looks like you are offline and the page you requested is not available right now. Please check back again once you are online.".
186
- * Click "Save Settings".
187
-
188
- #### Testing Your Progressive Web App
189
-
190
- * Open a supported browser in a supported device (for eg: Chrome for Android (62 or higher) in an Android device)
191
- * Enter your website and wait till it fully loads
192
- * You should see a pop-up that has your Application Icon and a button that reads "ADD TO HOME SCREEN".
193
- * Click on it and your PWA will be added to your home screen. Wait for the install to complete.
194
- * Go to your home screen and open your PWA. Browse into a few pages if you like. Close the App.
195
- * Disconnect from the internet and now open your PWA again. You should be able to see all the pages that you previously browsed.
196
- * Try visiting a page that you did not visit before. You should see the page you set as your "Offline Page" in the settings of SuperPWA.
197
-
198
-
199
- ### 🤝 About us
200
- > We are a duo who got excited about the idea. Our mission is simple: Help you build an awesome PWA that your users would want to have on their home screen. When we first heard about PWA we wanted to learn everything about it. We have spent countless hours learning and wants to share it with the world. Please give us your constructive feedback and support.
201
-
202
- ## ⛷️ Support
203
- This is a developer's portal for Super Progressive Web Apps and should not be used for support. Please visit the
204
- [Support Forums](https://wordpress.org/support/plugin/super-progressive-web-apps).
205
-
206
- ## 🐛 Reporting bugs
207
- If you ever get stuck, we are here to watch your back! [Open a New Support Topic](https://wordpress.org/support/plugin/super-progressive-web-apps) ticket if you have a question or need a feature. We are super excited to hear your feedback and we want to genuinely help you build the best Progressive Web App for your WordPress website!
208
-
209
- ## 🎍 Contributions
210
- Anyone is welcome to contribute to Super PWA to make it SUPER.
211
-
212
- There are various ways you can contribute:
213
-
214
- * [Raise an issue](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues) on GitHub.
215
- * Follow and Engage with us on Social Media
216
-
217
- &nbsp;&nbsp;&nbsp; <a href="https://twitter.com/intent/follow?screen_name=superpwa" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174876.svg" title="Follow SuperPWA on Twitter" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
218
- <a href="https://www.youtube.com/channel/UCMFlNeutNCwTNls186moUUA" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174883.svg" title="Follow SuperPWA on YouTube" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
219
- <a href="https://www.facebook.com/SuperPWA/" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174848.svg" title="Follow SuperPWA on Facebook" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
220
- <a href="https://www.instagram.com/superpwa/" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174855.svg" title="Follow SuperPWA on Instagram" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
221
-
222
- * Send us a Pull Request with your bug fixes and/or new features.
223
- * Provide feedback and [suggestions on enhancements](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open).
224
- * ##### Share via Social Media's and spread SuperPWA
225
-
226
- &nbsp;&nbsp;&nbsp; <a href="https://twitter.com/home?status=Super%20Progressive%20Web%20Apps%20helps%20to%20convert%20your%20WordPress%20website%20into%20PWA%20%23SuperPWA%20https%3A//github.com/SuperPWA/Super-Progressive-Web-Apps/%20%40SuperPWA" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174876.svg" title="Share SuperPWA on Twitter" width=20 height=20> Share on Twitter </a>&nbsp;&nbsp;&nbsp;&nbsp;
227
- <p> &nbsp;&nbsp;&nbsp; <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A//github.com/SuperPWA/Super-Progressive-Web-Apps/" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174848.svg" title="Follow SuperPWA on Facebook" width=20 height=20> Share on Facebook </a>&nbsp;&nbsp;&nbsp;&nbsp;</p>
228
- <p> &nbsp;&nbsp;&nbsp; <a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A//github.com/SuperPWA/Super-Progressive-Web-Apps/&title=Super%20Progressive%20Web%20Apps&summary=Super%20Progressive%20Web%20Apps%20helps%20to%20convert%20your%20WordPress%20website%20into%20PWA%20%23SuperPWA&source=GitHub" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174857.svg" title="Share SuperPWA on LinkedIn" width=20 height=20> Share on LinkedIn</a>&nbsp;&nbsp;&nbsp;&nbsp;</p>
229
-
230
- ## 📇 Changelog
231
- [superpwa.com/changelog/](https://superpwa.com/changelog/?utm_source=GitHub&utm_medium=Readme-Changelog).
232
-
233
- Emoji Credits : [Emojipedia](emojipedia.org)
234
- Social Media Icon Credits : [Flaticon](flaticon.com)
235
-
236
- **[⬆ back to top](#super-progressive-web-apps)**
1
+ # Super Progressive Web Apps
2
+ <p>
3
+ <a href="https://twitter.com/intent/follow?screen_name=superpwa">
4
+ <img src="https://img.shields.io/twitter/follow/superpwa.svg?style=social&logo=twitter" alt="follow SuperPWA on Twitter">
5
+ </a>
6
+ <a href="https://github.com/SuperPWA/Super-Progressive-Web-Apps">
7
+ <img src="https://img.shields.io/github/stars/SuperPWA/Super-Progressive-Web-Apps.svg?style=social&logo=github&label=SuperPWA" alt="Star Super Progressive Web Apps">
8
+ </a>
9
+
10
+
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-SuperPWALogo">
15
+ <img src="https://pbs.twimg.com/profile_images/975224418543681536/X9-CESOD_400x400.jpg" alt="Super Progressive Web Apps" width=175 height=175>
16
+ </a>
17
+
18
+ <h3 align="center">Super Progressive Web Apps</h3>
19
+
20
+ <p align="center">
21
+ SuperPWA helps to convert your WordPress website into Progressive Web Apps easily.
22
+ <br>
23
+ <br>
24
+ <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-viewWeb"><strong>Visit Website »</strong></a>
25
+ <br>
26
+ <br>
27
+ <a href="https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/new?template=bug.md">Report bug</a>
28
+ ·
29
+ <a href="https://wordpress.org/plugins/super-progressive-web-apps/">WordPress Plugin</a>
30
+ ·
31
+ <a href="https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/">Reviews</a>
32
+ ·
33
+ <a href="https://wordpress.org/plugins/super-progressive-web-apps/#faq">FAQ</a>
34
+ ·
35
+ <a href="#-contributions">Contributions</a>
36
+ </p>
37
+ </p>
38
+
39
+
40
+ <p align="center">
41
+ <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-LighthouseScore">
42
+ <img src="https://lighthouse-badge.appspot.com?score=100" alt="LightHouse Score">
43
+ </a>
44
+ <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
45
+ <img src="https://img.shields.io/wordpress/plugin/dt/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Downloads">
46
+ </a>
47
+ <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
48
+ <img src="https://img.shields.io/wordpress/plugin/r/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Rating">
49
+ </a>
50
+ <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
51
+ <img src="https://img.shields.io/wordpress/plugin/v/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Version">
52
+ </a>
53
+ <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
54
+ <img src="https://img.shields.io/wordpress/v/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Version">
55
+ </a>
56
+ </p>
57
+
58
+ ## Welcome to the Super PWA GitHub repository
59
+
60
+ ⚡️ Demo : <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-WelcomeDemo">superpwa.com</a> [Check Video's to know how it works](#videos-on-how-add-to-home-screen--progressive-web-apps-works-on-different-browsers)
61
+
62
+ ## What is Progressive Web Apps
63
+ Progressive Web Apps (PWA) is a new technology that creates a middle ground between a website and a mobile app. They are installed on the phone like a normal app (web app) and can be accessed from the home screen.
64
+
65
+ Users can come back to your website by launching the app from their home screen and interact with your website through an app-like interface. Your return visitors will experience almost-instant loading times and enjoy the great performance benefits of your PWA!
66
+
67
+ <a href="https://superpwa.com?utm_source=github&utm_medium=Readme-what-is-pwa">Super Progressive Web Apps</a> makes it easy for you to convert your WordPress website into a Progressive Web App easily!
68
+
69
+ ## ⭐ Support the project
70
+ If you feel super excited and want to support us in a small way, please consider starring and/or sharing the repo! This helps us getting known and grow the community.
71
+
72
+ <a href="#"><img src="https://raw.githubusercontent.com/josevarghese/Super-Progressive-Web-Apps/master/jose-github-star-gif.gif" alt="Star our repo" width="300px" height="76.95px" /></a>
73
+
74
+ Also you can support us via [following on social media's and share about us](#share-via-social-medias-and-spread-superpwa).
75
+
76
+ ## 🏗 Installation
77
+ Once SuperPWA ⚡️ is installed, users browsing your website from a supported mobile device will see a "Add To Home Screen" notice (from the bottom of the screen) and will be able to 'install your website' on the home screen of their device. Every page visited is stored locally on their device and will be available to read even when they are offline!
78
+
79
+ SuperPWA is easy to configure, it takes less than a minute to set-up your Progressive Web App! SuperPWA does a clean uninstall, by removing every database entry and file that it creates. In fact, none of the default settings are saved to the database until you manually save it the first time. Go ahead and give it a try.
80
+
81
+ ### 💡 Progressive Web App Minimum Requirments
82
+ - [x] Progressive Web Apps require that your WordPress website is served from a secure origin i.e. your website should be HTTPS and not HTTP. If your website isn’t HTTPS, please contact your host about it. You can also ask us [Support Forums](https://wordpress.org/support/plugin/super-progressive-web-apps) if you need help.
83
+ </br>
84
+
85
+ ##### Videos on How Add to Home Screen & Progressive Web Apps works on Different Browsers
86
+
87
+ |<a href="https://www.youtube.com/watch?v=n3TjhNblvqs"><img src="http://i3.ytimg.com/vi/n3TjhNblvqs/maxresdefault.jpg" alt="Google Chrome for Android"/> </br>📽️ Google Chrome for Android| <a href="https://www.youtube.com/watch?v=9v4RwahRQFU"><img src="http://i3.ytimg.com/vi/9v4RwahRQFU/maxresdefault.jpg" alt="Mozilla Firefox for Android" /> </br>📽️ Mozilla Firefox for Android | <a href="https://www.youtube.com/watch?v=V8-AdKxm134"><img src="http://i3.ytimg.com/vi/V8-AdKxm134/maxresdefault.jpg" alt="Microsoft Edge for Android"/> </br>📽️ Microsoft Edge for Android | <a href="https://www.youtube.com/watch?v=Sbhgb6_QKfQ"><img src="http://i3.ytimg.com/vi/Sbhgb6_QKfQ/maxresdefault.jpg" alt="Samung Internet for Android "/> </br>📽️ Samung Internet for Android | <a href="https://www.youtube.com/watch?v=bV8xE6lOdoY"><img src="http://i3.ytimg.com/vi/bV8xE6lOdoY/maxresdefault.jpg" alt="PWA on iOS - Safari Browser"/> </br>📽️ PWA on iOS - Safari Browser |
88
+ | :---------: | :---------: | :---------: | :---------: | :---------: |
89
+ </br>
90
+
91
+ ##### Detailed Documentations for testing PWA on Browsers
92
+
93
+ * [PWA on Chrome for Android](https://superpwa.com/doc/test-pwa-google-chrome/)
94
+ * [PWA on Desktop - Chrome](https://superpwa.com/doc/test-pwa-on-desktop/)
95
+ * [PWA on iOS device - Safari Browser](https://superpwa.com/doc/test-pwa-ios-devices/)
96
+ * [PWA on Microsoft Edge Browser for Android](https://superpwa.com/doc/test-pwa-microsoft-edge/)
97
+ * [PWA on Samsung Internet Browser for Android](https://superpwa.com/doc/test-pwa-samsung-internet-browser/)
98
+
99
+ #### 📦 What's in the box
100
+
101
+ Here are the current features of Super Progressive Web Apps:
102
+
103
+ * Generate a manifest for your website and add it to the head of your website.
104
+ * Set the application icon for your Progressive Web App.
105
+ * Set the background color for the splash screen of your Progressive Web App.
106
+ * Your website will show the "Add to home screen" notice when accessed in a supported browser.
107
+ * Aggressive caching of pages using CacheStorage API.
108
+ * Pages once cached are served even if the user is offline.
109
+ * Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
110
+ * New in version 1.2: Support for theme-color.
111
+ * New in version 1.2: Now you can edit the Application Name and Application Short name.
112
+ * New in version 1.2: Set the start page of your PWA.
113
+ * New in version 1.2: Set Accelerated Mobile Pages (AMP) version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
114
+ * New in version 1.3: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
115
+ * New in version 1.3: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
116
+ * New in version 1.3: Improved in-browser service worker update handling.
117
+ * New in version 1.4: You can now set the default orientation of your PWA. Choose from "any" (Follow Device Orientation), "Portrait" and "Landscape".
118
+ * New in version 1.4: You can now set the theme_color property in the manifest.
119
+ * New in version 1.5: OneSignal integration for Push notifications.
120
+ * New in version 1.6: WordPress Multisite Network compatibility.
121
+ * New in version 1.7: Add-Ons for SuperPWA is here! Ships with [UTM Tracking Add-On](https://superpwa.com/addons/utm-tracking/?utm_source=GitHub&utm_medium=Readme-version) to track visits coming from your PWA.
122
+ * New in version 1.8: Compatibility issues with OneSignal are now resolved!
123
+ * New in version 1.8: New Add-On: [Apple Touch Icons](https://superpwa.com/addons/apple-touch-icons/?utm_source=GitHub&utm_medium=Readme-version) that sets your app icons as Apple Touch Icons.
124
+ * New in version 2.0: SuperPWA is now compatible with WordPress installed in a sub-folder.
125
+ * New in version 2.0: You can now set [display property](https://superpwa.com/doc/web-app-manifest-display-modes/?utm_source=GitHub&utm_medium=Readme-version) from SuperPWA settings.
126
+ * New in version 2.1.1: Support for maskabale icons.
127
+
128
+ #### 🔮 Upcoming features:
129
+ * Offline Indicator Notice.
130
+
131
+ ### Device and Browser Support For PWA
132
+ | | <img src="https://image.flaticon.com/icons/svg/732/732205.svg" alt="Chrome" width="32px" height="32px" /> Chrome | <img src="https://image.flaticon.com/icons/svg/732/732198.svg" alt="Firefox" width="32px" height="32px" /> Firefox | <img src="https://image.flaticon.com/icons/svg/732/732219.svg" alt="Edge" width="32px" height="32px" /> Edge | <img src="https://camo.githubusercontent.com/3fb130c75d01178836d96dcf3baccbe7b95b3642/68747470733a2f2f696d6167652e666c617469636f6e2e636f6d2f69636f6e732f7376672f3733322f3733323233332e737667" alt="Opera" width="32px" height="32px" /> Opera | <img src="https://image.flaticon.com/icons/svg/732/732241.svg" alt="Safari" width="32px" height="32px" /> Safari |<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Samsung_Internet_Logo.png/800px-Samsung_Internet_Logo.png" alt="Samsung" width="32px" height="32px" /> Samsung | <img src="https://upload.wikimedia.org/wikipedia/en/d/d0/UC_Browser_Logo.png" alt="UC Browser" width="32px" height="32px" /> UC Browser | <img src="https://upload.wikimedia.org/wikipedia/en/a/a5/Brave_Software_Logo.png" alt="Brave" width="32px" height="32px" /> Brave |
133
+ | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: |
134
+ | Add to Home Screen | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="20px" height="20px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="20px" height="20px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> |
135
+ | Service Workers | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> |
136
+ | Web Push & Notifications| <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="20px" height="20px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> |
137
+ | Payment Request API | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> | - | - |
138
+ | Meta Theme Color | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | - | - | - | - | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> | - | <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Yes" width="32px" height="32px" /> |
139
+
140
+ </br>
141
+
142
+ <p align="center">
143
+ <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> Supported
144
+ &nbsp;
145
+ &nbsp;
146
+ &nbsp;
147
+ &nbsp;
148
+ <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="32px" height="32px" /> Beta or Partial Support
149
+ &nbsp;
150
+ &nbsp;
151
+ &nbsp;
152
+ &nbsp;
153
+ <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> In Development
154
+ </p>
155
+
156
+
157
+ Progressive web apps need browsers that support manifests and service workers. Currently Google Chrome (version 57+), Chrome for Android (62), Mozilla Firefox (57), Firefox for Android (58) are the major browsers that support PWA.
158
+
159
+ The list is fast growing and is likely to be supported in most major browsers by the end of this year.
160
+
161
+ ### Why Build Progressive Web Apps?
162
+ [![Why Build Progressive Web Apps](http://i3.ytimg.com/vi/1QILz1lAzWY/maxresdefault.jpg)](https://www.youtube.com/embed/1QILz1lAzWY)
163
+
164
+ ### How To Convert Your WordPress Website Into A Progressive Web App
165
+
166
+ #### ⚙️ WordPress Installation
167
+
168
+ * Visit WordPress Admin > **Plugins** > **Add New**
169
+ * Search for **Super Progressive Web Apps**
170
+ * Click "**Install Now**" and then "**Activate**" Super Progressive Web Apps
171
+
172
+ #### ⚙️ To install manually:
173
+
174
+ * Upload super-progressive-web-apps folder to the /wp-content/plugins/ directory on your server
175
+ * Go to WordPress Admin > **Plugins**
176
+ * Activate **Super Progressive Web Apps** plugin from the list.
177
+
178
+ #### Customizing Your Progressive Web App
179
+
180
+ Your Progressive Web App should be ready to test with the default settings upon activation. You can customize it further and make it truly your own.
181
+
182
+ * Go to WordPress Admin > "**SuperPWA**" > **Settings**
183
+ * Set a Background Color for the splash screen to be shown when your PWA is opened on a mobile device.
184
+ * Set the Application Icon. This will be the icon of your PWA when it is added to the homescreen in a mobile device. The icon must be a PNG image and exactly 192 x 192 pixels in size.
185
+ * Set the Offline Page. This page will be displayed if the user is offline and the page he requested is not cached already. Ideally you should create a dedicated WordPress page and set it here. Within the page you create, you could add a note that reads, "It looks like you are offline and the page you requested is not available right now. Please check back again once you are online.".
186
+ * Click "Save Settings".
187
+
188
+ #### Testing Your Progressive Web App
189
+
190
+ * Open a supported browser in a supported device (for eg: Chrome for Android (62 or higher) in an Android device)
191
+ * Enter your website and wait till it fully loads
192
+ * You should see a pop-up that has your Application Icon and a button that reads "ADD TO HOME SCREEN".
193
+ * Click on it and your PWA will be added to your home screen. Wait for the install to complete.
194
+ * Go to your home screen and open your PWA. Browse into a few pages if you like. Close the App.
195
+ * Disconnect from the internet and now open your PWA again. You should be able to see all the pages that you previously browsed.
196
+ * Try visiting a page that you did not visit before. You should see the page you set as your "Offline Page" in the settings of SuperPWA.
197
+
198
+
199
+ ### 🤝 About us
200
+ > We are a duo who got excited about the idea. Our mission is simple: Help you build an awesome PWA that your users would want to have on their home screen. When we first heard about PWA we wanted to learn everything about it. We have spent countless hours learning and wants to share it with the world. Please give us your constructive feedback and support.
201
+
202
+ ## ⛷️ Support
203
+ This is a developer's portal for Super Progressive Web Apps and should not be used for support. Please visit the
204
+ [Support Forums](https://wordpress.org/support/plugin/super-progressive-web-apps).
205
+
206
+ ## 🐛 Reporting bugs
207
+ If you ever get stuck, we are here to watch your back! [Open a New Support Topic](https://wordpress.org/support/plugin/super-progressive-web-apps) ticket if you have a question or need a feature. We are super excited to hear your feedback and we want to genuinely help you build the best Progressive Web App for your WordPress website!
208
+
209
+ ## 🎍 Contributions
210
+ Anyone is welcome to contribute to Super PWA to make it SUPER.
211
+
212
+ There are various ways you can contribute:
213
+
214
+ * [Raise an issue](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues) on GitHub.
215
+ * Follow and Engage with us on Social Media
216
+
217
+ &nbsp;&nbsp;&nbsp; <a href="https://twitter.com/intent/follow?screen_name=superpwa" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174876.svg" title="Follow SuperPWA on Twitter" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
218
+ <a href="https://www.youtube.com/channel/UCMFlNeutNCwTNls186moUUA" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174883.svg" title="Follow SuperPWA on YouTube" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
219
+ <a href="https://www.facebook.com/SuperPWA/" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174848.svg" title="Follow SuperPWA on Facebook" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
220
+ <a href="https://www.instagram.com/superpwa/" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174855.svg" title="Follow SuperPWA on Instagram" width=35 height=35></a>&nbsp;&nbsp;&nbsp;&nbsp;
221
+
222
+ * Send us a Pull Request with your bug fixes and/or new features.
223
+ * Provide feedback and [suggestions on enhancements](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open).
224
+ * ##### Share via Social Media's and spread SuperPWA
225
+
226
+ &nbsp;&nbsp;&nbsp; <a href="https://twitter.com/home?status=Super%20Progressive%20Web%20Apps%20helps%20to%20convert%20your%20WordPress%20website%20into%20PWA%20%23SuperPWA%20https%3A//github.com/SuperPWA/Super-Progressive-Web-Apps/%20%40SuperPWA" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174876.svg" title="Share SuperPWA on Twitter" width=20 height=20> Share on Twitter </a>&nbsp;&nbsp;&nbsp;&nbsp;
227
+ <p> &nbsp;&nbsp;&nbsp; <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A//github.com/SuperPWA/Super-Progressive-Web-Apps/" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174848.svg" title="Follow SuperPWA on Facebook" width=20 height=20> Share on Facebook </a>&nbsp;&nbsp;&nbsp;&nbsp;</p>
228
+ <p> &nbsp;&nbsp;&nbsp; <a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A//github.com/SuperPWA/Super-Progressive-Web-Apps/&title=Super%20Progressive%20Web%20Apps&summary=Super%20Progressive%20Web%20Apps%20helps%20to%20convert%20your%20WordPress%20website%20into%20PWA%20%23SuperPWA&source=GitHub" target="_blank" style="width:100%"><img src="https://image.flaticon.com/icons/svg/174/174857.svg" title="Share SuperPWA on LinkedIn" width=20 height=20> Share on LinkedIn</a>&nbsp;&nbsp;&nbsp;&nbsp;</p>
229
+
230
+ ## 📇 Changelog
231
+ [superpwa.com/changelog/](https://superpwa.com/changelog/?utm_source=GitHub&utm_medium=Readme-Changelog).
232
+
233
+ Emoji Credits : [Emojipedia](emojipedia.org)
234
+ Social Media Icon Credits : [Flaticon](flaticon.com)
235
+
236
+ **[⬆ back to top](#super-progressive-web-apps)**
addons/apple-touch-icons.php CHANGED
@@ -1,413 +1,422 @@
1
- <?php
2
- /**
3
- * Apple Touch Icons
4
- *
5
- * @since 1.8
6
- *
7
- * @function superpwa_ati_add_apple_touch_icons() Add Apple Touch Icons to the wp_head
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) ) exit;
12
-
13
- /**
14
- * Add Apple Touch Icons to the wp_head
15
- *
16
- * Uses the Application Icon and Splash Screen Icon for SuperPWA > Settings
17
- * and adds them to wp_head using the superpwa_wp_head_tags filter.
18
- *
19
- * @param (string) $tags HTML element tags passed on by superpwa_wp_head_tags
20
- *
21
- * @return (string) Appends the Apple Touch Icons to the existing tag string
22
- *
23
- * @since 1.8
24
- */
25
- function superpwa_ati_add_apple_touch_icons( $tags ) {
26
-
27
- // Get the icons added via SuperPWA > Settings
28
- $icons = superpwa_get_pwa_icons();
29
- // Get settings
30
- $settings = superpwa_get_settings();
31
-
32
- $splashIcons = superpwa_apple_icons_get_settings();
33
-
34
- if(isset($splashIcons['status_bar_style']) && !empty($splashIcons['status_bar_style'])){
35
- $status_bar_style = $splashIcons['status_bar_style'];
36
- }else{
37
- $status_bar_style = 'default';
38
- }
39
- $tags .= '<meta name="mobile-web-app-capable" content="yes">' . PHP_EOL;
40
- $tags .= '<meta name="apple-touch-fullscreen" content="yes">' . PHP_EOL;
41
- $tags .= '<meta name="apple-mobile-web-app-title" content="'.esc_attr($settings['app_name']).'">' . PHP_EOL;
42
- $tags .= '<meta name="application-name" content="'.esc_attr($settings['app_name']).'">' . PHP_EOL;
43
- $tags .= '<meta name="apple-mobile-web-app-capable" content="yes">' . PHP_EOL;
44
- $tags .= '<meta name="apple-mobile-web-app-status-bar-style" content="'.esc_attr($status_bar_style).'">' . PHP_EOL;
45
-
46
- foreach( $icons as $icon ) {
47
- $tags .= '<link rel="apple-touch-icon" sizes="' . $icon['sizes'] . '" href="' . $icon['src'] . '">' . PHP_EOL;
48
- }
49
- //Ios splash screen
50
- $iosScreenSetting = get_option( 'superpwa_apple_icons_uploaded' );
51
- if( $iosScreenSetting && isset($iosScreenSetting['ios_splash_icon']) && !empty($iosScreenSetting['ios_splash_icon']) ) {
52
- $iconsInfo = apple_splashscreen_files_data();
53
- foreach ( $iosScreenSetting['ios_splash_icon'] as $key => $value ) {
54
- if( !empty($value) && !empty($key) && isset($iconsInfo[$key]) ) {
55
- $screenData = $iconsInfo[$key];
56
- $tags .= '<link rel="apple-touch-startup-image" media="screen and (device-width: '.$screenData['device-width'].') and (device-height: '.$screenData['device-height'].') and (-webkit-device-pixel-ratio: '.$screenData['ratio'].') and (orientation: '.$screenData['orientation'].')" href="'.$value.'"/>'."\n";
57
- }//if closed
58
- }//foreach closed
59
- }
60
-
61
- return $tags;
62
- }
63
- add_filter( 'superpwa_wp_head_tags', 'superpwa_ati_add_apple_touch_icons' );
64
-
65
- /**
66
- * Remove apple-touch-icon added by WordPress in heading (site_icon_meta_tags)
67
- *
68
- * Wordpress introduce this filter since 4.3.0 (site_icon_meta_tags)
69
- * @since 2.1.6 introduce
70
- * @param (string) $tags HTML element tags passed on by site_icon_meta_tags
71
- *
72
- * @return (string) Remove the Apple Touch Icons from the existing tag string
73
- */
74
- function superpwa_remove_site_apple_touch_icon($meta_tags) {
75
- if(is_customize_preview() && is_admin()){
76
- return $meta_tags;
77
- }
78
- foreach ($meta_tags as $key => $value) {
79
- if(strpos($value, 'apple-touch-icon') !== false){
80
- unset($meta_tags[$key]);
81
- }
82
- }
83
- return $meta_tags;
84
- }
85
- add_filter( 'site_icon_meta_tags', 'superpwa_remove_site_apple_touch_icon', 0 );
86
-
87
-
88
- /**
89
- * Get UTM Tracking settings
90
- *
91
- * @since 1.7
92
- */
93
- function superpwa_apple_icons_get_settings() {
94
-
95
- $defaults = array(
96
- 'background_color' => '#cdcdcd',
97
- 'screen_centre_icon'=> '',
98
- 'status_bar_style' => 'default'
99
- );
100
-
101
- return get_option( 'superpwa_apple_icons_settings',$defaults);
102
- }
103
- /**
104
- * Register Apple icons & splash screen settings
105
- *
106
- * @since 2.1.7
107
- */
108
- function superpwa_apple_icons_register_settings() {
109
- // Register Setting
110
- register_setting(
111
- 'superpwa_apple_icons_settings_group', // Group name
112
- 'superpwa_apple_icons_settings', // Setting name = html form <input> name on settings form
113
- 'superpwa_apple_icons_validater_sanitizer' // Input validator and sanitizer
114
- );
115
-
116
- // Apple icons
117
- add_settings_section(
118
- 'superpwa_apple_icons_section', // ID
119
- __return_false(), // Title
120
- 'superpwa_apple_icons_section_cb', // Callback Function
121
- 'superpwa_apple_icons_section' // Page slug
122
- );
123
- // Splash screen URL
124
- add_settings_field(
125
- 'superpwa_apple_icons_splash_screen', // ID
126
- esc_html__('Splash Screen Image', 'super-progressive-web-apps'), // Title
127
- 'superpwa_apple_icons_splash_screen_cb', // CB
128
- 'superpwa_apple_icons_section', // Page slug
129
- 'superpwa_apple_icons_section' // Settings Section ID
130
- );
131
-
132
- // Splash screen URL
133
- add_settings_field(
134
- 'superpwa_apple_icons_splash_screen_center_background_color', // ID
135
- esc_html__('Centralize Image with Background Color', 'super-progressive-web-apps'), // Title
136
- 'superpwa_apple_icons_splash_with_centre_screen_cb', // CB
137
- 'superpwa_apple_icons_section', // Page slug
138
- 'superpwa_apple_icons_section' // Settings Section ID
139
- );
140
- // Splash screen URL
141
- add_settings_field(
142
- 'superpwa_apple_icons_splash_color_screen', // ID
143
- esc_html__('Background Color', 'super-progressive-web-apps'), // Title
144
- 'superpwa_apple_icons_splash_color_screen_cb', // CB
145
- 'superpwa_apple_icons_section', // Page slug
146
- 'superpwa_apple_icons_section' // Settings Section ID
147
- );
148
- // Display
149
- add_settings_field(
150
- 'superpwa_apple_icons_status_bar_style', // ID
151
- __('Mobile App Status Bar Style', 'super-progressive-web-apps'), // Title
152
- 'superpwa_apple_icons_status_bar_style_cb', // CB
153
- 'superpwa_apple_icons_section', // Page slug
154
- 'superpwa_apple_icons_section' // Settings Section ID
155
- );
156
- }
157
- add_action( 'admin_init', 'superpwa_apple_icons_register_settings' );
158
-
159
- /**
160
- * Upload the image of splash screen
161
- *
162
- * @since 2.1.7
163
- */
164
- function superpwa_apple_icons_section_cb() {
165
- echo esc_html__( 'Select png icon and background colour to show in splash screen, we automatically create images for all multiple other screen sizes', 'super-progressive-web-apps' );
166
- }
167
-
168
- /**
169
- * Upload the image of splash screen
170
- *
171
- * @since 2.1.7
172
- */
173
- function superpwa_apple_icons_splash_screen_cb() {
174
- $splashIcons = superpwa_apple_icons_get_settings();
175
- $splashIconsScreens = apple_splashscreen_files_data();
176
- $iosScreenSetting = get_option( 'superpwa_apple_icons_uploaded' ) ; //New generated icons
177
- ?>
178
- <input type="file" id="upload_apple_function" accept="image/png">
179
- <p class="description"><?php echo esc_html__('Must select PNG images only', 'super-progressive-web-apps'); ?> </p><br/>
180
- <?php
181
- $a = 'style="display:none"';$src = '';
182
- if(isset($iosScreenSetting['ios_splash_icon']) && !empty($iosScreenSetting['ios_splash_icon'])){
183
- $a = '';
184
- $src = end($iosScreenSetting['ios_splash_icon']).'?nocache='.uniqid();
185
- }
186
- ?>
187
- <p id="aft_img_gen"> </p>
188
- <img src="<?php echo esc_url_raw($src); ?>" id="thumbnail" title="<?php echo esc_attr__('Currently selected splash screen', 'super-progressive-web-apps'); ?>" width="100">
189
-
190
- <script id="iosScreen-data" type="application/json"><?php echo json_encode($splashIconsScreens);?></script>
191
- <br/>
192
- <?php
193
- }
194
-
195
- function superpwa_apple_icons_splash_with_centre_screen_cb() {
196
- $splashIcons = superpwa_apple_icons_get_settings();
197
-
198
- echo '<input type="checkbox" id="center-mode" value="center" name="superpwa_apple_icons_settings[screen_centre_icon]" '.(isset( $splashIcons['screen_centre_icon']) && $splashIcons['screen_centre_icon']=='center'? 'checked': '') .'/>';
199
- }
200
-
201
- /**
202
- * Splash Screen Pro
203
- *
204
- * @since 2.1.7
205
- */
206
- function superpwa_apple_icons_splash_color_screen_cb() {
207
- $splashIcons = superpwa_apple_icons_get_settings();
208
- ?>
209
- <input type="text" name="superpwa_apple_icons_settings[background_color]" class="superpwa-colorpicker" id="ios-splash-color" value="<?php echo (isset($splashIcons['screen_icon']) && !empty($splashIcons['screen_icon']))? $splashIcons['screen_icon']: $splashIcons['background_color'] ?>">
210
- <?php
211
- }
212
-
213
- /**
214
- * Splash Screen Pro
215
- *
216
- * @since 2.1.17
217
- */
218
- function superpwa_apple_icons_status_bar_style_cb() {
219
- $splashIcons = superpwa_apple_icons_get_settings();
220
- ?>
221
- <!-- Display Dropdown -->
222
- <label for="superpwa_apple_icons_settings[status_bar_style]">
223
- <select name="superpwa_apple_icons_settings[status_bar_style]" id="superpwa_apple_icons_settings[status_bar_style]">
224
- <option value="default" <?php if ( isset( $splashIcons['status_bar_style'] ) ) { selected( $splashIcons['status_bar_style'], 'default' ); } ?>>
225
- <?php _e( 'Default', 'super-progressive-web-apps' ); ?>
226
- </option>
227
- <option value="black" <?php if ( isset( $splashIcons['status_bar_style'] ) ) { selected( $splashIcons['status_bar_style'], 'black' ); } ?>>
228
- <?php _e( 'Black', 'super-progressive-web-apps' ); ?>
229
- </option>
230
- <option value="black-translucent" <?php if ( isset( $splashIcons['status_bar_style'] ) ) { selected( $splashIcons['status_bar_style'], 'black-translucent' ); } ?>>
231
- <?php _e( 'Black translucent', 'super-progressive-web-apps' ); ?>
232
- </option>
233
- </select>
234
- </label>
235
- <?php
236
- }
237
-
238
- /**
239
- * Apple Touch Icon & splash screen require tags data
240
- *
241
- * @since 1.7
242
- */
243
- function apple_splashscreen_files_data(){
244
- $iosSplashData = array(
245
- '1136x640'=> array("device-width"=> '320px', "device-height"=> "568px","ratio"=> 2,"orientation"=> "landscape","file"=> "icon_1136x640.png",'name'=> 'iPhone 5/iPhone SE'),
246
- '640x1136'=> array("device-width"=> '320px', "device-height"=> "568px","ratio"=> 2,"orientation"=> "portrait", "file"=> "icon_640x1136.png",'name'=> 'iPhone 5/iPhone SE'),
247
- '2688x1242'=>array("device-width"=> '414px', "device-height"=> "896px","ratio"=> 3,"orientation"=> "landscape", "file"=> "icon_2688x1242.png", 'name'=>'iPhone XS Max'),
248
- '1792x828'=> array("device-width"=> '414px', "device-height"=> "896px","ratio"=> 2, "orientation"=> "landscape", "file"=> "icon_1792x828.png", 'name'=>'iPhone XR'),
249
- '1125x2436'=>array("device-width"=> '375px', "device-height"=> "812px","ratio"=> 3,"orientation"=> 'portrait', "file"=>"icon_1125x2436.png", 'name'=> 'iPhone X/Xs'),
250
- '828x1792'=> array("device-width"=> "414px", "device-height"=> "896px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_828x1792.png",'name' => 'iPhone Xr'),
251
- '2436x1125'=> array("device-width"=> "375px","device-height"=> "812px","ratio"=> 3,"orientation"=> "landscape", "file"=>"icon_2436x1125.png", 'name'=> 'iPhone X/Xs'),
252
- '1242x2208'=> array("device-width"=> "414px","device-height"=> "736px","ratio"=> 3,"orientation"=> "portrait", "file"=>"icon_1242x2208.png", 'name'=> 'iPhone 6/7/8 Plus'),
253
- '2208x1242'=>array("device-width"=> "414px","device-height"=> "736px","ratio"=> 3,"orientation"=> "landscape", "file"=>"icon_2208x1242.png", 'name'=> 'iPhone 6/7/8 Plus'),
254
- '1334x750'=>array("device-width"=> "375px","device-height"=> "667px","ratio"=> 2,"orientation"=> "landscape", "file"=>"icon_1334x750.png", 'name'=> 'iPhone 6/7/8'),
255
- '750x1334'=>array("device-width"=> "375px","device-height"=> "667px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_750x1334.png", 'name'=> 'iPhone 6/7/8'),
256
- '2732x2048'=>array("device-width"=> "1024px","device-height"=>"1366px","ratio"=> 2,"orientation"=> "landscape","file"=>"icon_2732x2048.png", 'name'=> 'iPad Pro 12.9"'),
257
- '2048x2732'=>array("device-width"=> "1024px","device-height"=> "1366px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_2048x2732.png", 'name'=> 'iPad Pro 12.9"'),
258
- '2388x1668'=>array("device-width"=> "834px","device-height"=> "1194px","ratio"=> 2,"orientation"=> "landscape", "file"=>"icon_2388x1668.png",'name'=> 'iPad Pro 11"'),
259
- '1668x2388'=>array("device-width"=> "834px","device-height"=> "1194px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_1668x2388.png",'name'=> 'iPad Pro 11"'),
260
- '2224x1668'=>array("device-width"=> "834px", "device-height"=> "1112px","ratio"=> 2,"orientation"=>"landscape","file"=>"icon_2224x1668.png", 'name'=> 'iPad Pro 10.5"'),
261
- '1242x2688'=>array("device-width"=> "414px","device-height"=> "896px","ratio"=> 3, "orientation"=> "portrait","file"=>"icon_1242x2688.png", 'name' => 'iPhone Xs Max'),
262
- '1668x2224'=>array("device-width"=> "834px","device-height"=> "1112px","ratio"=> 2, "orientation"=> "portrait","file"=>"icon_1668x2224.png", 'name'=> 'iPad Pro 10.5"'),
263
- '1536x2048'=>array("device-width"=> "768px","device-height"=> "1024px","ratio"=> 2, "orientation"=> "portrait","file"=>"icon_1536x2048.png", 'name'=> 'iPad Mini/iPad Air'),
264
- '2048x1536'=>array("device-width"=> "768px","device-height"=> "1024px","ratio"=> 2,"orientation"=> "landscape","file"=>"icon_2048x1536.png", 'name'=> 'iPad Mini/iPad Air'),
265
- );
266
- return $iosSplashData;
267
- }
268
-
269
- function superpwa_load_admin_scripts($hooks){
270
- if( !in_array($hooks, array('superpwa_page_superpwa-apple-icons', 'super-pwa_page_superpwa-apple-icons')) && strpos($hooks, 'superpwa-apple-icons') == false ) {
271
- return false;
272
- }
273
- wp_enqueue_media();
274
- wp_register_script('superpwa-admin-apple-script',SUPERPWA_PATH_SRC .'/admin/js/jszip.min.js', array('superpwa-main-js'), SUPERPWA_VERSION, true);
275
- wp_enqueue_script('superpwa-admin-apple-script');
276
- wp_localize_script( 'superpwa-admin-apple-script', 'superpwaIosScreen',
277
- array('nonce'=> wp_create_nonce( 'superpwaIosScreenSecurity' )) );
278
-
279
-
280
- }
281
- add_action( 'admin_enqueue_scripts', 'superpwa_load_admin_scripts' );
282
-
283
- /**
284
- * Validate and sanitize user input
285
- *
286
- * @since 2.1.7
287
- */
288
- function superpwa_apple_icons_validater_sanitizer( $settings ) {
289
- // Sanitize and validate campaign source. Campaign source cannot be empty.
290
- $settings['screen_icon'] = (isset($settings['screen_icon'])) ? sanitize_text_field( $settings['screen_icon'] ) : '';
291
-
292
- // Sanitize and validate campaign source. Campaign source cannot be empty.
293
- $settings['background_color'] = sanitize_text_field( $settings['background_color'] ) == '' ? '' : sanitize_text_field( $settings['background_color'] );
294
-
295
- $settings['screen_centre_icon'] = sanitize_text_field( $settings['screen_centre_icon'] ) == '' ? '' : sanitize_text_field( $settings['screen_centre_icon'] );
296
-
297
- $settings['status_bar_style'] = sanitize_text_field( $settings['status_bar_style'] ) == '' ? 'default' : sanitize_text_field( $settings['status_bar_style'] );
298
-
299
- return $settings;
300
- }
301
- /**
302
- * Apple Touch Icon & splash screen UI renderer
303
- *
304
- * @since 1.7
305
- */
306
- function superpwa_apple_icons_interface_render() {
307
-
308
- // Authentication
309
- if ( ! current_user_can( 'manage_options' ) ) {
310
- return;
311
- }
312
-
313
- // Handing save settings
314
- if ( isset( $_GET['settings-updated'] ) ) {
315
-
316
- // Add settings saved message with the class of "updated"
317
- add_settings_error( 'superpwa_settings_group', 'superpwa_apple_icons_settings_saved_message', __( 'Settings Saved.', 'super-progressive-web-apps' ), 'updated' );
318
-
319
- // Show Settings Saved Message
320
- settings_errors( 'superpwa_settings_group' );
321
- }
322
- // Get add-on info
323
- $addon_utm_tracking = superpwa_get_addons( 'apple_touch_icons' );
324
-
325
- superpwa_setting_tabs_styles();
326
- ?>
327
- <div class="wrap">
328
- <!--Duplicate h1 To show saved settings message above h1 tag -->
329
- <h1 style="display: none" ><?php _e( 'Apple touch icons & Splash Screen', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
330
- <h1><?php _e( 'Apple touch icons & Splash Screen', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
331
-
332
- <?php superpwa_setting_tabs_html(); ?>
333
-
334
- <form action="options.php" method="post" enctype="multipart/form-data">
335
- <?php
336
- // Output nonce, action, and option_page fields for a settings page.
337
- settings_fields( 'superpwa_apple_icons_settings_group' );
338
-
339
- // Status
340
- do_settings_sections( 'superpwa_apple_icons_section' ); // Page slug
341
-
342
- echo "<p id='superpwa-apple-splash-message'></p>";
343
- // Output save settings button
344
- submit_button( __('Save Settings', 'super-progressive-web-apps'), 'primary ', 'submit', true, array( 'data-type' => 'create_images', 'id' => 'submit_splash_screen') );
345
- ?>
346
- </form>
347
- </div>
348
- <?php superpwa_newsletter_form(); ?>
349
- <?php
350
- }
351
-
352
- function superpwa_splashscreen_uploader(){
353
-
354
- // Authentication
355
- if ( ! current_user_can( 'manage_options' ) ) {
356
- return;
357
- }
358
-
359
- if( (!isset($_POST['security_nonce'])) || (isset($_POST['security_nonce']) && !wp_verify_nonce( $_POST['security_nonce'], 'superpwaIosScreenSecurity' )) ) {
360
- echo json_encode(array('status'=>400, 'message'=>'security nonce not matched'));die;
361
- }
362
- if(isset($_FILES['file']['type']) && $_FILES['file']['type']!='application/zip'){
363
- echo json_encode(array('status'=>500, 'message'=>'file type not matched'));die;
364
- }
365
- if(isset($_FILES['file']['error']) && $_FILES['file']['error']!='0'){
366
- echo json_encode(array('status'=>500, 'message'=>'file contains error'));die;
367
- }
368
-
369
- $upload = wp_upload_dir();
370
- $path = $upload['basedir']."/superpwa-splashIcons/";
371
- $subpath = $upload['basedir']."/superpwa-splashIcons/super_splash_screens/";
372
- wp_mkdir_p($path);
373
- file_put_contents($path.'/index.html','');
374
- file_put_contents($subpath.'/index.html','');
375
- WP_Filesystem();
376
- $zipFileName = $path."/splashScreen.zip";
377
- $moveFile = move_uploaded_file($_FILES['file']['tmp_name'], $zipFileName);
378
- if($moveFile && spwa_zip_allowed_extensions($zipFileName,['png'])){
379
- $result = unzip_file($zipFileName, $path);
380
- unlink($zipFileName);
381
- }else{
382
- echo json_encode(array('status'=>500, 'message'=>'Files are not uploading'));die;
383
- }
384
-
385
- $pathURL = $upload['baseurl']."/superpwa-splashIcons/super_splash_screens/";
386
- $iosScreenData = apple_splashscreen_files_data();
387
- $iosScreenSetting = (array)get_option( 'superpwa_apple_icons_uploaded' ) ;
388
- foreach ($iosScreenData as $key => $value) {
389
- $iosScreenSetting['ios_splash_icon'][$key] = $pathURL.$value['file'];
390
- }
391
- update_option( 'superpwa_apple_icons_uploaded', $iosScreenSetting ) ;
392
-
393
- echo json_encode(array("status"=>200, "message"=> "Splash screen uploaded successfully"));
394
- die;
395
- }
396
- function spwa_zip_allowed_extensions($zip_path, array $allowed_extensions) {
397
- $zip = new ZipArchive;
398
- $zip->open($zip_path);
399
-
400
- for ($i = 0; $i < $zip->numFiles; $i++) {
401
- $stat = $zip->statIndex( $i );
402
- $ext = pathinfo($stat['name'], PATHINFO_EXTENSION);
403
-
404
- // Skip folders name (but their content will be checked)
405
- if ($ext === '' && substr($stat['name'], -1) === '/')
406
- continue;
407
-
408
- if (!in_array(strtolower($ext), $allowed_extensions))
409
- return false;
410
- }
411
- return true;
412
- }
 
 
 
 
 
 
 
 
 
413
  add_action('wp_ajax_superpwa_splashscreen_uploader', 'superpwa_splashscreen_uploader');
1
+ <?php
2
+ /**
3
+ * Apple Touch Icons
4
+ *
5
+ * @since 1.8
6
+ *
7
+ * @function superpwa_ati_add_apple_touch_icons() Add Apple Touch Icons to the wp_head
8
+ */
9
+
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) ) exit;
12
+
13
+ /**
14
+ * Add Apple Touch Icons to the wp_head
15
+ *
16
+ * Uses the Application Icon and Splash Screen Icon for SuperPWA > Settings
17
+ * and adds them to wp_head using the superpwa_wp_head_tags filter.
18
+ *
19
+ * @param (string) $tags HTML element tags passed on by superpwa_wp_head_tags
20
+ *
21
+ * @return (string) Appends the Apple Touch Icons to the existing tag string
22
+ *
23
+ * @since 1.8
24
+ */
25
+ function superpwa_ati_add_apple_touch_icons( $tags ) {
26
+
27
+ // Get the icons added via SuperPWA > Settings
28
+ $icons = superpwa_get_pwa_icons();
29
+ // Get settings
30
+ $settings = superpwa_get_settings();
31
+
32
+ $splashIcons = superpwa_apple_icons_get_settings();
33
+
34
+ if(isset($splashIcons['status_bar_style']) && !empty($splashIcons['status_bar_style'])){
35
+ $status_bar_style = $splashIcons['status_bar_style'];
36
+ }else{
37
+ $status_bar_style = 'default';
38
+ }
39
+ $tags .= '<meta name="mobile-web-app-capable" content="yes">' . PHP_EOL;
40
+ $tags .= '<meta name="apple-touch-fullscreen" content="yes">' . PHP_EOL;
41
+ $tags .= '<meta name="apple-mobile-web-app-title" content="'.esc_attr($settings['app_name']).'">' . PHP_EOL;
42
+ $tags .= '<meta name="application-name" content="'.esc_attr($settings['app_name']).'">' . PHP_EOL;
43
+ $tags .= '<meta name="apple-mobile-web-app-capable" content="yes">' . PHP_EOL;
44
+ $tags .= '<meta name="apple-mobile-web-app-status-bar-style" content="'.esc_attr($status_bar_style).'">' . PHP_EOL;
45
+
46
+ foreach( $icons as $icon ) {
47
+ $tags .= '<link rel="apple-touch-icon" sizes="' . $icon['sizes'] . '" href="' . $icon['src'] . '">' . PHP_EOL;
48
+ }
49
+ //Ios splash screen
50
+ $iosScreenSetting = get_option( 'superpwa_apple_icons_uploaded' );
51
+ if( $iosScreenSetting && isset($iosScreenSetting['ios_splash_icon']) && !empty($iosScreenSetting['ios_splash_icon']) ) {
52
+ $iconsInfo = superpwa_apple_splashscreen_files_data();
53
+ foreach ( $iosScreenSetting['ios_splash_icon'] as $key => $value ) {
54
+ if( !empty($value) && !empty($key) && isset($iconsInfo[$key]) ) {
55
+ $screenData = $iconsInfo[$key];
56
+ $tags .= '<link rel="apple-touch-startup-image" media="screen and (device-width: '.$screenData['device-width'].') and (device-height: '.$screenData['device-height'].') and (-webkit-device-pixel-ratio: '.$screenData['ratio'].') and (orientation: '.$screenData['orientation'].')" href="'.$value.'"/>'."\n";
57
+ }//if closed
58
+ }//foreach closed
59
+ }
60
+
61
+ return $tags;
62
+ }
63
+ add_filter( 'superpwa_wp_head_tags', 'superpwa_ati_add_apple_touch_icons' );
64
+
65
+ /**
66
+ * Remove apple-touch-icon added by WordPress in heading (site_icon_meta_tags)
67
+ *
68
+ * Wordpress introduce this filter since 4.3.0 (site_icon_meta_tags)
69
+ * @since 2.1.6 introduce
70
+ * @param (string) $tags HTML element tags passed on by site_icon_meta_tags
71
+ *
72
+ * @return (string) Remove the Apple Touch Icons from the existing tag string
73
+ */
74
+ function superpwa_remove_site_apple_touch_icon($meta_tags) {
75
+ if(is_customize_preview() && is_admin()){
76
+ return $meta_tags;
77
+ }
78
+ foreach ($meta_tags as $key => $value) {
79
+ if(strpos($value, 'apple-touch-icon') !== false){
80
+ unset($meta_tags[$key]);
81
+ }
82
+ }
83
+ return $meta_tags;
84
+ }
85
+ add_filter( 'site_icon_meta_tags', 'superpwa_remove_site_apple_touch_icon', 0 );
86
+
87
+
88
+ /**
89
+ * Get UTM Tracking settings
90
+ *
91
+ * @since 1.7
92
+ */
93
+ function superpwa_apple_icons_get_settings() {
94
+
95
+ $defaults = array(
96
+ 'background_color' => '#cdcdcd',
97
+ 'screen_centre_icon'=> '',
98
+ 'status_bar_style' => 'default'
99
+ );
100
+
101
+ return get_option( 'superpwa_apple_icons_settings',$defaults);
102
+ }
103
+ /**
104
+ * Register Apple icons & splash screen settings
105
+ *
106
+ * @since 2.1.7
107
+ */
108
+ function superpwa_apple_icons_register_settings() {
109
+ // Register Setting
110
+ register_setting(
111
+ 'superpwa_apple_icons_settings_group', // Group name
112
+ 'superpwa_apple_icons_settings', // Setting name = html form <input> name on settings form
113
+ 'superpwa_apple_icons_validater_sanitizer' // Input validator and sanitizer
114
+ );
115
+
116
+ // Apple icons
117
+ add_settings_section(
118
+ 'superpwa_apple_icons_section', // ID
119
+ __return_false(), // Title
120
+ 'superpwa_apple_icons_section_cb', // Callback Function
121
+ 'superpwa_apple_icons_section' // Page slug
122
+ );
123
+ // Splash screen URL
124
+ add_settings_field(
125
+ 'superpwa_apple_icons_splash_screen', // ID
126
+ esc_html__('Splash Screen Image', 'super-progressive-web-apps'), // Title
127
+ 'superpwa_apple_icons_splash_screen_cb', // CB
128
+ 'superpwa_apple_icons_section', // Page slug
129
+ 'superpwa_apple_icons_section' // Settings Section ID
130
+ );
131
+
132
+ // Splash screen URL
133
+ add_settings_field(
134
+ 'superpwa_apple_icons_splash_screen_center_background_color', // ID
135
+ esc_html__('Centralize Image with Background Color', 'super-progressive-web-apps'), // Title
136
+ 'superpwa_apple_icons_splash_with_centre_screen_cb', // CB
137
+ 'superpwa_apple_icons_section', // Page slug
138
+ 'superpwa_apple_icons_section' // Settings Section ID
139
+ );
140
+ // Splash screen URL
141
+ add_settings_field(
142
+ 'superpwa_apple_icons_splash_color_screen', // ID
143
+ esc_html__('Background Color', 'super-progressive-web-apps'), // Title
144
+ 'superpwa_apple_icons_splash_color_screen_cb', // CB
145
+ 'superpwa_apple_icons_section', // Page slug
146
+ 'superpwa_apple_icons_section' // Settings Section ID
147
+ );
148
+ // Display
149
+ add_settings_field(
150
+ 'superpwa_apple_icons_status_bar_style', // ID
151
+ __('Mobile App Status Bar Style', 'super-progressive-web-apps'), // Title
152
+ 'superpwa_apple_icons_status_bar_style_cb', // CB
153
+ 'superpwa_apple_icons_section', // Page slug
154
+ 'superpwa_apple_icons_section' // Settings Section ID
155
+ );
156
+ }
157
+ add_action( 'admin_init', 'superpwa_apple_icons_register_settings' );
158
+
159
+ /**
160
+ * Upload the image of splash screen
161
+ *
162
+ * @since 2.1.7
163
+ */
164
+ function superpwa_apple_icons_section_cb() {
165
+ echo esc_html__( 'Select png icon and background colour to show in splash screen, we automatically create images for all multiple other screen sizes', 'super-progressive-web-apps' );
166
+ }
167
+
168
+ /**
169
+ * Upload the image of splash screen
170
+ *
171
+ * @since 2.1.7
172
+ */
173
+ function superpwa_apple_icons_splash_screen_cb() {
174
+ $splashIcons = superpwa_apple_icons_get_settings();
175
+ $splashIconsScreens = superpwa_apple_splashscreen_files_data();
176
+ $iosScreenSetting = get_option( 'superpwa_apple_icons_uploaded' ) ; //New generated icons
177
+ ?>
178
+ <input type="file" id="upload_apple_function" accept="image/png">
179
+ <p class="description"><?php echo esc_html__('Must select PNG images only', 'super-progressive-web-apps'); ?> </p><br/>
180
+ <?php
181
+ $a = 'style="display:none"';$src = '';
182
+ if(isset($iosScreenSetting['ios_splash_icon']) && !empty($iosScreenSetting['ios_splash_icon'])){
183
+ $a = '';
184
+ $src = end($iosScreenSetting['ios_splash_icon']).'?nocache='.uniqid();
185
+ }
186
+ ?>
187
+ <p id="aft_img_gen"> </p>
188
+ <img src="<?php echo esc_url_raw($src); ?>" id="thumbnail" title="<?php echo esc_attr__('Currently selected splash screen', 'super-progressive-web-apps'); ?>" width="100">
189
+
190
+ <script id="iosScreen-data" type="application/json"><?php echo json_encode($splashIconsScreens);?></script>
191
+ <br/>
192
+ <?php
193
+ }
194
+
195
+ function superpwa_apple_icons_splash_with_centre_screen_cb() {
196
+ $splashIcons = superpwa_apple_icons_get_settings();
197
+
198
+ echo '<input type="checkbox" id="center-mode" value="center" name="superpwa_apple_icons_settings[screen_centre_icon]" '.(isset( $splashIcons['screen_centre_icon']) && $splashIcons['screen_centre_icon']=='center'? 'checked': '') .'/>';
199
+ }
200
+
201
+ /**
202
+ * Splash Screen Pro
203
+ *
204
+ * @since 2.1.7
205
+ */
206
+ function superpwa_apple_icons_splash_color_screen_cb() {
207
+ $splashIcons = superpwa_apple_icons_get_settings();
208
+ ?>
209
+ <input type="text" name="superpwa_apple_icons_settings[background_color]" class="superpwa-colorpicker" id="ios-splash-color" value="<?php echo (isset($splashIcons['screen_icon']) && !empty($splashIcons['screen_icon']))? $splashIcons['screen_icon']: $splashIcons['background_color'] ?>">
210
+ <?php
211
+ }
212
+
213
+ /**
214
+ * Splash Screen Pro
215
+ *
216
+ * @since 2.1.17
217
+ */
218
+ function superpwa_apple_icons_status_bar_style_cb() {
219
+ $splashIcons = superpwa_apple_icons_get_settings();
220
+ ?>
221
+ <!-- Display Dropdown -->
222
+ <label for="superpwa_apple_icons_settings[status_bar_style]">
223
+ <select name="superpwa_apple_icons_settings[status_bar_style]" id="superpwa_apple_icons_settings[status_bar_style]">
224
+ <option value="default" <?php if ( isset( $splashIcons['status_bar_style'] ) ) { selected( $splashIcons['status_bar_style'], 'default' ); } ?>>
225
+ <?php _e( 'Default', 'super-progressive-web-apps' ); ?>
226
+ </option>
227
+ <option value="black" <?php if ( isset( $splashIcons['status_bar_style'] ) ) { selected( $splashIcons['status_bar_style'], 'black' ); } ?>>
228
+ <?php _e( 'Black', 'super-progressive-web-apps' ); ?>
229
+ </option>
230
+ <option value="black-translucent" <?php if ( isset( $splashIcons['status_bar_style'] ) ) { selected( $splashIcons['status_bar_style'], 'black-translucent' ); } ?>>
231
+ <?php _e( 'Black translucent', 'super-progressive-web-apps' ); ?>
232
+ </option>
233
+ </select>
234
+ </label>
235
+ <?php
236
+ }
237
+
238
+ /**
239
+ * Apple Touch Icon & splash screen require tags data
240
+ *
241
+ * @since 1.7
242
+ */
243
+ function superpwa_apple_splashscreen_files_data(){
244
+ $iosSplashData = array(
245
+ '1136x640'=> array("device-width"=> '320px', "device-height"=> "568px","ratio"=> 2,"orientation"=> "landscape","file"=> "icon_1136x640.png",'name'=> 'iPhone 5/iPhone SE'),
246
+ '640x1136'=> array("device-width"=> '320px', "device-height"=> "568px","ratio"=> 2,"orientation"=> "portrait", "file"=> "icon_640x1136.png",'name'=> 'iPhone 5/iPhone SE'),
247
+ '2688x1242'=>array("device-width"=> '414px', "device-height"=> "896px","ratio"=> 3,"orientation"=> "landscape", "file"=> "icon_2688x1242.png", 'name'=>'iPhone XS Max'),
248
+ '1792x828'=> array("device-width"=> '414px', "device-height"=> "896px","ratio"=> 2, "orientation"=> "landscape", "file"=> "icon_1792x828.png", 'name'=>'iPhone XR'),
249
+ '1125x2436'=>array("device-width"=> '375px', "device-height"=> "812px","ratio"=> 3,"orientation"=> 'portrait', "file"=>"icon_1125x2436.png", 'name'=> 'iPhone X/Xs'),
250
+ '828x1792'=> array("device-width"=> "414px", "device-height"=> "896px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_828x1792.png",'name' => 'iPhone Xr'),
251
+ '2436x1125'=> array("device-width"=> "375px","device-height"=> "812px","ratio"=> 3,"orientation"=> "landscape", "file"=>"icon_2436x1125.png", 'name'=> 'iPhone X/Xs'),
252
+ '1242x2208'=> array("device-width"=> "414px","device-height"=> "736px","ratio"=> 3,"orientation"=> "portrait", "file"=>"icon_1242x2208.png", 'name'=> 'iPhone 6/7/8 Plus'),
253
+ '2208x1242'=>array("device-width"=> "414px","device-height"=> "736px","ratio"=> 3,"orientation"=> "landscape", "file"=>"icon_2208x1242.png", 'name'=> 'iPhone 6/7/8 Plus'),
254
+ '1334x750'=>array("device-width"=> "375px","device-height"=> "667px","ratio"=> 2,"orientation"=> "landscape", "file"=>"icon_1334x750.png", 'name'=> 'iPhone 6/7/8'),
255
+ '750x1334'=>array("device-width"=> "375px","device-height"=> "667px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_750x1334.png", 'name'=> 'iPhone 6/7/8'),
256
+ '2732x2048'=>array("device-width"=> "1024px","device-height"=>"1366px","ratio"=> 2,"orientation"=> "landscape","file"=>"icon_2732x2048.png", 'name'=> 'iPad Pro 12.9"'),
257
+ '2048x2732'=>array("device-width"=> "1024px","device-height"=> "1366px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_2048x2732.png", 'name'=> 'iPad Pro 12.9"'),
258
+ '2388x1668'=>array("device-width"=> "834px","device-height"=> "1194px","ratio"=> 2,"orientation"=> "landscape", "file"=>"icon_2388x1668.png",'name'=> 'iPad Pro 11"'),
259
+ '1668x2388'=>array("device-width"=> "834px","device-height"=> "1194px","ratio"=> 2,"orientation"=> "portrait","file"=>"icon_1668x2388.png",'name'=> 'iPad Pro 11"'),
260
+ '2224x1668'=>array("device-width"=> "834px", "device-height"=> "1112px","ratio"=> 2,"orientation"=>"landscape","file"=>"icon_2224x1668.png", 'name'=> 'iPad Pro 10.5"'),
261
+ '1242x2688'=>array("device-width"=> "414px","device-height"=> "896px","ratio"=> 3, "orientation"=> "portrait","file"=>"icon_1242x2688.png", 'name' => 'iPhone Xs Max'),
262
+ '1668x2224'=>array("device-width"=> "834px","device-height"=> "1112px","ratio"=> 2, "orientation"=> "portrait","file"=>"icon_1668x2224.png", 'name'=> 'iPad Pro 10.5"'),
263
+ '1536x2048'=>array("device-width"=> "768px","device-height"=> "1024px","ratio"=> 2, "orientation"=> "portrait","file"=>"icon_1536x2048.png", 'name'=> 'iPad Mini/iPad Air'),
264
+ '2048x1536'=>array("device-width"=> "768px","device-height"=> "1024px","ratio"=> 2,"orientation"=> "landscape","file"=>"icon_2048x1536.png", 'name'=> 'iPad Mini/iPad Air'),
265
+ '1170x2532'=>array("device-width"=> "390px","device-height"=> "844px","ratio"=> 3,"orientation"=> "portrait","file"=>"icon_1170x2532.png", 'name'=> 'iPhone 12/13/14'),
266
+ '2532x1170'=>array("device-width"=> "844px","device-height"=> "390px","ratio"=> 3,"orientation"=> "landscape","file"=>"icon_2532x1170.png", 'name'=> 'iPhone 12/13/14'),
267
+ '2778x1284'=>array("device-width"=> "926px","device-height"=> "428px","ratio"=> 3,"orientation"=> "landscape","file"=>"icon_2778x1284.png", 'name'=> 'iPhone 12 Pro Max/13 Pro Max/14 Plus'),
268
+ '1284x2778'=>array("device-width"=> "428px","device-height"=> "926px","ratio"=> 3,"orientation"=> "portrait","file"=>"icon_2532x1170.png", 'name'=> 'iPhone 12 Pro Max/13 Pro Max/14 Plus'),
269
+ '2556x1179'=>array("device-width"=> "852px","device-height"=> "393px","ratio"=> 3,"orientation"=> "landscape","file"=>"icon_2556x1179.png", 'name'=> 'iPhone 14 Pro'),
270
+ '1179x2556'=>array("device-width"=> "393px","device-height"=> "852px","ratio"=> 3,"orientation"=> "portrait","file"=>"icon_1179x2556.png", 'name'=> 'iPhone 14 Pro'),
271
+ '2796x1290'=>array("device-width"=> "932px","device-height"=> "430px","ratio"=> 3,"orientation"=> "landscape","file"=>"icon_2796x1290.png", 'name'=> 'iPhone 14 Pro Max'),
272
+ '1290x2796'=>array("device-width"=> "430px","device-height"=> "932px","ratio"=> 3,"orientation"=> "portrait","file"=>"icon_1290x2796.png", 'name'=> 'iPhone 14 Pro Max'),
273
+
274
+ );
275
+ return $iosSplashData;
276
+ }
277
+
278
+ function superpwa_load_admin_scripts($hooks){
279
+ if( !in_array($hooks, array('superpwa_page_superpwa-apple-icons', 'super-pwa_page_superpwa-apple-icons')) && strpos($hooks, 'superpwa-apple-icons') == false ) {
280
+ return false;
281
+ }
282
+ wp_enqueue_media();
283
+ wp_register_script('superpwa-admin-apple-script',SUPERPWA_PATH_SRC .'/admin/js/jszip.min.js', array('superpwa-main-js'), SUPERPWA_VERSION, true);
284
+ wp_enqueue_script('superpwa-admin-apple-script');
285
+ wp_localize_script( 'superpwa-admin-apple-script', 'superpwaIosScreen',
286
+ array('nonce'=> wp_create_nonce( 'superpwaIosScreenSecurity' )) );
287
+
288
+
289
+ }
290
+ add_action( 'admin_enqueue_scripts', 'superpwa_load_admin_scripts' );
291
+
292
+ /**
293
+ * Validate and sanitize user input
294
+ *
295
+ * @since 2.1.7
296
+ */
297
+ function superpwa_apple_icons_validater_sanitizer( $settings ) {
298
+ // Sanitize and validate campaign source. Campaign source cannot be empty.
299
+ $settings['screen_icon'] = (isset($settings['screen_icon'])) ? sanitize_text_field( $settings['screen_icon'] ) : '';
300
+
301
+ // Sanitize and validate campaign source. Campaign source cannot be empty.
302
+ $settings['background_color'] = sanitize_text_field( $settings['background_color'] ) == '' ? '' : sanitize_text_field( $settings['background_color'] );
303
+
304
+ $settings['screen_centre_icon'] = sanitize_text_field( $settings['screen_centre_icon'] ) == '' ? '' : sanitize_text_field( $settings['screen_centre_icon'] );
305
+
306
+ $settings['status_bar_style'] = sanitize_text_field( $settings['status_bar_style'] ) == '' ? 'default' : sanitize_text_field( $settings['status_bar_style'] );
307
+
308
+ return $settings;
309
+ }
310
+ /**
311
+ * Apple Touch Icon & splash screen UI renderer
312
+ *
313
+ * @since 1.7
314
+ */
315
+ function superpwa_apple_icons_interface_render() {
316
+
317
+ // Authentication
318
+ if ( ! current_user_can( 'manage_options' ) ) {
319
+ return;
320
+ }
321
+
322
+ // Handing save settings
323
+ if ( isset( $_GET['settings-updated'] ) ) {
324
+
325
+ // Add settings saved message with the class of "updated"
326
+ add_settings_error( 'superpwa_settings_group', 'superpwa_apple_icons_settings_saved_message', __( 'Settings Saved.', 'super-progressive-web-apps' ), 'updated' );
327
+
328
+ // Show Settings Saved Message
329
+ settings_errors( 'superpwa_settings_group' );
330
+ }
331
+ // Get add-on info
332
+ $addon_utm_tracking = superpwa_get_addons( 'apple_touch_icons' );
333
+
334
+ superpwa_setting_tabs_styles();
335
+ ?>
336
+ <div class="wrap">
337
+ <!--Duplicate h1 To show saved settings message above h1 tag -->
338
+ <h1 style="display: none" ><?php _e( 'Apple touch icons & Splash Screen', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
339
+ <h1><?php _e( 'Apple touch icons & Splash Screen', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
340
+
341
+ <?php superpwa_setting_tabs_html(); ?>
342
+
343
+ <form action="options.php" method="post" enctype="multipart/form-data">
344
+ <?php
345
+ // Output nonce, action, and option_page fields for a settings page.
346
+ settings_fields( 'superpwa_apple_icons_settings_group' );
347
+
348
+ // Status
349
+ do_settings_sections( 'superpwa_apple_icons_section' ); // Page slug
350
+
351
+ echo "<p id='superpwa-apple-splash-message'></p>";
352
+ // Output save settings button
353
+ submit_button( __('Save Settings', 'super-progressive-web-apps'), 'primary ', 'submit', true, array( 'data-type' => 'create_images', 'id' => 'submit_splash_screen') );
354
+ ?>
355
+ </form>
356
+ </div>
357
+ <?php superpwa_newsletter_form(); ?>
358
+ <?php
359
+ }
360
+
361
+ function superpwa_splashscreen_uploader(){
362
+
363
+ // Authentication
364
+ if ( ! current_user_can( 'manage_options' ) ) {
365
+ return;
366
+ }
367
+
368
+ if( (!isset($_POST['security_nonce'])) || (isset($_POST['security_nonce']) && !wp_verify_nonce( $_POST['security_nonce'], 'superpwaIosScreenSecurity' )) ) {
369
+ echo json_encode(array('status'=>400, 'message'=>'security nonce not matched'));die;
370
+ }
371
+ if(isset($_FILES['file']['type']) && $_FILES['file']['type']!='application/zip'){
372
+ echo json_encode(array('status'=>500, 'message'=>'file type not matched'));die;
373
+ }
374
+ if(isset($_FILES['file']['error']) && $_FILES['file']['error']!='0'){
375
+ echo json_encode(array('status'=>500, 'message'=>'file contains error'));die;
376
+ }
377
+
378
+ $upload = wp_upload_dir();
379
+ $path = $upload['basedir']."/superpwa-splashIcons/";
380
+ $subpath = $upload['basedir']."/superpwa-splashIcons/super_splash_screens/";
381
+ wp_mkdir_p($path);
382
+ file_put_contents($path.'/index.html','');
383
+ file_put_contents($subpath.'/index.html','');
384
+ WP_Filesystem();
385
+ $zipFileName = $path."/splashScreen.zip";
386
+ $moveFile = move_uploaded_file($_FILES['file']['tmp_name'], $zipFileName);
387
+ if($moveFile && superpwa_zip_allowed_extensions($zipFileName,['png'])){
388
+ $result = unzip_file($zipFileName, $path);
389
+ unlink($zipFileName);
390
+ }else{
391
+ echo json_encode(array('status'=>500, 'message'=>'Files are not uploading'));die;
392
+ }
393
+
394
+ $pathURL = $upload['baseurl']."/superpwa-splashIcons/super_splash_screens/";
395
+ $iosScreenData = superpwa_apple_splashscreen_files_data();
396
+ $iosScreenSetting = (array)get_option( 'superpwa_apple_icons_uploaded' ) ;
397
+ foreach ($iosScreenData as $key => $value) {
398
+ $iosScreenSetting['ios_splash_icon'][$key] = $pathURL.$value['file'];
399
+ }
400
+ update_option( 'superpwa_apple_icons_uploaded', $iosScreenSetting ) ;
401
+
402
+ echo json_encode(array("status"=>200, "message"=> "Splash screen uploaded successfully"));
403
+ die;
404
+ }
405
+ function superpwa_zip_allowed_extensions($zip_path, array $allowed_extensions) {
406
+ $zip = new ZipArchive;
407
+ $zip->open($zip_path);
408
+
409
+ for ($i = 0; $i < $zip->numFiles; $i++) {
410
+ $stat = $zip->statIndex( $i );
411
+ $ext = pathinfo($stat['name'], PATHINFO_EXTENSION);
412
+
413
+ // Skip folders name (but their content will be checked)
414
+ if ($ext === '' && substr($stat['name'], -1) === '/')
415
+ continue;
416
+
417
+ if (!in_array(strtolower($ext), $allowed_extensions))
418
+ return false;
419
+ }
420
+ return true;
421
+ }
422
  add_action('wp_ajax_superpwa_splashscreen_uploader', 'superpwa_splashscreen_uploader');
addons/caching-strategies.php CHANGED
@@ -1,479 +1,479 @@
1
- <?php
2
- /**
3
- * Caching Strategies Icons
4
- *
5
- * @since 2.1.7
6
- *
7
- * @function superpwa_caching_strategies_get_settings() Settings of cache strategies
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) ) exit;
12
-
13
- /**
14
- * Get Caching Strategies settings
15
- *
16
- * @since 2.1.7
17
- */
18
- function superpwa_caching_strategies_get_settings() {
19
-
20
- $defaults = array(
21
- 'caching_type' => 'network_first',
22
- 'precaching_automatic' => '0',
23
- 'precaching_manual' => '0',
24
- 'precaching_automatic_post' => '0',
25
- 'precaching_automatic_page' => '0',
26
- 'precaching_post_count' => '5',
27
- 'precaching_urls' => '',
28
- );
29
-
30
- return get_option( 'superpwa_caching_strategies_settings', $defaults );
31
- }
32
-
33
- function superpwa_caching_strategies_sw_template($file_string){
34
- $settings = superpwa_caching_strategies_get_settings();
35
- $caching_type = isset($settings['caching_type'])? $settings['caching_type'] : 'network_first';
36
- if($caching_type=='network_first'){ return $file_string; }
37
- $script = '';
38
- switch($caching_type){
39
- case 'network_first':
40
- $script = ''; //already working with network first, so no need to edit
41
- break;
42
- case 'cache_first':
43
- $script = 'e.respondWith(
44
- caches.open(cacheName)
45
- .then(function(cache) {
46
- cache.match(e.request)
47
- .then( function(cacheResponse) {
48
- if(cacheResponse)
49
- return cacheResponse
50
- else
51
- return fetch(e.request)
52
- .then(function(networkResponse) {
53
- cache.put(e.request, networkResponse.clone())
54
- return networkResponse
55
- })
56
- })
57
- }).catch(function(){
58
- return fetch(e.request).then(function(response) {
59
- return caches.open(cacheName).then(function(cache) {
60
- cache.put(e.request, response.clone());
61
- return response;
62
- });
63
- })
64
- })
65
- );';
66
- break;
67
- case 'steal_while_revalidate':
68
- $script = 'e.respondWith(
69
- caches.open(cacheName)
70
- .then(function(cache) {
71
- cache.match(e.request)
72
- .then( function(cacheResponse) {
73
- fetch(e.request)
74
- .then(function(networkResponse) {
75
- cache.put(e.request, networkResponse)
76
- })
77
- return cacheResponse || networkResponse
78
- })
79
- })
80
- );';
81
- break;
82
- case 'cache_only':
83
- $script = 'e.respondWith(
84
- caches.open(cacheName).then(function(cache) {
85
- cache.match(e.request).then(function(cacheResponse) {
86
- return cacheResponse;
87
- })
88
- })
89
- );';
90
- break;
91
- case 'network_only':
92
- $script = 'e.respondWith(
93
- fetch(event.request).then(function(networkResponse) {
94
- return networkResponse
95
- })
96
- );';
97
- break;
98
- }
99
- if(!empty($script)){
100
- $replaceContent = 'e.respondWith(
101
- fetch(e.request).then(function(response) {
102
- return caches.open(cacheName).then(function(cache) {
103
- cache.put(e.request, response.clone());
104
- return response;
105
- });
106
- })
107
- );';
108
- $file_string = str_replace($replaceContent, $script, $file_string);
109
- }
110
- return $file_string;
111
- }
112
- add_filter( 'superpwa_sw_template', 'superpwa_caching_strategies_sw_template', 10, 1 );
113
-
114
-
115
- /**
116
- * Adding Pre Cache Urls in Service Worker Js
117
- * @since 2.1.17
118
- */
119
- function superpwa_pre_caching_urls_sw( $files_to_cache ) {
120
-
121
- $settings = superpwa_caching_strategies_get_settings();
122
- $pre_cache_urls = $manual_urls = '';
123
- if(isset($settings['precaching_manual']) && $settings['precaching_manual'] == '1' && !empty($settings['precaching_urls'])){
124
- $manual_urls = str_replace(',', '\',\'', $settings['precaching_urls']);
125
- $files_to_cache = '\''.$manual_urls.'\','.$files_to_cache;
126
- }
127
-
128
-
129
- $store_post_id = array();
130
- $store_post_id = json_decode(get_transient('superpwa_pre_cache_post_ids'));
131
-
132
- if(!empty($store_post_id) && isset($settings['precaching_automatic']) && $settings['precaching_automatic']==1){
133
- $files_to_cache .= ',';
134
- foreach ($store_post_id as $post_id){
135
-
136
- $files_to_cache .= "'".trim(get_permalink($post_id))."',\n";
137
-
138
- }
139
- }
140
-
141
- return $files_to_cache;
142
- }
143
- add_filter( 'superpwa_sw_files_to_cache', 'superpwa_pre_caching_urls_sw' );
144
-
145
- /**
146
- * Getting Post Ids for Automatic Pre-Caching
147
- * @since 2.1.17
148
- */
149
-
150
- add_action( 'publish_post', 'superpwa_store_latest_post_ids', 10, 2 );
151
- add_action( 'publish_page', 'superpwa_store_latest_post_ids', 10, 2 );
152
-
153
- function superpwa_store_latest_post_ids(){
154
-
155
- if ( ! current_user_can( 'edit_posts' ) ) {
156
- return;
157
- }
158
-
159
- $post_ids = array();
160
- $settings = superpwa_caching_strategies_get_settings();
161
-
162
- if(isset($settings['precaching_automatic']) && $settings['precaching_automatic']==1){
163
-
164
- $post_count = 10;
165
-
166
- if(isset($settings['precaching_post_count']) && $settings['precaching_post_count'] !=''){
167
- $post_count =$settings['precaching_post_count'];
168
- }
169
- $post_args = array( 'numberposts' => $post_count, 'post_status'=> 'publish', 'post_type'=> 'post' );
170
- $page_args = array( 'number' => $post_count, 'post_status'=> 'publish', 'post_type'=> 'page' );
171
-
172
- if(isset($settings['precaching_automatic_post']) && $settings['precaching_automatic_post']==1){
173
- $postslist = get_posts( $post_args );
174
- if($postslist){
175
- foreach ($postslist as $post){
176
- $post_ids[] = $post->ID;
177
- }
178
- }
179
- }else{
180
- delete_transient('superpwa_pre_cache_post_ids');
181
- }
182
-
183
- if(isset($settings['precaching_automatic_page']) && $settings['precaching_automatic_page']==1){
184
- $pageslist = get_pages( $page_args );
185
- if($pageslist){
186
- foreach ($pageslist as $post){
187
- $post_ids[] = $post->ID;
188
- }
189
- }
190
- }else{
191
- delete_transient('superpwa_pre_cache_post_ids');
192
- }
193
- $previousIds = get_transient('superpwa_pre_cache_post_ids');
194
- if($post_ids){
195
- if($previousIds){
196
- $previousIds = json_decode($previousIds);
197
- if(array_diff($post_ids, $previousIds)){
198
- set_transient('superpwa_pre_cache_post_ids', json_encode($post_ids));
199
- }
200
- }else{
201
- set_transient('superpwa_pre_cache_post_ids', json_encode($post_ids));
202
- }
203
- }
204
-
205
-
206
- }
207
- }
208
-
209
- /**
210
- * Todo list after saving caching_strategies settings
211
- *
212
- * Regenerate Service Worker when settings are saved.
213
- * Also used when add-on is activated and deactivated.
214
- *
215
- * @since 1.7
216
- */
217
- function superpwa_caching_strategies_save_settings_todo() {
218
-
219
- // Regenerate manifest
220
- superpwa_generate_sw();
221
- }
222
- add_action( 'add_option_superpwa_caching_strategies_settings', 'superpwa_caching_strategies_save_settings_todo' );
223
- add_action( 'update_option_superpwa_caching_strategies_settings', 'superpwa_caching_strategies_save_settings_todo' );
224
- add_action( 'superpwa_addon_activated_caching_strategies', 'superpwa_caching_strategies_save_settings_todo' );
225
-
226
- /**
227
- * Deactivation Todo
228
- *
229
- * Unhook the filter and regenerate manifest
230
- *
231
- * @since 1.7
232
- */
233
- function superpwa_caching_strategies_deactivate_todo() {
234
-
235
- // Unhook the UTM tracking params filter
236
- remove_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
237
-
238
- // Regenerate Service Worker
239
- superpwa_generate_sw();
240
- }
241
- add_action( 'superpwa_addon_deactivated_caching_strategies', 'superpwa_caching_strategies_deactivate_todo' );
242
-
243
- /**
244
- * Register Caching Strategies settings
245
- *
246
- * @since 2.1.7
247
- */
248
- function superpwa_caching_strategies_settings(){
249
- // Register Setting
250
- register_setting(
251
- 'superpwa_caching_strategies_settings_group', // Group name
252
- 'superpwa_caching_strategies_settings', // Setting name = html form <input> name on settings form
253
- 'superpwa_caching_strategies_validater_sanitizer' // Input validator and sanitizer
254
- );
255
-
256
- // UTM Tracking
257
- add_settings_section(
258
- 'superpwa_caching_strategies_section', // ID
259
- __return_false(), // Title
260
- 'superpwa_caching_strategies_section_cb', // Callback Function
261
- 'superpwa_caching_strategies_section' // Page slug
262
- );
263
- // Caching Strategies type
264
- add_settings_field(
265
- 'superpwa_caching_strategies_caching_type', // ID
266
- __('Caching Strategies Type', 'super-progressive-web-apps'), // Title
267
- 'superpwa_caching_strategies_caching_type_cb', // CB
268
- 'superpwa_caching_strategies_section', // Page slug
269
- 'superpwa_caching_strategies_section' // Settings Section ID
270
- );
271
- // Pre Caching Feature
272
- add_settings_field(
273
- 'superpwa_caching_strategies_pre_caching', // ID
274
- __('Pre Caching', 'super-progressive-web-apps'), // Title
275
- 'superpwa_caching_strategies_pre_caching_cb', // CB
276
- 'superpwa_caching_strategies_section', // Page slug
277
- 'superpwa_caching_strategies_section' // Settings Section ID
278
- );
279
- }
280
- add_action( 'admin_init', 'superpwa_caching_strategies_settings' );
281
-
282
-
283
- /**
284
- * Validate and sanitize user input
285
- *
286
- * @since 2.1.7
287
- */
288
- function superpwa_caching_strategies_validater_sanitizer( $settings ) {
289
-
290
- // Sanitize and validate campaign source. Campaign source cannot be empty.
291
- $settings['caching_type'] = sanitize_text_field( $settings['caching_type'] ) == '' ? 'network_first' : sanitize_text_field( $settings['caching_type'] );
292
-
293
- return $settings;
294
- }
295
-
296
- /**
297
- * Callback function for Caching Strategies section
298
- *
299
- * @since 1.7
300
- */
301
- function superpwa_caching_strategies_section_cb() {
302
-
303
- printf( '<p>' . __( 'Caching strategies will help your users to get connected and display content, perform function, in bad network conditions and even when the user is completely offline.', 'super-progressive-web-apps' ) . '</p>');
304
- }
305
-
306
- /**
307
- * Current Start URL
308
- *
309
- * @since 1.7
310
- */
311
- function superpwa_caching_strategies_caching_type_cb() {
312
- $cachingSettings = superpwa_caching_strategies_get_settings();
313
-
314
- echo '<p><label class="label"><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="network_first" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='network_first'? 'checked': '').'> Network first, then Cache </label></p>
315
- <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="cache_first" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='cache_first'? 'checked': '').'> Cache first, then Network </label>
316
- </p>
317
- <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="steal_while_revalidate" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='steal_while_revalidate'? 'checked': '').'> Stale While Revalidate </label></p>
318
- <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="cache_only" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='cache_only'? 'checked': '').'> Cache only </label></p>
319
- <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="network_only" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='network_only'? 'checked': '').'> Network only </label></p>
320
- ';
321
- }
322
-
323
- /**
324
- * Pre Caching Callback function
325
- *
326
- * @since 2.1.17
327
- */
328
- function superpwa_caching_strategies_pre_caching_cb() {
329
- $cachingSettings = superpwa_caching_strategies_get_settings();
330
-
331
- $settings = superpwa_caching_strategies_get_settings();
332
-
333
- $arrayOPT = array(
334
- 'automatic'=>'Automatic',
335
- 'manual'=>'Manual',
336
- );
337
- ?>
338
-
339
- <style type="text/css">.pre-manual-suboption span {display: table-cell;margin-bottom: 9px;padding: 15px 10px;line-height: 1.3;vertical-align: middle;}.show{display: block;}.hide{display: none}
340
- </style>
341
-
342
- <div class="pre-cache-main">
343
- <div class="pre-cache-automatic">
344
- <div class="pre-automatic-checkbox" style="margin-bottom: 10px;">
345
- <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic]" id="precaching_automatic" class="" <?php echo (isset( $settings['precaching_automatic'] ) && $settings['precaching_automatic'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
346
-
347
- <strong><?php echo esc_html__('Automatic', 'super-progressive-web-apps'); ?></strong>
348
- <!-- <span class="pwafw-tooltip"><i class="dashicons dashicons-editor-help"></i>
349
- <span class="pwafw-help-subtitle"><a href="https://pwa-for-wp.com/docs/article/setting-up-precaching-in-pwa/"><?php //echo esc_html__('For details click here', 'pwa-for-wp'); ?></a></span>
350
- </span> -->
351
- </div>
352
- <div id="pre-automatic-suboption" class="pre-automatic-suboption <?php echo (isset( $settings['precaching_automatic'] ) && $settings['precaching_automatic'] == 1 ? ' show' : ' hide'); ?>" style="margin-bottom: 30px;margin-left: 40px;">
353
- <table class="pre-automatic-cache-table" style="margin-bottom: 12px;">
354
- <tr>
355
- <td>
356
- <?php echo esc_html__('Post', 'super-progressive-web-apps') ?>
357
- </td>
358
- <td>
359
- <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic_post]" id="superpwa_settings_precaching_automatic_post" class="" <?php echo (isset( $settings['precaching_automatic_post'] ) && $settings['precaching_automatic_post'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
360
- </td>
361
- <td>
362
- <?php echo esc_html__('Page', 'super-progressive-web-apps') ?>
363
- </td>
364
- <td>
365
- <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic_page]" id="superpwa_settings_precaching_automatic_page" class="" <?php echo (isset( $settings['precaching_automatic_page'] ) && $settings['precaching_automatic_page'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
366
- </td>
367
- <td>
368
- <?php echo esc_html__('Custom Post', 'super-progressive-web-apps') ?>
369
- </td>
370
- <td>
371
- <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic_custom_post]" id="superpwa_settings_precaching_automatic_custom_post" class="" <?php echo (isset( $settings['precaching_automatic_custom_post'] ) && $settings['precaching_automatic_custom_post'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
372
- </td>
373
- </tr>
374
-
375
- </table>
376
-
377
- <span style="margin-left: 12px;"><strong><?php echo esc_html__('Enter Post Count', 'super-progressive-web-apps'); ?></strong></span>
378
- <span style="margin-left: 14px;">
379
- <input id="superpwa_settings_precaching_post_count" name="superpwa_caching_strategies_settings[precaching_post_count]" value="<?php if(isset($settings['precaching_post_count'])){ echo esc_attr($settings['precaching_post_count']);} ?>" type="number" min="0">
380
- </span>
381
- </div>
382
- </div> <!-- automatic wrap ends here -->
383
-
384
-
385
-
386
- <div class="pre-cache-manual" style="margin-top: 20px;">
387
- <div class="pre-manual-checkbox" style="margin-bottom: 10px;">
388
- <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_manual]" id="precaching_manual" class="" <?php echo (isset( $settings['precaching_manual'] ) && $settings['precaching_manual'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
389
-
390
- <strong><?php echo esc_html__('Manual', 'super-progressive-web-apps'); ?></strong>
391
- <!-- <span class="pwafw-tooltip"><i class="dashicons dashicons-editor-help"></i>
392
- <span class="pwafw-help-subtitle"><a href="https://pwa-for-wp.com/docs/article/setting-up-precaching-in-pwa/"><?php //echo esc_html__('For details click here', 'pwa-for-wp'); ?></a></span>
393
- </span> -->
394
-
395
- </div>
396
- <div id="pre-manual-suboption" class="pre-manual-suboption <?php echo (isset( $settings['precaching_manual'] ) && $settings['precaching_manual'] == 1 ? ' show' : ' hide'); ?>" style="margin-left: 45px;">
397
- <span class="pre-manual-label"> <strong> <?php echo esc_html__('Enter Urls To Be Cached', 'super-progressive-web-apps'); ?> </strong></span>
398
- <span class="pre-manual-textarea">
399
- <label><textarea placeholder="https://example.com/2019/06/06/hello-world/, https://example.com/2019/06/06/hello-world-2/ " rows="4" cols="50" id="superpwa_settings_precaching_urls" name="superpwa_caching_strategies_settings[precaching_urls]"><?php if(isset($settings['precaching_urls'])){ echo esc_attr($settings['precaching_urls']);} ?></textarea></label>
400
- <p><?php echo esc_html__('Note: Seperate the URLs using Comma(,)', 'super-progressive-web-apps'); ?></p>
401
- <p><?php echo esc_html__('Place the list of URLs which you want to pre cache by service worker', 'super-progressive-web-apps'); ?></p>
402
- </span>
403
- </div>
404
-
405
- </div> <!-- Manual wrap ends here -->
406
- </div> <!-- Main wrap ends here -->
407
-
408
-
409
-
410
- <?php
411
-
412
- }
413
-
414
- /**
415
- * Caching Strategies Admin Scripts
416
- *
417
- * @since 2.1.17
418
- */
419
-
420
- function superpwa_precache_load_admin_scripts($hooks){
421
- if( !in_array($hooks, array('superpwa_page_superpwa-caching-strategies', 'super-pwa_page_superpwa-caching-strategies')) && strpos($hooks, 'superpwa-caching-strategies') == false ) {
422
- return false;
423
- }
424
-
425
- wp_register_script('superpwa-admin-precache-script',SUPERPWA_PATH_SRC .'/admin/js/pre-cache.js', array('superpwa-main-js'), SUPERPWA_VERSION, true);
426
-
427
- wp_enqueue_script('superpwa-admin-precache-script');
428
-
429
- }
430
- add_action( 'admin_enqueue_scripts', 'superpwa_precache_load_admin_scripts' );
431
-
432
- /**
433
- * Caching Strategies UI renderer
434
- *
435
- * @since 2.1.7
436
- */
437
- function superpwa_caching_strategies_interface_render() {
438
-
439
- // Authentication
440
- if ( ! current_user_can( 'manage_options' ) ) {
441
- return;
442
- }
443
-
444
- // Handing save settings
445
- if ( isset( $_GET['settings-updated'] ) ) {
446
-
447
- // Add settings saved message with the class of "updated"
448
- add_settings_error( 'superpwa_settings_group', 'superpwa_caching_strategies_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
449
-
450
- // Show Settings Saved Message
451
- settings_errors( 'superpwa_settings_group' );
452
- }
453
- // Get add-on info
454
- $addon_utm_tracking = superpwa_get_addons( 'caching_strategies' );
455
-
456
- superpwa_setting_tabs_styles();
457
- ?>
458
-
459
- <div class="wrap">
460
- <h1><?php _e( 'Caching Strategies', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
461
-
462
- <?php superpwa_setting_tabs_html(); ?>
463
-
464
- <form action="options.php" method="post" class="form-table" enctype="multipart/form-data">
465
- <?php
466
- // Output nonce, action, and option_page fields for a settings page.
467
- settings_fields( 'superpwa_caching_strategies_settings_group' );
468
-
469
- // Status
470
- do_settings_sections( 'superpwa_caching_strategies_section' ); // Page slug
471
-
472
- // Output save settings button
473
- submit_button( __('Save Settings', 'super-progressive-web-apps') );
474
- ?>
475
- </form>
476
- </div>
477
- <?php superpwa_newsletter_form(); ?>
478
- <?php
479
  }
1
+ <?php
2
+ /**
3
+ * Caching Strategies Icons
4
+ *
5
+ * @since 2.1.7
6
+ *
7
+ * @function superpwa_caching_strategies_get_settings() Settings of cache strategies
8
+ */
9
+
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) ) exit;
12
+
13
+ /**
14
+ * Get Caching Strategies settings
15
+ *
16
+ * @since 2.1.7
17
+ */
18
+ function superpwa_caching_strategies_get_settings() {
19
+
20
+ $defaults = array(
21
+ 'caching_type' => 'network_first',
22
+ 'precaching_automatic' => '0',
23
+ 'precaching_manual' => '0',
24
+ 'precaching_automatic_post' => '0',
25
+ 'precaching_automatic_page' => '0',
26
+ 'precaching_post_count' => '5',
27
+ 'precaching_urls' => '',
28
+ );
29
+
30
+ return get_option( 'superpwa_caching_strategies_settings', $defaults );
31
+ }
32
+
33
+ function superpwa_caching_strategies_sw_template($file_string){
34
+ $settings = superpwa_caching_strategies_get_settings();
35
+ $caching_type = isset($settings['caching_type'])? $settings['caching_type'] : 'network_first';
36
+ if($caching_type=='network_first'){ return $file_string; }
37
+ $script = '';
38
+ switch($caching_type){
39
+ case 'network_first':
40
+ $script = ''; //already working with network first, so no need to edit
41
+ break;
42
+ case 'cache_first':
43
+ $script = 'e.respondWith(
44
+ caches.open(cacheName)
45
+ .then(function(cache) {
46
+ cache.match(e.request)
47
+ .then( function(cacheResponse) {
48
+ if(cacheResponse)
49
+ return cacheResponse
50
+ else
51
+ return fetch(e.request)
52
+ .then(function(networkResponse) {
53
+ cache.put(e.request, networkResponse.clone())
54
+ return networkResponse
55
+ })
56
+ })
57
+ }).catch(function(){
58
+ return fetch(e.request).then(function(response) {
59
+ return caches.open(cacheName).then(function(cache) {
60
+ cache.put(e.request, response.clone());
61
+ return response;
62
+ });
63
+ })
64
+ })
65
+ );';
66
+ break;
67
+ case 'steal_while_revalidate':
68
+ $script = 'e.respondWith(
69
+ caches.open(cacheName)
70
+ .then(function(cache) {
71
+ cache.match(e.request)
72
+ .then( function(cacheResponse) {
73
+ fetch(e.request)
74
+ .then(function(networkResponse) {
75
+ cache.put(e.request, networkResponse)
76
+ })
77
+ return cacheResponse || networkResponse
78
+ })
79
+ })
80
+ );';
81
+ break;
82
+ case 'cache_only':
83
+ $script = 'e.respondWith(
84
+ caches.open(cacheName).then(function(cache) {
85
+ cache.match(e.request).then(function(cacheResponse) {
86
+ return cacheResponse;
87
+ })
88
+ })
89
+ );';
90
+ break;
91
+ case 'network_only':
92
+ $script = 'e.respondWith(
93
+ fetch(event.request).then(function(networkResponse) {
94
+ return networkResponse
95
+ })
96
+ );';
97
+ break;
98
+ }
99
+ if(!empty($script)){
100
+ $replaceContent = 'e.respondWith(
101
+ fetch(e.request).then(function(response) {
102
+ return caches.open(cacheName).then(function(cache) {
103
+ cache.put(e.request, response.clone());
104
+ return response;
105
+ });
106
+ })
107
+ );';
108
+ $file_string = str_replace($replaceContent, $script, $file_string);
109
+ }
110
+ return $file_string;
111
+ }
112
+ add_filter( 'superpwa_sw_template', 'superpwa_caching_strategies_sw_template', 10, 1 );
113
+
114
+
115
+ /**
116
+ * Adding Pre Cache Urls in Service Worker Js
117
+ * @since 2.1.17
118
+ */
119
+ function superpwa_pre_caching_urls_sw( $files_to_cache ) {
120
+
121
+ $settings = superpwa_caching_strategies_get_settings();
122
+ $pre_cache_urls = $manual_urls = '';
123
+ if(isset($settings['precaching_manual']) && $settings['precaching_manual'] == '1' && !empty($settings['precaching_urls'])){
124
+ $manual_urls = str_replace(',', '\',\'', $settings['precaching_urls']);
125
+ $files_to_cache = '\''.$manual_urls.'\','.$files_to_cache;
126
+ }
127
+
128
+
129
+ $store_post_id = array();
130
+ $store_post_id = json_decode(get_transient('superpwa_pre_cache_post_ids'));
131
+
132
+ if(!empty($store_post_id) && isset($settings['precaching_automatic']) && $settings['precaching_automatic']==1){
133
+ $files_to_cache .= ',';
134
+ foreach ($store_post_id as $post_id){
135
+
136
+ $files_to_cache .= "'".trim(get_permalink($post_id))."',\n";
137
+
138
+ }
139
+ }
140
+
141
+ return $files_to_cache;
142
+ }
143
+ add_filter( 'superpwa_sw_files_to_cache', 'superpwa_pre_caching_urls_sw' );
144
+
145
+ /**
146
+ * Getting Post Ids for Automatic Pre-Caching
147
+ * @since 2.1.17
148
+ */
149
+
150
+ add_action( 'publish_post', 'superpwa_store_latest_post_ids', 10, 2 );
151
+ add_action( 'publish_page', 'superpwa_store_latest_post_ids', 10, 2 );
152
+
153
+ function superpwa_store_latest_post_ids(){
154
+
155
+ if ( ! current_user_can( 'edit_posts' ) ) {
156
+ return;
157
+ }
158
+
159
+ $post_ids = array();
160
+ $settings = superpwa_caching_strategies_get_settings();
161
+
162
+ if(isset($settings['precaching_automatic']) && $settings['precaching_automatic']==1){
163
+
164
+ $post_count = 10;
165
+
166
+ if(isset($settings['precaching_post_count']) && $settings['precaching_post_count'] !=''){
167
+ $post_count =$settings['precaching_post_count'];
168
+ }
169
+ $post_args = array( 'numberposts' => $post_count, 'post_status'=> 'publish', 'post_type'=> 'post' );
170
+ $page_args = array( 'number' => $post_count, 'post_status'=> 'publish', 'post_type'=> 'page' );
171
+
172
+ if(isset($settings['precaching_automatic_post']) && $settings['precaching_automatic_post']==1){
173
+ $postslist = get_posts( $post_args );
174
+ if($postslist){
175
+ foreach ($postslist as $post){
176
+ $post_ids[] = $post->ID;
177
+ }
178
+ }
179
+ }else{
180
+ delete_transient('superpwa_pre_cache_post_ids');
181
+ }
182
+
183
+ if(isset($settings['precaching_automatic_page']) && $settings['precaching_automatic_page']==1){
184
+ $pageslist = get_pages( $page_args );
185
+ if($pageslist){
186
+ foreach ($pageslist as $post){
187
+ $post_ids[] = $post->ID;
188
+ }
189
+ }
190
+ }else{
191
+ delete_transient('superpwa_pre_cache_post_ids');
192
+ }
193
+ $previousIds = get_transient('superpwa_pre_cache_post_ids');
194
+ if($post_ids){
195
+ if($previousIds){
196
+ $previousIds = json_decode($previousIds);
197
+ if(array_diff($post_ids, $previousIds)){
198
+ set_transient('superpwa_pre_cache_post_ids', json_encode($post_ids));
199
+ }
200
+ }else{
201
+ set_transient('superpwa_pre_cache_post_ids', json_encode($post_ids));
202
+ }
203
+ }
204
+
205
+
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Todo list after saving caching_strategies settings
211
+ *
212
+ * Regenerate Service Worker when settings are saved.
213
+ * Also used when add-on is activated and deactivated.
214
+ *
215
+ * @since 1.7
216
+ */
217
+ function superpwa_caching_strategies_save_settings_todo() {
218
+
219
+ // Regenerate manifest
220
+ superpwa_generate_sw();
221
+ }
222
+ add_action( 'add_option_superpwa_caching_strategies_settings', 'superpwa_caching_strategies_save_settings_todo' );
223
+ add_action( 'update_option_superpwa_caching_strategies_settings', 'superpwa_caching_strategies_save_settings_todo' );
224
+ add_action( 'superpwa_addon_activated_caching_strategies', 'superpwa_caching_strategies_save_settings_todo' );
225
+
226
+ /**
227
+ * Deactivation Todo
228
+ *
229
+ * Unhook the filter and regenerate manifest
230
+ *
231
+ * @since 1.7
232
+ */
233
+ function superpwa_caching_strategies_deactivate_todo() {
234
+
235
+ // Unhook the UTM tracking params filter
236
+ remove_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
237
+
238
+ // Regenerate Service Worker
239
+ superpwa_generate_sw();
240
+ }
241
+ add_action( 'superpwa_addon_deactivated_caching_strategies', 'superpwa_caching_strategies_deactivate_todo' );
242
+
243
+ /**
244
+ * Register Caching Strategies settings
245
+ *
246
+ * @since 2.1.7
247
+ */
248
+ function superpwa_caching_strategies_settings(){
249
+ // Register Setting
250
+ register_setting(
251
+ 'superpwa_caching_strategies_settings_group', // Group name
252
+ 'superpwa_caching_strategies_settings', // Setting name = html form <input> name on settings form
253
+ 'superpwa_caching_strategies_validater_sanitizer' // Input validator and sanitizer
254
+ );
255
+
256
+ // UTM Tracking
257
+ add_settings_section(
258
+ 'superpwa_caching_strategies_section', // ID
259
+ __return_false(), // Title
260
+ 'superpwa_caching_strategies_section_cb', // Callback Function
261
+ 'superpwa_caching_strategies_section' // Page slug
262
+ );
263
+ // Caching Strategies type
264
+ add_settings_field(
265
+ 'superpwa_caching_strategies_caching_type', // ID
266
+ __('Caching Strategies Type', 'super-progressive-web-apps'), // Title
267
+ 'superpwa_caching_strategies_caching_type_cb', // CB
268
+ 'superpwa_caching_strategies_section', // Page slug
269
+ 'superpwa_caching_strategies_section' // Settings Section ID
270
+ );
271
+ // Pre Caching Feature
272
+ add_settings_field(
273
+ 'superpwa_caching_strategies_pre_caching', // ID
274
+ __('Pre Caching', 'super-progressive-web-apps'), // Title
275
+ 'superpwa_caching_strategies_pre_caching_cb', // CB
276
+ 'superpwa_caching_strategies_section', // Page slug
277
+ 'superpwa_caching_strategies_section' // Settings Section ID
278
+ );
279
+ }
280
+ add_action( 'admin_init', 'superpwa_caching_strategies_settings' );
281
+
282
+
283
+ /**
284
+ * Validate and sanitize user input
285
+ *
286
+ * @since 2.1.7
287
+ */
288
+ function superpwa_caching_strategies_validater_sanitizer( $settings ) {
289
+
290
+ // Sanitize and validate campaign source. Campaign source cannot be empty.
291
+ $settings['caching_type'] = sanitize_text_field( $settings['caching_type'] ) == '' ? 'network_first' : sanitize_text_field( $settings['caching_type'] );
292
+
293
+ return $settings;
294
+ }
295
+
296
+ /**
297
+ * Callback function for Caching Strategies section
298
+ *
299
+ * @since 1.7
300
+ */
301
+ function superpwa_caching_strategies_section_cb() {
302
+
303
+ printf( '<p>' . __( 'Caching strategies will help your users to get connected and display content, perform function, in bad network conditions and even when the user is completely offline.', 'super-progressive-web-apps' ) . '</p>');
304
+ }
305
+
306
+ /**
307
+ * Current Start URL
308
+ *
309
+ * @since 1.7
310
+ */
311
+ function superpwa_caching_strategies_caching_type_cb() {
312
+ $cachingSettings = superpwa_caching_strategies_get_settings();
313
+
314
+ echo '<p><label class="label"><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="network_first" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='network_first'? 'checked': '').'> Network first, then Cache </label></p>
315
+ <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="cache_first" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='cache_first'? 'checked': '').'> Cache first, then Network </label>
316
+ </p>
317
+ <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="steal_while_revalidate" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='steal_while_revalidate'? 'checked': '').'> Stale While Revalidate </label></p>
318
+ <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="cache_only" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='cache_only'? 'checked': '').'> Cache only </label></p>
319
+ <p><label><input type="radio" name="superpwa_caching_strategies_settings[caching_type]" value="network_only" '.(isset($cachingSettings['caching_type']) && $cachingSettings['caching_type']=='network_only'? 'checked': '').'> Network only </label></p>
320
+ ';
321
+ }
322
+
323
+ /**
324
+ * Pre Caching Callback function
325
+ *
326
+ * @since 2.1.17
327
+ */
328
+ function superpwa_caching_strategies_pre_caching_cb() {
329
+ $cachingSettings = superpwa_caching_strategies_get_settings();
330
+
331
+ $settings = superpwa_caching_strategies_get_settings();
332
+
333
+ $arrayOPT = array(
334
+ 'automatic'=>'Automatic',
335
+ 'manual'=>'Manual',
336
+ );
337
+ ?>
338
+
339
+ <style type="text/css">.pre-manual-suboption span {display: table-cell;margin-bottom: 9px;padding: 15px 10px;line-height: 1.3;vertical-align: middle;}.show{display: block;}.hide{display: none}
340
+ </style>
341
+
342
+ <div class="pre-cache-main">
343
+ <div class="pre-cache-automatic">
344
+ <div class="pre-automatic-checkbox" style="margin-bottom: 10px;">
345
+ <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic]" id="precaching_automatic" class="" <?php echo (isset( $settings['precaching_automatic'] ) && $settings['precaching_automatic'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
346
+
347
+ <strong><?php echo esc_html__('Automatic', 'super-progressive-web-apps'); ?></strong>
348
+ <!-- <span class="pwafw-tooltip"><i class="dashicons dashicons-editor-help"></i>
349
+ <span class="pwafw-help-subtitle"><a href="https://pwa-for-wp.com/docs/article/setting-up-precaching-in-pwa/"><?php //echo esc_html__('For details click here', 'pwa-for-wp'); ?></a></span>
350
+ </span> -->
351
+ </div>
352
+ <div id="pre-automatic-suboption" class="pre-automatic-suboption <?php echo (isset( $settings['precaching_automatic'] ) && $settings['precaching_automatic'] == 1 ? ' show' : ' hide'); ?>" style="margin-bottom: 30px;margin-left: 40px;">
353
+ <table class="pre-automatic-cache-table" style="margin-bottom: 12px;">
354
+ <tr>
355
+ <td>
356
+ <?php echo esc_html__('Post', 'super-progressive-web-apps') ?>
357
+ </td>
358
+ <td>
359
+ <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic_post]" id="superpwa_settings_precaching_automatic_post" class="" <?php echo (isset( $settings['precaching_automatic_post'] ) && $settings['precaching_automatic_post'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
360
+ </td>
361
+ <td>
362
+ <?php echo esc_html__('Page', 'super-progressive-web-apps') ?>
363
+ </td>
364
+ <td>
365
+ <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic_page]" id="superpwa_settings_precaching_automatic_page" class="" <?php echo (isset( $settings['precaching_automatic_page'] ) && $settings['precaching_automatic_page'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
366
+ </td>
367
+ <td>
368
+ <?php echo esc_html__('Custom Post', 'super-progressive-web-apps') ?>
369
+ </td>
370
+ <td>
371
+ <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_automatic_custom_post]" id="superpwa_settings_precaching_automatic_custom_post" class="" <?php echo (isset( $settings['precaching_automatic_custom_post'] ) && $settings['precaching_automatic_custom_post'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
372
+ </td>
373
+ </tr>
374
+
375
+ </table>
376
+
377
+ <span style="margin-left: 12px;"><strong><?php echo esc_html__('Enter Post Count', 'super-progressive-web-apps'); ?></strong></span>
378
+ <span style="margin-left: 14px;">
379
+ <input id="superpwa_settings_precaching_post_count" name="superpwa_caching_strategies_settings[precaching_post_count]" value="<?php if(isset($settings['precaching_post_count'])){ echo esc_attr($settings['precaching_post_count']);} ?>" type="number" min="0">
380
+ </span>
381
+ </div>
382
+ </div> <!-- automatic wrap ends here -->
383
+
384
+
385
+
386
+ <div class="pre-cache-manual" style="margin-top: 20px;">
387
+ <div class="pre-manual-checkbox" style="margin-bottom: 10px;">
388
+ <input type="checkbox" name="superpwa_caching_strategies_settings[precaching_manual]" id="precaching_manual" class="" <?php echo (isset( $settings['precaching_manual'] ) && $settings['precaching_manual'] == 1 ? 'checked="checked"' : ''); ?> data-uncheck-val="0" value="1">
389
+
390
+ <strong><?php echo esc_html__('Manual', 'super-progressive-web-apps'); ?></strong>
391
+ <!-- <span class="pwafw-tooltip"><i class="dashicons dashicons-editor-help"></i>
392
+ <span class="pwafw-help-subtitle"><a href="https://pwa-for-wp.com/docs/article/setting-up-precaching-in-pwa/"><?php //echo esc_html__('For details click here', 'pwa-for-wp'); ?></a></span>
393
+ </span> -->
394
+
395
+ </div>
396
+ <div id="pre-manual-suboption" class="pre-manual-suboption <?php echo (isset( $settings['precaching_manual'] ) && $settings['precaching_manual'] == 1 ? ' show' : ' hide'); ?>" style="margin-left: 45px;">
397
+ <span class="pre-manual-label"> <strong> <?php echo esc_html__('Enter Urls To Be Cached', 'super-progressive-web-apps'); ?> </strong></span>
398
+ <span class="pre-manual-textarea">
399
+ <label><textarea placeholder="https://example.com/2019/06/06/hello-world/, https://example.com/2019/06/06/hello-world-2/ " rows="4" cols="50" id="superpwa_settings_precaching_urls" name="superpwa_caching_strategies_settings[precaching_urls]"><?php if(isset($settings['precaching_urls'])){ echo esc_attr($settings['precaching_urls']);} ?></textarea></label>
400
+ <p><?php echo esc_html__('Note: Seperate the URLs using Comma(,)', 'super-progressive-web-apps'); ?></p>
401
+ <p><?php echo esc_html__('Place the list of URLs which you want to pre cache by service worker', 'super-progressive-web-apps'); ?></p>
402
+ </span>
403
+ </div>
404
+
405
+ </div> <!-- Manual wrap ends here -->
406
+ </div> <!-- Main wrap ends here -->
407
+
408
+
409
+
410
+ <?php
411
+
412
+ }
413
+
414
+ /**
415
+ * Caching Strategies Admin Scripts
416
+ *
417
+ * @since 2.1.17
418
+ */
419
+
420
+ function superpwa_precache_load_admin_scripts($hooks){
421
+ if( !in_array($hooks, array('superpwa_page_superpwa-caching-strategies', 'super-pwa_page_superpwa-caching-strategies')) && strpos($hooks, 'superpwa-caching-strategies') == false ) {
422
+ return false;
423
+ }
424
+
425
+ wp_register_script('superpwa-admin-precache-script',SUPERPWA_PATH_SRC .'/admin/js/pre-cache.js', array('superpwa-main-js'), SUPERPWA_VERSION, true);
426
+
427
+ wp_enqueue_script('superpwa-admin-precache-script');
428
+
429
+ }
430
+ add_action( 'admin_enqueue_scripts', 'superpwa_precache_load_admin_scripts' );
431
+
432
+ /**
433
+ * Caching Strategies UI renderer
434
+ *
435
+ * @since 2.1.7
436
+ */
437
+ function superpwa_caching_strategies_interface_render() {
438
+
439
+ // Authentication
440
+ if ( ! current_user_can( 'manage_options' ) ) {
441
+ return;
442
+ }
443
+
444
+ // Handing save settings
445
+ if ( isset( $_GET['settings-updated'] ) ) {
446
+
447
+ // Add settings saved message with the class of "updated"
448
+ add_settings_error( 'superpwa_settings_group', 'superpwa_caching_strategies_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
449
+
450
+ // Show Settings Saved Message
451
+ settings_errors( 'superpwa_settings_group' );
452
+ }
453
+ // Get add-on info
454
+ $addon_utm_tracking = superpwa_get_addons( 'caching_strategies' );
455
+
456
+ superpwa_setting_tabs_styles();
457
+ ?>
458
+
459
+ <div class="wrap">
460
+ <h1><?php _e( 'Caching Strategies', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
461
+
462
+ <?php superpwa_setting_tabs_html(); ?>
463
+
464
+ <form action="options.php" method="post" class="form-table" enctype="multipart/form-data">
465
+ <?php
466
+ // Output nonce, action, and option_page fields for a settings page.
467
+ settings_fields( 'superpwa_caching_strategies_settings_group' );
468
+
469
+ // Status
470
+ do_settings_sections( 'superpwa_caching_strategies_section' ); // Page slug
471
+
472
+ // Output save settings button
473
+ submit_button( __('Save Settings', 'super-progressive-web-apps') );
474
+ ?>
475
+ </form>
476
+ </div>
477
+ <?php superpwa_newsletter_form(); ?>
478
+ <?php
479
  }
addons/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
addons/pull-to-refresh.php CHANGED
@@ -1,388 +1,388 @@
1
- <?php
2
-
3
- /**
4
- * Pull To Refresh
5
- *
6
- * @since 1.7
7
- *
8
- * @function superpwa_pull_to_refresh_sub_menu() Add sub-menu page for Pull To Refresh
9
- * @function superpwa_pull_to_refresh_get_settings() Get Pull To Refresh settings
10
- * @function superpwa_pull_to_refresh_for_start_url() Add Pull To Refresh to the start_url
11
- * @function superpwa_pull_to_refresh_save_settings_todo() Todo list after saving Pull To Refresh settings
12
- * @function superpwa_pull_to_refresh_deactivate_todo() Deactivation Todo
13
- * @function superpwa_pull_to_refresh_register_settings() Register Pull To Refresh settings
14
- * @function superpwa_pull_to_refresh_validater_sanitizer() Validate and sanitize user input
15
- * @function superpwa_pull_to_refresh_section_cb() Callback function for Pull To Refresh section
16
- * @function superpwa_pull_to_refresh_start_url_cb() Current Start URL
17
- * @function superpwa_pull_to_refresh_enable_cb() Campaign Source
18
- * @function superpwa_pull_to_refresh_pull_message_text_cb() Pull message
19
- * @function superpwa_pull_to_refresh_pull_release_text_cb() Release message
20
- * @function superpwa_pull_to_refresh_refreshing_text_cb() Refreshing message
21
- * @function superpwa_pull_to_refresh_font_size_cb() Font size
22
- * @function superpwa_pull_to_refresh_interface_render() Pull To Refresh UI renderer
23
- */
24
-
25
- // Exit if accessed directly
26
- if (!defined('ABSPATH')) exit;
27
-
28
- /**
29
- * Get Pull To Refresh settings
30
- *
31
- * @since 1.7
32
- */
33
- function superpwa_pull_to_refresh_get_settings()
34
- {
35
-
36
- $defaults = array(
37
- 'superpwa_pull_to_refresh_switch' => '1',
38
- 'superpwa_ptr_text' => 'Pull down to refresh',
39
- 'superpwa_ptr_release_text' => 'Release to refresh',
40
- 'superpwa_ptr_refreshing_text' => 'Refreshing',
41
- 'superpwa_ptr_font_size' => '0.85em',
42
- 'superpwa_ptr_font_color' => 'rgba(0, 0, 0, 0.3)',
43
- );
44
-
45
- return get_option('superpwa_pull_to_refresh_settings', $defaults);
46
- }
47
-
48
-
49
- /**
50
- * Todo list after saving Pull To Refresh settings
51
- *
52
- * Regenerate manifest when settings are saved.
53
- * Also used when add-on is activated and deactivated.
54
- *
55
- * @since 1.7
56
- */
57
- function superpwa_pull_to_refresh_save_settings_todo()
58
- {
59
-
60
- // Regenerate manifest
61
- superpwa_generate_manifest();
62
- }
63
- add_action('add_option_superpwa_pull_to_refresh_settings', 'superpwa_pull_to_refresh_save_settings_todo');
64
- add_action('update_option_superpwa_pull_to_refresh_settings', 'superpwa_pull_to_refresh_save_settings_todo');
65
- add_action('superpwa_addon_activated_pull_to_refresh', 'superpwa_pull_to_refresh_save_settings_todo');
66
-
67
- /**
68
- * Deactivation Todo
69
- *
70
- * Unhook the filter and regenerate manifest
71
- *
72
- * @since 1.7
73
- */
74
- /* function superpwa_pull_to_refresh_deactivate_todo()
75
- {
76
-
77
- // Unhook the Pull To Refresh params filter
78
- remove_filter('superpwa_manifest_start_url', 'superpwa_pull_to_refresh_for_start_url');
79
-
80
- // Regenerate manifest
81
- superpwa_generate_manifest();
82
- }
83
- */ // add_action('superpwa_addon_deactivated_pull_to_refresh', 'superpwa_pull_to_refresh_deactivate_todo');
84
-
85
- /**
86
- * Register Pull To Refresh settings
87
- *
88
- * @since 1.7
89
- */
90
- function superpwa_pull_to_refresh_register_settings()
91
- {
92
-
93
- // Register Setting
94
- register_setting(
95
- 'superpwa_pull_to_refresh_settings_group', // Group name
96
- 'superpwa_pull_to_refresh_settings', // Setting name = html form <input> name on settings form
97
- 'superpwa_pull_to_refresh_validater_sanitizer' // Input validator and sanitizer
98
- );
99
-
100
- // Pull To Refresh
101
- add_settings_section(
102
- 'superpwa_pull_to_refresh_section', // ID
103
- __return_false(), // Title
104
- '', // Callback Function
105
- 'superpwa_pull_to_refresh_section' // Page slug
106
- );
107
-
108
-
109
- // Pull To Refresh
110
- add_settings_field(
111
- 'superpwa_pull_to_refresh_source', // ID
112
- __('Pull To Refresh ', 'super-progressive-web-apps'), // Title
113
- 'superpwa_pull_to_refresh_enable_cb', // CB
114
- 'superpwa_pull_to_refresh_section', // Page slug
115
- 'superpwa_pull_to_refresh_section' // Settings Section ID
116
- );
117
-
118
- // Pull message
119
- add_settings_field(
120
- 'superpwa_pull_to_refresh_pull_message', // ID
121
- __('Pull message', 'super-progressive-web-apps'), // Title
122
- 'superpwa_pull_to_refresh_pull_message_text_cb', // CB
123
- 'superpwa_pull_to_refresh_section', // Page slug
124
- 'superpwa_pull_to_refresh_section' // Settings Section ID
125
- );
126
-
127
- // Release message
128
- add_settings_field(
129
- 'superpwa_pull_to_refresh_release_message', // ID
130
- __('Release message', 'super-progressive-web-apps'), // Title
131
- 'superpwa_pull_to_refresh_pull_release_text_cb', // CB
132
- 'superpwa_pull_to_refresh_section', // Page slug
133
- 'superpwa_pull_to_refresh_section' // Settings Section ID
134
- );
135
-
136
- // Refreshing message
137
- add_settings_field(
138
- 'superpwa_pull_to_refresh_refreshing', // ID
139
- __('Refreshing message', 'super-progressive-web-apps'), // Title
140
- 'superpwa_pull_to_refresh_refreshing_text_cb', // CB
141
- 'superpwa_pull_to_refresh_section', // Page slug
142
- 'superpwa_pull_to_refresh_section' // Settings Section ID
143
- );
144
-
145
- // Font size
146
- add_settings_field(
147
- 'superpwa_pull_to_refresh_font_size', // ID
148
- __('Font size', 'super-progressive-web-apps'), // Title
149
- 'superpwa_pull_to_refresh_font_size_cb', // CB
150
- 'superpwa_pull_to_refresh_section', // Page slug
151
- 'superpwa_pull_to_refresh_section' // Settings Section ID
152
- );
153
-
154
- // Font Color
155
- add_settings_field(
156
- 'superpwa_pull_to_refresh_font_color', // ID
157
- __('Font Color', 'super-progressive-web-apps'), // Title
158
- 'superpwa_pull_to_refresh_font_color_cb', // CB
159
- 'superpwa_pull_to_refresh_section', // Page slug
160
- 'superpwa_pull_to_refresh_section' // Settings Section ID
161
- );
162
- }
163
- add_action('admin_init', 'superpwa_pull_to_refresh_register_settings');
164
-
165
- /**
166
- * Validate and sanitize user input
167
- *
168
- * @since 1.7
169
- */
170
- function superpwa_pull_to_refresh_validater_sanitizer($settings)
171
- {
172
-
173
- // Sanitize and validate campaign source. Campaign source cannot be empty.
174
- $settings['superpwa_pull_to_refresh_switch'] = sanitize_text_field($settings['superpwa_pull_to_refresh_switch']) == '' ? 'Pull down to refresh' : sanitize_text_field($settings['superpwa_pull_to_refresh_switch']);
175
-
176
- // Sanitize Pull message
177
- $settings['superpwa_ptr_text'] = sanitize_text_field($settings['superpwa_ptr_text']) == '' ? '' : sanitize_text_field($settings['superpwa_ptr_text']);
178
-
179
- // Sanitize Release message
180
- $settings['superpwa_ptr_release_text'] = sanitize_text_field($settings['superpwa_ptr_release_text']) == '' ? '' : sanitize_text_field($settings['superpwa_ptr_release_text']);
181
-
182
- // Sanitize Refreshing message
183
- $settings['superpwa_ptr_refreshing_text'] = sanitize_text_field($settings['superpwa_ptr_refreshing_text']);
184
-
185
- // Sanitize Font Size
186
- $settings['superpwa_ptr_font_size'] = sanitize_text_field($settings['superpwa_ptr_font_size']);
187
-
188
- // Sanitize Font Color
189
- $settings['superpwa_ptr_font_color'] = sanitize_text_field($settings['superpwa_ptr_font_color']);
190
-
191
- return $settings;
192
- }
193
-
194
- // /**
195
- // * Callback function for Pull To Refresh section
196
- // *
197
- // * @since 1.7
198
- // */
199
- // function superpwa_pull_to_refresh_section_cb() {
200
-
201
- // // Get add-on info
202
- // $addon_pull_to_refresh = superpwa_get_addons( 'pull_to_refresh' );
203
-
204
- // // printf( '<p>' . __( 'This add-on automatically adds UTM campaign parameters to the <code>Start Page</code> URL in your <a href="%s" target="_blank">manifest</a>. This will help you identify visitors coming specifically from your app. <a href="%s" target="_blank">Read more</a> about Pull To Refresh.', 'super-progressive-web-apps' ) . '</p>', superpwa_manifest( 'src' ), $addon_pull_to_refresh['link'] . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings' );
205
- // }
206
-
207
-
208
- /**
209
- * Campaign Source
210
- *
211
- * @since 1.7
212
- */
213
- function superpwa_pull_to_refresh_enable_cb()
214
- {
215
- // Get Settings
216
- $settings = superpwa_pull_to_refresh_get_settings(); ?>
217
- <fieldset>
218
- <input type="checkbox" name="superpwa_pull_to_refresh_settings[superpwa_pull_to_refresh_switch]" class="regular-text" value="1" <?php if (isset($settings['superpwa_pull_to_refresh_switch'])) { checked('1', $settings['superpwa_pull_to_refresh_switch']); } ?> />
219
- </fieldset>
220
- <?php
221
- }
222
-
223
- /**
224
- * Pull message
225
- *
226
- * @since 1.7
227
- */
228
- function superpwa_pull_to_refresh_pull_message_text_cb()
229
- {
230
- // Get Settings
231
- $settings = superpwa_pull_to_refresh_get_settings(); ?>
232
- <fieldset>
233
- <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_text]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_text']) && (!empty($settings['superpwa_ptr_text']))) echo esc_attr($settings['superpwa_ptr_text']); ?>" />
234
- </fieldset>
235
- <?php
236
- }
237
-
238
- /**
239
- * Release message
240
- *
241
- * @since 1.7
242
- */
243
- function superpwa_pull_to_refresh_pull_release_text_cb()
244
- {
245
- // Get Settings
246
- $settings = superpwa_pull_to_refresh_get_settings(); ?>
247
- <fieldset>
248
- <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_release_text]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_release_text']) && (!empty($settings['superpwa_ptr_release_text']))) echo esc_attr($settings['superpwa_ptr_release_text']); ?>" />
249
- </fieldset>
250
- <?php
251
- }
252
-
253
- /**
254
- * Refreshing message
255
- *
256
- * @since 1.7
257
- */
258
- function superpwa_pull_to_refresh_refreshing_text_cb()
259
- {
260
- // Get Settings
261
- $settings = superpwa_pull_to_refresh_get_settings(); ?>
262
- <fieldset>
263
- <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_refreshing_text]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_refreshing_text']) && (!empty($settings['superpwa_ptr_refreshing_text']))) echo esc_attr($settings['superpwa_ptr_refreshing_text']); ?>" />
264
- </fieldset>
265
- <?php
266
- }
267
-
268
- /**
269
- * Font size
270
- *
271
- * @since 1.7
272
- */
273
- function superpwa_pull_to_refresh_font_size_cb()
274
- {
275
- // Get Settings
276
- $settings = superpwa_pull_to_refresh_get_settings(); ?>
277
- <fieldset>
278
- <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_font_size]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_font_size']) && (!empty($settings['superpwa_ptr_font_size']))) echo esc_attr($settings['superpwa_ptr_font_size']); ?>" />
279
- </fieldset>
280
- <?php
281
- }
282
-
283
- /**
284
- * Font color
285
- *
286
- * @since 1.7
287
- */
288
-
289
- function superpwa_pull_to_refresh_font_color_cb()
290
- {
291
- $settings = superpwa_pull_to_refresh_get_settings();
292
- ?>
293
- <fieldset>
294
- <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_font_color]" class="superpwa-colorpicker" value="<?php if (isset($settings['superpwa_ptr_font_color']) && (!empty($settings['superpwa_ptr_font_color']))) echo esc_attr($settings['superpwa_ptr_font_color']); ?>" />
295
- </fieldset>
296
- <?php
297
- }
298
-
299
-
300
- /**
301
- * Pull To Refresh UI renderer
302
- *
303
- * @since 1.7
304
- */
305
- function superpwa_pull_to_refresh_interface_render()
306
- {
307
- // Authentication
308
- if (!current_user_can('manage_options')) {
309
- return;
310
- }
311
-
312
- // Handing save settings
313
- if (isset($_GET['settings-updated'])) {
314
- // Add settings saved message with the class of "updated"
315
- add_settings_error('superpwa_settings_group', 'superpwa_pull_to_refresh_settings_saved_message', __('Settings saved.', 'super-progressive-web-apps'), 'updated');
316
-
317
- // Show Settings Saved Message
318
- settings_errors('superpwa_settings_group');
319
- }
320
- // Get add-on info
321
- $addon_pull_to_refresh = superpwa_get_addons('pull_to_refresh');
322
- superpwa_setting_tabs_styles();
323
- ?>
324
-
325
- <div class="wrap">
326
- <h1><?php _e('Pull To Refresh', 'super-progressive-web-apps'); ?>
327
- <!-- <small>(<a href="<?php //echo esc_url($addon_pull_to_refresh['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'
328
- ?>"><?php //echo esc_html__( 'Docs', 'super-progressive-web-apps' );
329
- ?></a>)</small> -->
330
- </h1>
331
-
332
- <?php superpwa_setting_tabs_html(); ?>
333
-
334
- <form action="options.php" method="post" enctype="multipart/form-data">
335
- <?php
336
- // Output nonce, action, and option_page fields for a settings page.
337
- settings_fields('superpwa_pull_to_refresh_settings_group');
338
-
339
- // Status
340
- do_settings_sections('superpwa_pull_to_refresh_section'); // Page slug
341
-
342
- // Output save settings button
343
- submit_button(__('Save Settings', 'super-progressive-web-apps'));
344
- ?>
345
- </form>
346
- </div>
347
- <?php //superpwa_newsletter_form();
348
- ?>
349
- <?php
350
- }
351
-
352
-
353
- /* add_action("admin_enqueue_scripts", 'superpwa_pull_to_refresh_script_enqueue');
354
-
355
- function superpwa_pull_to_refresh_script_enqueue($hook){
356
- if($hook== 'toplevel_page_pwaforwp'){
357
- //wp_enqueue_script('pwaforwp-ptr-switches',PWAFORWP_PTRFP_PLUGIN_URL . '/assets/admin-pull-to-refresh.js',array( 'jquery', 'pwaforwp-main-js' ),PWAFORWP_PTRFP_VERSION,true);
358
- // wp_enqueue_script( 'superpwa-make-better-js', SUPERPWA_PATH_SRC . 'admin/make-better-admin.js', array( 'jquery' ), SUPERPWA_VERSION);
359
-
360
- }
361
- }
362
-
363
- */
364
-
365
- if(!function_exists('superpwa_pull_to_refresh_ptrfp_scripts_load')){
366
- function superpwa_pull_to_refresh_ptrfp_scripts_load(){
367
- if(function_exists('superpwa_pull_to_refresh_get_settings')){
368
- $settings = superpwa_pull_to_refresh_get_settings();
369
- }else{ $settings = array(); }
370
- if( isset($settings['superpwa_pull_to_refresh_switch']) && $settings['superpwa_pull_to_refresh_switch'] ==1 ){
371
- wp_enqueue_script( "superpwa_ptrfp_lib_script", SUPERPWA_PATH_SRC."admin/js/superpwa-ptr-lib.min.js", array('jquery'), SUPERPWA_VERSION, true );
372
- $ptrArray = array(
373
- 'instrPullToRefresh'=> ( isset( $settings['superpwa_ptr_text'] )? $settings['superpwa_ptr_text'] : esc_html__("Pull down to refresh", 'pull-to-refresh-for-pwa') ),
374
- 'instrReleaseToRefresh'=> (isset( $settings['superpwa_ptr_release_text'] )? $settings['superpwa_ptr_release_text'] : esc_html__("Release to refresh", 'pull-to-refresh-for-pwa') ),
375
- 'instrRefreshing'=>( isset( $settings['superpwa_ptr_refreshing_text'] )? $settings['superpwa_ptr_refreshing_text'] : esc_html__("Refreshing", 'pull-to-refresh-for-pwa') ),
376
- 'instrptr_font_size'=>( isset( $settings['superpwa_ptr_font_size'] ) && !empty($settings['superpwa_ptr_font_size'])? $settings['superpwa_ptr_font_size'] : "0.85em" ),
377
- 'instrptr_font_color'=>( isset( $settings['superpwa_ptr_font_color'] ) && !empty($settings['superpwa_ptr_font_color'])? $settings['superpwa_ptr_font_color'] : "rgba(0, 0, 0, 0.3)" ),
378
- );
379
- wp_localize_script("superpwa_ptrfp_lib_script", 'superpwa_ptr_obj', $ptrArray);
380
- /*wp_add_inline_script( "pwaforwp_ptrfp_lib_script", '
381
- PullToRefresh.init({
382
- onRefresh: function() { location.reload(true); },
383
- });', 'after' );*/
384
-
385
- }
386
- }
387
- add_action("wp_enqueue_scripts", 'superpwa_pull_to_refresh_ptrfp_scripts_load');
388
  }
1
+ <?php
2
+
3
+ /**
4
+ * Pull To Refresh
5
+ *
6
+ * @since 1.7
7
+ *
8
+ * @function superpwa_pull_to_refresh_sub_menu() Add sub-menu page for Pull To Refresh
9
+ * @function superpwa_pull_to_refresh_get_settings() Get Pull To Refresh settings
10
+ * @function superpwa_pull_to_refresh_for_start_url() Add Pull To Refresh to the start_url
11
+ * @function superpwa_pull_to_refresh_save_settings_todo() Todo list after saving Pull To Refresh settings
12
+ * @function superpwa_pull_to_refresh_deactivate_todo() Deactivation Todo
13
+ * @function superpwa_pull_to_refresh_register_settings() Register Pull To Refresh settings
14
+ * @function superpwa_pull_to_refresh_validater_sanitizer() Validate and sanitize user input
15
+ * @function superpwa_pull_to_refresh_section_cb() Callback function for Pull To Refresh section
16
+ * @function superpwa_pull_to_refresh_start_url_cb() Current Start URL
17
+ * @function superpwa_pull_to_refresh_enable_cb() Campaign Source
18
+ * @function superpwa_pull_to_refresh_pull_message_text_cb() Pull message
19
+ * @function superpwa_pull_to_refresh_pull_release_text_cb() Release message
20
+ * @function superpwa_pull_to_refresh_refreshing_text_cb() Refreshing message
21
+ * @function superpwa_pull_to_refresh_font_size_cb() Font size
22
+ * @function superpwa_pull_to_refresh_interface_render() Pull To Refresh UI renderer
23
+ */
24
+
25
+ // Exit if accessed directly
26
+ if (!defined('ABSPATH')) exit;
27
+
28
+ /**
29
+ * Get Pull To Refresh settings
30
+ *
31
+ * @since 1.7
32
+ */
33
+ function superpwa_pull_to_refresh_get_settings()
34
+ {
35
+
36
+ $defaults = array(
37
+ 'superpwa_pull_to_refresh_switch' => '1',
38
+ 'superpwa_ptr_text' => 'Pull down to refresh',
39
+ 'superpwa_ptr_release_text' => 'Release to refresh',
40
+ 'superpwa_ptr_refreshing_text' => 'Refreshing',
41
+ 'superpwa_ptr_font_size' => '0.85em',
42
+ 'superpwa_ptr_font_color' => 'rgba(0, 0, 0, 0.3)',
43
+ );
44
+
45
+ return get_option('superpwa_pull_to_refresh_settings', $defaults);
46
+ }
47
+
48
+
49
+ /**
50
+ * Todo list after saving Pull To Refresh settings
51
+ *
52
+ * Regenerate manifest when settings are saved.
53
+ * Also used when add-on is activated and deactivated.
54
+ *
55
+ * @since 1.7
56
+ */
57
+ function superpwa_pull_to_refresh_save_settings_todo()
58
+ {
59
+
60
+ // Regenerate manifest
61
+ superpwa_generate_manifest();
62
+ }
63
+ add_action('add_option_superpwa_pull_to_refresh_settings', 'superpwa_pull_to_refresh_save_settings_todo');
64
+ add_action('update_option_superpwa_pull_to_refresh_settings', 'superpwa_pull_to_refresh_save_settings_todo');
65
+ add_action('superpwa_addon_activated_pull_to_refresh', 'superpwa_pull_to_refresh_save_settings_todo');
66
+
67
+ /**
68
+ * Deactivation Todo
69
+ *
70
+ * Unhook the filter and regenerate manifest
71
+ *
72
+ * @since 1.7
73
+ */
74
+ /* function superpwa_pull_to_refresh_deactivate_todo()
75
+ {
76
+
77
+ // Unhook the Pull To Refresh params filter
78
+ remove_filter('superpwa_manifest_start_url', 'superpwa_pull_to_refresh_for_start_url');
79
+
80
+ // Regenerate manifest
81
+ superpwa_generate_manifest();
82
+ }
83
+ */ // add_action('superpwa_addon_deactivated_pull_to_refresh', 'superpwa_pull_to_refresh_deactivate_todo');
84
+
85
+ /**
86
+ * Register Pull To Refresh settings
87
+ *
88
+ * @since 1.7
89
+ */
90
+ function superpwa_pull_to_refresh_register_settings()
91
+ {
92
+
93
+ // Register Setting
94
+ register_setting(
95
+ 'superpwa_pull_to_refresh_settings_group', // Group name
96
+ 'superpwa_pull_to_refresh_settings', // Setting name = html form <input> name on settings form
97
+ 'superpwa_pull_to_refresh_validater_sanitizer' // Input validator and sanitizer
98
+ );
99
+
100
+ // Pull To Refresh
101
+ add_settings_section(
102
+ 'superpwa_pull_to_refresh_section', // ID
103
+ __return_false(), // Title
104
+ '', // Callback Function
105
+ 'superpwa_pull_to_refresh_section' // Page slug
106
+ );
107
+
108
+
109
+ // Pull To Refresh
110
+ add_settings_field(
111
+ 'superpwa_pull_to_refresh_source', // ID
112
+ __('Pull To Refresh ', 'super-progressive-web-apps'), // Title
113
+ 'superpwa_pull_to_refresh_enable_cb', // CB
114
+ 'superpwa_pull_to_refresh_section', // Page slug
115
+ 'superpwa_pull_to_refresh_section' // Settings Section ID
116
+ );
117
+
118
+ // Pull message
119
+ add_settings_field(
120
+ 'superpwa_pull_to_refresh_pull_message', // ID
121
+ __('Pull message', 'super-progressive-web-apps'), // Title
122
+ 'superpwa_pull_to_refresh_pull_message_text_cb', // CB
123
+ 'superpwa_pull_to_refresh_section', // Page slug
124
+ 'superpwa_pull_to_refresh_section' // Settings Section ID
125
+ );
126
+
127
+ // Release message
128
+ add_settings_field(
129
+ 'superpwa_pull_to_refresh_release_message', // ID
130
+ __('Release message', 'super-progressive-web-apps'), // Title
131
+ 'superpwa_pull_to_refresh_pull_release_text_cb', // CB
132
+ 'superpwa_pull_to_refresh_section', // Page slug
133
+ 'superpwa_pull_to_refresh_section' // Settings Section ID
134
+ );
135
+
136
+ // Refreshing message
137
+ add_settings_field(
138
+ 'superpwa_pull_to_refresh_refreshing', // ID
139
+ __('Refreshing message', 'super-progressive-web-apps'), // Title
140
+ 'superpwa_pull_to_refresh_refreshing_text_cb', // CB
141
+ 'superpwa_pull_to_refresh_section', // Page slug
142
+ 'superpwa_pull_to_refresh_section' // Settings Section ID
143
+ );
144
+
145
+ // Font size
146
+ add_settings_field(
147
+ 'superpwa_pull_to_refresh_font_size', // ID
148
+ __('Font size', 'super-progressive-web-apps'), // Title
149
+ 'superpwa_pull_to_refresh_font_size_cb', // CB
150
+ 'superpwa_pull_to_refresh_section', // Page slug
151
+ 'superpwa_pull_to_refresh_section' // Settings Section ID
152
+ );
153
+
154
+ // Font Color
155
+ add_settings_field(
156
+ 'superpwa_pull_to_refresh_font_color', // ID
157
+ __('Font Color', 'super-progressive-web-apps'), // Title
158
+ 'superpwa_pull_to_refresh_font_color_cb', // CB
159
+ 'superpwa_pull_to_refresh_section', // Page slug
160
+ 'superpwa_pull_to_refresh_section' // Settings Section ID
161
+ );
162
+ }
163
+ add_action('admin_init', 'superpwa_pull_to_refresh_register_settings');
164
+
165
+ /**
166
+ * Validate and sanitize user input
167
+ *
168
+ * @since 1.7
169
+ */
170
+ function superpwa_pull_to_refresh_validater_sanitizer($settings)
171
+ {
172
+
173
+ // Sanitize and validate campaign source. Campaign source cannot be empty.
174
+ $settings['superpwa_pull_to_refresh_switch'] = sanitize_text_field($settings['superpwa_pull_to_refresh_switch']) == '' ? 'Pull down to refresh' : sanitize_text_field($settings['superpwa_pull_to_refresh_switch']);
175
+
176
+ // Sanitize Pull message
177
+ $settings['superpwa_ptr_text'] = sanitize_text_field($settings['superpwa_ptr_text']) == '' ? '' : sanitize_text_field($settings['superpwa_ptr_text']);
178
+
179
+ // Sanitize Release message
180
+ $settings['superpwa_ptr_release_text'] = sanitize_text_field($settings['superpwa_ptr_release_text']) == '' ? '' : sanitize_text_field($settings['superpwa_ptr_release_text']);
181
+
182
+ // Sanitize Refreshing message
183
+ $settings['superpwa_ptr_refreshing_text'] = sanitize_text_field($settings['superpwa_ptr_refreshing_text']);
184
+
185
+ // Sanitize Font Size
186
+ $settings['superpwa_ptr_font_size'] = sanitize_text_field($settings['superpwa_ptr_font_size']);
187
+
188
+ // Sanitize Font Color
189
+ $settings['superpwa_ptr_font_color'] = sanitize_text_field($settings['superpwa_ptr_font_color']);
190
+
191
+ return $settings;
192
+ }
193
+
194
+ // /**
195
+ // * Callback function for Pull To Refresh section
196
+ // *
197
+ // * @since 1.7
198
+ // */
199
+ // function superpwa_pull_to_refresh_section_cb() {
200
+
201
+ // // Get add-on info
202
+ // $addon_pull_to_refresh = superpwa_get_addons( 'pull_to_refresh' );
203
+
204
+ // // printf( '<p>' . __( 'This add-on automatically adds UTM campaign parameters to the <code>Start Page</code> URL in your <a href="%s" target="_blank">manifest</a>. This will help you identify visitors coming specifically from your app. <a href="%s" target="_blank">Read more</a> about Pull To Refresh.', 'super-progressive-web-apps' ) . '</p>', superpwa_manifest( 'src' ), $addon_pull_to_refresh['link'] . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings' );
205
+ // }
206
+
207
+
208
+ /**
209
+ * Campaign Source
210
+ *
211
+ * @since 1.7
212
+ */
213
+ function superpwa_pull_to_refresh_enable_cb()
214
+ {
215
+ // Get Settings
216
+ $settings = superpwa_pull_to_refresh_get_settings(); ?>
217
+ <fieldset>
218
+ <input type="checkbox" name="superpwa_pull_to_refresh_settings[superpwa_pull_to_refresh_switch]" class="regular-text" value="1" <?php if (isset($settings['superpwa_pull_to_refresh_switch'])) { checked('1', $settings['superpwa_pull_to_refresh_switch']); } ?> />
219
+ </fieldset>
220
+ <?php
221
+ }
222
+
223
+ /**
224
+ * Pull message
225
+ *
226
+ * @since 1.7
227
+ */
228
+ function superpwa_pull_to_refresh_pull_message_text_cb()
229
+ {
230
+ // Get Settings
231
+ $settings = superpwa_pull_to_refresh_get_settings(); ?>
232
+ <fieldset>
233
+ <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_text]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_text']) && (!empty($settings['superpwa_ptr_text']))) echo esc_attr($settings['superpwa_ptr_text']); ?>" />
234
+ </fieldset>
235
+ <?php
236
+ }
237
+
238
+ /**
239
+ * Release message
240
+ *
241
+ * @since 1.7
242
+ */
243
+ function superpwa_pull_to_refresh_pull_release_text_cb()
244
+ {
245
+ // Get Settings
246
+ $settings = superpwa_pull_to_refresh_get_settings(); ?>
247
+ <fieldset>
248
+ <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_release_text]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_release_text']) && (!empty($settings['superpwa_ptr_release_text']))) echo esc_attr($settings['superpwa_ptr_release_text']); ?>" />
249
+ </fieldset>
250
+ <?php
251
+ }
252
+
253
+ /**
254
+ * Refreshing message
255
+ *
256
+ * @since 1.7
257
+ */
258
+ function superpwa_pull_to_refresh_refreshing_text_cb()
259
+ {
260
+ // Get Settings
261
+ $settings = superpwa_pull_to_refresh_get_settings(); ?>
262
+ <fieldset>
263
+ <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_refreshing_text]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_refreshing_text']) && (!empty($settings['superpwa_ptr_refreshing_text']))) echo esc_attr($settings['superpwa_ptr_refreshing_text']); ?>" />
264
+ </fieldset>
265
+ <?php
266
+ }
267
+
268
+ /**
269
+ * Font size
270
+ *
271
+ * @since 1.7
272
+ */
273
+ function superpwa_pull_to_refresh_font_size_cb()
274
+ {
275
+ // Get Settings
276
+ $settings = superpwa_pull_to_refresh_get_settings(); ?>
277
+ <fieldset>
278
+ <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_font_size]" class="regular-text" value="<?php if (isset($settings['superpwa_ptr_font_size']) && (!empty($settings['superpwa_ptr_font_size']))) echo esc_attr($settings['superpwa_ptr_font_size']); ?>" />
279
+ </fieldset>
280
+ <?php
281
+ }
282
+
283
+ /**
284
+ * Font color
285
+ *
286
+ * @since 1.7
287
+ */
288
+
289
+ function superpwa_pull_to_refresh_font_color_cb()
290
+ {
291
+ $settings = superpwa_pull_to_refresh_get_settings();
292
+ ?>
293
+ <fieldset>
294
+ <input type="text" name="superpwa_pull_to_refresh_settings[superpwa_ptr_font_color]" class="superpwa-colorpicker" value="<?php if (isset($settings['superpwa_ptr_font_color']) && (!empty($settings['superpwa_ptr_font_color']))) echo esc_attr($settings['superpwa_ptr_font_color']); ?>" />
295
+ </fieldset>
296
+ <?php
297
+ }
298
+
299
+
300
+ /**
301
+ * Pull To Refresh UI renderer
302
+ *
303
+ * @since 1.7
304
+ */
305
+ function superpwa_pull_to_refresh_interface_render()
306
+ {
307
+ // Authentication
308
+ if (!current_user_can('manage_options')) {
309
+ return;
310
+ }
311
+
312
+ // Handing save settings
313
+ if (isset($_GET['settings-updated'])) {
314
+ // Add settings saved message with the class of "updated"
315
+ add_settings_error('superpwa_settings_group', 'superpwa_pull_to_refresh_settings_saved_message', __('Settings saved.', 'super-progressive-web-apps'), 'updated');
316
+
317
+ // Show Settings Saved Message
318
+ settings_errors('superpwa_settings_group');
319
+ }
320
+ // Get add-on info
321
+ $addon_pull_to_refresh = superpwa_get_addons('pull_to_refresh');
322
+ superpwa_setting_tabs_styles();
323
+ ?>
324
+
325
+ <div class="wrap">
326
+ <h1><?php _e('Pull To Refresh', 'super-progressive-web-apps'); ?>
327
+ <!-- <small>(<a href="<?php //echo esc_url($addon_pull_to_refresh['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'
328
+ ?>"><?php //echo esc_html__( 'Docs', 'super-progressive-web-apps' );
329
+ ?></a>)</small> -->
330
+ </h1>
331
+
332
+ <?php superpwa_setting_tabs_html(); ?>
333
+
334
+ <form action="options.php" method="post" enctype="multipart/form-data">
335
+ <?php
336
+ // Output nonce, action, and option_page fields for a settings page.
337
+ settings_fields('superpwa_pull_to_refresh_settings_group');
338
+
339
+ // Status
340
+ do_settings_sections('superpwa_pull_to_refresh_section'); // Page slug
341
+
342
+ // Output save settings button
343
+ submit_button(__('Save Settings', 'super-progressive-web-apps'));
344
+ ?>
345
+ </form>
346
+ </div>
347
+ <?php //superpwa_newsletter_form();
348
+ ?>
349
+ <?php
350
+ }
351
+
352
+
353
+ /* add_action("admin_enqueue_scripts", 'superpwa_pull_to_refresh_script_enqueue');
354
+
355
+ function superpwa_pull_to_refresh_script_enqueue($hook){
356
+ if($hook== 'toplevel_page_pwaforwp'){
357
+ //wp_enqueue_script('pwaforwp-ptr-switches',PWAFORWP_PTRFP_PLUGIN_URL . '/assets/admin-pull-to-refresh.js',array( 'jquery', 'pwaforwp-main-js' ),PWAFORWP_PTRFP_VERSION,true);
358
+ // wp_enqueue_script( 'superpwa-make-better-js', SUPERPWA_PATH_SRC . 'admin/make-better-admin.js', array( 'jquery' ), SUPERPWA_VERSION);
359
+
360
+ }
361
+ }
362
+
363
+ */
364
+
365
+ if(!function_exists('superpwa_pull_to_refresh_ptrfp_scripts_load')){
366
+ function superpwa_pull_to_refresh_ptrfp_scripts_load(){
367
+ if(function_exists('superpwa_pull_to_refresh_get_settings')){
368
+ $settings = superpwa_pull_to_refresh_get_settings();
369
+ }else{ $settings = array(); }
370
+ if( isset($settings['superpwa_pull_to_refresh_switch']) && $settings['superpwa_pull_to_refresh_switch'] ==1 ){
371
+ wp_enqueue_script( "superpwa_ptrfp_lib_script", SUPERPWA_PATH_SRC."admin/js/superpwa-ptr-lib.min.js", array('jquery'), SUPERPWA_VERSION, true );
372
+ $ptrArray = array(
373
+ 'instrPullToRefresh'=> ( isset( $settings['superpwa_ptr_text'] )? $settings['superpwa_ptr_text'] : esc_html__("Pull down to refresh", 'pull-to-refresh-for-pwa') ),
374
+ 'instrReleaseToRefresh'=> (isset( $settings['superpwa_ptr_release_text'] )? $settings['superpwa_ptr_release_text'] : esc_html__("Release to refresh", 'pull-to-refresh-for-pwa') ),
375
+ 'instrRefreshing'=>( isset( $settings['superpwa_ptr_refreshing_text'] )? $settings['superpwa_ptr_refreshing_text'] : esc_html__("Refreshing", 'pull-to-refresh-for-pwa') ),
376
+ 'instrptr_font_size'=>( isset( $settings['superpwa_ptr_font_size'] ) && !empty($settings['superpwa_ptr_font_size'])? $settings['superpwa_ptr_font_size'] : "0.85em" ),
377
+ 'instrptr_font_color'=>( isset( $settings['superpwa_ptr_font_color'] ) && !empty($settings['superpwa_ptr_font_color'])? $settings['superpwa_ptr_font_color'] : "rgba(0, 0, 0, 0.3)" ),
378
+ );
379
+ wp_localize_script("superpwa_ptrfp_lib_script", 'superpwa_ptr_obj', $ptrArray);
380
+ /*wp_add_inline_script( "pwaforwp_ptrfp_lib_script", '
381
+ PullToRefresh.init({
382
+ onRefresh: function() { location.reload(true); },
383
+ });', 'after' );*/
384
+
385
+ }
386
+ }
387
+ add_action("wp_enqueue_scripts", 'superpwa_pull_to_refresh_ptrfp_scripts_load');
388
  }
addons/utm-tracking.php CHANGED
@@ -1,391 +1,391 @@
1
- <?php
2
- /**
3
- * UTM Tracking
4
- *
5
- * @since 1.7
6
- *
7
- * @function superpwa_utm_tracking_sub_menu() Add sub-menu page for UTM Tracking
8
- * @function superpwa_utm_tracking_get_settings() Get UTM Tracking settings
9
- * @function superpwa_utm_tracking_for_start_url() Add UTM Tracking to the start_url
10
- * @function superpwa_utm_tracking_save_settings_todo() Todo list after saving UTM Tracking settings
11
- * @function superpwa_utm_tracking_deactivate_todo() Deactivation Todo
12
- * @function superpwa_utm_tracking_register_settings() Register UTM Tracking settings
13
- * @function superpwa_utm_tracking_validater_sanitizer() Validate and sanitize user input
14
- * @function superpwa_utm_tracking_section_cb() Callback function for UTM Tracking section
15
- * @function superpwa_utm_tracking_start_url_cb() Current Start URL
16
- * @function superpwa_utm_tracking_source_cb() Campaign Source
17
- * @function superpwa_utm_tracking_medium_cb() Campaign Medium
18
- * @function superpwa_utm_tracking_name_cb() Campaign Name
19
- * @function superpwa_utm_tracking_term_cb() Campaign Term
20
- * @function superpwa_utm_tracking_content_cb() Campaign Content
21
- * @function superpwa_utm_tracking_interface_render() UTM Tracking UI renderer
22
- */
23
-
24
- // Exit if accessed directly
25
- if ( ! defined( 'ABSPATH' ) ) exit;
26
-
27
- /**
28
- * Get UTM Tracking settings
29
- *
30
- * @since 1.7
31
- */
32
- function superpwa_utm_tracking_get_settings() {
33
-
34
- $defaults = array(
35
- 'utm_source' => 'superpwa',
36
- 'utm_medium' => 'superpwa',
37
- 'utm_campaign' => 'superpwa',
38
- );
39
-
40
- return get_option( 'superpwa_utm_tracking_settings', $defaults );
41
- }
42
-
43
- /**
44
- * Add UTM Tracking to the start_url
45
- *
46
- * Hooks onto the superpwa_manifest_start_url filter to add the
47
- * UTM tracking parameters to the start_url
48
- *
49
- * Example: https://superpwa.com/?utm_source=superpwa&utm_medium=medium&utm_campaign=name&utm_term=terms&utm_content=content
50
- *
51
- * @param $start_url (string) the start_url for manifest from superpwa_get_start_url()
52
- * @return (string) Filtered start_url with UTM tracking added
53
- *
54
- * @since 1.7
55
- */
56
- function superpwa_utm_tracking_for_start_url( $start_url ) {
57
-
58
- // Get UTM Tracking settings
59
- $utm_params = superpwa_utm_tracking_get_settings();
60
-
61
- // Add the initial '/?'
62
- $start_url = trailingslashit( $start_url ) . '?';
63
-
64
- // Build the URL
65
- foreach ( $utm_params as $param => $value ) {
66
-
67
- if ( ! empty( $value ) ) {
68
- $start_url = $start_url . $param . '=' . rawurlencode( $value ) . '&';
69
- }
70
- }
71
-
72
- // Remove trailing '&'
73
- return rtrim( $start_url, '&' );
74
- }
75
- add_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
76
-
77
- /**
78
- * Todo list after saving UTM Tracking settings
79
- *
80
- * Regenerate manifest when settings are saved.
81
- * Also used when add-on is activated and deactivated.
82
- *
83
- * @since 1.7
84
- */
85
- function superpwa_utm_tracking_save_settings_todo() {
86
-
87
- // Regenerate manifest
88
- superpwa_generate_manifest();
89
- }
90
- add_action( 'add_option_superpwa_utm_tracking_settings', 'superpwa_utm_tracking_save_settings_todo' );
91
- add_action( 'update_option_superpwa_utm_tracking_settings', 'superpwa_utm_tracking_save_settings_todo' );
92
- add_action( 'superpwa_addon_activated_utm_tracking', 'superpwa_utm_tracking_save_settings_todo' );
93
-
94
- /**
95
- * Deactivation Todo
96
- *
97
- * Unhook the filter and regenerate manifest
98
- *
99
- * @since 1.7
100
- */
101
- function superpwa_utm_tracking_deactivate_todo() {
102
-
103
- // Unhook the UTM tracking params filter
104
- remove_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
105
-
106
- // Regenerate manifest
107
- superpwa_generate_manifest();
108
- }
109
- add_action( 'superpwa_addon_deactivated_utm_tracking', 'superpwa_utm_tracking_deactivate_todo' );
110
-
111
- /**
112
- * Register UTM Tracking settings
113
- *
114
- * @since 1.7
115
- */
116
- function superpwa_utm_tracking_register_settings() {
117
-
118
- // Register Setting
119
- register_setting(
120
- 'superpwa_utm_tracking_settings_group', // Group name
121
- 'superpwa_utm_tracking_settings', // Setting name = html form <input> name on settings form
122
- 'superpwa_utm_tracking_validater_sanitizer' // Input validator and sanitizer
123
- );
124
-
125
- // UTM Tracking
126
- add_settings_section(
127
- 'superpwa_utm_tracking_section', // ID
128
- __return_false(), // Title
129
- 'superpwa_utm_tracking_section_cb', // Callback Function
130
- 'superpwa_utm_tracking_section' // Page slug
131
- );
132
-
133
- // Current Start URL
134
- add_settings_field(
135
- 'superpwa_utm_tracking_start_url', // ID
136
- __('Current Start URL', 'super-progressive-web-apps'), // Title
137
- 'superpwa_utm_tracking_start_url_cb', // CB
138
- 'superpwa_utm_tracking_section', // Page slug
139
- 'superpwa_utm_tracking_section' // Settings Section ID
140
- );
141
-
142
- // Campaign Source
143
- add_settings_field(
144
- 'superpwa_utm_tracking_source', // ID
145
- __('Campaign Source', 'super-progressive-web-apps'), // Title
146
- 'superpwa_utm_tracking_source_cb', // CB
147
- 'superpwa_utm_tracking_section', // Page slug
148
- 'superpwa_utm_tracking_section' // Settings Section ID
149
- );
150
-
151
- // Campaign Medium
152
- add_settings_field(
153
- 'superpwa_utm_tracking_medium', // ID
154
- __('Campaign Medium', 'super-progressive-web-apps'), // Title
155
- 'superpwa_utm_tracking_medium_cb', // CB
156
- 'superpwa_utm_tracking_section', // Page slug
157
- 'superpwa_utm_tracking_section' // Settings Section ID
158
- );
159
-
160
- // Campaign Name
161
- add_settings_field(
162
- 'superpwa_utm_tracking_name', // ID
163
- __('Campaign Name', 'super-progressive-web-apps'), // Title
164
- 'superpwa_utm_tracking_name_cb', // CB
165
- 'superpwa_utm_tracking_section', // Page slug
166
- 'superpwa_utm_tracking_section' // Settings Section ID
167
- );
168
-
169
- // Campaign Term
170
- add_settings_field(
171
- 'superpwa_utm_tracking_term', // ID
172
- __('Campaign Term', 'super-progressive-web-apps'), // Title
173
- 'superpwa_utm_tracking_term_cb', // CB
174
- 'superpwa_utm_tracking_section', // Page slug
175
- 'superpwa_utm_tracking_section' // Settings Section ID
176
- );
177
-
178
- // Campaign Content
179
- add_settings_field(
180
- 'superpwa_utm_tracking_content', // ID
181
- __('Campaign Content', 'super-progressive-web-apps'), // Title
182
- 'superpwa_utm_tracking_content_cb', // CB
183
- 'superpwa_utm_tracking_section', // Page slug
184
- 'superpwa_utm_tracking_section' // Settings Section ID
185
- );
186
- }
187
- add_action( 'admin_init', 'superpwa_utm_tracking_register_settings' );
188
-
189
- /**
190
- * Validate and sanitize user input
191
- *
192
- * @since 1.7
193
- */
194
- function superpwa_utm_tracking_validater_sanitizer( $settings ) {
195
-
196
- // Sanitize and validate campaign source. Campaign source cannot be empty.
197
- $settings['utm_source'] = sanitize_text_field( $settings['utm_source'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_source'] );
198
-
199
- // Sanitize campaign medium
200
- $settings['utm_medium'] = sanitize_text_field( $settings['utm_medium'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_medium'] );
201
-
202
- // Sanitize campaign name
203
- $settings['utm_campaign'] = sanitize_text_field( $settings['utm_campaign'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_campaign'] );
204
-
205
- // Sanitize campaign term
206
- $settings['utm_term'] = sanitize_text_field( $settings['utm_term'] );
207
-
208
- // Sanitize campaign medium
209
- $settings['utm_content'] = sanitize_text_field( $settings['utm_content'] );
210
-
211
- return $settings;
212
- }
213
-
214
- /**
215
- * Callback function for UTM Tracking section
216
- *
217
- * @since 1.7
218
- */
219
- function superpwa_utm_tracking_section_cb() {
220
-
221
- // Get add-on info
222
- $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
223
-
224
- printf( '<p>' . __( 'This add-on automatically adds UTM campaign parameters to the <code>Start Page</code> URL in your <a href="%s" target="_blank">manifest</a>. This will help you identify visitors coming specifically from your app. <a href="%s" target="_blank">Read more</a> about UTM Tracking.', 'super-progressive-web-apps' ) . '</p>', superpwa_manifest( 'src' ), $addon_utm_tracking['link'] . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings' );
225
- }
226
-
227
- /**
228
- * Current Start URL
229
- *
230
- * @since 1.7
231
- */
232
- function superpwa_utm_tracking_start_url_cb() {
233
-
234
- echo '<code style="word-break: break-all;">' . superpwa_get_start_url( true ) . '</code>';
235
- }
236
-
237
- /**
238
- * Campaign Source
239
- *
240
- * @since 1.7
241
- */
242
- function superpwa_utm_tracking_source_cb() {
243
-
244
- // Get Settings
245
- $settings = superpwa_utm_tracking_get_settings(); ?>
246
-
247
- <fieldset>
248
-
249
- <input type="text" name="superpwa_utm_tracking_settings[utm_source]" class="regular-text" value="<?php if ( isset( $settings['utm_source'] ) && ( ! empty($settings['utm_source']) ) ) echo esc_attr( $settings['utm_source'] ); ?>"/>
250
-
251
- </fieldset>
252
-
253
- <p class="description">
254
- <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
255
- </p>
256
-
257
- <?php
258
- }
259
-
260
- /**
261
- * Campaign Medium
262
- *
263
- * @since 1.7
264
- */
265
- function superpwa_utm_tracking_medium_cb() {
266
-
267
- // Get Settings
268
- $settings = superpwa_utm_tracking_get_settings(); ?>
269
-
270
- <fieldset>
271
-
272
- <input type="text" name="superpwa_utm_tracking_settings[utm_medium]" class="regular-text" value="<?php if ( isset( $settings['utm_medium'] ) && ( ! empty($settings['utm_medium']) ) ) echo esc_attr( $settings['utm_medium'] ); ?>"/>
273
-
274
- </fieldset>
275
-
276
- <p class="description">
277
- <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
278
- </p>
279
-
280
- <?php
281
- }
282
-
283
- /**
284
- * Campaign Name
285
- *
286
- * @since 1.7
287
- */
288
- function superpwa_utm_tracking_name_cb() {
289
-
290
- // Get Settings
291
- $settings = superpwa_utm_tracking_get_settings(); ?>
292
-
293
- <fieldset>
294
-
295
- <input type="text" name="superpwa_utm_tracking_settings[utm_campaign]" class="regular-text" value="<?php if ( isset( $settings['utm_campaign'] ) && ( ! empty($settings['utm_campaign']) ) ) echo esc_attr( $settings['utm_campaign'] ); ?>"/>
296
-
297
- </fieldset>
298
-
299
- <p class="description">
300
- <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
301
- </p>
302
-
303
- <?php
304
- }
305
-
306
- /**
307
- * Campaign Term
308
- *
309
- * @since 1.7
310
- */
311
- function superpwa_utm_tracking_term_cb() {
312
-
313
- // Get Settings
314
- $settings = superpwa_utm_tracking_get_settings(); ?>
315
-
316
- <fieldset>
317
-
318
- <input type="text" name="superpwa_utm_tracking_settings[utm_term]" placeholder="Optional" class="regular-text" value="<?php if ( isset( $settings['utm_term'] ) && ( ! empty($settings['utm_term']) ) ) echo esc_attr( $settings['utm_term'] ); ?>"/>
319
-
320
- </fieldset>
321
-
322
- <?php
323
- }
324
-
325
- /**
326
- * Campaign Content
327
- *
328
- * @since 1.7
329
- */
330
- function superpwa_utm_tracking_content_cb() {
331
-
332
- // Get Settings
333
- $settings = superpwa_utm_tracking_get_settings(); ?>
334
-
335
- <fieldset>
336
-
337
- <input type="text" name="superpwa_utm_tracking_settings[utm_content]" placeholder="Optional" class="regular-text" value="<?php if ( isset( $settings['utm_content'] ) && ( ! empty($settings['utm_content']) ) ) echo esc_attr( $settings['utm_content'] ); ?>"/>
338
-
339
- </fieldset>
340
-
341
- <?php
342
- }
343
-
344
- /**
345
- * UTM Tracking UI renderer
346
- *
347
- * @since 1.7
348
- */
349
- function superpwa_utm_tracking_interface_render() {
350
-
351
- // Authentication
352
- if ( ! current_user_can( 'manage_options' ) ) {
353
- return;
354
- }
355
-
356
- // Handing save settings
357
- if ( isset( $_GET['settings-updated'] ) ) {
358
-
359
- // Add settings saved message with the class of "updated"
360
- add_settings_error( 'superpwa_settings_group', 'superpwa_utm_tracking_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
361
-
362
- // Show Settings Saved Message
363
- settings_errors( 'superpwa_settings_group' );
364
- }
365
- // Get add-on info
366
- $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
367
-
368
- superpwa_setting_tabs_styles();
369
- ?>
370
-
371
- <div class="wrap">
372
- <h1><?php _e( 'UTM Tracking', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
373
-
374
- <?php superpwa_setting_tabs_html(); ?>
375
-
376
- <form action="options.php" method="post" enctype="multipart/form-data">
377
- <?php
378
- // Output nonce, action, and option_page fields for a settings page.
379
- settings_fields( 'superpwa_utm_tracking_settings_group' );
380
-
381
- // Status
382
- do_settings_sections( 'superpwa_utm_tracking_section' ); // Page slug
383
-
384
- // Output save settings button
385
- submit_button( __('Save Settings', 'super-progressive-web-apps') );
386
- ?>
387
- </form>
388
- </div>
389
- <?php superpwa_newsletter_form(); ?>
390
- <?php
391
  }
1
+ <?php
2
+ /**
3
+ * UTM Tracking
4
+ *
5
+ * @since 1.7
6
+ *
7
+ * @function superpwa_utm_tracking_sub_menu() Add sub-menu page for UTM Tracking
8
+ * @function superpwa_utm_tracking_get_settings() Get UTM Tracking settings
9
+ * @function superpwa_utm_tracking_for_start_url() Add UTM Tracking to the start_url
10
+ * @function superpwa_utm_tracking_save_settings_todo() Todo list after saving UTM Tracking settings
11
+ * @function superpwa_utm_tracking_deactivate_todo() Deactivation Todo
12
+ * @function superpwa_utm_tracking_register_settings() Register UTM Tracking settings
13
+ * @function superpwa_utm_tracking_validater_sanitizer() Validate and sanitize user input
14
+ * @function superpwa_utm_tracking_section_cb() Callback function for UTM Tracking section
15
+ * @function superpwa_utm_tracking_start_url_cb() Current Start URL
16
+ * @function superpwa_utm_tracking_source_cb() Campaign Source
17
+ * @function superpwa_utm_tracking_medium_cb() Campaign Medium
18
+ * @function superpwa_utm_tracking_name_cb() Campaign Name
19
+ * @function superpwa_utm_tracking_term_cb() Campaign Term
20
+ * @function superpwa_utm_tracking_content_cb() Campaign Content
21
+ * @function superpwa_utm_tracking_interface_render() UTM Tracking UI renderer
22
+ */
23
+
24
+ // Exit if accessed directly
25
+ if ( ! defined( 'ABSPATH' ) ) exit;
26
+
27
+ /**
28
+ * Get UTM Tracking settings
29
+ *
30
+ * @since 1.7
31
+ */
32
+ function superpwa_utm_tracking_get_settings() {
33
+
34
+ $defaults = array(
35
+ 'utm_source' => 'superpwa',
36
+ 'utm_medium' => 'superpwa',
37
+ 'utm_campaign' => 'superpwa',
38
+ );
39
+
40
+ return get_option( 'superpwa_utm_tracking_settings', $defaults );
41
+ }
42
+
43
+ /**
44
+ * Add UTM Tracking to the start_url
45
+ *
46
+ * Hooks onto the superpwa_manifest_start_url filter to add the
47
+ * UTM tracking parameters to the start_url
48
+ *
49
+ * Example: https://superpwa.com/?utm_source=superpwa&utm_medium=medium&utm_campaign=name&utm_term=terms&utm_content=content
50
+ *
51
+ * @param $start_url (string) the start_url for manifest from superpwa_get_start_url()
52
+ * @return (string) Filtered start_url with UTM tracking added
53
+ *
54
+ * @since 1.7
55
+ */
56
+ function superpwa_utm_tracking_for_start_url( $start_url ) {
57
+
58
+ // Get UTM Tracking settings
59
+ $utm_params = superpwa_utm_tracking_get_settings();
60
+
61
+ // Add the initial '/?'
62
+ $start_url = trailingslashit( $start_url ) . '?';
63
+
64
+ // Build the URL
65
+ foreach ( $utm_params as $param => $value ) {
66
+
67
+ if ( ! empty( $value ) ) {
68
+ $start_url = $start_url . $param . '=' . rawurlencode( $value ) . '&';
69
+ }
70
+ }
71
+
72
+ // Remove trailing '&'
73
+ return rtrim( $start_url, '&' );
74
+ }
75
+ add_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
76
+
77
+ /**
78
+ * Todo list after saving UTM Tracking settings
79
+ *
80
+ * Regenerate manifest when settings are saved.
81
+ * Also used when add-on is activated and deactivated.
82
+ *
83
+ * @since 1.7
84
+ */
85
+ function superpwa_utm_tracking_save_settings_todo() {
86
+
87
+ // Regenerate manifest
88
+ superpwa_generate_manifest();
89
+ }
90
+ add_action( 'add_option_superpwa_utm_tracking_settings', 'superpwa_utm_tracking_save_settings_todo' );
91
+ add_action( 'update_option_superpwa_utm_tracking_settings', 'superpwa_utm_tracking_save_settings_todo' );
92
+ add_action( 'superpwa_addon_activated_utm_tracking', 'superpwa_utm_tracking_save_settings_todo' );
93
+
94
+ /**
95
+ * Deactivation Todo
96
+ *
97
+ * Unhook the filter and regenerate manifest
98
+ *
99
+ * @since 1.7
100
+ */
101
+ function superpwa_utm_tracking_deactivate_todo() {
102
+
103
+ // Unhook the UTM tracking params filter
104
+ remove_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
105
+
106
+ // Regenerate manifest
107
+ superpwa_generate_manifest();
108
+ }
109
+ add_action( 'superpwa_addon_deactivated_utm_tracking', 'superpwa_utm_tracking_deactivate_todo' );
110
+
111
+ /**
112
+ * Register UTM Tracking settings
113
+ *
114
+ * @since 1.7
115
+ */
116
+ function superpwa_utm_tracking_register_settings() {
117
+
118
+ // Register Setting
119
+ register_setting(
120
+ 'superpwa_utm_tracking_settings_group', // Group name
121
+ 'superpwa_utm_tracking_settings', // Setting name = html form <input> name on settings form
122
+ 'superpwa_utm_tracking_validater_sanitizer' // Input validator and sanitizer
123
+ );
124
+
125
+ // UTM Tracking
126
+ add_settings_section(
127
+ 'superpwa_utm_tracking_section', // ID
128
+ __return_false(), // Title
129
+ 'superpwa_utm_tracking_section_cb', // Callback Function
130
+ 'superpwa_utm_tracking_section' // Page slug
131
+ );
132
+
133
+ // Current Start URL
134
+ add_settings_field(
135
+ 'superpwa_utm_tracking_start_url', // ID
136
+ __('Current Start URL', 'super-progressive-web-apps'), // Title
137
+ 'superpwa_utm_tracking_start_url_cb', // CB
138
+ 'superpwa_utm_tracking_section', // Page slug
139
+ 'superpwa_utm_tracking_section' // Settings Section ID
140
+ );
141
+
142
+ // Campaign Source
143
+ add_settings_field(
144
+ 'superpwa_utm_tracking_source', // ID
145
+ __('Campaign Source', 'super-progressive-web-apps'), // Title
146
+ 'superpwa_utm_tracking_source_cb', // CB
147
+ 'superpwa_utm_tracking_section', // Page slug
148
+ 'superpwa_utm_tracking_section' // Settings Section ID
149
+ );
150
+
151
+ // Campaign Medium
152
+ add_settings_field(
153
+ 'superpwa_utm_tracking_medium', // ID
154
+ __('Campaign Medium', 'super-progressive-web-apps'), // Title
155
+ 'superpwa_utm_tracking_medium_cb', // CB
156
+ 'superpwa_utm_tracking_section', // Page slug
157
+ 'superpwa_utm_tracking_section' // Settings Section ID
158
+ );
159
+
160
+ // Campaign Name
161
+ add_settings_field(
162
+ 'superpwa_utm_tracking_name', // ID
163
+ __('Campaign Name', 'super-progressive-web-apps'), // Title
164
+ 'superpwa_utm_tracking_name_cb', // CB
165
+ 'superpwa_utm_tracking_section', // Page slug
166
+ 'superpwa_utm_tracking_section' // Settings Section ID
167
+ );
168
+
169
+ // Campaign Term
170
+ add_settings_field(
171
+ 'superpwa_utm_tracking_term', // ID
172
+ __('Campaign Term', 'super-progressive-web-apps'), // Title
173
+ 'superpwa_utm_tracking_term_cb', // CB
174
+ 'superpwa_utm_tracking_section', // Page slug
175
+ 'superpwa_utm_tracking_section' // Settings Section ID
176
+ );
177
+
178
+ // Campaign Content
179
+ add_settings_field(
180
+ 'superpwa_utm_tracking_content', // ID
181
+ __('Campaign Content', 'super-progressive-web-apps'), // Title
182
+ 'superpwa_utm_tracking_content_cb', // CB
183
+ 'superpwa_utm_tracking_section', // Page slug
184
+ 'superpwa_utm_tracking_section' // Settings Section ID
185
+ );
186
+ }
187
+ add_action( 'admin_init', 'superpwa_utm_tracking_register_settings' );
188
+
189
+ /**
190
+ * Validate and sanitize user input
191
+ *
192
+ * @since 1.7
193
+ */
194
+ function superpwa_utm_tracking_validater_sanitizer( $settings ) {
195
+
196
+ // Sanitize and validate campaign source. Campaign source cannot be empty.
197
+ $settings['utm_source'] = sanitize_text_field( $settings['utm_source'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_source'] );
198
+
199
+ // Sanitize campaign medium
200
+ $settings['utm_medium'] = sanitize_text_field( $settings['utm_medium'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_medium'] );
201
+
202
+ // Sanitize campaign name
203
+ $settings['utm_campaign'] = sanitize_text_field( $settings['utm_campaign'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_campaign'] );
204
+
205
+ // Sanitize campaign term
206
+ $settings['utm_term'] = sanitize_text_field( $settings['utm_term'] );
207
+
208
+ // Sanitize campaign medium
209
+ $settings['utm_content'] = sanitize_text_field( $settings['utm_content'] );
210
+
211
+ return $settings;
212
+ }
213
+
214
+ /**
215
+ * Callback function for UTM Tracking section
216
+ *
217
+ * @since 1.7
218
+ */
219
+ function superpwa_utm_tracking_section_cb() {
220
+
221
+ // Get add-on info
222
+ $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
223
+
224
+ printf( '<p>' . __( 'This add-on automatically adds UTM campaign parameters to the <code>Start Page</code> URL in your <a href="%s" target="_blank">manifest</a>. This will help you identify visitors coming specifically from your app. <a href="%s" target="_blank">Read more</a> about UTM Tracking.', 'super-progressive-web-apps' ) . '</p>', superpwa_manifest( 'src' ), $addon_utm_tracking['link'] . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings' );
225
+ }
226
+
227
+ /**
228
+ * Current Start URL
229
+ *
230
+ * @since 1.7
231
+ */
232
+ function superpwa_utm_tracking_start_url_cb() {
233
+
234
+ echo '<code style="word-break: break-all;">' . superpwa_get_start_url( true ) . '</code>';
235
+ }
236
+
237
+ /**
238
+ * Campaign Source
239
+ *
240
+ * @since 1.7
241
+ */
242
+ function superpwa_utm_tracking_source_cb() {
243
+
244
+ // Get Settings
245
+ $settings = superpwa_utm_tracking_get_settings(); ?>
246
+
247
+ <fieldset>
248
+
249
+ <input type="text" name="superpwa_utm_tracking_settings[utm_source]" class="regular-text" value="<?php if ( isset( $settings['utm_source'] ) && ( ! empty($settings['utm_source']) ) ) echo esc_attr( $settings['utm_source'] ); ?>"/>
250
+
251
+ </fieldset>
252
+
253
+ <p class="description">
254
+ <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
255
+ </p>
256
+
257
+ <?php
258
+ }
259
+
260
+ /**
261
+ * Campaign Medium
262
+ *
263
+ * @since 1.7
264
+ */
265
+ function superpwa_utm_tracking_medium_cb() {
266
+
267
+ // Get Settings
268
+ $settings = superpwa_utm_tracking_get_settings(); ?>
269
+
270
+ <fieldset>
271
+
272
+ <input type="text" name="superpwa_utm_tracking_settings[utm_medium]" class="regular-text" value="<?php if ( isset( $settings['utm_medium'] ) && ( ! empty($settings['utm_medium']) ) ) echo esc_attr( $settings['utm_medium'] ); ?>"/>
273
+
274
+ </fieldset>
275
+
276
+ <p class="description">
277
+ <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
278
+ </p>
279
+
280
+ <?php
281
+ }
282
+
283
+ /**
284
+ * Campaign Name
285
+ *
286
+ * @since 1.7
287
+ */
288
+ function superpwa_utm_tracking_name_cb() {
289
+
290
+ // Get Settings
291
+ $settings = superpwa_utm_tracking_get_settings(); ?>
292
+
293
+ <fieldset>
294
+
295
+ <input type="text" name="superpwa_utm_tracking_settings[utm_campaign]" class="regular-text" value="<?php if ( isset( $settings['utm_campaign'] ) && ( ! empty($settings['utm_campaign']) ) ) echo esc_attr( $settings['utm_campaign'] ); ?>"/>
296
+
297
+ </fieldset>
298
+
299
+ <p class="description">
300
+ <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
301
+ </p>
302
+
303
+ <?php
304
+ }
305
+
306
+ /**
307
+ * Campaign Term
308
+ *
309
+ * @since 1.7
310
+ */
311
+ function superpwa_utm_tracking_term_cb() {
312
+
313
+ // Get Settings
314
+ $settings = superpwa_utm_tracking_get_settings(); ?>
315
+
316
+ <fieldset>
317
+
318
+ <input type="text" name="superpwa_utm_tracking_settings[utm_term]" placeholder="Optional" class="regular-text" value="<?php if ( isset( $settings['utm_term'] ) && ( ! empty($settings['utm_term']) ) ) echo esc_attr( $settings['utm_term'] ); ?>"/>
319
+
320
+ </fieldset>
321
+
322
+ <?php
323
+ }
324
+
325
+ /**
326
+ * Campaign Content
327
+ *
328
+ * @since 1.7
329
+ */
330
+ function superpwa_utm_tracking_content_cb() {
331
+
332
+ // Get Settings
333
+ $settings = superpwa_utm_tracking_get_settings(); ?>
334
+
335
+ <fieldset>
336
+
337
+ <input type="text" name="superpwa_utm_tracking_settings[utm_content]" placeholder="Optional" class="regular-text" value="<?php if ( isset( $settings['utm_content'] ) && ( ! empty($settings['utm_content']) ) ) echo esc_attr( $settings['utm_content'] ); ?>"/>
338
+
339
+ </fieldset>
340
+
341
+ <?php
342
+ }
343
+
344
+ /**
345
+ * UTM Tracking UI renderer
346
+ *
347
+ * @since 1.7
348
+ */
349
+ function superpwa_utm_tracking_interface_render() {
350
+
351
+ // Authentication
352
+ if ( ! current_user_can( 'manage_options' ) ) {
353
+ return;
354
+ }
355
+
356
+ // Handing save settings
357
+ if ( isset( $_GET['settings-updated'] ) ) {
358
+
359
+ // Add settings saved message with the class of "updated"
360
+ add_settings_error( 'superpwa_settings_group', 'superpwa_utm_tracking_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
361
+
362
+ // Show Settings Saved Message
363
+ settings_errors( 'superpwa_settings_group' );
364
+ }
365
+ // Get add-on info
366
+ $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
367
+
368
+ superpwa_setting_tabs_styles();
369
+ ?>
370
+
371
+ <div class="wrap">
372
+ <h1><?php _e( 'UTM Tracking', 'super-progressive-web-apps' ); ?> <small>(<a href="<?php echo esc_url($addon_utm_tracking['link']) . '?utm_source=superpwa-plugin&utm_medium=utm-tracking-settings'?>"><?php echo esc_html__( 'Docs', 'super-progressive-web-apps' ); ?></a>)</small></h1>
373
+
374
+ <?php superpwa_setting_tabs_html(); ?>
375
+
376
+ <form action="options.php" method="post" enctype="multipart/form-data">
377
+ <?php
378
+ // Output nonce, action, and option_page fields for a settings page.
379
+ settings_fields( 'superpwa_utm_tracking_settings_group' );
380
+
381
+ // Status
382
+ do_settings_sections( 'superpwa_utm_tracking_section' ); // Page slug
383
+
384
+ // Output save settings button
385
+ submit_button( __('Save Settings', 'super-progressive-web-apps') );
386
+ ?>
387
+ </form>
388
+ </div>
389
+ <?php superpwa_newsletter_form(); ?>
390
+ <?php
391
  }
admin/admin-ui-render-addons.php CHANGED
@@ -1,626 +1,641 @@
1
- <?php
2
- /**
3
- * Add-Ons Settings UI
4
- *
5
- * @since 1.7
6
- *
7
- * @function superpwa_get_addons() Add-ons of SuperPWA
8
- * @function superpwa_addons_interface_render() Add-Ons UI renderer
9
- * @function superpwa_addons_status() Find add-on status
10
- * @function superpwa_addons_button_text() Button text based on add-on status
11
- * @function superpwa_addons_button_link() Action URL based on add-on status
12
- * @function superpwa_addons_handle_activation() Handle add-on activation
13
- * @function superpwa_addons_handle_deactivation() Handle add-on deactivation
14
- */
15
-
16
- // Exit if accessed directly
17
- if ( ! defined( 'ABSPATH' ) ) exit;
18
-
19
- /**
20
- * Add-ons of SuperPWA
21
- *
22
- * An associative array containing all the add-ons of SuperPWA.
23
- * array(
24
- * 'addon-slug' => array(
25
- * 'name' => 'Add-On Name',
26
- * 'description' => 'Add-On description',
27
- * 'type' => 'bundled | addon',
28
- * 'icon' => 'icon-for-addon-128x128.png',
29
- * 'link' => 'https://superpwa.com/addons/details-page-of-addon',
30
- * 'admin_link' => admin_url( 'admin.php?page=superpwa-addon-admin-page' ),
31
- * 'admin_link_text' => __( 'Customize settings | More Details &rarr;', 'super-progressive-web-apps' ),
32
- * 'admin_link_target' => 'admin | external',
33
- * 'superpwa_min_version' => '1.7' // min version of SuperPWA required to use the add-on.
34
- * )
35
- * );
36
- *
37
- * @param (string) addon-slug to retrieve the details about a specific add-on. False by default and then returns all add-ons.
38
- *
39
- * @return (array|boolean) an associative array containing all the info about the requested add-on. False if add-on not found.
40
- *
41
- * @since 1.7
42
- * @since 1.8 Returns false of $slug isn't found.
43
- */
44
- function superpwa_get_addons( $slug = false ) {
45
-
46
- // Add-Ons array
47
- $addons = array(
48
- 'pull_to_refresh' => array(
49
- 'name' => __( 'Pull To Refresh', 'super-progressive-web-apps' ),
50
- 'description' => __( 'Pull To Refresh to refresh your page', 'super-progressive-web-apps' ),
51
- 'type' => 'bundled',
52
- 'icon' => 'pull-to-refresh.png',
53
- 'link' => 'https://superpwa.com/docs/',
54
- 'admin_link' => admin_url( 'admin.php?page=superpwa-pull-to-refresh' ),
55
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
56
- 'admin_link_target' => 'admin',
57
- 'superpwa_min_version' => '1.0',
58
- ),
59
- 'utm_tracking' => array(
60
- 'name' => __( 'UTM Tracking', 'super-progressive-web-apps' ),
61
- 'description' => __( 'Track visits from your app by adding UTM tracking parameters to the Start Page URL.', 'super-progressive-web-apps' ),
62
- 'type' => 'bundled',
63
- 'icon' => 'utm-action.png',
64
- 'link' => 'https://superpwa.com/addons/utm-tracking/',
65
- 'admin_link' => admin_url( 'admin.php?page=superpwa-utm-tracking' ),
66
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
67
- 'admin_link_target' => 'admin',
68
- 'superpwa_min_version' => '1.7',
69
- ),
70
- 'apple_touch_icons' => array(
71
- 'name' => __( 'Apple Touch Icons & Splash Screen', 'super-progressive-web-apps' ),
72
- 'description' => __( 'Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.', 'super-progressive-web-apps' ),
73
- 'type' => 'bundled',
74
- 'icon' => 'apple-touch.png',
75
- 'link' => 'https://superpwa.com/addons/apple-touch-icons/',
76
- 'admin_link' => admin_url( 'admin.php?page=superpwa-apple-icons' ),
77
- 'admin_link_text' => __( 'More Details & Customize Settings &rarr;', 'super-progressive-web-apps' ),
78
- 'admin_link_target' => 'admin',
79
- 'superpwa_min_version' => '2.1.7',//1.8
80
- ),
81
- 'caching_strategies' => array(
82
- 'name' => __( 'Caching Strategies', 'super-progressive-web-apps' ),
83
- 'description' => __( 'To serve content from the cache and make your app available offline you need to intercept network requests and respond with files stored in the cache. ', 'super-progressive-web-apps' ),
84
- 'type' => 'bundled',
85
- 'icon' => 'caching-strategy.png',
86
- 'link' => 'https://superpwa.com/addons/caching-strategies/',
87
- 'admin_link' => admin_url( 'admin.php?page=superpwa-caching-strategies' ),
88
- 'admin_link_text' => __( 'More Details &rarr;', 'super-progressive-web-apps' ),
89
- 'admin_link_target' => 'admin',
90
- 'superpwa_min_version' => '2.1.6',
91
- ),
92
- 'call_to_action' => array(
93
- 'name' => __( 'Call To Action', 'super-progressive-web-apps' ),
94
- 'description' => __( 'Easily gives notification banner your users to Add to Homescreen on website.', 'super-progressive-web-apps' ),
95
- 'type' => 'addon_pro',
96
- 'icon' => 'call-to-action.png',
97
- 'link' => 'https://superpwa.com/doc/call-to-action-cta-add-on-for-superpwa/',
98
- 'more_link' => 'https://superpwa.com/doc/call-to-action-cta-add-on-for-superpwa/',
99
- 'admin_link' => admin_url('admin.php?page=superpwa-call-to-action'),
100
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
101
- 'admin_link_target' => 'admin',
102
- 'superpwa_min_version' => '2.1.2',
103
- ),
104
- 'android_apk_app_generator' => array(
105
- 'name' => __( 'Android APK APP Generator', 'super-progressive-web-apps' ),
106
- 'description' => __( 'Easily generate APK APP of your current PWA website.', 'super-progressive-web-apps' ),
107
- 'type' => 'addon_pro',
108
- 'icon' => 'android-apk-app.png',
109
- 'link' => 'https://superpwa.com/doc/android-apk-app-generator-add-on-for-superpwa/',
110
- 'more_link' => 'https://superpwa.com/doc/android-apk-app-generator-add-on-for-superpwa/',
111
- 'admin_link' => admin_url('admin.php?page=superpwa-android-apk-app'),
112
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
113
- 'admin_link_target' => 'admin',
114
- 'superpwa_min_version' => '2.1.2',
115
- ),
116
- 'app_shortcut' => array(
117
- 'name' => __( 'APP Shortcuts', 'super-progressive-web-apps' ),
118
- 'description' => __( 'APP shortcuts give quick access to a handful of common actions that users need frequently.', 'super-progressive-web-apps' ),
119
- 'type' => 'addon_pro',
120
- 'icon' => 'app-shortcut.png',
121
- 'link' => 'https://superpwa.com/doc/app-shortcut-add-on-for-superpwa/',
122
- 'more_link' => 'https://superpwa.com/doc/app-shortcut-add-on-for-superpwa/',
123
- 'admin_link' => admin_url('admin.php?page=superpwa-app-shortcut'),
124
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
125
- 'admin_link_target' => 'admin',
126
- 'superpwa_min_version' => '2.1.6',
127
- ),
128
- 'data_analytics' => array(
129
- 'name' => __( 'Data Analytics', 'super-progressive-web-apps' ),
130
- 'description' => __( 'Data analytics allows you to see how many customers interact with your website using Super Progressive Web App.', 'super-progressive-web-apps' ),
131
- 'type' => 'addon_pro',
132
- 'icon' => 'data-analytics.png',
133
- 'link' => 'https://superpwa.com/doc/data-analytics-add-on-for-superpwa/',
134
- 'more_link' => 'https://superpwa.com/doc/data-analytics-add-on-for-superpwa/',
135
- 'admin_link' => admin_url('admin.php?page=superpwa-data-analytics'),
136
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
137
- 'admin_link_target' => 'admin',
138
- 'superpwa_min_version' => '2.1.8',
139
- ),
140
- 'pre_loader' => array(
141
- 'name' => __( 'PreLoader', 'super-progressive-web-apps' ),
142
- 'description' => __( 'Set the Pre-Loading Feature and provide your user an eye catchy loading functionality to the site.', 'super-progressive-web-apps' ),
143
- 'type' => 'addon_pro',
144
- 'icon' => 'spinner-of-dots.png',
145
- 'link' => 'https://superpwa.com/doc/preloader-add-on-for-superpwa/',
146
- 'admin_link' => admin_url( 'admin.php?page=superpwa-pre-loader' ),
147
- 'admin_link_text' => __( 'More Details & Customize Settings &rarr;', 'super-progressive-web-apps' ),
148
- 'admin_link_target' => 'admin',
149
- 'superpwa_min_version' => '2.1.18',//1.8
150
- ),
151
- 'qr_code_generator' => array(
152
- 'name' => __( 'QR Code Generator', 'super-progressive-web-apps' ),
153
- 'description' => __( 'Provides you with Install App QR Code which you can download and share with your users to give them easy to use and engaging user experience.', 'super-progressive-web-apps' ),
154
- 'type' => 'addon_pro',
155
- 'icon' => 'qr-code.png',
156
- 'link' => 'https://superpwa.com/doc/qr-code-generator-add-on-for-superpwa/',
157
- 'more_link' => 'https://superpwa.com/doc/qr-code-generator-add-on-for-superpwa/',
158
- 'admin_link' => admin_url('admin.php?page=superpwa-qr-code-generator'),
159
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
160
- 'admin_link_target' => 'admin',
161
- 'superpwa_min_version' => '2.2.3',
162
- ),
163
- );
164
-
165
- if ( $slug === false ) {
166
- return $addons;
167
- }
168
-
169
- if ( ! isset( $addons[$slug] ) ) {
170
- return false;
171
- }
172
-
173
- return $addons[$slug];
174
- }
175
-
176
- /**
177
- * Add-Ons UI renderer
178
- *
179
- * @since 1.7
180
- */
181
- function superpwa_addons_interface_render() {
182
-
183
- // Authentication
184
- if ( ! current_user_can( 'manage_options' ) ) {
185
- return;
186
- }
187
-
188
- // Add-on activation todo
189
- if ( isset( $_GET['activated'] ) && isset( $_GET['addon'] ) ) {
190
-
191
- // Add-on activation action. Functions defined in the add-on file are loaded by now.
192
- do_action( 'superpwa_addon_activated_' . $_GET['addon'] );
193
-
194
- // Get add-on info
195
- $addon = superpwa_get_addons( $_GET['addon'] );
196
-
197
- // Add UTM Tracking to admin_link_text if its not an admin page.
198
- if ( $addon['admin_link_target'] === 'external' ) {
199
- $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-activation-notice';
200
- }
201
-
202
- // Set link target attribute so that external links open in a new tab.
203
- $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
204
-
205
- if ( $addon !== false ) {
206
-
207
- // Add-on activation notice
208
- echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>Add-On activated: %s.</strong> <a href="%s"%s>%s</a>', 'super-progressive-web-apps' ), $addon['name'], $addon['admin_link'], $link_target, $addon['admin_link_text'] ) . '</p></div>';
209
- }
210
- }
211
-
212
- // Add-on de-activation notice
213
- if ( isset( $_GET['deactivated'] ) ) {
214
-
215
- // Add settings saved message with the class of "updated"
216
- add_settings_error( 'superpwa_settings_group', 'superpwa_addon_deactivated_message', __( 'Add-On deactivated', 'super-progressive-web-apps' ), 'updated' );
217
-
218
- // Show Settings Saved Message
219
- settings_errors( 'superpwa_settings_group' );
220
- }
221
-
222
- // Get add-ons array
223
- $addons = superpwa_get_addons();
224
-
225
- ?>
226
- <style type="text/css">.spwa-tab {overflow: hidden;border: 1px solid #ccc;background-color: #fff;margin-top: 15px;}.spwa-tab a {background-color: inherit;text-decoration: none;float: left;border: none;outline: none;cursor: pointer;padding: 14px 16px;transition: 0s;font-size: 15px;color: #2271b1;}.spwa-tab a:hover {color: #0a4b78;}.spwa-tab a.active {box-shadow: none;border-bottom: 4px solid #646970;color: #1d2327;}.spwa-tab a:focus {box-shadow: none;outline: none;}.spwa-tabcontent {display: none;padding: 6px 12px;border-top: none; animation: fadeEffect 1s; } @keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }</style>
227
- <div class="wrap">
228
- <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
229
- <?php superpwa_setting_tabs_html(); ?>
230
- <p><?php _e( 'Add-Ons extend the functionality of SuperPWA.', 'super-progressive-web-apps' ); ?></p>
231
- <style>.compatibility-compatible i:before{font-size: 16px; POSITION: RELATIVE;top: 3px;width: 15px;}</style>
232
- <!-- Add-Ons UI -->
233
- <div class="wp-list-table widefat addon-install">
234
-
235
- <div id="the-list">
236
-
237
- <?php
238
- // Newsletter marker. Set this to false once newsletter subscription is displayed.
239
- $superpwa_newsletter = true;
240
-
241
- // Looping over each add-on
242
- foreach( $addons as $slug => $addon ) {
243
-
244
- // Add UTM Tracking to admin_link_text if its not an admin page.
245
- if ( $addon['admin_link_target'] === 'external' ) {
246
- $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-card';
247
- }
248
-
249
- // Set link target attribute so that external links open in a new tab.
250
- $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
251
-
252
- ?>
253
-
254
- <div class="plugin-card plugin-card-<?php echo $slug; ?>">
255
-
256
- <div class="plugin-card-top">
257
-
258
- <div class="name column-name">
259
- <h3>
260
- <a href="<?php echo $addon['link'] . (($addon['admin_link_target'] === 'external')? '?utm_source=superpwa-plugin&utm_medium=addon-card': '') ; ?>" target="_blank">
261
- <?php echo $addon['name']; ?>
262
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/' . $addon['icon']; ?>" class="plugin-icon" alt="">
263
- </a>
264
- </h3>
265
- </div>
266
-
267
- <div class="action-links">
268
- <ul class="plugin-action-buttons">
269
- <li>
270
- <a class="button activate-now button-<?php echo superpwa_addons_button_text( $slug ) == __( 'Deactivate', 'super-progressive-web-apps' ) ? 'secondary' : 'primary'; ?>" data-slug="<?php echo $slug; ?>" href="<?php echo superpwa_addons_button_link( $slug ); ?>" aria-label<?php echo superpwa_addons_button_text( $slug ) . ' ' . $addon['name'] . ' now'; ?>" data-name="<?php echo $addon['name']; ?>">
271
- <?php echo superpwa_addons_button_text( $slug ); ?>
272
- </a>
273
- </li>
274
- <?php if ( superpwa_addons_status( $slug ) == 'active' ) {
275
- printf( __( '<li class="compatibility-compatible"><a class="button activate-now button-secondary" href="%s"%s style="padding-left: 7px;"><i class="dashicons-before dashicons-admin-generic" style="vertical-align: sub;font-size: 8px;"></i> %s</a></li>', 'super-progressive-web-apps' ), $addon['admin_link'], $link_target, __('Settings','super-progressive-web-apps') );
276
- }else{ ?>
277
- <li>
278
- <?php
279
- $link = $addon['link'] . (($addon['admin_link_target'] === 'external')?'?utm_source=superpwa-plugin&utm_medium=addon-card': '');
280
- if (isset($addon['more_link'])) {
281
- $link = $addon['more_link'] . (($addon['admin_link_target'] === 'external')?'?utm_source=superpwa-plugin&utm_medium=addon-card': '');
282
- }
283
- ?>
284
- <a href="<?php echo $link; ?>" target="_blank" aria-label="<?php printf(__('More information about %s', 'super-progressive-web-apps'), $addon['name']); ?>" data-title="<?php echo $addon['name']; ?>"><?php _e('More Details', 'super-progressive-web-apps'); ?></a>
285
- </li>
286
- <?php } ?>
287
- </ul>
288
- </div>
289
-
290
- <div class="desc column-description">
291
- <p><?php echo $addon['description']; ?></p>
292
- </div>
293
-
294
- </div>
295
-
296
- <?php /*<div class="plugin-card-bottom">
297
- <div class="column-compatibility">
298
- <?php
299
- if ( superpwa_addons_status( $slug ) == 'active' ) {
300
- printf( __( '<span class="compatibility-compatible"><strong>Add-On active.</strong> <a href="%s"%s>%s</a></span>', 'super-progressive-web-apps' ), $addon['admin_link'], $link_target, $addon['admin_link_text'] );
301
- }
302
- else if ( version_compare( SUPERPWA_VERSION, $addon['superpwa_min_version'], '>=' ) ) {
303
- _e( '<span class="compatibility-compatible"><strong>Compatible</strong> with your version of SuperPWA</span>', 'super-progressive-web-apps' );
304
- }
305
- else {
306
- _e( '<span class="compatibility-incompatible"><strong>Please upgrade</strong> to the latest version of SuperPWA</span>', 'super-progressive-web-apps' );
307
- } ?>
308
- </div>
309
- </div>*/ ?>
310
-
311
- </div>
312
- <?php } ?>
313
- </div>
314
- </div>
315
-
316
- </div>
317
- <?php
318
- }
319
-
320
- /**
321
- * Find add-on status
322
- *
323
- * Returns one of these statuses:
324
- * active when the add-on is installed and active.
325
- * inactive when the add-on is installed but not activated.
326
- * uninstalled when the add-on is not installed and not available.
327
- *
328
- * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
329
- * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
330
- *
331
- * @return (string) one of the statuses as described above. False if $slug is not a valid add-on.
332
- *
333
- * @since 1.7
334
- */
335
- function superpwa_addons_status( $slug ) {
336
-
337
- // Get add-on details
338
- $addon = superpwa_get_addons( $slug );
339
-
340
- // A security check to make sure that the add-on under consideration exist.
341
- if ( $addon === false ) {
342
- return false;
343
- }
344
-
345
- // Get active add-ons
346
- $active_addons = get_option( 'superpwa_active_addons', array() );
347
-
348
- switch( $addon['type'] ) {
349
-
350
- // Bundled add-ons ships with SuperPWA and need not be installed separately.
351
- case 'bundled':
352
-
353
- // True means, add-on is installed and active
354
- if ( in_array( $slug, $active_addons ) ) {
355
- return 'active';
356
- }
357
-
358
- // add-on is installed, but inactive
359
- return 'inactive';
360
-
361
- break;
362
-
363
- // Add-ons installed as a separate plugin
364
- case 'addon':
365
-
366
- // True means, add-on is installed and active
367
- if ( is_plugin_active( $slug ) ) {
368
- return 'active';
369
- }
370
-
371
- // Add-on is inactive, check if add-on is installed
372
- if ( file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
373
- return 'inactive';
374
- }
375
-
376
- // If we are here, add-on is not installed and not active
377
- return 'uninstalled';
378
-
379
- break;
380
- // Add-ons pro installed as a separate plugin
381
- case 'addon_pro':
382
- $pro_plugin = 'super-progressive-web-apps-pro/super-progressive-web-apps-pro.php';
383
- // True means, add-on is installed and active
384
- if ( is_plugin_active( $pro_plugin ) ) {
385
- // True means, add-on is installed and active
386
- if ( in_array( $slug, $active_addons ) ) {
387
- return 'active';
388
- }
389
- return 'inactive';
390
- }
391
-
392
-
393
- // Add-on is inactive, check if add-on is installed
394
- if ( file_exists( WP_PLUGIN_DIR . '/' . $pro_plugin ) ) {
395
- return 'upgrade';
396
- }
397
-
398
- // If we are here, add-on is not installed and not active
399
- return 'upgrade';
400
-
401
-
402
-
403
- break;
404
-
405
- default:
406
- return false;
407
- break;
408
- }
409
- }
410
-
411
- /**
412
- * Button text based on add-on status
413
- *
414
- * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
415
- * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
416
- *
417
- * @return (string) 'Activate', if plugin status is 'inactive'
418
- * 'Deactivate', if plugin status is 'active'
419
- * 'Install', if plugin status is 'uninstalled'
420
- *
421
- * @since 1.7
422
- */
423
- function superpwa_addons_button_text( $slug ) {
424
-
425
- // Get the add-on status
426
- $addon_status = superpwa_addons_status( $slug );
427
-
428
- switch( $addon_status ) {
429
-
430
- case 'inactive':
431
- return __( 'Activate', 'super-progressive-web-apps' );
432
- break;
433
-
434
- case 'active':
435
- return __( 'Deactivate', 'super-progressive-web-apps' );
436
- break;
437
-
438
- case 'upgrade':
439
- return __( 'Upgrade to PRO', 'super-progressive-web-apps' );
440
- break;
441
- case 'uninstalled':
442
- default: // Safety net for edge cases if any.
443
- return __( 'Install', 'super-progressive-web-apps' );
444
- break;
445
- }
446
- }
447
-
448
- /**
449
- * Action URL based on add-on status
450
- *
451
- * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
452
- * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
453
- *
454
- * @return (string) activation / deactivation / install url with nonce as necessary
455
- *
456
- * @since 1.7
457
- */
458
- function superpwa_addons_button_link( $slug ) {
459
-
460
- // Get the add-on status
461
- $addon_status = superpwa_addons_status( $slug );
462
-
463
- // Get add-on details
464
- $addon = superpwa_get_addons( $slug );
465
-
466
- switch( $addon_status ) {
467
-
468
- // Add-on inactive, send activation link.
469
- case 'inactive':
470
-
471
- // Plugin activation link for add-on plugins that are installed separately.
472
- if ( $addon['type'] == 'addon' ) {
473
- wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $slug ), 'activate-plugin_' . $slug );
474
- }
475
-
476
- // Activation link for bundled add-ons.
477
- return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_activate_addon&addon=' . $slug ), 'activate', 'superpwa_addon_activate_nonce' );
478
-
479
- break;
480
-
481
- // Add-on active, send deactivation link.
482
- case 'active':
483
-
484
- // Plugin deactivation link for add-on plugins that are installed separately.
485
- if ( $addon['type'] == 'addon' ) {
486
- wp_nonce_url( admin_url( 'plugins.php?action=deactivate&plugin=' . $slug ), 'deactivate-plugin_' . $slug );
487
- }
488
-
489
- // Deactivation link for bundled add-ons.
490
- return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_deactivate_addon&addon=' . $slug ), 'deactivate', 'superpwa_addon_deactivate_nonce' );
491
-
492
- break;
493
-
494
- // If add-on is not installed and for edge cases where $addon_status is false, we use the add-on link.
495
- case 'uninstalled':
496
- case 'upgrade':
497
- default:
498
- return $addon['link'];
499
- break;
500
- }
501
- }
502
-
503
- /**
504
- * Handle add-on activation
505
- *
506
- * Verifies that the activation request is valid and then redirects the page back to the add-ons page.
507
- * Hooked onto admin_post_superpwa_activate_addon action hook
508
- *
509
- * @since 1.7
510
- * @since 1.8 Handles only activation. Used to handle both activation and deactivation.
511
- * @since 1.8 Hooked onto admin_post_superpwa_activate_addon. Was hooked to load-superpwa_page_superpwa-addons before.
512
- */
513
- function superpwa_addons_handle_activation() {
514
-
515
- // Get the add-on status
516
- $addon_status = superpwa_addons_status( $_GET['addon'] );
517
-
518
- // Authentication
519
- if (
520
- ! current_user_can( 'manage_options' ) ||
521
- ! isset( $_GET['addon'] ) ||
522
- ! ( isset( $_GET['superpwa_addon_activate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_activate_nonce'], 'activate' ) ) ||
523
- ! ( $addon_status == 'inactive' )
524
- ) {
525
-
526
- // Return to referer if authentication fails.
527
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
528
- exit;
529
- }
530
-
531
- // Get active add-ons
532
- $active_addons = get_option( 'superpwa_active_addons', array() );
533
-
534
- // Add the add-on to the list of active add-ons
535
- $active_addons[] = $_GET['addon'];
536
-
537
- // Write settings back to database
538
- update_option( 'superpwa_active_addons', $active_addons );
539
-
540
- // Redirect back to add-ons sub-menu
541
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons&activated=1&addon=' . $_GET['addon'] ) );
542
- exit;
543
- }
544
- add_action( 'admin_post_superpwa_activate_addon', 'superpwa_addons_handle_activation' );
545
-
546
- /**
547
- * Handle add-on deactivation
548
- *
549
- * Verifies that the deactivation request is valid and then redirects the page back to the add-ons page.
550
- * Hooked onto admin_post_superpwa_deactivate_addon action hook.
551
- *
552
- * @since 1.8
553
- */
554
- function superpwa_addons_handle_deactivation() {
555
-
556
- // Get the add-on status
557
- $addon_status = superpwa_addons_status( $_GET['addon'] );
558
-
559
- // Authentication
560
- if (
561
- ! current_user_can( 'manage_options' ) ||
562
- ! isset( $_GET['addon'] ) ||
563
- ! ( isset( $_GET['superpwa_addon_deactivate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_deactivate_nonce'], 'deactivate' ) ) ||
564
- ! ( $addon_status == 'active' )
565
- ) {
566
-
567
- // Return to referer if authentication fails.
568
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
569
- exit;
570
- }
571
-
572
- // Get active add-ons
573
- $active_addons = get_option( 'superpwa_active_addons', array() );
574
-
575
- // Delete the add-on from the active_addons array in SuperPWA settings.
576
- $active_addons = array_flip( $active_addons );
577
- unset( $active_addons[ $_GET['addon'] ] );
578
- $active_addons = array_flip( $active_addons );
579
-
580
- // Write settings back to database
581
- update_option( 'superpwa_active_addons', $active_addons );
582
-
583
- // Add-on deactivation action. Functions defined in the add-on file are still availalbe at this point.
584
- do_action( 'superpwa_addon_deactivated_' . $_GET['addon'] );
585
-
586
- // Redirect back to add-ons sub-menu
587
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons&deactivated=1&addon=' . $_GET['addon'] ) );
588
- exit;
589
- }
590
- add_action( 'admin_post_superpwa_deactivate_addon', 'superpwa_addons_handle_deactivation' );
591
-
592
- /**
593
- * Handle newsletter submit
594
- *
595
- *
596
- * @since 2.1.5
597
- */
598
- function superpwa_newsletter_submit(){
599
- global $current_user;
600
- $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
601
- $api_params = array(
602
- 'name' => esc_attr($current_user->display_name),
603
- 'email'=> sanitize_text_field($_POST['email']),
604
- 'website'=> sanitize_text_field( get_site_url() ),
605
- 'type'=> 'superpwa'
606
- );
607
- $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
608
- $response = wp_remote_retrieve_body( $response );
609
- echo json_encode(array('status'=>200, 'message'=>'Submitted ', 'response'=> $response));
610
- die;
611
- }
612
- add_action( 'wp_ajax_superpwa_newsletter_submit', 'superpwa_newsletter_submit' );
613
- add_action( 'wp_ajax_nopriv_superpwa_newsletter_submit', 'superpwa_newsletter_submit' );
614
-
615
- function superpwa_newsletter_hide_form(){
616
-
617
- $hide_newsletter = get_option('superpwa_hide_newsletter');
618
- if($hide_newsletter == false){
619
- add_option( 'superpwa_hide_newsletter', 'no' );
620
- }
621
- update_option( 'superpwa_hide_newsletter', 'yes' );
622
- echo json_encode(array('status'=>200, 'message'=>'Submitted '));
623
- die;
624
- }
625
- add_action( 'wp_ajax_superpwa_newsletter_hide_form', 'superpwa_newsletter_hide_form' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
  add_action( 'wp_ajax_nopriv_superpwa_newsletter_hide_form', 'superpwa_newsletter_hide_form' );
1
+ <?php
2
+ /**
3
+ * Add-Ons Settings UI
4
+ *
5
+ * @since 1.7
6
+ *
7
+ * @function superpwa_get_addons() Add-ons of SuperPWA
8
+ * @function superpwa_addons_interface_render() Add-Ons UI renderer
9
+ * @function superpwa_addons_status() Find add-on status
10
+ * @function superpwa_addons_button_text() Button text based on add-on status
11
+ * @function superpwa_addons_button_link() Action URL based on add-on status
12
+ * @function superpwa_addons_handle_activation() Handle add-on activation
13
+ * @function superpwa_addons_handle_deactivation() Handle add-on deactivation
14
+ */
15
+
16
+ // Exit if accessed directly
17
+ if ( ! defined( 'ABSPATH' ) ) exit;
18
+
19
+ /**
20
+ * Add-ons of SuperPWA
21
+ *
22
+ * An associative array containing all the add-ons of SuperPWA.
23
+ * array(
24
+ * 'addon-slug' => array(
25
+ * 'name' => 'Add-On Name',
26
+ * 'description' => 'Add-On description',
27
+ * 'type' => 'bundled | addon',
28
+ * 'icon' => 'icon-for-addon-128x128.png',
29
+ * 'link' => 'https://superpwa.com/addons/details-page-of-addon',
30
+ * 'admin_link' => admin_url( 'admin.php?page=superpwa-addon-admin-page' ),
31
+ * 'admin_link_text' => __( 'Customize settings | More Details &rarr;', 'super-progressive-web-apps' ),
32
+ * 'admin_link_target' => 'admin | external',
33
+ * 'superpwa_min_version' => '1.7' // min version of SuperPWA required to use the add-on.
34
+ * )
35
+ * );
36
+ *
37
+ * @param (string) addon-slug to retrieve the details about a specific add-on. False by default and then returns all add-ons.
38
+ *
39
+ * @return (array|boolean) an associative array containing all the info about the requested add-on. False if add-on not found.
40
+ *
41
+ * @since 1.7
42
+ * @since 1.8 Returns false of $slug isn't found.
43
+ */
44
+ function superpwa_get_addons( $slug = false ) {
45
+
46
+ // Add-Ons array
47
+ $addons = array(
48
+ 'pull_to_refresh' => array(
49
+ 'name' => __( 'Pull To Refresh', 'super-progressive-web-apps' ),
50
+ 'description' => __( 'Pull To Refresh to refresh your page', 'super-progressive-web-apps' ),
51
+ 'type' => 'bundled',
52
+ 'icon' => 'pull-to-refresh.png',
53
+ 'link' => 'https://superpwa.com/docs/',
54
+ 'admin_link' => admin_url( 'admin.php?page=superpwa-pull-to-refresh' ),
55
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
56
+ 'admin_link_target' => 'admin',
57
+ 'superpwa_min_version' => '1.0',
58
+ ),
59
+ 'utm_tracking' => array(
60
+ 'name' => __( 'UTM Tracking', 'super-progressive-web-apps' ),
61
+ 'description' => __( 'Track visits from your app by adding UTM tracking parameters to the Start Page URL.', 'super-progressive-web-apps' ),
62
+ 'type' => 'bundled',
63
+ 'icon' => 'utm-action.png',
64
+ 'link' => 'https://superpwa.com/addons/utm-tracking/',
65
+ 'admin_link' => admin_url( 'admin.php?page=superpwa-utm-tracking' ),
66
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
67
+ 'admin_link_target' => 'admin',
68
+ 'superpwa_min_version' => '1.7',
69
+ ),
70
+ 'apple_touch_icons' => array(
71
+ 'name' => __( 'Apple Touch Icons & Splash Screen', 'super-progressive-web-apps' ),
72
+ 'description' => __( 'Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.', 'super-progressive-web-apps' ),
73
+ 'type' => 'bundled',
74
+ 'icon' => 'apple-touch.png',
75
+ 'link' => 'https://superpwa.com/addons/apple-touch-icons/',
76
+ 'admin_link' => admin_url( 'admin.php?page=superpwa-apple-icons' ),
77
+ 'admin_link_text' => __( 'More Details & Customize Settings &rarr;', 'super-progressive-web-apps' ),
78
+ 'admin_link_target' => 'admin',
79
+ 'superpwa_min_version' => '2.1.7',//1.8
80
+ ),
81
+ 'caching_strategies' => array(
82
+ 'name' => __( 'Caching Strategies', 'super-progressive-web-apps' ),
83
+ 'description' => __( 'To serve content from the cache and make your app available offline you need to intercept network requests and respond with files stored in the cache. ', 'super-progressive-web-apps' ),
84
+ 'type' => 'bundled',
85
+ 'icon' => 'caching-strategy.png',
86
+ 'link' => 'https://superpwa.com/addons/caching-strategies/',
87
+ 'admin_link' => admin_url( 'admin.php?page=superpwa-caching-strategies' ),
88
+ 'admin_link_text' => __( 'More Details &rarr;', 'super-progressive-web-apps' ),
89
+ 'admin_link_target' => 'admin',
90
+ 'superpwa_min_version' => '2.1.6',
91
+ ),
92
+ 'call_to_action' => array(
93
+ 'name' => __( 'Call To Action', 'super-progressive-web-apps' ),
94
+ 'description' => __( 'Easily gives notification banner your users to Add to Homescreen on website.', 'super-progressive-web-apps' ),
95
+ 'type' => 'addon_pro',
96
+ 'icon' => 'call-to-action.png',
97
+ 'link' => 'https://superpwa.com/doc/call-to-action-cta-add-on-for-superpwa/',
98
+ 'more_link' => 'https://superpwa.com/doc/call-to-action-cta-add-on-for-superpwa/',
99
+ 'admin_link' => admin_url('admin.php?page=superpwa-call-to-action'),
100
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
101
+ 'admin_link_target' => 'admin',
102
+ 'superpwa_min_version' => '2.1.2',
103
+ ),
104
+ 'android_apk_app_generator' => array(
105
+ 'name' => __( 'Android APK APP Generator', 'super-progressive-web-apps' ),
106
+ 'description' => __( 'Easily generate APK APP of your current PWA website.', 'super-progressive-web-apps' ),
107
+ 'type' => 'addon_pro',
108
+ 'icon' => 'android-apk-app.png',
109
+ 'link' => 'https://superpwa.com/doc/android-apk-app-generator-add-on-for-superpwa/',
110
+ 'more_link' => 'https://superpwa.com/doc/android-apk-app-generator-add-on-for-superpwa/',
111
+ 'admin_link' => admin_url('admin.php?page=superpwa-android-apk-app'),
112
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
113
+ 'admin_link_target' => 'admin',
114
+ 'superpwa_min_version' => '2.1.2',
115
+ ),
116
+ 'app_shortcut' => array(
117
+ 'name' => __( 'APP Shortcuts', 'super-progressive-web-apps' ),
118
+ 'description' => __( 'APP shortcuts give quick access to a handful of common actions that users need frequently.', 'super-progressive-web-apps' ),
119
+ 'type' => 'addon_pro',
120
+ 'icon' => 'app-shortcut.png',
121
+ 'link' => 'https://superpwa.com/doc/app-shortcut-add-on-for-superpwa/',
122
+ 'more_link' => 'https://superpwa.com/doc/app-shortcut-add-on-for-superpwa/',
123
+ 'admin_link' => admin_url('admin.php?page=superpwa-app-shortcut'),
124
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
125
+ 'admin_link_target' => 'admin',
126
+ 'superpwa_min_version' => '2.1.6',
127
+ ),
128
+ 'data_analytics' => array(
129
+ 'name' => __( 'Data Analytics', 'super-progressive-web-apps' ),
130
+ 'description' => __( 'Data analytics allows you to see how many customers interact with your website using Super Progressive Web App.', 'super-progressive-web-apps' ),
131
+ 'type' => 'addon_pro',
132
+ 'icon' => 'data-analytics.png',
133
+ 'link' => 'https://superpwa.com/doc/data-analytics-add-on-for-superpwa/',
134
+ 'more_link' => 'https://superpwa.com/doc/data-analytics-add-on-for-superpwa/',
135
+ 'admin_link' => admin_url('admin.php?page=superpwa-data-analytics'),
136
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
137
+ 'admin_link_target' => 'admin',
138
+ 'superpwa_min_version' => '2.1.8',
139
+ ),
140
+ 'pre_loader' => array(
141
+ 'name' => __( 'PreLoader', 'super-progressive-web-apps' ),
142
+ 'description' => __( 'Set the Pre-Loading Feature and provide your user an eye catchy loading functionality to the site.', 'super-progressive-web-apps' ),
143
+ 'type' => 'addon_pro',
144
+ 'icon' => 'spinner-of-dots.png',
145
+ 'link' => 'https://superpwa.com/doc/preloader-add-on-for-superpwa/',
146
+ 'admin_link' => admin_url( 'admin.php?page=superpwa-pre-loader' ),
147
+ 'admin_link_text' => __( 'More Details & Customize Settings &rarr;', 'super-progressive-web-apps' ),
148
+ 'admin_link_target' => 'admin',
149
+ 'superpwa_min_version' => '2.1.18',//1.8
150
+ ),
151
+ 'qr_code_generator' => array(
152
+ 'name' => __( 'QR Code Generator', 'super-progressive-web-apps' ),
153
+ 'description' => __( 'Provides you with Install App QR Code which you can download and share with your users to give them easy to use and engaging user experience.', 'super-progressive-web-apps' ),
154
+ 'type' => 'addon_pro',
155
+ 'icon' => 'qr-code.png',
156
+ 'link' => 'https://superpwa.com/doc/qr-code-generator-add-on-for-superpwa/',
157
+ 'more_link' => 'https://superpwa.com/doc/qr-code-generator-add-on-for-superpwa/',
158
+ 'admin_link' => admin_url('admin.php?page=superpwa-qr-code-generator'),
159
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
160
+ 'admin_link_target' => 'admin',
161
+ 'superpwa_min_version' => '2.2.3',
162
+ ),
163
+ );
164
+
165
+ if ( $slug === false ) {
166
+ return $addons;
167
+ }
168
+
169
+ if ( ! isset( $addons[$slug] ) ) {
170
+ return false;
171
+ }
172
+
173
+ return $addons[$slug];
174
+ }
175
+
176
+ /**
177
+ * Add-Ons UI renderer
178
+ *
179
+ * @since 1.7
180
+ */
181
+ function superpwa_addons_interface_render() {
182
+
183
+ // Authentication
184
+ if ( ! current_user_can( 'manage_options' ) ) {
185
+ return;
186
+ }
187
+
188
+ // Add-on activation todo
189
+ if ( isset( $_GET['activated'] ) && isset( $_GET['addon'] ) ) {
190
+
191
+ // Add-on activation action. Functions defined in the add-on file are loaded by now.
192
+ do_action( 'superpwa_addon_activated_' . $_GET['addon'] );
193
+
194
+ // Get add-on info
195
+ $addon = superpwa_get_addons( $_GET['addon'] );
196
+
197
+ // Add UTM Tracking to admin_link_text if its not an admin page.
198
+ if ( $addon['admin_link_target'] === 'external' ) {
199
+ $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-activation-notice';
200
+ }
201
+
202
+ // Set link target attribute so that external links open in a new tab.
203
+ $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
204
+
205
+ if ( $addon !== false ) {
206
+
207
+ // Add-on activation notice
208
+ echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>Add-On activated: %s.</strong> <a href="%s"%s>%s</a>', 'super-progressive-web-apps' ), $addon['name'], $addon['admin_link'], $link_target, $addon['admin_link_text'] ) . '</p></div>';
209
+ }
210
+ }
211
+
212
+ // Add-on de-activation notice
213
+ if ( isset( $_GET['deactivated'] ) ) {
214
+
215
+ // Add settings saved message with the class of "updated"
216
+ add_settings_error( 'superpwa_settings_group', 'superpwa_addon_deactivated_message', __( 'Add-On deactivated', 'super-progressive-web-apps' ), 'updated' );
217
+
218
+ // Show Settings Saved Message
219
+ settings_errors( 'superpwa_settings_group' );
220
+ }
221
+
222
+ // Get add-ons array
223
+ $addons = superpwa_get_addons();
224
+
225
+ ?>
226
+ <style type="text/css">.spwa-tab {overflow: hidden;border: 1px solid #ccc;background-color: #fff;margin-top: 15px;}.spwa-tab a {background-color: inherit;text-decoration: none;float: left;border: none;outline: none;cursor: pointer;padding: 14px 16px;transition: 0s;font-size: 15px;color: #2271b1;}.spwa-tab a:hover {color: #0a4b78;}.spwa-tab a.active {box-shadow: none;border-bottom: 4px solid #646970;color: #1d2327;}.spwa-tab a:focus {box-shadow: none;outline: none;}.spwa-tabcontent {display: none;padding: 6px 12px;border-top: none; animation: fadeEffect 1s; } @keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }</style>
227
+ <div class="wrap">
228
+ <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
229
+ <?php superpwa_setting_tabs_html(); ?>
230
+ <p><?php _e( 'Add-Ons extend the functionality of SuperPWA.', 'super-progressive-web-apps' ); ?></p>
231
+ <style>.compatibility-compatible i:before{font-size: 16px; POSITION: RELATIVE;top: 3px;width: 15px;}</style>
232
+ <!-- Add-Ons UI -->
233
+ <div class="wp-list-table widefat addon-install">
234
+
235
+ <div id="the-list">
236
+
237
+ <?php
238
+ // Newsletter marker. Set this to false once newsletter subscription is displayed.
239
+ $superpwa_newsletter = true;
240
+
241
+ // Looping over each add-on
242
+ foreach( $addons as $slug => $addon ) {
243
+
244
+ // Add UTM Tracking to admin_link_text if its not an admin page.
245
+ if ( $addon['admin_link_target'] === 'external' ) {
246
+ $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-card';
247
+ }
248
+
249
+ // Set link target attribute so that external links open in a new tab.
250
+ $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
251
+
252
+ ?>
253
+
254
+ <div class="plugin-card plugin-card-<?php echo $slug; ?>">
255
+
256
+ <div class="plugin-card-top">
257
+
258
+ <div class="name column-name">
259
+ <h3>
260
+ <a href="<?php echo $addon['link'] . (($addon['admin_link_target'] === 'external')? '?utm_source=superpwa-plugin&utm_medium=addon-card': '') ; ?>" target="_blank">
261
+ <?php echo $addon['name']; ?>
262
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/' . $addon['icon']; ?>" class="plugin-icon" alt="">
263
+ </a>
264
+ </h3>
265
+ </div>
266
+
267
+ <div class="action-links">
268
+ <ul class="plugin-action-buttons">
269
+ <li>
270
+ <a class="button activate-now button-<?php echo superpwa_addons_button_text( $slug ) == __( 'Deactivate', 'super-progressive-web-apps' ) ? 'secondary' : 'primary'; ?>" data-slug="<?php echo $slug; ?>" href="<?php echo superpwa_addons_button_link( $slug ); ?>" aria-label<?php echo superpwa_addons_button_text( $slug ) . ' ' . $addon['name'] . ' now'; ?>" data-name="<?php echo $addon['name']; ?>">
271
+ <?php echo superpwa_addons_button_text( $slug ); ?>
272
+ </a>
273
+ </li>
274
+ <?php if ( superpwa_addons_status( $slug ) == 'active' ) {
275
+ printf( __( '<li class="compatibility-compatible"><a class="button activate-now button-secondary" href="%s"%s style="padding-left: 7px;"><i class="dashicons-before dashicons-admin-generic" style="vertical-align: sub;font-size: 8px;"></i> %s</a></li>', 'super-progressive-web-apps' ), $addon['admin_link'], $link_target, __('Settings','super-progressive-web-apps') );
276
+ }else{ ?>
277
+ <li>
278
+ <?php
279
+ $link = $addon['link'] . (($addon['admin_link_target'] === 'external')?'?utm_source=superpwa-plugin&utm_medium=addon-card': '');
280
+ if (isset($addon['more_link'])) {
281
+ $link = $addon['more_link'] . (($addon['admin_link_target'] === 'external')?'?utm_source=superpwa-plugin&utm_medium=addon-card': '');
282
+ }
283
+ ?>
284
+ <a href="<?php echo $link; ?>" target="_blank" aria-label="<?php printf(__('More information about %s', 'super-progressive-web-apps'), $addon['name']); ?>" data-title="<?php echo $addon['name']; ?>"><?php _e('More Details', 'super-progressive-web-apps'); ?></a>
285
+ </li>
286
+ <?php } ?>
287
+ </ul>
288
+ </div>
289
+
290
+ <div class="desc column-description">
291
+ <p><?php echo $addon['description']; ?></p>
292
+ </div>
293
+
294
+ </div>
295
+
296
+ <?php /*<div class="plugin-card-bottom">
297
+ <div class="column-compatibility">
298
+ <?php
299
+ if ( superpwa_addons_status( $slug ) == 'active' ) {
300
+ printf( __( '<span class="compatibility-compatible"><strong>Add-On active.</strong> <a href="%s"%s>%s</a></span>', 'super-progressive-web-apps' ), $addon['admin_link'], $link_target, $addon['admin_link_text'] );
301
+ }
302
+ else if ( version_compare( SUPERPWA_VERSION, $addon['superpwa_min_version'], '>=' ) ) {
303
+ _e( '<span class="compatibility-compatible"><strong>Compatible</strong> with your version of SuperPWA</span>', 'super-progressive-web-apps' );
304
+ }
305
+ else {
306
+ _e( '<span class="compatibility-incompatible"><strong>Please upgrade</strong> to the latest version of SuperPWA</span>', 'super-progressive-web-apps' );
307
+ } ?>
308
+ </div>
309
+ </div>*/ ?>
310
+
311
+ </div>
312
+ <?php } ?>
313
+ </div>
314
+ </div>
315
+ <details id="superpwa-ocassional-pop-up-container">
316
+ <summary class="superpwa-ocassional-pop-up-open-close-button"><?php esc_html_e('40% OFF - Limited Time Only', 'super-progressive-web-apps')?><svg fill="#fff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 288.359 288.359" style="enable-background:new 0 0 288.359 288.359;" xml:space="preserve"><g><path d="M283.38,4.98c-3.311-3.311-7.842-5.109-12.522-4.972L163.754,3.166c-4.334,0.128-8.454,1.906-11.52,4.972L4.979,155.394 c-6.639,6.639-6.639,17.402,0,24.041L108.924,283.38c6.639,6.639,17.402,6.639,24.041,0l147.256-147.256 c3.065-3.065,4.844-7.186,4.972-11.52l3.159-107.103C288.49,12.821,286.691,8.291,283.38,4.98z M247.831,130.706L123.128,255.407 c-1.785,1.785-4.679,1.785-6.464,0l-83.712-83.712c-1.785-1.785-1.785-4.679,0-6.464L157.654,40.529 c1.785-1.785,4.679-1.785,6.464,0l83.713,83.713C249.616,126.027,249.616,128.921,247.831,130.706z M263.56,47.691 c-6.321,6.322-16.57,6.322-22.892,0c-6.322-6.321-6.322-16.57,0-22.892c6.321-6.322,16.569-6.322,22.892,0 C269.882,31.121,269.882,41.37,263.56,47.691z"/><path d="M99.697,181.278c-5.457,2.456-8.051,3.32-10.006,1.364c-1.592-1.591-1.5-4.411,1.501-7.412 c1.458-1.458,2.927-2.52,4.26-3.298c1.896-1.106,2.549-3.528,1.467-5.438l-0.018-0.029c-0.544-0.96-1.455-1.658-2.522-1.939 c-1.067-0.279-2.202-0.116-3.147,0.453c-1.751,1.054-3.64,2.48-5.587,4.428c-7.232,7.23-7.595,15.599-2.365,20.829 c4.457,4.457,10.597,3.956,17.463,0.637c5.004-2.364,7.55-2.729,9.46-0.819c2.002,2.002,1.638,5.004-1.545,8.186 c-1.694,1.694-3.672,3.044-5.582,4.06c-0.994,0.528-1.728,1.44-2.027,2.525c-0.3,1.085-0.139,2.245,0.443,3.208l0.036,0.06 c1.143,1.889,3.575,2.531,5.503,1.457c2.229-1.241,4.732-3.044,6.902-5.215c8.412-8.412,8.002-16.736,2.864-21.875 C112.475,178.141,107.109,177.868,99.697,181.278z"/><path d="M150.245,157.91l-31.508-16.594c-1.559-0.821-3.47-0.531-4.716,0.714l-4.897,4.898c-1.25,1.25-1.537,3.169-0.707,4.73 l16.834,31.654c0.717,1.347,2.029,2.274,3.538,2.5c1.509,0.225,3.035-0.278,4.114-1.357c1.528-1.528,1.851-3.89,0.786-5.771 l-3.884-6.866l8.777-8.777l6.944,3.734c1.952,1.05,4.361,0.696,5.928-0.871c1.129-1.129,1.654-2.726,1.415-4.303 C152.63,160.023,151.657,158.653,150.245,157.91z M125.621,165.632c0,0-7.822-13.37-9.187-15.644l0.091-0.092 c2.274,1.364,15.872,8.959,15.872,8.959L125.621,165.632z"/><path d="M173.694,133.727c-1.092,0-2.139,0.434-2.911,1.205l-9.278,9.278l-21.352-21.352c-0.923-0.923-2.175-1.441-3.479-1.441 s-2.557,0.519-3.479,1.441c-1.922,1.922-1.922,5.037,0,6.958l24.331,24.332c1.57,1.569,4.115,1.569,5.685,0l13.395-13.395 c1.607-1.607,1.607-4.213,0-5.821C175.833,134.16,174.786,133.727,173.694,133.727z"/><path d="M194.638,111.35l-9.755,9.755l-7.276-7.277l8.459-8.458c1.557-1.558,1.557-4.081-0.001-5.639 c-1.557-1.557-4.082-1.557-5.639,0l-8.458,8.458l-6.367-6.366l9.117-9.117c1.57-1.57,1.57-4.115,0-5.686 c-0.754-0.755-1.776-1.179-2.843-1.179c-1.066,0-2.089,0.424-2.843,1.178l-13.234,13.233c-0.753,0.754-1.177,1.776-1.177,2.843 c0,1.066,0.424,2.089,1.178,2.843l24.968,24.968c1.57,1.569,4.115,1.569,5.685,0l13.87-13.87c1.57-1.57,1.57-4.115,0-5.686 C198.752,109.78,196.208,109.78,194.638,111.35z"/></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></svg></summary>
317
+ <span class="superpwa-promotion-close-btn"> &times; </span>
318
+ <div class="superpwa-ocassional-pop-up-contents">
319
+
320
+ <img src="<?php echo SUPERPWA_PATH_SRC.'public/images/offers.png'?>" class="superpwa-promotion-surprise-icon" />
321
+ <p class="superpwa-ocassional-pop-up-headline"><?php esc_html_e('40% OFF on ', 'super-progressive-web-apps')?><span><?php esc_html_e('SuperPWA PRO', 'super-progressive-web-apps')?></span></p>
322
+ <p class="superpwa-ocassional-pop-up-second-headline"><?php esc_html_e('Upgrade the PRO version during this festive season and get our biggest discount of all time on New Purchases, Renewals &amp; Upgrades', 'super-progressive-web-apps')?></p>
323
+ <a class="superpwa-ocassional-pop-up-offer-btn" href="<?php echo esc_url('https://superpwa.com/november-deal/')?>" target="_blank"><?php esc_html_e('Get This Offer Now', 'super-progressive-web-apps')?></a>
324
+ <p class="superpwa-ocassional-pop-up-last-line"><?php esc_html_e('Black Friday, Cyber Monday, Christmas &amp; New year are the only times we offer discounts this big.', 'super-progressive-web-apps')?></p>
325
+ </div>
326
+
327
+ </details>
328
+ <style>details#superpwa-ocassional-pop-up-container{position:fixed;right:1rem;bottom:1rem;margin-top:2rem;color:#6b7280;display:flex;flex-direction:column;z-index:99999}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents{background-color:#1e1e27;box-shadow:0 5px 10px rgba(0,0,0,.15);padding:25px 25px 10px;border-radius:8px;position:absolute;max-height:calc(100vh - 100px);width:350px;max-width:calc(100vw - 2rem);bottom:calc(100% + 1rem);right:0;overflow:auto;transform-origin:100% 100%;color:#95a3b9;margin-bottom:44px}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents::-webkit-scrollbar{width:15px;background-color:#1e1e27}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents::-webkit-scrollbar-thumb{width:5px;border-radius:99em;background-color:#95a3b9;border:5px solid #1e1e27}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents>*+*{margin-top:.75em}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p>code{font-size:1rem;font-family:monospace}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents pre{white-space:pre-line;border:1px solid #95a3b9;border-radius:6px;font-family:monospace;padding:.75em;font-size:.875rem;color:#fff}details#superpwa-ocassional-pop-up-container[open] div.superpwa-ocassional-pop-up-contents{bottom:0;-webkit-animation:.25s superpwa_ocassional_pop_up_scale;animation:.25s superpwa_ocassional_pop_up_scale}details#superpwa-ocassional-pop-up-container span.superpwa-promotion-close-btn{font-weight:400;font-size:20px;background:#37474f;font-family:sans-serif;border-radius:30px;color:#fff;position:absolute;right:-10px;z-index:99999;padding:0 8px;top:-311px;cursor:pointer;line-height:28px}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents img.superpwa-promotion-surprise-icon{width:40px;float:left;margin-right:10px}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-headline{font-size:21px;margin:0;line-height:47px;font-weight:500;color:#fff}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-headline span{color:#F04720;font-weight:700}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-second-headline{font-size:16px;color:#fff}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents a.superpwa-ocassional-pop-up-offer-btn{background:#1EB7E7;padding:13px 38px 14px;color:#fff;text-align:center;border-radius:60px;font-size:18px;display:inline-flex;align-items:center;margin:0 auto 15px;text-decoration:none;line-height:1.2;transform:perspective(1px) translateZ(0);box-shadow:0 0 20px 5px rgb(0 0 0 / 6%);transition:.3s ease-in-out;box-shadow:3px 5px .65em 0 rgb(0 0 0 / 15%);display:inherit}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-last-line{font-size:12px;color:#a6a6a6}details#superpwa-ocassional-pop-up-container summary{display:inline-flex;margin-left:auto;margin-right:auto;justify-content:center;align-items:center;font-weight:600;padding:.5em 1.25em;border-radius:99em;color:#fff;background-color:#185adb;box-shadow:0 5px 15px rgba(0,0,0,.1);list-style:none;text-align:center;cursor:pointer;transition:.15s;position:relative;font-size:.9rem;z-index:99999}details#superpwa-ocassional-pop-up-container summary::-webkit-details-marker{display:none}details#superpwa-ocassional-pop-up-container summary:hover,summary:focus{background-color:#1348af}details#superpwa-ocassional-pop-up-container summary svg{width:25px;margin-left:5px;vertical-align:baseline}@-webkit-keyframes superpwa_ocassional_pop_up_scale{0%{transform:superpwa_ocassional_pop_up_scale(0)}100%{transform:superpwa_ocassional_pop_up_scale(1)}}@keyframes superpwa_ocassional_pop_up_scale{0%{transform:superpwa_ocassional_pop_up_scale(0)}100%{transform:superpwa_ocassional_pop_up_scale(1)}}</style>
329
+ <script>function superpwa_set_admin_occasional_ads_pop_up_cookie(){var o=new Date;o.setFullYear(o.getFullYear()+1),document.cookie="superpwa_hide_admin_occasional_ads_pop_up_cookie_feedback=1; expires="+o.toUTCString()+"; path=/"}function superpwa_delete_admin_occasional_ads_pop_up_cookie(){document.cookie="superpwa_hide_admin_occasional_ads_pop_up_cookie_feedback=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function superpwa_get_admin_occasional_ads_pop_up_cookie(){for(var o="superpwa_hide_admin_occasional_ads_pop_up_cookie_feedback=",a=decodeURIComponent(document.cookie).split(";"),e=0;e<a.length;e++){for(var c=a[e];" "==c.charAt(0);)c=c.substring(1);if(0==c.indexOf(o))return c.substring(o.length,c.length)}return""}jQuery(function(o){var a=superpwa_get_admin_occasional_ads_pop_up_cookie();0==a&&""==a&&jQuery("details#superpwa-ocassional-pop-up-container").attr("open",1);void 0!==a&&""!==a&&o("details#superpwa-ocassional-pop-up-container").attr("open",!1),o("details#superpwa-ocassional-pop-up-container span.superpwa-promotion-close-btn").click(function(a){o("details#superpwa-ocassional-pop-up-container summary").click()}),o("details#superpwa-ocassional-pop-up-container summary").click(function(a){var e=o(this).parents("details#superpwa-ocassional-pop-up-container"),c=o(e).attr("open");void 0!==c&&!1!==c?superpwa_set_admin_occasional_ads_pop_up_cookie():superpwa_delete_admin_occasional_ads_pop_up_cookie()})});</script>
330
+
331
+ </div>
332
+ <?php
333
+ }
334
+
335
+ /**
336
+ * Find add-on status
337
+ *
338
+ * Returns one of these statuses:
339
+ * active when the add-on is installed and active.
340
+ * inactive when the add-on is installed but not activated.
341
+ * uninstalled when the add-on is not installed and not available.
342
+ *
343
+ * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
344
+ * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
345
+ *
346
+ * @return (string) one of the statuses as described above. False if $slug is not a valid add-on.
347
+ *
348
+ * @since 1.7
349
+ */
350
+ function superpwa_addons_status( $slug ) {
351
+
352
+ // Get add-on details
353
+ $addon = superpwa_get_addons( $slug );
354
+
355
+ // A security check to make sure that the add-on under consideration exist.
356
+ if ( $addon === false ) {
357
+ return false;
358
+ }
359
+
360
+ // Get active add-ons
361
+ $active_addons = get_option( 'superpwa_active_addons', array() );
362
+
363
+ switch( $addon['type'] ) {
364
+
365
+ // Bundled add-ons ships with SuperPWA and need not be installed separately.
366
+ case 'bundled':
367
+
368
+ // True means, add-on is installed and active
369
+ if ( in_array( $slug, $active_addons ) ) {
370
+ return 'active';
371
+ }
372
+
373
+ // add-on is installed, but inactive
374
+ return 'inactive';
375
+
376
+ break;
377
+
378
+ // Add-ons installed as a separate plugin
379
+ case 'addon':
380
+
381
+ // True means, add-on is installed and active
382
+ if ( is_plugin_active( $slug ) ) {
383
+ return 'active';
384
+ }
385
+
386
+ // Add-on is inactive, check if add-on is installed
387
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
388
+ return 'inactive';
389
+ }
390
+
391
+ // If we are here, add-on is not installed and not active
392
+ return 'uninstalled';
393
+
394
+ break;
395
+ // Add-ons pro installed as a separate plugin
396
+ case 'addon_pro':
397
+ $pro_plugin = 'super-progressive-web-apps-pro/super-progressive-web-apps-pro.php';
398
+ // True means, add-on is installed and active
399
+ if ( is_plugin_active( $pro_plugin ) ) {
400
+ // True means, add-on is installed and active
401
+ if ( in_array( $slug, $active_addons ) ) {
402
+ return 'active';
403
+ }
404
+ return 'inactive';
405
+ }
406
+
407
+
408
+ // Add-on is inactive, check if add-on is installed
409
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $pro_plugin ) ) {
410
+ return 'upgrade';
411
+ }
412
+
413
+ // If we are here, add-on is not installed and not active
414
+ return 'upgrade';
415
+
416
+
417
+
418
+ break;
419
+
420
+ default:
421
+ return false;
422
+ break;
423
+ }
424
+ }
425
+
426
+ /**
427
+ * Button text based on add-on status
428
+ *
429
+ * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
430
+ * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
431
+ *
432
+ * @return (string) 'Activate', if plugin status is 'inactive'
433
+ * 'Deactivate', if plugin status is 'active'
434
+ * 'Install', if plugin status is 'uninstalled'
435
+ *
436
+ * @since 1.7
437
+ */
438
+ function superpwa_addons_button_text( $slug ) {
439
+
440
+ // Get the add-on status
441
+ $addon_status = superpwa_addons_status( $slug );
442
+
443
+ switch( $addon_status ) {
444
+
445
+ case 'inactive':
446
+ return __( 'Activate', 'super-progressive-web-apps' );
447
+ break;
448
+
449
+ case 'active':
450
+ return __( 'Deactivate', 'super-progressive-web-apps' );
451
+ break;
452
+
453
+ case 'upgrade':
454
+ return __( 'Upgrade to PRO', 'super-progressive-web-apps' );
455
+ break;
456
+ case 'uninstalled':
457
+ default: // Safety net for edge cases if any.
458
+ return __( 'Install', 'super-progressive-web-apps' );
459
+ break;
460
+ }
461
+ }
462
+
463
+ /**
464
+ * Action URL based on add-on status
465
+ *
466
+ * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
467
+ * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
468
+ *
469
+ * @return (string) activation / deactivation / install url with nonce as necessary
470
+ *
471
+ * @since 1.7
472
+ */
473
+ function superpwa_addons_button_link( $slug ) {
474
+
475
+ // Get the add-on status
476
+ $addon_status = superpwa_addons_status( $slug );
477
+
478
+ // Get add-on details
479
+ $addon = superpwa_get_addons( $slug );
480
+
481
+ switch( $addon_status ) {
482
+
483
+ // Add-on inactive, send activation link.
484
+ case 'inactive':
485
+
486
+ // Plugin activation link for add-on plugins that are installed separately.
487
+ if ( $addon['type'] == 'addon' ) {
488
+ wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $slug ), 'activate-plugin_' . $slug );
489
+ }
490
+
491
+ // Activation link for bundled add-ons.
492
+ return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_activate_addon&addon=' . $slug ), 'activate', 'superpwa_addon_activate_nonce' );
493
+
494
+ break;
495
+
496
+ // Add-on active, send deactivation link.
497
+ case 'active':
498
+
499
+ // Plugin deactivation link for add-on plugins that are installed separately.
500
+ if ( $addon['type'] == 'addon' ) {
501
+ wp_nonce_url( admin_url( 'plugins.php?action=deactivate&plugin=' . $slug ), 'deactivate-plugin_' . $slug );
502
+ }
503
+
504
+ // Deactivation link for bundled add-ons.
505
+ return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_deactivate_addon&addon=' . $slug ), 'deactivate', 'superpwa_addon_deactivate_nonce' );
506
+
507
+ break;
508
+
509
+ // If add-on is not installed and for edge cases where $addon_status is false, we use the add-on link.
510
+ case 'uninstalled':
511
+ case 'upgrade':
512
+ default:
513
+ return $addon['link'];
514
+ break;
515
+ }
516
+ }
517
+
518
+ /**
519
+ * Handle add-on activation
520
+ *
521
+ * Verifies that the activation request is valid and then redirects the page back to the add-ons page.
522
+ * Hooked onto admin_post_superpwa_activate_addon action hook
523
+ *
524
+ * @since 1.7
525
+ * @since 1.8 Handles only activation. Used to handle both activation and deactivation.
526
+ * @since 1.8 Hooked onto admin_post_superpwa_activate_addon. Was hooked to load-superpwa_page_superpwa-addons before.
527
+ */
528
+ function superpwa_addons_handle_activation() {
529
+
530
+ // Get the add-on status
531
+ $addon_status = superpwa_addons_status( $_GET['addon'] );
532
+
533
+ // Authentication
534
+ if (
535
+ ! current_user_can( 'manage_options' ) ||
536
+ ! isset( $_GET['addon'] ) ||
537
+ ! ( isset( $_GET['superpwa_addon_activate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_activate_nonce'], 'activate' ) ) ||
538
+ ! ( $addon_status == 'inactive' )
539
+ ) {
540
+
541
+ // Return to referer if authentication fails.
542
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
543
+ exit;
544
+ }
545
+
546
+ // Get active add-ons
547
+ $active_addons = get_option( 'superpwa_active_addons', array() );
548
+
549
+ // Add the add-on to the list of active add-ons
550
+ $active_addons[] = $_GET['addon'];
551
+
552
+ // Write settings back to database
553
+ update_option( 'superpwa_active_addons', $active_addons );
554
+
555
+ // Redirect back to add-ons sub-menu
556
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons&activated=1&addon=' . $_GET['addon'] ) );
557
+ exit;
558
+ }
559
+ add_action( 'admin_post_superpwa_activate_addon', 'superpwa_addons_handle_activation' );
560
+
561
+ /**
562
+ * Handle add-on deactivation
563
+ *
564
+ * Verifies that the deactivation request is valid and then redirects the page back to the add-ons page.
565
+ * Hooked onto admin_post_superpwa_deactivate_addon action hook.
566
+ *
567
+ * @since 1.8
568
+ */
569
+ function superpwa_addons_handle_deactivation() {
570
+
571
+ // Get the add-on status
572
+ $addon_status = superpwa_addons_status( $_GET['addon'] );
573
+
574
+ // Authentication
575
+ if (
576
+ ! current_user_can( 'manage_options' ) ||
577
+ ! isset( $_GET['addon'] ) ||
578
+ ! ( isset( $_GET['superpwa_addon_deactivate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_deactivate_nonce'], 'deactivate' ) ) ||
579
+ ! ( $addon_status == 'active' )
580
+ ) {
581
+
582
+ // Return to referer if authentication fails.
583
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
584
+ exit;
585
+ }
586
+
587
+ // Get active add-ons
588
+ $active_addons = get_option( 'superpwa_active_addons', array() );
589
+
590
+ // Delete the add-on from the active_addons array in SuperPWA settings.
591
+ $active_addons = array_flip( $active_addons );
592
+ unset( $active_addons[ $_GET['addon'] ] );
593
+ $active_addons = array_flip( $active_addons );
594
+
595
+ // Write settings back to database
596
+ update_option( 'superpwa_active_addons', $active_addons );
597
+
598
+ // Add-on deactivation action. Functions defined in the add-on file are still availalbe at this point.
599
+ do_action( 'superpwa_addon_deactivated_' . $_GET['addon'] );
600
+
601
+ // Redirect back to add-ons sub-menu
602
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons&deactivated=1&addon=' . $_GET['addon'] ) );
603
+ exit;
604
+ }
605
+ add_action( 'admin_post_superpwa_deactivate_addon', 'superpwa_addons_handle_deactivation' );
606
+
607
+ /**
608
+ * Handle newsletter submit
609
+ *
610
+ *
611
+ * @since 2.1.5
612
+ */
613
+ function superpwa_newsletter_submit(){
614
+ global $current_user;
615
+ $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
616
+ $api_params = array(
617
+ 'name' => esc_attr($current_user->display_name),
618
+ 'email'=> sanitize_text_field($_POST['email']),
619
+ 'website'=> sanitize_text_field( get_site_url() ),
620
+ 'type'=> 'superpwa'
621
+ );
622
+ $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
623
+ $response = wp_remote_retrieve_body( $response );
624
+ echo json_encode(array('status'=>200, 'message'=>'Submitted ', 'response'=> $response));
625
+ die;
626
+ }
627
+ add_action( 'wp_ajax_superpwa_newsletter_submit', 'superpwa_newsletter_submit' );
628
+ add_action( 'wp_ajax_nopriv_superpwa_newsletter_submit', 'superpwa_newsletter_submit' );
629
+
630
+ function superpwa_newsletter_hide_form(){
631
+
632
+ $hide_newsletter = get_option('superpwa_hide_newsletter');
633
+ if($hide_newsletter == false){
634
+ add_option( 'superpwa_hide_newsletter', 'no' );
635
+ }
636
+ update_option( 'superpwa_hide_newsletter', 'yes' );
637
+ echo json_encode(array('status'=>200, 'message'=>'Submitted '));
638
+ die;
639
+ }
640
+ add_action( 'wp_ajax_superpwa_newsletter_hide_form', 'superpwa_newsletter_hide_form' );
641
  add_action( 'wp_ajax_nopriv_superpwa_newsletter_hide_form', 'superpwa_newsletter_hide_form' );
admin/admin-ui-render-settings.php CHANGED
@@ -1,783 +1,810 @@
1
- <?php
2
- /**
3
- * Admin UI setup and render
4
- *
5
- * @since 1.0
6
- *
7
- * @function superpwa_app_name_cb() Application Name
8
- * @function superpwa_app_short_name_cb() Application Short Name
9
- * @function superpwa_description_cb() Description
10
- * @function superpwa_background_color_cb() Splash Screen Background Color
11
- * @function superpwa_theme_color_cb() Theme Color
12
- * @function superpwa_app_icon_cb() Application Icon
13
- * @function superpwa_app_icon_cb() Splash Screen Icon
14
- * @function superpwa_app_screenshots_cb() Screenshots Icon
15
- * @function superpwa_start_url_cb() Start URL Dropdown
16
- * @function superpwa_app_category_cb() App Category Dropdown
17
- * @function superpwa_offline_page_cb() Offline Page Dropdown
18
- * @function superpwa_orientation_cb() Default Orientation Dropdown
19
- * @function superpwa_display_cb() Default Display Dropdown
20
- * @function superpwa_text_direction_cb() Text Direction Dropdown
21
- * @function superpwa_manifest_status_cb() Manifest Status
22
- * @function superpwa_sw_status_cb() Service Worker Status
23
- * @function superpwa_https_status_cb() HTTPS Status
24
- * @function superpwa_disable_add_to_home_cb() Disable Add to home
25
- * @function superpwa_admin_interface_render() Admin interface renderer
26
- */
27
-
28
- // Exit if accessed directly
29
- if ( ! defined( 'ABSPATH' ) ) exit;
30
-
31
- /**
32
- * Application Name
33
- *
34
- * @since 1.2
35
- */
36
- function superpwa_app_name_cb() {
37
-
38
- // Get Settings
39
- $settings = superpwa_get_settings(); ?>
40
-
41
- <fieldset>
42
-
43
- <input type="text" name="superpwa_settings[app_name]" class="regular-text" value="<?php if ( isset( $settings['app_name'] ) && ( ! empty($settings['app_name']) ) ) echo esc_attr($settings['app_name']); ?>"/>
44
-
45
- </fieldset>
46
-
47
- <?php
48
- }
49
-
50
- /**
51
- * Application Short Name
52
- *
53
- * @since 1.2
54
- */
55
- function superpwa_app_short_name_cb() {
56
-
57
- // Get Settings
58
- $settings = superpwa_get_settings(); ?>
59
-
60
- <fieldset>
61
-
62
- <input type="text" name="superpwa_settings[app_short_name]" class="regular-text superpwa-app-short-name" value="<?php if ( isset( $settings['app_short_name'] ) && ( ! empty($settings['app_short_name']) ) ) echo esc_attr($settings['app_short_name']); ?>"/>
63
-
64
- <p class="description">
65
- <?php _e('Used when there is insufficient space to display the full name of the application. <span id="superpwa-app-short-name-limit"><code>15</code> characters or less.</span>', 'super-progressive-web-apps'); ?>
66
- </p>
67
-
68
- </fieldset>
69
-
70
- <?php
71
- }
72
-
73
- /**
74
- * Description
75
- *
76
- * @since 1.6
77
- */
78
- function superpwa_description_cb() {
79
-
80
- // Get Settings
81
- $settings = superpwa_get_settings(); ?>
82
-
83
- <fieldset>
84
-
85
- <input type="text" name="superpwa_settings[description]" class="regular-text" value="<?php if ( isset( $settings['description'] ) && ( ! empty( $settings['description'] ) ) ) echo esc_attr( $settings['description'] ); ?>"/>
86
-
87
- <p class="description">
88
- <?php _e( 'A brief description of what your app is about.', 'super-progressive-web-apps' ); ?>
89
- </p>
90
-
91
- </fieldset>
92
-
93
- <?php
94
- }
95
-
96
- /**
97
- * Application Icon
98
- *
99
- * @since 1.0
100
- */
101
- function superpwa_app_icon_cb() {
102
-
103
- // Get Settings
104
- $settings = superpwa_get_settings(); ?>
105
-
106
- <!-- Application Icon -->
107
- <input type="text" name="superpwa_settings[icon]" id="superpwa_settings[icon]" class="superpwa-icon regular-text" size="50" value="<?php echo isset( $settings['icon'] ) ? esc_attr( $settings['icon']) : ''; ?>">
108
- <button type="button" class="button superpwa-icon-upload" data-editor="content">
109
- <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
110
- </button>
111
-
112
- <p class="description">
113
- <?php _e('This will be the icon of your app when installed on the phone. Must be a <code>PNG</code> image exactly <code>192x192</code> in size.', 'super-progressive-web-apps'); ?>
114
- </p>
115
-
116
- <?php
117
- }
118
-
119
- /**
120
- * Splash Screen Icon
121
- *
122
- * @since 1.3
123
- */
124
- function superpwa_splash_icon_cb() {
125
-
126
- // Get Settings
127
- $settings = superpwa_get_settings(); ?>
128
-
129
- <!-- Splash Screen Icon -->
130
- <input type="text" name="superpwa_settings[splash_icon]" id="superpwa_settings[splash_icon]" class="superpwa-splash-icon regular-text" size="50" value="<?php echo isset( $settings['splash_icon'] ) ? esc_attr( $settings['splash_icon']) : ''; ?>">
131
- <button type="button" class="button superpwa-splash-icon-upload" data-editor="content">
132
- <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
133
- </button>
134
-
135
- <p class="description">
136
- <?php _e('This icon will be displayed on the splash screen of your app on supported devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in size.', 'super-progressive-web-apps'); ?>
137
- </p>
138
-
139
- <?php
140
- }
141
-
142
- /**
143
- * Screenshots Icon
144
- *
145
- * @since 1.0
146
- */
147
- function superpwa_app_screenshots_cb() {
148
-
149
- // Get Settings
150
- $settings = superpwa_get_settings(); ?>
151
-
152
- <!-- Application Icon -->
153
- <input type="text" name="superpwa_settings[screenshots]" id="superpwa_settings[screenshots]" class="superpwa-screenshots regular-text" size="50" value="<?php echo isset( $settings['screenshots'] ) ? esc_attr( $settings['screenshots']) : ''; ?>">
154
- <button type="button" class="button superpwa-screenshots-upload" data-editor="content">
155
- <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Screenshots', 'super-progressive-web-apps' ); ?>
156
- </button>
157
-
158
- <p class="description">
159
- <?php _e('This will be the screenshots of your app when installed on the phone. Must be a <code>PNG</code> image exactly <code>512x512</code> in size.', 'super-progressive-web-apps'); ?>
160
- </p>
161
-
162
- <?php
163
- }
164
-
165
- /**
166
- * Splash Screen Background Color
167
- *
168
- * @since 1.0
169
- */
170
- function superpwa_background_color_cb() {
171
-
172
- // Get Settings
173
- $settings = superpwa_get_settings(); ?>
174
-
175
- <!-- Background Color -->
176
- <input type="text" name="superpwa_settings[background_color]" id="superpwa_settings[background_color]" class="superpwa-colorpicker" value="<?php echo isset( $settings['background_color'] ) ? esc_attr( $settings['background_color']) : '#D5E0EB'; ?>" data-default-color="#D5E0EB">
177
-
178
- <p class="description">
179
- <?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?>
180
- </p>
181
-
182
- <?php
183
- }
184
-
185
- /**
186
- * Theme Color
187
- *
188
- * @since 1.4
189
- */
190
- function superpwa_theme_color_cb() {
191
-
192
- // Get Settings
193
- $settings = superpwa_get_settings(); ?>
194
-
195
- <!-- Theme Color -->
196
- <input type="text" name="superpwa_settings[theme_color]" id="superpwa_settings[theme_color]" class="superpwa-colorpicker" value="<?php echo isset( $settings['theme_color'] ) ? esc_attr( $settings['theme_color']) : '#D5E0EB'; ?>" data-default-color="#D5E0EB">
197
-
198
- <p class="description">
199
- <?php _e('Theme color is used on supported devices to tint the UI elements of the browser and app switcher. When in doubt, use the same color as <code>Background Color</code>.', 'super-progressive-web-apps'); ?>
200
- </p>
201
-
202
- <?php
203
- }
204
-
205
- /**
206
- * Start URL Dropdown
207
- *
208
- * @since 1.2
209
- */
210
- function superpwa_start_url_cb() {
211
-
212
- // Get Settings
213
- $settings = superpwa_get_settings(); ?>
214
-
215
- <fieldset>
216
-
217
- <!-- WordPress Pages Dropdown -->
218
- <label for="superpwa_settings[start_url]">
219
- <?php echo wp_dropdown_pages( array(
220
- 'name' => 'superpwa_settings[start_url]',
221
- 'echo' => 0,
222
- 'show_option_none' => __( '&mdash; Homepage &mdash;' ),
223
- 'option_none_value' => '0',
224
- 'selected' => isset($settings['start_url']) ? $settings['start_url'] : '',
225
- )); ?>
226
- </label>
227
-
228
- <p class="description">
229
- <?php printf( __( 'Specify the page to load when the application is launched from a device. Current start page is <code>%s</code>', 'super-progressive-web-apps' ), superpwa_get_start_url() ); ?>
230
- </p>
231
-
232
- <?php if ( superpwa_is_amp() ) { ?>
233
-
234
- <!-- AMP Page As Start Page -->
235
- <br><input type="checkbox" name="superpwa_settings[start_url_amp]" id="superpwa_settings[start_url_amp]" value="1"
236
- <?php if ( isset( $settings['start_url_amp'] ) ) { checked( '1', $settings['start_url_amp'] ); } ?>>
237
- <label for="superpwa_settings[start_url_amp]"><?php _e('Use AMP version of the start page.', 'super-progressive-web-apps') ?></label>
238
- <br>
239
-
240
- <!-- AMP for WordPress 0.6.2 doesn't support homepage, the blog index, and archive pages. -->
241
- <?php if ( is_plugin_active( 'amp/amp.php' ) ) { ?>
242
- <p class="description">
243
- <?php _e( 'Do not check this if your start page is the homepage, the blog index, or the archives page. AMP for WordPress does not create AMP versions for these pages.', 'super-progressive-web-apps' ); ?>
244
- </p>
245
- <?php } ?>
246
-
247
- <!-- tagDiv AMP 1.2 doesn't enable AMP for pages by default and needs to be enabled manually in settings -->
248
- <?php if ( is_plugin_active( 'td-amp/td-amp.php' ) && method_exists( 'td_util', 'get_option' ) ) {
249
-
250
- // Read option value from db
251
- $td_amp_page_post_type = td_util::get_option( 'tds_amp_post_type_page' );
252
-
253
- // Show notice if option to enable AMP for pages is disabled.
254
- if ( empty( $td_amp_page_post_type ) ) { ?>
255
- <p class="description">
256
- <?php printf( __( 'Please enable AMP support for Page in <a href="%s">Theme Settings > Theme Panel</a> > AMP > Post Type Support.', 'super-progressive-web-apps' ), admin_url( 'admin.php?page=td_theme_panel' ) ); ?>
257
- </p>
258
- <?php }
259
- } ?>
260
-
261
- <?php } ?>
262
-
263
- </fieldset>
264
-
265
- <?php
266
- }
267
-
268
- /**
269
- * App Category Dropdown
270
- *
271
- * @since 1.2
272
- */
273
- function superpwa_app_category_cb() {
274
-
275
- // Get Settings
276
- $settings = superpwa_get_settings(); ?>
277
-
278
- <fieldset>
279
-
280
- <!-- WordPress Pages Dropdown -->
281
- <label for="superpwa_settings[app_category]">
282
- <?php
283
- echo wp_dropdown_categories( array(
284
- 'name' => 'superpwa_settings[app_category]',
285
- 'echo' => 0,
286
- 'show_option_none' => __( '&mdash; Default &mdash;' ),
287
- 'taxonomy' => 'category',
288
- 'option_none_value' => '0',
289
- 'selected' => isset($settings['app_category']) ? $settings['app_category'] : '',
290
- )); ?>
291
- </label>
292
-
293
- </fieldset>
294
-
295
- <?php
296
- }
297
-
298
- /**
299
- * Offline Page Dropdown
300
- *
301
- * @since 1.1
302
- */
303
- function superpwa_offline_page_cb() {
304
-
305
- // Get Settings
306
- $settings = superpwa_get_settings(); ?>
307
-
308
- <!-- WordPress Pages Dropdown -->
309
- <label for="superpwa_settings[offline_page]">
310
- <?php echo wp_dropdown_pages( array(
311
- 'name' => 'superpwa_settings[offline_page]',
312
- 'echo' => 0,
313
- 'show_option_none' => __( '&mdash; Default &mdash;' ),
314
- 'option_none_value' => '0',
315
- 'selected' => isset($settings['offline_page']) ? $settings['offline_page'] : '',
316
- )); ?>
317
- </label>
318
-
319
- <p class="description">
320
- <?php printf( __( 'Offline page is displayed when the device is offline and the requested page is not already cached. Current offline page is <code>%s</code>', 'super-progressive-web-apps' ), superpwa_get_offline_page() ); ?>
321
- </p>
322
-
323
- <?php
324
- }
325
-
326
- /**
327
- * Default Orientation Dropdown
328
- *
329
- * @since 1.4
330
- */
331
- function superpwa_orientation_cb() {
332
-
333
- // Get Settings
334
- $settings = superpwa_get_settings(); ?>
335
-
336
- <!-- Orientation Dropdown -->
337
- <label for="superpwa_settings[orientation]">
338
- <select name="superpwa_settings[orientation]" id="superpwa_settings[orientation]">
339
- <option value="0" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 0 ); } ?>>
340
- <?php _e( 'Follow Device Orientation', 'super-progressive-web-apps' ); ?>
341
- </option>
342
- <option value="1" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 1 ); } ?>>
343
- <?php _e( 'Portrait', 'super-progressive-web-apps' ); ?>
344
- </option>
345
- <option value="2" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 2 ); } ?>>
346
- <?php _e( 'Landscape', 'super-progressive-web-apps' ); ?>
347
- </option>
348
- </select>
349
- </label>
350
-
351
- <p class="description">
352
- <?php _e( 'Set the orientation of your app on devices. When set to <code>Follow Device Orientation</code> your app will rotate as the device is rotated.', 'super-progressive-web-apps' ); ?>
353
- </p>
354
-
355
- <?php
356
- }
357
-
358
- /**
359
- * Default Display Dropdown
360
- *
361
- * @author Jose Varghese
362
- *
363
- * @since 2.0
364
- */
365
- function superpwa_display_cb() {
366
-
367
- // Get Settings
368
- $settings = superpwa_get_settings(); ?>
369
-
370
- <!-- Display Dropdown -->
371
- <label for="superpwa_settings[display]">
372
- <select name="superpwa_settings[display]" id="superpwa_settings[display]">
373
- <option value="0" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 0 ); } ?>>
374
- <?php _e( 'Full Screen', 'super-progressive-web-apps' ); ?>
375
- </option>
376
- <option value="1" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 1 ); } ?>>
377
- <?php _e( 'Standalone', 'super-progressive-web-apps' ); ?>
378
- </option>
379
- <option value="2" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 2 ); } ?>>
380
- <?php _e( 'Minimal UI', 'super-progressive-web-apps' ); ?>
381
- </option>
382
- <option value="3" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 3 ); } ?>>
383
- <?php _e( 'Browser', 'super-progressive-web-apps' ); ?>
384
- </option>
385
- </select>
386
- </label>
387
-
388
- <p class="description">
389
- <?php printf( __( 'Display mode decides what browser UI is shown when your app is launched. <code>Standalone</code> is default. <a href="%s" target="_blank">What\'s the difference? &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', 'https://superpwa.com/doc/web-app-manifest-display-modes/?utm_source=superpwa-plugin&utm_medium=settings-display' ); ?>
390
- </p>
391
-
392
- <?php
393
- }
394
-
395
- /**
396
- * Text Direction Dropdown
397
- *
398
- * @author Jose Varghese
399
- *
400
- * @since 2.0
401
- */
402
- function superpwa_text_direction_cb() {
403
-
404
- // Get Settings
405
- $settings = superpwa_get_settings(); ?>
406
-
407
- <!-- Display Dropdown -->
408
- <label for="superpwa_settings[text_dir]">
409
- <select name="superpwa_settings[text_dir]" id="superpwa_settings[display]">
410
- <option value="0" <?php if ( isset( $settings['text_dir'] ) ) { selected( $settings['text_dir'], 0 ); } ?>>
411
- <?php _e( 'LTR', 'super-progressive-web-apps' ); ?>
412
- </option>
413
- <option value="1" <?php if ( isset( $settings['text_dir'] ) ) { selected( $settings['text_dir'], 1 ); } ?>>
414
- <?php _e( 'RTL', 'super-progressive-web-apps' ); ?>
415
- </option>
416
- </select>
417
- </label>
418
-
419
- <p class="description">
420
- <?php printf( __( 'The text direction of your PWA', 'super-progressive-web-apps' )); ?>
421
- </p>
422
-
423
- <?php
424
- }
425
-
426
- /**
427
- * Manifest Status
428
- *
429
- * @author Arun Basil Lal
430
- *
431
- * @since 1.2
432
- * @since 1.8 Attempt to generate manifest again if the manifest doesn't exist.
433
- * @since 2.0 Remove logic to check if manifest exists in favour of dynamic manifest.
434
- * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
435
- */
436
- function superpwa_manifest_status_cb() {
437
-
438
- /**
439
- * Check to see if the file exists, If not attempts to generate a new one.
440
- */
441
- if ( superpwa_file_exists( superpwa_manifest( 'src' ) ) || superpwa_generate_manifest() ) {
442
-
443
- printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Manifest generated successfully. You can <a href="%s" target="_blank">See it here &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', superpwa_manifest( 'src' ) );
444
- } else {
445
-
446
- printf( '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __( 'Manifest generation failed. <a href="%s" target="_blank">Fix it &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', 'https://superpwa.com/doc/fixing-manifest-service-worker-generation-failed-error/?utm_source=superpwa-plugin&utm_medium=settings-status-no-manifest' );
447
- }
448
- }
449
-
450
- /**
451
- * Service Worker Status
452
- *
453
- * @author Arun Basil Lal
454
- *
455
- * @since 1.2
456
- * @since 1.8 Attempt to generate service worker again if it doesn't exist.
457
- * @since 2.0 Modify logic to check if Service worker exists.
458
- * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
459
- */
460
- function superpwa_sw_status_cb() {
461
-
462
- /**
463
- * Check to see if the file exists, If not attempts to generate a new one.
464
- */
465
- if ( superpwa_file_exists( superpwa_sw( 'src' ) ) || superpwa_generate_sw() ) {
466
-
467
- printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Service worker generated successfully. <a href="%s" target="_blank">See it here &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', superpwa_sw( 'src' ) );
468
- } else {
469
-
470
- printf( '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __( 'Service worker generation failed. <a href="%s" target="_blank">Fix it &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', 'https://superpwa.com/doc/fixing-manifest-service-worker-generation-failed-error/?utm_source=superpwa-plugin&utm_medium=settings-status-no-sw' );
471
- }
472
- }
473
-
474
- /**
475
- * HTTPS Status
476
- *
477
- * @since 1.2
478
- */
479
- function superpwa_https_status_cb() {
480
-
481
- if ( is_ssl() ) {
482
-
483
- printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Your website is served over HTTPS.', 'super-progressive-web-apps' ) . '</p>' );
484
- } else {
485
-
486
- printf( '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __( 'Progressive Web Apps require that your website is served over HTTPS. Please contact your host to add a SSL certificate to your domain.', 'super-progressive-web-apps' ) . '</p>' );
487
- }
488
- }
489
-
490
-
491
- /**
492
- * Admin can disable the add to home bar
493
- *
494
- * @since 2.1.4
495
- */
496
- function superpwa_disable_add_to_home_cb() {
497
- // Get Settings
498
- $settings = superpwa_get_settings();
499
- ?><input type="checkbox" name="superpwa_settings[disable_add_to_home]" id="superpwa_settings[disable_add_to_home]" value="1"
500
- <?php if ( isset( $settings['disable_add_to_home'] ) ) { checked( '1', $settings['disable_add_to_home'] ); } ?>>
501
- <label for="superpwa_settings[disable_add_to_home]"><?php _e('Remove default banner', 'super-progressive-web-apps') ?></label>
502
- <br>
503
- <?php
504
- }
505
-
506
- /**
507
- * App Shortcut link Dropdown
508
- *
509
- * @since 1.2
510
- */
511
- function superpwa_app_shortcut_link_cb() {
512
-
513
- // Get Settings
514
- $settings = superpwa_get_settings(); ?>
515
-
516
- <fieldset>
517
-
518
- <!-- WordPress Pages Dropdown -->
519
- <label for="superpwa_settings[shortcut_url]">
520
- <?php echo wp_dropdown_pages( array(
521
- 'name' => 'superpwa_settings[shortcut_url]',
522
- 'echo' => 0,
523
- 'show_option_none' => __( 'Select Page' ),
524
- 'option_none_value' => '0',
525
- 'selected' => isset($settings['shortcut_url']) ? $settings['shortcut_url'] : '',
526
- )); ?>
527
- </label>
528
-
529
- <p class="description">
530
- <?php echo __( 'Specify the page to load when the application is launched via Shortcut.', 'super-progressive-web-apps' ); ?>
531
- </p>
532
- </fieldset>
533
-
534
- <?php
535
- }
536
-
537
- /**
538
- * Enable or disable the yandex support
539
- *
540
- * @since 2.1.4
541
- */
542
- function superpwa_yandex_support_cb() {
543
- // Get Settings
544
- $settings = superpwa_get_settings();
545
- ?><input type="checkbox" name="superpwa_settings[yandex_support]" id="superpwa_settings[yandex_support]" value="1"
546
- <?php if ( isset( $settings['yandex_support'] ) ) { checked( '1', $settings['yandex_support'] ); } ?>>
547
- <br>
548
- <?php
549
- }
550
- /**
551
- * Enable or disable the analytics support
552
- *
553
- * @since 2.1.5
554
- */
555
- function superpwa_analytics_support_cb() {
556
- // Get Settings
557
- $settings = superpwa_get_settings();
558
- ?><input type="checkbox" name="superpwa_settings[analytics_support]" id="superpwa_settings[analytics_support]" value="1"
559
- <?php if ( isset( $settings['analytics_support'] ) ) { checked( '1', $settings['analytics_support'] ); } ?>>
560
- <br>
561
- <?php
562
- }
563
-
564
- /**
565
- * Enable or disable cache external urls support
566
- *
567
- * @since 2.1.6
568
- */
569
- function superpwa_cache_external_urls_support_cb() {
570
- // Get Settings
571
- $settings = superpwa_get_settings();
572
- ?><input type="checkbox" name="superpwa_settings[cache_external_urls]" id="superpwa_settings[cache_external_urls]" value="1"
573
- <?php if ( isset( $settings['cache_external_urls'] ) ) { checked( '1', $settings['cache_external_urls'] ); } ?>>
574
- <br>
575
- <?php
576
- }
577
-
578
- /**
579
- * Exclude Urls from Cache list of service worker
580
- *
581
- * @since 2.1.2
582
- */
583
-
584
- function superpwa_exclude_url_cache_cb(){
585
- // Get Settings
586
- $settings = superpwa_get_settings();
587
- ?>
588
- <label><textarea placeholder="https://example.com/contact-us/, https://example.com/checkout/" rows="4" cols="70" id="superpwa_settings[excluded_urls]" name="superpwa_settings[excluded_urls]"><?php echo (isset($settings['excluded_urls']) ? esc_attr($settings['excluded_urls']): ''); ?></textarea></label>
589
- <p><?php echo esc_html__('Note: Seperate the URLs using a Comma(,)', 'super-progressive-web-apps'); ?></p>
590
- <p><?php echo esc_html__('Place the list of URLs which you do not want to cache by service worker', 'super-progressive-web-apps'); ?></p>
591
-
592
- <?php
593
- }
594
-
595
- /**
596
- * Exclude add to home screen popup on particular pages
597
- *
598
- * @since 2.1.19
599
- */
600
-
601
- function superpwa_exclude_add_to_homescreen_cb(){
602
- // Get Settings
603
- $settings = superpwa_get_settings();
604
- ?>
605
- <label><textarea placeholder="https://example.com/contact-us/, https://example.com/checkout/" rows="4" cols="70" id="superpwa_settings[exclude_homescreen]" name="superpwa_settings[exclude_homescreen]"><?php echo (isset($settings['exclude_homescreen']) ? esc_attr($settings['exclude_homescreen']): ''); ?></textarea></label>
606
- <p><?php echo esc_html__('Note: Seperate the URLs using a Comma(,)', 'super-progressive-web-apps'); ?></p>
607
- <p><?php echo esc_html__('Place the list of URLs on which add to homescreen will be hidden', 'super-progressive-web-apps'); ?></p>
608
-
609
- <?php
610
- }
611
-
612
- function superpwa_reset_settings_cb(){
613
- ?>
614
- <button class="button superpwa-reset-settings">
615
- <?php echo esc_html__('Reset','super-progressive-web-apps'); ?>
616
- </button>
617
-
618
- <?php
619
- }
620
-
621
- /**
622
- * Force Update Service Worker
623
- *
624
- * @since 2.1.6
625
- */
626
-
627
- function superpwa_force_update_sw_cb(){
628
- // Get Settings
629
- $settings = superpwa_get_settings();
630
- ?>
631
- <label><input type="text" id="superpwa_settings[force_update_sw_setting]" name="superpwa_settings[force_update_sw_setting]" value="<?php if(isset($settings['force_update_sw_setting'])){
632
- if(!version_compare($settings['force_update_sw_setting'],SUPERPWA_VERSION, '>=') ){
633
- $settings['force_update_sw_setting'] = SUPERPWA_VERSION;
634
- }
635
- echo esc_attr($settings['force_update_sw_setting']);
636
- }else{ echo SUPERPWA_VERSION; } ?>"></label>
637
- <code>Current Version <?php echo SUPERPWA_VERSION; ?></code>
638
- <p><?php echo esc_html__('Update the version number. It will automatically re-install the service worker for all the users', 'super-progressive-web-apps'); ?></p>
639
-
640
- <?php
641
- }
642
-
643
-
644
- /**
645
- * Admin interface renderer
646
- *
647
- * @since 1.0
648
- * @since 1.7 Handling of settings saved messages since UI is its own menu item in the admin menu.
649
- */
650
- function superpwa_admin_interface_render() {
651
-
652
- // Authentication
653
- if ( ! current_user_can( 'manage_options' ) ) {
654
- return;
655
- }
656
-
657
- // Handing save settings
658
- if ( isset( $_GET['settings-updated'] ) ) {
659
-
660
- // Add settings saved message with the class of "updated"
661
- add_settings_error( 'superpwa_settings_group', 'superpwa_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
662
-
663
- // Show Settings Saved Message
664
- settings_errors( 'superpwa_settings_group' );
665
- }
666
-
667
- ?>
668
- <style type="text/css">.spwa-tab {overflow: hidden;border: 1px solid #ccc;background-color: #fff;margin-top: 15px;}.spwa-tab a {background-color: inherit;text-decoration: none;float: left;border: none;outline: none;cursor: pointer;padding: 14px 16px;transition: 0s;font-size: 15px;color: #2271b1;}.spwa-tab a:hover {color: #0a4b78;}.spwa-tab a.active {box-shadow: none;border-bottom: 4px solid #646970;color: #1d2327;}.spwa-tab a:focus {box-shadow: none;outline: none;}.spwa-tabcontent {display: none;padding: 6px 12px;border-top: none; animation: fadeEffect 1s; }p.support-cont {font-size: 14px;font-weight: 500;color: #646970;}#support{margin-top: 1em;} @keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }</style>
669
-
670
- <div class="wrap">
671
- <?php
672
- if ( defined('SUPERPWA_PRO_VERSION') ) {
673
- wp_enqueue_script('superpwa-pro-admin', trailingslashit(SUPERPWA_PRO_PATH_SRC).'assets/js/admin.js', array('jquery'), SUPERPWA_PRO_VERSION, true);
674
- $array = array('security_nonce'=>wp_create_nonce('superpwa_pro_post_nonce'));
675
- wp_localize_script('superpwa-pro-admin', 'superpwa_pro_var', $array);
676
- $license_info = get_option("superpwa_pro_upgrade_license");
677
- if ( defined('SUPERPWA_PRO_PLUGIN_DIR_NAME') && !empty($license_info) ){
678
- $superpwa_pro_manager = SUPERPWA_PRO_PLUGIN_DIR_NAME.'/assets/inc/superpwa-pro-license-data.php';
679
- if( file_exists($superpwa_pro_manager) ){
680
- require_once $superpwa_pro_manager;
681
- if( $_GET['page'] == 'superpwa' ) {
682
- wp_enqueue_style( 'superpwa-license-panel-css', SUPERPWA_PRO_PATH_SRC . '/assets/inc/css/superpwa-pro-license-data.css', array() , SUPERPWA_PRO_VERSION );
683
- }
684
- }
685
- }
686
- } ?>
687
- <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
688
-
689
- <form action="options.php" method="post" enctype="multipart/form-data">
690
- <?php
691
- // Output nonce, action, and option_page fields for a settings page.
692
- settings_fields( 'superpwa_settings_group' );
693
- $addon_page = admin_url( 'admin.php?page=superpwa-addons');
694
- ?>
695
- <div class="spwa-tab">
696
- <a id="spwa-default" class="spwa-tablinks" data-href="no" href="#general-settings" onclick="openCity(event, 'settings')">Settings</a>
697
- <a class="spwa-tablinks" id="spwa-feature" href="<?php echo $addon_page; ?>" data-href="yes">Features (Addons)</a>
698
- <a class="spwa-tablinks" id="spwa-advance" href="#advance-settings" onclick="openCity(event, 'advance')" data-href="no">Advanced</a>
699
- <a class="spwa-tablinks" id="spwa-support" href="#support-settings" onclick="openCity(event, 'support')" data-href="no">Help & Support</a>
700
- <?php if( defined('SUPERPWA_PRO_VERSION') ){
701
- $expiry_warning = superpwa_license_expire_warning();
702
- ?>
703
- <a class="spwa-tablinks" id="spwa-license" href="#license-settings" onclick="openCity(event, 'superpwa_pro_license')" data-href="no">License <?php echo $expiry_warning; ?></a>
704
- <?php } ?>
705
- <?php if(!defined('SUPERPWA_PRO_VERSION')){ ?>
706
- <a class="spwa-tablinks" id="spwa-upgrade2pro" style="background: #ff4c4c;color: #ffffff;margin-right: 5px; float: right; font-weight: 700; padding: 16px 25px" href="<?php echo admin_url('admin.php?page=superpwa-upgrade'); ?>" onclick="openCity(event, 'superpwa-upgrade')" data-href="no"><?php echo __( 'Upgrade to PRO', 'super-progressive-web-apps' ); ?></a>
707
- <?php } ?>
708
- </div>
709
- <span id="alert-warning" style=" margin-top: 10px; display: none; padding: 10px;background-color: #ff9800;color: white;"> Please Save the settings before moving to other tabs </span>
710
- <div id="settings" class="spwa-tabcontent">
711
- <?php
712
- // Basic Application Settings
713
- do_settings_sections( 'superpwa_basic_settings_section' ); // Page slug
714
-
715
- // Status
716
- do_settings_sections( 'superpwa_pwa_status_section' ); // Page slug
717
- // Output save settings button
718
- echo '<style>.submit{float:left;}</style>';
719
- submit_button( __('Save Settings', 'super-progressive-web-apps') );
720
- if(!defined('SUPERPWA_PRO_VERSION')){
721
- echo '<a class="button" style="background: black;color: white;margin: 30px 0px 0px 25px;" href="'.admin_url('admin.php?page=superpwa-upgrade').'" target="_blank">Go PRO</a>';
722
- }
723
- ?>
724
- </div>
725
- <div id="advance" class="spwa-tabcontent">
726
- <?php
727
- // Advance
728
- do_settings_sections( 'superpwa_pwa_advance_section' ); // Page slug
729
- // Output save settings button
730
- echo '<style>.submit{float:left;}</style>';
731
- submit_button( __('Save Settings', 'super-progressive-web-apps') );
732
- if(!defined('SUPERPWA_PRO_VERSION')){
733
- echo '<a class="button" style="background: black;color: white;margin: 30px 0px 0px 25px;" href="'.admin_url('admin.php?page=superpwa-upgrade').'" target="_blank">Go PRO</a>';
734
- }
735
- ?>
736
- </div>
737
- <div id="support" class="spwa-tabcontent">
738
-
739
- <?php
740
- //1)Docs 2)Find new or whats new in superpwa(Blog Post Link)
741
- //3)Technical issue (supportLink) 4)Report a Bug(Support Link)
742
-
743
- ?>
744
- <h1>1) Documentation</h1>
745
- <p class="support-cont">All the documents regarding SuperPWA Setup, it's settings detail and also about add-ons setup all you can go through this <b><a href="https://superpwa.com/docs/" target="_blank">Docs link</a></b></p>
746
-
747
- <h1>2) What's New</h1>
748
- <p class="support-cont">We will be continuously working on new features whereas also fixing the bugs and at the sametime releasing new feature add-ons, So to catch all those things just check this link <b><a href="https://superpwa.com/blog/" target="_blank">What's new in SuperPWA</a></b></p>
749
-
750
- <h1>3) Technical Issue</h1>
751
- <p class="support-cont">If you are facing any issues or unable to Setup, you can directly connect us using this link <b><a href="https://superpwa.com/contact/" target="_blank">Contact us</a></b></p>
752
-
753
- <h1>4) Report a Bug</h1>
754
- <p class="support-cont">If you found any bug or having issues with any third party plugins you can contact us <b><a href="https://superpwa.com/contact/" target="_blank">Bug Report</a></b></p>
755
- </div>
756
-
757
- <div id="superpwa_pro_license" class="spwa-tabcontent">
758
-
759
- <?php
760
- if ( function_exists('superpwa_pro_upgrade_license_page') ) {
761
- superpwa_pro_upgrade_license_page();
762
- }
763
- ?>
764
-
765
- </div>
766
-
767
- </form>
768
- </div>
769
- <?php superpwa_newsletter_form(); ?>
770
- <script type="text/javascript">function openCity(evt, cityName) {var i, tabcontent, tablinks;tabcontent = document.getElementsByClassName("spwa-tabcontent");for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("spwa-tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(cityName).style.display = "block"; evt.currentTarget.className += " active"; }
771
- var url = window.location.href;
772
- if(url.indexOf('#advance-settings') > -1){
773
- document.getElementById("spwa-advance").click();
774
- }else if(url.indexOf('#support-settings') > -1){
775
- document.getElementById("spwa-support").click();
776
- }else if(url.indexOf('#license-settings') > -1){
777
- document.getElementById("spwa-license").click();
778
- }else{
779
- document.getElementById("spwa-default").click();
780
- }
781
- </script>
782
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783
  }
1
+ <?php
2
+ /**
3
+ * Admin UI setup and render
4
+ *
5
+ * @since 1.0
6
+ *
7
+ * @function superpwa_app_name_cb() Application Name
8
+ * @function superpwa_app_short_name_cb() Application Short Name
9
+ * @function superpwa_description_cb() Description
10
+ * @function superpwa_background_color_cb() Splash Screen Background Color
11
+ * @function superpwa_theme_color_cb() Theme Color
12
+ * @function superpwa_app_icon_cb() Application Icon
13
+ * @function superpwa_app_icon_cb() Splash Screen Icon
14
+ * @function superpwa_app_screenshots_cb() Screenshots Icon
15
+ * @function superpwa_start_url_cb() Start URL Dropdown
16
+ * @function superpwa_app_category_cb() App Category Dropdown
17
+ * @function superpwa_offline_page_cb() Offline Page Dropdown
18
+ * @function superpwa_orientation_cb() Default Orientation Dropdown
19
+ * @function superpwa_display_cb() Default Display Dropdown
20
+ * @function superpwa_text_direction_cb() Text Direction Dropdown
21
+ * @function superpwa_manifest_status_cb() Manifest Status
22
+ * @function superpwa_sw_status_cb() Service Worker Status
23
+ * @function superpwa_https_status_cb() HTTPS Status
24
+ * @function superpwa_disable_add_to_home_cb() Disable Add to home
25
+ * @function superpwa_admin_interface_render() Admin interface renderer
26
+ */
27
+
28
+ // Exit if accessed directly
29
+ if ( ! defined( 'ABSPATH' ) ) exit;
30
+
31
+ /**
32
+ * Application Name
33
+ *
34
+ * @since 1.2
35
+ */
36
+ function superpwa_app_name_cb() {
37
+
38
+ // Get Settings
39
+ $settings = superpwa_get_settings(); ?>
40
+
41
+ <fieldset>
42
+
43
+ <input type="text" name="superpwa_settings[app_name]" class="regular-text" value="<?php if ( isset( $settings['app_name'] ) && ( ! empty($settings['app_name']) ) ) echo esc_attr($settings['app_name']); ?>"/>
44
+
45
+ </fieldset>
46
+
47
+ <?php
48
+ }
49
+
50
+ /**
51
+ * Application Short Name
52
+ *
53
+ * @since 1.2
54
+ */
55
+ function superpwa_app_short_name_cb() {
56
+
57
+ // Get Settings
58
+ $settings = superpwa_get_settings(); ?>
59
+
60
+ <fieldset>
61
+
62
+ <input type="text" name="superpwa_settings[app_short_name]" class="regular-text superpwa-app-short-name" value="<?php if ( isset( $settings['app_short_name'] ) && ( ! empty($settings['app_short_name']) ) ) echo esc_attr($settings['app_short_name']); ?>"/>
63
+
64
+ <p class="description">
65
+ <?php _e('Used when there is insufficient space to display the full name of the application. <span id="superpwa-app-short-name-limit"><code>15</code> characters or less.</span>', 'super-progressive-web-apps'); ?>
66
+ </p>
67
+
68
+ </fieldset>
69
+
70
+ <?php
71
+ }
72
+
73
+ /**
74
+ * Description
75
+ *
76
+ * @since 1.6
77
+ */
78
+ function superpwa_description_cb() {
79
+
80
+ // Get Settings
81
+ $settings = superpwa_get_settings(); ?>
82
+
83
+ <fieldset>
84
+
85
+ <input type="text" name="superpwa_settings[description]" class="regular-text" value="<?php if ( isset( $settings['description'] ) && ( ! empty( $settings['description'] ) ) ) echo esc_attr( $settings['description'] ); ?>"/>
86
+
87
+ <p class="description">
88
+ <?php _e( 'A brief description of what your app is about.', 'super-progressive-web-apps' ); ?>
89
+ </p>
90
+
91
+ </fieldset>
92
+
93
+ <?php
94
+ }
95
+
96
+ /**
97
+ * Application Icon
98
+ *
99
+ * @since 1.0
100
+ */
101
+ function superpwa_app_icon_cb() {
102
+
103
+ // Get Settings
104
+ $settings = superpwa_get_settings(); ?>
105
+
106
+ <!-- Application Icon -->
107
+ <input type="text" name="superpwa_settings[icon]" id="superpwa_settings[icon]" class="superpwa-icon regular-text" size="50" value="<?php echo isset( $settings['icon'] ) ? esc_attr( $settings['icon']) : ''; ?>">
108
+ <button type="button" class="button superpwa-icon-upload" data-editor="content">
109
+ <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
110
+ </button>
111
+
112
+ <p class="description">
113
+ <?php _e('This will be the icon of your app when installed on the phone. Must be a <code>PNG</code> image exactly <code>192x192</code> in size.', 'super-progressive-web-apps'); ?>
114
+ </p>
115
+
116
+ <?php
117
+ }
118
+
119
+ /**
120
+ * Splash Screen Icon
121
+ *
122
+ * @since 1.3
123
+ */
124
+ function superpwa_splash_icon_cb() {
125
+
126
+ // Get Settings
127
+ $settings = superpwa_get_settings(); ?>
128
+
129
+ <!-- Splash Screen Icon -->
130
+ <input type="text" name="superpwa_settings[splash_icon]" id="superpwa_settings[splash_icon]" class="superpwa-splash-icon regular-text" size="50" value="<?php echo isset( $settings['splash_icon'] ) ? esc_attr( $settings['splash_icon']) : ''; ?>">
131
+ <button type="button" class="button superpwa-splash-icon-upload" data-editor="content">
132
+ <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
133
+ </button>
134
+
135
+ <p class="description">
136
+ <?php _e('This icon will be displayed on the splash screen of your app on supported devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in size.', 'super-progressive-web-apps'); ?>
137
+ </p>
138
+
139
+ <?php
140
+ }
141
+
142
+ /**
143
+ * Screenshots Icon
144
+ *
145
+ * @since 1.0
146
+ */
147
+ function superpwa_app_screenshots_cb() {
148
+
149
+ // Get Settings
150
+ $settings = superpwa_get_settings(); ?>
151
+
152
+ <!-- Application Icon -->
153
+ <input type="text" name="superpwa_settings[screenshots]" id="superpwa_settings[screenshots]" class="superpwa-screenshots regular-text" size="50" value="<?php echo isset( $settings['screenshots'] ) ? esc_attr( $settings['screenshots']) : ''; ?>">
154
+ <button type="button" class="button superpwa-screenshots-upload" data-editor="content">
155
+ <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Screenshots', 'super-progressive-web-apps' ); ?>
156
+ </button>
157
+
158
+ <p class="description">
159
+ <?php _e('This will be the screenshots of your app when installed on the phone. Must be a <code>PNG</code> image exactly <code>472x1024</code> in size.', 'super-progressive-web-apps'); ?>
160
+ </p>
161
+
162
+ <?php
163
+ }
164
+
165
+ /**
166
+ * Splash Screen Background Color
167
+ *
168
+ * @since 1.0
169
+ */
170
+ function superpwa_background_color_cb() {
171
+
172
+ // Get Settings
173
+ $settings = superpwa_get_settings(); ?>
174
+
175
+ <!-- Background Color -->
176
+ <input type="text" name="superpwa_settings[background_color]" id="superpwa_settings[background_color]" class="superpwa-colorpicker" value="<?php echo isset( $settings['background_color'] ) ? esc_attr( $settings['background_color']) : '#D5E0EB'; ?>" data-default-color="#D5E0EB">
177
+
178
+ <p class="description">
179
+ <?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?>
180
+ </p>
181
+
182
+ <?php
183
+ }
184
+
185
+ /**
186
+ * Theme Color
187
+ *
188
+ * @since 1.4
189
+ */
190
+ function superpwa_theme_color_cb() {
191
+
192
+ // Get Settings
193
+ $settings = superpwa_get_settings(); ?>
194
+
195
+ <!-- Theme Color -->
196
+ <input type="text" name="superpwa_settings[theme_color]" id="superpwa_settings[theme_color]" class="superpwa-colorpicker" value="<?php echo isset( $settings['theme_color'] ) ? esc_attr( $settings['theme_color']) : '#D5E0EB'; ?>" data-default-color="#D5E0EB">
197
+
198
+ <p class="description">
199
+ <?php _e('Theme color is used on supported devices to tint the UI elements of the browser and app switcher. When in doubt, use the same color as <code>Background Color</code>.', 'super-progressive-web-apps'); ?>
200
+ </p>
201
+
202
+ <?php
203
+ }
204
+
205
+ /**
206
+ * Start URL Dropdown
207
+ *
208
+ * @since 1.2
209
+ */
210
+ function superpwa_start_url_cb() {
211
+
212
+ // Get Settings
213
+ $settings = superpwa_get_settings(); ?>
214
+
215
+ <fieldset>
216
+
217
+ <!-- WordPress Pages Dropdown -->
218
+ <label for="superpwa_settings[start_url]">
219
+ <?php echo wp_dropdown_pages( array(
220
+ 'name' => 'superpwa_settings[start_url]',
221
+ 'echo' => 0,
222
+ 'show_option_none' => __( '&mdash; Homepage &mdash;' ),
223
+ 'option_none_value' => '0',
224
+ 'selected' => isset($settings['start_url']) ? $settings['start_url'] : '',
225
+ )); ?>
226
+ </label>
227
+
228
+ <p class="description">
229
+ <?php printf( __( 'Specify the page to load when the application is launched from a device. Current start page is <code>%s</code>', 'super-progressive-web-apps' ), superpwa_get_start_url() ); ?>
230
+ </p>
231
+
232
+ <?php if ( superpwa_is_amp() ) { ?>
233
+
234
+ <!-- AMP Page As Start Page -->
235
+ <br><input type="checkbox" name="superpwa_settings[start_url_amp]" id="superpwa_settings[start_url_amp]" value="1"
236
+ <?php if ( isset( $settings['start_url_amp'] ) ) { checked( '1', $settings['start_url_amp'] ); } ?>>
237
+ <label for="superpwa_settings[start_url_amp]"><?php _e('Use AMP version of the start page.', 'super-progressive-web-apps') ?></label>
238
+ <br>
239
+
240
+ <!-- AMP for WordPress 0.6.2 doesn't support homepage, the blog index, and archive pages. -->
241
+ <?php if ( is_plugin_active( 'amp/amp.php' ) ) { ?>
242
+ <p class="description">
243
+ <?php _e( 'Do not check this if your start page is the homepage, the blog index, or the archives page. AMP for WordPress does not create AMP versions for these pages.', 'super-progressive-web-apps' ); ?>
244
+ </p>
245
+ <?php } ?>
246
+
247
+ <!-- tagDiv AMP 1.2 doesn't enable AMP for pages by default and needs to be enabled manually in settings -->
248
+ <?php if ( is_plugin_active( 'td-amp/td-amp.php' ) && method_exists( 'td_util', 'get_option' ) ) {
249
+
250
+ // Read option value from db
251
+ $td_amp_page_post_type = td_util::get_option( 'tds_amp_post_type_page' );
252
+
253
+ // Show notice if option to enable AMP for pages is disabled.
254
+ if ( empty( $td_amp_page_post_type ) ) { ?>
255
+ <p class="description">
256
+ <?php printf( __( 'Please enable AMP support for Page in <a href="%s">Theme Settings > Theme Panel</a> > AMP > Post Type Support.', 'super-progressive-web-apps' ), admin_url( 'admin.php?page=td_theme_panel' ) ); ?>
257
+ </p>
258
+ <?php }
259
+ } ?>
260
+
261
+ <?php } ?>
262
+
263
+ </fieldset>
264
+
265
+ <?php
266
+ }
267
+
268
+ /**
269
+ * App Category Dropdown
270
+ *
271
+ * @since 1.2
272
+ */
273
+ function superpwa_app_category_cb() {
274
+
275
+ // Get Settings
276
+ $settings = superpwa_get_settings(); ?>
277
+
278
+ <fieldset>
279
+
280
+ <!-- WordPress Pages Dropdown -->
281
+ <label for="superpwa_settings[app_category]">
282
+ <?php
283
+ echo wp_dropdown_categories( array(
284
+ 'name' => 'superpwa_settings[app_category]',
285
+ 'echo' => 0,
286
+ 'show_option_none' => __( '&mdash; Default &mdash;' ),
287
+ 'taxonomy' => 'category',
288
+ 'option_none_value' => '0',
289
+ 'selected' => isset($settings['app_category']) ? $settings['app_category'] : '',
290
+ )); ?>
291
+ </label>
292
+
293
+ </fieldset>
294
+
295
+ <?php
296
+ }
297
+
298
+ /**
299
+ * Offline Page Dropdown
300
+ *
301
+ * @since 1.1
302
+ */
303
+ function superpwa_offline_page_cb() {
304
+
305
+ // Get Settings
306
+ $settings = superpwa_get_settings(); ?>
307
+
308
+ <!-- WordPress Pages Dropdown -->
309
+ <label for="superpwa_settings[offline_page]">
310
+ <?php echo wp_dropdown_pages( array(
311
+ 'name' => 'superpwa_settings[offline_page]',
312
+ 'echo' => 0,
313
+ 'show_option_none' => __( '&mdash; Default &mdash;' ),
314
+ 'option_none_value' => '0',
315
+ 'selected' => isset($settings['offline_page']) ? $settings['offline_page'] : '',
316
+ )); ?>
317
+ </label>
318
+
319
+ <p class="description">
320
+ <?php printf( __( 'Offline page is displayed when the device is offline and the requested page is not already cached. Current offline page is <code>%s</code>', 'super-progressive-web-apps' ), superpwa_get_offline_page() ); ?>
321
+ </p>
322
+
323
+ <?php
324
+ }
325
+
326
+ /**
327
+ * Default Orientation Dropdown
328
+ *
329
+ * @since 1.4
330
+ */
331
+ function superpwa_orientation_cb() {
332
+
333
+ // Get Settings
334
+ $settings = superpwa_get_settings(); ?>
335
+
336
+ <!-- Orientation Dropdown -->
337
+ <label for="superpwa_settings[orientation]">
338
+ <select name="superpwa_settings[orientation]" id="superpwa_settings[orientation]">
339
+ <option value="0" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 0 ); } ?>>
340
+ <?php _e( 'Follow Device Orientation', 'super-progressive-web-apps' ); ?>
341
+ </option>
342
+ <option value="1" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 1 ); } ?>>
343
+ <?php _e( 'Portrait', 'super-progressive-web-apps' ); ?>
344
+ </option>
345
+ <option value="2" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 2 ); } ?>>
346
+ <?php _e( 'Landscape', 'super-progressive-web-apps' ); ?>
347
+ </option>
348
+ </select>
349
+ </label>
350
+
351
+ <p class="description">
352
+ <?php _e( 'Set the orientation of your app on devices. When set to <code>Follow Device Orientation</code> your app will rotate as the device is rotated.', 'super-progressive-web-apps' ); ?>
353
+ </p>
354
+
355
+ <?php
356
+ }
357
+
358
+ /**
359
+ * Default Display Dropdown
360
+ *
361
+ * @author Jose Varghese
362
+ *
363
+ * @since 2.0
364
+ */
365
+ function superpwa_display_cb() {
366
+
367
+ // Get Settings
368
+ $settings = superpwa_get_settings(); ?>
369
+
370
+ <!-- Display Dropdown -->
371
+ <label for="superpwa_settings[display]">
372
+ <select name="superpwa_settings[display]" id="superpwa_settings[display]">
373
+ <option value="0" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 0 ); } ?>>
374
+ <?php _e( 'Full Screen', 'super-progressive-web-apps' ); ?>
375
+ </option>
376
+ <option value="1" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 1 ); } ?>>
377
+ <?php _e( 'Standalone', 'super-progressive-web-apps' ); ?>
378
+ </option>
379
+ <option value="2" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 2 ); } ?>>
380
+ <?php _e( 'Minimal UI', 'super-progressive-web-apps' ); ?>
381
+ </option>
382
+ <option value="3" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 3 ); } ?>>
383
+ <?php _e( 'Browser', 'super-progressive-web-apps' ); ?>
384
+ </option>
385
+ </select>
386
+ </label>
387
+
388
+ <p class="description">
389
+ <?php printf( __( 'Display mode decides what browser UI is shown when your app is launched. <code>Standalone</code> is default. <a href="%s" target="_blank">What\'s the difference? &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', 'https://superpwa.com/doc/web-app-manifest-display-modes/?utm_source=superpwa-plugin&utm_medium=settings-display' ); ?>
390
+ </p>
391
+
392
+ <?php
393
+ }
394
+
395
+ /**
396
+ * Text Direction Dropdown
397
+ *
398
+ * @author Jose Varghese
399
+ *
400
+ * @since 2.0
401
+ */
402
+ function superpwa_text_direction_cb() {
403
+
404
+ // Get Settings
405
+ $settings = superpwa_get_settings(); ?>
406
+
407
+ <!-- Display Dropdown -->
408
+ <label for="superpwa_settings[text_dir]">
409
+ <select name="superpwa_settings[text_dir]" id="superpwa_settings[display]">
410
+ <option value="0" <?php if ( isset( $settings['text_dir'] ) ) { selected( $settings['text_dir'], 0 ); } ?>>
411
+ <?php _e( 'LTR', 'super-progressive-web-apps' ); ?>
412
+ </option>
413
+ <option value="1" <?php if ( isset( $settings['text_dir'] ) ) { selected( $settings['text_dir'], 1 ); } ?>>
414
+ <?php _e( 'RTL', 'super-progressive-web-apps' ); ?>
415
+ </option>
416
+ </select>
417
+ </label>
418
+
419
+ <p class="description">
420
+ <?php printf( __( 'The text direction of your PWA', 'super-progressive-web-apps' )); ?>
421
+ </p>
422
+
423
+ <?php
424
+ }
425
+
426
+ /**
427
+ * Manifest Status
428
+ *
429
+ * @author Arun Basil Lal
430
+ *
431
+ * @since 1.2
432
+ * @since 1.8 Attempt to generate manifest again if the manifest doesn't exist.
433
+ * @since 2.0 Remove logic to check if manifest exists in favour of dynamic manifest.
434
+ * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
435
+ */
436
+ function superpwa_manifest_status_cb() {
437
+
438
+ /**
439
+ * Check to see if the file exists, If not attempts to generate a new one.
440
+ */
441
+ if ( superpwa_file_exists( superpwa_manifest( 'src' ) ) || superpwa_generate_manifest() ) {
442
+
443
+ printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Manifest generated successfully. You can <a href="%s" target="_blank">See it here &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', superpwa_manifest( 'src' ) );
444
+ } else {
445
+
446
+ printf( '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __( 'Manifest generation failed. <a href="%s" target="_blank">Fix it &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', 'https://superpwa.com/doc/fixing-manifest-service-worker-generation-failed-error/?utm_source=superpwa-plugin&utm_medium=settings-status-no-manifest' );
447
+ }
448
+ }
449
+
450
+ /**
451
+ * Service Worker Status
452
+ *
453
+ * @author Arun Basil Lal
454
+ *
455
+ * @since 1.2
456
+ * @since 1.8 Attempt to generate service worker again if it doesn't exist.
457
+ * @since 2.0 Modify logic to check if Service worker exists.
458
+ * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
459
+ */
460
+ function superpwa_sw_status_cb() {
461
+
462
+ /**
463
+ * Check to see if the file exists, If not attempts to generate a new one.
464
+ */
465
+ if ( superpwa_file_exists( superpwa_sw( 'src' ) ) || superpwa_generate_sw() ) {
466
+
467
+ printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Service worker generated successfully. <a href="%s" target="_blank">See it here &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', superpwa_sw( 'src' ) );
468
+ } else {
469
+
470
+ printf( '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __( 'Service worker generation failed. <a href="%s" target="_blank">Fix it &rarr;</a>', 'super-progressive-web-apps' ) . '</p>', 'https://superpwa.com/doc/fixing-manifest-service-worker-generation-failed-error/?utm_source=superpwa-plugin&utm_medium=settings-status-no-sw' );
471
+ }
472
+ }
473
+
474
+ /**
475
+ * HTTPS Status
476
+ *
477
+ * @since 1.2
478
+ */
479
+ function superpwa_https_status_cb() {
480
+
481
+ if ( is_ssl() ) {
482
+
483
+ printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Your website is served over HTTPS.', 'super-progressive-web-apps' ) . '</p>' );
484
+ } else {
485
+
486
+ printf( '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __( 'Progressive Web Apps require that your website is served over HTTPS. Please contact your host to add a SSL certificate to your domain.', 'super-progressive-web-apps' ) . '</p>' );
487
+ }
488
+ }
489
+
490
+
491
+ /**
492
+ * Admin can disable the add to home bar
493
+ *
494
+ * @since 2.1.4
495
+ */
496
+ function superpwa_disable_add_to_home_cb() {
497
+ // Get Settings
498
+ $settings = superpwa_get_settings();
499
+ ?><input type="checkbox" name="superpwa_settings[disable_add_to_home]" id="superpwa_settings[disable_add_to_home]" value="1"
500
+ <?php if ( isset( $settings['disable_add_to_home'] ) ) { checked( '1', $settings['disable_add_to_home'] ); } ?>>
501
+ <label for="superpwa_settings[disable_add_to_home]"><?php _e('Remove default banner', 'super-progressive-web-apps') ?></label>
502
+ <br>
503
+ <?php
504
+ }
505
+
506
+ /**
507
+ * App Shortcut link Dropdown
508
+ *
509
+ * @since 1.2
510
+ */
511
+ function superpwa_app_shortcut_link_cb() {
512
+
513
+ // Get Settings
514
+ $settings = superpwa_get_settings(); ?>
515
+
516
+ <fieldset>
517
+
518
+ <!-- WordPress Pages Dropdown -->
519
+ <label for="superpwa_settings[shortcut_url]">
520
+ <?php echo wp_dropdown_pages( array(
521
+ 'name' => 'superpwa_settings[shortcut_url]',
522
+ 'echo' => 0,
523
+ 'show_option_none' => __( 'Select Page' ),
524
+ 'option_none_value' => '0',
525
+ 'selected' => isset($settings['shortcut_url']) ? $settings['shortcut_url'] : '',
526
+ )); ?>
527
+ </label>
528
+
529
+ <p class="description">
530
+ <?php echo __( 'Specify the page to load when the application is launched via Shortcut.', 'super-progressive-web-apps' ); ?>
531
+ </p>
532
+ </fieldset>
533
+
534
+ <?php
535
+ }
536
+
537
+ /**
538
+ * Enable or disable the yandex support
539
+ *
540
+ * @since 2.1.4
541
+ */
542
+ function superpwa_yandex_support_cb() {
543
+ // Get Settings
544
+ $settings = superpwa_get_settings();
545
+ ?><input type="checkbox" name="superpwa_settings[yandex_support]" id="superpwa_settings[yandex_support]" value="1"
546
+ <?php if ( isset( $settings['yandex_support'] ) ) { checked( '1', $settings['yandex_support'] ); } ?>>
547
+ <br>
548
+ <?php
549
+ }
550
+ /**
551
+ * Enable or disable the analytics support
552
+ *
553
+ * @since 2.1.5
554
+ */
555
+ function superpwa_analytics_support_cb() {
556
+ // Get Settings
557
+ $settings = superpwa_get_settings();
558
+ ?><input type="checkbox" name="superpwa_settings[analytics_support]" id="superpwa_settings[analytics_support]" value="1"
559
+ <?php if ( isset( $settings['analytics_support'] ) ) { checked( '1', $settings['analytics_support'] ); } ?>>
560
+ <br>
561
+ <?php
562
+ }
563
+
564
+ /**
565
+ * Enable or disable cache external urls support
566
+ *
567
+ * @since 2.1.6
568
+ */
569
+ function superpwa_cache_external_urls_support_cb() {
570
+ // Get Settings
571
+ $settings = superpwa_get_settings();
572
+ ?><input type="checkbox" name="superpwa_settings[cache_external_urls]" id="superpwa_settings[cache_external_urls]" value="1"
573
+ <?php if ( isset( $settings['cache_external_urls'] ) ) { checked( '1', $settings['cache_external_urls'] ); } ?>>
574
+ <br>
575
+ <?php
576
+ }
577
+
578
+ /**
579
+ * Exclude Urls from Cache list of service worker
580
+ *
581
+ * @since 2.1.2
582
+ */
583
+
584
+ function superpwa_exclude_url_cache_cb(){
585
+ // Get Settings
586
+ $settings = superpwa_get_settings();
587
+ ?>
588
+ <label><textarea placeholder="https://example.com/contact-us/, https://example.com/checkout/" rows="4" cols="70" id="superpwa_settings[excluded_urls]" name="superpwa_settings[excluded_urls]"><?php echo (isset($settings['excluded_urls']) ? esc_attr($settings['excluded_urls']): ''); ?></textarea></label>
589
+ <p><?php echo esc_html__('Note: Seperate the URLs using a Comma(,)', 'super-progressive-web-apps'); ?></p>
590
+ <p><?php echo esc_html__('Place the list of URLs which you do not want to cache by service worker', 'super-progressive-web-apps'); ?></p>
591
+
592
+ <?php
593
+ }
594
+
595
+ /**
596
+ * Exclude add to home screen popup on particular pages
597
+ *
598
+ * @since 2.1.19
599
+ */
600
+
601
+ function superpwa_exclude_add_to_homescreen_cb(){
602
+ // Get Settings
603
+ $settings = superpwa_get_settings();
604
+ ?>
605
+ <label><textarea placeholder="https://example.com/contact-us/, https://example.com/checkout/" rows="4" cols="70" id="superpwa_settings[exclude_homescreen]" name="superpwa_settings[exclude_homescreen]"><?php echo (isset($settings['exclude_homescreen']) ? esc_attr($settings['exclude_homescreen']): ''); ?></textarea></label>
606
+ <p><?php echo esc_html__('Note: Seperate the URLs using a Comma(,)', 'super-progressive-web-apps'); ?></p>
607
+ <p><?php echo esc_html__('Place the list of URLs on which add to homescreen will be hidden', 'super-progressive-web-apps'); ?></p>
608
+
609
+ <?php
610
+ }
611
+
612
+ function superpwa_reset_settings_cb(){
613
+ ?>
614
+ <button class="button superpwa-reset-settings">
615
+ <?php echo esc_html__('Reset','super-progressive-web-apps'); ?>
616
+ </button>
617
+
618
+ <?php
619
+ }
620
+
621
+ function superpwa_bypass_sw_url_cache_cb(){
622
+ $settings = superpwa_get_settings();
623
+ ?><input type="checkbox" name="superpwa_settings[bypass_sw_url_cache]" id="superpwa_settings[bypass_sw_url_cache]" value="1"
624
+ <?php if ( isset( $settings['bypass_sw_url_cache'] ) ) { checked( '1', $settings['bypass_sw_url_cache'] ); } ?>>
625
+ <br>
626
+ <p><?php echo esc_html__(' Enable this option when ', 'super-progressive-web-apps'); ?></p>
627
+ <p><?php echo esc_html__(' * Your service worker file does not update or is cached by your server.', 'super-progressive-web-apps'); ?></p>
628
+ <p><?php echo esc_html__(' * If manual pre caching pages are not cached.', 'super-progressive-web-apps'); ?></p>
629
+ <?php
630
+ }
631
+
632
+ /**
633
+ * Force Update Service Worker
634
+ *
635
+ * @since 2.1.6
636
+ */
637
+
638
+ function superpwa_force_update_sw_cb(){
639
+ // Get Settings
640
+ $settings = superpwa_get_settings();
641
+ ?>
642
+ <label><input type="text" id="superpwa_settings[force_update_sw_setting]" name="superpwa_settings[force_update_sw_setting]" value="<?php if(isset($settings['force_update_sw_setting'])){
643
+ if(!version_compare($settings['force_update_sw_setting'],SUPERPWA_VERSION, '>=') ){
644
+ $settings['force_update_sw_setting'] = SUPERPWA_VERSION;
645
+ }
646
+ echo esc_attr($settings['force_update_sw_setting']);
647
+ }else{ echo SUPERPWA_VERSION; } ?>"></label>
648
+ <code>Current Version <?php echo SUPERPWA_VERSION; ?></code>
649
+ <p><?php echo esc_html__('Update the version number. It will automatically re-install the service worker for all the users', 'super-progressive-web-apps'); ?></p>
650
+
651
+ <?php
652
+ }
653
+
654
+
655
+ /**
656
+ * Admin interface renderer
657
+ *
658
+ * @since 1.0
659
+ * @since 1.7 Handling of settings saved messages since UI is its own menu item in the admin menu.
660
+ */
661
+ function superpwa_admin_interface_render() {
662
+
663
+ // Authentication
664
+ if ( ! current_user_can( 'manage_options' ) ) {
665
+ return;
666
+ }
667
+
668
+ // Handing save settings
669
+ if ( isset( $_GET['settings-updated'] ) ) {
670
+
671
+ // Add settings saved message with the class of "updated"
672
+ add_settings_error( 'superpwa_settings_group', 'superpwa_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
673
+
674
+ // Show Settings Saved Message
675
+ settings_errors( 'superpwa_settings_group' );
676
+ }
677
+
678
+ ?>
679
+ <style type="text/css">.spwa-tab {overflow: hidden;border: 1px solid #ccc;background-color: #fff;margin-top: 15px;}.spwa-tab a {background-color: inherit;text-decoration: none;float: left;border: none;outline: none;cursor: pointer;padding: 14px 16px;transition: 0s;font-size: 15px;color: #2271b1;}.spwa-tab a:hover {color: #0a4b78;}.spwa-tab a.active {box-shadow: none;border-bottom: 4px solid #646970;color: #1d2327;}.spwa-tab a:focus {box-shadow: none;outline: none;}.spwa-tabcontent {display: none;padding: 6px 12px;border-top: none; animation: fadeEffect 1s; }p.support-cont {font-size: 14px;font-weight: 500;color: #646970;}#support{margin-top: 1em;} @keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }</style>
680
+
681
+ <div class="wrap">
682
+ <?php
683
+ if ( defined('SUPERPWA_PRO_VERSION') ) {
684
+ wp_enqueue_script('superpwa-pro-admin', trailingslashit(SUPERPWA_PRO_PATH_SRC).'assets/js/admin.js', array('jquery'), SUPERPWA_PRO_VERSION, true);
685
+ $array = array('security_nonce'=>wp_create_nonce('superpwa_pro_post_nonce'));
686
+ wp_localize_script('superpwa-pro-admin', 'superpwa_pro_var', $array);
687
+ $license_info = get_option("superpwa_pro_upgrade_license");
688
+ if ( defined('SUPERPWA_PRO_PLUGIN_DIR_NAME') && !empty($license_info) ){
689
+ $superpwa_pro_manager = SUPERPWA_PRO_PLUGIN_DIR_NAME.'/assets/inc/superpwa-pro-license-data.php';
690
+ if( file_exists($superpwa_pro_manager) ){
691
+ require_once $superpwa_pro_manager;
692
+ if( $_GET['page'] == 'superpwa' ) {
693
+ wp_enqueue_style( 'superpwa-license-panel-css', SUPERPWA_PRO_PATH_SRC . '/assets/inc/css/superpwa-pro-license-data.css', array() , SUPERPWA_PRO_VERSION );
694
+ }
695
+ }
696
+ }
697
+ } ?>
698
+ <h1><?php echo esc_html__('Super Progressive Web Apps', 'super-progressive-web-apps'); ?> <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
699
+
700
+ <form action="options.php" method="post" enctype="multipart/form-data">
701
+ <?php
702
+ // Output nonce, action, and option_page fields for a settings page.
703
+ settings_fields( 'superpwa_settings_group' );
704
+ $addon_page = admin_url( 'admin.php?page=superpwa-addons');
705
+ ?>
706
+ <div class="spwa-tab">
707
+ <a id="spwa-default" class="spwa-tablinks" data-href="no" href="#general-settings" onclick="openCity(event, 'settings')"><?php echo __('Settings', 'super-progressive-web-apps'); ?></a>
708
+ <a class="spwa-tablinks" id="spwa-feature" href="<?php echo $addon_page; ?>" data-href="yes"><?php echo __('Features (Addons)', 'super-progressive-web-apps'); ?></a>
709
+ <a class="spwa-tablinks" id="spwa-advance" href="#advance-settings" onclick="openCity(event, 'advance')" data-href="no"><?php echo __('Advanced', 'super-progressive-web-apps'); ?></a>
710
+ <a class="spwa-tablinks" id="spwa-support" href="#support-settings" onclick="openCity(event, 'support')" data-href="no"><?php echo __('Help & Support', 'super-progressive-web-apps'); ?></a>
711
+ <?php if( defined('SUPERPWA_PRO_VERSION') ){
712
+ $expiry_warning = superpwa_license_expire_warning();
713
+ ?>
714
+ <a class="spwa-tablinks" id="spwa-license" href="#license-settings" onclick="openCity(event, 'superpwa_pro_license')" data-href="no">License <?php echo $expiry_warning; ?></a>
715
+ <?php } ?>
716
+ <?php if(!defined('SUPERPWA_PRO_VERSION')){ ?>
717
+ <a class="spwa-tablinks" id="spwa-upgrade2pro" style="background: #ff4c4c;color: #ffffff;margin-right: 5px; float: right; font-weight: 700; padding: 16px 25px" href="<?php echo admin_url('admin.php?page=superpwa-upgrade'); ?>" onclick="openCity(event, 'superpwa-upgrade')" data-href="no"><?php echo __( 'Upgrade to PRO', 'super-progressive-web-apps' ); ?></a>
718
+ <?php } ?>
719
+ </div>
720
+ <span id="alert-warning" style=" margin-top: 10px; display: none; padding: 10px;background-color: #ff9800;color: white;"> <?php _e( 'Please Save the settings before moving to other tabs', 'super-progressive-web-apps' ); ?> </span>
721
+ <div id="settings" class="spwa-tabcontent">
722
+ <?php
723
+ // Basic Application Settings
724
+ do_settings_sections( 'superpwa_basic_settings_section' ); // Page slug
725
+
726
+ // Status
727
+ do_settings_sections( 'superpwa_pwa_status_section' ); // Page slug
728
+ // Output save settings button
729
+ echo '<style>.submit{float:left;}</style>';
730
+ submit_button( __('Save Settings', 'super-progressive-web-apps') );
731
+ if(!defined('SUPERPWA_PRO_VERSION')){
732
+ echo '<a class="button" style="background: black;color: white;margin: 30px 0px 0px 25px;" href="'.admin_url('admin.php?page=superpwa-upgrade').'" target="_blank">'.__( 'Go PRO', 'super-progressive-web-apps').'</a>';
733
+ }
734
+ ?>
735
+ </div>
736
+ <div id="advance" class="spwa-tabcontent">
737
+ <?php
738
+ // Advance
739
+ do_settings_sections( 'superpwa_pwa_advance_section' ); // Page slug
740
+ // Output save settings button
741
+ echo '<style>.submit{float:left;}</style>';
742
+ submit_button( __('Save Settings', 'super-progressive-web-apps') );
743
+ if(!defined('SUPERPWA_PRO_VERSION')){
744
+ echo '<a class="button" style="background: black;color: white;margin: 30px 0px 0px 25px;" href="'.admin_url('admin.php?page=superpwa-upgrade').'" target="_blank">'.__( 'Go PRO', 'super-progressive-web-apps').'</a>';
745
+ }
746
+ ?>
747
+ </div>
748
+ <div id="support" class="spwa-tabcontent">
749
+
750
+ <?php
751
+ //1)Docs 2)Find new or whats new in superpwa(Blog Post Link)
752
+ //3)Technical issue (supportLink) 4)Report a Bug(Support Link)
753
+
754
+ ?>
755
+ <h1><?php esc_html_e(' 1) Documentation', 'super-progressive-web-apps'); ?></h1>
756
+ <p class="support-cont"><?php esc_html_e('All the documents regarding SuperPWA Setup, it\'s settings detail and also about add-ons setup all you can go through this ', 'super-progressive-web-apps'); ?><b><a href="https://superpwa.com/docs/" target="_blank"><?php esc_html_e('Docs link', 'super-progressive-web-apps'); ?></a></b></p>
757
+
758
+ <h1><?php esc_html_e(' 2) What\'s New', 'super-progressive-web-apps'); ?></h1>
759
+ <p class="support-cont"><?php esc_html_e('We will be continuously working on new features whereas also fixing the bugs and at the sametime releasing new feature add-ons, So to catch all those things just check this link ', 'super-progressive-web-apps'); ?> <b><a href="https://superpwa.com/blog/" target="_blank"><?php esc_html_e('What\'s new in SuperPWA', 'super-progressive-web-apps'); ?></a></b></p>
760
+
761
+ <h1><?php esc_html_e(' 3) Technical Issue', 'super-progressive-web-apps'); ?></h1>
762
+ <p class="support-cont"><?php esc_html_e('If you are facing any issues or unable to Setup, you can directly connect us using this link', 'super-progressive-web-apps'); ?> <b><a href="https://superpwa.com/contact/" target="_blank"><?php esc_html_e('Contact us', 'super-progressive-web-apps'); ?></a></b></p>
763
+
764
+ <h1><?php esc_html_e(' 4) Report a Bug', 'super-progressive-web-apps'); ?></h1>
765
+ <p class="support-cont"><?php esc_html_e('If you found any bug or having issues with any third party plugins you can contact us ', 'super-progressive-web-apps'); ?> <b><a href="https://superpwa.com/contact/" target="_blank"><?php esc_html_e('Bug Report', 'super-progressive-web-apps'); ?></a></b></p>
766
+ </div>
767
+
768
+ <div id="superpwa_pro_license" class="spwa-tabcontent">
769
+
770
+ <?php
771
+ if ( function_exists('superpwa_pro_upgrade_license_page') ) {
772
+ superpwa_pro_upgrade_license_page();
773
+ }
774
+ ?>
775
+
776
+ </div>
777
+
778
+ </form>
779
+ <details id="superpwa-ocassional-pop-up-container">
780
+ <summary class="superpwa-ocassional-pop-up-open-close-button"><?php esc_html_e('40% OFF - Limited Time Only', 'super-progressive-web-apps')?><svg fill="#fff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 288.359 288.359" style="enable-background:new 0 0 288.359 288.359;" xml:space="preserve"><g><path d="M283.38,4.98c-3.311-3.311-7.842-5.109-12.522-4.972L163.754,3.166c-4.334,0.128-8.454,1.906-11.52,4.972L4.979,155.394 c-6.639,6.639-6.639,17.402,0,24.041L108.924,283.38c6.639,6.639,17.402,6.639,24.041,0l147.256-147.256 c3.065-3.065,4.844-7.186,4.972-11.52l3.159-107.103C288.49,12.821,286.691,8.291,283.38,4.98z M247.831,130.706L123.128,255.407 c-1.785,1.785-4.679,1.785-6.464,0l-83.712-83.712c-1.785-1.785-1.785-4.679,0-6.464L157.654,40.529 c1.785-1.785,4.679-1.785,6.464,0l83.713,83.713C249.616,126.027,249.616,128.921,247.831,130.706z M263.56,47.691 c-6.321,6.322-16.57,6.322-22.892,0c-6.322-6.321-6.322-16.57,0-22.892c6.321-6.322,16.569-6.322,22.892,0 C269.882,31.121,269.882,41.37,263.56,47.691z"/><path d="M99.697,181.278c-5.457,2.456-8.051,3.32-10.006,1.364c-1.592-1.591-1.5-4.411,1.501-7.412 c1.458-1.458,2.927-2.52,4.26-3.298c1.896-1.106,2.549-3.528,1.467-5.438l-0.018-0.029c-0.544-0.96-1.455-1.658-2.522-1.939 c-1.067-0.279-2.202-0.116-3.147,0.453c-1.751,1.054-3.64,2.48-5.587,4.428c-7.232,7.23-7.595,15.599-2.365,20.829 c4.457,4.457,10.597,3.956,17.463,0.637c5.004-2.364,7.55-2.729,9.46-0.819c2.002,2.002,1.638,5.004-1.545,8.186 c-1.694,1.694-3.672,3.044-5.582,4.06c-0.994,0.528-1.728,1.44-2.027,2.525c-0.3,1.085-0.139,2.245,0.443,3.208l0.036,0.06 c1.143,1.889,3.575,2.531,5.503,1.457c2.229-1.241,4.732-3.044,6.902-5.215c8.412-8.412,8.002-16.736,2.864-21.875 C112.475,178.141,107.109,177.868,99.697,181.278z"/><path d="M150.245,157.91l-31.508-16.594c-1.559-0.821-3.47-0.531-4.716,0.714l-4.897,4.898c-1.25,1.25-1.537,3.169-0.707,4.73 l16.834,31.654c0.717,1.347,2.029,2.274,3.538,2.5c1.509,0.225,3.035-0.278,4.114-1.357c1.528-1.528,1.851-3.89,0.786-5.771 l-3.884-6.866l8.777-8.777l6.944,3.734c1.952,1.05,4.361,0.696,5.928-0.871c1.129-1.129,1.654-2.726,1.415-4.303 C152.63,160.023,151.657,158.653,150.245,157.91z M125.621,165.632c0,0-7.822-13.37-9.187-15.644l0.091-0.092 c2.274,1.364,15.872,8.959,15.872,8.959L125.621,165.632z"/><path d="M173.694,133.727c-1.092,0-2.139,0.434-2.911,1.205l-9.278,9.278l-21.352-21.352c-0.923-0.923-2.175-1.441-3.479-1.441 s-2.557,0.519-3.479,1.441c-1.922,1.922-1.922,5.037,0,6.958l24.331,24.332c1.57,1.569,4.115,1.569,5.685,0l13.395-13.395 c1.607-1.607,1.607-4.213,0-5.821C175.833,134.16,174.786,133.727,173.694,133.727z"/><path d="M194.638,111.35l-9.755,9.755l-7.276-7.277l8.459-8.458c1.557-1.558,1.557-4.081-0.001-5.639 c-1.557-1.557-4.082-1.557-5.639,0l-8.458,8.458l-6.367-6.366l9.117-9.117c1.57-1.57,1.57-4.115,0-5.686 c-0.754-0.755-1.776-1.179-2.843-1.179c-1.066,0-2.089,0.424-2.843,1.178l-13.234,13.233c-0.753,0.754-1.177,1.776-1.177,2.843 c0,1.066,0.424,2.089,1.178,2.843l24.968,24.968c1.57,1.569,4.115,1.569,5.685,0l13.87-13.87c1.57-1.57,1.57-4.115,0-5.686 C198.752,109.78,196.208,109.78,194.638,111.35z"/></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></svg></summary>
781
+ <span class="superpwa-promotion-close-btn"> &times; </span>
782
+ <div class="superpwa-ocassional-pop-up-contents">
783
+
784
+ <img src="<?php echo SUPERPWA_PATH_SRC.'public/images/offers.png'?>" class="superpwa-promotion-surprise-icon" />
785
+ <p class="superpwa-ocassional-pop-up-headline"><?php esc_html_e('40% OFF on ', 'super-progressive-web-apps')?><span><?php esc_html_e('SuperPWA PRO', 'super-progressive-web-apps')?></span></p>
786
+ <p class="superpwa-ocassional-pop-up-second-headline"><?php esc_html_e('Upgrade the PRO version during this festive season and get our biggest discount of all time on New Purchases, Renewals &amp; Upgrades', 'super-progressive-web-apps')?></p>
787
+ <a class="superpwa-ocassional-pop-up-offer-btn" href="<?php echo esc_url('https://superpwa.com/november-deal/')?>" target="_blank"><?php esc_html_e('Get This Offer Now', 'super-progressive-web-apps')?></a>
788
+ <p class="superpwa-ocassional-pop-up-last-line"><?php esc_html_e('Black Friday, Cyber Monday, Christmas &amp; New year are the only times we offer discounts this big.', 'super-progressive-web-apps')?></p>
789
+ </div>
790
+
791
+ </details>
792
+ <style>details#superpwa-ocassional-pop-up-container{position:fixed;right:1rem;bottom:1rem;margin-top:2rem;color:#6b7280;display:flex;flex-direction:column;z-index:99999}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents{background-color:#1e1e27;box-shadow:0 5px 10px rgba(0,0,0,.15);padding:25px 25px 10px;border-radius:8px;position:absolute;max-height:calc(100vh - 100px);width:350px;max-width:calc(100vw - 2rem);bottom:calc(100% + 1rem);right:0;overflow:auto;transform-origin:100% 100%;color:#95a3b9;margin-bottom:44px}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents::-webkit-scrollbar{width:15px;background-color:#1e1e27}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents::-webkit-scrollbar-thumb{width:5px;border-radius:99em;background-color:#95a3b9;border:5px solid #1e1e27}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents>*+*{margin-top:.75em}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p>code{font-size:1rem;font-family:monospace}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents pre{white-space:pre-line;border:1px solid #95a3b9;border-radius:6px;font-family:monospace;padding:.75em;font-size:.875rem;color:#fff}details#superpwa-ocassional-pop-up-container[open] div.superpwa-ocassional-pop-up-contents{bottom:0;-webkit-animation:.25s superpwa_ocassional_pop_up_scale;animation:.25s superpwa_ocassional_pop_up_scale}details#superpwa-ocassional-pop-up-container span.superpwa-promotion-close-btn{font-weight:400;font-size:20px;background:#37474f;font-family:sans-serif;border-radius:30px;color:#fff;position:absolute;right:-10px;z-index:99999;padding:0 8px;top:-311px;cursor:pointer;line-height:28px}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents img.superpwa-promotion-surprise-icon{width:40px;float:left;margin-right:10px}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-headline{font-size:21px;margin:0;line-height:47px;font-weight:500;color:#fff}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-headline span{color:#F04720;font-weight:700}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-second-headline{font-size:16px;color:#fff}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents a.superpwa-ocassional-pop-up-offer-btn{background:#1EB7E7;padding:13px 38px 14px;color:#fff;text-align:center;border-radius:60px;font-size:18px;display:inline-flex;align-items:center;margin:0 auto 15px;text-decoration:none;line-height:1.2;transform:perspective(1px) translateZ(0);box-shadow:0 0 20px 5px rgb(0 0 0 / 6%);transition:.3s ease-in-out;box-shadow:3px 5px .65em 0 rgb(0 0 0 / 15%);display:inherit}details#superpwa-ocassional-pop-up-container div.superpwa-ocassional-pop-up-contents p.superpwa-ocassional-pop-up-last-line{font-size:12px;color:#a6a6a6}details#superpwa-ocassional-pop-up-container summary{display:inline-flex;margin-left:auto;margin-right:auto;justify-content:center;align-items:center;font-weight:600;padding:.5em 1.25em;border-radius:99em;color:#fff;background-color:#185adb;box-shadow:0 5px 15px rgba(0,0,0,.1);list-style:none;text-align:center;cursor:pointer;transition:.15s;position:relative;font-size:.9rem;z-index:99999}details#superpwa-ocassional-pop-up-container summary::-webkit-details-marker{display:none}details#superpwa-ocassional-pop-up-container summary:hover,summary:focus{background-color:#1348af}details#superpwa-ocassional-pop-up-container summary svg{width:25px;margin-left:5px;vertical-align:baseline}@-webkit-keyframes superpwa_ocassional_pop_up_scale{0%{transform:superpwa_ocassional_pop_up_scale(0)}100%{transform:superpwa_ocassional_pop_up_scale(1)}}@keyframes superpwa_ocassional_pop_up_scale{0%{transform:superpwa_ocassional_pop_up_scale(0)}100%{transform:superpwa_ocassional_pop_up_scale(1)}}</style>
793
+ <script>function superpwa_set_admin_occasional_ads_pop_up_cookie(){var o=new Date;o.setFullYear(o.getFullYear()+1),document.cookie="superpwa_hide_admin_occasional_ads_pop_up_cookie_feedback=1; expires="+o.toUTCString()+"; path=/"}function superpwa_delete_admin_occasional_ads_pop_up_cookie(){document.cookie="superpwa_hide_admin_occasional_ads_pop_up_cookie_feedback=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function superpwa_get_admin_occasional_ads_pop_up_cookie(){for(var o="superpwa_hide_admin_occasional_ads_pop_up_cookie_feedback=",a=decodeURIComponent(document.cookie).split(";"),e=0;e<a.length;e++){for(var c=a[e];" "==c.charAt(0);)c=c.substring(1);if(0==c.indexOf(o))return c.substring(o.length,c.length)}return""}jQuery(function(o){var a=superpwa_get_admin_occasional_ads_pop_up_cookie();0==a&&""==a&&jQuery("details#superpwa-ocassional-pop-up-container").attr("open",1);void 0!==a&&""!==a&&o("details#superpwa-ocassional-pop-up-container").attr("open",!1),o("details#superpwa-ocassional-pop-up-container span.superpwa-promotion-close-btn").click(function(a){o("details#superpwa-ocassional-pop-up-container summary").click()}),o("details#superpwa-ocassional-pop-up-container summary").click(function(a){var e=o(this).parents("details#superpwa-ocassional-pop-up-container"),c=o(e).attr("open");void 0!==c&&!1!==c?superpwa_set_admin_occasional_ads_pop_up_cookie():superpwa_delete_admin_occasional_ads_pop_up_cookie()})});</script>
794
+
795
+ </div>
796
+ <?php superpwa_newsletter_form(); ?>
797
+ <script type="text/javascript">function openCity(evt, cityName) {var i, tabcontent, tablinks;tabcontent = document.getElementsByClassName("spwa-tabcontent");for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("spwa-tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(cityName).style.display = "block"; evt.currentTarget.className += " active"; }
798
+ var url = window.location.href;
799
+ if(url.indexOf('#advance-settings') > -1){
800
+ document.getElementById("spwa-advance").click();
801
+ }else if(url.indexOf('#support-settings') > -1){
802
+ document.getElementById("spwa-support").click();
803
+ }else if(url.indexOf('#license-settings') > -1){
804
+ document.getElementById("spwa-license").click();
805
+ }else{
806
+ document.getElementById("spwa-default").click();
807
+ }
808
+ </script>
809
+ <?php
810
  }
admin/admin-ui-render-upgrade.php CHANGED
@@ -1,297 +1,297 @@
1
- <?php
2
- /**
3
- * Upgrade to pro Settings UI
4
- *
5
- * @since 1.7
6
- *
7
- * @function superpwa_upgread_pro_interface_render() Add-Ons UI renderer
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) ) exit;
12
-
13
- function superpwa_upgread_pro_interface_render(){
14
- // Authentication
15
- if ( ! current_user_can( 'manage_options' ) ) {
16
- return;
17
- }
18
-
19
- ?>
20
- <link rel='stylesheet' href='<?php echo SUPERPWA_PATH_SRC . 'admin/css/upgrade-ui.css?ver='.SUPERPWA_VERSION ?>' media='all' />
21
-
22
- <div class="wrap">
23
- <!-- Add-Ons UI -->
24
- <div class="wp-list-table widefat addon-install">
25
-
26
- <div id="the-list">
27
- <?php
28
- if(defined('SUPERPWA_PRO_VERSION')){
29
- do_action("admin_upgrade_license_page");
30
- }else{ ?>
31
-
32
-
33
- <div class="fp-wr">
34
- <div class="sp-fp-img">
35
- <span class="sp_ov"></span>
36
- </div>
37
- <div class="sp-fp-cnt">
38
- <h1><?php _e( 'Upgrade to SuperPWA Pro'); ?></h1>
39
- <p><?php _e( 'Take your PWA to the next level with SuperPWA PRO version.', 'super-progressive-web-apps' ); ?></p>
40
- <a class="buy" href="#upgrade"><?php _e( 'Purchase now', 'super-progressive-web-apps' ); ?></a>
41
- </div>
42
- <div class="pvf">
43
- <div class="ext">
44
- <div class="ex-1 e-1">
45
- <h4><?php _e( 'Premium Features', 'super-progressive-web-apps' ); ?></h4>
46
- <p><?php _e( 'The premium features of SuperPWA enhances your app and takes it to a next level to help you reach more engagement and personalization with your user.', 'super-progressive-web-apps' ); ?></p>
47
- </div>
48
- <div class="ex-1 e-2">
49
- <h4><?php _e( 'Continuous Innovation', 'super-progressive-web-apps' ); ?></h4>
50
- <p><?php _e( 'We are planning to continiously build premium features and release them. We have a roadmap and we listen to our customers to turn their feedback into reality.', 'super-progressive-web-apps' ); ?></p>
51
- </div>
52
- <div class="ex-1 e-3">
53
- <h4><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></h4>
54
- <p><?php _e( 'Get private ticketing help from our full-time technical staff & developers who helps you with the technical issues.', 'super-progressive-web-apps' ); ?></p>
55
- </div>
56
- </div><!-- /. ext -->
57
- <div class="pvf-cnt">
58
- <div class="pvf-tlt">
59
- <h2><?php _e( 'Compare Pro vs. Free Version', 'super-progressive-web-apps' ); ?></h2>
60
- <span><?php _e( 'See what you\'ll get with the professional version', 'super-progressive-web-apps' ); ?></span>
61
- </div>
62
- <div class="pvf-cmp">
63
- <div class="fr">
64
- <h1>FREE</h1>
65
- <div class="fr-fe">
66
- <div class="fe-1">
67
- <h4><?php _e( 'Continious Development', 'super-progressive-web-apps' ); ?></h4>
68
- <p><?php _e( 'We take bug reports and feature requests seriously. We’re continiously developing &amp; improve this product for last 2 years with passion and love.', 'super-progressive-web-apps' ); ?></p>
69
- </div>
70
- <div class="fe-1">
71
- <h4><?php _e( '50+ Features', 'super-progressive-web-apps' ); ?></h4>
72
- <p><?php _e( 'We\'re constantly expanding the plugin and make it more useful. We have wide variety of features which will fit any use-case.', 'super-progressive-web-apps' ); ?></p>
73
- </div>
74
- </div><!-- /. fr-fe -->
75
- </div><!-- /. fr -->
76
- <div class="pr">
77
- <h1>PRO</h1>
78
- <div class="pr-fe">
79
- <span><?php _e( 'Everything in Free, and:', 'super-progressive-web-apps' ); ?></span>
80
- <div class="fet">
81
- <div class="fe-2">
82
- <div class="fe-t">
83
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
84
- <h4><?php _e( 'Call to Action feature', 'super-progressive-web-apps' ); ?></h4>
85
- </div>
86
- <p><?php _e( 'Easily gives notification banner your users to Add to Homescreen on website.', 'super-progressive-web-apps' ); ?></p>
87
- </div>
88
- <div class="fe-2">
89
- <div class="fe-t">
90
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
91
- <h4><?php _e( 'Advanced Tech Support', 'super-progressive-web-apps' ); ?></h4>
92
- </div>
93
- <p><?php _e( 'High skilled team will go above & beyond to help you with issues.', 'super-progressive-web-apps' ); ?></p>
94
- </div>
95
-
96
- <div class="fe-2">
97
- <div class="fe-t">
98
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
99
- <h4>Android APK APP Generator</h4>
100
- </div>
101
- <p>Easily generate Android APP (APK package) of your current PWA website.</p>
102
- </div>
103
-
104
- <div class="fe-2">
105
- <div class="fe-t">
106
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
107
- <h4>Continious Updates</h4>
108
- </div>
109
- <p>We're continiously updating our premium features and releasing them.</p>
110
- </div>
111
- <div class="fe-2">
112
- <div class="fe-t">
113
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
114
- <h4>Innovation</h4>
115
- </div>
116
- <p>Be the first one to get the innovative features that we build in the future.</p>
117
- </div>
118
- <div class="fe-2">
119
- <div class="fe-t">
120
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
121
- <h4>Documentation</h4>
122
- </div>
123
- <p>We create tutorials for every possible feature and keep it updated for you.</p>
124
- </div>
125
- </div><!-- /. fet -->
126
- <div class="pr-btn">
127
- <a href="#upgrade">Upgrade to Pro</a>
128
- </div><!-- /. pr-btn -->
129
- </div><!-- /. pr-fe -->
130
- </div><!-- /.pr -->
131
- </div><!-- /. pvf-cmp -->
132
- </div><!-- /. pvf-cnt -->
133
- <div id="upgrade" class="amp-upg">
134
- <div class="upg-t">
135
- <h2>Let's Upgrade Your PWA</h2>
136
- <span>Choose your plan and upgrade in minutes!</span>
137
- </div>
138
- <div class="sp-pri-lst">
139
- <div class="pri-tb">
140
- <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=1" target="_blank">
141
- <h5>PERSONAL</h5>
142
- <span class="d-amt"><sup>$</sup>99</span>
143
- <span class="amt"><sup>$</sup>99</span>
144
- <span class="s-amt">(Save $59)</span>
145
- <span class="bil">Billed Annually</span>
146
- <span class="s">1 Site License</span>
147
- <span class="e">Tech Support</span>
148
- <span class="f">1 year Updates </span>
149
- <span class="sp-sv">Pro Features </span>
150
- <span class="pri-by">Buy Now</span>
151
- </a>
152
- </div>
153
- <div class="pri-tb rec">
154
- <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=2" target="_blank">
155
- <h5>MULTIPLE</h5>
156
- <span class="d-amt"><sup>$</sup>129</span>
157
- <span class="amt"><sup>$</sup>129</span>
158
- <span class="s-amt">(Save $79)</span>
159
- <span class="bil">Billed Annually</span>
160
- <span class="s">3 Site License</span>
161
- <span class="e">Tech Support</span>
162
- <span class="f">1 year Updates</span>
163
- <span class="sp-sv">Save 78%</span>
164
- <span class="pri-by">Buy Now</span>
165
- <span class="sp-rcm">RECOMMENDED</span>
166
- </a>
167
- </div>
168
- <div class="pri-tb">
169
- <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=3" target="_blank">
170
- <h5>WEBMASTER</h5>
171
- <span class="d-amt"><sup>$</sup>199</span>
172
- <span class="amt"><sup>$</sup>199</span>
173
- <span class="s-amt">(Save $99)</span>
174
- <span class="bil">Billed Annually</span>
175
- <span class="s">10 Site License</span>
176
- <span class="e">Tech Support</span>
177
- <span class="f">Pro Features</span>
178
- <span class="sp-sv">Save 83%</span>
179
- <span class="pri-by">Buy Now</span>
180
- </a>
181
- </div>
182
- <div class="pri-tb">
183
- <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=4" target="_blank">
184
- <h5>FREELANCER</h5>
185
- <span class="d-amt"><sup>$</sup>249</span>
186
- <span class="amt"><sup>$</sup>249</span>
187
- <span class="s-amt">(Save $119)</span>
188
- <span class="bil">Billed Annually</span>
189
- <span class="s">25 Site License</span>
190
- <span class="e">Tech Support</span>
191
- <span class="f">Pro Features</span>
192
- <span class="sp-sv">Save 90%</span>
193
- <span class="pri-by">Buy Now</span>
194
- </a>
195
- </div>
196
- <div class="pri-tb">
197
- <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=5" target="_blank">
198
- <h5>AGENCY</h5>
199
- <span class="d-amt"><sup>$</sup>499</span>
200
- <span class="amt"><sup>$</sup>499</span>
201
- <span class="s-amt">(Save $199)</span>
202
- <span class="bil">Billed Annually</span>
203
- <span class="s">Unlimited Site</span>
204
- <span class="e">E-mail support</span>
205
- <span class="f">Pro Features</span>
206
- <span class="sp-sv">UNLIMITED</span>
207
- <span class="pri-by">Buy Now</span>
208
- </a>
209
- </div>
210
- <div class="pri-tb">
211
- <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=6" target="_blank">
212
- <h5>LIFETIME</h5>
213
- <span class="d-amt"><sup>$</sup>999</span>
214
- <span class="amt"><sup>$</sup>999</span>
215
- <span class="s-amt">(Save $199)</span>
216
- <span class="bil">Billed Annually</span>
217
- <span class="s">Unlimited Site</span>
218
- <span class="e">Tech Support</span>
219
- <span class="f">Pro Features</span>
220
- <span class="sp-sv">UNLIMITED</span>
221
- <span class="pri-by">Buy Now</span>
222
- </a>
223
- </div>
224
- </div><!-- /.pri-lst -->
225
- <div class="tru-us">
226
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/rating.png' ?>">
227
- <h2>Used by more than 40000+ Users!</h2>
228
- <p>More than 40k Websites, Blogs &amp; E-Commerce shops are powered by our SuperPWA making it the #1 Independent PWA plugin in WordPress.</p>
229
- <a href="https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?filter=5" target="_blank">Read The Reviews</a>
230
- </div>
231
- </div><!--/ .amp-upg -->
232
- <div class="ampfaq">
233
- <h4>Frequently Asked Questions</h4>
234
- <div class="faq-lst">
235
- <div class="lt">
236
- <ul>
237
- <li>
238
- <span>Is there a setup fee?</span>
239
- <p>No. There are no setup fees on any of our plans</p>
240
- </li>
241
- <li>
242
- <span>What's the time span for your contracts?</span>
243
- <p>All the plans are year-to-year which are subscribed annually except for lifetime plan.</p>
244
- </li>
245
- <li>
246
- <span>What payment methods are accepted?</span>
247
- <p>We accepts PayPal and Credit Card payments.</p>
248
- </li>
249
- <li>
250
- <span>Do you offer support if I need help?</span>
251
- <p>Yes! Top-notch customer support for our paid customers is key for a quality product, so we’ll do our very best to resolve any issues you encounter via our support page.</p>
252
- </li>
253
- <li>
254
- <span>Can I use the plugins after my subscription is expired?</span>
255
- <p>Yes, you can use the plugins but you will not get future updates for those plugins.</p>
256
- </li>
257
- </ul>
258
- </div>
259
- <div class="rt">
260
- <ul>
261
- <li>
262
- <span>Can I cancel my membership at any time?</span>
263
- <p>Yes. You can cancel your membership by contacting us.</p>
264
- </li>
265
- <li>
266
- <span>Can I change my plan later on?</span>
267
- <p>Yes. You can upgrade your plan by contacting us.</p>
268
- </li>
269
- <li>
270
- <span>Do you offer refunds?</span>
271
- <p>You are fully protected by our 100% Money Back Guarantee Unconditional. If during the next 14 days you experience an issue that makes the plugin unusable and we are unable to resolve it, well happily offer a full refund.</p>
272
- </li>
273
- <li>
274
- <span>Do I get updates for the premium plugin?</span>
275
- <p>Yes, you will get updates for all the premium plugins until your subscription is active.</p>
276
- </li>
277
- </ul>
278
- </div>
279
- </div><!-- /.faq-lst -->
280
- <div class="f-cnt">
281
- <span>I have other pre-sale questions, can you help?</span>
282
- <p>All the plans are year-to-year which are subscribed annually.</p>
283
- <a href="https://superpwa.com/contact/'?utm_source=superpwa-plugin&utm_medium=addon-card'">Contact a Human</a>
284
- </div><!-- /.f-cnt -->
285
- </div><!-- /.faq -->
286
- </div><!-- /. pvf -->
287
- </div>
288
- <?php } ?>
289
-
290
-
291
-
292
-
293
- </div>
294
- </div>
295
- </div>
296
- <?php
297
- }
1
+ <?php
2
+ /**
3
+ * Upgrade to pro Settings UI
4
+ *
5
+ * @since 1.7
6
+ *
7
+ * @function superpwa_upgread_pro_interface_render() Add-Ons UI renderer
8
+ */
9
+
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) ) exit;
12
+
13
+ function superpwa_upgread_pro_interface_render(){
14
+ // Authentication
15
+ if ( ! current_user_can( 'manage_options' ) ) {
16
+ return;
17
+ }
18
+
19
+ ?>
20
+ <link rel='stylesheet' href='<?php echo SUPERPWA_PATH_SRC . 'admin/css/upgrade-ui.css?ver='.SUPERPWA_VERSION ?>' media='all' />
21
+
22
+ <div class="wrap">
23
+ <!-- Add-Ons UI -->
24
+ <div class="wp-list-table widefat addon-install">
25
+
26
+ <div id="the-list">
27
+ <?php
28
+ if(defined('SUPERPWA_PRO_VERSION')){
29
+ do_action("admin_upgrade_license_page");
30
+ }else{ ?>
31
+
32
+
33
+ <div class="fp-wr">
34
+ <div class="sp-fp-img">
35
+ <span class="sp_ov"></span>
36
+ </div>
37
+ <div class="sp-fp-cnt">
38
+ <h1><?php _e( 'Upgrade to SuperPWA Pro','super-progressive-web-apps'); ?></h1>
39
+ <p><?php _e( 'Take your PWA to the next level with SuperPWA PRO version.', 'super-progressive-web-apps' ); ?></p>
40
+ <a class="buy" href="#upgrade"><?php _e( 'Purchase now', 'super-progressive-web-apps' ); ?></a>
41
+ </div>
42
+ <div class="pvf">
43
+ <div class="ext">
44
+ <div class="ex-1 e-1">
45
+ <h4><?php _e( 'Premium Features', 'super-progressive-web-apps' ); ?></h4>
46
+ <p><?php _e( 'The premium features of SuperPWA enhances your app and takes it to a next level to help you reach more engagement and personalization with your user.', 'super-progressive-web-apps' ); ?></p>
47
+ </div>
48
+ <div class="ex-1 e-2">
49
+ <h4><?php _e( 'Continuous Innovation', 'super-progressive-web-apps' ); ?></h4>
50
+ <p><?php _e( 'We are planning to continiously build premium features and release them. We have a roadmap and we listen to our customers to turn their feedback into reality.', 'super-progressive-web-apps' ); ?></p>
51
+ </div>
52
+ <div class="ex-1 e-3">
53
+ <h4><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></h4>
54
+ <p><?php _e( 'Get private ticketing help from our full-time technical staff & developers who helps you with the technical issues.', 'super-progressive-web-apps' ); ?></p>
55
+ </div>
56
+ </div><!-- /. ext -->
57
+ <div class="pvf-cnt">
58
+ <div class="pvf-tlt">
59
+ <h2><?php _e( 'Compare Pro vs. Free Version', 'super-progressive-web-apps' ); ?></h2>
60
+ <span><?php _e( 'See what you\'ll get with the professional version', 'super-progressive-web-apps' ); ?></span>
61
+ </div>
62
+ <div class="pvf-cmp">
63
+ <div class="fr">
64
+ <h1>FREE</h1>
65
+ <div class="fr-fe">
66
+ <div class="fe-1">
67
+ <h4><?php _e( 'Continious Development', 'super-progressive-web-apps' ); ?></h4>
68
+ <p><?php _e( 'We take bug reports and feature requests seriously. We’re continiously developing &amp; improve this product for last 2 years with passion and love.', 'super-progressive-web-apps' ); ?></p>
69
+ </div>
70
+ <div class="fe-1">
71
+ <h4><?php _e( '50+ Features', 'super-progressive-web-apps' ); ?></h4>
72
+ <p><?php _e( 'We\'re constantly expanding the plugin and make it more useful. We have wide variety of features which will fit any use-case.', 'super-progressive-web-apps' ); ?></p>
73
+ </div>
74
+ </div><!-- /. fr-fe -->
75
+ </div><!-- /. fr -->
76
+ <div class="pr">
77
+ <h1>PRO</h1>
78
+ <div class="pr-fe">
79
+ <span><?php _e( 'Everything in Free, and:', 'super-progressive-web-apps' ); ?></span>
80
+ <div class="fet">
81
+ <div class="fe-2">
82
+ <div class="fe-t">
83
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
84
+ <h4><?php _e( 'Call to Action feature', 'super-progressive-web-apps' ); ?></h4>
85
+ </div>
86
+ <p><?php _e( 'Easily gives notification banner your users to Add to Homescreen on website.', 'super-progressive-web-apps' ); ?></p>
87
+ </div>
88
+ <div class="fe-2">
89
+ <div class="fe-t">
90
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
91
+ <h4><?php _e( 'Advanced Tech Support', 'super-progressive-web-apps' ); ?></h4>
92
+ </div>
93
+ <p><?php _e( 'High skilled team will go above & beyond to help you with issues.', 'super-progressive-web-apps' ); ?></p>
94
+ </div>
95
+
96
+ <div class="fe-2">
97
+ <div class="fe-t">
98
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
99
+ <h4><?php _e( 'Android APK APP Generator', 'super-progressive-web-apps' ); ?></h4>
100
+ </div>
101
+ <p><?php _e( 'Easily generate Android APP (APK package) of your current PWA website.', 'super-progressive-web-apps' ); ?></p>
102
+ </div>
103
+
104
+ <div class="fe-2">
105
+ <div class="fe-t">
106
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
107
+ <h4><?php _e( 'Continuous Updates', 'super-progressive-web-apps' ); ?></h4>
108
+ </div>
109
+ <p><?php _e( 'We\'re continuously updating our premium features and releasing them.', 'super-progressive-web-apps' ); ?></p>
110
+ </div>
111
+ <div class="fe-2">
112
+ <div class="fe-t">
113
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
114
+ <h4><?php _e( 'Innovation', 'super-progressive-web-apps' ); ?></h4>
115
+ </div>
116
+ <p><?php _e( 'Be the first one to get the innovative features that we build in the future.', 'super-progressive-web-apps' ); ?></p>
117
+ </div>
118
+ <div class="fe-2">
119
+ <div class="fe-t">
120
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/tick.png' ?>">
121
+ <h4><?php _e( 'Documentation', 'super-progressive-web-apps' ); ?></h4>
122
+ </div>
123
+ <p><?php _e( 'We create tutorials for every possible feature and keep it updated for you.', 'super-progressive-web-apps' ); ?></p>
124
+ </div>
125
+ </div><!-- /. fet -->
126
+ <div class="pr-btn">
127
+ <a href="#upgrade"><?php _e( 'Upgrade to Pro', 'super-progressive-web-apps' ); ?></a>
128
+ </div><!-- /. pr-btn -->
129
+ </div><!-- /. pr-fe -->
130
+ </div><!-- /.pr -->
131
+ </div><!-- /. pvf-cmp -->
132
+ </div><!-- /. pvf-cnt -->
133
+ <div id="upgrade" class="amp-upg">
134
+ <div class="upg-t">
135
+ <h2><?php _e( 'Let\'s Upgrade Your PWA', 'super-progressive-web-apps' ); ?></h2>
136
+ <span><?php _e( 'Choose your plan and upgrade in minutes!', 'super-progressive-web-apps' ); ?></span>
137
+ </div>
138
+ <div class="sp-pri-lst">
139
+ <div class="pri-tb">
140
+ <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=1" target="_blank">
141
+ <h5><?php _e( 'PERSONAL', 'super-progressive-web-apps' ); ?></h5>
142
+ <span class="d-amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '99', 'super-progressive-web-apps' ); ?></span>
143
+ <span class="amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '99', 'super-progressive-web-apps' ); ?></span>
144
+ <span class="s-amt"><?php _e( '(Save $59)', 'super-progressive-web-apps' ); ?></span>
145
+ <span class="bil"><?php _e( 'Billed Annually', 'super-progressive-web-apps' ); ?></span>
146
+ <span class="s"><?php _e( '1 Site License', 'super-progressive-web-apps' ); ?></span>
147
+ <span class="e"><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></span>
148
+ <span class="f"><?php _e( '1 year Updates', 'super-progressive-web-apps' ); ?> </span>
149
+ <span class="sp-sv"><?php _e( 'Pro Features', 'super-progressive-web-apps' ); ?> </span>
150
+ <span class="pri-by"><?php _e( 'Buy Now', 'super-progressive-web-apps' ); ?></span>
151
+ </a>
152
+ </div>
153
+ <div class="pri-tb rec">
154
+ <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=2" target="_blank">
155
+ <h5><?php _e( 'MULTIPLE', 'super-progressive-web-apps' ); ?></h5>
156
+ <span class="d-amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '129', 'super-progressive-web-apps' ); ?></span>
157
+ <span class="amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '129', 'super-progressive-web-apps' ); ?></span>
158
+ <span class="s-amt"><?php _e( '(Save $79)', 'super-progressive-web-apps' ); ?></span>
159
+ <span class="bil"><?php _e( 'Billed Annually', 'super-progressive-web-apps' ); ?></span>
160
+ <span class="s"><?php _e( '3 Site License', 'super-progressive-web-apps' ); ?></span>
161
+ <span class="e"><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></span>
162
+ <span class="f"><?php _e( '1 year Updates', 'super-progressive-web-apps' ); ?></span>
163
+ <span class="sp-sv"><?php _e( 'Save 78%', 'super-progressive-web-apps' ); ?></span>
164
+ <span class="pri-by"><?php _e( 'Buy Now', 'super-progressive-web-apps' ); ?></span>
165
+ <span class="sp-rcm"><?php _e( 'RECOMMENDED', 'super-progressive-web-apps' ); ?></span>
166
+ </a>
167
+ </div>
168
+ <div class="pri-tb">
169
+ <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=3" target="_blank">
170
+ <h5><?php _e( 'WEBMASTER', 'super-progressive-web-apps' ); ?></h5>
171
+ <span class="d-amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '199', 'super-progressive-web-apps' ); ?></span>
172
+ <span class="amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '199', 'super-progressive-web-apps' ); ?></span>
173
+ <span class="s-amt"><?php _e( '(Save $99)', 'super-progressive-web-apps' ); ?></span>
174
+ <span class="bil"><?php _e( 'Billed Annually', 'super-progressive-web-apps' ); ?></span>
175
+ <span class="s"><?php _e( '10 Site License', 'super-progressive-web-apps' ); ?></span>
176
+ <span class="e"><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></span>
177
+ <span class="f"><?php _e( 'Pro Features', 'super-progressive-web-apps' ); ?></span>
178
+ <span class="sp-sv"><?php _e( 'Save 83%', 'super-progressive-web-apps' ); ?></span>
179
+ <span class="pri-by"><?php _e( 'Buy Now', 'super-progressive-web-apps' ); ?></span>
180
+ </a>
181
+ </div>
182
+ <div class="pri-tb">
183
+ <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=4" target="_blank">
184
+ <h5><?php _e( 'FREELANCER', 'super-progressive-web-apps' ); ?></h5>
185
+ <span class="d-amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '249', 'super-progressive-web-apps' ); ?></span>
186
+ <span class="amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '249', 'super-progressive-web-apps' ); ?></span>
187
+ <span class="s-amt"><?php _e( '(Save $119)', 'super-progressive-web-apps' ); ?></span>
188
+ <span class="bil"><?php _e( 'Billed Annually', 'super-progressive-web-apps' ); ?></span>
189
+ <span class="s"><?php _e( '25 Site License', 'super-progressive-web-apps' ); ?></span>
190
+ <span class="e"><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></span>
191
+ <span class="f"><?php _e( 'Pro Features', 'super-progressive-web-apps' ); ?></span>
192
+ <span class="sp-sv"><?php _e( 'Save 90%', 'super-progressive-web-apps' ); ?></span>
193
+ <span class="pri-by"><?php _e( 'Buy Now', 'super-progressive-web-apps' ); ?></span>
194
+ </a>
195
+ </div>
196
+ <div class="pri-tb">
197
+ <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=5" target="_blank">
198
+ <h5><?php _e( 'AGENCY', 'super-progressive-web-apps' ); ?></h5>
199
+ <span class="d-amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '499', 'super-progressive-web-apps' ); ?></span>
200
+ <span class="amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '499', 'super-progressive-web-apps' ); ?></span>
201
+ <span class="s-amt"><?php _e( '(Save $199)', 'super-progressive-web-apps' ); ?></span>
202
+ <span class="bil"><?php _e( 'Billed Annually', 'super-progressive-web-apps' ); ?></span>
203
+ <span class="s"><?php _e( 'Unlimited Site', 'super-progressive-web-apps' ); ?></span>
204
+ <span class="e"><?php _e( 'E-mail Support', 'super-progressive-web-apps' ); ?></span>
205
+ <span class="f"><?php _e( 'Pro Features', 'super-progressive-web-apps' ); ?></span>
206
+ <span class="sp-sv"><?php _e( 'UNLIMITED', 'super-progressive-web-apps' ); ?></span>
207
+ <span class="pri-by"><?php _e( 'Buy Now', 'super-progressive-web-apps' ); ?></span>
208
+ </a>
209
+ </div>
210
+ <div class="pri-tb">
211
+ <a href="https://superpwa.com/checkout?edd_action=add_to_cart&download_id=666&edd_options[price_id]=6" target="_blank">
212
+ <h5><?php _e( 'LIFETIME', 'super-progressive-web-apps' ); ?></h5>
213
+ <span class="d-amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '999', 'super-progressive-web-apps' ); ?></span>
214
+ <span class="amt"><sup><?php _e( '$', 'super-progressive-web-apps' ); ?></sup><?php _e( '999', 'super-progressive-web-apps' ); ?></span>
215
+ <span class="s-amt"><?php _e( '(Save $199)', 'super-progressive-web-apps' ); ?></span>
216
+ <span class="bil"><?php _e( 'Billed Annually', 'super-progressive-web-apps' ); ?></span>
217
+ <span class="s"><?php _e( 'Unlimited Site', 'super-progressive-web-apps' ); ?></span>
218
+ <span class="e"><?php _e( 'Tech Support', 'super-progressive-web-apps' ); ?></span>
219
+ <span class="f"><?php _e( 'Pro Features', 'super-progressive-web-apps' ); ?></span>
220
+ <span class="sp-sv"><?php _e( 'UNLIMITED', 'super-progressive-web-apps' ); ?></span>
221
+ <span class="pri-by"><?php _e( 'Buy Now', 'super-progressive-web-apps' ); ?></span>
222
+ </a>
223
+ </div>
224
+ </div><!-- /.pri-lst -->
225
+ <div class="tru-us">
226
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/rating.png' ?>">
227
+ <h2><?php _e( 'Used by more than 40000+ Users!', 'super-progressive-web-apps' ); ?></h2>
228
+ <p><?php _e( 'More than 40k Websites, Blogs &amp; E-Commerce shops are powered by our SuperPWA making it the #1 Independent PWA plugin in WordPress.', 'super-progressive-web-apps' ); ?></p>
229
+ <a href="https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?filter=5" target="_blank"><?php _e( 'Read The Reviews', 'super-progressive-web-apps' ); ?></a>
230
+ </div>
231
+ </div><!--/ .amp-upg -->
232
+ <div class="ampfaq">
233
+ <h4><?php _e( 'Frequently Asked Questions', 'super-progressive-web-apps' ); ?></h4>
234
+ <div class="faq-lst">
235
+ <div class="lt">
236
+ <ul>
237
+ <li>
238
+ <span><?php _e( 'Is there a setup fee?', 'super-progressive-web-apps' ); ?></span>
239
+ <p><?php _e( 'No. There are no setup fees on any of our plans', 'super-progressive-web-apps' ); ?></p>
240
+ </li>
241
+ <li>
242
+ <span><?php _e( 'What\'s the time span for your contracts?', 'super-progressive-web-apps' ); ?></span>
243
+ <p><?php _e( 'All the plans are year-to-year which are subscribed annually except for lifetime plan.', 'super-progressive-web-apps' ); ?></p>
244
+ </li>
245
+ <li>
246
+ <span><?php _e( 'What payment methods are accepted?', 'super-progressive-web-apps' ); ?></span>
247
+ <p><?php _e( 'RWe accepts PayPal and Credit Card payments.', 'super-progressive-web-apps' ); ?></p>
248
+ </li>
249
+ <li>
250
+ <span><?php _e( 'Do you offer support if I need help?', 'super-progressive-web-apps' ); ?></span>
251
+ <p><?php _e( 'Yes! Top-notch customer support for our paid customers is key for a quality product, so we’ll do our very best to resolve any issues you encounter via our support page.', 'super-progressive-web-apps' ); ?></p>
252
+ </li>
253
+ <li>
254
+ <span><?php _e( 'Can I use the plugins after my subscription is expired?', 'super-progressive-web-apps' ); ?></span>
255
+ <p><?php _e( 'Yes, you can use the plugins but you will not get future updates for those plugins.', 'super-progressive-web-apps' ); ?></p>
256
+ </li>
257
+ </ul>
258
+ </div>
259
+ <div class="rt">
260
+ <ul>
261
+ <li>
262
+ <span><?php _e( 'Can I cancel my membership at any time?', 'super-progressive-web-apps' ); ?></span>
263
+ <p><?php _e( 'Yes. You can cancel your membership by contacting us.', 'super-progressive-web-apps' ); ?></p>
264
+ </li>
265
+ <li>
266
+ <span><?php _e( 'Can I change my plan later on?', 'super-progressive-web-apps' ); ?></span>
267
+ <p><?php _e( 'Yes. You can upgrade your plan by contacting us.', 'super-progressive-web-apps' ); ?></p>
268
+ </li>
269
+ <li>
270
+ <span><?php _e( 'Do you offer refunds?', 'super-progressive-web-apps' ); ?></span>
271
+ <p><?php _e( 'You are fully protected by our 100% Money Back Guarantee Unconditional. If during the next 14 days you experience an issue that makes the plugin unusable and we are unable to resolve it, we\'ll happily offer a full refund.', 'super-progressive-web-apps' ); ?></p>
272
+ </li>
273
+ <li>
274
+ <span><?php _e( 'Do I get updates for the premium plugin?', 'super-progressive-web-apps' ); ?></span>
275
+ <p><?php _e( 'Yes, you will get updates for all the premium plugins until your subscription is active.', 'super-progressive-web-apps' ); ?></p>
276
+ </li>
277
+ </ul>
278
+ </div>
279
+ </div><!-- /.faq-lst -->
280
+ <div class="f-cnt">
281
+ <span><?php _e( 'I have other pre-sale questions, can you help?', 'super-progressive-web-apps' ); ?></span>
282
+ <p><?php _e( 'All the plans are year-to-year which are subscribed annually.', 'super-progressive-web-apps' ); ?></p>
283
+ <a href="https://superpwa.com/contact/'?utm_source=superpwa-plugin&utm_medium=addon-card'"><?php _e( 'Contact a Human', 'super-progressive-web-apps' ); ?></a>
284
+ </div><!-- /.f-cnt -->
285
+ </div><!-- /.faq -->
286
+ </div><!-- /. pvf -->
287
+ </div>
288
+ <?php } ?>
289
+
290
+
291
+
292
+
293
+ </div>
294
+ </div>
295
+ </div>
296
+ <?php
297
+ }
admin/admin-ui-setup.php CHANGED
@@ -1,607 +1,617 @@
1
- <?php
2
- /**
3
- * Admin setup for the plugin
4
- *
5
- * @since 1.0
6
- * @function superpwa_add_menu_links() Add admin menu pages
7
- * @function superpwa_register_settings Register Settings
8
- * @function superpwa_validater_and_sanitizer() Validate And Sanitize User Input Before Its Saved To Database
9
- * @function superpwa_get_settings() Get settings from database
10
- * @function superpwa_enqueue_css_js() Enqueue CSS and JS
11
- * @function superpwa_after_save_settings_todo() Todo list after saving admin options
12
- * @function superpwa_footer_text() Admin footer text
13
- * @function superpwa_footer_version() Admin footer version
14
- */
15
-
16
- // Exit if accessed directly
17
- if ( ! defined( 'ABSPATH' ) ) exit;
18
-
19
- /**
20
- * Add admin menu pages
21
- *
22
- * @since 1.0
23
- * @refer https://developer.wordpress.org/plugins/administration-menus/
24
- */
25
- function superpwa_add_menu_links() {
26
-
27
- // Main menu page
28
- add_menu_page( __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'SuperPWA', 'super-progressive-web-apps' ), 'manage_options', 'superpwa','superpwa_admin_interface_render', SUPERPWA_PATH_SRC. 'admin/img/superpwa-menu-icon.png', 100 );
29
-
30
- // Settings page - Same as main menu page
31
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Settings', 'super-progressive-web-apps' ), 'manage_options', 'superpwa', 'superpwa_admin_interface_render', 60);
32
-
33
- // Add-Ons page
34
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Add-ons', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-addons', 'superpwa_addons_interface_render', 70);
35
-
36
- // UTM Tracking sub-menu
37
- if ( superpwa_addons_status( 'utm_tracking' ) == 'active' ){
38
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'UTM Tracking', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-utm-tracking', 'superpwa_utm_tracking_interface_render', 72 );
39
- }
40
-
41
- // apple touch icons sub-menu
42
- if ( superpwa_addons_status( 'apple_touch_icons' ) == 'active' ){
43
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Apple icons', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-apple-icons', 'superpwa_apple_icons_interface_render', 74 );
44
- }
45
-
46
- // pull to refresh sub-menu
47
- if ( superpwa_addons_status( 'pull_to_refresh' ) == 'active' ){
48
- add_submenu_page( 'superpwa', __( 'Pull To Refresh', 'super-progressive-web-apps' ), __( 'Pull To Refresh', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-pull-to-refresh', 'superpwa_pull_to_refresh_interface_render', 74 );
49
- }
50
-
51
- // Caching Strategies sub-menu
52
- if ( superpwa_addons_status( 'caching_strategies' ) == 'active' ){
53
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Caching Strategies', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-caching-strategies', 'superpwa_caching_strategies_interface_render', 74 );
54
- }
55
-
56
- // Upgrade to pro page
57
- $textlicense = "<span style='color: #ff4c4c;font-weight: 700;font-size: 15px;'>".__( 'Upgrade to Pro', 'super-progressive-web-apps' )."</span>";
58
- if( defined('SUPERPWA_PRO_VERSION') ){
59
-
60
- $license_alert = $days = '';
61
- $license_info = get_option("superpwa_pro_upgrade_license");
62
- if ($license_info) {
63
-
64
- $license_exp = date('Y-m-d', strtotime($license_info['pro']['license_key_expires']));
65
- $license_info_lifetime = $license_info['pro']['license_key_expires'];
66
- $today = date('Y-m-d');
67
- $exp_date = $license_exp;
68
- $date1 = date_create($today);
69
- $date2 = date_create($exp_date);
70
- $diff = date_diff($date1,$date2);
71
- $days = $diff->format("%a");
72
- if( $license_info_lifetime == 'lifetime' ){
73
- $days = 'Lifetime';
74
- if ($days == 'Lifetime') {
75
- $expire_msg = " Your License is Valid for Lifetime ";
76
- }
77
- }
78
- else if($today > $exp_date){
79
- $days = -$days;
80
- }
81
-
82
-
83
-
84
- $license_alert = isset($days) && $days!==0 && $days<=30 && $days!=='Lifetime' ? "<span class='superpwa_pro_icon dashicons dashicons-warning superpwa_pro_alert' style='color: #ffb229;left: 3px;position: relative;'></span>": "" ;
85
- }
86
- $textlicense = __( 'License', 'super-progressive-web-apps' );
87
-
88
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), $textlicense.$license_alert, 'manage_options', 'superpwa#license-settings', 'superpwa_upgread_pro_interface_render' , 9999999);
89
- }else{
90
- add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), $textlicense, 'manage_options', 'superpwa-upgrade', 'superpwa_upgread_pro_interface_render' , 9999999);
91
- }
92
-
93
- }
94
- add_action( 'admin_menu', 'superpwa_add_menu_links' );
95
-
96
- /**
97
- * Register Settings
98
- *
99
- * @since 1.0
100
- */
101
- function superpwa_register_settings() {
102
-
103
- // Register Setting
104
- register_setting(
105
- 'superpwa_settings_group', // Group name
106
- 'superpwa_settings', // Setting name = html form <input> name on settings form
107
- 'superpwa_validater_and_sanitizer' // Input sanitizer
108
- );
109
-
110
- // Basic Application Settings
111
- add_settings_section(
112
- 'superpwa_basic_settings_section', // ID
113
- __return_false(), // Title
114
- '__return_false', // Callback Function
115
- 'superpwa_basic_settings_section' // Page slug
116
- );
117
-
118
- // Application Name
119
- add_settings_field(
120
- 'superpwa_app_name', // ID
121
- __('Application Name', 'super-progressive-web-apps'), // Title
122
- 'superpwa_app_name_cb', // CB
123
- 'superpwa_basic_settings_section', // Page slug
124
- 'superpwa_basic_settings_section' // Settings Section ID
125
- );
126
-
127
- // Application Short Name
128
- add_settings_field(
129
- 'superpwa_app_short_name', // ID
130
- __('Application Short Name', 'super-progressive-web-apps'), // Title
131
- 'superpwa_app_short_name_cb', // CB
132
- 'superpwa_basic_settings_section', // Page slug
133
- 'superpwa_basic_settings_section' // Settings Section ID
134
- );
135
-
136
- // Description
137
- add_settings_field(
138
- 'superpwa_description', // ID
139
- __( 'Description', 'super-progressive-web-apps' ), // Title
140
- 'superpwa_description_cb', // CB
141
- 'superpwa_basic_settings_section', // Page slug
142
- 'superpwa_basic_settings_section' // Settings Section ID
143
- );
144
-
145
- // Application Icon
146
- add_settings_field(
147
- 'superpwa_icons', // ID
148
- __('Application Icon', 'super-progressive-web-apps'), // Title
149
- 'superpwa_app_icon_cb', // Callback function
150
- 'superpwa_basic_settings_section', // Page slug
151
- 'superpwa_basic_settings_section' // Settings Section ID
152
- );
153
-
154
- // Splash Screen Icon
155
- add_settings_field(
156
- 'superpwa_splash_icon', // ID
157
- __('Splash Screen Icon', 'super-progressive-web-apps'), // Title
158
- 'superpwa_splash_icon_cb', // Callback function
159
- 'superpwa_basic_settings_section', // Page slug
160
- 'superpwa_basic_settings_section' // Settings Section ID
161
- );
162
-
163
- // Screenshots Icon
164
- add_settings_field(
165
- 'superpwa_app_screenshots', // ID
166
- __('APP Screenshots', 'super-progressive-web-apps'), // Title
167
- 'superpwa_app_screenshots_cb', // Callback function
168
- 'superpwa_basic_settings_section', // Page slug
169
- 'superpwa_basic_settings_section' // Settings Section ID
170
- );
171
-
172
- // Splash Screen Background Color
173
- add_settings_field(
174
- 'superpwa_background_color', // ID
175
- __('Background Color', 'super-progressive-web-apps'), // Title
176
- 'superpwa_background_color_cb', // CB
177
- 'superpwa_basic_settings_section', // Page slug
178
- 'superpwa_basic_settings_section' // Settings Section ID
179
- );
180
-
181
- // Theme Color
182
- add_settings_field(
183
- 'superpwa_theme_color', // ID
184
- __('Theme Color', 'super-progressive-web-apps'), // Title
185
- 'superpwa_theme_color_cb', // CB
186
- 'superpwa_basic_settings_section', // Page slug
187
- 'superpwa_basic_settings_section' // Settings Section ID
188
- );
189
-
190
- // Start URL
191
- add_settings_field(
192
- 'superpwa_start_url', // ID
193
- __('Start Page', 'super-progressive-web-apps'), // Title
194
- 'superpwa_start_url_cb', // CB
195
- 'superpwa_basic_settings_section', // Page slug
196
- 'superpwa_basic_settings_section' // Settings Section ID
197
- );
198
-
199
- // App Category
200
- add_settings_field(
201
- 'superpwa_app_category', // ID
202
- __('App Category', 'super-progressive-web-apps'), // Title
203
- 'superpwa_app_category_cb', // CB
204
- 'superpwa_basic_settings_section', // Page slug
205
- 'superpwa_basic_settings_section' // Settings Section ID
206
- );
207
-
208
- // Offline Page
209
- add_settings_field(
210
- 'superpwa_offline_page', // ID
211
- __('Offline Page', 'super-progressive-web-apps'), // Title
212
- 'superpwa_offline_page_cb', // CB
213
- 'superpwa_basic_settings_section', // Page slug
214
- 'superpwa_basic_settings_section' // Settings Section ID
215
- );
216
-
217
- // Orientation
218
- add_settings_field(
219
- 'superpwa_orientation', // ID
220
- __('Orientation', 'super-progressive-web-apps'), // Title
221
- 'superpwa_orientation_cb', // CB
222
- 'superpwa_basic_settings_section', // Page slug
223
- 'superpwa_basic_settings_section' // Settings Section ID
224
- );
225
-
226
- // Display
227
- add_settings_field(
228
- 'superpwa_display', // ID
229
- __('Display', 'super-progressive-web-apps'), // Title
230
- 'superpwa_display_cb', // CB
231
- 'superpwa_basic_settings_section', // Page slug
232
- 'superpwa_basic_settings_section' // Settings Section ID
233
- );
234
-
235
- // Direction
236
- add_settings_field(
237
- 'superpwa_text_direction', // ID
238
- __('Text Direction', 'super-progressive-web-apps'), // Title
239
- 'superpwa_text_direction_cb', // CB
240
- 'superpwa_basic_settings_section', // Page slug
241
- 'superpwa_basic_settings_section' // Settings Section ID
242
- );
243
-
244
- // PWA Status
245
- add_settings_section(
246
- 'superpwa_pwa_status_section', // ID
247
- __('Status', 'super-progressive-web-apps'), // Title
248
- '__return_false', // Callback Function
249
- 'superpwa_pwa_status_section' // Page slug
250
- );
251
-
252
- // Manifest status
253
- add_settings_field(
254
- 'superpwa_manifest_status', // ID
255
- __('Manifest', 'super-progressive-web-apps'), // Title
256
- 'superpwa_manifest_status_cb', // CB
257
- 'superpwa_pwa_status_section', // Page slug
258
- 'superpwa_pwa_status_section' // Settings Section ID
259
- );
260
-
261
- // Service Worker status
262
- add_settings_field(
263
- 'superpwa_sw_status', // ID
264
- __('Service Worker', 'super-progressive-web-apps'), // Title
265
- 'superpwa_sw_status_cb', // CB
266
- 'superpwa_pwa_status_section', // Page slug
267
- 'superpwa_pwa_status_section' // Settings Section ID
268
- );
269
-
270
- // HTTPS status
271
- add_settings_field(
272
- 'superpwa_https_status', // ID
273
- __('HTTPS', 'super-progressive-web-apps'), // Title
274
- 'superpwa_https_status_cb', // CB
275
- 'superpwa_pwa_status_section', // Page slug
276
- 'superpwa_pwa_status_section' // Settings Section ID
277
- );
278
-
279
-
280
- //Advance Page
281
- // PWA Advance settings
282
- add_settings_section(
283
- 'superpwa_pwa_advance_section', // ID
284
- __return_false(), // Title
285
- '__return_false', // Callback Function
286
- 'superpwa_pwa_advance_section' // Page slug
287
- );
288
- // Disabling "Add to home screen"
289
- add_settings_field(
290
- 'superpwa_disable_add_to_home', // ID
291
- __('Disable "Add to home screen"', 'super-progressive-web-apps'), // Title
292
- 'superpwa_disable_add_to_home_cb', // CB
293
- 'superpwa_pwa_advance_section', // Page slug
294
- 'superpwa_pwa_advance_section' // Settings Section ID
295
- );
296
- if (!defined('SUPERPWA_PRO_VERSION')) {
297
- // App shortcuts
298
- add_settings_field(
299
- 'superpwa_app_shortcut', // ID
300
- __('App shortcuts link', 'super-progressive-web-apps'), // Title
301
- 'superpwa_app_shortcut_link_cb', // CB
302
- 'superpwa_pwa_advance_section', // Page slug
303
- 'superpwa_pwa_advance_section' // Settings Section ID
304
- );
305
- }
306
- // Yandex Support
307
- add_settings_field(
308
- 'superpwa_yandex_support_shortcut', // ID
309
- __('Yandex support', 'super-progressive-web-apps'), // Title
310
- 'superpwa_yandex_support_cb', // CB
311
- 'superpwa_pwa_advance_section', // Page slug
312
- 'superpwa_pwa_advance_section' // Settings Section ID
313
- );
314
- // Analytics support
315
- add_settings_field(
316
- 'superpwa_analytics_support_shortcut', // ID
317
- __('Offline analytics ', 'super-progressive-web-apps'), // Title
318
- 'superpwa_analytics_support_cb', // CB
319
- 'superpwa_pwa_advance_section', // Page slug
320
- 'superpwa_pwa_advance_section' // Settings Section ID
321
- );
322
- // Cache External Origin URLs
323
- add_settings_field(
324
- 'superpwa_cache_external_urls_shortcut', // ID
325
- __('Cache External Origin URLs', 'super-progressive-web-apps'), // Title
326
- 'superpwa_cache_external_urls_support_cb', // CB
327
- 'superpwa_pwa_advance_section', // Page slug
328
- 'superpwa_pwa_advance_section' // Settings Section ID
329
- );
330
- // Force Update Service Worker
331
- add_settings_field(
332
- 'superpwa_force_update_sw_shortcut', // ID
333
- __('Re-Install Service Worker', 'super-progressive-web-apps'), // Title
334
- 'superpwa_force_update_sw_cb', // CB
335
- 'superpwa_pwa_advance_section', // Page slug
336
- 'superpwa_pwa_advance_section' // Settings Section ID
337
- );
338
- // Exclude Urls from Cache list
339
- add_settings_field(
340
- 'superpwa_exclude_url_cache_shortcut', // ID
341
- __('Exclude URLs from Cache list', 'super-progressive-web-apps'), // Title
342
- 'superpwa_exclude_url_cache_cb', // CB
343
- 'superpwa_pwa_advance_section', // Page slug
344
- 'superpwa_pwa_advance_section' // Settings Section ID
345
- );
346
- // Exclude Urls from Cache list
347
- add_settings_field(
348
- 'superpwa_exclude_add_to_homescreen_shortcut', // ID
349
- __('Exclude Add to homescreen banner', 'super-progressive-web-apps'), // Title
350
- 'superpwa_exclude_add_to_homescreen_cb', // CB
351
- 'superpwa_pwa_advance_section', // Page slug
352
- 'superpwa_pwa_advance_section' // Settings Section ID
353
- );
354
- // Exclude Urls from Cache list
355
- add_settings_field(
356
- 'superpwa_reset_settings_shortcut', // ID
357
- __('Reset Settings', 'super-progressive-web-apps'), // Title
358
- 'superpwa_reset_settings_cb', // CB
359
- 'superpwa_pwa_advance_section', // Page slug
360
- 'superpwa_pwa_advance_section' // Settings Section ID
361
- );
362
- }
363
- add_action( 'admin_init', 'superpwa_register_settings' );
364
-
365
- /**
366
- * Validate and sanitize user input before its saved to database
367
- *
368
- * @author Arun Basil Lal
369
- *
370
- * @param (array) $settings Values passed from the Settings API from SuperPWA > Settings
371
- *
372
- * @since 1.0
373
- * @since 1.3 Added splash_icon
374
- * @since 1.6 Added description
375
- * @since 2.0 Limit app_short_name to 12 characters
376
- * @since 2.0.1 Added is_static_sw and is_static_manifest
377
- */
378
- function superpwa_validater_and_sanitizer( $settings ) {
379
-
380
- // Sanitize Application Name
381
- $settings['app_name'] = sanitize_text_field( $settings['app_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_name'] );
382
-
383
- // Sanitize Application Short Name
384
- if(function_exists('mb_substr')){
385
- $settings['app_short_name'] = mb_substr( sanitize_text_field( $settings['app_short_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_short_name'] ), 0, 15 );
386
- } else {
387
- $settings['app_short_name'] = substr( sanitize_text_field( $settings['app_short_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_short_name'] ), 0, 15 );
388
- }
389
-
390
- // Sanitize description
391
- $settings['description'] = sanitize_text_field( $settings['description'] );
392
-
393
- // Sanitize hex color input for background_color
394
- $settings['background_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['background_color'] ) ? sanitize_text_field( $settings['background_color'] ) : '#D5E0EB';
395
-
396
- // Sanitize hex color input for theme_color
397
- $settings['theme_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['theme_color'] ) ? sanitize_text_field( $settings['theme_color'] ) : '#D5E0EB';
398
-
399
- // Sanitize application icon
400
- $settings['icon'] = sanitize_text_field( $settings['icon'] ) == '' ? superpwa_httpsify( SUPERPWA_PATH_SRC . 'public/images/logo.png' ) : sanitize_text_field( superpwa_httpsify( $settings['icon'] ) );
401
-
402
- $settings['screenshots'] = sanitize_text_field( $settings['screenshots'] ) == '' ? superpwa_httpsify( SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png' ) : sanitize_text_field( superpwa_httpsify( $settings['screenshots'] ) );
403
-
404
- // Sanitize splash screen icon
405
- $settings['splash_icon'] = sanitize_text_field( superpwa_httpsify( $settings['splash_icon'] ) );
406
-
407
- /**
408
- * Get current settings already saved in the database.
409
- *
410
- * When the SuperPWA > Settings page is saved, the form does not have the values for
411
- * is_static_sw or is_static_manifest. So this is added here to match the already saved
412
- * values in the database.
413
- */
414
- $current_settings = superpwa_get_settings();
415
-
416
- if ( ! isset( $settings['is_static_sw'] ) ) {
417
- $settings['is_static_sw'] = $current_settings['is_static_sw'];
418
- }
419
-
420
- if ( ! isset( $settings['is_static_manifest'] ) ) {
421
- $settings['is_static_manifest'] = $current_settings['is_static_manifest'];
422
- }
423
-
424
- return $settings;
425
- }
426
-
427
- /**
428
- * Get settings from database
429
- *
430
- * @return (Array) A merged array of default and settings saved in database.
431
- *
432
- * @author Arun Basil Lal
433
- *
434
- * @since 1.0
435
- * @since 2.0 Added display
436
- * @since 2.0.1 Added is_static_manifest. 1 for static files, 0 for dynamic files.
437
- * @since 2.0.1 Added is_static_sw. 1 for static files, 0 for dynamic files.
438
- */
439
- function superpwa_get_settings() {
440
-
441
- $defaults = array(
442
- 'app_name' => get_bloginfo( 'name' ),
443
- 'app_short_name' => function_exists('mb_substr') ? mb_substr( get_bloginfo( 'name' ), 0, 15 ) : substr( get_bloginfo( 'name' ), 0, 15 ),
444
- 'description' => get_bloginfo( 'description' ),
445
- 'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
446
- 'splash_icon' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
447
- 'screenshots' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
448
- 'background_color' => '#D5E0EB',
449
- 'theme_color' => '#D5E0EB',
450
- 'start_url' => 0,
451
- 'start_url_amp' => 0,
452
- 'app_category' => 0,
453
- 'offline_page' => 0,
454
- 'orientation' => 1,
455
- 'display' => 1,
456
- 'dir' => 'ltr',
457
- 'is_static_manifest'=> 0,
458
- 'is_static_sw' => 0,
459
- 'disable_add_to_home'=> 0,
460
- 'analytics_support'=> 1,
461
- 'cache_external_urls'=> 0,
462
- 'yandex_support'=> 0,
463
- 'force_update_sw_setting'=> SUPERPWA_VERSION,
464
- 'excluded_urls'=> '',
465
- 'exclude_homescreen'=> '',
466
- );
467
-
468
- $settings = get_option( 'superpwa_settings', $defaults );
469
-
470
- return $settings;
471
- }
472
- /***
473
- Returns default Superpwa settings
474
- ***/
475
- function superpwa_get_default_settings() {
476
-
477
- $defaults = array(
478
- 'app_name' => get_bloginfo( 'name' ),
479
- 'app_short_name' => function_exists('mb_substr') ? mb_substr( get_bloginfo( 'name' ), 0, 15 ) : substr( get_bloginfo( 'name' ), 0, 15 ),
480
- 'description' => get_bloginfo( 'description' ),
481
- 'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
482
- 'splash_icon' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
483
- 'screenshots' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
484
- 'background_color' => '#D5E0EB',
485
- 'theme_color' => '#D5E0EB',
486
- 'start_url' => 0,
487
- 'start_url_amp' => 0,
488
- 'offline_page' => 0,
489
- 'app_category' => 0,
490
- 'orientation' => 1,
491
- 'display' => 1,
492
- 'dir' => 'ltr',
493
- 'is_static_manifest'=> 0,
494
- 'is_static_sw' => 0,
495
- 'disable_add_to_home'=> 0,
496
- 'analytics_support'=> 1,
497
- 'cache_external_urls'=> 0,
498
- 'yandex_support'=> 0,
499
- 'force_update_sw_setting'=> SUPERPWA_VERSION,
500
- 'excluded_urls'=> '',
501
- 'exclude_homescreen'=> '',
502
- );
503
-
504
- return $settings;
505
- }
506
-
507
- /**
508
- * Todo list after saving admin options
509
- *
510
- * Regenerate manifest
511
- * Regenerate service worker
512
- *
513
- * @author Arun Basil Lal
514
- *
515
- * @since 1.0
516
- */
517
- function superpwa_after_save_settings_todo() {
518
-
519
- // Regenerate manifest
520
- superpwa_generate_manifest();
521
-
522
- // Regenerate service worker
523
- superpwa_generate_sw();
524
- }
525
- add_action( 'add_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
526
- add_action( 'update_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
527
-
528
- /**
529
- * Enqueue CSS and JS
530
- *
531
- * @since 1.0
532
- */
533
- function superpwa_enqueue_css_js( $hook ) {
534
-
535
- // Load only on SuperPWA plugin pages
536
- if ( strpos( $hook, 'superpwa' ) === false ) {
537
- return;
538
- }
539
- remove_all_actions('admin_notices');
540
-
541
- // Color picker CSS
542
- // @refer https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
543
- wp_enqueue_style( 'wp-color-picker' );
544
-
545
- // Everything needed for media upload
546
- wp_enqueue_media();
547
-
548
- // Main JS
549
- wp_register_script( 'superpwa-main-js', SUPERPWA_PATH_SRC . 'admin/js/main.js', array( 'wp-color-picker' ), SUPERPWA_VERSION, true );
550
-
551
- $object_name = array(
552
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
553
- 'superpwa_security_nonce' => wp_create_nonce('superpwa_ajax_check_nonce'),
554
- );
555
- $object_name = apply_filters('superpwa_localize_filter',$object_name,'superpwa_obj');
556
-
557
- wp_localize_script('superpwa-main-js', 'superpwa_obj', $object_name);
558
- wp_enqueue_script('superpwa-main-js');
559
-
560
- if( defined('SUPERPWA_PRO_VERSION') ){
561
- if ($hook == 'toplevel_page_superpwa') {
562
- wp_enqueue_style('superpwa-admin-panel-css', SUPERPWA_PATH_SRC . 'admin/css/admin-panel.css', array(), SUPERPWA_PRO_VERSION, 'all');
563
- }
564
- }
565
- }
566
- add_action( 'admin_enqueue_scripts', 'superpwa_enqueue_css_js' );
567
-
568
- /**
569
- * Admin footer text
570
- *
571
- * A function to add footer text to the settings page of the plugin.
572
- * @since 1.2
573
- * @refer https://codex.wordpress.org/Function_Reference/get_current_screen
574
- */
575
- function superpwa_footer_text( $default ) {
576
-
577
- // Retun default on non-plugin pages
578
- $screen = get_current_screen();
579
- if ( strpos( $screen->id, 'superpwa' ) === false ) {
580
- return $default;
581
- }
582
-
583
- $superpwa_footer_text = sprintf( __( 'If you like SuperPWA, please <a href="%s" target="_blank">make a donation</a> or leave a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a bunch!', 'super-progressive-web-apps' ),
584
- 'https://millionclues.com/donate/',
585
- 'https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?rate=5#new-post'
586
- );
587
-
588
- return $superpwa_footer_text;
589
- }
590
- add_filter( 'admin_footer_text', 'superpwa_footer_text' );
591
-
592
- /**
593
- * Admin footer version
594
- *
595
- * @since 1.0
596
- */
597
- function superpwa_footer_version( $default ) {
598
-
599
- // Retun default on non-plugin pages
600
- $screen = get_current_screen();
601
- if ( strpos( $screen->id, 'superpwa' ) === false ) {
602
- return $default;
603
- }
604
-
605
- return 'SuperPWA ' . SUPERPWA_VERSION;
606
- }
 
 
 
 
 
 
 
 
 
 
607
  add_filter( 'update_footer', 'superpwa_footer_version', 11 );
1
+ <?php
2
+ /**
3
+ * Admin setup for the plugin
4
+ *
5
+ * @since 1.0
6
+ * @function superpwa_add_menu_links() Add admin menu pages
7
+ * @function superpwa_register_settings Register Settings
8
+ * @function superpwa_validater_and_sanitizer() Validate And Sanitize User Input Before Its Saved To Database
9
+ * @function superpwa_get_settings() Get settings from database
10
+ * @function superpwa_enqueue_css_js() Enqueue CSS and JS
11
+ * @function superpwa_after_save_settings_todo() Todo list after saving admin options
12
+ * @function superpwa_footer_text() Admin footer text
13
+ * @function superpwa_footer_version() Admin footer version
14
+ */
15
+
16
+ // Exit if accessed directly
17
+ if ( ! defined( 'ABSPATH' ) ) exit;
18
+
19
+ /**
20
+ * Add admin menu pages
21
+ *
22
+ * @since 1.0
23
+ * @refer https://developer.wordpress.org/plugins/administration-menus/
24
+ */
25
+ function superpwa_add_menu_links() {
26
+
27
+ // Main menu page
28
+ add_menu_page( __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'SuperPWA', 'super-progressive-web-apps' ), 'manage_options', 'superpwa','superpwa_admin_interface_render', SUPERPWA_PATH_SRC. 'admin/img/superpwa-menu-icon.png', 100 );
29
+
30
+ // Settings page - Same as main menu page
31
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Settings', 'super-progressive-web-apps' ), 'manage_options', 'superpwa', 'superpwa_admin_interface_render', 60);
32
+
33
+ // Add-Ons page
34
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Add-ons', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-addons', 'superpwa_addons_interface_render', 70);
35
+
36
+ // UTM Tracking sub-menu
37
+ if ( superpwa_addons_status( 'utm_tracking' ) == 'active' ){
38
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'UTM Tracking', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-utm-tracking', 'superpwa_utm_tracking_interface_render', 72 );
39
+ }
40
+
41
+ // apple touch icons sub-menu
42
+ if ( superpwa_addons_status( 'apple_touch_icons' ) == 'active' ){
43
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Apple icons', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-apple-icons', 'superpwa_apple_icons_interface_render', 74 );
44
+ }
45
+
46
+ // pull to refresh sub-menu
47
+ if ( superpwa_addons_status( 'pull_to_refresh' ) == 'active' ){
48
+ add_submenu_page( 'superpwa', __( 'Pull To Refresh', 'super-progressive-web-apps' ), __( 'Pull To Refresh', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-pull-to-refresh', 'superpwa_pull_to_refresh_interface_render', 74 );
49
+ }
50
+
51
+ // Caching Strategies sub-menu
52
+ if ( superpwa_addons_status( 'caching_strategies' ) == 'active' ){
53
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), __( 'Caching Strategies', 'super-progressive-web-apps' ), 'manage_options', 'superpwa-caching-strategies', 'superpwa_caching_strategies_interface_render', 74 );
54
+ }
55
+
56
+ // Upgrade to pro page
57
+ $textlicense = "<span style='color: #ff4c4c;font-weight: 700;font-size: 15px;'>".__( 'Upgrade to Pro', 'super-progressive-web-apps' )."</span>";
58
+ if( defined('SUPERPWA_PRO_VERSION') ){
59
+
60
+ $license_alert = $days = '';
61
+ $license_info = get_option("superpwa_pro_upgrade_license");
62
+ if ($license_info) {
63
+
64
+ $license_exp = date('Y-m-d', strtotime($license_info['pro']['license_key_expires']));
65
+ $license_info_lifetime = $license_info['pro']['license_key_expires'];
66
+ $today = date('Y-m-d');
67
+ $exp_date = $license_exp;
68
+ $date1 = date_create($today);
69
+ $date2 = date_create($exp_date);
70
+ $diff = date_diff($date1,$date2);
71
+ $days = $diff->format("%a");
72
+ if( $license_info_lifetime == 'lifetime' ){
73
+ $days = 'Lifetime';
74
+ if ($days == 'Lifetime') {
75
+ $expire_msg = " Your License is Valid for Lifetime ";
76
+ }
77
+ }
78
+ else if($today > $exp_date){
79
+ $days = -$days;
80
+ }
81
+
82
+
83
+
84
+ $license_alert = isset($days) && $days!==0 && $days<=30 && $days!=='Lifetime' ? "<span class='superpwa_pro_icon dashicons dashicons-warning superpwa_pro_alert' style='color: #ffb229;left: 3px;position: relative;'></span>": "" ;
85
+ }
86
+ $textlicense = __( 'License', 'super-progressive-web-apps' );
87
+
88
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), $textlicense.$license_alert, 'manage_options', 'superpwa#license-settings', 'superpwa_upgread_pro_interface_render' , 9999999);
89
+ }else{
90
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), $textlicense, 'manage_options', 'superpwa-upgrade', 'superpwa_upgread_pro_interface_render' , 9999999);
91
+ }
92
+
93
+ }
94
+ add_action( 'admin_menu', 'superpwa_add_menu_links' );
95
+
96
+ /**
97
+ * Register Settings
98
+ *
99
+ * @since 1.0
100
+ */
101
+ function superpwa_register_settings() {
102
+
103
+ // Register Setting
104
+ register_setting(
105
+ 'superpwa_settings_group', // Group name
106
+ 'superpwa_settings', // Setting name = html form <input> name on settings form
107
+ 'superpwa_validater_and_sanitizer' // Input sanitizer
108
+ );
109
+
110
+ // Basic Application Settings
111
+ add_settings_section(
112
+ 'superpwa_basic_settings_section', // ID
113
+ __return_false(), // Title
114
+ '__return_false', // Callback Function
115
+ 'superpwa_basic_settings_section' // Page slug
116
+ );
117
+
118
+ // Application Name
119
+ add_settings_field(
120
+ 'superpwa_app_name', // ID
121
+ __('Application Name', 'super-progressive-web-apps'), // Title
122
+ 'superpwa_app_name_cb', // CB
123
+ 'superpwa_basic_settings_section', // Page slug
124
+ 'superpwa_basic_settings_section' // Settings Section ID
125
+ );
126
+
127
+ // Application Short Name
128
+ add_settings_field(
129
+ 'superpwa_app_short_name', // ID
130
+ __('Application Short Name', 'super-progressive-web-apps'), // Title
131
+ 'superpwa_app_short_name_cb', // CB
132
+ 'superpwa_basic_settings_section', // Page slug
133
+ 'superpwa_basic_settings_section' // Settings Section ID
134
+ );
135
+
136
+ // Description
137
+ add_settings_field(
138
+ 'superpwa_description', // ID
139
+ __( 'Description', 'super-progressive-web-apps' ), // Title
140
+ 'superpwa_description_cb', // CB
141
+ 'superpwa_basic_settings_section', // Page slug
142
+ 'superpwa_basic_settings_section' // Settings Section ID
143
+ );
144
+
145
+ // Application Icon
146
+ add_settings_field(
147
+ 'superpwa_icons', // ID
148
+ __('Application Icon', 'super-progressive-web-apps'), // Title
149
+ 'superpwa_app_icon_cb', // Callback function
150
+ 'superpwa_basic_settings_section', // Page slug
151
+ 'superpwa_basic_settings_section' // Settings Section ID
152
+ );
153
+
154
+ // Splash Screen Icon
155
+ add_settings_field(
156
+ 'superpwa_splash_icon', // ID
157
+ __('Splash Screen Icon', 'super-progressive-web-apps'), // Title
158
+ 'superpwa_splash_icon_cb', // Callback function
159
+ 'superpwa_basic_settings_section', // Page slug
160
+ 'superpwa_basic_settings_section' // Settings Section ID
161
+ );
162
+
163
+ // Screenshots Icon
164
+ add_settings_field(
165
+ 'superpwa_app_screenshots', // ID
166
+ __('APP Screenshots', 'super-progressive-web-apps'), // Title
167
+ 'superpwa_app_screenshots_cb', // Callback function
168
+ 'superpwa_basic_settings_section', // Page slug
169
+ 'superpwa_basic_settings_section' // Settings Section ID
170
+ );
171
+
172
+ // Splash Screen Background Color
173
+ add_settings_field(
174
+ 'superpwa_background_color', // ID
175
+ __('Background Color', 'super-progressive-web-apps'), // Title
176
+ 'superpwa_background_color_cb', // CB
177
+ 'superpwa_basic_settings_section', // Page slug
178
+ 'superpwa_basic_settings_section' // Settings Section ID
179
+ );
180
+
181
+ // Theme Color
182
+ add_settings_field(
183
+ 'superpwa_theme_color', // ID
184
+ __('Theme Color', 'super-progressive-web-apps'), // Title
185
+ 'superpwa_theme_color_cb', // CB
186
+ 'superpwa_basic_settings_section', // Page slug
187
+ 'superpwa_basic_settings_section' // Settings Section ID
188
+ );
189
+
190
+ // Start URL
191
+ add_settings_field(
192
+ 'superpwa_start_url', // ID
193
+ __('Start Page', 'super-progressive-web-apps'), // Title
194
+ 'superpwa_start_url_cb', // CB
195
+ 'superpwa_basic_settings_section', // Page slug
196
+ 'superpwa_basic_settings_section' // Settings Section ID
197
+ );
198
+
199
+ // App Category
200
+ add_settings_field(
201
+ 'superpwa_app_category', // ID
202
+ __('App Category', 'super-progressive-web-apps'), // Title
203
+ 'superpwa_app_category_cb', // CB
204
+ 'superpwa_basic_settings_section', // Page slug
205
+ 'superpwa_basic_settings_section' // Settings Section ID
206
+ );
207
+
208
+ // Offline Page
209
+ add_settings_field(
210
+ 'superpwa_offline_page', // ID
211
+ __('Offline Page', 'super-progressive-web-apps'), // Title
212
+ 'superpwa_offline_page_cb', // CB
213
+ 'superpwa_basic_settings_section', // Page slug
214
+ 'superpwa_basic_settings_section' // Settings Section ID
215
+ );
216
+
217
+ // Orientation
218
+ add_settings_field(
219
+ 'superpwa_orientation', // ID
220
+ __('Orientation', 'super-progressive-web-apps'), // Title
221
+ 'superpwa_orientation_cb', // CB
222
+ 'superpwa_basic_settings_section', // Page slug
223
+ 'superpwa_basic_settings_section' // Settings Section ID
224
+ );
225
+
226
+ // Display
227
+ add_settings_field(
228
+ 'superpwa_display', // ID
229
+ __('Display', 'super-progressive-web-apps'), // Title
230
+ 'superpwa_display_cb', // CB
231
+ 'superpwa_basic_settings_section', // Page slug
232
+ 'superpwa_basic_settings_section' // Settings Section ID
233
+ );
234
+
235
+ // Direction
236
+ add_settings_field(
237
+ 'superpwa_text_direction', // ID
238
+ __('Text Direction', 'super-progressive-web-apps'), // Title
239
+ 'superpwa_text_direction_cb', // CB
240
+ 'superpwa_basic_settings_section', // Page slug
241
+ 'superpwa_basic_settings_section' // Settings Section ID
242
+ );
243
+
244
+ // PWA Status
245
+ add_settings_section(
246
+ 'superpwa_pwa_status_section', // ID
247
+ __('Status', 'super-progressive-web-apps'), // Title
248
+ '__return_false', // Callback Function
249
+ 'superpwa_pwa_status_section' // Page slug
250
+ );
251
+
252
+ // Manifest status
253
+ add_settings_field(
254
+ 'superpwa_manifest_status', // ID
255
+ __('Manifest', 'super-progressive-web-apps'), // Title
256
+ 'superpwa_manifest_status_cb', // CB
257
+ 'superpwa_pwa_status_section', // Page slug
258
+ 'superpwa_pwa_status_section' // Settings Section ID
259
+ );
260
+
261
+ // Service Worker status
262
+ add_settings_field(
263
+ 'superpwa_sw_status', // ID
264
+ __('Service Worker', 'super-progressive-web-apps'), // Title
265
+ 'superpwa_sw_status_cb', // CB
266
+ 'superpwa_pwa_status_section', // Page slug
267
+ 'superpwa_pwa_status_section' // Settings Section ID
268
+ );
269
+
270
+ // HTTPS status
271
+ add_settings_field(
272
+ 'superpwa_https_status', // ID
273
+ __('HTTPS', 'super-progressive-web-apps'), // Title
274
+ 'superpwa_https_status_cb', // CB
275
+ 'superpwa_pwa_status_section', // Page slug
276
+ 'superpwa_pwa_status_section' // Settings Section ID
277
+ );
278
+
279
+
280
+ //Advance Page
281
+ // PWA Advance settings
282
+ add_settings_section(
283
+ 'superpwa_pwa_advance_section', // ID
284
+ __return_false(), // Title
285
+ '__return_false', // Callback Function
286
+ 'superpwa_pwa_advance_section' // Page slug
287
+ );
288
+ // Disabling "Add to home screen"
289
+ add_settings_field(
290
+ 'superpwa_disable_add_to_home', // ID
291
+ __('Disable "Add to home screen"', 'super-progressive-web-apps'), // Title
292
+ 'superpwa_disable_add_to_home_cb', // CB
293
+ 'superpwa_pwa_advance_section', // Page slug
294
+ 'superpwa_pwa_advance_section' // Settings Section ID
295
+ );
296
+ if (!defined('SUPERPWA_PRO_VERSION')) {
297
+ // App shortcuts
298
+ add_settings_field(
299
+ 'superpwa_app_shortcut', // ID
300
+ __('App shortcuts link', 'super-progressive-web-apps'), // Title
301
+ 'superpwa_app_shortcut_link_cb', // CB
302
+ 'superpwa_pwa_advance_section', // Page slug
303
+ 'superpwa_pwa_advance_section' // Settings Section ID
304
+ );
305
+ }
306
+ // Yandex Support
307
+ add_settings_field(
308
+ 'superpwa_yandex_support_shortcut', // ID
309
+ __('Yandex support', 'super-progressive-web-apps'), // Title
310
+ 'superpwa_yandex_support_cb', // CB
311
+ 'superpwa_pwa_advance_section', // Page slug
312
+ 'superpwa_pwa_advance_section' // Settings Section ID
313
+ );
314
+ // Analytics support
315
+ add_settings_field(
316
+ 'superpwa_analytics_support_shortcut', // ID
317
+ __('Offline analytics ', 'super-progressive-web-apps'), // Title
318
+ 'superpwa_analytics_support_cb', // CB
319
+ 'superpwa_pwa_advance_section', // Page slug
320
+ 'superpwa_pwa_advance_section' // Settings Section ID
321
+ );
322
+ // Cache External Origin URLs
323
+ add_settings_field(
324
+ 'superpwa_cache_external_urls_shortcut', // ID
325
+ __('Cache External Origin URLs', 'super-progressive-web-apps'), // Title
326
+ 'superpwa_cache_external_urls_support_cb', // CB
327
+ 'superpwa_pwa_advance_section', // Page slug
328
+ 'superpwa_pwa_advance_section' // Settings Section ID
329
+ );
330
+ // Force Update Service Worker
331
+ add_settings_field(
332
+ 'superpwa_force_update_sw_shortcut', // ID
333
+ __('Re-Install Service Worker', 'super-progressive-web-apps'), // Title
334
+ 'superpwa_force_update_sw_cb', // CB
335
+ 'superpwa_pwa_advance_section', // Page slug
336
+ 'superpwa_pwa_advance_section' // Settings Section ID
337
+ );
338
+ // Exclude Urls from Cache list
339
+ add_settings_field(
340
+ 'superpwa_exclude_url_cache_shortcut', // ID
341
+ __('Exclude URLs from Cache list', 'super-progressive-web-apps'), // Title
342
+ 'superpwa_exclude_url_cache_cb', // CB
343
+ 'superpwa_pwa_advance_section', // Page slug
344
+ 'superpwa_pwa_advance_section' // Settings Section ID
345
+ );
346
+ // Exclude Urls from Cache list
347
+ add_settings_field(
348
+ 'superpwa_exclude_add_to_homescreen_shortcut', // ID
349
+ __('Exclude Add to homescreen banner', 'super-progressive-web-apps'), // Title
350
+ 'superpwa_exclude_add_to_homescreen_cb', // CB
351
+ 'superpwa_pwa_advance_section', // Page slug
352
+ 'superpwa_pwa_advance_section' // Settings Section ID
353
+ );
354
+ //Regenerate Service worker
355
+ add_settings_field(
356
+ 'superpwa_bypass_sw_url_cache', // ID
357
+ __('Bypass Service Worker Caching', 'super-progressive-web-apps'), // Title
358
+ 'superpwa_bypass_sw_url_cache_cb', // CB
359
+ 'superpwa_pwa_advance_section', // Page slug
360
+ 'superpwa_pwa_advance_section' // Settings Section ID
361
+ );
362
+ // Exclude Urls from Cache list
363
+ add_settings_field(
364
+ 'superpwa_reset_settings_shortcut', // ID
365
+ __('Reset Settings', 'super-progressive-web-apps'), // Title
366
+ 'superpwa_reset_settings_cb', // CB
367
+ 'superpwa_pwa_advance_section', // Page slug
368
+ 'superpwa_pwa_advance_section' // Settings Section ID
369
+ );
370
+ }
371
+ add_action( 'admin_init', 'superpwa_register_settings' );
372
+
373
+ /**
374
+ * Validate and sanitize user input before its saved to database
375
+ *
376
+ * @author Arun Basil Lal
377
+ *
378
+ * @param (array) $settings Values passed from the Settings API from SuperPWA > Settings
379
+ *
380
+ * @since 1.0
381
+ * @since 1.3 Added splash_icon
382
+ * @since 1.6 Added description
383
+ * @since 2.0 Limit app_short_name to 12 characters
384
+ * @since 2.0.1 Added is_static_sw and is_static_manifest
385
+ */
386
+ function superpwa_validater_and_sanitizer( $settings ) {
387
+
388
+ // Sanitize Application Name
389
+ $settings['app_name'] = sanitize_text_field( $settings['app_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_name'] );
390
+
391
+ // Sanitize Application Short Name
392
+ if(function_exists('mb_substr')){
393
+ $settings['app_short_name'] = mb_substr( sanitize_text_field( $settings['app_short_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_short_name'] ), 0, 15 );
394
+ } else {
395
+ $settings['app_short_name'] = substr( sanitize_text_field( $settings['app_short_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_short_name'] ), 0, 15 );
396
+ }
397
+
398
+ // Sanitize description
399
+ $settings['description'] = sanitize_text_field( $settings['description'] );
400
+
401
+ // Sanitize hex color input for background_color
402
+ $settings['background_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['background_color'] ) ? sanitize_text_field( $settings['background_color'] ) : '#D5E0EB';
403
+
404
+ // Sanitize hex color input for theme_color
405
+ $settings['theme_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['theme_color'] ) ? sanitize_text_field( $settings['theme_color'] ) : '#D5E0EB';
406
+
407
+ // Sanitize application icon
408
+ $settings['icon'] = sanitize_text_field( $settings['icon'] ) == '' ? superpwa_httpsify( SUPERPWA_PATH_SRC . 'public/images/logo.png' ) : sanitize_text_field( superpwa_httpsify( $settings['icon'] ) );
409
+
410
+ $settings['screenshots'] = sanitize_text_field( $settings['screenshots'] ) == '' ? superpwa_httpsify( SUPERPWA_PATH_SRC . 'public/images/screenshot-472x1024.png' ) : sanitize_text_field( superpwa_httpsify( $settings['screenshots'] ) );
411
+
412
+ // Sanitize splash screen icon
413
+ $settings['splash_icon'] = sanitize_text_field( superpwa_httpsify( $settings['splash_icon'] ) );
414
+
415
+ /**
416
+ * Get current settings already saved in the database.
417
+ *
418
+ * When the SuperPWA > Settings page is saved, the form does not have the values for
419
+ * is_static_sw or is_static_manifest. So this is added here to match the already saved
420
+ * values in the database.
421
+ */
422
+ $current_settings = superpwa_get_settings();
423
+
424
+ if ( ! isset( $settings['is_static_sw'] ) ) {
425
+ $settings['is_static_sw'] = $current_settings['is_static_sw'];
426
+ }
427
+
428
+ if ( ! isset( $settings['is_static_manifest'] ) ) {
429
+ $settings['is_static_manifest'] = $current_settings['is_static_manifest'];
430
+ }
431
+
432
+ return $settings;
433
+ }
434
+
435
+ /**
436
+ * Get settings from database
437
+ *
438
+ * @return (Array) A merged array of default and settings saved in database.
439
+ *
440
+ * @author Arun Basil Lal
441
+ *
442
+ * @since 1.0
443
+ * @since 2.0 Added display
444
+ * @since 2.0.1 Added is_static_manifest. 1 for static files, 0 for dynamic files.
445
+ * @since 2.0.1 Added is_static_sw. 1 for static files, 0 for dynamic files.
446
+ */
447
+ function superpwa_get_settings() {
448
+
449
+ $defaults = array(
450
+ 'app_name' => get_bloginfo( 'name' ),
451
+ 'app_short_name' => function_exists('mb_substr') ? mb_substr( get_bloginfo( 'name' ), 0, 15 ) : substr( get_bloginfo( 'name' ), 0, 15 ),
452
+ 'description' => get_bloginfo( 'description' ),
453
+ 'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
454
+ 'splash_icon' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
455
+ 'screenshots' => SUPERPWA_PATH_SRC . 'public/images/screenshot-472x1024.png',
456
+ 'background_color' => '#D5E0EB',
457
+ 'theme_color' => '#D5E0EB',
458
+ 'start_url' => 0,
459
+ 'start_url_amp' => 0,
460
+ 'app_category' => 0,
461
+ 'offline_page' => 0,
462
+ 'orientation' => 1,
463
+ 'display' => 1,
464
+ 'dir' => 'ltr',
465
+ 'is_static_manifest'=> 0,
466
+ 'is_static_sw' => 0,
467
+ 'disable_add_to_home'=> 0,
468
+ 'analytics_support'=> 1,
469
+ 'cache_external_urls'=> 0,
470
+ 'yandex_support'=> 0,
471
+ 'force_update_sw_setting'=> SUPERPWA_VERSION,
472
+ 'excluded_urls'=> '',
473
+ 'exclude_homescreen'=> '',
474
+ 'bypass_sw_url_cache'=> '',
475
+ );
476
+
477
+ $settings = get_option( 'superpwa_settings', $defaults );
478
+
479
+ return $settings;
480
+ }
481
+ /***
482
+ Returns default Superpwa settings
483
+ ***/
484
+ function superpwa_get_default_settings() {
485
+
486
+ $defaults = array(
487
+ 'app_name' => get_bloginfo( 'name' ),
488
+ 'app_short_name' => function_exists('mb_substr') ? mb_substr( get_bloginfo( 'name' ), 0, 15 ) : substr( get_bloginfo( 'name' ), 0, 15 ),
489
+ 'description' => get_bloginfo( 'description' ),
490
+ 'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
491
+ 'splash_icon' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
492
+ 'screenshots' => SUPERPWA_PATH_SRC . 'public/images/screenshot-472x1024.png',
493
+ 'background_color' => '#D5E0EB',
494
+ 'theme_color' => '#D5E0EB',
495
+ 'start_url' => 0,
496
+ 'start_url_amp' => 0,
497
+ 'offline_page' => 0,
498
+ 'app_category' => 0,
499
+ 'orientation' => 1,
500
+ 'display' => 1,
501
+ 'dir' => 'ltr',
502
+ 'is_static_manifest'=> 0,
503
+ 'is_static_sw' => 0,
504
+ 'disable_add_to_home'=> 0,
505
+ 'analytics_support'=> 1,
506
+ 'cache_external_urls'=> 0,
507
+ 'yandex_support'=> 0,
508
+ 'force_update_sw_setting'=> SUPERPWA_VERSION,
509
+ 'excluded_urls'=> '',
510
+ 'exclude_homescreen'=> '',
511
+ 'bypass_sw_url_cache'=> '',
512
+ );
513
+
514
+ return $settings;
515
+ }
516
+
517
+ /**
518
+ * Todo list after saving admin options
519
+ *
520
+ * Regenerate manifest
521
+ * Regenerate service worker
522
+ *
523
+ * @author Arun Basil Lal
524
+ *
525
+ * @since 1.0
526
+ */
527
+ function superpwa_after_save_settings_todo() {
528
+
529
+ // Regenerate manifest
530
+ superpwa_generate_manifest();
531
+
532
+ // Regenerate service worker
533
+ superpwa_generate_sw();
534
+ }
535
+ add_action( 'add_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
536
+ add_action( 'update_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
537
+
538
+ /**
539
+ * Enqueue CSS and JS
540
+ *
541
+ * @since 1.0
542
+ */
543
+ function superpwa_enqueue_css_js( $hook ) {
544
+
545
+ // Load only on SuperPWA plugin pages
546
+ if ( strpos( $hook, 'superpwa' ) === false ) {
547
+ return;
548
+ }
549
+ remove_all_actions('admin_notices');
550
+
551
+ // Color picker CSS
552
+ // @refer https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
553
+ wp_enqueue_style( 'wp-color-picker' );
554
+
555
+ // Everything needed for media upload
556
+ wp_enqueue_media();
557
+
558
+ // Main JS
559
+ wp_register_script( 'superpwa-main-js', SUPERPWA_PATH_SRC . 'admin/js/main.js', array( 'wp-color-picker' ), SUPERPWA_VERSION, true );
560
+
561
+ $object_name = array(
562
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
563
+ 'superpwa_security_nonce' => wp_create_nonce('superpwa_ajax_check_nonce'),
564
+ );
565
+ $object_name = apply_filters('superpwa_localize_filter',$object_name,'superpwa_obj');
566
+
567
+ wp_localize_script('superpwa-main-js', 'superpwa_obj', $object_name);
568
+ wp_enqueue_script('superpwa-main-js');
569
+
570
+ if( defined('SUPERPWA_PRO_VERSION') ){
571
+ if ($hook == 'toplevel_page_superpwa') {
572
+ wp_enqueue_style('superpwa-admin-panel-css', SUPERPWA_PATH_SRC . 'admin/css/admin-panel.css', array(), SUPERPWA_PRO_VERSION, 'all');
573
+ }
574
+ }
575
+ }
576
+ add_action( 'admin_enqueue_scripts', 'superpwa_enqueue_css_js' );
577
+
578
+ /**
579
+ * Admin footer text
580
+ *
581
+ * A function to add footer text to the settings page of the plugin.
582
+ * @since 1.2
583
+ * @refer https://codex.wordpress.org/Function_Reference/get_current_screen
584
+ */
585
+ function superpwa_footer_text( $default ) {
586
+
587
+ // Retun default on non-plugin pages
588
+ $screen = get_current_screen();
589
+ if ( strpos( $screen->id, 'superpwa' ) === false ) {
590
+ return $default;
591
+ }
592
+
593
+ $superpwa_footer_text = sprintf( __( 'If you like SuperPWA, please <a href="%s" target="_blank">make a donation</a> or leave a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a bunch!', 'super-progressive-web-apps' ),
594
+ 'https://millionclues.com/donate/',
595
+ 'https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?rate=5#new-post'
596
+ );
597
+
598
+ return $superpwa_footer_text;
599
+ }
600
+ add_filter( 'admin_footer_text', 'superpwa_footer_text' );
601
+
602
+ /**
603
+ * Admin footer version
604
+ *
605
+ * @since 1.0
606
+ */
607
+ function superpwa_footer_version( $default ) {
608
+
609
+ // Retun default on non-plugin pages
610
+ $screen = get_current_screen();
611
+ if ( strpos( $screen->id, 'superpwa' ) === false ) {
612
+ return $default;
613
+ }
614
+
615
+ return 'SuperPWA ' . SUPERPWA_VERSION;
616
+ }
617
  add_filter( 'update_footer', 'superpwa_footer_version', 11 );
admin/basic-setup.php CHANGED
@@ -1,494 +1,494 @@
1
- <?php
2
- /**
3
- * Basic setup functions for the plugin
4
- *
5
- * @since 1.0
6
- *
7
- * @function superpwa_activate_plugin() Plugin activatation todo list
8
- * @function superpwa_activation_redirect() Redirect to SuperPWA UI on plugin activation
9
- * @function superpwa_admin_notices() Admin notices
10
- * @function superpwa_network_admin_notices() Network Admin notices
11
- * @function superpwa_upgrader() Plugin upgrade todo list
12
- * @function superpwa_deactivate_plugin() Plugin deactivation todo list
13
- * @function superpwa_load_plugin_textdomain() Load plugin text domain
14
- * @function superpwa_settings_link() Print direct link to plugin settings in plugins list in admin
15
- * @function superpwa_plugin_row_meta() Add donate and other links to plugins list
16
- */
17
-
18
- // Exit if accessed directly
19
- if ( ! defined('ABSPATH') ) exit;
20
-
21
- /**
22
- * Plugin activation todo list
23
- *
24
- * This function runs when user activates the plugin. Used in register_activation_hook()
25
- * On multisites, during network activation, this is fired only for the main site.
26
- * For the rest of the sites, superpwa_upgrader() handles generation of manifest and service worker.
27
- *
28
- * @param $network_active (Boolean) True if the plugin is network activated, false otherwise.
29
- *
30
- * @author Arun Basil Lal
31
- *
32
- * @link https://www.alexgeorgiou.gr/network-activated-wordpress-plugins/ (Thanks Alex!)
33
- *
34
- * @since 1.0
35
- * @since 1.6 register_activation_hook() moved to this file (basic-setup.php) from main plugin file (superpwa.php).
36
- * @since 1.6 Added checks for multisite compatibility.
37
- */
38
- function superpwa_activate_plugin( $network_active ) {
39
-
40
- // Adding option to show/hide newsletter form
41
- add_option( 'superpwa_hide_newsletter', 'no' );
42
-
43
- // Not network active i.e. plugin is activated on a single install (normal WordPress install) or a single site on a multisite network
44
- if ( ! $network_active ) {
45
-
46
- // Set transient for single site activation notice
47
- set_transient( 'superpwa_admin_notice_activation', true, 60 );
48
-
49
- return;
50
- }
51
-
52
- // If we are here, then plugin is network activated on a multisite. Set transient for activation notice on network admin.
53
- set_transient( 'superpwa_network_admin_notice_activation', true, 60 );
54
-
55
- }
56
- register_activation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_activate_plugin' );
57
-
58
- /**
59
- * Redirect to SuperPWA UI on plugin activation.
60
- *
61
- * Will redirect to SuperPWA settings page when plugin is activated.
62
- * Will not redirect if multiple plugins are activated at the same time.
63
- * Will not redirect when activated network wide on multisite. Network admins know their way.
64
- *
65
- * @param (string) $plugin Path to the main plugin file from plugins directory.
66
- * @param (bool) $network_wide True when network activated on multisites. False otherwise.
67
- *
68
- * @author Arun Basil Lal
69
- *
70
- * @since 2.0
71
- * @since 2.1 Added a check to see if WP_Plugins_List_Table class is available.
72
- */
73
- function superpwa_activation_redirect( $plugin, $network_wide ) {
74
-
75
- // Return if not SuperPWA or if plugin is activated network wide.
76
- if ( $plugin !== plugin_basename( SUPERPWA_PLUGIN_FILE ) || $network_wide === true ) {
77
- return false;
78
- }
79
-
80
- if ( ! class_exists( 'WP_Plugins_List_Table' ) ) {
81
- return false;
82
- }
83
-
84
- /**
85
- * An instance of the WP_Plugins_List_Table class.
86
- *
87
- * @link https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-admin/plugins.php#L15
88
- */
89
- $wp_list_table_instance = new WP_Plugins_List_Table();
90
- $current_action = $wp_list_table_instance->current_action();
91
-
92
- // When only one plugin is activated, the current_action() method will return activate.
93
- if ( $current_action !== 'activate' ) {
94
- return false;
95
- }
96
-
97
- // Redirect to SuperPWA settings page.
98
- exit( wp_redirect( admin_url( 'admin.php?page=superpwa' ) ) );
99
- }
100
- add_action( 'activated_plugin', 'superpwa_activation_redirect', PHP_INT_MAX, 2 );
101
-
102
- /**
103
- * Admin Notices
104
- *
105
- * @since 1.2 Admin notice on plugin activation
106
- */
107
- function superpwa_admin_notices() {
108
-
109
- // Notices only for admins
110
- if ( ! current_user_can( 'manage_options' ) ) {
111
- return;
112
- }
113
-
114
- // Admin notice on plugin activation
115
- if ( get_transient( 'superpwa_admin_notice_activation' ) ) {
116
-
117
- $superpwa_is_ready = superpwa_is_pwa_ready() ? __( 'Your app is ready with the default settings. ', 'super-progressive-web-apps' ) : '';
118
-
119
- // Do not display link to settings UI if we are already in the UI.
120
- $screen = get_current_screen();
121
- $superpwa_ui_link_text = ( strpos( $screen->id, 'superpwa' ) === false ) ? sprintf( __( '<a href="%s">Customize your app &rarr;</a>', 'super-progressive-web-apps' ), admin_url( 'admin.php?page=superpwa' ) ) : '';
122
-
123
- echo '<div class="updated notice is-dismissible"><p>' . __( 'Thank you for installing <strong>Super Progressive Web Apps!</strong> ', 'super-progressive-web-apps' ) . $superpwa_is_ready . $superpwa_ui_link_text . '</p></div>';
124
-
125
- // Delete transient
126
- delete_transient( 'superpwa_admin_notice_activation' );
127
- }
128
-
129
- // Admin notice on plugin upgrade
130
- if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
131
-
132
- echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a href="%s" target="_blank">Discover new features and read the story &rarr;</a>', 'super-progressive-web-apps' ), SUPERPWA_VERSION, 'https://superpwa.com/category/release-notes/latest/?utm_source=superpwa-plugin&utm_medium=update-success-notice' ) . '</p></div>';
133
-
134
- // Delete transient
135
- delete_transient( 'superpwa_admin_notice_upgrade_complete' );
136
- }
137
- }
138
- add_action( 'admin_notices', 'superpwa_admin_notices' );
139
-
140
- /**
141
- * Network Admin notices
142
- *
143
- * @since 1.6 Admin notice on multisite network activation
144
- */
145
- function superpwa_network_admin_notices() {
146
-
147
- // Notices only for admins
148
- if ( ! current_user_can( 'manage_options' ) ) {
149
- return;
150
- }
151
-
152
- // Network admin notice on multisite network activation
153
- if ( get_transient( 'superpwa_network_admin_notice_activation' ) ) {
154
-
155
- $superpwa_is_ready = superpwa_is_pwa_ready() ? 'Your app is ready on the main website with the default settings. ' : '';
156
-
157
- echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( 'Thank you for installing <strong>Super Progressive Web Apps!</strong> '. $superpwa_is_ready .'<a href="%s">Customize your app &rarr;</a><br/>Note: manifest and service worker for the individual websites will be generated on the first visit to the respective WordPress admin.', 'super-progressive-web-apps' ), admin_url( 'admin.php?page=superpwa' ) ) . '</p></div>';
158
-
159
- // Delete transient
160
- delete_transient( 'superpwa_network_admin_notice_activation' );
161
- }
162
-
163
- // Network admin notice on plugin upgrade
164
- if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
165
-
166
- echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a href="%s" target="_blank">Discover new features and read the story &rarr;</a>', 'super-progressive-web-apps' ), SUPERPWA_VERSION, 'https://superpwa.com/category/release-notes/latest/?utm_source=superpwa-plugin&utm_medium=update-success-notice-multisite' ) . '</p></div>';
167
-
168
- // Delete transient
169
- delete_transient( 'superpwa_admin_notice_upgrade_complete' );
170
- }
171
- }
172
- add_action( 'network_admin_notices', 'superpwa_network_admin_notices' );
173
-
174
- /**
175
- * Plugin upgrade todo list
176
- *
177
- * @since 1.3.1
178
- * @since 1.4 Added orientation setting and theme_color to database when upgrading from pre 1.4 versions.
179
- * @since 1.6 Added multisite compatibility.
180
- */
181
- function superpwa_upgrader() {
182
-
183
- $current_ver = get_option( 'superpwa_version' );
184
-
185
- // Return if we have already done this todo
186
- if ( version_compare( $current_ver, SUPERPWA_VERSION, '==' ) ) {
187
- return;
188
- }
189
-
190
- /**
191
- * Todo list for fresh install.
192
- *
193
- * On a multisite, during network activation, the activation hook (and activation todo) is not fired.
194
- * Manifest and service worker is generated the first time the wp-admin is loaded (when admin_init is fired).
195
- */
196
- if ( $current_ver === false ) {
197
-
198
- // Generate manifest
199
- superpwa_generate_manifest();
200
-
201
- // Generate service worker
202
- superpwa_generate_sw();
203
-
204
- if ( is_multisite() ) {
205
-
206
- // For multisites, save the activation status of current blog.
207
- superpwa_multisite_activation_status( true );
208
- }
209
-
210
- // Save SuperPWA version to database.
211
- add_option( 'superpwa_version', SUPERPWA_VERSION );
212
-
213
- return;
214
- }
215
-
216
- /**
217
- * Add orientation and theme_color to database when upgrading from pre 1.4 versions.
218
- *
219
- * Until 1.4, there was no UI for orientation and theme_color.
220
- * In the manifest, orientation was hard coded as 'natural'.
221
- * background_color had UI and this value was used for both background_color and theme_color in the manifest.
222
- *
223
- * @since 1.4
224
- */
225
- if ( version_compare( $current_ver, '1.3.1', '<=' ) ) {
226
-
227
- // Get settings
228
- $settings = superpwa_get_settings();
229
-
230
- // Orientation was set as 'natural' until version 1.4. Set it as 1, which is 'portrait'.
231
- $settings['orientation'] = 1;
232
-
233
- // theme_color was same as background_color until version 1.4
234
- $settings['theme_color'] = $settings['background_color'];
235
-
236
- // Write settings back to database
237
- update_option( 'superpwa_settings', $settings );
238
- }
239
-
240
- /**
241
- * Delete existing service worker for single sites that use OneSignal.
242
- *
243
- * For OneSignal compatibility, in version 1.8 the service worker filename is renamed.
244
- * If OneSignal is active, by this point, the new filename will be filtered in.
245
- * This upgrade routine restores the defaul service worker filename and deletes the existing service worker.
246
- * Also adds back the filter for new filename. OneSignal compatibility for multisites is not available at this point.
247
- *
248
- * @since 1.8
249
- */
250
- if ( version_compare( $current_ver, '1.7.1', '<=' ) && class_exists( 'OneSignal' ) && ! is_multisite() ) {
251
-
252
- // Restore the default service worker filename of SuperPWA.
253
- remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
254
-
255
- // Delete service worker
256
- superpwa_delete_sw();
257
-
258
- // Change service worker filename to match OneSignal's service worker.
259
- add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
260
- }
261
-
262
- /**
263
- * Add display to database when upgrading from pre 2.0 versions.
264
- * Delete manifest and service worker files.
265
- *
266
- * Until 2.0, there was no UI for display.
267
- * In the manifest, display was hard coded as 'standalone'.
268
- *
269
- * Starting with 2.0, manifest and service worker files are dynamic and no longer static.
270
- *
271
- * @since 2.0
272
- */
273
- if ( version_compare( $current_ver, '1.9', '<=' ) ) {
274
-
275
- // Get settings
276
- $settings = superpwa_get_settings();
277
-
278
- // Display was set as 'standalone' until version 2.0. Set it as 1, which is 'standalone'.
279
- $settings['display'] = 1;
280
-
281
- // Write settings back to database
282
- update_option( 'superpwa_settings', $settings );
283
- }
284
-
285
- /**
286
- * Add file state variables to database
287
- *
288
- * @since 2.0.1
289
- */
290
- if ( version_compare( $current_ver, '2.0', '<=' ) ) {
291
-
292
- // Get settings
293
- $settings = superpwa_get_settings();
294
-
295
- // 1 for static files, 0 for dynamic files (default).
296
- $settings['is_static_manifest'] = 0;
297
- $settings['is_static_sw'] = 0;
298
-
299
- // Write settings back to database
300
- update_option( 'superpwa_settings', $settings );
301
- }
302
-
303
- // Re-generate manifest
304
- superpwa_generate_manifest();
305
-
306
- // Re-generate service worker
307
- superpwa_generate_sw();
308
-
309
- // Add current version to database
310
- update_option( 'superpwa_version', SUPERPWA_VERSION );
311
-
312
- // For multisites, save the activation status of current blog.
313
- superpwa_multisite_activation_status( true );
314
-
315
- // Set transient for upgrade complete notice
316
- set_transient( 'superpwa_admin_notice_upgrade_complete', true, 60 );
317
- }
318
- add_action( 'admin_init', 'superpwa_upgrader' );
319
-
320
- /**
321
- * Plugin deactivation todo list
322
- *
323
- * Runs during deactivation.
324
- * During uninstall uninstall.php is also executed.
325
- *
326
- * @param $network_active (Boolean) True if the plugin is network activated, false otherwise.
327
- * @link https://www.alexgeorgiou.gr/network-activated-wordpress-plugins/ (Thanks Alex!)
328
- *
329
- * @since 1.0
330
- * @since 1.6 register_deactivation_hook() moved to this file (basic-setup.php) from main plugin file (superpwa.php)
331
- */
332
- function superpwa_deactivate_plugin( $network_active ) {
333
-
334
- // Delete manifest
335
- superpwa_delete_manifest();
336
-
337
- // Delete service worker
338
- superpwa_delete_sw();
339
-
340
- // For multisites, save the de-activation status of current blog.
341
- superpwa_multisite_activation_status( false );
342
-
343
- // Run the network deactivator during network deactivation
344
- if ( $network_active === true ) {
345
- superpwa_multisite_network_deactivator();
346
- }
347
- }
348
- register_deactivation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_deactivate_plugin' );
349
-
350
- /**
351
- * Load plugin text domain
352
- *
353
- * @since 1.0
354
- */
355
- function superpwa_load_plugin_textdomain() {
356
- load_plugin_textdomain( 'super-progressive-web-apps', false, '/super-progressive-web-apps/languages/' );
357
- }
358
- add_action( 'plugins_loaded', 'superpwa_load_plugin_textdomain' );
359
-
360
- /**
361
- * Print direct link to plugin settings in plugins list in admin
362
- *
363
- * @since 1.0
364
- */
365
- function superpwa_settings_link( $links ) {
366
-
367
- $pro_plugin = 'super-progressive-web-apps-pro/super-progressive-web-apps-pro.php';
368
- // True means, add-on is installed and active
369
- if ( is_plugin_active( $pro_plugin ) ) {
370
- // True means, add-on is installed and active
371
- return array_merge(
372
- array(
373
- 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>',
374
- // 'upgrade' => '<a href="' . admin_url( 'admin.php?page=superpwa-upgrade' ) . '">' . __( 'Upgrade to Pro', 'super-progressive-web-apps' ) . '</a>'
375
- ),
376
- $links
377
- );
378
- }else{
379
- return array_merge(
380
- array(
381
- 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>',
382
- 'upgrade' => '<a href="' . admin_url( 'admin.php?page=superpwa-upgrade' ) . '">' . __( 'Upgrade to Pro', 'super-progressive-web-apps' ) . '</a>'
383
- ),
384
- $links
385
- );
386
-
387
- }
388
-
389
- }
390
- add_filter( 'plugin_action_links_' . plugin_basename( SUPERPWA_PLUGIN_FILE ), 'superpwa_settings_link' );
391
-
392
- /**
393
- * Add donate and other links to plugins list
394
- *
395
- * @since 1.0
396
- */
397
- function superpwa_plugin_row_meta( $links, $file ) {
398
-
399
- if ( strpos( $file, 'superpwa.php' ) !== false ) {
400
- $new_links = array(
401
- 'demo' => '<a href="https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin_row_meta" target="_blank">' . __( 'Demo', 'super-progressive-web-apps' ) . '</a>',
402
- );
403
- $links = array_merge( $links, $new_links );
404
- }
405
-
406
- return $links;
407
- }
408
- add_filter( 'plugin_row_meta', 'superpwa_plugin_row_meta', 10, 2 );
409
-
410
- /**
411
- * Adds rewrite rules to handle request to SW javascript and Manifest json.
412
- *
413
- * @since 2.0
414
- *
415
- * @uses superpwa_get_sw_filename()
416
- * @uses superpwa_get_manifest_filename()
417
- */
418
- function superpwa_add_rewrite_rules() {
419
- $sw_filename = superpwa_get_sw_filename();
420
- add_rewrite_rule( "^/{$sw_filename}$",
421
- "index.php?{$sw_filename}=1"
422
- );
423
-
424
- $manifest_filename = superpwa_get_manifest_filename();
425
- add_rewrite_rule( "^/{$manifest_filename}$",
426
- "index.php?{$manifest_filename}=1"
427
- );
428
- }
429
-
430
- /**
431
- * Generates SW and Manifest on the fly.
432
- *
433
- * This way no physical files have to be placed on WP root folder. Hallelujah!
434
- *
435
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
436
- *
437
- * @uses superpwa_get_sw_filename()
438
- * @uses superpwa_get_manifest_filename()
439
- * @uses superpwa_manifest_template()
440
- * @uses superpwa_sw_template()
441
- *
442
- * @since 2.0
443
- * @since 2.1 uses http_build_query() instead of implode() to convert query_vars to string.
444
- */
445
- function superpwa_generate_sw_and_manifest_on_fly( $query ) {
446
- if ( ! property_exists( $query, 'query_vars' ) || ! is_array( $query->query_vars ) ) {
447
- return;
448
- }
449
- $query_vars_as_string = http_build_query( $query->query_vars );
450
- $manifest_filename = superpwa_get_manifest_filename();
451
- $sw_filename = superpwa_get_sw_filename();
452
- $amphtml_filename = 'superpwa-amp-sw.html';
453
-
454
- if ( strpos( $query_vars_as_string, $manifest_filename ) !== false ) {
455
- // Generate manifest from Settings and send the response w/ header.
456
- header( 'Content-Type: application/json' );
457
- echo json_encode( superpwa_manifest_template() );
458
- exit();
459
- }
460
- // Needed new query_vars of pagename for Wp Fastest Cache
461
- if(class_exists('WpFastestCache')){
462
- $query_vars_as_string = isset($query->query_vars['pagename']) ? $query->query_vars['pagename'] : false;
463
- if($query_vars_as_string == false){
464
- $query_vars_as_string = isset($query->query_vars['name']) ? $query->query_vars['name'] : '';
465
- }
466
- }
467
-
468
- if ( strpos( $query_vars_as_string, $sw_filename ) !== false ) {
469
- header( 'Content-Type: text/javascript' );
470
- echo superpwa_sw_template();
471
- exit();
472
- }
473
- if ( strpos( $query_vars_as_string, $amphtml_filename ) !== false ) {
474
- header( 'Content-Type: text/html' );
475
- echo amp_service_worker_template();
476
- exit();
477
- }
478
- }
479
-
480
- /**
481
- * Sets up the hooks once.
482
- *
483
- * Possibly put in the same order as execution for better understanding.
484
- *
485
- * @link https://codex.wordpress.org/Plugin_API/Action_Reference Actions run during a typical Request.
486
- * @link https://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded
487
- *
488
- * @since 2.0
489
- */
490
- function superpwa_setup_hooks() {
491
- add_action( 'init', 'superpwa_add_rewrite_rules' );
492
- add_action( 'parse_request', 'superpwa_generate_sw_and_manifest_on_fly' );
493
- }
494
  add_action( 'plugins_loaded', 'superpwa_setup_hooks' );
1
+ <?php
2
+ /**
3
+ * Basic setup functions for the plugin
4
+ *
5
+ * @since 1.0
6
+ *
7
+ * @function superpwa_activate_plugin() Plugin activatation todo list
8
+ * @function superpwa_activation_redirect() Redirect to SuperPWA UI on plugin activation
9
+ * @function superpwa_admin_notices() Admin notices
10
+ * @function superpwa_network_admin_notices() Network Admin notices
11
+ * @function superpwa_upgrader() Plugin upgrade todo list
12
+ * @function superpwa_deactivate_plugin() Plugin deactivation todo list
13
+ * @function superpwa_load_plugin_textdomain() Load plugin text domain
14
+ * @function superpwa_settings_link() Print direct link to plugin settings in plugins list in admin
15
+ * @function superpwa_plugin_row_meta() Add donate and other links to plugins list
16
+ */
17
+
18
+ // Exit if accessed directly
19
+ if ( ! defined('ABSPATH') ) exit;
20
+
21
+ /**
22
+ * Plugin activation todo list
23
+ *
24
+ * This function runs when user activates the plugin. Used in register_activation_hook()
25
+ * On multisites, during network activation, this is fired only for the main site.
26
+ * For the rest of the sites, superpwa_upgrader() handles generation of manifest and service worker.
27
+ *
28
+ * @param $network_active (Boolean) True if the plugin is network activated, false otherwise.
29
+ *
30
+ * @author Arun Basil Lal
31
+ *
32
+ * @link https://www.alexgeorgiou.gr/network-activated-wordpress-plugins/ (Thanks Alex!)
33
+ *
34
+ * @since 1.0
35
+ * @since 1.6 register_activation_hook() moved to this file (basic-setup.php) from main plugin file (superpwa.php).
36
+ * @since 1.6 Added checks for multisite compatibility.
37
+ */
38
+ function superpwa_activate_plugin( $network_active ) {
39
+
40
+ // Adding option to show/hide newsletter form
41
+ add_option( 'superpwa_hide_newsletter', 'no' );
42
+
43
+ // Not network active i.e. plugin is activated on a single install (normal WordPress install) or a single site on a multisite network
44
+ if ( ! $network_active ) {
45
+
46
+ // Set transient for single site activation notice
47
+ set_transient( 'superpwa_admin_notice_activation', true, 60 );
48
+
49
+ return;
50
+ }
51
+
52
+ // If we are here, then plugin is network activated on a multisite. Set transient for activation notice on network admin.
53
+ set_transient( 'superpwa_network_admin_notice_activation', true, 60 );
54
+
55
+ }
56
+ register_activation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_activate_plugin' );
57
+
58
+ /**
59
+ * Redirect to SuperPWA UI on plugin activation.
60
+ *
61
+ * Will redirect to SuperPWA settings page when plugin is activated.
62
+ * Will not redirect if multiple plugins are activated at the same time.
63
+ * Will not redirect when activated network wide on multisite. Network admins know their way.
64
+ *
65
+ * @param (string) $plugin Path to the main plugin file from plugins directory.
66
+ * @param (bool) $network_wide True when network activated on multisites. False otherwise.
67
+ *
68
+ * @author Arun Basil Lal
69
+ *
70
+ * @since 2.0
71
+ * @since 2.1 Added a check to see if WP_Plugins_List_Table class is available.
72
+ */
73
+ function superpwa_activation_redirect( $plugin, $network_wide ) {
74
+
75
+ // Return if not SuperPWA or if plugin is activated network wide.
76
+ if ( $plugin !== plugin_basename( SUPERPWA_PLUGIN_FILE ) || $network_wide === true ) {
77
+ return false;
78
+ }
79
+
80
+ if ( ! class_exists( 'WP_Plugins_List_Table' ) ) {
81
+ return false;
82
+ }
83
+
84
+ /**
85
+ * An instance of the WP_Plugins_List_Table class.
86
+ *
87
+ * @link https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-admin/plugins.php#L15
88
+ */
89
+ $wp_list_table_instance = new WP_Plugins_List_Table();
90
+ $current_action = $wp_list_table_instance->current_action();
91
+
92
+ // When only one plugin is activated, the current_action() method will return activate.
93
+ if ( $current_action !== 'activate' ) {
94
+ return false;
95
+ }
96
+
97
+ // Redirect to SuperPWA settings page.
98
+ exit( wp_redirect( admin_url( 'admin.php?page=superpwa' ) ) );
99
+ }
100
+ add_action( 'activated_plugin', 'superpwa_activation_redirect', PHP_INT_MAX, 2 );
101
+
102
+ /**
103
+ * Admin Notices
104
+ *
105
+ * @since 1.2 Admin notice on plugin activation
106
+ */
107
+ function superpwa_admin_notices() {
108
+
109
+ // Notices only for admins
110
+ if ( ! current_user_can( 'manage_options' ) ) {
111
+ return;
112
+ }
113
+
114
+ // Admin notice on plugin activation
115
+ if ( get_transient( 'superpwa_admin_notice_activation' ) ) {
116
+
117
+ $superpwa_is_ready = superpwa_is_pwa_ready() ? __( 'Your app is ready with the default settings. ', 'super-progressive-web-apps' ) : '';
118
+
119
+ // Do not display link to settings UI if we are already in the UI.
120
+ $screen = get_current_screen();
121
+ $superpwa_ui_link_text = ( strpos( $screen->id, 'superpwa' ) === false ) ? sprintf( __( '<a href="%s">Customize your app &rarr;</a>', 'super-progressive-web-apps' ), admin_url( 'admin.php?page=superpwa' ) ) : '';
122
+
123
+ echo '<div class="updated notice is-dismissible"><p>' . __( 'Thank you for installing <strong>Super Progressive Web Apps!</strong> ', 'super-progressive-web-apps' ) . $superpwa_is_ready . $superpwa_ui_link_text . '</p></div>';
124
+
125
+ // Delete transient
126
+ delete_transient( 'superpwa_admin_notice_activation' );
127
+ }
128
+
129
+ // Admin notice on plugin upgrade
130
+ if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
131
+
132
+ echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a href="%s" target="_blank">Discover new features and read the story &rarr;</a>', 'super-progressive-web-apps' ), SUPERPWA_VERSION, 'https://superpwa.com/category/release-notes/latest/?utm_source=superpwa-plugin&utm_medium=update-success-notice' ) . '</p></div>';
133
+
134
+ // Delete transient
135
+ delete_transient( 'superpwa_admin_notice_upgrade_complete' );
136
+ }
137
+ }
138
+ add_action( 'admin_notices', 'superpwa_admin_notices' );
139
+
140
+ /**
141
+ * Network Admin notices
142
+ *
143
+ * @since 1.6 Admin notice on multisite network activation
144
+ */
145
+ function superpwa_network_admin_notices() {
146
+
147
+ // Notices only for admins
148
+ if ( ! current_user_can( 'manage_options' ) ) {
149
+ return;
150
+ }
151
+
152
+ // Network admin notice on multisite network activation
153
+ if ( get_transient( 'superpwa_network_admin_notice_activation' ) ) {
154
+
155
+ $superpwa_is_ready = superpwa_is_pwa_ready() ? 'Your app is ready on the main website with the default settings. ' : '';
156
+
157
+ echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( 'Thank you for installing <strong>Super Progressive Web Apps!</strong> '. $superpwa_is_ready .'<a href="%s">Customize your app &rarr;</a><br/>Note: manifest and service worker for the individual websites will be generated on the first visit to the respective WordPress admin.', 'super-progressive-web-apps' ), admin_url( 'admin.php?page=superpwa' ) ) . '</p></div>';
158
+
159
+ // Delete transient
160
+ delete_transient( 'superpwa_network_admin_notice_activation' );
161
+ }
162
+
163
+ // Network admin notice on plugin upgrade
164
+ if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
165
+
166
+ echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a href="%s" target="_blank">Discover new features and read the story &rarr;</a>', 'super-progressive-web-apps' ), SUPERPWA_VERSION, 'https://superpwa.com/category/release-notes/latest/?utm_source=superpwa-plugin&utm_medium=update-success-notice-multisite' ) . '</p></div>';
167
+
168
+ // Delete transient
169
+ delete_transient( 'superpwa_admin_notice_upgrade_complete' );
170
+ }
171
+ }
172
+ add_action( 'network_admin_notices', 'superpwa_network_admin_notices' );
173
+
174
+ /**
175
+ * Plugin upgrade todo list
176
+ *
177
+ * @since 1.3.1
178
+ * @since 1.4 Added orientation setting and theme_color to database when upgrading from pre 1.4 versions.
179
+ * @since 1.6 Added multisite compatibility.
180
+ */
181
+ function superpwa_upgrader() {
182
+
183
+ $current_ver = get_option( 'superpwa_version' );
184
+
185
+ // Return if we have already done this todo
186
+ if ( version_compare( $current_ver, SUPERPWA_VERSION, '==' ) ) {
187
+ return;
188
+ }
189
+
190
+ /**
191
+ * Todo list for fresh install.
192
+ *
193
+ * On a multisite, during network activation, the activation hook (and activation todo) is not fired.
194
+ * Manifest and service worker is generated the first time the wp-admin is loaded (when admin_init is fired).
195
+ */
196
+ if ( $current_ver === false ) {
197
+
198
+ // Generate manifest
199
+ superpwa_generate_manifest();
200
+
201
+ // Generate service worker
202
+ superpwa_generate_sw();
203
+
204
+ if ( is_multisite() ) {
205
+
206
+ // For multisites, save the activation status of current blog.
207
+ superpwa_multisite_activation_status( true );
208
+ }
209
+
210
+ // Save SuperPWA version to database.
211
+ add_option( 'superpwa_version', SUPERPWA_VERSION );
212
+
213
+ return;
214
+ }
215
+
216
+ /**
217
+ * Add orientation and theme_color to database when upgrading from pre 1.4 versions.
218
+ *
219
+ * Until 1.4, there was no UI for orientation and theme_color.
220
+ * In the manifest, orientation was hard coded as 'natural'.
221
+ * background_color had UI and this value was used for both background_color and theme_color in the manifest.
222
+ *
223
+ * @since 1.4
224
+ */
225
+ if ( version_compare( $current_ver, '1.3.1', '<=' ) ) {
226
+
227
+ // Get settings
228
+ $settings = superpwa_get_settings();
229
+
230
+ // Orientation was set as 'natural' until version 1.4. Set it as 1, which is 'portrait'.
231
+ $settings['orientation'] = 1;
232
+
233
+ // theme_color was same as background_color until version 1.4
234
+ $settings['theme_color'] = $settings['background_color'];
235
+
236
+ // Write settings back to database
237
+ update_option( 'superpwa_settings', $settings );
238
+ }
239
+
240
+ /**
241
+ * Delete existing service worker for single sites that use OneSignal.
242
+ *
243
+ * For OneSignal compatibility, in version 1.8 the service worker filename is renamed.
244
+ * If OneSignal is active, by this point, the new filename will be filtered in.
245
+ * This upgrade routine restores the defaul service worker filename and deletes the existing service worker.
246
+ * Also adds back the filter for new filename. OneSignal compatibility for multisites is not available at this point.
247
+ *
248
+ * @since 1.8
249
+ */
250
+ if ( version_compare( $current_ver, '1.7.1', '<=' ) && class_exists( 'OneSignal' ) && ! is_multisite() ) {
251
+
252
+ // Restore the default service worker filename of SuperPWA.
253
+ remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
254
+
255
+ // Delete service worker
256
+ superpwa_delete_sw();
257
+
258
+ // Change service worker filename to match OneSignal's service worker.
259
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
260
+ }
261
+
262
+ /**
263
+ * Add display to database when upgrading from pre 2.0 versions.
264
+ * Delete manifest and service worker files.
265
+ *
266
+ * Until 2.0, there was no UI for display.
267
+ * In the manifest, display was hard coded as 'standalone'.
268
+ *
269
+ * Starting with 2.0, manifest and service worker files are dynamic and no longer static.
270
+ *
271
+ * @since 2.0
272
+ */
273
+ if ( version_compare( $current_ver, '1.9', '<=' ) ) {
274
+
275
+ // Get settings
276
+ $settings = superpwa_get_settings();
277
+
278
+ // Display was set as 'standalone' until version 2.0. Set it as 1, which is 'standalone'.
279
+ $settings['display'] = 1;
280
+
281
+ // Write settings back to database
282
+ update_option( 'superpwa_settings', $settings );
283
+ }
284
+
285
+ /**
286
+ * Add file state variables to database
287
+ *
288
+ * @since 2.0.1
289
+ */
290
+ if ( version_compare( $current_ver, '2.0', '<=' ) ) {
291
+
292
+ // Get settings
293
+ $settings = superpwa_get_settings();
294
+
295
+ // 1 for static files, 0 for dynamic files (default).
296
+ $settings['is_static_manifest'] = 0;
297
+ $settings['is_static_sw'] = 0;
298
+
299
+ // Write settings back to database
300
+ update_option( 'superpwa_settings', $settings );
301
+ }
302
+
303
+ // Re-generate manifest
304
+ superpwa_generate_manifest();
305
+
306
+ // Re-generate service worker
307
+ superpwa_generate_sw();
308
+
309
+ // Add current version to database
310
+ update_option( 'superpwa_version', SUPERPWA_VERSION );
311
+
312
+ // For multisites, save the activation status of current blog.
313
+ superpwa_multisite_activation_status( true );
314
+
315
+ // Set transient for upgrade complete notice
316
+ set_transient( 'superpwa_admin_notice_upgrade_complete', true, 60 );
317
+ }
318
+ add_action( 'admin_init', 'superpwa_upgrader' );
319
+
320
+ /**
321
+ * Plugin deactivation todo list
322
+ *
323
+ * Runs during deactivation.
324
+ * During uninstall uninstall.php is also executed.
325
+ *
326
+ * @param $network_active (Boolean) True if the plugin is network activated, false otherwise.
327
+ * @link https://www.alexgeorgiou.gr/network-activated-wordpress-plugins/ (Thanks Alex!)
328
+ *
329
+ * @since 1.0
330
+ * @since 1.6 register_deactivation_hook() moved to this file (basic-setup.php) from main plugin file (superpwa.php)
331
+ */
332
+ function superpwa_deactivate_plugin( $network_active ) {
333
+
334
+ // Delete manifest
335
+ superpwa_delete_manifest();
336
+
337
+ // Delete service worker
338
+ superpwa_delete_sw();
339
+
340
+ // For multisites, save the de-activation status of current blog.
341
+ superpwa_multisite_activation_status( false );
342
+
343
+ // Run the network deactivator during network deactivation
344
+ if ( $network_active === true ) {
345
+ superpwa_multisite_network_deactivator();
346
+ }
347
+ }
348
+ register_deactivation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_deactivate_plugin' );
349
+
350
+ /**
351
+ * Load plugin text domain
352
+ *
353
+ * @since 1.0
354
+ */
355
+ function superpwa_load_plugin_textdomain() {
356
+ load_plugin_textdomain( 'super-progressive-web-apps', false, '/super-progressive-web-apps/languages/' );
357
+ }
358
+ add_action( 'plugins_loaded', 'superpwa_load_plugin_textdomain' );
359
+
360
+ /**
361
+ * Print direct link to plugin settings in plugins list in admin
362
+ *
363
+ * @since 1.0
364
+ */
365
+ function superpwa_settings_link( $links ) {
366
+
367
+ $pro_plugin = 'super-progressive-web-apps-pro/super-progressive-web-apps-pro.php';
368
+ // True means, add-on is installed and active
369
+ if ( is_plugin_active( $pro_plugin ) ) {
370
+ // True means, add-on is installed and active
371
+ return array_merge(
372
+ array(
373
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>',
374
+ // 'upgrade' => '<a href="' . admin_url( 'admin.php?page=superpwa-upgrade' ) . '">' . __( 'Upgrade to Pro', 'super-progressive-web-apps' ) . '</a>'
375
+ ),
376
+ $links
377
+ );
378
+ }else{
379
+ return array_merge(
380
+ array(
381
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>',
382
+ 'upgrade' => '<a href="' . admin_url( 'admin.php?page=superpwa-upgrade' ) . '">' . __( 'Upgrade to Pro', 'super-progressive-web-apps' ) . '</a>'
383
+ ),
384
+ $links
385
+ );
386
+
387
+ }
388
+
389
+ }
390
+ add_filter( 'plugin_action_links_' . plugin_basename( SUPERPWA_PLUGIN_FILE ), 'superpwa_settings_link' );
391
+
392
+ /**
393
+ * Add donate and other links to plugins list
394
+ *
395
+ * @since 1.0
396
+ */
397
+ function superpwa_plugin_row_meta( $links, $file ) {
398
+
399
+ if ( strpos( $file, 'superpwa.php' ) !== false ) {
400
+ $new_links = array(
401
+ 'demo' => '<a href="https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin_row_meta" target="_blank">' . __( 'Demo', 'super-progressive-web-apps' ) . '</a>',
402
+ );
403
+ $links = array_merge( $links, $new_links );
404
+ }
405
+
406
+ return $links;
407
+ }
408
+ add_filter( 'plugin_row_meta', 'superpwa_plugin_row_meta', 10, 2 );
409
+
410
+ /**
411
+ * Adds rewrite rules to handle request to SW javascript and Manifest json.
412
+ *
413
+ * @since 2.0
414
+ *
415
+ * @uses superpwa_get_sw_filename()
416
+ * @uses superpwa_get_manifest_filename()
417
+ */
418
+ function superpwa_add_rewrite_rules() {
419
+ $sw_filename = superpwa_get_sw_filename();
420
+ add_rewrite_rule( "^/{$sw_filename}$",
421
+ "index.php?{$sw_filename}=1"
422
+ );
423
+
424
+ $manifest_filename = superpwa_get_manifest_filename();
425
+ add_rewrite_rule( "^/{$manifest_filename}$",
426
+ "index.php?{$manifest_filename}=1"
427
+ );
428
+ }
429
+
430
+ /**
431
+ * Generates SW and Manifest on the fly.
432
+ *
433
+ * This way no physical files have to be placed on WP root folder. Hallelujah!
434
+ *
435
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
436
+ *
437
+ * @uses superpwa_get_sw_filename()
438
+ * @uses superpwa_get_manifest_filename()
439
+ * @uses superpwa_manifest_template()
440
+ * @uses superpwa_sw_template()
441
+ *
442
+ * @since 2.0
443
+ * @since 2.1 uses http_build_query() instead of implode() to convert query_vars to string.
444
+ */
445
+ function superpwa_generate_sw_and_manifest_on_fly( $query ) {
446
+ if ( ! property_exists( $query, 'query_vars' ) || ! is_array( $query->query_vars ) ) {
447
+ return;
448
+ }
449
+ $query_vars_as_string = http_build_query( $query->query_vars );
450
+ $manifest_filename = superpwa_get_manifest_filename();
451
+ $sw_filename = superpwa_get_sw_filename();
452
+ $amphtml_filename = 'superpwa-amp-sw.html';
453
+
454
+ if ( strpos( $query_vars_as_string, $manifest_filename ) !== false ) {
455
+ // Generate manifest from Settings and send the response w/ header.
456
+ header( 'Content-Type: application/json' );
457
+ echo json_encode( superpwa_manifest_template() );
458
+ exit();
459
+ }
460
+ // Needed new query_vars of pagename for Wp Fastest Cache
461
+ if(class_exists('WpFastestCache')){
462
+ $query_vars_as_string = isset($query->query_vars['pagename']) ? $query->query_vars['pagename'] : false;
463
+ if($query_vars_as_string == false){
464
+ $query_vars_as_string = isset($query->query_vars['name']) ? $query->query_vars['name'] : '';
465
+ }
466
+ }
467
+
468
+ if ( strpos( $query_vars_as_string, $sw_filename ) !== false ) {
469
+ header( 'Content-Type: text/javascript' );
470
+ echo superpwa_sw_template();
471
+ exit();
472
+ }
473
+ if ( strpos( $query_vars_as_string, $amphtml_filename ) !== false ) {
474
+ header( 'Content-Type: text/html' );
475
+ echo amp_service_worker_template();
476
+ exit();
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Sets up the hooks once.
482
+ *
483
+ * Possibly put in the same order as execution for better understanding.
484
+ *
485
+ * @link https://codex.wordpress.org/Plugin_API/Action_Reference Actions run during a typical Request.
486
+ * @link https://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded
487
+ *
488
+ * @since 2.0
489
+ */
490
+ function superpwa_setup_hooks() {
491
+ add_action( 'init', 'superpwa_add_rewrite_rules' );
492
+ add_action( 'parse_request', 'superpwa_generate_sw_and_manifest_on_fly' );
493
+ }
494
  add_action( 'plugins_loaded', 'superpwa_setup_hooks' );
admin/css/upgrade-ui.css CHANGED
@@ -1,611 +1,611 @@
1
- #the-list{position: relative;}
2
- .fp-wr {
3
- width: 95%;
4
- margin: 0 auto;
5
- position: relative
6
- }
7
-
8
- .sp-fp-img {
9
- width: 100%;
10
- margin: 0 auto;
11
- text-align: center;
12
- position: relative;
13
- line-height: 0;
14
- height: 300px;
15
- }
16
-
17
- .fp-img img {
18
- position: relative
19
- }
20
-
21
- .sp_ov {
22
- background: linear-gradient(to right, #f4a7c9, #b168ff);
23
- bottom: 0;
24
- left: 0;
25
- position: absolute;
26
- right: 0;
27
- top: 0;
28
- border-radius: 10px
29
- }
30
-
31
- .sp-fp-cnt {
32
- position: absolute;
33
- top: 40px;
34
- bottom: 0;
35
- left: 40px;
36
- right: 40px;
37
- margin: 0 auto;
38
- text-align: center
39
- }
40
-
41
- .sp-fp-cnt h1 {
42
- font-size: 56px;
43
- color: #ffffff;
44
- font-weight: 600;
45
- text-shadow: 2px 2px 0px rgb(0 0 0 / 0.75);
46
- }
47
-
48
- .sp-fp-cnt p {
49
- margin-top: 10px;
50
- color: rgb(0 0 0 / 70%);
51
- font-size: 18px;
52
- padding: 0 100px;
53
- line-height: 1.4;
54
- }
55
-
56
- .sp-fp-cnt .buy {
57
- background-color: #ffe258 !important;
58
- background: linear-gradient(to right, #fdfc35, #ffe258) !important;
59
- border-radius: 3px !important;
60
- border-width: 0px !important;
61
- font-weight: 400;
62
- color: #524a1b !important;
63
- font-size: 17px !important;
64
- padding: 0.6rem 1.2rem;
65
- font-size: 1.25rem;
66
- line-height: 2;
67
- }
68
- .sp-fp-cnt .buy:hover{
69
- box-shadow: 0px 2px 2px #999;
70
- background: linear-gradient(to left, #fdfc35, #ffe258) !important;
71
- }
72
- .pvf {
73
- position: relative;
74
- top: -16px;
75
- border: 1px solid #eee;
76
- padding-bottom: 40px
77
- }
78
-
79
- .ext {
80
- display: grid;
81
- grid-template-columns: 1fr 1fr 1fr;
82
- background: #f9f9f9;
83
- padding: 45px 0 45px 25px
84
- }
85
-
86
- .ex-1 {
87
- width: 250px
88
- }
89
-
90
- .ex-1 h4 {
91
- margin: 15px 0 12px 0;
92
- font-size: 18px;
93
- color: #222;
94
- font-weight: 500
95
- }
96
-
97
- .ex-1 p {
98
- font-size: 14px;
99
- color: #555;
100
- font-weight: 400;
101
- margin: 0
102
- }
103
-
104
- .e-1 img {
105
- width: 65px!important
106
- }
107
-
108
- .e-2 img {
109
- width: 45px!important
110
- }
111
-
112
- .e-3 img {
113
- width: 49px!important
114
- }
115
-
116
- .pvf-cnt {
117
- width: 100%;
118
- display: inline-block
119
- }
120
-
121
- .pvf-tlt {
122
- text-align: center;
123
- width: 100%;
124
- margin: 70px 0 60px 0
125
- }
126
-
127
- .pvf-tlt h2 {
128
- font-size: 36px;
129
- line-height: 1.4;
130
- color: #000;
131
- font-weight: 500;
132
- margin: 0
133
- }
134
-
135
- .pvf-tlt span {
136
- font-size: 16px;
137
- color: #000;
138
- margin-top: 15px;
139
- display: inline-block;
140
- position: relative;
141
- top: 4px
142
- }
143
-
144
- .pvf-cmp {
145
- display: grid;
146
- grid-template-columns: 1fr 2fr
147
- }
148
-
149
- .fr {
150
- border-right: 1px solid #eee
151
- }
152
-
153
- .fr h1,
154
- .pr h1 {
155
- font-size: 36px;
156
- font-weight: 700;
157
- line-height: 1.5;
158
- border-bottom: 1px solid #efefef;
159
- padding: 0 0 20px 35px
160
- }
161
-
162
- .pr h1 {
163
- padding-left: 50px
164
- }
165
-
166
- .fr-fe {
167
- color: #222;
168
- padding-top: 10px
169
- }
170
-
171
- .fe-1 {
172
- padding: 22px 35px 35px 35px
173
- }
174
-
175
- .fe-1 h4 {
176
- margin: 0 0 10px 0;
177
- font-size: 20px;
178
- line-height: 1.4;
179
- font-weight: 400;
180
- color: #000
181
- }
182
-
183
- .fe-1 p {
184
- font-size: 15px;
185
- line-height: 1.4;
186
- margin: 0;
187
- color: #333
188
- }
189
-
190
- .pr-fe {
191
- padding: 34px 35px 35px 35px
192
- }
193
-
194
- .pr-fe span {
195
- font-family: georgia;
196
- font-size: 16px;
197
- font-weight: 700;
198
- color: #000;
199
- font-style: italic;
200
- line-height: 1.3
201
- }
202
-
203
- .fet {
204
- width: 100%;
205
- display: grid;
206
- grid-template-columns: 1fr 1fr;
207
- grid-gap: 25px;
208
- margin-top: 40px
209
- }
210
-
211
- .fe-2 {
212
- color: #222
213
- }
214
-
215
- .fe-t img {
216
- width: 22px!important;
217
- display: inline-block;
218
- vertical-align: middle
219
- }
220
-
221
- .fe-t h4 {
222
- margin: 0;
223
- display: inline-block;
224
- vertical-align: middle;
225
- font-size: 19px;
226
- color: #000;
227
- font-weight: 400;
228
- line-height: 1.4;
229
- padding-left: 8px
230
- }
231
-
232
- .fe-2 p {
233
- font-size: 15px;
234
- line-height: 1.4;
235
- margin: 0;
236
- color: #555;
237
- padding-top: 8px
238
- }
239
-
240
- .pr-btn {
241
- width: 100%;
242
- display: inline-block;
243
- text-align: center;
244
- margin: 50px 0 25px 0
245
- }
246
-
247
- .pr-btn a {
248
- text-decoration: none;
249
- color: #fff;
250
- padding: 12px 35px 17px 35px;
251
- display: inline-block;
252
- border-radius: 5px;
253
- font-size: 28px;
254
- font-weight: 500;
255
- line-height: 1.2;
256
- background: -webkit-linear-gradient(to right, #f988bb, #9853e2);
257
- font-weight: 600;
258
- background: #eb3349;
259
- background: linear-gradient(to right, #f988bb, #9853e2);
260
- margin-top: 0;
261
- box-shadow: 0 .15em .65em 0 rgba(0, 0, 0, .25)
262
- }
263
-
264
- .amp-upg {
265
- background: #f5f5f5;
266
- padding: 60px 10px 0 10px
267
- }
268
-
269
- .upg-t {
270
- text-align: center;
271
- color: #222
272
- }
273
-
274
- .upg-t h2 {
275
- margin: 0;
276
- font-size: 35px;
277
- color: #060606;
278
- line-height: 1.3;
279
- font-weight: 500
280
- }
281
-
282
- .upg-t>span {
283
- font-size: 14px;
284
- line-height: 1.2;
285
- margin-top: 15px;
286
- display: inline-block;
287
- color: #666
288
- }
289
-
290
- .sp-pri-lst {
291
- width: 100%;
292
- display: grid;
293
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
294
- margin-top: 70px;
295
- grid-gap: 1px;
296
- box-shadow: 0 10px 15px 1px #ddd
297
- }
298
-
299
- .pri-tb {
300
- background: #fff;
301
- text-align: center;
302
- border: 1px solid #f9f9f9;
303
- position: relative
304
- }
305
-
306
- .pri-tb:hover {
307
- border: 1px solid #b168ff
308
- }
309
-
310
- .pri-tb a:hover .pri-by {
311
- background: #b168ff
312
- }
313
- .pri-tb a:hover .amt {
314
- color: #7241a7
315
- }
316
-
317
- .pri-tb a {
318
- display: inline-block;
319
- text-decoration: none;
320
- color: #222;
321
- padding: 20px 12px
322
- }
323
-
324
- .pri-tb h5 {
325
- margin: 0 0 20px 0;
326
- font-size: 13px;
327
- line-height: 1.2;
328
- letter-spacing: 2px;
329
- font-weight: 400;
330
- color: #000
331
- }
332
-
333
- .pri-tb span {
334
- display: inline-block
335
- }
336
-
337
- .pri-tb .amt {
338
- font-size: 40px;
339
- color: #b168ff;
340
- font-weight: 500;
341
- margin-bottom: 20px;
342
- display: block
343
- }
344
-
345
- .pri-tb .d-amt {
346
- font-size: 24px;
347
- color: #666;
348
- font-weight: 500;
349
- margin-bottom: 15px;
350
- display: none;
351
- text-decoration: line-through
352
- }
353
-
354
- .d-amt sup {
355
- line-height: 0;
356
- position: relative;
357
- top: 7px
358
- }
359
-
360
- .pri-tb .s-amt {
361
- font-size: 13px;
362
- color: #4caf50;
363
- font-weight: 500;
364
- margin-bottom: 10px;
365
- display: none
366
- }
367
-
368
- .pri-tb .amt sup {
369
- font-size: 22px;
370
- padding: 0 4px 0 0;
371
- position: relative;
372
- top: 7px
373
- }
374
-
375
- .pri-tb .bil {
376
- color: #aaa;
377
- font-size: 12px;
378
- margin-bottom: 20px
379
- }
380
-
381
- .pri-tb .e,
382
- .pri-tb .f,
383
- .pri-tb .s {
384
- font-size: 14px;
385
- margin-bottom: 15px;
386
- color: #3b4750
387
- }
388
-
389
- .pri-tb .sp-sv {
390
- display: none;
391
- font-size: 12px;
392
- color: #fff;
393
- background: #4caf50;
394
- margin: 0 auto;
395
- padding: 1px 7px 2px 7px;
396
- border-radius: 45px
397
- }
398
-
399
- .pri-by {
400
- font-size: 15px;
401
- line-height: 1.2;
402
- background: #333;
403
- border-radius: 2px;
404
- padding: 9px 18px 10px 18px;
405
- display: inline-block;
406
- color: #fff;
407
- margin-top: 29px;
408
- font-weight: 500
409
- }
410
-
411
- .sp-pri-lst .rec {
412
- box-shadow: 0 1px 40px 0 #ccc;
413
- background: #fff;
414
- z-index: 9;
415
- margin-top: -20px;
416
- position: relative
417
- }
418
-
419
- .sp-pri-lst .rec:hover .sp-rcm {
420
- background: #b168ff;
421
- color: #fff
422
- }
423
-
424
- .sp-pri-lst .rec .pri-by {
425
- background: #b168ff
426
- }
427
-
428
- .sp-rcm {
429
- background: linear-gradient(to right, #fdfc35, #ffe258);
430
- color: #7b6c23;
431
- position: absolute;
432
- top: -20px;
433
- left: 0;
434
- right: -1px;
435
- bottom: auto;
436
- padding: 2px 0;
437
- font-size: 11px;
438
- letter-spacing: 2px
439
- }
440
-
441
- .tru-us {
442
- text-align: center;
443
- padding: 60px 0;
444
- margin: 0 auto;
445
- font-size: 16px;
446
- color: #222
447
- }
448
-
449
- .tru-us h2 {
450
- margin: 20px 0 0 0;
451
- font-size: 28px;
452
- font-weight: 500
453
- }
454
-
455
- .tru-us p {
456
- font-size: 17px;
457
- margin: 19px 15% 18px 15%;
458
- color: #666;
459
- line-height: 29px
460
- }
461
-
462
- .tru-us a {
463
- font-size: 18px;
464
- color: #489bff;
465
- text-decoration: none;
466
- font-weight: 400
467
- }
468
-
469
- .ampfaq {
470
- width: 100%;
471
- margin: 25px 0
472
- }
473
-
474
- .ampfaq h4 {
475
- margin: 0;
476
- text-align: center;
477
- font-size: 20px;
478
- font-weight: 500;
479
- color: #333
480
- }
481
-
482
- .faq-lst {
483
- margin-top: 50px;
484
- display: grid;
485
- grid-template-columns: 1fr 1fr
486
- }
487
-
488
- .lt {
489
- padding-left: 50px
490
- }
491
-
492
- .lt,
493
- .rt {
494
- width: 70%
495
- }
496
-
497
- .lt ul,
498
- .rt ul {
499
- margin: 0
500
- }
501
-
502
- .lt ul li,
503
- .rt ul li {
504
- color: #222;
505
- margin-bottom: 30px!important
506
- }
507
-
508
- .lt span,
509
- .rt span {
510
- font-size: 17px;
511
- font-weight: 500;
512
- margin-bottom: 6px;
513
- display: inline-block
514
- }
515
-
516
- .lt p,
517
- .rt p {
518
- font-size: 15px;
519
- margin: 0
520
- }
521
-
522
- .f-cnt {
523
- text-align: center;
524
- margin-top: 20px;
525
- color: #222
526
- }
527
-
528
- .f-cnt span {
529
- font-size: 17px;
530
- margin: 8px 0;
531
- font-weight: 500
532
- }
533
-
534
- .f-cnt p {
535
- font-size: 15px;
536
- margin: 6px 0
537
- }
538
-
539
- .f-cnt a {
540
- background: #333;
541
- color: #fff;
542
- padding: 15px 30px;
543
- text-decoration: none;
544
- font-size: 18px;
545
- font-weight: 500;
546
- display: inline-block;
547
- margin-top: 15px
548
- }
549
-
550
- @media(max-width:1366px) {
551
- .amp-upg {
552
- padding: 60px 0 0 0
553
- }
554
- .sp-fp-cnt p {
555
-
556
- line-height: 35px;
557
- font-size: 18px;
558
-
559
- }
560
- }
561
-
562
- @media(max-width:1280px) {
563
- .sp-fp-cnt {
564
- top: 1.3%
565
- }
566
- }
567
-
568
- @media(max-width:768px) {
569
- .ext {
570
- grid-template-columns: 1fr;
571
- grid-gap: 30px 0;
572
- padding: 30px
573
- }
574
- .pvf-tlt h2 {
575
- font-size: 26px
576
- }
577
- .pvf-cmp {
578
- grid-template-columns: 1fr
579
- }
580
- .pr-btn a {
581
- font-size: 22px
582
- }
583
- .sp-pri-lst {
584
- grid-template-columns: 1fr 1fr 1fr
585
- }
586
- .sp-fp-cnt p {
587
- line-height: 1.5;
588
- font-size: 16px;
589
- margin-top: 15px;
590
- padding: 0 20px
591
- }
592
- .sp-fp-cnt .buy {
593
- font-size: 16px;
594
- padding: 8px 30px
595
- }
596
- .sp-fp-cnt {
597
- top: 15px
598
- }
599
- .sp-fp-cnt h1 {
600
- font-size: 30px
601
- }
602
- .ex-1 {
603
- width: 100%
604
- }
605
- .faq-lst {
606
- grid-template-columns: 1fr
607
- }
608
- .rt {
609
- padding-left: 50px
610
- }
611
- }
1
+ #the-list{position: relative;}
2
+ .fp-wr {
3
+ width: 95%;
4
+ margin: 0 auto;
5
+ position: relative
6
+ }
7
+
8
+ .sp-fp-img {
9
+ width: 100%;
10
+ margin: 0 auto;
11
+ text-align: center;
12
+ position: relative;
13
+ line-height: 0;
14
+ height: 300px;
15
+ }
16
+
17
+ .fp-img img {
18
+ position: relative
19
+ }
20
+
21
+ .sp_ov {
22
+ background: linear-gradient(to right, #f4a7c9, #b168ff);
23
+ bottom: 0;
24
+ left: 0;
25
+ position: absolute;
26
+ right: 0;
27
+ top: 0;
28
+ border-radius: 10px
29
+ }
30
+
31
+ .sp-fp-cnt {
32
+ position: absolute;
33
+ top: 40px;
34
+ bottom: 0;
35
+ left: 40px;
36
+ right: 40px;
37
+ margin: 0 auto;
38
+ text-align: center
39
+ }
40
+
41
+ .sp-fp-cnt h1 {
42
+ font-size: 56px;
43
+ color: #ffffff;
44
+ font-weight: 600;
45
+ text-shadow: 2px 2px 0px rgb(0 0 0 / 0.75);
46
+ }
47
+
48
+ .sp-fp-cnt p {
49
+ margin-top: 10px;
50
+ color: rgb(0 0 0 / 70%);
51
+ font-size: 18px;
52
+ padding: 0 100px;
53
+ line-height: 1.4;
54
+ }
55
+
56
+ .sp-fp-cnt .buy {
57
+ background-color: #ffe258 !important;
58
+ background: linear-gradient(to right, #fdfc35, #ffe258) !important;
59
+ border-radius: 3px !important;
60
+ border-width: 0px !important;
61
+ font-weight: 400;
62
+ color: #524a1b !important;
63
+ font-size: 17px !important;
64
+ padding: 0.6rem 1.2rem;
65
+ font-size: 1.25rem;
66
+ line-height: 2;
67
+ }
68
+ .sp-fp-cnt .buy:hover{
69
+ box-shadow: 0px 2px 2px #999;
70
+ background: linear-gradient(to left, #fdfc35, #ffe258) !important;
71
+ }
72
+ .pvf {
73
+ position: relative;
74
+ top: -16px;
75
+ border: 1px solid #eee;
76
+ padding-bottom: 40px
77
+ }
78
+
79
+ .ext {
80
+ display: grid;
81
+ grid-template-columns: 1fr 1fr 1fr;
82
+ background: #f9f9f9;
83
+ padding: 45px 0 45px 25px
84
+ }
85
+
86
+ .ex-1 {
87
+ width: 250px
88
+ }
89
+
90
+ .ex-1 h4 {
91
+ margin: 15px 0 12px 0;
92
+ font-size: 18px;
93
+ color: #222;
94
+ font-weight: 500
95
+ }
96
+
97
+ .ex-1 p {
98
+ font-size: 14px;
99
+ color: #555;
100
+ font-weight: 400;
101
+ margin: 0
102
+ }
103
+
104
+ .e-1 img {
105
+ width: 65px!important
106
+ }
107
+
108
+ .e-2 img {
109
+ width: 45px!important
110
+ }
111
+
112
+ .e-3 img {
113
+ width: 49px!important
114
+ }
115
+
116
+ .pvf-cnt {
117
+ width: 100%;
118
+ display: inline-block
119
+ }
120
+
121
+ .pvf-tlt {
122
+ text-align: center;
123
+ width: 100%;
124
+ margin: 70px 0 60px 0
125
+ }
126
+
127
+ .pvf-tlt h2 {
128
+ font-size: 36px;
129
+ line-height: 1.4;
130
+ color: #000;
131
+ font-weight: 500;
132
+ margin: 0
133
+ }
134
+
135
+ .pvf-tlt span {
136
+ font-size: 16px;
137
+ color: #000;
138
+ margin-top: 15px;
139
+ display: inline-block;
140
+ position: relative;
141
+ top: 4px
142
+ }
143
+
144
+ .pvf-cmp {
145
+ display: grid;
146
+ grid-template-columns: 1fr 2fr
147
+ }
148
+
149
+ .fr {
150
+ border-right: 1px solid #eee
151
+ }
152
+
153
+ .fr h1,
154
+ .pr h1 {
155
+ font-size: 36px;
156
+ font-weight: 700;
157
+ line-height: 1.5;
158
+ border-bottom: 1px solid #efefef;
159
+ padding: 0 0 20px 35px
160
+ }
161
+
162
+ .pr h1 {
163
+ padding-left: 50px
164
+ }
165
+
166
+ .fr-fe {
167
+ color: #222;
168
+ padding-top: 10px
169
+ }
170
+
171
+ .fe-1 {
172
+ padding: 22px 35px 35px 35px
173
+ }
174
+
175
+ .fe-1 h4 {
176
+ margin: 0 0 10px 0;
177
+ font-size: 20px;
178
+ line-height: 1.4;
179
+ font-weight: 400;
180
+ color: #000
181
+ }
182
+
183
+ .fe-1 p {
184
+ font-size: 15px;
185
+ line-height: 1.4;
186
+ margin: 0;
187
+ color: #333
188
+ }
189
+
190
+ .pr-fe {
191
+ padding: 34px 35px 35px 35px
192
+ }
193
+
194
+ .pr-fe span {
195
+ font-family: georgia;
196
+ font-size: 16px;
197
+ font-weight: 700;
198
+ color: #000;
199
+ font-style: italic;
200
+ line-height: 1.3
201
+ }
202
+
203
+ .fet {
204
+ width: 100%;
205
+ display: grid;
206
+ grid-template-columns: 1fr 1fr;
207
+ grid-gap: 25px;
208
+ margin-top: 40px
209
+ }
210
+
211
+ .fe-2 {
212
+ color: #222
213
+ }
214
+
215
+ .fe-t img {
216
+ width: 22px!important;
217
+ display: inline-block;
218
+ vertical-align: middle
219
+ }
220
+
221
+ .fe-t h4 {
222
+ margin: 0;
223
+ display: inline-block;
224
+ vertical-align: middle;
225
+ font-size: 19px;
226
+ color: #000;
227
+ font-weight: 400;
228
+ line-height: 1.4;
229
+ padding-left: 8px
230
+ }
231
+
232
+ .fe-2 p {
233
+ font-size: 15px;
234
+ line-height: 1.4;
235
+ margin: 0;
236
+ color: #555;
237
+ padding-top: 8px
238
+ }
239
+
240
+ .pr-btn {
241
+ width: 100%;
242
+ display: inline-block;
243
+ text-align: center;
244
+ margin: 50px 0 25px 0
245
+ }
246
+
247
+ .pr-btn a {
248
+ text-decoration: none;
249
+ color: #fff;
250
+ padding: 12px 35px 17px 35px;
251
+ display: inline-block;
252
+ border-radius: 5px;
253
+ font-size: 28px;
254
+ font-weight: 500;
255
+ line-height: 1.2;
256
+ background: -webkit-linear-gradient(to right, #f988bb, #9853e2);
257
+ font-weight: 600;
258
+ background: #eb3349;
259
+ background: linear-gradient(to right, #f988bb, #9853e2);
260
+ margin-top: 0;
261
+ box-shadow: 0 .15em .65em 0 rgba(0, 0, 0, .25)
262
+ }
263
+
264
+ .amp-upg {
265
+ background: #f5f5f5;
266
+ padding: 60px 10px 0 10px
267
+ }
268
+
269
+ .upg-t {
270
+ text-align: center;
271
+ color: #222
272
+ }
273
+
274
+ .upg-t h2 {
275
+ margin: 0;
276
+ font-size: 35px;
277
+ color: #060606;
278
+ line-height: 1.3;
279
+ font-weight: 500
280
+ }
281
+
282
+ .upg-t>span {
283
+ font-size: 14px;
284
+ line-height: 1.2;
285
+ margin-top: 15px;
286
+ display: inline-block;
287
+ color: #666
288
+ }
289
+
290
+ .sp-pri-lst {
291
+ width: 100%;
292
+ display: grid;
293
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
294
+ margin-top: 70px;
295
+ grid-gap: 1px;
296
+ box-shadow: 0 10px 15px 1px #ddd
297
+ }
298
+
299
+ .pri-tb {
300
+ background: #fff;
301
+ text-align: center;
302
+ border: 1px solid #f9f9f9;
303
+ position: relative
304
+ }
305
+
306
+ .pri-tb:hover {
307
+ border: 1px solid #b168ff
308
+ }
309
+
310
+ .pri-tb a:hover .pri-by {
311
+ background: #b168ff
312
+ }
313
+ .pri-tb a:hover .amt {
314
+ color: #7241a7
315
+ }
316
+
317
+ .pri-tb a {
318
+ display: inline-block;
319
+ text-decoration: none;
320
+ color: #222;
321
+ padding: 20px 12px
322
+ }
323
+
324
+ .pri-tb h5 {
325
+ margin: 0 0 20px 0;
326
+ font-size: 13px;
327
+ line-height: 1.2;
328
+ letter-spacing: 2px;
329
+ font-weight: 400;
330
+ color: #000
331
+ }
332
+
333
+ .pri-tb span {
334
+ display: inline-block
335
+ }
336
+
337
+ .pri-tb .amt {
338
+ font-size: 40px;
339
+ color: #b168ff;
340
+ font-weight: 500;
341
+ margin-bottom: 20px;
342
+ display: block
343
+ }
344
+
345
+ .pri-tb .d-amt {
346
+ font-size: 24px;
347
+ color: #666;
348
+ font-weight: 500;
349
+ margin-bottom: 15px;
350
+ display: none;
351
+ text-decoration: line-through
352
+ }
353
+
354
+ .d-amt sup {
355
+ line-height: 0;
356
+ position: relative;
357
+ top: 7px
358
+ }
359
+
360
+ .pri-tb .s-amt {
361
+ font-size: 13px;
362
+ color: #4caf50;
363
+ font-weight: 500;
364
+ margin-bottom: 10px;
365
+ display: none
366
+ }
367
+
368
+ .pri-tb .amt sup {
369
+ font-size: 22px;
370
+ padding: 0 4px 0 0;
371
+ position: relative;
372
+ top: 7px
373
+ }
374
+
375
+ .pri-tb .bil {
376
+ color: #aaa;
377
+ font-size: 12px;
378
+ margin-bottom: 20px
379
+ }
380
+
381
+ .pri-tb .e,
382
+ .pri-tb .f,
383
+ .pri-tb .s {
384
+ font-size: 14px;
385
+ margin-bottom: 15px;
386
+ color: #3b4750
387
+ }
388
+
389
+ .pri-tb .sp-sv {
390
+ display: none;
391
+ font-size: 12px;
392
+ color: #fff;
393
+ background: #4caf50;
394
+ margin: 0 auto;
395
+ padding: 1px 7px 2px 7px;
396
+ border-radius: 45px
397
+ }
398
+
399
+ .pri-by {
400
+ font-size: 15px;
401
+ line-height: 1.2;
402
+ background: #333;
403
+ border-radius: 2px;
404
+ padding: 9px 18px 10px 18px;
405
+ display: inline-block;
406
+ color: #fff;
407
+ margin-top: 29px;
408
+ font-weight: 500
409
+ }
410
+
411
+ .sp-pri-lst .rec {
412
+ box-shadow: 0 1px 40px 0 #ccc;
413
+ background: #fff;
414
+ z-index: 9;
415
+ margin-top: -20px;
416
+ position: relative
417
+ }
418
+
419
+ .sp-pri-lst .rec:hover .sp-rcm {
420
+ background: #b168ff;
421
+ color: #fff
422
+ }
423
+
424
+ .sp-pri-lst .rec .pri-by {
425
+ background: #b168ff
426
+ }
427
+
428
+ .sp-rcm {
429
+ background: linear-gradient(to right, #fdfc35, #ffe258);
430
+ color: #7b6c23;
431
+ position: absolute;
432
+ top: -20px;
433
+ left: 0;
434
+ right: -1px;
435
+ bottom: auto;
436
+ padding: 2px 0;
437
+ font-size: 11px;
438
+ letter-spacing: 2px
439
+ }
440
+
441
+ .tru-us {
442
+ text-align: center;
443
+ padding: 60px 0;
444
+ margin: 0 auto;
445
+ font-size: 16px;
446
+ color: #222
447
+ }
448
+
449
+ .tru-us h2 {
450
+ margin: 20px 0 0 0;
451
+ font-size: 28px;
452
+ font-weight: 500
453
+ }
454
+
455
+ .tru-us p {
456
+ font-size: 17px;
457
+ margin: 19px 15% 18px 15%;
458
+ color: #666;
459
+ line-height: 29px
460
+ }
461
+
462
+ .tru-us a {
463
+ font-size: 18px;
464
+ color: #489bff;
465
+ text-decoration: none;
466
+ font-weight: 400
467
+ }
468
+
469
+ .ampfaq {
470
+ width: 100%;
471
+ margin: 25px 0
472
+ }
473
+
474
+ .ampfaq h4 {
475
+ margin: 0;
476
+ text-align: center;
477
+ font-size: 20px;
478
+ font-weight: 500;
479
+ color: #333
480
+ }
481
+
482
+ .faq-lst {
483
+ margin-top: 50px;
484
+ display: grid;
485
+ grid-template-columns: 1fr 1fr
486
+ }
487
+
488
+ .lt {
489
+ padding-left: 50px
490
+ }
491
+
492
+ .lt,
493
+ .rt {
494
+ width: 70%
495
+ }
496
+
497
+ .lt ul,
498
+ .rt ul {
499
+ margin: 0
500
+ }
501
+
502
+ .lt ul li,
503
+ .rt ul li {
504
+ color: #222;
505
+ margin-bottom: 30px!important
506
+ }
507
+
508
+ .lt span,
509
+ .rt span {
510
+ font-size: 17px;
511
+ font-weight: 500;
512
+ margin-bottom: 6px;
513
+ display: inline-block
514
+ }
515
+
516
+ .lt p,
517
+ .rt p {
518
+ font-size: 15px;
519
+ margin: 0
520
+ }
521
+
522
+ .f-cnt {
523
+ text-align: center;
524
+ margin-top: 20px;
525
+ color: #222
526
+ }
527
+
528
+ .f-cnt span {
529
+ font-size: 17px;
530
+ margin: 8px 0;
531
+ font-weight: 500
532
+ }
533
+
534
+ .f-cnt p {
535
+ font-size: 15px;
536
+ margin: 6px 0
537
+ }
538
+
539
+ .f-cnt a {
540
+ background: #333;
541
+ color: #fff;
542
+ padding: 15px 30px;
543
+ text-decoration: none;
544
+ font-size: 18px;
545
+ font-weight: 500;
546
+ display: inline-block;
547
+ margin-top: 15px
548
+ }
549
+
550
+ @media(max-width:1366px) {
551
+ .amp-upg {
552
+ padding: 60px 0 0 0
553
+ }
554
+ .sp-fp-cnt p {
555
+
556
+ line-height: 35px;
557
+ font-size: 18px;
558
+
559
+ }
560
+ }
561
+
562
+ @media(max-width:1280px) {
563
+ .sp-fp-cnt {
564
+ top: 1.3%
565
+ }
566
+ }
567
+
568
+ @media(max-width:768px) {
569
+ .ext {
570
+ grid-template-columns: 1fr;
571
+ grid-gap: 30px 0;
572
+ padding: 30px
573
+ }
574
+ .pvf-tlt h2 {
575
+ font-size: 26px
576
+ }
577
+ .pvf-cmp {
578
+ grid-template-columns: 1fr
579
+ }
580
+ .pr-btn a {
581
+ font-size: 22px
582
+ }
583
+ .sp-pri-lst {
584
+ grid-template-columns: 1fr 1fr 1fr
585
+ }
586
+ .sp-fp-cnt p {
587
+ line-height: 1.5;
588
+ font-size: 16px;
589
+ margin-top: 15px;
590
+ padding: 0 20px
591
+ }
592
+ .sp-fp-cnt .buy {
593
+ font-size: 16px;
594
+ padding: 8px 30px
595
+ }
596
+ .sp-fp-cnt {
597
+ top: 15px
598
+ }
599
+ .sp-fp-cnt h1 {
600
+ font-size: 30px
601
+ }
602
+ .ex-1 {
603
+ width: 100%
604
+ }
605
+ .faq-lst {
606
+ grid-template-columns: 1fr
607
+ }
608
+ .rt {
609
+ padding-left: 50px
610
+ }
611
+ }
admin/deactivate-feedback.php CHANGED
@@ -1,37 +1,38 @@
1
- <?php
2
- $reasons = array(
3
- 1 => '<li><label><input type="radio" name="superpwa_disable_reason" value="temporary"/>' . __('It is only temporary', 'superpwa-for-wp') . '</label></li>',
4
- 2 => '<li><label><input type="radio" name="superpwa_disable_reason" value="stopped"/>' . __('I stopped using superPWA on my site', 'superpwa-for-wp') . '</label></li>',
5
- 3 => '<li><label><input type="radio" name="superpwa_disable_reason" value="missing"/>' . __('I miss a feature', 'superpwa-for-wp') . '</label></li>
6
- <li><input class="mb-box missing" type="text" name="superpwa_disable_text[]" value="" placeholder="Please describe the feature"/></li>',
7
- 4 => '<li><label><input type="radio" name="superpwa_disable_reason" value="technical"/>' . __('Technical Issue', 'superpwa-for-wp') . '</label></li>
8
- <li><textarea class="mb-box technical" name="superpwa_disable_text[]" placeholder="' . __('How Can we help? Please describe your problem', 'superpwa-for-wp') . '"></textarea></li>',
9
- 5 => '<li><label><input type="radio" name="superpwa_disable_reason" value="another"/>' . __('I switched to another plugin', 'superpwa-for-wp') . '</label></li>
10
- <li><input class="mb-box another" type="text" name="superpwa_disable_text[]" value="" placeholder="Name of the plugin"/></li>',
11
- 6 => '<li><label><input type="radio" name="superpwa_disable_reason" value="other"/>' . __('Other reason', 'superpwa-for-wp') . '</label></li>
12
- <li><textarea class="mb-box other" name="superpwa_disable_text[]" placeholder="' . __('Please specify, if possible', 'superpwa-for-wp') . '"></textarea></li>',
13
- );
14
- shuffle($reasons);
15
- ?>
16
-
17
-
18
- <div id="superpwa-reloaded-feedback-overlay" style="display: none;">
19
- <div id="superpwa-reloaded-feedback-content">
20
- <form action="" method="post">
21
- <h3><strong><?php _e('If you have a moment, please let us know why you are deactivating:', 'superpwa-for-wp'); ?></strong></h3>
22
- <ul>
23
- <?php
24
- foreach ($reasons as $reason){
25
- echo $reason;
26
- }
27
- ?>
28
- </ul>
29
- <?php if ($email) : ?>
30
- <input type="hidden" name="superpwa_disable_from" value="<?php echo $email; ?>"/>
31
- <?php endif; ?>
32
- <input id="superpwa-reloaded-feedback-submit" class="button button-primary" type="submit" name="superpwa_disable_submit" value="<?php _e('Submit & Deactivate', 'superpwa-for-wp'); ?>"/>
33
- <a class="button"><?php _e('Only Deactivate', 'superpwa-for-wp'); ?></a>
34
- <a class="superpwa-for-wp-feedback-not-deactivate" href="#"><?php _e('Don\'t deactivate', 'superpwa-for-wp'); ?></a>
35
- </form>
36
- </div>
 
37
  </div>
1
+ <?php
2
+ $reasons = array(
3
+ 1 => '<li><label><input type="radio" name="superpwa_disable_reason" value="temporary"/>' . __('It is only temporary', 'superpwa-for-wp') . '</label></li>',
4
+ 2 => '<li><label><input type="radio" name="superpwa_disable_reason" value="stopped"/>' . __('I stopped using superPWA on my site', 'superpwa-for-wp') . '</label></li>',
5
+ 3 => '<li><label><input type="radio" name="superpwa_disable_reason" value="missing"/>' . __('I miss a feature', 'superpwa-for-wp') . '</label></li>
6
+ <li><input class="mb-box missing" type="text" name="superpwa_disable_text[]" value="" placeholder="Please describe the feature"/></li>',
7
+ 4 => '<li><label><input type="radio" name="superpwa_disable_reason" value="technical"/>' . __('Technical Issue', 'superpwa-for-wp') . '</label></li>
8
+ <li><textarea class="mb-box technical" name="superpwa_disable_text[]" placeholder="' . __('How Can we help? Please describe your problem', 'superpwa-for-wp') . '"></textarea></li>',
9
+ 5 => '<li><label><input type="radio" name="superpwa_disable_reason" value="another"/>' . __('I switched to another plugin', 'superpwa-for-wp') . '</label></li>
10
+ <li><input class="mb-box another" type="text" name="superpwa_disable_text[]" value="" placeholder="Name of the plugin"/></li>',
11
+ 6 => '<li><label><input type="radio" name="superpwa_disable_reason" value="other"/>' . __('Other reason', 'superpwa-for-wp') . '</label></li>
12
+ <li><textarea class="mb-box other" name="superpwa_disable_text[]" placeholder="' . __('Please specify, if possible', 'superpwa-for-wp') . '"></textarea></li>',
13
+ );
14
+ shuffle($reasons);
15
+ ?>
16
+
17
+
18
+ <div id="superpwa-reloaded-feedback-overlay" style="display: none;">
19
+ <div id="superpwa-reloaded-feedback-content">
20
+ <form action="" method="post">
21
+ <h3><strong><?php _e('If you have a moment, please let us know why you are deactivating:', 'superpwa-for-wp'); ?></strong></h3>
22
+ <ul>
23
+ <?php
24
+ foreach ($reasons as $reason){
25
+ echo $reason;
26
+ }
27
+ ?>
28
+ </ul>
29
+ <?php if ($email) : ?>
30
+ <input type="hidden" name="superpwa_disable_from" value="<?php echo $email; ?>"/>
31
+ <?php endif; ?>
32
+ <input id="superpwa-reloaded-feedback-submit" class="button button-primary" type="submit" name="superpwa_disable_submit" value="<?php _e('Submit & Deactivate', 'superpwa-for-wp'); ?>"/>
33
+ <input type="hidden" name="superpwa_deactivate_nonce" value="<?=wp_create_nonce( 'superpwa-deactivate-nonce' )?>">
34
+ <a class="button"><?php _e('Only Deactivate', 'superpwa-for-wp'); ?></a>
35
+ <a class="superpwa-for-wp-feedback-not-deactivate" href="#"><?php _e('Don\'t deactivate', 'superpwa-for-wp'); ?></a>
36
+ </form>
37
+ </div>
38
  </div>
admin/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
admin/js/jszip.min.js CHANGED
@@ -1,198 +1,198 @@
1
- /*!
2
-
3
- JSZip v3.1.5 - A JavaScript class for generating and reading zip files
4
- <http://stuartk.com/jszip>
5
-
6
- (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
7
- Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
8
-
9
- JSZip uses the library pako released under the MIT license :
10
- https://github.com/nodeca/pako/blob/master/LICENSE
11
- */
12
- !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.JSZip=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("./utils"),e=a("./support"),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a){for(var b,c,e,g,h,i,j,k=[],l=0,m=a.length,n=m,o="string"!==d.getTypeOf(a);l<a.length;)n=m-l,o?(b=a[l++],c=l<m?a[l++]:0,e=l<m?a[l++]:0):(b=a.charCodeAt(l++),c=l<m?a.charCodeAt(l++):0,e=l<m?a.charCodeAt(l++):0),g=b>>2,h=(3&b)<<4|c>>4,i=n>1?(15&c)<<2|e>>6:64,j=n>2?63&e:64,k.push(f.charAt(g)+f.charAt(h)+f.charAt(i)+f.charAt(j));return k.join("")},c.decode=function(a){var b,c,d,g,h,i,j,k=0,l=0,m="data:";if(a.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");var n=3*a.length/4;if(a.charAt(a.length-1)===f.charAt(64)&&n--,a.charAt(a.length-2)===f.charAt(64)&&n--,n%1!==0)throw new Error("Invalid base64 input, bad content length.");var o;for(o=e.uint8array?new Uint8Array(0|n):new Array(0|n);k<a.length;)g=f.indexOf(a.charAt(k++)),h=f.indexOf(a.charAt(k++)),i=f.indexOf(a.charAt(k++)),j=f.indexOf(a.charAt(k++)),b=g<<2|h>>4,c=(15&h)<<4|i>>2,d=(3&i)<<6|j,o[l++]=b,64!==i&&(o[l++]=c),64!==j&&(o[l++]=d);return o}},{"./support":30,"./utils":32}],2:[function(a,b,c){"use strict";function d(a,b,c,d,e){this.compressedSize=a,this.uncompressedSize=b,this.crc32=c,this.compression=d,this.compressedContent=e}var e=a("./external"),f=a("./stream/DataWorker"),g=a("./stream/DataLengthProbe"),h=a("./stream/Crc32Probe"),g=a("./stream/DataLengthProbe");d.prototype={getContentWorker:function(){var a=new f(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new g("data_length")),b=this;return a.on("end",function(){if(this.streamInfo.data_length!==b.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),a},getCompressedWorker:function(){return new f(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(a,b,c){return a.pipe(new h).pipe(new g("uncompressedSize")).pipe(b.compressWorker(c)).pipe(new g("compressedSize")).withStreamInfo("compression",b)},b.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(a,b,c){"use strict";var d=a("./stream/GenericWorker");c.STORE={magic:"\0\0",compressWorker:function(a){return new d("STORE compression")},uncompressWorker:function(){return new d("STORE decompression")}},c.DEFLATE=a("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=h,f=d+c;a^=-1;for(var g=d;g<f;g++)a=a>>>8^e[255&(a^b[g])];return a^-1}function f(a,b,c,d){var e=h,f=d+c;a^=-1;for(var g=d;g<f;g++)a=a>>>8^e[255&(a^b.charCodeAt(g))];return a^-1}var g=a("./utils"),h=d();b.exports=function(a,b){if("undefined"==typeof a||!a.length)return 0;var c="string"!==g.getTypeOf(a);return c?e(0|b,a,a.length,0):f(0|b,a,a.length,0)}},{"./utils":32}],5:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!0,c.date=null,c.compression=null,c.compressionOptions=null,c.comment=null,c.unixPermissions=null,c.dosPermissions=null},{}],6:[function(a,b,c){"use strict";var d=null;d="undefined"!=typeof Promise?Promise:a("lie"),b.exports={Promise:d}},{lie:58}],7:[function(a,b,c){"use strict";function d(a,b){h.call(this,"FlateWorker/"+a),this._pako=null,this._pakoAction=a,this._pakoOptions=b,this.meta={}}var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,f=a("pako"),g=a("./utils"),h=a("./stream/GenericWorker"),i=e?"uint8array":"array";c.magic="\b\0",g.inherits(d,h),d.prototype.processChunk=function(a){this.meta=a.meta,null===this._pako&&this._createPako(),this._pako.push(g.transformTo(i,a.data),!1)},d.prototype.flush=function(){h.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new f[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var a=this;this._pako.onData=function(b){a.push({data:b,meta:a.meta})}},c.compressWorker=function(a){return new d("Deflate",a)},c.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:59}],8:[function(a,b,c){"use strict";function d(a,b,c,d){f.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=c,this.encodeFileName=d,this.streamFiles=a,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}var e=a("../utils"),f=a("../stream/GenericWorker"),g=a("../utf8"),h=a("../crc32"),i=a("../signature"),j=function(a,b){var c,d="";for(c=0;c<b;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},k=function(a,b){var c=a;return a||(c=b?16893:33204),(65535&c)<<16},l=function(a,b){return 63&(a||0)},m=function(a,b,c,d,f,m){var n,o,p=a.file,q=a.compression,r=m!==g.utf8encode,s=e.transformTo("string",m(p.name)),t=e.transformTo("string",g.utf8encode(p.name)),u=p.comment,v=e.transformTo("string",m(u)),w=e.transformTo("string",g.utf8encode(u)),x=t.length!==p.name.length,y=w.length!==u.length,z="",A="",B="",C=p.dir,D=p.date,E={crc32:0,compressedSize:0,uncompressedSize:0};b&&!c||(E.crc32=a.crc32,E.compressedSize=a.compressedSize,E.uncompressedSize=a.uncompressedSize);var F=0;b&&(F|=8),r||!x&&!y||(F|=2048);var G=0,H=0;C&&(G|=16),"UNIX"===f?(H=798,G|=k(p.unixPermissions,C)):(H=20,G|=l(p.dosPermissions,C)),n=D.getUTCHours(),n<<=6,n|=D.getUTCMinutes(),n<<=5,n|=D.getUTCSeconds()/2,o=D.getUTCFullYear()-1980,o<<=4,o|=D.getUTCMonth()+1,o<<=5,o|=D.getUTCDate(),x&&(A=j(1,1)+j(h(s),4)+t,z+="up"+j(A.length,2)+A),y&&(B=j(1,1)+j(h(v),4)+w,z+="uc"+j(B.length,2)+B);var I="";I+="\n\0",I+=j(F,2),I+=q.magic,I+=j(n,2),I+=j(o,2),I+=j(E.crc32,4),I+=j(E.compressedSize,4),I+=j(E.uncompressedSize,4),I+=j(s.length,2),I+=j(z.length,2);var J=i.LOCAL_FILE_HEADER+I+s+z,K=i.CENTRAL_FILE_HEADER+j(H,2)+I+j(v.length,2)+"\0\0\0\0"+j(G,4)+j(d,4)+s+z+v;return{fileRecord:J,dirRecord:K}},n=function(a,b,c,d,f){var g="",h=e.transformTo("string",f(d));return g=i.CENTRAL_DIRECTORY_END+"\0\0\0\0"+j(a,2)+j(a,2)+j(b,4)+j(c,4)+j(h.length,2)+h},o=function(a){var b="";return b=i.DATA_DESCRIPTOR+j(a.crc32,4)+j(a.compressedSize,4)+j(a.uncompressedSize,4)};e.inherits(d,f),d.prototype.push=function(a){var b=a.meta.percent||0,c=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(a):(this.bytesWritten+=a.data.length,f.prototype.push.call(this,{data:a.data,meta:{currentFile:this.currentFile,percent:c?(b+100*(c-d-1))/c:100}}))},d.prototype.openedSource=function(a){this.currentSourceOffset=this.bytesWritten,this.currentFile=a.file.name;var b=this.streamFiles&&!a.file.dir;if(b){var c=m(a,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:c.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(a){this.accumulate=!1;var b=this.streamFiles&&!a.file.dir,c=m(a,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(c.dirRecord),b)this.push({data:o(a),meta:{percent:100}});else for(this.push({data:c.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var a=this.bytesWritten,b=0;b<this.dirRecords.length;b++)this.push({data:this.dirRecords[b],meta:{percent:100}});var c=this.bytesWritten-a,d=n(this.dirRecords.length,c,a,this.zipComment,this.encodeFileName);this.push({data:d,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(a){this._sources.push(a);var b=this;return a.on("data",function(a){b.processChunk(a)}),a.on("end",function(){b.closedSource(b.previous.streamInfo),b._sources.length?b.prepareNextSource():b.end()}),a.on("error",function(a){b.error(a)}),this},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(a){var b=this._sources;if(!f.prototype.error.call(this,a))return!1;for(var c=0;c<b.length;c++)try{b[c].error(a)}catch(a){}return!0},d.prototype.lock=function(){f.prototype.lock.call(this);for(var a=this._sources,b=0;b<a.length;b++)a[b].lock()},b.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(a,b,c){"use strict";var d=a("../compressions"),e=a("./ZipFileWorker"),f=function(a,b){var c=a||b,e=d[c];if(!e)throw new Error(c+" is not a valid compression method !");return e};c.generateWorker=function(a,b,c){var d=new e(b.streamFiles,c,b.platform,b.encodeFileName),g=0;try{a.forEach(function(a,c){g++;var e=f(c.options.compression,b.compression),h=c.options.compressionOptions||b.compressionOptions||{},i=c.dir,j=c.date;c._compressWorker(e,h).withStreamInfo("file",{name:a,dir:i,date:j,comment:c.comment||"",unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions}).pipe(d)}),d.entriesCount=g}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(a,b,c){"use strict";function d(){if(!(this instanceof d))return new d;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var a=new d;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a}}d.prototype=a("./object"),d.prototype.loadAsync=a("./load"),d.support=a("./support"),d.defaults=a("./defaults"),d.version="3.1.5",d.loadAsync=function(a,b){return(new d).loadAsync(a,b)},d.external=a("./external"),b.exports=d},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(a,b,c){"use strict";function d(a){return new f.Promise(function(b,c){var d=a.decompressed.getContentWorker().pipe(new i);d.on("error",function(a){c(a)}).on("end",function(){d.streamInfo.crc32!==a.decompressed.crc32?c(new Error("Corrupted zip : CRC32 mismatch")):b()}).resume()})}var e=a("./utils"),f=a("./external"),g=a("./utf8"),e=a("./utils"),h=a("./zipEntries"),i=a("./stream/Crc32Probe"),j=a("./nodejsUtils");b.exports=function(a,b){var c=this;return b=e.extend(b||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:g.utf8decode}),j.isNode&&j.isStream(a)?f.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):e.prepareContent("the loaded zip file",a,!0,b.optimizedBinaryString,b.base64).then(function(a){var c=new h(b);return c.load(a),c}).then(function(a){var c=[f.Promise.resolve(a)],e=a.files;if(b.checkCRC32)for(var g=0;g<e.length;g++)c.push(d(e[g]));return f.Promise.all(c)}).then(function(a){for(var d=a.shift(),e=d.files,f=0;f<e.length;f++){var g=e[f];c.file(g.fileNameStr,g.decompressed,{binary:!0,optimizedBinaryString:!0,date:g.date,dir:g.dir,comment:g.fileCommentStr.length?g.fileCommentStr:null,unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions,createFolders:b.createFolders})}return d.zipComment.length&&(c.comment=d.zipComment),c})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(a,b,c){"use strict";function d(a,b){f.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(b)}var e=a("../utils"),f=a("../stream/GenericWorker");e.inherits(d,f),d.prototype._bindStream=function(a){var b=this;this._stream=a,a.pause(),a.on("data",function(a){b.push({data:a,meta:{percent:0}})}).on("error",function(a){b.isPaused?this.generatedError=a:b.error(a)}).on("end",function(){b.isPaused?b._upstreamEnded=!0:b.end()})},d.prototype.pause=function(){return!!f.prototype.pause.call(this)&&(this._stream.pause(),!0)},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},b.exports=d},{"../stream/GenericWorker":28,"../utils":32}],13:[function(a,b,c){"use strict";function d(a,b,c){e.call(this,b),this._helper=a;var d=this;a.on("data",function(a,b){d.push(a)||d._helper.pause(),c&&c(b)}).on("error",function(a){d.emit("error",a)}).on("end",function(){d.push(null)})}var e=a("readable-stream").Readable,f=a("../utils");f.inherits(d,e),d.prototype._read=function(){this._helper.resume()},b.exports=d},{"../utils":32,"readable-stream":16}],14:[function(a,b,c){"use strict";b.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(a,b){return new Buffer(a,b)},allocBuffer:function(a){return Buffer.alloc?Buffer.alloc(a):new Buffer(a)},isBuffer:function(a){return Buffer.isBuffer(a)},isStream:function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pause&&"function"==typeof a.resume}}},{}],15:[function(a,b,c){"use strict";function d(a){return"[object RegExp]"===Object.prototype.toString.call(a)}var e=a("./utf8"),f=a("./utils"),g=a("./stream/GenericWorker"),h=a("./stream/StreamHelper"),i=a("./defaults"),j=a("./compressedObject"),k=a("./zipObject"),l=a("./generate"),m=a("./nodejsUtils"),n=a("./nodejs/NodejsStreamInputAdapter"),o=function(a,b,c){var d,e=f.getTypeOf(b),h=f.extend(c||{},i);h.date=h.date||new Date,null!==h.compression&&(h.compression=h.compression.toUpperCase()),"string"==typeof h.unixPermissions&&(h.unixPermissions=parseInt(h.unixPermissions,8)),h.unixPermissions&&16384&h.unixPermissions&&(h.dir=!0),h.dosPermissions&&16&h.dosPermissions&&(h.dir=!0),h.dir&&(a=q(a)),h.createFolders&&(d=p(a))&&r.call(this,d,!0);var l="string"===e&&h.binary===!1&&h.base64===!1;c&&"undefined"!=typeof c.binary||(h.binary=!l);var o=b instanceof j&&0===b.uncompressedSize;(o||h.dir||!b||0===b.length)&&(h.base64=!1,h.binary=!0,b="",h.compression="STORE",e="string");var s=null;s=b instanceof j||b instanceof g?b:m.isNode&&m.isStream(b)?new n(a,b):f.prepareContent(a,b,h.binary,h.optimizedBinaryString,h.base64);var t=new k(a,s,h);this.files[a]=t},p=function(a){"/"===a.slice(-1)&&(a=a.substring(0,a.length-1));var b=a.lastIndexOf("/");return b>0?a.substring(0,b):""},q=function(a){return"/"!==a.slice(-1)&&(a+="/"),a},r=function(a,b){return b="undefined"!=typeof b?b:i.createFolders,a=q(a),this.files[a]||o.call(this,a,null,{dir:!0,createFolders:b}),this.files[a]},s={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(a){var b,c,d;for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],c=b.slice(this.root.length,b.length),c&&b.slice(0,this.root.length)===this.root&&a(c,d))},filter:function(a){var b=[];return this.forEach(function(c,d){a(c,d)&&b.push(d)}),b},file:function(a,b,c){if(1===arguments.length){if(d(a)){var e=a;return this.filter(function(a,b){return!b.dir&&e.test(a)})}var f=this.files[this.root+a];return f&&!f.dir?f:null}return a=this.root+a,o.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(d(a))return this.filter(function(b,c){return c.dir&&a.test(b)});var b=this.root+a,c=r.call(this,b),e=this.clone();return e.root=c.name,e},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!==a.slice(-1)&&(a+="/"),b=this.files[a]),b&&!b.dir)delete this.files[a];else for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;d<c.length;d++)delete this.files[c[d].name];return this},generate:function(a){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(a){var b,c={};try{if(c=f.extend(a||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:e.utf8encode}),c.type=c.type.toLowerCase(),c.compression=c.compression.toUpperCase(),"binarystring"===c.type&&(c.type="string"),!c.type)throw new Error("No output type specified.");f.checkSupport(c.type),"darwin"!==c.platform&&"freebsd"!==c.platform&&"linux"!==c.platform&&"sunos"!==c.platform||(c.platform="UNIX"),"win32"===c.platform&&(c.platform="DOS");var d=c.comment||this.comment||"";b=l.generateWorker(this,c,d)}catch(i){b=new g("error"),b.error(i)}return new h(b,c.type||"string",c.mimeType)},generateAsync:function(a,b){return this.generateInternalStream(a).accumulate(b)},generateNodeStream:function(a,b){return a=a||{},a.type||(a.type="nodebuffer"),this.generateInternalStream(a).toNodejsStream(b)}};b.exports=s},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(a,b,c){b.exports=a("stream")},{stream:void 0}],17:[function(a,b,c){"use strict";function d(a){e.call(this,a);for(var b=0;b<this.data.length;b++)a[b]=255&a[b]}var e=a("./DataReader"),f=a("../utils");f.inherits(d,e),d.prototype.byteAt=function(a){return this.data[this.zero+a]},d.prototype.lastIndexOfSignature=function(a){for(var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f-this.zero;return-1},d.prototype.readAndCheckSignature=function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.readData(4);return b===f[0]&&c===f[1]&&d===f[2]&&e===f[3]},d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return[];var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./DataReader":18}],18:[function(a,b,c){"use strict";function d(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}var e=a("../utils");d.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(a){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return e.transformTo("string",this.readData(a))},readData:function(a){},lastIndexOfSignature:function(a){},readAndCheckSignature:function(a){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},b.exports=d},{"../utils":32}],19:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./Uint8ArrayReader"),f=a("../utils");f.inherits(d,e),d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./DataReader"),f=a("../utils");f.inherits(d,e),d.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},d.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},d.prototype.readAndCheckSignature=function(a){var b=this.readData(4);return a===b},d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./DataReader":18}],21:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./ArrayReader"),f=a("../utils");f.inherits(d,e),d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./ArrayReader":17}],22:[function(a,b,c){"use strict";var d=a("../utils"),e=a("../support"),f=a("./ArrayReader"),g=a("./StringReader"),h=a("./NodeBufferReader"),i=a("./Uint8ArrayReader");b.exports=function(a){var b=d.getTypeOf(a);return d.checkSupport(b),"string"!==b||e.uint8array?"nodebuffer"===b?new h(a):e.uint8array?new i(d.transformTo("uint8array",a)):new f(d.transformTo("array",a)):new g(a)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(a,b,c){"use strict";c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\b"},{}],24:[function(a,b,c){"use strict";function d(a){e.call(this,"ConvertWorker to "+a),this.destType=a}var e=a("./GenericWorker"),f=a("../utils");f.inherits(d,e),d.prototype.processChunk=function(a){this.push({data:f.transformTo(this.destType,a.data),meta:a.meta})},b.exports=d},{"../utils":32,"./GenericWorker":28}],25:[function(a,b,c){"use strict";function d(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}var e=a("./GenericWorker"),f=a("../crc32"),g=a("../utils");g.inherits(d,e),d.prototype.processChunk=function(a){this.streamInfo.crc32=f(a.data,this.streamInfo.crc32||0),this.push(a)},b.exports=d},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(a,b,c){"use strict";function d(a){f.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}var e=a("../utils"),f=a("./GenericWorker");e.inherits(d,f),d.prototype.processChunk=function(a){if(a){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+a.data.length}f.prototype.processChunk.call(this,a)},b.exports=d},{"../utils":32,"./GenericWorker":28}],27:[function(a,b,c){"use strict";function d(a){f.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(a){b.dataIsReady=!0,b.data=a,b.max=a&&a.length||0,b.type=e.getTypeOf(a),b.isPaused||b._tickAndRepeat()},function(a){b.error(a)})}var e=a("../utils"),f=a("./GenericWorker"),g=16384;e.inherits(d,f),d.prototype.cleanUp=function(){f.prototype.cleanUp.call(this),this.data=null},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0)},d.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},d.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=g,b=null,c=Math.min(this.max,this.index+a);if(this.index>=this.max)return this.end();switch(this.type){case"string":b=this.data.substring(this.index,c);break;case"uint8array":b=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":b=this.data.slice(this.index,c)}return this.index=c,this.push({data:b,meta:{percent:this.max?this.index/this.max*100:0}})},b.exports=d},{"../utils":32,"./GenericWorker":28}],28:[function(a,b,c){"use strict";function d(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}d.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,b){return this._listeners[a].push(b),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,b){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,b)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var b=this;return a.on("data",function(a){b.processChunk(a)}),a.on("end",function(){b.end()}),a.on("error",function(a){b.error(a)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var a=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,b){return this.extraStreamInfo[a]=b,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},b.exports=d},{}],29:[function(a,b,c){"use strict";function d(a,b,c){switch(a){case"blob":return h.newBlob(h.transformTo("arraybuffer",b),c);case"base64":return k.encode(b);default:return h.transformTo(a,b)}}function e(a,b){var c,d=0,e=null,f=0;for(c=0;c<b.length;c++)f+=b[c].length;switch(a){case"string":return b.join("");case"array":return Array.prototype.concat.apply([],b);case"uint8array":for(e=new Uint8Array(f),c=0;c<b.length;c++)e.set(b[c],d),d+=b[c].length;return e;case"nodebuffer":return Buffer.concat(b);default:throw new Error("concat : unsupported type '"+a+"'")}}function f(a,b){return new m.Promise(function(c,f){var g=[],h=a._internalType,i=a._outputType,j=a._mimeType;a.on("data",function(a,c){g.push(a),b&&b(c)}).on("error",function(a){g=[],f(a)}).on("end",function(){try{var a=d(i,e(h,g),j);c(a)}catch(b){f(b)}g=[]}).resume()})}function g(a,b,c){var d=b;switch(b){case"blob":case"arraybuffer":d="uint8array";break;case"base64":d="string"}try{this._internalType=d,this._outputType=b,this._mimeType=c,h.checkSupport(d),this._worker=a.pipe(new i(d)),a.lock()}catch(e){this._worker=new j("error"),this._worker.error(e)}}var h=a("../utils"),i=a("./ConvertWorker"),j=a("./GenericWorker"),k=a("../base64"),l=a("../support"),m=a("../external"),n=null;if(l.nodestream)try{n=a("../nodejs/NodejsStreamOutputAdapter")}catch(o){}g.prototype={accumulate:function(a){return f(this,a)},on:function(a,b){var c=this;return"data"===a?this._worker.on(a,function(a){b.call(c,a.data,a.meta)}):this._worker.on(a,function(){h.delay(b,arguments,c)}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(a){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new n(this,{objectMode:"nodebuffer"!==this._outputType},a)}},b.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(a,b,c){"use strict";if(c.base64=!0,c.array=!0,c.string=!0,c.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c.nodebuffer="undefined"!=typeof Buffer,c.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)c.blob=!1;else{var d=new ArrayBuffer(0);try{c.blob=0===new Blob([d],{type:"application/zip"}).size}catch(e){try{var f=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,g=new f;g.append(d),c.blob=0===g.getBlob("application/zip").size}catch(e){c.blob=!1}}}try{c.nodestream=!!a("readable-stream").Readable}catch(e){c.nodestream=!1}},{"readable-stream":16}],31:[function(a,b,c){"use strict";function d(){i.call(this,"utf-8 decode"),this.leftOver=null}function e(){i.call(this,"utf-8 encode")}for(var f=a("./utils"),g=a("./support"),h=a("./nodejsUtils"),i=a("./stream/GenericWorker"),j=new Array(256),k=0;k<256;k++)j[k]=k>=252?6:k>=248?5:k>=240?4:k>=224?3:k>=192?2:1;j[254]=j[254]=1;var l=function(a){var b,c,d,e,f,h=a.length,i=0;for(e=0;e<h;e++)c=a.charCodeAt(e),55296===(64512&c)&&e+1<h&&(d=a.charCodeAt(e+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),e++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=g.uint8array?new Uint8Array(i):new Array(i),f=0,e=0;f<i;e++)c=a.charCodeAt(e),55296===(64512&c)&&e+1<h&&(d=a.charCodeAt(e+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),e++)),c<128?b[f++]=c:c<2048?(b[f++]=192|c>>>6,b[f++]=128|63&c):c<65536?(b[f++]=224|c>>>12,b[f++]=128|c>>>6&63,b[f++]=128|63&c):(b[f++]=240|c>>>18,b[f++]=128|c>>>12&63,b[f++]=128|c>>>6&63,b[f++]=128|63&c);return b},m=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+j[a[c]]>b?c:b},n=function(a){var b,c,d,e,g=a.length,h=new Array(2*g);for(c=0,b=0;b<g;)if(d=a[b++],d<128)h[c++]=d;else if(e=j[d],e>4)h[c++]=65533,b+=e-1;else{for(d&=2===e?31:3===e?15:7;e>1&&b<g;)d=d<<6|63&a[b++],e--;e>1?h[c++]=65533:d<65536?h[c++]=d:(d-=65536,h[c++]=55296|d>>10&1023,h[c++]=56320|1023&d)}return h.length!==c&&(h.subarray?h=h.subarray(0,c):h.length=c),f.applyFromCharCode(h)};c.utf8encode=function(a){return g.nodebuffer?h.newBufferFrom(a,"utf-8"):l(a)},c.utf8decode=function(a){return g.nodebuffer?f.transformTo("nodebuffer",a).toString("utf-8"):(a=f.transformTo(g.uint8array?"uint8array":"array",a),n(a))},f.inherits(d,i),d.prototype.processChunk=function(a){var b=f.transformTo(g.uint8array?"uint8array":"array",a.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var d=b;b=new Uint8Array(d.length+this.leftOver.length),b.set(this.leftOver,0),b.set(d,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var e=m(b),h=b;e!==b.length&&(g.uint8array?(h=b.subarray(0,e),this.leftOver=b.subarray(e,b.length)):(h=b.slice(0,e),this.leftOver=b.slice(e,b.length))),this.push({data:c.utf8decode(h),meta:a.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:c.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},c.Utf8DecodeWorker=d,f.inherits(e,i),e.prototype.processChunk=function(a){this.push({data:c.utf8encode(a.data),meta:a.meta})},c.Utf8EncodeWorker=e},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(a,b,c){"use strict";function d(a){var b=null;return b=i.uint8array?new Uint8Array(a.length):new Array(a.length),f(a,b)}function e(a){return a}function f(a,b){for(var c=0;c<a.length;++c)b[c]=255&a.charCodeAt(c);return b}function g(a){var b=65536,d=c.getTypeOf(a),e=!0;if("uint8array"===d?e=n.applyCanBeUsed.uint8array:"nodebuffer"===d&&(e=n.applyCanBeUsed.nodebuffer),e)for(;b>1;)try{return n.stringifyByChunk(a,d,b)}catch(f){b=Math.floor(b/2)}return n.stringifyByChar(a)}function h(a,b){for(var c=0;c<a.length;c++)b[c]=a[c];
13
- return b}var i=a("./support"),j=a("./base64"),k=a("./nodejsUtils"),l=a("core-js/library/fn/set-immediate"),m=a("./external");c.newBlob=function(a,b){c.checkSupport("blob");try{return new Blob([a],{type:b})}catch(d){try{var e=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,f=new e;return f.append(a),f.getBlob(b)}catch(d){throw new Error("Bug : can't construct the Blob.")}}};var n={stringifyByChunk:function(a,b,c){var d=[],e=0,f=a.length;if(f<=c)return String.fromCharCode.apply(null,a);for(;e<f;)"array"===b||"nodebuffer"===b?d.push(String.fromCharCode.apply(null,a.slice(e,Math.min(e+c,f)))):d.push(String.fromCharCode.apply(null,a.subarray(e,Math.min(e+c,f)))),e+=c;return d.join("")},stringifyByChar:function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(a){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,k.allocBuffer(1)).length}catch(a){return!1}}()}};c.applyFromCharCode=g;var o={};o.string={string:e,array:function(a){return f(a,new Array(a.length))},arraybuffer:function(a){return o.string.uint8array(a).buffer},uint8array:function(a){return f(a,new Uint8Array(a.length))},nodebuffer:function(a){return f(a,k.allocBuffer(a.length))}},o.array={string:g,array:e,arraybuffer:function(a){return new Uint8Array(a).buffer},uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return k.newBufferFrom(a)}},o.arraybuffer={string:function(a){return g(new Uint8Array(a))},array:function(a){return h(new Uint8Array(a),new Array(a.byteLength))},arraybuffer:e,uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return k.newBufferFrom(new Uint8Array(a))}},o.uint8array={string:g,array:function(a){return h(a,new Array(a.length))},arraybuffer:function(a){return a.buffer},uint8array:e,nodebuffer:function(a){return k.newBufferFrom(a)}},o.nodebuffer={string:g,array:function(a){return h(a,new Array(a.length))},arraybuffer:function(a){return o.nodebuffer.uint8array(a).buffer},uint8array:function(a){return h(a,new Uint8Array(a.length))},nodebuffer:e},c.transformTo=function(a,b){if(b||(b=""),!a)return b;c.checkSupport(a);var d=c.getTypeOf(b),e=o[d][a](b);return e},c.getTypeOf=function(a){return"string"==typeof a?"string":"[object Array]"===Object.prototype.toString.call(a)?"array":i.nodebuffer&&k.isBuffer(a)?"nodebuffer":i.uint8array&&a instanceof Uint8Array?"uint8array":i.arraybuffer&&a instanceof ArrayBuffer?"arraybuffer":void 0},c.checkSupport=function(a){var b=i[a.toLowerCase()];if(!b)throw new Error(a+" is not supported by this platform")},c.MAX_VALUE_16BITS=65535,c.MAX_VALUE_32BITS=-1,c.pretty=function(a){var b,c,d="";for(c=0;c<(a||"").length;c++)b=a.charCodeAt(c),d+="\\x"+(b<16?"0":"")+b.toString(16).toUpperCase();return d},c.delay=function(a,b,c){l(function(){a.apply(c||null,b||[])})},c.inherits=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c},c.extend=function(){var a,b,c={};for(a=0;a<arguments.length;a++)for(b in arguments[a])arguments[a].hasOwnProperty(b)&&"undefined"==typeof c[b]&&(c[b]=arguments[a][b]);return c},c.prepareContent=function(a,b,e,f,g){var h=m.Promise.resolve(b).then(function(a){var b=i.blob&&(a instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(a))!==-1);return b&&"undefined"!=typeof FileReader?new m.Promise(function(b,c){var d=new FileReader;d.onload=function(a){b(a.target.result)},d.onerror=function(a){c(a.target.error)},d.readAsArrayBuffer(a)}):a});return h.then(function(b){var h=c.getTypeOf(b);return h?("arraybuffer"===h?b=c.transformTo("uint8array",b):"string"===h&&(g?b=j.decode(b):e&&f!==!0&&(b=d(b))),b):m.Promise.reject(new Error("Can't read the data of '"+a+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"core-js/library/fn/set-immediate":36}],33:[function(a,b,c){"use strict";function d(a){this.files=[],this.loadOptions=a}var e=a("./reader/readerFor"),f=a("./utils"),g=a("./signature"),h=a("./zipEntry"),i=(a("./utf8"),a("./support"));d.prototype={checkSignature:function(a){if(!this.reader.readAndCheckSignature(a)){this.reader.index-=4;var b=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+f.pretty(b)+", expected "+f.pretty(a)+")")}},isSignature:function(a,b){var c=this.reader.index;this.reader.setIndex(a);var d=this.reader.readString(4),e=d===b;return this.reader.setIndex(c),e},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var a=this.reader.readData(this.zipCommentLength),b=i.uint8array?"uint8array":"array",c=f.transformTo(b,a);this.zipComment=this.loadOptions.decodeFileName(c)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;e<d;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readData(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a<this.files.length;a++)b=this.files[a],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(g.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var a;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(g.CENTRAL_FILE_HEADER);)a=new h({zip64:this.zip64},this.loadOptions),a.readCentralPart(this.reader),this.files.push(a);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var a=this.reader.lastIndexOfSignature(g.CENTRAL_DIRECTORY_END);if(a<0){var b=!this.isSignature(0,g.LOCAL_FILE_HEADER);throw b?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(a);var c=a;if(this.checkSignature(g.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f.MAX_VALUE_16BITS||this.centralDirRecords===f.MAX_VALUE_16BITS||this.centralDirSize===f.MAX_VALUE_32BITS||this.centralDirOffset===f.MAX_VALUE_32BITS){if(this.zip64=!0,a=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),a<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(a),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,g.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var e=c-d;if(e>0)this.isSignature(c,g.CENTRAL_FILE_HEADER)||(this.reader.zero=e);else if(e<0)throw new Error("Corrupted zip: missing "+Math.abs(e)+" bytes.")},prepareReader:function(a){this.reader=e(a)},load:function(a){this.prepareReader(a),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},b.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(a,b,c){"use strict";function d(a,b){this.options=a,this.loadOptions=b}var e=a("./reader/readerFor"),f=a("./utils"),g=a("./compressedObject"),h=a("./crc32"),i=a("./utf8"),j=a("./compressions"),k=a("./support"),l=0,m=3,n=function(a){for(var b in j)if(j.hasOwnProperty(b)&&j[b].magic===a)return j[b];return null};d.prototype={isEncrypted:function(){return 1===(1&this.bitFlag)},useUTF8:function(){return 2048===(2048&this.bitFlag)},readLocalPart:function(a){var b,c;if(a.skip(22),this.fileNameLength=a.readInt(2),c=a.readInt(2),this.fileName=a.readData(this.fileNameLength),a.skip(c),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(b=n(this.compressionMethod),null===b)throw new Error("Corrupted zip : compression "+f.pretty(this.compressionMethod)+" unknown (inner file : "+f.transformTo("string",this.fileName)+")");this.decompressed=new g(this.compressedSize,this.uncompressedSize,this.crc32,b,a.readData(this.compressedSize))},readCentralPart:function(a){this.versionMadeBy=a.readInt(2),a.skip(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate(),this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4);var b=a.readInt(2);if(this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");a.skip(b),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var a=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),a===l&&(this.dosPermissions=63&this.externalFileAttributes),a===m&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(a){if(this.extraFields[1]){var b=e(this.extraFields[1].value);this.uncompressedSize===f.MAX_VALUE_32BITS&&(this.uncompressedSize=b.readInt(8)),this.compressedSize===f.MAX_VALUE_32BITS&&(this.compressedSize=b.readInt(8)),this.localHeaderOffset===f.MAX_VALUE_32BITS&&(this.localHeaderOffset=b.readInt(8)),this.diskNumberStart===f.MAX_VALUE_32BITS&&(this.diskNumberStart=b.readInt(4))}},readExtraFields:function(a){var b,c,d,e=a.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});a.index<e;)b=a.readInt(2),c=a.readInt(2),d=a.readData(c),this.extraFields[b]={id:b,length:c,value:d}},handleUTF8:function(){var a=k.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=i.utf8decode(this.fileName),this.fileCommentStr=i.utf8decode(this.fileComment);else{var b=this.findExtraFieldUnicodePath();if(null!==b)this.fileNameStr=b;else{var c=f.transformTo(a,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(c)}var d=this.findExtraFieldUnicodeComment();if(null!==d)this.fileCommentStr=d;else{var e=f.transformTo(a,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(e)}}},findExtraFieldUnicodePath:function(){var a=this.extraFields[28789];if(a){var b=e(a.value);return 1!==b.readInt(1)?null:h(this.fileName)!==b.readInt(4)?null:i.utf8decode(b.readData(a.length-5))}return null},findExtraFieldUnicodeComment:function(){var a=this.extraFields[25461];if(a){var b=e(a.value);return 1!==b.readInt(1)?null:h(this.fileComment)!==b.readInt(4)?null:i.utf8decode(b.readData(a.length-5))}return null}},b.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(a,b,c){"use strict";var d=a("./stream/StreamHelper"),e=a("./stream/DataWorker"),f=a("./utf8"),g=a("./compressedObject"),h=a("./stream/GenericWorker"),i=function(a,b,c){this.name=a,this.dir=c.dir,this.date=c.date,this.comment=c.comment,this.unixPermissions=c.unixPermissions,this.dosPermissions=c.dosPermissions,this._data=b,this._dataBinary=c.binary,this.options={compression:c.compression,compressionOptions:c.compressionOptions}};i.prototype={internalStream:function(a){var b=null,c="string";try{if(!a)throw new Error("No output type specified.");c=a.toLowerCase();var e="string"===c||"text"===c;"binarystring"!==c&&"text"!==c||(c="string"),b=this._decompressWorker();var g=!this._dataBinary;g&&!e&&(b=b.pipe(new f.Utf8EncodeWorker)),!g&&e&&(b=b.pipe(new f.Utf8DecodeWorker))}catch(i){b=new h("error"),b.error(i)}return new d(b,c,"")},async:function(a,b){return this.internalStream(a).accumulate(b)},nodeStream:function(a,b){return this.internalStream(a||"nodebuffer").toNodejsStream(b)},_compressWorker:function(a,b){if(this._data instanceof g&&this._data.compression.magic===a.magic)return this._data.getCompressedWorker();var c=this._decompressWorker();return this._dataBinary||(c=c.pipe(new f.Utf8EncodeWorker)),g.createWorkerFrom(c,a,b)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof h?this._data:new e(this._data)}};for(var j=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],k=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},l=0;l<j.length;l++)i.prototype[j[l]]=k;b.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(a,b,c){a("../modules/web.immediate"),b.exports=a("../modules/_core").setImmediate},{"../modules/_core":40,"../modules/web.immediate":56}],37:[function(a,b,c){b.exports=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function!");return a}},{}],38:[function(a,b,c){var d=a("./_is-object");b.exports=function(a){if(!d(a))throw TypeError(a+" is not an object!");return a}},{"./_is-object":51}],39:[function(a,b,c){var d={}.toString;b.exports=function(a){return d.call(a).slice(8,-1)}},{}],40:[function(a,b,c){var d=b.exports={version:"2.3.0"};"number"==typeof __e&&(__e=d)},{}],41:[function(a,b,c){var d=a("./_a-function");b.exports=function(a,b,c){if(d(a),void 0===b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}}},{"./_a-function":37}],42:[function(a,b,c){b.exports=!a("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":45}],43:[function(a,b,c){var d=a("./_is-object"),e=a("./_global").document,f=d(e)&&d(e.createElement);b.exports=function(a){return f?e.createElement(a):{}}},{"./_global":46,"./_is-object":51}],44:[function(a,b,c){var d=a("./_global"),e=a("./_core"),f=a("./_ctx"),g=a("./_hide"),h="prototype",i=function(a,b,c){var j,k,l,m=a&i.F,n=a&i.G,o=a&i.S,p=a&i.P,q=a&i.B,r=a&i.W,s=n?e:e[b]||(e[b]={}),t=s[h],u=n?d:o?d[b]:(d[b]||{})[h];n&&(c=b);for(j in c)k=!m&&u&&void 0!==u[j],k&&j in s||(l=k?u[j]:c[j],s[j]=n&&"function"!=typeof u[j]?c[j]:q&&k?f(l,d):r&&u[j]==l?function(a){var b=function(b,c,d){if(this instanceof a){switch(arguments.length){case 0:return new a;case 1:return new a(b);case 2:return new a(b,c)}return new a(b,c,d)}return a.apply(this,arguments)};return b[h]=a[h],b}(l):p&&"function"==typeof l?f(Function.call,l):l,p&&((s.virtual||(s.virtual={}))[j]=l,a&i.R&&t&&!t[j]&&g(t,j,l)))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,i.U=64,i.R=128,b.exports=i},{"./_core":40,"./_ctx":41,"./_global":46,"./_hide":47}],45:[function(a,b,c){b.exports=function(a){try{return!!a()}catch(b){return!0}}},{}],46:[function(a,b,c){var d=b.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=d)},{}],47:[function(a,b,c){var d=a("./_object-dp"),e=a("./_property-desc");b.exports=a("./_descriptors")?function(a,b,c){return d.f(a,b,e(1,c))}:function(a,b,c){return a[b]=c,a}},{"./_descriptors":42,"./_object-dp":52,"./_property-desc":53}],48:[function(a,b,c){b.exports=a("./_global").document&&document.documentElement},{"./_global":46}],49:[function(a,b,c){b.exports=!a("./_descriptors")&&!a("./_fails")(function(){return 7!=Object.defineProperty(a("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":42,"./_dom-create":43,"./_fails":45}],50:[function(a,b,c){b.exports=function(a,b,c){var d=void 0===c;switch(b.length){case 0:return d?a():a.call(c);case 1:return d?a(b[0]):a.call(c,b[0]);case 2:return d?a(b[0],b[1]):a.call(c,b[0],b[1]);case 3:return d?a(b[0],b[1],b[2]):a.call(c,b[0],b[1],b[2]);case 4:return d?a(b[0],b[1],b[2],b[3]):a.call(c,b[0],b[1],b[2],b[3])}return a.apply(c,b)}},{}],51:[function(a,b,c){b.exports=function(a){return"object"==typeof a?null!==a:"function"==typeof a}},{}],52:[function(a,b,c){var d=a("./_an-object"),e=a("./_ie8-dom-define"),f=a("./_to-primitive"),g=Object.defineProperty;c.f=a("./_descriptors")?Object.defineProperty:function(a,b,c){if(d(a),b=f(b,!0),d(c),e)try{return g(a,b,c)}catch(h){}if("get"in c||"set"in c)throw TypeError("Accessors not supported!");return"value"in c&&(a[b]=c.value),a}},{"./_an-object":38,"./_descriptors":42,"./_ie8-dom-define":49,"./_to-primitive":55}],53:[function(a,b,c){b.exports=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}}},{}],54:[function(a,b,c){var d,e,f,g=a("./_ctx"),h=a("./_invoke"),i=a("./_html"),j=a("./_dom-create"),k=a("./_global"),l=k.process,m=k.setImmediate,n=k.clearImmediate,o=k.MessageChannel,p=0,q={},r="onreadystatechange",s=function(){var a=+this;if(q.hasOwnProperty(a)){var b=q[a];delete q[a],b()}},t=function(a){s.call(a.data)};m&&n||(m=function(a){for(var b=[],c=1;arguments.length>c;)b.push(arguments[c++]);return q[++p]=function(){h("function"==typeof a?a:Function(a),b)},d(p),p},n=function(a){delete q[a]},"process"==a("./_cof")(l)?d=function(a){l.nextTick(g(s,a,1))}:o?(e=new o,f=e.port2,e.port1.onmessage=t,d=g(f.postMessage,f,1)):k.addEventListener&&"function"==typeof postMessage&&!k.importScripts?(d=function(a){k.postMessage(a+"","*")},k.addEventListener("message",t,!1)):d=r in j("script")?function(a){i.appendChild(j("script"))[r]=function(){i.removeChild(this),s.call(a)}}:function(a){setTimeout(g(s,a,1),0)}),b.exports={set:m,clear:n}},{"./_cof":39,"./_ctx":41,"./_dom-create":43,"./_global":46,"./_html":48,"./_invoke":50}],55:[function(a,b,c){var d=a("./_is-object");b.exports=function(a,b){if(!d(a))return a;var c,e;if(b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;if("function"==typeof(c=a.valueOf)&&!d(e=c.call(a)))return e;if(!b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":51}],56:[function(a,b,c){var d=a("./_export"),e=a("./_task");d(d.G+d.B,{setImmediate:e.set,clearImmediate:e.clear})},{"./_export":44,"./_task":54}],57:[function(a,b,c){(function(a){"use strict";function c(){k=!0;for(var a,b,c=l.length;c;){for(b=l,l=[],a=-1;++a<c;)b[a]();c=l.length}k=!1}function d(a){1!==l.push(a)||k||e()}var e,f=a.MutationObserver||a.WebKitMutationObserver;if(f){var g=0,h=new f(c),i=a.document.createTextNode("");h.observe(i,{characterData:!0}),e=function(){i.data=g=++g%2}}else if(a.setImmediate||"undefined"==typeof a.MessageChannel)e="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var b=a.document.createElement("script");b.onreadystatechange=function(){c(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},a.document.documentElement.appendChild(b)}:function(){setTimeout(c,0)};else{var j=new a.MessageChannel;j.port1.onmessage=c,e=function(){j.port2.postMessage(0)}}var k,l=[];b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],58:[function(a,b,c){"use strict";function d(){}function e(a){if("function"!=typeof a)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,a!==d&&i(this,a)}function f(a,b,c){this.promise=a,"function"==typeof b&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),"function"==typeof c&&(this.onRejected=c,this.callRejected=this.otherCallRejected)}function g(a,b,c){o(function(){var d;try{d=b(c)}catch(e){return p.reject(a,e)}d===a?p.reject(a,new TypeError("Cannot resolve promise with itself")):p.resolve(a,d)})}function h(a){var b=a&&a.then;if(a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof b)return function(){b.apply(a,arguments)}}function i(a,b){function c(b){f||(f=!0,p.reject(a,b))}function d(b){f||(f=!0,p.resolve(a,b))}function e(){b(d,c)}var f=!1,g=j(e);"error"===g.status&&c(g.value)}function j(a,b){var c={};try{c.value=a(b),c.status="success"}catch(d){c.status="error",c.value=d}return c}function k(a){return a instanceof this?a:p.resolve(new this(d),a)}function l(a){var b=new this(d);return p.reject(b,a)}function m(a){function b(a,b){function d(a){g[b]=a,++h!==e||f||(f=!0,p.resolve(j,g))}c.resolve(a).then(d,function(a){f||(f=!0,p.reject(j,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=new Array(e),h=0,i=-1,j=new this(d);++i<e;)b(a[i],i);return j}function n(a){function b(a){c.resolve(a).then(function(a){f||(f=!0,p.resolve(h,a))},function(a){f||(f=!0,p.reject(h,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=-1,h=new this(d);++g<e;)b(a[g]);return h}var o=a("immediate"),p={},q=["REJECTED"],r=["FULFILLED"],s=["PENDING"];b.exports=e,e.prototype["catch"]=function(a){return this.then(null,a)},e.prototype.then=function(a,b){if("function"!=typeof a&&this.state===r||"function"!=typeof b&&this.state===q)return this;var c=new this.constructor(d);if(this.state!==s){var e=this.state===r?a:b;g(c,e,this.outcome)}else this.queue.push(new f(c,a,b));return c},f.prototype.callFulfilled=function(a){p.resolve(this.promise,a)},f.prototype.otherCallFulfilled=function(a){g(this.promise,this.onFulfilled,a)},f.prototype.callRejected=function(a){p.reject(this.promise,a)},f.prototype.otherCallRejected=function(a){g(this.promise,this.onRejected,a)},p.resolve=function(a,b){var c=j(h,b);if("error"===c.status)return p.reject(a,c.value);var d=c.value;if(d)i(a,d);else{a.state=r,a.outcome=b;for(var e=-1,f=a.queue.length;++e<f;)a.queue[e].callFulfilled(b)}return a},p.reject=function(a,b){a.state=q,a.outcome=b;for(var c=-1,d=a.queue.length;++c<d;)a.queue[c].callRejected(b);return a},e.resolve=k,e.reject=l,e.all=m,e.race=n},{immediate:57}],59:[function(a,b,c){"use strict";var d=a("./lib/utils/common").assign,e=a("./lib/deflate"),f=a("./lib/inflate"),g=a("./lib/zlib/constants"),h={};d(h,e,f,g),b.exports=h},{"./lib/deflate":60,"./lib/inflate":61,"./lib/utils/common":62,"./lib/zlib/constants":65}],60:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=i.assign({level:s,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:t,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=h.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==p)throw new Error(k[c]);if(b.header&&h.deflateSetHeader(this.strm,b.header),b.dictionary){var e;if(e="string"==typeof b.dictionary?j.string2buf(b.dictionary):"[object ArrayBuffer]"===m.call(b.dictionary)?new Uint8Array(b.dictionary):b.dictionary,c=h.deflateSetDictionary(this.strm,e),c!==p)throw new Error(k[c]);this._dict_set=!0}}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg||k[c.err];return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}function g(a,b){return b=b||{},b.gzip=!0,e(a,b)}var h=a("./zlib/deflate"),i=a("./utils/common"),j=a("./utils/strings"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=Object.prototype.toString,n=0,o=4,p=0,q=1,r=2,s=-1,t=0,u=8;d.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?o:n,"string"==typeof a?e.input=j.string2buf(a):"[object ArrayBuffer]"===m.call(a)?e.input=new Uint8Array(a):e.input=a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new i.Buf8(f),e.next_out=0,e.avail_out=f),c=h.deflate(e,d),c!==q&&c!==p)return this.onEnd(c),this.ended=!0,!1;0!==e.avail_out&&(0!==e.avail_in||d!==o&&d!==r)||("string"===this.options.to?this.onData(j.buf2binstring(i.shrinkBuf(e.output,e.next_out))):this.onData(i.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==q);return d===o?(c=h.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===p):d!==r||(this.onEnd(p),e.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=d,c.deflate=e,c.deflateRaw=f,c.gzip=g},{"./utils/common":62,"./utils/strings":63,"./zlib/deflate":67,"./zlib/messages":72,"./zlib/zstream":74}],61:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg||k[c.err];return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l,m=this.strm,o=this.options.chunkSize,p=this.options.dictionary,q=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?m.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?m.input=new Uint8Array(a):m.input=a,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new h.Buf8(o),m.next_out=0,m.avail_out=o),c=g.inflate(m,j.Z_NO_FLUSH),c===j.Z_NEED_DICT&&p&&(l="string"==typeof p?i.string2buf(p):"[object ArrayBuffer]"===n.call(p)?new Uint8Array(p):p,c=g.inflateSetDictionary(this.strm,l)),c===j.Z_BUF_ERROR&&q===!0&&(c=j.Z_OK,q=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&c!==j.Z_STREAM_END&&(0!==m.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(m.output,m.next_out),f=m.next_out-e,k=i.buf2string(m.output,e),m.next_out=f,m.avail_out=o-f,f&&h.arraySet(m.output,m.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(q=!0)}while((m.avail_in>0||0===m.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d!==j.Z_SYNC_FLUSH||(this.onEnd(j.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":62,"./utils/strings":63,"./zlib/constants":65,"./zlib/gzheader":68,"./zlib/inflate":70,"./zlib/messages":72,"./zlib/zstream":74}],62:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;b<c;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;b<c;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],63:[function(a,b,c){"use strict";function d(a,b){if(b<65537&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;d<b;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;j<256;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f<h;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=new e.Buf8(i),g=0,f=0;g<i;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),c<128?b[g++]=c:c<2048?(b[g++]=192|c>>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c<d;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;c<h;)if(f=a[c++],f<128)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c<h;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":62}],64:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0;
14
- }b.exports=d},{}],65:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],66:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h<g;h++)a=a>>>8^e[255&(a^b[h])];return a^-1}var f=d();b.exports=e},{}],67:[function(a,b,c){"use strict";function d(a,b){return a.msg=I[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(E.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){F._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,E.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=G(a.adler,b,e,c):2===a.state.wrap&&(a.adler=H(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-la?a.strstart-(a.w_size-la):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ka,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&f<m);if(d=ka-(m-f),f=m-ka,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-la)){E.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ja)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ja-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ja)););}while(a.lookahead<la&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===J)return ua;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return ua;if(a.strstart-a.block_start>=a.w_size-la&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?ua:ua}function o(a,b){for(var c,d;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c)),a.match_length>=ja)if(d=F._tr_tally(a,a.strstart-a.match_start,a.match_length-ja),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ja){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function p(a,b){for(var c,d,e;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ja-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===U||a.match_length===ja&&a.strstart-a.match_start>4096)&&(a.match_length=ja-1)),a.prev_length>=ja&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ja,d=F._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ja),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ja-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return ua}else if(a.match_available){if(d=F._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return ua}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=F._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ka){if(m(a),a.lookahead<=ka&&b===J)return ua;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ja&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ka;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&e<f);a.match_length=ka-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ja?(c=F._tr_tally(a,1,a.match_length-ja),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===J)return ua;break}if(a.match_length=0,c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function s(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e}function t(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=D[a.level].max_lazy,a.good_match=D[a.level].good_length,a.nice_match=D[a.level].nice_length,a.max_chain_length=D[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ja-1,a.match_available=0,a.ins_h=0}function u(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=$,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new E.Buf16(2*ha),this.dyn_dtree=new E.Buf16(2*(2*fa+1)),this.bl_tree=new E.Buf16(2*(2*ga+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new E.Buf16(ia+1),this.heap=new E.Buf16(2*ea+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new E.Buf16(2*ea+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function v(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=Z,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?na:sa,a.adler=2===b.wrap?0:1,b.last_flush=J,F._tr_init(b),O):d(a,Q)}function w(a){var b=v(a);return b===O&&t(a.state),b}function x(a,b){return a&&a.state?2!==a.state.wrap?Q:(a.state.gzhead=b,O):Q}function y(a,b,c,e,f,g){if(!a)return Q;var h=1;if(b===T&&(b=6),e<0?(h=0,e=-e):e>15&&(h=2,e-=16),f<1||f>_||c!==$||e<8||e>15||b<0||b>9||g<0||g>X)return d(a,Q);8===e&&(e=9);var i=new u;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+ja-1)/ja),i.window=new E.Buf8(2*i.w_size),i.head=new E.Buf16(i.hash_size),i.prev=new E.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new E.Buf8(i.pending_buf_size),i.d_buf=1*i.lit_bufsize,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,w(a)}function z(a,b){return y(a,b,$,aa,ba,Y)}function A(a,b){var c,h,k,l;if(!a||!a.state||b>N||b<0)return a?d(a,Q):Q;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ta&&b!==M)return d(a,0===a.avail_out?S:Q);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===na)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=H(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=oa):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,ya),h.status=sa);else{var m=$+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=V||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ma),m+=31-m%31,h.status=sa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===oa)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=pa)}else h.status=pa;if(h.status===pa)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=qa)}else h.status=qa;if(h.status===qa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=ra)}else h.status=ra;if(h.status===ra&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=sa)):h.status=sa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,O}else if(0===a.avail_in&&e(b)<=e(c)&&b!==M)return d(a,S);if(h.status===ta&&0!==a.avail_in)return d(a,S);if(0!==a.avail_in||0!==h.lookahead||b!==J&&h.status!==ta){var o=h.strategy===V?r(h,b):h.strategy===W?q(h,b):D[h.level].func(h,b);if(o!==wa&&o!==xa||(h.status=ta),o===ua||o===wa)return 0===a.avail_out&&(h.last_flush=-1),O;if(o===va&&(b===K?F._tr_align(h):b!==N&&(F._tr_stored_block(h,0,0,!1),b===L&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,O}return b!==M?O:h.wrap<=0?P:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?O:P)}function B(a){var b;return a&&a.state?(b=a.state.status,b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra&&b!==sa&&b!==ta?d(a,Q):(a.state=null,b===sa?d(a,R):O)):Q}function C(a,b){var c,d,e,g,h,i,j,k,l=b.length;if(!a||!a.state)return Q;if(c=a.state,g=c.wrap,2===g||1===g&&c.status!==na||c.lookahead)return Q;for(1===g&&(a.adler=G(a.adler,b,l,0)),c.wrap=0,l>=c.w_size&&(0===g&&(f(c.head),c.strstart=0,c.block_start=0,c.insert=0),k=new E.Buf8(c.w_size),E.arraySet(k,b,l-c.w_size,c.w_size,0),b=k,l=c.w_size),h=a.avail_in,i=a.next_in,j=a.input,a.avail_in=l,a.next_in=0,a.input=b,m(c);c.lookahead>=ja;){d=c.strstart,e=c.lookahead-(ja-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[d+ja-1])&c.hash_mask,c.prev[d&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=d,d++;while(--e);c.strstart=d,c.lookahead=ja-1,m(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=ja-1,c.match_available=0,a.next_in=i,a.input=j,a.avail_in=h,c.wrap=g,O}var D,E=a("../utils/common"),F=a("./trees"),G=a("./adler32"),H=a("./crc32"),I=a("./messages"),J=0,K=1,L=3,M=4,N=5,O=0,P=1,Q=-2,R=-3,S=-5,T=-1,U=1,V=2,W=3,X=4,Y=0,Z=2,$=8,_=9,aa=15,ba=8,ca=29,da=256,ea=da+1+ca,fa=30,ga=19,ha=2*ea+1,ia=15,ja=3,ka=258,la=ka+ja+1,ma=32,na=42,oa=69,pa=73,qa=91,ra=103,sa=113,ta=666,ua=1,va=2,wa=3,xa=4,ya=3;D=[new s(0,0,0,0,n),new s(4,4,8,4,o),new s(4,5,16,8,o),new s(4,6,32,32,o),new s(4,4,16,16,p),new s(8,16,32,32,p),new s(8,16,128,128,p),new s(8,32,128,256,p),new s(32,128,258,1024,p),new s(32,258,258,4096,p)],c.deflateInit=z,c.deflateInit2=y,c.deflateReset=w,c.deflateResetKeep=v,c.deflateSetHeader=x,c.deflate=A,c.deflateEnd=B,c.deflateSetDictionary=C,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":62,"./adler32":64,"./crc32":66,"./messages":72,"./trees":73}],68:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],69:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(q<w&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,q<w&&(p+=B[f++]<<q,q+=8,q<w&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(n<w){if(z+=l+n-w,w-=n,w<x){x-=w;do C[h++]=o[z++];while(--w);if(z=0,n<x){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(f<g&&h<j);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=f<g?5+(g-f):5-(f-g),a.avail_out=h<j?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],70:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=L,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new s.Buf32(pa),b.distcode=b.distdyn=new s.Buf32(qa),b.sane=1,b.back=-1,D):G}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):G}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=(b>>4)+1,b<48&&(b&=15)),b&&(b<8||b>15)?G:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):G}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==D&&(a.state=null),c):G}function j(a){return i(a,sa)}function k(a){if(ta){var b;for(q=new s.Buf32(512),r=new s.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(w(y,a.lens,0,288,q,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;w(z,a.lens,0,32,r,0,a.work,{bits:5}),ta=!1}a.lencode=q,a.lenbits=9,a.distcode=r,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new s.Buf8(f.wsize)),d>=f.wsize?(s.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),s.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(s.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,r,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new s.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return G;c=a.state,c.mode===W&&(c.mode=X),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=D;a:for(;;)switch(c.mode){case L:if(0===c.wrap){c.mode=X;break}for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0),m=0,n=0,c.mode=M;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=ma;break}if((15&m)!==K){a.msg="unknown compression method",c.mode=ma;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=ma;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?U:W,m=0,n=0;break;case M:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==K){a.msg="unknown compression method",c.mode=ma;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=ma;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=N;case N:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=u(c.check,Ba,4,0)),m=0,n=0,c.mode=O;case O:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=P;case P:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=Q;case Q:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=R;case R:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=S;case S:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=T;case T:if(512&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=ma;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=W;break;case U:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=V;case V:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,F;a.adler=c.check=1,c.mode=W;case W:if(b===B||b===C)break a;case X:if(c.last){m>>>=7&n,n-=7&n,c.mode=ja;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=Y;break;case 1:if(k(c),c.mode=ca,b===C){m>>>=2,n-=2;break a}break;case 2:c.mode=_;break;case 3:a.msg="invalid block type",c.mode=ma}m>>>=2,n-=2;break;case Y:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=ma;break}if(c.length=65535&m,m=0,n=0,c.mode=Z,b===C)break a;case Z:c.mode=$;case $:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;s.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=W;break;case _:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=ma;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.ncode;){for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=w(x,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=ma;break}c.have=0,c.mode=ba;case ba:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(sa<16)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=ma;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=ma;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===ma)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=ma;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=w(y,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=ma;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=w(z,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=ma;break}if(c.mode=ca,b===C)break a;case ca:c.mode=da;case da:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,v(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===W&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ia;break}if(32&ra){c.back=-1,c.mode=W;break}if(64&ra){a.msg="invalid literal/length code",c.mode=ma;break}c.extra=15&ra,c.mode=ea;case ea:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=fa;case fa:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=ma;break}c.offset=sa,c.extra=15&ra,c.mode=ga;case ga:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=ma;break}c.mode=ha;case ha:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=ma;break}q>c.wnext?(q-=c.wnext,r=c.wsize-q):r=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,r=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[r++];while(--q);0===c.length&&(c.mode=da);break;case ia:if(0===j)break a;f[h++]=c.length,j--,c.mode=da;break;case ja:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?u(c.check,f,p,h-p):t(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=ma;break}m=0,n=0}c.mode=ka;case ka:if(c.wrap&&c.flags){for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=ma;break}m=0,n=0}c.mode=la;case la:xa=E;break a;case ma:xa=H;break a;case na:return I;case oa:default:return G}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<ma&&(c.mode<ja||b!==A))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=na,I):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?u(c.check,f,p,a.next_out-p):t(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===W?128:0)+(c.mode===ca||c.mode===Z?256:0),(0===o&&0===p||b===A)&&xa===D&&(xa=J),xa)}function n(a){if(!a||!a.state)return G;var b=a.state;return b.window&&(b.window=null),a.state=null,D}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?G:(c.head=b,b.done=!1,D)):G}function p(a,b){var c,d,e,f=b.length;return a&&a.state?(c=a.state,0!==c.wrap&&c.mode!==V?G:c.mode===V&&(d=1,d=t(d,b,f,0),d!==c.check)?H:(e=l(a,b,f,f))?(c.mode=na,I):(c.havedict=1,D)):G}var q,r,s=a("../utils/common"),t=a("./adler32"),u=a("./crc32"),v=a("./inffast"),w=a("./inftrees"),x=0,y=1,z=2,A=4,B=5,C=6,D=0,E=1,F=2,G=-2,H=-3,I=-4,J=-5,K=8,L=1,M=2,N=3,O=4,P=5,Q=6,R=7,S=8,T=9,U=10,V=11,W=12,X=13,Y=14,Z=15,$=16,_=17,aa=18,ba=19,ca=20,da=21,ea=22,fa=23,ga=24,ha=25,ia=26,ja=27,ka=28,la=29,ma=30,na=31,oa=32,pa=852,qa=592,ra=15,sa=ra,ta=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateSetDictionary=p,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":62,"./adler32":64,"./crc32":66,"./inffast":69,"./inftrees":71}],71:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;D<=e;D++)P[D]=0;for(E=0;E<o;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F<G&&0===P[F];F++);for(H<F&&(H=F),K=1,D=1;D<=e;D++)if(K<<=1,K-=P[D],K<0)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;D<e;D++)Q[D+1]=Q[D]+P[D];for(E=0;E<o;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(;;){z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;I+J<G&&(K-=P[I+J],!(K<=0));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":62}],72:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],73:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length}function f(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b}function g(a){return a<256?ia[a]:ia[256+(a>>>7)]}function h(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function i(a,b,c){a.bi_valid>X-c?(a.bi_buf|=b<<a.bi_valid&65535,h(a,a.bi_buf),a.bi_buf=b>>X-a.bi_valid,a.bi_valid+=c-X):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function j(a,b,c){i(a,c[2*b],c[2*b+1])}function k(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function l(a){16===a.bi_valid?(h(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function m(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;f<=W;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,
15
- c=a.heap_max+1;c<V;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function n(a,b,c){var d,e,f=new Array(W+1),g=0;for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2*e]=k(f[h]++,h))}}function o(){var a,b,c,d,f,g=new Array(W+1);for(c=0,d=0;d<Q-1;d++)for(ka[d]=c,a=0;a<1<<ba[d];a++)ja[c++]=d;for(ja[c-1]=d,f=0,d=0;d<16;d++)for(la[d]=f,a=0;a<1<<ca[d];a++)ia[f++]=d;for(f>>=7;d<T;d++)for(la[d]=f<<7,a=0;a<1<<ca[d]-7;a++)ia[256+f++]=d;for(b=0;b<=W;b++)g[b]=0;for(a=0;a<=143;)ga[2*a+1]=8,a++,g[8]++;for(;a<=255;)ga[2*a+1]=9,a++,g[9]++;for(;a<=279;)ga[2*a+1]=7,a++,g[7]++;for(;a<=287;)ga[2*a+1]=8,a++,g[8]++;for(n(ga,S+1,g),a=0;a<T;a++)ha[2*a+1]=5,ha[2*a]=k(a,5);ma=new e(ga,ba,R+1,S,W),na=new e(ha,ca,0,T,W),oa=new e(new Array(0),da,0,U,Y)}function p(a){var b;for(b=0;b<S;b++)a.dyn_ltree[2*b]=0;for(b=0;b<T;b++)a.dyn_dtree[2*b]=0;for(b=0;b<U;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*Z]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function q(a){a.bi_valid>8?h(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function r(a,b,c,d){q(a),d&&(h(a,c),h(a,~c)),G.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function s(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function t(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&s(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!s(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function u(a,b,c){var d,e,f,h,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],e=a.pending_buf[a.l_buf+k],k++,0===d?j(a,e,b):(f=ja[e],j(a,f+R+1,b),h=ba[f],0!==h&&(e-=ka[f],i(a,e,h)),d--,f=g(d),j(a,f,c),h=ca[f],0!==h&&(d-=la[f],i(a,d,h)));while(k<a.last_lit);j(a,Z,b)}function v(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=V,c=0;c<i;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=j<2?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)t(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],t(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,t(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],m(a,b),n(f,j,a.bl_count)}function w(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;d<=c;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(h<j?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*$]++):h<=10?a.bl_tree[2*_]++:a.bl_tree[2*aa]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function x(a,b,c){var d,e,f=-1,g=b[1],h=0,k=7,l=4;for(0===g&&(k=138,l=3),d=0;d<=c;d++)if(e=g,g=b[2*(d+1)+1],!(++h<k&&e===g)){if(h<l){do j(a,e,a.bl_tree);while(0!==--h)}else 0!==e?(e!==f&&(j(a,e,a.bl_tree),h--),j(a,$,a.bl_tree),i(a,h-3,2)):h<=10?(j(a,_,a.bl_tree),i(a,h-3,3)):(j(a,aa,a.bl_tree),i(a,h-11,7));h=0,f=e,0===g?(k=138,l=3):e===g?(k=6,l=3):(k=7,l=4)}}function y(a){var b;for(w(a,a.dyn_ltree,a.l_desc.max_code),w(a,a.dyn_dtree,a.d_desc.max_code),v(a,a.bl_desc),b=U-1;b>=3&&0===a.bl_tree[2*ea[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function z(a,b,c,d){var e;for(i(a,b-257,5),i(a,c-1,5),i(a,d-4,4),e=0;e<d;e++)i(a,a.bl_tree[2*ea[e]+1],3);x(a,a.dyn_ltree,b-1),x(a,a.dyn_dtree,c-1)}function A(a){var b,c=4093624447;for(b=0;b<=31;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return I;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return J;for(b=32;b<R;b++)if(0!==a.dyn_ltree[2*b])return J;return I}function B(a){pa||(o(),pa=!0),a.l_desc=new f(a.dyn_ltree,ma),a.d_desc=new f(a.dyn_dtree,na),a.bl_desc=new f(a.bl_tree,oa),a.bi_buf=0,a.bi_valid=0,p(a)}function C(a,b,c,d){i(a,(L<<1)+(d?1:0),3),r(a,b,c,!0)}function D(a){i(a,M<<1,3),j(a,Z,ga),l(a)}function E(a,b,c,d){var e,f,g=0;a.level>0?(a.strm.data_type===K&&(a.strm.data_type=A(a)),v(a,a.l_desc),v(a,a.d_desc),g=y(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,f<=e&&(e=f)):e=f=c+5,c+4<=e&&b!==-1?C(a,b,c,d):a.strategy===H||f===e?(i(a,(M<<1)+(d?1:0),3),u(a,ga,ha)):(i(a,(N<<1)+(d?1:0),3),z(a,a.l_desc.max_code+1,a.d_desc.max_code+1,g+1),u(a,a.dyn_ltree,a.dyn_dtree)),p(a),d&&q(a)}function F(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ja[c]+R+1)]++,a.dyn_dtree[2*g(b)]++),a.last_lit===a.lit_bufsize-1}var G=a("../utils/common"),H=4,I=0,J=1,K=2,L=0,M=1,N=2,O=3,P=258,Q=29,R=256,S=R+1+Q,T=30,U=19,V=2*S+1,W=15,X=16,Y=7,Z=256,$=16,_=17,aa=18,ba=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ca=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fa=512,ga=new Array(2*(S+2));d(ga);var ha=new Array(2*T);d(ha);var ia=new Array(fa);d(ia);var ja=new Array(P-O+1);d(ja);var ka=new Array(Q);d(ka);var la=new Array(T);d(la);var ma,na,oa,pa=!1;c._tr_init=B,c._tr_stored_block=C,c._tr_flush_block=E,c._tr_tally=F,c._tr_align=D},{"../utils/common":62}],74:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}]},{},[10])(10)});
16
-
17
- /* FileSaver.js
18
- * A saveAs() FileSaver implementation.
19
- * 1.3.8
20
- * 2018-03-22 14:03:47
21
- *
22
- * By Eli Grey, https://eligrey.com
23
- * License: MIT
24
- * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
25
- */
26
-
27
- /*global self */
28
- /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
29
-
30
- /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/src/FileSaver.js */
31
-
32
- var saveAs = saveAs || (function(view) {
33
- "use strict";
34
- // IE <10 is explicitly unsupported
35
- if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
36
- return;
37
- }
38
- var
39
- doc = view.document
40
- // only get URL when necessary in case Blob.js hasn't overridden it yet
41
- , get_URL = function() {
42
- return view.URL || view.webkitURL || view;
43
- }
44
- , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
45
- , can_use_save_link = "download" in save_link
46
- , click = function(node) {
47
- var event = new MouseEvent("click");
48
- node.dispatchEvent(event);
49
- }
50
- , is_safari = /constructor/i.test(view.HTMLElement) || view.safari
51
- , is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
52
- , setImmediate = view.setImmediate || view.setTimeout
53
- , throw_outside = function(ex) {
54
- setImmediate(function() {
55
- throw ex;
56
- }, 0);
57
- }
58
- , force_saveable_type = "application/octet-stream"
59
- // the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to
60
- , arbitrary_revoke_timeout = 1000 * 40 // in ms
61
- , revoke = function(file) {
62
- var revoker = function() {
63
- if (typeof file === "string") { // file is an object URL
64
- get_URL().revokeObjectURL(file);
65
- } else { // file is a File
66
- file.remove();
67
- }
68
- };
69
- setTimeout(revoker, arbitrary_revoke_timeout);
70
- }
71
- , dispatch = function(filesaver, event_types, event) {
72
- event_types = [].concat(event_types);
73
- var i = event_types.length;
74
- while (i--) {
75
- var listener = filesaver["on" + event_types[i]];
76
- if (typeof listener === "function") {
77
- try {
78
- listener.call(filesaver, event || filesaver);
79
- } catch (ex) {
80
- throw_outside(ex);
81
- }
82
- }
83
- }
84
- }
85
- , auto_bom = function(blob) {
86
- // prepend BOM for UTF-8 XML and text/* types (including HTML)
87
- // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
88
- if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
89
- return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});
90
- }
91
- return blob;
92
- }
93
- , FileSaver = function(blob, name, no_auto_bom) {
94
- if (!no_auto_bom) {
95
- blob = auto_bom(blob);
96
- }
97
- // First try a.download, then web filesystem, then object URLs
98
- var
99
- filesaver = this
100
- , type = blob.type
101
- , force = type === force_saveable_type
102
- , object_url
103
- , dispatch_all = function() {
104
- dispatch(filesaver, "writestart progress write writeend".split(" "));
105
- }
106
- // on any filesys errors revert to saving with object URLs
107
- , fs_error = function() {
108
- if ((is_chrome_ios || (force && is_safari)) && view.FileReader) {
109
- // Safari doesn't allow downloading of blob urls
110
- var reader = new FileReader();
111
- reader.onloadend = function() {
112
- var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;');
113
- var popup = view.open(url, '_blank');
114
- if(!popup) view.location.href = url;
115
- url=undefined; // release reference before dispatching
116
- filesaver.readyState = filesaver.DONE;
117
- dispatch_all();
118
- };
119
- reader.readAsDataURL(blob);
120
- filesaver.readyState = filesaver.INIT;
121
- return;
122
- }
123
- // don't create more object URLs than needed
124
- if (!object_url) {
125
- object_url = get_URL().createObjectURL(blob);
126
- }
127
- if (force) {
128
- view.location.href = object_url;
129
- } else {
130
- var opened = view.open(object_url, "_blank");
131
- if (!opened) {
132
- // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html
133
- view.location.href = object_url;
134
- }
135
- }
136
- filesaver.readyState = filesaver.DONE;
137
- dispatch_all();
138
- revoke(object_url);
139
- }
140
- ;
141
- filesaver.readyState = filesaver.INIT;
142
-
143
- if (can_use_save_link) {
144
- object_url = get_URL().createObjectURL(blob);
145
- setImmediate(function() {
146
- save_link.href = object_url;
147
- save_link.download = name;
148
- click(save_link);
149
- dispatch_all();
150
- revoke(object_url);
151
- filesaver.readyState = filesaver.DONE;
152
- }, 0);
153
- return;
154
- }
155
-
156
- fs_error();
157
- }
158
- , FS_proto = FileSaver.prototype
159
- , saveAs = function(blob, name, no_auto_bom) {
160
- return new FileSaver(blob, name || blob.name || "download", no_auto_bom);
161
- }
162
- ;
163
-
164
- // IE 10+ (native saveAs)
165
- if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
166
- return function(blob, name, no_auto_bom) {
167
- name = name || blob.name || "download";
168
-
169
- if (!no_auto_bom) {
170
- blob = auto_bom(blob);
171
- }
172
- return navigator.msSaveOrOpenBlob(blob, name);
173
- };
174
- }
175
-
176
- // todo: detect chrome extensions & packaged apps
177
- //save_link.target = "_blank";
178
-
179
- FS_proto.abort = function(){};
180
- FS_proto.readyState = FS_proto.INIT = 0;
181
- FS_proto.WRITING = 1;
182
- FS_proto.DONE = 2;
183
-
184
- FS_proto.error =
185
- FS_proto.onwritestart =
186
- FS_proto.onprogress =
187
- FS_proto.onwrite =
188
- FS_proto.onabort =
189
- FS_proto.onerror =
190
- FS_proto.onwriteend =
191
- null;
192
-
193
- return saveAs;
194
- }(
195
- typeof self !== "undefined" && self
196
- || typeof window !== "undefined" && window
197
- || this
198
- ));
1
+ /*!
2
+
3
+ JSZip v3.1.5 - A JavaScript class for generating and reading zip files
4
+ <http://stuartk.com/jszip>
5
+
6
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
7
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
8
+
9
+ JSZip uses the library pako released under the MIT license :
10
+ https://github.com/nodeca/pako/blob/master/LICENSE
11
+ */
12
+ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.JSZip=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("./utils"),e=a("./support"),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a){for(var b,c,e,g,h,i,j,k=[],l=0,m=a.length,n=m,o="string"!==d.getTypeOf(a);l<a.length;)n=m-l,o?(b=a[l++],c=l<m?a[l++]:0,e=l<m?a[l++]:0):(b=a.charCodeAt(l++),c=l<m?a.charCodeAt(l++):0,e=l<m?a.charCodeAt(l++):0),g=b>>2,h=(3&b)<<4|c>>4,i=n>1?(15&c)<<2|e>>6:64,j=n>2?63&e:64,k.push(f.charAt(g)+f.charAt(h)+f.charAt(i)+f.charAt(j));return k.join("")},c.decode=function(a){var b,c,d,g,h,i,j,k=0,l=0,m="data:";if(a.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");var n=3*a.length/4;if(a.charAt(a.length-1)===f.charAt(64)&&n--,a.charAt(a.length-2)===f.charAt(64)&&n--,n%1!==0)throw new Error("Invalid base64 input, bad content length.");var o;for(o=e.uint8array?new Uint8Array(0|n):new Array(0|n);k<a.length;)g=f.indexOf(a.charAt(k++)),h=f.indexOf(a.charAt(k++)),i=f.indexOf(a.charAt(k++)),j=f.indexOf(a.charAt(k++)),b=g<<2|h>>4,c=(15&h)<<4|i>>2,d=(3&i)<<6|j,o[l++]=b,64!==i&&(o[l++]=c),64!==j&&(o[l++]=d);return o}},{"./support":30,"./utils":32}],2:[function(a,b,c){"use strict";function d(a,b,c,d,e){this.compressedSize=a,this.uncompressedSize=b,this.crc32=c,this.compression=d,this.compressedContent=e}var e=a("./external"),f=a("./stream/DataWorker"),g=a("./stream/DataLengthProbe"),h=a("./stream/Crc32Probe"),g=a("./stream/DataLengthProbe");d.prototype={getContentWorker:function(){var a=new f(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new g("data_length")),b=this;return a.on("end",function(){if(this.streamInfo.data_length!==b.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),a},getCompressedWorker:function(){return new f(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(a,b,c){return a.pipe(new h).pipe(new g("uncompressedSize")).pipe(b.compressWorker(c)).pipe(new g("compressedSize")).withStreamInfo("compression",b)},b.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(a,b,c){"use strict";var d=a("./stream/GenericWorker");c.STORE={magic:"\0\0",compressWorker:function(a){return new d("STORE compression")},uncompressWorker:function(){return new d("STORE decompression")}},c.DEFLATE=a("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=h,f=d+c;a^=-1;for(var g=d;g<f;g++)a=a>>>8^e[255&(a^b[g])];return a^-1}function f(a,b,c,d){var e=h,f=d+c;a^=-1;for(var g=d;g<f;g++)a=a>>>8^e[255&(a^b.charCodeAt(g))];return a^-1}var g=a("./utils"),h=d();b.exports=function(a,b){if("undefined"==typeof a||!a.length)return 0;var c="string"!==g.getTypeOf(a);return c?e(0|b,a,a.length,0):f(0|b,a,a.length,0)}},{"./utils":32}],5:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!0,c.date=null,c.compression=null,c.compressionOptions=null,c.comment=null,c.unixPermissions=null,c.dosPermissions=null},{}],6:[function(a,b,c){"use strict";var d=null;d="undefined"!=typeof Promise?Promise:a("lie"),b.exports={Promise:d}},{lie:58}],7:[function(a,b,c){"use strict";function d(a,b){h.call(this,"FlateWorker/"+a),this._pako=null,this._pakoAction=a,this._pakoOptions=b,this.meta={}}var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,f=a("pako"),g=a("./utils"),h=a("./stream/GenericWorker"),i=e?"uint8array":"array";c.magic="\b\0",g.inherits(d,h),d.prototype.processChunk=function(a){this.meta=a.meta,null===this._pako&&this._createPako(),this._pako.push(g.transformTo(i,a.data),!1)},d.prototype.flush=function(){h.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new f[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var a=this;this._pako.onData=function(b){a.push({data:b,meta:a.meta})}},c.compressWorker=function(a){return new d("Deflate",a)},c.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:59}],8:[function(a,b,c){"use strict";function d(a,b,c,d){f.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=c,this.encodeFileName=d,this.streamFiles=a,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}var e=a("../utils"),f=a("../stream/GenericWorker"),g=a("../utf8"),h=a("../crc32"),i=a("../signature"),j=function(a,b){var c,d="";for(c=0;c<b;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},k=function(a,b){var c=a;return a||(c=b?16893:33204),(65535&c)<<16},l=function(a,b){return 63&(a||0)},m=function(a,b,c,d,f,m){var n,o,p=a.file,q=a.compression,r=m!==g.utf8encode,s=e.transformTo("string",m(p.name)),t=e.transformTo("string",g.utf8encode(p.name)),u=p.comment,v=e.transformTo("string",m(u)),w=e.transformTo("string",g.utf8encode(u)),x=t.length!==p.name.length,y=w.length!==u.length,z="",A="",B="",C=p.dir,D=p.date,E={crc32:0,compressedSize:0,uncompressedSize:0};b&&!c||(E.crc32=a.crc32,E.compressedSize=a.compressedSize,E.uncompressedSize=a.uncompressedSize);var F=0;b&&(F|=8),r||!x&&!y||(F|=2048);var G=0,H=0;C&&(G|=16),"UNIX"===f?(H=798,G|=k(p.unixPermissions,C)):(H=20,G|=l(p.dosPermissions,C)),n=D.getUTCHours(),n<<=6,n|=D.getUTCMinutes(),n<<=5,n|=D.getUTCSeconds()/2,o=D.getUTCFullYear()-1980,o<<=4,o|=D.getUTCMonth()+1,o<<=5,o|=D.getUTCDate(),x&&(A=j(1,1)+j(h(s),4)+t,z+="up"+j(A.length,2)+A),y&&(B=j(1,1)+j(h(v),4)+w,z+="uc"+j(B.length,2)+B);var I="";I+="\n\0",I+=j(F,2),I+=q.magic,I+=j(n,2),I+=j(o,2),I+=j(E.crc32,4),I+=j(E.compressedSize,4),I+=j(E.uncompressedSize,4),I+=j(s.length,2),I+=j(z.length,2);var J=i.LOCAL_FILE_HEADER+I+s+z,K=i.CENTRAL_FILE_HEADER+j(H,2)+I+j(v.length,2)+"\0\0\0\0"+j(G,4)+j(d,4)+s+z+v;return{fileRecord:J,dirRecord:K}},n=function(a,b,c,d,f){var g="",h=e.transformTo("string",f(d));return g=i.CENTRAL_DIRECTORY_END+"\0\0\0\0"+j(a,2)+j(a,2)+j(b,4)+j(c,4)+j(h.length,2)+h},o=function(a){var b="";return b=i.DATA_DESCRIPTOR+j(a.crc32,4)+j(a.compressedSize,4)+j(a.uncompressedSize,4)};e.inherits(d,f),d.prototype.push=function(a){var b=a.meta.percent||0,c=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(a):(this.bytesWritten+=a.data.length,f.prototype.push.call(this,{data:a.data,meta:{currentFile:this.currentFile,percent:c?(b+100*(c-d-1))/c:100}}))},d.prototype.openedSource=function(a){this.currentSourceOffset=this.bytesWritten,this.currentFile=a.file.name;var b=this.streamFiles&&!a.file.dir;if(b){var c=m(a,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:c.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(a){this.accumulate=!1;var b=this.streamFiles&&!a.file.dir,c=m(a,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(c.dirRecord),b)this.push({data:o(a),meta:{percent:100}});else for(this.push({data:c.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var a=this.bytesWritten,b=0;b<this.dirRecords.length;b++)this.push({data:this.dirRecords[b],meta:{percent:100}});var c=this.bytesWritten-a,d=n(this.dirRecords.length,c,a,this.zipComment,this.encodeFileName);this.push({data:d,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(a){this._sources.push(a);var b=this;return a.on("data",function(a){b.processChunk(a)}),a.on("end",function(){b.closedSource(b.previous.streamInfo),b._sources.length?b.prepareNextSource():b.end()}),a.on("error",function(a){b.error(a)}),this},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(a){var b=this._sources;if(!f.prototype.error.call(this,a))return!1;for(var c=0;c<b.length;c++)try{b[c].error(a)}catch(a){}return!0},d.prototype.lock=function(){f.prototype.lock.call(this);for(var a=this._sources,b=0;b<a.length;b++)a[b].lock()},b.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(a,b,c){"use strict";var d=a("../compressions"),e=a("./ZipFileWorker"),f=function(a,b){var c=a||b,e=d[c];if(!e)throw new Error(c+" is not a valid compression method !");return e};c.generateWorker=function(a,b,c){var d=new e(b.streamFiles,c,b.platform,b.encodeFileName),g=0;try{a.forEach(function(a,c){g++;var e=f(c.options.compression,b.compression),h=c.options.compressionOptions||b.compressionOptions||{},i=c.dir,j=c.date;c._compressWorker(e,h).withStreamInfo("file",{name:a,dir:i,date:j,comment:c.comment||"",unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions}).pipe(d)}),d.entriesCount=g}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(a,b,c){"use strict";function d(){if(!(this instanceof d))return new d;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var a=new d;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a}}d.prototype=a("./object"),d.prototype.loadAsync=a("./load"),d.support=a("./support"),d.defaults=a("./defaults"),d.version="3.1.5",d.loadAsync=function(a,b){return(new d).loadAsync(a,b)},d.external=a("./external"),b.exports=d},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(a,b,c){"use strict";function d(a){return new f.Promise(function(b,c){var d=a.decompressed.getContentWorker().pipe(new i);d.on("error",function(a){c(a)}).on("end",function(){d.streamInfo.crc32!==a.decompressed.crc32?c(new Error("Corrupted zip : CRC32 mismatch")):b()}).resume()})}var e=a("./utils"),f=a("./external"),g=a("./utf8"),e=a("./utils"),h=a("./zipEntries"),i=a("./stream/Crc32Probe"),j=a("./nodejsUtils");b.exports=function(a,b){var c=this;return b=e.extend(b||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:g.utf8decode}),j.isNode&&j.isStream(a)?f.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):e.prepareContent("the loaded zip file",a,!0,b.optimizedBinaryString,b.base64).then(function(a){var c=new h(b);return c.load(a),c}).then(function(a){var c=[f.Promise.resolve(a)],e=a.files;if(b.checkCRC32)for(var g=0;g<e.length;g++)c.push(d(e[g]));return f.Promise.all(c)}).then(function(a){for(var d=a.shift(),e=d.files,f=0;f<e.length;f++){var g=e[f];c.file(g.fileNameStr,g.decompressed,{binary:!0,optimizedBinaryString:!0,date:g.date,dir:g.dir,comment:g.fileCommentStr.length?g.fileCommentStr:null,unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions,createFolders:b.createFolders})}return d.zipComment.length&&(c.comment=d.zipComment),c})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(a,b,c){"use strict";function d(a,b){f.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(b)}var e=a("../utils"),f=a("../stream/GenericWorker");e.inherits(d,f),d.prototype._bindStream=function(a){var b=this;this._stream=a,a.pause(),a.on("data",function(a){b.push({data:a,meta:{percent:0}})}).on("error",function(a){b.isPaused?this.generatedError=a:b.error(a)}).on("end",function(){b.isPaused?b._upstreamEnded=!0:b.end()})},d.prototype.pause=function(){return!!f.prototype.pause.call(this)&&(this._stream.pause(),!0)},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},b.exports=d},{"../stream/GenericWorker":28,"../utils":32}],13:[function(a,b,c){"use strict";function d(a,b,c){e.call(this,b),this._helper=a;var d=this;a.on("data",function(a,b){d.push(a)||d._helper.pause(),c&&c(b)}).on("error",function(a){d.emit("error",a)}).on("end",function(){d.push(null)})}var e=a("readable-stream").Readable,f=a("../utils");f.inherits(d,e),d.prototype._read=function(){this._helper.resume()},b.exports=d},{"../utils":32,"readable-stream":16}],14:[function(a,b,c){"use strict";b.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(a,b){return new Buffer(a,b)},allocBuffer:function(a){return Buffer.alloc?Buffer.alloc(a):new Buffer(a)},isBuffer:function(a){return Buffer.isBuffer(a)},isStream:function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pause&&"function"==typeof a.resume}}},{}],15:[function(a,b,c){"use strict";function d(a){return"[object RegExp]"===Object.prototype.toString.call(a)}var e=a("./utf8"),f=a("./utils"),g=a("./stream/GenericWorker"),h=a("./stream/StreamHelper"),i=a("./defaults"),j=a("./compressedObject"),k=a("./zipObject"),l=a("./generate"),m=a("./nodejsUtils"),n=a("./nodejs/NodejsStreamInputAdapter"),o=function(a,b,c){var d,e=f.getTypeOf(b),h=f.extend(c||{},i);h.date=h.date||new Date,null!==h.compression&&(h.compression=h.compression.toUpperCase()),"string"==typeof h.unixPermissions&&(h.unixPermissions=parseInt(h.unixPermissions,8)),h.unixPermissions&&16384&h.unixPermissions&&(h.dir=!0),h.dosPermissions&&16&h.dosPermissions&&(h.dir=!0),h.dir&&(a=q(a)),h.createFolders&&(d=p(a))&&r.call(this,d,!0);var l="string"===e&&h.binary===!1&&h.base64===!1;c&&"undefined"!=typeof c.binary||(h.binary=!l);var o=b instanceof j&&0===b.uncompressedSize;(o||h.dir||!b||0===b.length)&&(h.base64=!1,h.binary=!0,b="",h.compression="STORE",e="string");var s=null;s=b instanceof j||b instanceof g?b:m.isNode&&m.isStream(b)?new n(a,b):f.prepareContent(a,b,h.binary,h.optimizedBinaryString,h.base64);var t=new k(a,s,h);this.files[a]=t},p=function(a){"/"===a.slice(-1)&&(a=a.substring(0,a.length-1));var b=a.lastIndexOf("/");return b>0?a.substring(0,b):""},q=function(a){return"/"!==a.slice(-1)&&(a+="/"),a},r=function(a,b){return b="undefined"!=typeof b?b:i.createFolders,a=q(a),this.files[a]||o.call(this,a,null,{dir:!0,createFolders:b}),this.files[a]},s={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(a){var b,c,d;for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],c=b.slice(this.root.length,b.length),c&&b.slice(0,this.root.length)===this.root&&a(c,d))},filter:function(a){var b=[];return this.forEach(function(c,d){a(c,d)&&b.push(d)}),b},file:function(a,b,c){if(1===arguments.length){if(d(a)){var e=a;return this.filter(function(a,b){return!b.dir&&e.test(a)})}var f=this.files[this.root+a];return f&&!f.dir?f:null}return a=this.root+a,o.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(d(a))return this.filter(function(b,c){return c.dir&&a.test(b)});var b=this.root+a,c=r.call(this,b),e=this.clone();return e.root=c.name,e},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!==a.slice(-1)&&(a+="/"),b=this.files[a]),b&&!b.dir)delete this.files[a];else for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;d<c.length;d++)delete this.files[c[d].name];return this},generate:function(a){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(a){var b,c={};try{if(c=f.extend(a||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:e.utf8encode}),c.type=c.type.toLowerCase(),c.compression=c.compression.toUpperCase(),"binarystring"===c.type&&(c.type="string"),!c.type)throw new Error("No output type specified.");f.checkSupport(c.type),"darwin"!==c.platform&&"freebsd"!==c.platform&&"linux"!==c.platform&&"sunos"!==c.platform||(c.platform="UNIX"),"win32"===c.platform&&(c.platform="DOS");var d=c.comment||this.comment||"";b=l.generateWorker(this,c,d)}catch(i){b=new g("error"),b.error(i)}return new h(b,c.type||"string",c.mimeType)},generateAsync:function(a,b){return this.generateInternalStream(a).accumulate(b)},generateNodeStream:function(a,b){return a=a||{},a.type||(a.type="nodebuffer"),this.generateInternalStream(a).toNodejsStream(b)}};b.exports=s},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(a,b,c){b.exports=a("stream")},{stream:void 0}],17:[function(a,b,c){"use strict";function d(a){e.call(this,a);for(var b=0;b<this.data.length;b++)a[b]=255&a[b]}var e=a("./DataReader"),f=a("../utils");f.inherits(d,e),d.prototype.byteAt=function(a){return this.data[this.zero+a]},d.prototype.lastIndexOfSignature=function(a){for(var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f-this.zero;return-1},d.prototype.readAndCheckSignature=function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.readData(4);return b===f[0]&&c===f[1]&&d===f[2]&&e===f[3]},d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return[];var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./DataReader":18}],18:[function(a,b,c){"use strict";function d(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}var e=a("../utils");d.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(a){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return e.transformTo("string",this.readData(a))},readData:function(a){},lastIndexOfSignature:function(a){},readAndCheckSignature:function(a){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},b.exports=d},{"../utils":32}],19:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./Uint8ArrayReader"),f=a("../utils");f.inherits(d,e),d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./DataReader"),f=a("../utils");f.inherits(d,e),d.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},d.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},d.prototype.readAndCheckSignature=function(a){var b=this.readData(4);return a===b},d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./DataReader":18}],21:[function(a,b,c){"use strict";function d(a){e.call(this,a)}var e=a("./ArrayReader"),f=a("../utils");f.inherits(d,e),d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,b},b.exports=d},{"../utils":32,"./ArrayReader":17}],22:[function(a,b,c){"use strict";var d=a("../utils"),e=a("../support"),f=a("./ArrayReader"),g=a("./StringReader"),h=a("./NodeBufferReader"),i=a("./Uint8ArrayReader");b.exports=function(a){var b=d.getTypeOf(a);return d.checkSupport(b),"string"!==b||e.uint8array?"nodebuffer"===b?new h(a):e.uint8array?new i(d.transformTo("uint8array",a)):new f(d.transformTo("array",a)):new g(a)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(a,b,c){"use strict";c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\b"},{}],24:[function(a,b,c){"use strict";function d(a){e.call(this,"ConvertWorker to "+a),this.destType=a}var e=a("./GenericWorker"),f=a("../utils");f.inherits(d,e),d.prototype.processChunk=function(a){this.push({data:f.transformTo(this.destType,a.data),meta:a.meta})},b.exports=d},{"../utils":32,"./GenericWorker":28}],25:[function(a,b,c){"use strict";function d(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}var e=a("./GenericWorker"),f=a("../crc32"),g=a("../utils");g.inherits(d,e),d.prototype.processChunk=function(a){this.streamInfo.crc32=f(a.data,this.streamInfo.crc32||0),this.push(a)},b.exports=d},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(a,b,c){"use strict";function d(a){f.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}var e=a("../utils"),f=a("./GenericWorker");e.inherits(d,f),d.prototype.processChunk=function(a){if(a){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+a.data.length}f.prototype.processChunk.call(this,a)},b.exports=d},{"../utils":32,"./GenericWorker":28}],27:[function(a,b,c){"use strict";function d(a){f.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(a){b.dataIsReady=!0,b.data=a,b.max=a&&a.length||0,b.type=e.getTypeOf(a),b.isPaused||b._tickAndRepeat()},function(a){b.error(a)})}var e=a("../utils"),f=a("./GenericWorker"),g=16384;e.inherits(d,f),d.prototype.cleanUp=function(){f.prototype.cleanUp.call(this),this.data=null},d.prototype.resume=function(){return!!f.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0)},d.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},d.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=g,b=null,c=Math.min(this.max,this.index+a);if(this.index>=this.max)return this.end();switch(this.type){case"string":b=this.data.substring(this.index,c);break;case"uint8array":b=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":b=this.data.slice(this.index,c)}return this.index=c,this.push({data:b,meta:{percent:this.max?this.index/this.max*100:0}})},b.exports=d},{"../utils":32,"./GenericWorker":28}],28:[function(a,b,c){"use strict";function d(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}d.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,b){return this._listeners[a].push(b),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,b){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,b)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var b=this;return a.on("data",function(a){b.processChunk(a)}),a.on("end",function(){b.end()}),a.on("error",function(a){b.error(a)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var a=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,b){return this.extraStreamInfo[a]=b,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},b.exports=d},{}],29:[function(a,b,c){"use strict";function d(a,b,c){switch(a){case"blob":return h.newBlob(h.transformTo("arraybuffer",b),c);case"base64":return k.encode(b);default:return h.transformTo(a,b)}}function e(a,b){var c,d=0,e=null,f=0;for(c=0;c<b.length;c++)f+=b[c].length;switch(a){case"string":return b.join("");case"array":return Array.prototype.concat.apply([],b);case"uint8array":for(e=new Uint8Array(f),c=0;c<b.length;c++)e.set(b[c],d),d+=b[c].length;return e;case"nodebuffer":return Buffer.concat(b);default:throw new Error("concat : unsupported type '"+a+"'")}}function f(a,b){return new m.Promise(function(c,f){var g=[],h=a._internalType,i=a._outputType,j=a._mimeType;a.on("data",function(a,c){g.push(a),b&&b(c)}).on("error",function(a){g=[],f(a)}).on("end",function(){try{var a=d(i,e(h,g),j);c(a)}catch(b){f(b)}g=[]}).resume()})}function g(a,b,c){var d=b;switch(b){case"blob":case"arraybuffer":d="uint8array";break;case"base64":d="string"}try{this._internalType=d,this._outputType=b,this._mimeType=c,h.checkSupport(d),this._worker=a.pipe(new i(d)),a.lock()}catch(e){this._worker=new j("error"),this._worker.error(e)}}var h=a("../utils"),i=a("./ConvertWorker"),j=a("./GenericWorker"),k=a("../base64"),l=a("../support"),m=a("../external"),n=null;if(l.nodestream)try{n=a("../nodejs/NodejsStreamOutputAdapter")}catch(o){}g.prototype={accumulate:function(a){return f(this,a)},on:function(a,b){var c=this;return"data"===a?this._worker.on(a,function(a){b.call(c,a.data,a.meta)}):this._worker.on(a,function(){h.delay(b,arguments,c)}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(a){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new n(this,{objectMode:"nodebuffer"!==this._outputType},a)}},b.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(a,b,c){"use strict";if(c.base64=!0,c.array=!0,c.string=!0,c.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c.nodebuffer="undefined"!=typeof Buffer,c.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)c.blob=!1;else{var d=new ArrayBuffer(0);try{c.blob=0===new Blob([d],{type:"application/zip"}).size}catch(e){try{var f=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,g=new f;g.append(d),c.blob=0===g.getBlob("application/zip").size}catch(e){c.blob=!1}}}try{c.nodestream=!!a("readable-stream").Readable}catch(e){c.nodestream=!1}},{"readable-stream":16}],31:[function(a,b,c){"use strict";function d(){i.call(this,"utf-8 decode"),this.leftOver=null}function e(){i.call(this,"utf-8 encode")}for(var f=a("./utils"),g=a("./support"),h=a("./nodejsUtils"),i=a("./stream/GenericWorker"),j=new Array(256),k=0;k<256;k++)j[k]=k>=252?6:k>=248?5:k>=240?4:k>=224?3:k>=192?2:1;j[254]=j[254]=1;var l=function(a){var b,c,d,e,f,h=a.length,i=0;for(e=0;e<h;e++)c=a.charCodeAt(e),55296===(64512&c)&&e+1<h&&(d=a.charCodeAt(e+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),e++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=g.uint8array?new Uint8Array(i):new Array(i),f=0,e=0;f<i;e++)c=a.charCodeAt(e),55296===(64512&c)&&e+1<h&&(d=a.charCodeAt(e+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),e++)),c<128?b[f++]=c:c<2048?(b[f++]=192|c>>>6,b[f++]=128|63&c):c<65536?(b[f++]=224|c>>>12,b[f++]=128|c>>>6&63,b[f++]=128|63&c):(b[f++]=240|c>>>18,b[f++]=128|c>>>12&63,b[f++]=128|c>>>6&63,b[f++]=128|63&c);return b},m=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+j[a[c]]>b?c:b},n=function(a){var b,c,d,e,g=a.length,h=new Array(2*g);for(c=0,b=0;b<g;)if(d=a[b++],d<128)h[c++]=d;else if(e=j[d],e>4)h[c++]=65533,b+=e-1;else{for(d&=2===e?31:3===e?15:7;e>1&&b<g;)d=d<<6|63&a[b++],e--;e>1?h[c++]=65533:d<65536?h[c++]=d:(d-=65536,h[c++]=55296|d>>10&1023,h[c++]=56320|1023&d)}return h.length!==c&&(h.subarray?h=h.subarray(0,c):h.length=c),f.applyFromCharCode(h)};c.utf8encode=function(a){return g.nodebuffer?h.newBufferFrom(a,"utf-8"):l(a)},c.utf8decode=function(a){return g.nodebuffer?f.transformTo("nodebuffer",a).toString("utf-8"):(a=f.transformTo(g.uint8array?"uint8array":"array",a),n(a))},f.inherits(d,i),d.prototype.processChunk=function(a){var b=f.transformTo(g.uint8array?"uint8array":"array",a.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var d=b;b=new Uint8Array(d.length+this.leftOver.length),b.set(this.leftOver,0),b.set(d,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var e=m(b),h=b;e!==b.length&&(g.uint8array?(h=b.subarray(0,e),this.leftOver=b.subarray(e,b.length)):(h=b.slice(0,e),this.leftOver=b.slice(e,b.length))),this.push({data:c.utf8decode(h),meta:a.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:c.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},c.Utf8DecodeWorker=d,f.inherits(e,i),e.prototype.processChunk=function(a){this.push({data:c.utf8encode(a.data),meta:a.meta})},c.Utf8EncodeWorker=e},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(a,b,c){"use strict";function d(a){var b=null;return b=i.uint8array?new Uint8Array(a.length):new Array(a.length),f(a,b)}function e(a){return a}function f(a,b){for(var c=0;c<a.length;++c)b[c]=255&a.charCodeAt(c);return b}function g(a){var b=65536,d=c.getTypeOf(a),e=!0;if("uint8array"===d?e=n.applyCanBeUsed.uint8array:"nodebuffer"===d&&(e=n.applyCanBeUsed.nodebuffer),e)for(;b>1;)try{return n.stringifyByChunk(a,d,b)}catch(f){b=Math.floor(b/2)}return n.stringifyByChar(a)}function h(a,b){for(var c=0;c<a.length;c++)b[c]=a[c];
13
+ return b}var i=a("./support"),j=a("./base64"),k=a("./nodejsUtils"),l=a("core-js/library/fn/set-immediate"),m=a("./external");c.newBlob=function(a,b){c.checkSupport("blob");try{return new Blob([a],{type:b})}catch(d){try{var e=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,f=new e;return f.append(a),f.getBlob(b)}catch(d){throw new Error("Bug : can't construct the Blob.")}}};var n={stringifyByChunk:function(a,b,c){var d=[],e=0,f=a.length;if(f<=c)return String.fromCharCode.apply(null,a);for(;e<f;)"array"===b||"nodebuffer"===b?d.push(String.fromCharCode.apply(null,a.slice(e,Math.min(e+c,f)))):d.push(String.fromCharCode.apply(null,a.subarray(e,Math.min(e+c,f)))),e+=c;return d.join("")},stringifyByChar:function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(a){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,k.allocBuffer(1)).length}catch(a){return!1}}()}};c.applyFromCharCode=g;var o={};o.string={string:e,array:function(a){return f(a,new Array(a.length))},arraybuffer:function(a){return o.string.uint8array(a).buffer},uint8array:function(a){return f(a,new Uint8Array(a.length))},nodebuffer:function(a){return f(a,k.allocBuffer(a.length))}},o.array={string:g,array:e,arraybuffer:function(a){return new Uint8Array(a).buffer},uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return k.newBufferFrom(a)}},o.arraybuffer={string:function(a){return g(new Uint8Array(a))},array:function(a){return h(new Uint8Array(a),new Array(a.byteLength))},arraybuffer:e,uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return k.newBufferFrom(new Uint8Array(a))}},o.uint8array={string:g,array:function(a){return h(a,new Array(a.length))},arraybuffer:function(a){return a.buffer},uint8array:e,nodebuffer:function(a){return k.newBufferFrom(a)}},o.nodebuffer={string:g,array:function(a){return h(a,new Array(a.length))},arraybuffer:function(a){return o.nodebuffer.uint8array(a).buffer},uint8array:function(a){return h(a,new Uint8Array(a.length))},nodebuffer:e},c.transformTo=function(a,b){if(b||(b=""),!a)return b;c.checkSupport(a);var d=c.getTypeOf(b),e=o[d][a](b);return e},c.getTypeOf=function(a){return"string"==typeof a?"string":"[object Array]"===Object.prototype.toString.call(a)?"array":i.nodebuffer&&k.isBuffer(a)?"nodebuffer":i.uint8array&&a instanceof Uint8Array?"uint8array":i.arraybuffer&&a instanceof ArrayBuffer?"arraybuffer":void 0},c.checkSupport=function(a){var b=i[a.toLowerCase()];if(!b)throw new Error(a+" is not supported by this platform")},c.MAX_VALUE_16BITS=65535,c.MAX_VALUE_32BITS=-1,c.pretty=function(a){var b,c,d="";for(c=0;c<(a||"").length;c++)b=a.charCodeAt(c),d+="\\x"+(b<16?"0":"")+b.toString(16).toUpperCase();return d},c.delay=function(a,b,c){l(function(){a.apply(c||null,b||[])})},c.inherits=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c},c.extend=function(){var a,b,c={};for(a=0;a<arguments.length;a++)for(b in arguments[a])arguments[a].hasOwnProperty(b)&&"undefined"==typeof c[b]&&(c[b]=arguments[a][b]);return c},c.prepareContent=function(a,b,e,f,g){var h=m.Promise.resolve(b).then(function(a){var b=i.blob&&(a instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(a))!==-1);return b&&"undefined"!=typeof FileReader?new m.Promise(function(b,c){var d=new FileReader;d.onload=function(a){b(a.target.result)},d.onerror=function(a){c(a.target.error)},d.readAsArrayBuffer(a)}):a});return h.then(function(b){var h=c.getTypeOf(b);return h?("arraybuffer"===h?b=c.transformTo("uint8array",b):"string"===h&&(g?b=j.decode(b):e&&f!==!0&&(b=d(b))),b):m.Promise.reject(new Error("Can't read the data of '"+a+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"core-js/library/fn/set-immediate":36}],33:[function(a,b,c){"use strict";function d(a){this.files=[],this.loadOptions=a}var e=a("./reader/readerFor"),f=a("./utils"),g=a("./signature"),h=a("./zipEntry"),i=(a("./utf8"),a("./support"));d.prototype={checkSignature:function(a){if(!this.reader.readAndCheckSignature(a)){this.reader.index-=4;var b=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+f.pretty(b)+", expected "+f.pretty(a)+")")}},isSignature:function(a,b){var c=this.reader.index;this.reader.setIndex(a);var d=this.reader.readString(4),e=d===b;return this.reader.setIndex(c),e},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var a=this.reader.readData(this.zipCommentLength),b=i.uint8array?"uint8array":"array",c=f.transformTo(b,a);this.zipComment=this.loadOptions.decodeFileName(c)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;e<d;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readData(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a<this.files.length;a++)b=this.files[a],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(g.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var a;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(g.CENTRAL_FILE_HEADER);)a=new h({zip64:this.zip64},this.loadOptions),a.readCentralPart(this.reader),this.files.push(a);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var a=this.reader.lastIndexOfSignature(g.CENTRAL_DIRECTORY_END);if(a<0){var b=!this.isSignature(0,g.LOCAL_FILE_HEADER);throw b?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(a);var c=a;if(this.checkSignature(g.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f.MAX_VALUE_16BITS||this.centralDirRecords===f.MAX_VALUE_16BITS||this.centralDirSize===f.MAX_VALUE_32BITS||this.centralDirOffset===f.MAX_VALUE_32BITS){if(this.zip64=!0,a=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),a<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(a),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,g.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var e=c-d;if(e>0)this.isSignature(c,g.CENTRAL_FILE_HEADER)||(this.reader.zero=e);else if(e<0)throw new Error("Corrupted zip: missing "+Math.abs(e)+" bytes.")},prepareReader:function(a){this.reader=e(a)},load:function(a){this.prepareReader(a),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},b.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(a,b,c){"use strict";function d(a,b){this.options=a,this.loadOptions=b}var e=a("./reader/readerFor"),f=a("./utils"),g=a("./compressedObject"),h=a("./crc32"),i=a("./utf8"),j=a("./compressions"),k=a("./support"),l=0,m=3,n=function(a){for(var b in j)if(j.hasOwnProperty(b)&&j[b].magic===a)return j[b];return null};d.prototype={isEncrypted:function(){return 1===(1&this.bitFlag)},useUTF8:function(){return 2048===(2048&this.bitFlag)},readLocalPart:function(a){var b,c;if(a.skip(22),this.fileNameLength=a.readInt(2),c=a.readInt(2),this.fileName=a.readData(this.fileNameLength),a.skip(c),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(b=n(this.compressionMethod),null===b)throw new Error("Corrupted zip : compression "+f.pretty(this.compressionMethod)+" unknown (inner file : "+f.transformTo("string",this.fileName)+")");this.decompressed=new g(this.compressedSize,this.uncompressedSize,this.crc32,b,a.readData(this.compressedSize))},readCentralPart:function(a){this.versionMadeBy=a.readInt(2),a.skip(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate(),this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4);var b=a.readInt(2);if(this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");a.skip(b),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var a=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),a===l&&(this.dosPermissions=63&this.externalFileAttributes),a===m&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(a){if(this.extraFields[1]){var b=e(this.extraFields[1].value);this.uncompressedSize===f.MAX_VALUE_32BITS&&(this.uncompressedSize=b.readInt(8)),this.compressedSize===f.MAX_VALUE_32BITS&&(this.compressedSize=b.readInt(8)),this.localHeaderOffset===f.MAX_VALUE_32BITS&&(this.localHeaderOffset=b.readInt(8)),this.diskNumberStart===f.MAX_VALUE_32BITS&&(this.diskNumberStart=b.readInt(4))}},readExtraFields:function(a){var b,c,d,e=a.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});a.index<e;)b=a.readInt(2),c=a.readInt(2),d=a.readData(c),this.extraFields[b]={id:b,length:c,value:d}},handleUTF8:function(){var a=k.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=i.utf8decode(this.fileName),this.fileCommentStr=i.utf8decode(this.fileComment);else{var b=this.findExtraFieldUnicodePath();if(null!==b)this.fileNameStr=b;else{var c=f.transformTo(a,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(c)}var d=this.findExtraFieldUnicodeComment();if(null!==d)this.fileCommentStr=d;else{var e=f.transformTo(a,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(e)}}},findExtraFieldUnicodePath:function(){var a=this.extraFields[28789];if(a){var b=e(a.value);return 1!==b.readInt(1)?null:h(this.fileName)!==b.readInt(4)?null:i.utf8decode(b.readData(a.length-5))}return null},findExtraFieldUnicodeComment:function(){var a=this.extraFields[25461];if(a){var b=e(a.value);return 1!==b.readInt(1)?null:h(this.fileComment)!==b.readInt(4)?null:i.utf8decode(b.readData(a.length-5))}return null}},b.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(a,b,c){"use strict";var d=a("./stream/StreamHelper"),e=a("./stream/DataWorker"),f=a("./utf8"),g=a("./compressedObject"),h=a("./stream/GenericWorker"),i=function(a,b,c){this.name=a,this.dir=c.dir,this.date=c.date,this.comment=c.comment,this.unixPermissions=c.unixPermissions,this.dosPermissions=c.dosPermissions,this._data=b,this._dataBinary=c.binary,this.options={compression:c.compression,compressionOptions:c.compressionOptions}};i.prototype={internalStream:function(a){var b=null,c="string";try{if(!a)throw new Error("No output type specified.");c=a.toLowerCase();var e="string"===c||"text"===c;"binarystring"!==c&&"text"!==c||(c="string"),b=this._decompressWorker();var g=!this._dataBinary;g&&!e&&(b=b.pipe(new f.Utf8EncodeWorker)),!g&&e&&(b=b.pipe(new f.Utf8DecodeWorker))}catch(i){b=new h("error"),b.error(i)}return new d(b,c,"")},async:function(a,b){return this.internalStream(a).accumulate(b)},nodeStream:function(a,b){return this.internalStream(a||"nodebuffer").toNodejsStream(b)},_compressWorker:function(a,b){if(this._data instanceof g&&this._data.compression.magic===a.magic)return this._data.getCompressedWorker();var c=this._decompressWorker();return this._dataBinary||(c=c.pipe(new f.Utf8EncodeWorker)),g.createWorkerFrom(c,a,b)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof h?this._data:new e(this._data)}};for(var j=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],k=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},l=0;l<j.length;l++)i.prototype[j[l]]=k;b.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(a,b,c){a("../modules/web.immediate"),b.exports=a("../modules/_core").setImmediate},{"../modules/_core":40,"../modules/web.immediate":56}],37:[function(a,b,c){b.exports=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function!");return a}},{}],38:[function(a,b,c){var d=a("./_is-object");b.exports=function(a){if(!d(a))throw TypeError(a+" is not an object!");return a}},{"./_is-object":51}],39:[function(a,b,c){var d={}.toString;b.exports=function(a){return d.call(a).slice(8,-1)}},{}],40:[function(a,b,c){var d=b.exports={version:"2.3.0"};"number"==typeof __e&&(__e=d)},{}],41:[function(a,b,c){var d=a("./_a-function");b.exports=function(a,b,c){if(d(a),void 0===b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}}},{"./_a-function":37}],42:[function(a,b,c){b.exports=!a("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":45}],43:[function(a,b,c){var d=a("./_is-object"),e=a("./_global").document,f=d(e)&&d(e.createElement);b.exports=function(a){return f?e.createElement(a):{}}},{"./_global":46,"./_is-object":51}],44:[function(a,b,c){var d=a("./_global"),e=a("./_core"),f=a("./_ctx"),g=a("./_hide"),h="prototype",i=function(a,b,c){var j,k,l,m=a&i.F,n=a&i.G,o=a&i.S,p=a&i.P,q=a&i.B,r=a&i.W,s=n?e:e[b]||(e[b]={}),t=s[h],u=n?d:o?d[b]:(d[b]||{})[h];n&&(c=b);for(j in c)k=!m&&u&&void 0!==u[j],k&&j in s||(l=k?u[j]:c[j],s[j]=n&&"function"!=typeof u[j]?c[j]:q&&k?f(l,d):r&&u[j]==l?function(a){var b=function(b,c,d){if(this instanceof a){switch(arguments.length){case 0:return new a;case 1:return new a(b);case 2:return new a(b,c)}return new a(b,c,d)}return a.apply(this,arguments)};return b[h]=a[h],b}(l):p&&"function"==typeof l?f(Function.call,l):l,p&&((s.virtual||(s.virtual={}))[j]=l,a&i.R&&t&&!t[j]&&g(t,j,l)))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,i.U=64,i.R=128,b.exports=i},{"./_core":40,"./_ctx":41,"./_global":46,"./_hide":47}],45:[function(a,b,c){b.exports=function(a){try{return!!a()}catch(b){return!0}}},{}],46:[function(a,b,c){var d=b.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=d)},{}],47:[function(a,b,c){var d=a("./_object-dp"),e=a("./_property-desc");b.exports=a("./_descriptors")?function(a,b,c){return d.f(a,b,e(1,c))}:function(a,b,c){return a[b]=c,a}},{"./_descriptors":42,"./_object-dp":52,"./_property-desc":53}],48:[function(a,b,c){b.exports=a("./_global").document&&document.documentElement},{"./_global":46}],49:[function(a,b,c){b.exports=!a("./_descriptors")&&!a("./_fails")(function(){return 7!=Object.defineProperty(a("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":42,"./_dom-create":43,"./_fails":45}],50:[function(a,b,c){b.exports=function(a,b,c){var d=void 0===c;switch(b.length){case 0:return d?a():a.call(c);case 1:return d?a(b[0]):a.call(c,b[0]);case 2:return d?a(b[0],b[1]):a.call(c,b[0],b[1]);case 3:return d?a(b[0],b[1],b[2]):a.call(c,b[0],b[1],b[2]);case 4:return d?a(b[0],b[1],b[2],b[3]):a.call(c,b[0],b[1],b[2],b[3])}return a.apply(c,b)}},{}],51:[function(a,b,c){b.exports=function(a){return"object"==typeof a?null!==a:"function"==typeof a}},{}],52:[function(a,b,c){var d=a("./_an-object"),e=a("./_ie8-dom-define"),f=a("./_to-primitive"),g=Object.defineProperty;c.f=a("./_descriptors")?Object.defineProperty:function(a,b,c){if(d(a),b=f(b,!0),d(c),e)try{return g(a,b,c)}catch(h){}if("get"in c||"set"in c)throw TypeError("Accessors not supported!");return"value"in c&&(a[b]=c.value),a}},{"./_an-object":38,"./_descriptors":42,"./_ie8-dom-define":49,"./_to-primitive":55}],53:[function(a,b,c){b.exports=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}}},{}],54:[function(a,b,c){var d,e,f,g=a("./_ctx"),h=a("./_invoke"),i=a("./_html"),j=a("./_dom-create"),k=a("./_global"),l=k.process,m=k.setImmediate,n=k.clearImmediate,o=k.MessageChannel,p=0,q={},r="onreadystatechange",s=function(){var a=+this;if(q.hasOwnProperty(a)){var b=q[a];delete q[a],b()}},t=function(a){s.call(a.data)};m&&n||(m=function(a){for(var b=[],c=1;arguments.length>c;)b.push(arguments[c++]);return q[++p]=function(){h("function"==typeof a?a:Function(a),b)},d(p),p},n=function(a){delete q[a]},"process"==a("./_cof")(l)?d=function(a){l.nextTick(g(s,a,1))}:o?(e=new o,f=e.port2,e.port1.onmessage=t,d=g(f.postMessage,f,1)):k.addEventListener&&"function"==typeof postMessage&&!k.importScripts?(d=function(a){k.postMessage(a+"","*")},k.addEventListener("message",t,!1)):d=r in j("script")?function(a){i.appendChild(j("script"))[r]=function(){i.removeChild(this),s.call(a)}}:function(a){setTimeout(g(s,a,1),0)}),b.exports={set:m,clear:n}},{"./_cof":39,"./_ctx":41,"./_dom-create":43,"./_global":46,"./_html":48,"./_invoke":50}],55:[function(a,b,c){var d=a("./_is-object");b.exports=function(a,b){if(!d(a))return a;var c,e;if(b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;if("function"==typeof(c=a.valueOf)&&!d(e=c.call(a)))return e;if(!b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":51}],56:[function(a,b,c){var d=a("./_export"),e=a("./_task");d(d.G+d.B,{setImmediate:e.set,clearImmediate:e.clear})},{"./_export":44,"./_task":54}],57:[function(a,b,c){(function(a){"use strict";function c(){k=!0;for(var a,b,c=l.length;c;){for(b=l,l=[],a=-1;++a<c;)b[a]();c=l.length}k=!1}function d(a){1!==l.push(a)||k||e()}var e,f=a.MutationObserver||a.WebKitMutationObserver;if(f){var g=0,h=new f(c),i=a.document.createTextNode("");h.observe(i,{characterData:!0}),e=function(){i.data=g=++g%2}}else if(a.setImmediate||"undefined"==typeof a.MessageChannel)e="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var b=a.document.createElement("script");b.onreadystatechange=function(){c(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},a.document.documentElement.appendChild(b)}:function(){setTimeout(c,0)};else{var j=new a.MessageChannel;j.port1.onmessage=c,e=function(){j.port2.postMessage(0)}}var k,l=[];b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],58:[function(a,b,c){"use strict";function d(){}function e(a){if("function"!=typeof a)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,a!==d&&i(this,a)}function f(a,b,c){this.promise=a,"function"==typeof b&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),"function"==typeof c&&(this.onRejected=c,this.callRejected=this.otherCallRejected)}function g(a,b,c){o(function(){var d;try{d=b(c)}catch(e){return p.reject(a,e)}d===a?p.reject(a,new TypeError("Cannot resolve promise with itself")):p.resolve(a,d)})}function h(a){var b=a&&a.then;if(a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof b)return function(){b.apply(a,arguments)}}function i(a,b){function c(b){f||(f=!0,p.reject(a,b))}function d(b){f||(f=!0,p.resolve(a,b))}function e(){b(d,c)}var f=!1,g=j(e);"error"===g.status&&c(g.value)}function j(a,b){var c={};try{c.value=a(b),c.status="success"}catch(d){c.status="error",c.value=d}return c}function k(a){return a instanceof this?a:p.resolve(new this(d),a)}function l(a){var b=new this(d);return p.reject(b,a)}function m(a){function b(a,b){function d(a){g[b]=a,++h!==e||f||(f=!0,p.resolve(j,g))}c.resolve(a).then(d,function(a){f||(f=!0,p.reject(j,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=new Array(e),h=0,i=-1,j=new this(d);++i<e;)b(a[i],i);return j}function n(a){function b(a){c.resolve(a).then(function(a){f||(f=!0,p.resolve(h,a))},function(a){f||(f=!0,p.reject(h,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=-1,h=new this(d);++g<e;)b(a[g]);return h}var o=a("immediate"),p={},q=["REJECTED"],r=["FULFILLED"],s=["PENDING"];b.exports=e,e.prototype["catch"]=function(a){return this.then(null,a)},e.prototype.then=function(a,b){if("function"!=typeof a&&this.state===r||"function"!=typeof b&&this.state===q)return this;var c=new this.constructor(d);if(this.state!==s){var e=this.state===r?a:b;g(c,e,this.outcome)}else this.queue.push(new f(c,a,b));return c},f.prototype.callFulfilled=function(a){p.resolve(this.promise,a)},f.prototype.otherCallFulfilled=function(a){g(this.promise,this.onFulfilled,a)},f.prototype.callRejected=function(a){p.reject(this.promise,a)},f.prototype.otherCallRejected=function(a){g(this.promise,this.onRejected,a)},p.resolve=function(a,b){var c=j(h,b);if("error"===c.status)return p.reject(a,c.value);var d=c.value;if(d)i(a,d);else{a.state=r,a.outcome=b;for(var e=-1,f=a.queue.length;++e<f;)a.queue[e].callFulfilled(b)}return a},p.reject=function(a,b){a.state=q,a.outcome=b;for(var c=-1,d=a.queue.length;++c<d;)a.queue[c].callRejected(b);return a},e.resolve=k,e.reject=l,e.all=m,e.race=n},{immediate:57}],59:[function(a,b,c){"use strict";var d=a("./lib/utils/common").assign,e=a("./lib/deflate"),f=a("./lib/inflate"),g=a("./lib/zlib/constants"),h={};d(h,e,f,g),b.exports=h},{"./lib/deflate":60,"./lib/inflate":61,"./lib/utils/common":62,"./lib/zlib/constants":65}],60:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=i.assign({level:s,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:t,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=h.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==p)throw new Error(k[c]);if(b.header&&h.deflateSetHeader(this.strm,b.header),b.dictionary){var e;if(e="string"==typeof b.dictionary?j.string2buf(b.dictionary):"[object ArrayBuffer]"===m.call(b.dictionary)?new Uint8Array(b.dictionary):b.dictionary,c=h.deflateSetDictionary(this.strm,e),c!==p)throw new Error(k[c]);this._dict_set=!0}}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg||k[c.err];return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}function g(a,b){return b=b||{},b.gzip=!0,e(a,b)}var h=a("./zlib/deflate"),i=a("./utils/common"),j=a("./utils/strings"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=Object.prototype.toString,n=0,o=4,p=0,q=1,r=2,s=-1,t=0,u=8;d.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?o:n,"string"==typeof a?e.input=j.string2buf(a):"[object ArrayBuffer]"===m.call(a)?e.input=new Uint8Array(a):e.input=a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new i.Buf8(f),e.next_out=0,e.avail_out=f),c=h.deflate(e,d),c!==q&&c!==p)return this.onEnd(c),this.ended=!0,!1;0!==e.avail_out&&(0!==e.avail_in||d!==o&&d!==r)||("string"===this.options.to?this.onData(j.buf2binstring(i.shrinkBuf(e.output,e.next_out))):this.onData(i.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==q);return d===o?(c=h.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===p):d!==r||(this.onEnd(p),e.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=d,c.deflate=e,c.deflateRaw=f,c.gzip=g},{"./utils/common":62,"./utils/strings":63,"./zlib/deflate":67,"./zlib/messages":72,"./zlib/zstream":74}],61:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg||k[c.err];return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l,m=this.strm,o=this.options.chunkSize,p=this.options.dictionary,q=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?m.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?m.input=new Uint8Array(a):m.input=a,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new h.Buf8(o),m.next_out=0,m.avail_out=o),c=g.inflate(m,j.Z_NO_FLUSH),c===j.Z_NEED_DICT&&p&&(l="string"==typeof p?i.string2buf(p):"[object ArrayBuffer]"===n.call(p)?new Uint8Array(p):p,c=g.inflateSetDictionary(this.strm,l)),c===j.Z_BUF_ERROR&&q===!0&&(c=j.Z_OK,q=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&c!==j.Z_STREAM_END&&(0!==m.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(m.output,m.next_out),f=m.next_out-e,k=i.buf2string(m.output,e),m.next_out=f,m.avail_out=o-f,f&&h.arraySet(m.output,m.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(q=!0)}while((m.avail_in>0||0===m.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d!==j.Z_SYNC_FLUSH||(this.onEnd(j.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":62,"./utils/strings":63,"./zlib/constants":65,"./zlib/gzheader":68,"./zlib/inflate":70,"./zlib/messages":72,"./zlib/zstream":74}],62:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;b<c;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;b<c;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],63:[function(a,b,c){"use strict";function d(a,b){if(b<65537&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;d<b;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;j<256;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f<h;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=new e.Buf8(i),g=0,f=0;g<i;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),c<128?b[g++]=c:c<2048?(b[g++]=192|c>>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c<d;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;c<h;)if(f=a[c++],f<128)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c<h;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":62}],64:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0;
14
+ }b.exports=d},{}],65:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],66:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h<g;h++)a=a>>>8^e[255&(a^b[h])];return a^-1}var f=d();b.exports=e},{}],67:[function(a,b,c){"use strict";function d(a,b){return a.msg=I[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(E.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){F._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,E.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=G(a.adler,b,e,c):2===a.state.wrap&&(a.adler=H(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-la?a.strstart-(a.w_size-la):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ka,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&f<m);if(d=ka-(m-f),f=m-ka,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-la)){E.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ja)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ja-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ja)););}while(a.lookahead<la&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===J)return ua;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return ua;if(a.strstart-a.block_start>=a.w_size-la&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?ua:ua}function o(a,b){for(var c,d;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c)),a.match_length>=ja)if(d=F._tr_tally(a,a.strstart-a.match_start,a.match_length-ja),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ja){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function p(a,b){for(var c,d,e;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ja-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===U||a.match_length===ja&&a.strstart-a.match_start>4096)&&(a.match_length=ja-1)),a.prev_length>=ja&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ja,d=F._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ja),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ja-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return ua}else if(a.match_available){if(d=F._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return ua}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=F._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ka){if(m(a),a.lookahead<=ka&&b===J)return ua;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ja&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ka;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&e<f);a.match_length=ka-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ja?(c=F._tr_tally(a,1,a.match_length-ja),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===J)return ua;break}if(a.match_length=0,c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function s(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e}function t(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=D[a.level].max_lazy,a.good_match=D[a.level].good_length,a.nice_match=D[a.level].nice_length,a.max_chain_length=D[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ja-1,a.match_available=0,a.ins_h=0}function u(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=$,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new E.Buf16(2*ha),this.dyn_dtree=new E.Buf16(2*(2*fa+1)),this.bl_tree=new E.Buf16(2*(2*ga+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new E.Buf16(ia+1),this.heap=new E.Buf16(2*ea+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new E.Buf16(2*ea+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function v(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=Z,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?na:sa,a.adler=2===b.wrap?0:1,b.last_flush=J,F._tr_init(b),O):d(a,Q)}function w(a){var b=v(a);return b===O&&t(a.state),b}function x(a,b){return a&&a.state?2!==a.state.wrap?Q:(a.state.gzhead=b,O):Q}function y(a,b,c,e,f,g){if(!a)return Q;var h=1;if(b===T&&(b=6),e<0?(h=0,e=-e):e>15&&(h=2,e-=16),f<1||f>_||c!==$||e<8||e>15||b<0||b>9||g<0||g>X)return d(a,Q);8===e&&(e=9);var i=new u;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+ja-1)/ja),i.window=new E.Buf8(2*i.w_size),i.head=new E.Buf16(i.hash_size),i.prev=new E.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new E.Buf8(i.pending_buf_size),i.d_buf=1*i.lit_bufsize,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,w(a)}function z(a,b){return y(a,b,$,aa,ba,Y)}function A(a,b){var c,h,k,l;if(!a||!a.state||b>N||b<0)return a?d(a,Q):Q;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ta&&b!==M)return d(a,0===a.avail_out?S:Q);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===na)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=H(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=oa):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,ya),h.status=sa);else{var m=$+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=V||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ma),m+=31-m%31,h.status=sa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===oa)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=pa)}else h.status=pa;if(h.status===pa)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=qa)}else h.status=qa;if(h.status===qa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=ra)}else h.status=ra;if(h.status===ra&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=sa)):h.status=sa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,O}else if(0===a.avail_in&&e(b)<=e(c)&&b!==M)return d(a,S);if(h.status===ta&&0!==a.avail_in)return d(a,S);if(0!==a.avail_in||0!==h.lookahead||b!==J&&h.status!==ta){var o=h.strategy===V?r(h,b):h.strategy===W?q(h,b):D[h.level].func(h,b);if(o!==wa&&o!==xa||(h.status=ta),o===ua||o===wa)return 0===a.avail_out&&(h.last_flush=-1),O;if(o===va&&(b===K?F._tr_align(h):b!==N&&(F._tr_stored_block(h,0,0,!1),b===L&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,O}return b!==M?O:h.wrap<=0?P:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?O:P)}function B(a){var b;return a&&a.state?(b=a.state.status,b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra&&b!==sa&&b!==ta?d(a,Q):(a.state=null,b===sa?d(a,R):O)):Q}function C(a,b){var c,d,e,g,h,i,j,k,l=b.length;if(!a||!a.state)return Q;if(c=a.state,g=c.wrap,2===g||1===g&&c.status!==na||c.lookahead)return Q;for(1===g&&(a.adler=G(a.adler,b,l,0)),c.wrap=0,l>=c.w_size&&(0===g&&(f(c.head),c.strstart=0,c.block_start=0,c.insert=0),k=new E.Buf8(c.w_size),E.arraySet(k,b,l-c.w_size,c.w_size,0),b=k,l=c.w_size),h=a.avail_in,i=a.next_in,j=a.input,a.avail_in=l,a.next_in=0,a.input=b,m(c);c.lookahead>=ja;){d=c.strstart,e=c.lookahead-(ja-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[d+ja-1])&c.hash_mask,c.prev[d&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=d,d++;while(--e);c.strstart=d,c.lookahead=ja-1,m(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=ja-1,c.match_available=0,a.next_in=i,a.input=j,a.avail_in=h,c.wrap=g,O}var D,E=a("../utils/common"),F=a("./trees"),G=a("./adler32"),H=a("./crc32"),I=a("./messages"),J=0,K=1,L=3,M=4,N=5,O=0,P=1,Q=-2,R=-3,S=-5,T=-1,U=1,V=2,W=3,X=4,Y=0,Z=2,$=8,_=9,aa=15,ba=8,ca=29,da=256,ea=da+1+ca,fa=30,ga=19,ha=2*ea+1,ia=15,ja=3,ka=258,la=ka+ja+1,ma=32,na=42,oa=69,pa=73,qa=91,ra=103,sa=113,ta=666,ua=1,va=2,wa=3,xa=4,ya=3;D=[new s(0,0,0,0,n),new s(4,4,8,4,o),new s(4,5,16,8,o),new s(4,6,32,32,o),new s(4,4,16,16,p),new s(8,16,32,32,p),new s(8,16,128,128,p),new s(8,32,128,256,p),new s(32,128,258,1024,p),new s(32,258,258,4096,p)],c.deflateInit=z,c.deflateInit2=y,c.deflateReset=w,c.deflateResetKeep=v,c.deflateSetHeader=x,c.deflate=A,c.deflateEnd=B,c.deflateSetDictionary=C,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":62,"./adler32":64,"./crc32":66,"./messages":72,"./trees":73}],68:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],69:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(q<w&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,q<w&&(p+=B[f++]<<q,q+=8,q<w&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(n<w){if(z+=l+n-w,w-=n,w<x){x-=w;do C[h++]=o[z++];while(--w);if(z=0,n<x){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(f<g&&h<j);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=f<g?5+(g-f):5-(f-g),a.avail_out=h<j?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],70:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=L,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new s.Buf32(pa),b.distcode=b.distdyn=new s.Buf32(qa),b.sane=1,b.back=-1,D):G}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):G}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=(b>>4)+1,b<48&&(b&=15)),b&&(b<8||b>15)?G:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):G}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==D&&(a.state=null),c):G}function j(a){return i(a,sa)}function k(a){if(ta){var b;for(q=new s.Buf32(512),r=new s.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(w(y,a.lens,0,288,q,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;w(z,a.lens,0,32,r,0,a.work,{bits:5}),ta=!1}a.lencode=q,a.lenbits=9,a.distcode=r,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new s.Buf8(f.wsize)),d>=f.wsize?(s.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),s.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(s.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,r,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new s.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return G;c=a.state,c.mode===W&&(c.mode=X),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=D;a:for(;;)switch(c.mode){case L:if(0===c.wrap){c.mode=X;break}for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0),m=0,n=0,c.mode=M;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=ma;break}if((15&m)!==K){a.msg="unknown compression method",c.mode=ma;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=ma;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?U:W,m=0,n=0;break;case M:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==K){a.msg="unknown compression method",c.mode=ma;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=ma;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=N;case N:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=u(c.check,Ba,4,0)),m=0,n=0,c.mode=O;case O:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=P;case P:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=Q;case Q:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=R;case R:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=S;case S:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=T;case T:if(512&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=ma;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=W;break;case U:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=V;case V:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,F;a.adler=c.check=1,c.mode=W;case W:if(b===B||b===C)break a;case X:if(c.last){m>>>=7&n,n-=7&n,c.mode=ja;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=Y;break;case 1:if(k(c),c.mode=ca,b===C){m>>>=2,n-=2;break a}break;case 2:c.mode=_;break;case 3:a.msg="invalid block type",c.mode=ma}m>>>=2,n-=2;break;case Y:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=ma;break}if(c.length=65535&m,m=0,n=0,c.mode=Z,b===C)break a;case Z:c.mode=$;case $:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;s.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=W;break;case _:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=ma;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.ncode;){for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=w(x,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=ma;break}c.have=0,c.mode=ba;case ba:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(sa<16)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=ma;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=ma;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===ma)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=ma;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=w(y,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=ma;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=w(z,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=ma;break}if(c.mode=ca,b===C)break a;case ca:c.mode=da;case da:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,v(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===W&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ia;break}if(32&ra){c.back=-1,c.mode=W;break}if(64&ra){a.msg="invalid literal/length code",c.mode=ma;break}c.extra=15&ra,c.mode=ea;case ea:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=fa;case fa:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=ma;break}c.offset=sa,c.extra=15&ra,c.mode=ga;case ga:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=ma;break}c.mode=ha;case ha:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=ma;break}q>c.wnext?(q-=c.wnext,r=c.wsize-q):r=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,r=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[r++];while(--q);0===c.length&&(c.mode=da);break;case ia:if(0===j)break a;f[h++]=c.length,j--,c.mode=da;break;case ja:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?u(c.check,f,p,h-p):t(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=ma;break}m=0,n=0}c.mode=ka;case ka:if(c.wrap&&c.flags){for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=ma;break}m=0,n=0}c.mode=la;case la:xa=E;break a;case ma:xa=H;break a;case na:return I;case oa:default:return G}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<ma&&(c.mode<ja||b!==A))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=na,I):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?u(c.check,f,p,a.next_out-p):t(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===W?128:0)+(c.mode===ca||c.mode===Z?256:0),(0===o&&0===p||b===A)&&xa===D&&(xa=J),xa)}function n(a){if(!a||!a.state)return G;var b=a.state;return b.window&&(b.window=null),a.state=null,D}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?G:(c.head=b,b.done=!1,D)):G}function p(a,b){var c,d,e,f=b.length;return a&&a.state?(c=a.state,0!==c.wrap&&c.mode!==V?G:c.mode===V&&(d=1,d=t(d,b,f,0),d!==c.check)?H:(e=l(a,b,f,f))?(c.mode=na,I):(c.havedict=1,D)):G}var q,r,s=a("../utils/common"),t=a("./adler32"),u=a("./crc32"),v=a("./inffast"),w=a("./inftrees"),x=0,y=1,z=2,A=4,B=5,C=6,D=0,E=1,F=2,G=-2,H=-3,I=-4,J=-5,K=8,L=1,M=2,N=3,O=4,P=5,Q=6,R=7,S=8,T=9,U=10,V=11,W=12,X=13,Y=14,Z=15,$=16,_=17,aa=18,ba=19,ca=20,da=21,ea=22,fa=23,ga=24,ha=25,ia=26,ja=27,ka=28,la=29,ma=30,na=31,oa=32,pa=852,qa=592,ra=15,sa=ra,ta=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateSetDictionary=p,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":62,"./adler32":64,"./crc32":66,"./inffast":69,"./inftrees":71}],71:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;D<=e;D++)P[D]=0;for(E=0;E<o;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F<G&&0===P[F];F++);for(H<F&&(H=F),K=1,D=1;D<=e;D++)if(K<<=1,K-=P[D],K<0)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;D<e;D++)Q[D+1]=Q[D]+P[D];for(E=0;E<o;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(;;){z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;I+J<G&&(K-=P[I+J],!(K<=0));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":62}],72:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],73:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length}function f(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b}function g(a){return a<256?ia[a]:ia[256+(a>>>7)]}function h(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function i(a,b,c){a.bi_valid>X-c?(a.bi_buf|=b<<a.bi_valid&65535,h(a,a.bi_buf),a.bi_buf=b>>X-a.bi_valid,a.bi_valid+=c-X):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function j(a,b,c){i(a,c[2*b],c[2*b+1])}function k(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function l(a){16===a.bi_valid?(h(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function m(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;f<=W;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,
15
+ c=a.heap_max+1;c<V;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function n(a,b,c){var d,e,f=new Array(W+1),g=0;for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2*e]=k(f[h]++,h))}}function o(){var a,b,c,d,f,g=new Array(W+1);for(c=0,d=0;d<Q-1;d++)for(ka[d]=c,a=0;a<1<<ba[d];a++)ja[c++]=d;for(ja[c-1]=d,f=0,d=0;d<16;d++)for(la[d]=f,a=0;a<1<<ca[d];a++)ia[f++]=d;for(f>>=7;d<T;d++)for(la[d]=f<<7,a=0;a<1<<ca[d]-7;a++)ia[256+f++]=d;for(b=0;b<=W;b++)g[b]=0;for(a=0;a<=143;)ga[2*a+1]=8,a++,g[8]++;for(;a<=255;)ga[2*a+1]=9,a++,g[9]++;for(;a<=279;)ga[2*a+1]=7,a++,g[7]++;for(;a<=287;)ga[2*a+1]=8,a++,g[8]++;for(n(ga,S+1,g),a=0;a<T;a++)ha[2*a+1]=5,ha[2*a]=k(a,5);ma=new e(ga,ba,R+1,S,W),na=new e(ha,ca,0,T,W),oa=new e(new Array(0),da,0,U,Y)}function p(a){var b;for(b=0;b<S;b++)a.dyn_ltree[2*b]=0;for(b=0;b<T;b++)a.dyn_dtree[2*b]=0;for(b=0;b<U;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*Z]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function q(a){a.bi_valid>8?h(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function r(a,b,c,d){q(a),d&&(h(a,c),h(a,~c)),G.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function s(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function t(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&s(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!s(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function u(a,b,c){var d,e,f,h,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],e=a.pending_buf[a.l_buf+k],k++,0===d?j(a,e,b):(f=ja[e],j(a,f+R+1,b),h=ba[f],0!==h&&(e-=ka[f],i(a,e,h)),d--,f=g(d),j(a,f,c),h=ca[f],0!==h&&(d-=la[f],i(a,d,h)));while(k<a.last_lit);j(a,Z,b)}function v(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=V,c=0;c<i;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=j<2?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)t(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],t(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,t(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],m(a,b),n(f,j,a.bl_count)}function w(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;d<=c;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(h<j?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*$]++):h<=10?a.bl_tree[2*_]++:a.bl_tree[2*aa]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function x(a,b,c){var d,e,f=-1,g=b[1],h=0,k=7,l=4;for(0===g&&(k=138,l=3),d=0;d<=c;d++)if(e=g,g=b[2*(d+1)+1],!(++h<k&&e===g)){if(h<l){do j(a,e,a.bl_tree);while(0!==--h)}else 0!==e?(e!==f&&(j(a,e,a.bl_tree),h--),j(a,$,a.bl_tree),i(a,h-3,2)):h<=10?(j(a,_,a.bl_tree),i(a,h-3,3)):(j(a,aa,a.bl_tree),i(a,h-11,7));h=0,f=e,0===g?(k=138,l=3):e===g?(k=6,l=3):(k=7,l=4)}}function y(a){var b;for(w(a,a.dyn_ltree,a.l_desc.max_code),w(a,a.dyn_dtree,a.d_desc.max_code),v(a,a.bl_desc),b=U-1;b>=3&&0===a.bl_tree[2*ea[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function z(a,b,c,d){var e;for(i(a,b-257,5),i(a,c-1,5),i(a,d-4,4),e=0;e<d;e++)i(a,a.bl_tree[2*ea[e]+1],3);x(a,a.dyn_ltree,b-1),x(a,a.dyn_dtree,c-1)}function A(a){var b,c=4093624447;for(b=0;b<=31;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return I;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return J;for(b=32;b<R;b++)if(0!==a.dyn_ltree[2*b])return J;return I}function B(a){pa||(o(),pa=!0),a.l_desc=new f(a.dyn_ltree,ma),a.d_desc=new f(a.dyn_dtree,na),a.bl_desc=new f(a.bl_tree,oa),a.bi_buf=0,a.bi_valid=0,p(a)}function C(a,b,c,d){i(a,(L<<1)+(d?1:0),3),r(a,b,c,!0)}function D(a){i(a,M<<1,3),j(a,Z,ga),l(a)}function E(a,b,c,d){var e,f,g=0;a.level>0?(a.strm.data_type===K&&(a.strm.data_type=A(a)),v(a,a.l_desc),v(a,a.d_desc),g=y(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,f<=e&&(e=f)):e=f=c+5,c+4<=e&&b!==-1?C(a,b,c,d):a.strategy===H||f===e?(i(a,(M<<1)+(d?1:0),3),u(a,ga,ha)):(i(a,(N<<1)+(d?1:0),3),z(a,a.l_desc.max_code+1,a.d_desc.max_code+1,g+1),u(a,a.dyn_ltree,a.dyn_dtree)),p(a),d&&q(a)}function F(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ja[c]+R+1)]++,a.dyn_dtree[2*g(b)]++),a.last_lit===a.lit_bufsize-1}var G=a("../utils/common"),H=4,I=0,J=1,K=2,L=0,M=1,N=2,O=3,P=258,Q=29,R=256,S=R+1+Q,T=30,U=19,V=2*S+1,W=15,X=16,Y=7,Z=256,$=16,_=17,aa=18,ba=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ca=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fa=512,ga=new Array(2*(S+2));d(ga);var ha=new Array(2*T);d(ha);var ia=new Array(fa);d(ia);var ja=new Array(P-O+1);d(ja);var ka=new Array(Q);d(ka);var la=new Array(T);d(la);var ma,na,oa,pa=!1;c._tr_init=B,c._tr_stored_block=C,c._tr_flush_block=E,c._tr_tally=F,c._tr_align=D},{"../utils/common":62}],74:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}]},{},[10])(10)});
16
+
17
+ /* FileSaver.js
18
+ * A saveAs() FileSaver implementation.
19
+ * 1.3.8
20
+ * 2018-03-22 14:03:47
21
+ *
22
+ * By Eli Grey, https://eligrey.com
23
+ * License: MIT
24
+ * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
25
+ */
26
+
27
+ /*global self */
28
+ /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
29
+
30
+ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/src/FileSaver.js */
31
+
32
+ var saveAs = saveAs || (function(view) {
33
+ "use strict";
34
+ // IE <10 is explicitly unsupported
35
+ if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
36
+ return;
37
+ }
38
+ var
39
+ doc = view.document
40
+ // only get URL when necessary in case Blob.js hasn't overridden it yet
41
+ , get_URL = function() {
42
+ return view.URL || view.webkitURL || view;
43
+ }
44
+ , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
45
+ , can_use_save_link = "download" in save_link
46
+ , click = function(node) {
47
+ var event = new MouseEvent("click");
48
+ node.dispatchEvent(event);
49
+ }
50
+ , is_safari = /constructor/i.test(view.HTMLElement) || view.safari
51
+ , is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
52
+ , setImmediate = view.setImmediate || view.setTimeout
53
+ , throw_outside = function(ex) {
54
+ setImmediate(function() {
55
+ throw ex;
56
+ }, 0);
57
+ }
58
+ , force_saveable_type = "application/octet-stream"
59
+ // the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to
60
+ , arbitrary_revoke_timeout = 1000 * 40 // in ms
61
+ , revoke = function(file) {
62
+ var revoker = function() {
63
+ if (typeof file === "string") { // file is an object URL
64
+ get_URL().revokeObjectURL(file);
65
+ } else { // file is a File
66
+ file.remove();
67
+ }
68
+ };
69
+ setTimeout(revoker, arbitrary_revoke_timeout);
70
+ }
71
+ , dispatch = function(filesaver, event_types, event) {
72
+ event_types = [].concat(event_types);
73
+ var i = event_types.length;
74
+ while (i--) {
75
+ var listener = filesaver["on" + event_types[i]];
76
+ if (typeof listener === "function") {
77
+ try {
78
+ listener.call(filesaver, event || filesaver);
79
+ } catch (ex) {
80
+ throw_outside(ex);
81
+ }
82
+ }
83
+ }
84
+ }
85
+ , auto_bom = function(blob) {
86
+ // prepend BOM for UTF-8 XML and text/* types (including HTML)
87
+ // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
88
+ if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
89
+ return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});
90
+ }
91
+ return blob;
92
+ }
93
+ , FileSaver = function(blob, name, no_auto_bom) {
94
+ if (!no_auto_bom) {
95
+ blob = auto_bom(blob);
96
+ }
97
+ // First try a.download, then web filesystem, then object URLs
98
+ var
99
+ filesaver = this
100
+ , type = blob.type
101
+ , force = type === force_saveable_type
102
+ , object_url
103
+ , dispatch_all = function() {
104
+ dispatch(filesaver, "writestart progress write writeend".split(" "));
105
+ }
106
+ // on any filesys errors revert to saving with object URLs
107
+ , fs_error = function() {
108
+ if ((is_chrome_ios || (force && is_safari)) && view.FileReader) {
109
+ // Safari doesn't allow downloading of blob urls
110
+ var reader = new FileReader();
111
+ reader.onloadend = function() {
112
+ var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;');
113
+ var popup = view.open(url, '_blank');
114
+ if(!popup) view.location.href = url;
115
+ url=undefined; // release reference before dispatching
116
+ filesaver.readyState = filesaver.DONE;
117
+ dispatch_all();
118
+ };
119
+ reader.readAsDataURL(blob);
120
+ filesaver.readyState = filesaver.INIT;
121
+ return;
122
+ }
123
+ // don't create more object URLs than needed
124
+ if (!object_url) {
125
+ object_url = get_URL().createObjectURL(blob);
126
+ }
127
+ if (force) {
128
+ view.location.href = object_url;
129
+ } else {
130
+ var opened = view.open(object_url, "_blank");
131
+ if (!opened) {
132
+ // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html
133
+ view.location.href = object_url;
134
+ }
135
+ }
136
+ filesaver.readyState = filesaver.DONE;
137
+ dispatch_all();
138
+ revoke(object_url);
139
+ }
140
+ ;
141
+ filesaver.readyState = filesaver.INIT;
142
+
143
+ if (can_use_save_link) {
144
+ object_url = get_URL().createObjectURL(blob);
145
+ setImmediate(function() {
146
+ save_link.href = object_url;
147
+ save_link.download = name;
148
+ click(save_link);
149
+ dispatch_all();
150
+ revoke(object_url);
151
+ filesaver.readyState = filesaver.DONE;
152
+ }, 0);
153
+ return;
154
+ }
155
+
156
+ fs_error();
157
+ }
158
+ , FS_proto = FileSaver.prototype
159
+ , saveAs = function(blob, name, no_auto_bom) {
160
+ return new FileSaver(blob, name || blob.name || "download", no_auto_bom);
161
+ }
162
+ ;
163
+
164
+ // IE 10+ (native saveAs)
165
+ if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
166
+ return function(blob, name, no_auto_bom) {
167
+ name = name || blob.name || "download";
168
+
169
+ if (!no_auto_bom) {
170
+ blob = auto_bom(blob);
171
+ }
172
+ return navigator.msSaveOrOpenBlob(blob, name);
173
+ };
174
+ }
175
+
176
+ // todo: detect chrome extensions & packaged apps
177
+ //save_link.target = "_blank";
178
+
179
+ FS_proto.abort = function(){};
180
+ FS_proto.readyState = FS_proto.INIT = 0;
181
+ FS_proto.WRITING = 1;
182
+ FS_proto.DONE = 2;
183
+
184
+ FS_proto.error =
185
+ FS_proto.onwritestart =
186
+ FS_proto.onprogress =
187
+ FS_proto.onwrite =
188
+ FS_proto.onabort =
189
+ FS_proto.onerror =
190
+ FS_proto.onwriteend =
191
+ null;
192
+
193
+ return saveAs;
194
+ }(
195
+ typeof self !== "undefined" && self
196
+ || typeof window !== "undefined" && window
197
+ || this
198
+ ));
admin/js/main.js CHANGED
@@ -1,261 +1,276 @@
1
- var changes = false;
2
- jQuery(document).ready(function($){
3
- $('.superpwa-colorpicker').wpColorPicker(); // Color picker
4
- $('.superpwa-colorpicker').wpColorPicker('option','change',function(event, ui) {
5
- changes = true;}); // When Color picker changes
6
- $('.superpwa-icon-upload').click(function(e) { // Application Icon upload
7
- e.preventDefault();
8
- var superpwa_meda_uploader = wp.media({
9
- title: 'Application Icon',
10
- button: {
11
- text: 'Select Icon'
12
- },
13
- multiple: false // Set this to true to allow multiple files to be selected
14
- })
15
- .on('select', function() {
16
- var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
17
- $('.superpwa-icon').val(attachment.url);
18
- })
19
- .open();
20
- });
21
- $('.superpwa-splash-icon-upload').click(function(e) { // Splash Screen Icon upload
22
- e.preventDefault();
23
- var superpwa_meda_uploader = wp.media({
24
- title: 'Splash Screen Icon',
25
- button: {
26
- text: 'Select Icon'
27
- },
28
- multiple: false // Set this to true to allow multiple files to be selected
29
- })
30
- .on('select', function() {
31
- var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
32
- $('.superpwa-splash-icon').val(attachment.url);
33
- })
34
- .open();
35
- });
36
- $('.screenshots-icon-upload').click(function(e) { // Application Icon upload
37
- e.preventDefault();
38
- var superpwa_meda_uploader = wp.media({
39
- title: 'Screenshots',
40
- button: {
41
- text: 'Select Icon'
42
- },
43
- multiple: false // Set this to true to allow multiple files to be selected
44
- })
45
- .on('select', function() {
46
- var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
47
- $('.superpwa-screenshots').val(attachment.url);
48
- })
49
- .open();
50
- });
51
- $('.superpwa-app-short-name').on('input', function(e) { // Warn when app_short_name exceeds 12 characters.
52
- if ( $('.superpwa-app-short-name').val().length > 15 ) {
53
- $('.superpwa-app-short-name').css({'color': '#dc3232'});
54
- $('#superpwa-app-short-name-limit').css({'color': '#dc3232'});
55
- } else {
56
- $('.superpwa-app-short-name').css({'color': 'inherit'});
57
- $('#superpwa-app-short-name-limit').css({'color': 'inherit'});
58
- }
59
- });
60
- $('#superpwa_newsletter').submit(function(e){
61
- //e.preventDefault();
62
- var form = jQuery(this);
63
- var email = form.find('input[name="newsletter-email"]').val();
64
- jQuery.post(ajaxurl, {action:'superpwa_newsletter_submit',email:email},
65
- function(data) {}
66
- );
67
- return true;
68
- });
69
- $('.superpwa_newsletter_hide').click(function(e){
70
- //e.preventDefault();
71
- jQuery('.superpwa-newsletter-wrapper').css("display", "none");
72
- var form = jQuery(this);
73
- jQuery.post(ajaxurl, {action:'superpwa_newsletter_hide_form'},
74
- function(data) {}
75
- );
76
- return true;
77
- });
78
- //Hide superPWA other menus
79
- $('#toplevel_page_superpwa').find('ul').find('li').each(function(v, i){
80
- arr = ['superpwa', 'settings', 'add-ons', 'license', 'upgrade to pro'];
81
- var txt = $(this).text().toLowerCase();
82
- if($.inArray( txt, arr ) ===-1){
83
- $(this).hide();
84
- }
85
- })
86
- //Hide superPWA other menus
87
- const urlParams = new URLSearchParams(window.location.search);
88
- arr = ['superpwa', 'superpwa-addons', 'superpwa-upgrade']
89
- if($.inArray( urlParams.get('page'), arr ) ===-1){
90
- var heading = $('.wrap').find('h1').html()
91
- $('.wrap').find('h1').html('<a href="./admin.php?page=superpwa-addons" style="text-decoration:none;color: #5b5b5d;">SuperPWA Add-ons</a> > ' + heading)
92
- }
93
- });
94
- var image = '';
95
- document.addEventListener('DOMContentLoaded', function() {
96
- var elmFileUpload = document.getElementById('upload_apple_function');
97
- if (elmFileUpload) {
98
- elmFileUpload.addEventListener('change', superpwaOnFileUploadChange, false);
99
- }
100
- });
101
-
102
- function superpwaOnFileUploadChange(e) {
103
- var file = e.target.files[0];
104
- var fr = new FileReader();
105
- fr.onload = function(e) {
106
- image = e.target.result;
107
- document.getElementById('thumbnail').src = e.target.result;
108
- document.getElementById('thumbnail').style.display = 'none';
109
- };
110
- fr.readAsDataURL(file);
111
- document.getElementById('aft_img_gen').innerHTML = "Generating Images Please Wait...";
112
- setTimeout(function(){ superpwaGetZip(); }, 300);
113
- }
114
-
115
- function superpwaGetZip() {
116
- jQuery('#aft_img_gen').text("Generating Images Please Wait...");
117
- if(image==''){
118
- alert("Please Select Image"); jQuery('#superpwa-apple-splash-message').text("");
119
- return;
120
- }
121
- var zip = new JSZip();
122
- var folder = zip.folder('super_splash_screens');
123
- var canvas = document.createElement('canvas'),
124
- ctx = canvas.getContext('2d');
125
-
126
- var img = new Image();
127
- img.src = image;
128
- var phones = JSON.parse(document.getElementById('iosScreen-data').innerHTML)
129
- Object.keys(phones).forEach(function(key, index) {
130
- var phone = phones[key];
131
- var ws=key.split("x")[0];
132
- var hs=key.split("x")[1];
133
- canvas.width=ws;
134
- canvas.height=hs;
135
- var wi=img.width;
136
- var hi=img.height;
137
- var wnew=wi;
138
- var hnew=hi;
139
-
140
- if (document.getElementById('center-mode').checked == true) {
141
- ctx.fillStyle = document.getElementById('ios-splash-color').value;
142
- ctx.fillRect(0,0,canvas.width,canvas.height);
143
- }else{
144
- var rs = ws / hs;
145
- var ri = wi / hi;
146
- var scale = rs > ri ? (ws / wi) : (hs / hi);
147
- wnew = wi * scale;
148
- hnew = hi * scale;
149
- }
150
-
151
- ctx.drawImage(img,(ws-wnew)/2,(hs-hnew)/2,wnew,hnew);
152
- var img2=canvas.toDataURL();
153
- folder.file(phone.file,img2.split(';base64,')[1],{base64:true});
154
- });
155
- zip.generateAsync({
156
- type: 'blob'
157
- }).then(function(content) {
158
- //saveAs(content, 'splashscreens.zip');
159
-
160
- var fileName = 'splashscreens.zip';
161
- var fileObj = new File([content], fileName, {
162
- type : 'application/zip'
163
- });
164
- console.log('File object created:', fileObj);
165
- var fd = new FormData();
166
- fd.append('fileName', fileName);
167
- fd.append('file', fileObj);
168
- fd.append('action', 'superpwa_splashscreen_uploader');
169
- fd.append('security_nonce', superpwaIosScreen.nonce);
170
-
171
-
172
- // POST Ajax call
173
- jQuery.ajax({
174
- type: 'POST',
175
- url: ajaxurl,
176
- data: fd,
177
- dataType: 'json',
178
- success: function (data) {
179
- console.log(data)
180
- jQuery('#thumbnail').css("display", "block");
181
- jQuery('#aft_img_gen').text("Splash Screen Images Generated Successfully");
182
- jQuery('#aft_img_gen').css({"color":"green","margin-bottom":"20px"});
183
- jQuery('#submit_splash_screen').trigger('click');
184
- //window.location.reload();
185
- },
186
- cache: false,
187
- contentType: false,
188
- processData: false
189
- })
190
- });
191
- }
192
-
193
- // Settings unsaved alert message
194
- var tablinks,select_tag,input_tag,button_tag;
195
- tablinks = document.getElementsByClassName("spwa-tablinks");
196
- select_tag = document.getElementsByTagName("select");
197
- input_tag = document.getElementsByTagName("input");
198
- button_tag = document.getElementsByTagName("button");
199
-
200
- if(input_tag){
201
- for(var h=0; h<input_tag.length;h++ ){
202
- input_tag[h].addEventListener( 'change', function(e) {
203
- //console.log(changes);
204
- changes = true;
205
- // console.log(changes);
206
- });
207
- }
208
- }
209
- if(select_tag){
210
- for(var j=0; j<select_tag.length;j++ ){
211
- select_tag[j].addEventListener( 'change', function(e) {
212
- changes = true;
213
- });
214
- }
215
- }
216
- if(button_tag){
217
- for(var k=0; k<button_tag.length;k++ ){
218
- button_tag[k].addEventListener( 'click', function(e) {
219
- changes = true;
220
- });
221
- }
222
- }
223
-
224
- if(tablinks){
225
- for(var l=0; l<tablinks.length;l++ ){
226
- tablinks[l].addEventListener( 'click', function(e) {
227
-
228
- if(changes){
229
- window.onbeforeunload = function(e) {
230
- return "Sure you want to leave?";
231
- };
232
- }
233
-
234
- });
235
- }
236
- }
237
-
238
- //Reset settings
239
- jQuery(document).on("click",".superpwa-reset-settings", function(e){
240
- //$('.superpwa-reset-settings').click(function(e){
241
- e.preventDefault();
242
-
243
- var reset_confirm = confirm("Are you sure?");
244
-
245
- if(reset_confirm == true){
246
-
247
- jQuery.ajax({
248
- type: "POST",
249
- url:ajaxurl,
250
- dataType: "json",
251
- data:{action:"superpwa_reset_all_settings", superpwa_security_nonce:superpwa_obj.superpwa_security_nonce},
252
- success:function(response){
253
- setTimeout(function(){ location.reload(); }, 1000);
254
- },
255
- error: function(response){
256
- console.log(response);
257
- }
258
- });
259
-
260
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  });
1
+ var changes = false;
2
+ jQuery(document).ready(function($){
3
+ $('.superpwa-colorpicker').wpColorPicker(); // Color picker
4
+ $('.superpwa-colorpicker').wpColorPicker('option','change',function(event, ui) {
5
+ changes = true;}); // When Color picker changes
6
+ $('.superpwa-icon-upload').click(function(e) { // Application Icon upload
7
+ e.preventDefault();
8
+ var superpwa_meda_uploader = wp.media({
9
+ title: 'Application Icon',
10
+ button: {
11
+ text: 'Select Icon'
12
+ },
13
+ multiple: false // Set this to true to allow multiple files to be selected
14
+ })
15
+ .on('select', function() {
16
+ var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
17
+ $('.superpwa-icon').val(attachment.url);
18
+ })
19
+ .open();
20
+ });
21
+ $('.superpwa-splash-icon-upload').click(function(e) { // Splash Screen Icon upload
22
+ e.preventDefault();
23
+ var superpwa_meda_uploader = wp.media({
24
+ title: 'Splash Screen Icon',
25
+ button: {
26
+ text: 'Select Icon'
27
+ },
28
+ multiple: false // Set this to true to allow multiple files to be selected
29
+ })
30
+ .on('select', function() {
31
+ var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
32
+ $('.superpwa-splash-icon').val(attachment.url);
33
+ })
34
+ .open();
35
+ });
36
+ $('.superpwa-screenshots-upload').click(function(e) { // Application Icon upload
37
+ e.preventDefault();
38
+ var superpwa_meda_uploader = wp.media({
39
+ title: 'Screenshots',
40
+ button: {
41
+ text: 'Select Icon'
42
+ },
43
+ multiple: true // Set this to true to allow multiple files to be selected
44
+ })
45
+ .on('select', function() {
46
+ var attachment = superpwa_meda_uploader.state().get('selection').toJSON();
47
+ var len= attachment.length;
48
+ var screenshots=[];
49
+ if(len>8)
50
+ {
51
+ alert('Screenshots must be less than or equal to 8');
52
+ return;
53
+ }
54
+ if(len>0)
55
+ {
56
+ for(var i=0;i<len;i++)
57
+ {
58
+ screenshots.push(attachment[i].url);
59
+ }
60
+ }
61
+
62
+ $('.superpwa-screenshots').val(screenshots.join(','));
63
+ })
64
+ .open();
65
+ });
66
+ $('.superpwa-app-short-name').on('input', function(e) { // Warn when app_short_name exceeds 12 characters.
67
+ if ( $('.superpwa-app-short-name').val().length > 15 ) {
68
+ $('.superpwa-app-short-name').css({'color': '#dc3232'});
69
+ $('#superpwa-app-short-name-limit').css({'color': '#dc3232'});
70
+ } else {
71
+ $('.superpwa-app-short-name').css({'color': 'inherit'});
72
+ $('#superpwa-app-short-name-limit').css({'color': 'inherit'});
73
+ }
74
+ });
75
+ $('#superpwa_newsletter').submit(function(e){
76
+ //e.preventDefault();
77
+ var form = jQuery(this);
78
+ var email = form.find('input[name="newsletter-email"]').val();
79
+ jQuery.post(ajaxurl, {action:'superpwa_newsletter_submit',email:email},
80
+ function(data) {}
81
+ );
82
+ return true;
83
+ });
84
+ $('.superpwa_newsletter_hide').click(function(e){
85
+ //e.preventDefault();
86
+ jQuery('.superpwa-newsletter-wrapper').css("display", "none");
87
+ var form = jQuery(this);
88
+ jQuery.post(ajaxurl, {action:'superpwa_newsletter_hide_form'},
89
+ function(data) {}
90
+ );
91
+ return true;
92
+ });
93
+ //Hide superPWA other menus
94
+ $('#toplevel_page_superpwa').find('ul').find('li').each(function(v, i){
95
+ arr = ['superpwa', 'settings', 'add-ons', 'license', 'upgrade to pro'];
96
+ var txt = $(this).text().toLowerCase();
97
+ if($.inArray( txt, arr ) ===-1){
98
+ $(this).hide();
99
+ }
100
+ })
101
+ //Hide superPWA other menus
102
+ const urlParams = new URLSearchParams(window.location.search);
103
+ arr = ['superpwa', 'superpwa-addons', 'superpwa-upgrade']
104
+ if($.inArray( urlParams.get('page'), arr ) ===-1){
105
+ var heading = $('.wrap').find('h1').html()
106
+ $('.wrap').find('h1').html('<a href="./admin.php?page=superpwa-addons" style="text-decoration:none;color: #5b5b5d;">SuperPWA Add-ons</a> > ' + heading)
107
+ }
108
+ });
109
+ var image = '';
110
+ document.addEventListener('DOMContentLoaded', function() {
111
+ var elmFileUpload = document.getElementById('upload_apple_function');
112
+ if (elmFileUpload) {
113
+ elmFileUpload.addEventListener('change', superpwaOnFileUploadChange, false);
114
+ }
115
+ });
116
+
117
+ function superpwaOnFileUploadChange(e) {
118
+ var file = e.target.files[0];
119
+ var fr = new FileReader();
120
+ fr.onload = function(e) {
121
+ image = e.target.result;
122
+ document.getElementById('thumbnail').src = e.target.result;
123
+ document.getElementById('thumbnail').style.display = 'none';
124
+ };
125
+ fr.readAsDataURL(file);
126
+ document.getElementById('aft_img_gen').innerHTML = "Generating Images Please Wait...";
127
+ setTimeout(function(){ superpwaGetZip(); }, 300);
128
+ }
129
+
130
+ function superpwaGetZip() {
131
+ jQuery('#aft_img_gen').text("Generating Images Please Wait...");
132
+ if(image==''){
133
+ alert("Please Select Image"); jQuery('#superpwa-apple-splash-message').text("");
134
+ return;
135
+ }
136
+ var zip = new JSZip();
137
+ var folder = zip.folder('super_splash_screens');
138
+ var canvas = document.createElement('canvas'),
139
+ ctx = canvas.getContext('2d');
140
+
141
+ var img = new Image();
142
+ img.src = image;
143
+ var phones = JSON.parse(document.getElementById('iosScreen-data').innerHTML)
144
+ Object.keys(phones).forEach(function(key, index) {
145
+ var phone = phones[key];
146
+ var ws=key.split("x")[0];
147
+ var hs=key.split("x")[1];
148
+ canvas.width=ws;
149
+ canvas.height=hs;
150
+ var wi=img.width;
151
+ var hi=img.height;
152
+ var wnew=wi;
153
+ var hnew=hi;
154
+
155
+ if (document.getElementById('center-mode').checked == true) {
156
+ ctx.fillStyle = document.getElementById('ios-splash-color').value;
157
+ ctx.fillRect(0,0,canvas.width,canvas.height);
158
+ }else{
159
+ var rs = ws / hs;
160
+ var ri = wi / hi;
161
+ var scale = rs > ri ? (ws / wi) : (hs / hi);
162
+ wnew = wi * scale;
163
+ hnew = hi * scale;
164
+ }
165
+
166
+ ctx.drawImage(img,(ws-wnew)/2,(hs-hnew)/2,wnew,hnew);
167
+ var img2=canvas.toDataURL();
168
+ folder.file(phone.file,img2.split(';base64,')[1],{base64:true});
169
+ });
170
+ zip.generateAsync({
171
+ type: 'blob'
172
+ }).then(function(content) {
173
+ //saveAs(content, 'splashscreens.zip');
174
+
175
+ var fileName = 'splashscreens.zip';
176
+ var fileObj = new File([content], fileName, {
177
+ type : 'application/zip'
178
+ });
179
+ console.log('File object created:', fileObj);
180
+ var fd = new FormData();
181
+ fd.append('fileName', fileName);
182
+ fd.append('file', fileObj);
183
+ fd.append('action', 'superpwa_splashscreen_uploader');
184
+ fd.append('security_nonce', superpwaIosScreen.nonce);
185
+
186
+
187
+ // POST Ajax call
188
+ jQuery.ajax({
189
+ type: 'POST',
190
+ url: ajaxurl,
191
+ data: fd,
192
+ dataType: 'json',
193
+ success: function (data) {
194
+ console.log(data)
195
+ jQuery('#thumbnail').css("display", "block");
196
+ jQuery('#aft_img_gen').text("Splash Screen Images Generated Successfully");
197
+ jQuery('#aft_img_gen').css({"color":"green","margin-bottom":"20px"});
198
+ jQuery('#submit_splash_screen').trigger('click');
199
+ //window.location.reload();
200
+ },
201
+ cache: false,
202
+ contentType: false,
203
+ processData: false
204
+ })
205
+ });
206
+ }
207
+
208
+ // Settings unsaved alert message
209
+ var tablinks,select_tag,input_tag,button_tag;
210
+ tablinks = document.getElementsByClassName("spwa-tablinks");
211
+ select_tag = document.getElementsByTagName("select");
212
+ input_tag = document.getElementsByTagName("input");
213
+ button_tag = document.getElementsByTagName("button");
214
+
215
+ if(input_tag){
216
+ for(var h=0; h<input_tag.length;h++ ){
217
+ input_tag[h].addEventListener( 'change', function(e) {
218
+ //console.log(changes);
219
+ changes = true;
220
+ // console.log(changes);
221
+ });
222
+ }
223
+ }
224
+ if(select_tag){
225
+ for(var j=0; j<select_tag.length;j++ ){
226
+ select_tag[j].addEventListener( 'change', function(e) {
227
+ changes = true;
228
+ });
229
+ }
230
+ }
231
+ if(button_tag){
232
+ for(var k=0; k<button_tag.length;k++ ){
233
+ button_tag[k].addEventListener( 'click', function(e) {
234
+ changes = true;
235
+ });
236
+ }
237
+ }
238
+
239
+ if(tablinks){
240
+ for(var l=0; l<tablinks.length;l++ ){
241
+ tablinks[l].addEventListener( 'click', function(e) {
242
+
243
+ if(changes){
244
+ window.onbeforeunload = function(e) {
245
+ return "Sure you want to leave?";
246
+ };
247
+ }
248
+
249
+ });
250
+ }
251
+ }
252
+
253
+ //Reset settings
254
+ jQuery(document).on("click",".superpwa-reset-settings", function(e){
255
+ //$('.superpwa-reset-settings').click(function(e){
256
+ e.preventDefault();
257
+
258
+ var reset_confirm = confirm("Are you sure?");
259
+
260
+ if(reset_confirm == true){
261
+
262
+ jQuery.ajax({
263
+ type: "POST",
264
+ url:ajaxurl,
265
+ dataType: "json",
266
+ data:{action:"superpwa_reset_all_settings", superpwa_security_nonce:superpwa_obj.superpwa_security_nonce},
267
+ success:function(response){
268
+ setTimeout(function(){ location.reload(); }, 1000);
269
+ },
270
+ error: function(response){
271
+ console.log(response);
272
+ }
273
+ });
274
+
275
+ }
276
  });
admin/js/pre-cache.js CHANGED
@@ -1,25 +1,25 @@
1
- jQuery(document).ready(function($){
2
- $('#precaching_automatic').click(function(e){
3
-
4
- if(e.target.checked == true){
5
- // Code in the case checkbox is checked.
6
- console.log('checked');
7
- $('#pre-automatic-suboption').removeClass('hide').addClass('show');
8
- } else {
9
- // Code in the case checkbox is NOT checked.
10
- $('#pre-automatic-suboption').removeClass('show').addClass('hide');
11
- }
12
- });
13
-
14
- $('#precaching_manual').click(function(e){
15
-
16
- if(e.target.checked == true){
17
- // Code in the case checkbox is checked.
18
- $('#pre-manual-suboption').removeClass('hide').addClass('show');
19
- } else {
20
- // Code in the case checkbox is NOT checked.
21
- $('#pre-manual-suboption').removeClass('show').addClass('hide');
22
- }
23
- });
24
-
25
  });
1
+ jQuery(document).ready(function($){
2
+ $('#precaching_automatic').click(function(e){
3
+
4
+ if(e.target.checked == true){
5
+ // Code in the case checkbox is checked.
6
+ console.log('checked');
7
+ $('#pre-automatic-suboption').removeClass('hide').addClass('show');
8
+ } else {
9
+ // Code in the case checkbox is NOT checked.
10
+ $('#pre-automatic-suboption').removeClass('show').addClass('hide');
11
+ }
12
+ });
13
+
14
+ $('#precaching_manual').click(function(e){
15
+
16
+ if(e.target.checked == true){
17
+ // Code in the case checkbox is checked.
18
+ $('#pre-manual-suboption').removeClass('hide').addClass('show');
19
+ } else {
20
+ // Code in the case checkbox is NOT checked.
21
+ $('#pre-manual-suboption').removeClass('show').addClass('hide');
22
+ }
23
+ });
24
+
25
  });
admin/js/superpwa-ptr-lib.min.js CHANGED
@@ -1,8 +1,8 @@
1
- /*!
2
- * superpwa_pulltorefreshjs v0.1.19
3
- */
4
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).PullToRefresh=t()}(this,function(){"use strict";var e={pullStartY:null,pullMoveY:null,handlers:[],styleEl:null,events:null,dist:0,state:"pending",timeout:null,distResisted:0,supportsPassive:!1,supportsPointerEvents:!!window.PointerEvent};try{window.addEventListener("test",null,{get passive(){e.supportsPassive=!0}})}catch(e){}var t,n={setupDOM:function(t){if(!t.ptrElement){var n=document.createElement("div");t.mainElement!==document.body?t.mainElement.parentNode.insertBefore(n,t.mainElement):document.body.insertBefore(n,document.body.firstChild),n.classList.add(t.classPrefix+"ptr"),n.innerHTML=t.getMarkup().replace(/__PREFIX__/g,t.classPrefix),t.ptrElement=n,"function"==typeof t.onInit&&t.onInit(t),e.styleEl||(e.styleEl=document.createElement("style"),e.styleEl.setAttribute("id","pull-to-refresh-js-style"),document.head.appendChild(e.styleEl)),e.styleEl.textContent=t.getStyles().replace(/__PREFIX__/g,t.classPrefix).replace(/\s+/g," ")}return t},onReset:function(t){t.ptrElement.classList.remove(t.classPrefix+"refresh"),t.ptrElement.style[t.cssProp]="0px",setTimeout(function(){t.ptrElement&&t.ptrElement.parentNode&&(t.ptrElement.parentNode.removeChild(t.ptrElement),t.ptrElement=null),e.state="pending"},t.refreshTimeout)},update:function(t){var n=t.ptrElement.querySelector("."+t.classPrefix+"icon"),s=t.ptrElement.querySelector("."+t.classPrefix+"text");n&&("refreshing"===e.state?n.innerHTML=t.iconRefreshing:n.innerHTML=t.iconArrow),s&&("releasing"===e.state&&(s.innerHTML=t.instructionsReleaseToRefresh),"pulling"!==e.state&&"pending"!==e.state||(s.innerHTML=t.instructionsPullToRefresh),"refreshing"===e.state&&(s.innerHTML=t.instructionsRefreshing))}},s=function(t){return e.pointerEventsEnabled&&e.supportsPointerEvents?t.screenY:t.touches[0].screenY},r=function(){var r;function i(t){var i=e.handlers.filter(function(e){return e.contains(t.target)})[0];e.enable=!!i,i&&"pending"===e.state&&(r=n.setupDOM(i),i.shouldPullToRefresh()&&(e.pullStartY=s(t)),clearTimeout(e.timeout),n.update(i))}function o(t){r&&r.ptrElement&&e.enable&&(e.pullStartY?e.pullMoveY=s(t):r.shouldPullToRefresh()&&(e.pullStartY=s(t)),"refreshing"!==e.state?("pending"===e.state&&(r.ptrElement.classList.add(r.classPrefix+"pull"),e.state="pulling",n.update(r)),e.pullStartY&&e.pullMoveY&&(e.dist=e.pullMoveY-e.pullStartY),e.distExtra=e.dist-r.distIgnore,e.distExtra>0&&(t.cancelable&&t.preventDefault(),r.ptrElement.style[r.cssProp]=e.distResisted+"px",e.distResisted=r.resistanceFunction(e.distExtra/r.distThreshold)*Math.min(r.distMax,e.distExtra),"pulling"===e.state&&e.distResisted>r.distThreshold&&(r.ptrElement.classList.add(r.classPrefix+"release"),e.state="releasing",n.update(r)),"releasing"===e.state&&e.distResisted<r.distThreshold&&(r.ptrElement.classList.remove(r.classPrefix+"release"),e.state="pulling",n.update(r)))):t.cancelable&&r.shouldPullToRefresh()&&e.pullStartY<e.pullMoveY&&t.preventDefault())}function l(){if(r&&r.ptrElement&&e.enable){if(clearTimeout(t),t=setTimeout(function(){r&&r.ptrElement&&"pending"===e.state&&n.onReset(r)},500),"releasing"===e.state&&e.distResisted>r.distThreshold)e.state="refreshing",r.ptrElement.style[r.cssProp]=r.distReload+"px",r.ptrElement.classList.add(r.classPrefix+"refresh"),e.timeout=setTimeout(function(){var e=r.onRefresh(function(){return n.onReset(r)});e&&"function"==typeof e.then&&e.then(function(){return n.onReset(r)}),e||r.onRefresh.length||n.onReset(r)},r.refreshTimeout);else{if("refreshing"===e.state)return;r.ptrElement.style[r.cssProp]="0px",e.state="pending"}n.update(r),r.ptrElement.classList.remove(r.classPrefix+"release"),r.ptrElement.classList.remove(r.classPrefix+"pull"),e.pullStartY=e.pullMoveY=null,e.dist=e.distResisted=0}}function a(){r&&r.mainElement.classList.toggle(r.classPrefix+"top",r.shouldPullToRefresh())}var d=e.supportsPassive?{passive:e.passive||!1}:void 0;return e.pointerEventsEnabled&&e.supportsPointerEvents?(window.addEventListener("pointerup",l),window.addEventListener("pointerdown",i),window.addEventListener("pointermove",o,d)):(window.addEventListener("touchend",l),window.addEventListener("touchstart",i),window.addEventListener("touchmove",o,d)),window.addEventListener("scroll",a),{onTouchEnd:l,onTouchStart:i,onTouchMove:o,onScroll:a,destroy:function(){e.pointerEventsEnabled&&e.supportsPointerEvents?(window.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",l),window.removeEventListener("pointermove",o,d)):(window.removeEventListener("touchstart",i),window.removeEventListener("touchend",l),window.removeEventListener("touchmove",o,d)),window.removeEventListener("scroll",a)}}},i={distThreshold:60,distMax:80,distReload:50,distIgnore:0,mainElement:"body",triggerElement:"body",ptrElement:".ptr",classPrefix:"ptr--",cssProp:"min-height",iconArrow:"&#8675;",iconRefreshing:"&hellip;",instructionsPullToRefresh:superpwa_ptr_obj.instrPullToRefresh,instructionsReleaseToRefresh:superpwa_ptr_obj.instrReleaseToRefresh,instructionsRefreshing:superpwa_ptr_obj.instrRefreshing,refreshTimeout:500,getMarkup:function(){return'\n<div class="__PREFIX__box">\n <div class="__PREFIX__content">\n <div class="__PREFIX__icon"></div>\n <div class="__PREFIX__text"></div>\n </div>\n</div>\n'},getStyles:function(){return"\n.__PREFIX__ptr {\n box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.12);\n pointer-events: none;\n font-size: "+superpwa_ptr_obj.instrptr_font_size+";\n font-weight: bold;\n top: 0;\n height: 0;\n transition: height 0.3s, min-height 0.3s;\n text-align: center;\n width: 100%;\n overflow: hidden;\n display: flex;\n align-items: flex-end;\n align-content: stretch;\n}\n\n.__PREFIX__box {\n padding: 10px;\n flex-basis: 100%;\n}\n\n.__PREFIX__pull {\n transition: none;\n}\n\n.__PREFIX__text {\n margin-top: .33em;\n color: "+superpwa_ptr_obj.instrptr_font_color+";\n}\n\n.__PREFIX__icon {\n color: "+superpwa_ptr_obj.instrptr_font_color+";\n transition: transform .3s;\n}\n\n/*\nWhen at the top of the page, disable vertical overscroll so passive touch\nlisteners can take over.\n*/\n.__PREFIX__top {\n touch-action: pan-x pan-down pinch-zoom;\n}\n\n.__PREFIX__release .__PREFIX__icon {\n transform: rotate(180deg);\n}\n"},onInit:function(){},onRefresh:function(){return location.reload()},resistanceFunction:function(e){return Math.min(1,e/2.5)},shouldPullToRefresh:function(){return!window.scrollY}},o=["mainElement","ptrElement","triggerElement"],l=function(t){var n={};return Object.keys(i).forEach(function(e){n[e]=t[e]||i[e]}),n.refreshTimeout="number"==typeof t.refreshTimeout?t.refreshTimeout:i.refreshTimeout,o.forEach(function(e){"string"==typeof n[e]&&(n[e]=document.querySelector(n[e]))}),e.events||(e.events=r()),n.contains=function(e){return n.triggerElement.contains(e)},n.destroy=function(){clearTimeout(e.timeout);var t=e.handlers.indexOf(n);e.handlers.splice(t,1)},n};return{setPassiveMode:function(t){e.passive=t},setPointerEventsMode:function(t){e.pointerEventsEnabled=t},destroyAll:function(){e.events&&(e.events.destroy(),e.events=null),e.handlers.forEach(function(e){e.destroy()})},init:function(t){void 0===t&&(t={});var n=l(t);return e.handlers.push(n),n},_:{setupHandler:l,setupEvents:r,setupDOM:n.setupDOM,onReset:n.onReset,update:n.update}}});
5
- //# sourceMappingURL=index.umd.min.js.map
6
- PullToRefresh.init({
7
- onRefresh: function() { location.reload(true); },
8
  });
1
+ /*!
2
+ * superpwa_pulltorefreshjs v0.1.19
3
+ */
4
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).PullToRefresh=t()}(this,function(){"use strict";var e={pullStartY:null,pullMoveY:null,handlers:[],styleEl:null,events:null,dist:0,state:"pending",timeout:null,distResisted:0,supportsPassive:!1,supportsPointerEvents:!!window.PointerEvent};try{window.addEventListener("test",null,{get passive(){e.supportsPassive=!0}})}catch(e){}var t,n={setupDOM:function(t){if(!t.ptrElement){var n=document.createElement("div");t.mainElement!==document.body?t.mainElement.parentNode.insertBefore(n,t.mainElement):document.body.insertBefore(n,document.body.firstChild),n.classList.add(t.classPrefix+"ptr"),n.innerHTML=t.getMarkup().replace(/__PREFIX__/g,t.classPrefix),t.ptrElement=n,"function"==typeof t.onInit&&t.onInit(t),e.styleEl||(e.styleEl=document.createElement("style"),e.styleEl.setAttribute("id","pull-to-refresh-js-style"),document.head.appendChild(e.styleEl)),e.styleEl.textContent=t.getStyles().replace(/__PREFIX__/g,t.classPrefix).replace(/\s+/g," ")}return t},onReset:function(t){t.ptrElement.classList.remove(t.classPrefix+"refresh"),t.ptrElement.style[t.cssProp]="0px",setTimeout(function(){t.ptrElement&&t.ptrElement.parentNode&&(t.ptrElement.parentNode.removeChild(t.ptrElement),t.ptrElement=null),e.state="pending"},t.refreshTimeout)},update:function(t){var n=t.ptrElement.querySelector("."+t.classPrefix+"icon"),s=t.ptrElement.querySelector("."+t.classPrefix+"text");n&&("refreshing"===e.state?n.innerHTML=t.iconRefreshing:n.innerHTML=t.iconArrow),s&&("releasing"===e.state&&(s.innerHTML=t.instructionsReleaseToRefresh),"pulling"!==e.state&&"pending"!==e.state||(s.innerHTML=t.instructionsPullToRefresh),"refreshing"===e.state&&(s.innerHTML=t.instructionsRefreshing))}},s=function(t){return e.pointerEventsEnabled&&e.supportsPointerEvents?t.screenY:t.touches[0].screenY},r=function(){var r;function i(t){var i=e.handlers.filter(function(e){return e.contains(t.target)})[0];e.enable=!!i,i&&"pending"===e.state&&(r=n.setupDOM(i),i.shouldPullToRefresh()&&(e.pullStartY=s(t)),clearTimeout(e.timeout),n.update(i))}function o(t){r&&r.ptrElement&&e.enable&&(e.pullStartY?e.pullMoveY=s(t):r.shouldPullToRefresh()&&(e.pullStartY=s(t)),"refreshing"!==e.state?("pending"===e.state&&(r.ptrElement.classList.add(r.classPrefix+"pull"),e.state="pulling",n.update(r)),e.pullStartY&&e.pullMoveY&&(e.dist=e.pullMoveY-e.pullStartY),e.distExtra=e.dist-r.distIgnore,e.distExtra>0&&(t.cancelable&&t.preventDefault(),r.ptrElement.style[r.cssProp]=e.distResisted+"px",e.distResisted=r.resistanceFunction(e.distExtra/r.distThreshold)*Math.min(r.distMax,e.distExtra),"pulling"===e.state&&e.distResisted>r.distThreshold&&(r.ptrElement.classList.add(r.classPrefix+"release"),e.state="releasing",n.update(r)),"releasing"===e.state&&e.distResisted<r.distThreshold&&(r.ptrElement.classList.remove(r.classPrefix+"release"),e.state="pulling",n.update(r)))):t.cancelable&&r.shouldPullToRefresh()&&e.pullStartY<e.pullMoveY&&t.preventDefault())}function l(){if(r&&r.ptrElement&&e.enable){if(clearTimeout(t),t=setTimeout(function(){r&&r.ptrElement&&"pending"===e.state&&n.onReset(r)},500),"releasing"===e.state&&e.distResisted>r.distThreshold)e.state="refreshing",r.ptrElement.style[r.cssProp]=r.distReload+"px",r.ptrElement.classList.add(r.classPrefix+"refresh"),e.timeout=setTimeout(function(){var e=r.onRefresh(function(){return n.onReset(r)});e&&"function"==typeof e.then&&e.then(function(){return n.onReset(r)}),e||r.onRefresh.length||n.onReset(r)},r.refreshTimeout);else{if("refreshing"===e.state)return;r.ptrElement.style[r.cssProp]="0px",e.state="pending"}n.update(r),r.ptrElement.classList.remove(r.classPrefix+"release"),r.ptrElement.classList.remove(r.classPrefix+"pull"),e.pullStartY=e.pullMoveY=null,e.dist=e.distResisted=0}}function a(){r&&r.mainElement.classList.toggle(r.classPrefix+"top",r.shouldPullToRefresh())}var d=e.supportsPassive?{passive:e.passive||!1}:void 0;return e.pointerEventsEnabled&&e.supportsPointerEvents?(window.addEventListener("pointerup",l),window.addEventListener("pointerdown",i),window.addEventListener("pointermove",o,d)):(window.addEventListener("touchend",l),window.addEventListener("touchstart",i),window.addEventListener("touchmove",o,d)),window.addEventListener("scroll",a),{onTouchEnd:l,onTouchStart:i,onTouchMove:o,onScroll:a,destroy:function(){e.pointerEventsEnabled&&e.supportsPointerEvents?(window.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",l),window.removeEventListener("pointermove",o,d)):(window.removeEventListener("touchstart",i),window.removeEventListener("touchend",l),window.removeEventListener("touchmove",o,d)),window.removeEventListener("scroll",a)}}},i={distThreshold:60,distMax:80,distReload:50,distIgnore:0,mainElement:"body",triggerElement:"body",ptrElement:".ptr",classPrefix:"ptr--",cssProp:"min-height",iconArrow:"&#8675;",iconRefreshing:"&hellip;",instructionsPullToRefresh:superpwa_ptr_obj.instrPullToRefresh,instructionsReleaseToRefresh:superpwa_ptr_obj.instrReleaseToRefresh,instructionsRefreshing:superpwa_ptr_obj.instrRefreshing,refreshTimeout:500,getMarkup:function(){return'\n<div class="__PREFIX__box">\n <div class="__PREFIX__content">\n <div class="__PREFIX__icon"></div>\n <div class="__PREFIX__text"></div>\n </div>\n</div>\n'},getStyles:function(){return"\n.__PREFIX__ptr {\n box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.12);\n pointer-events: none;\n font-size: "+superpwa_ptr_obj.instrptr_font_size+";\n font-weight: bold;\n top: 0;\n height: 0;\n transition: height 0.3s, min-height 0.3s;\n text-align: center;\n width: 100%;\n overflow: hidden;\n display: flex;\n align-items: flex-end;\n align-content: stretch;\n}\n\n.__PREFIX__box {\n padding: 10px;\n flex-basis: 100%;\n}\n\n.__PREFIX__pull {\n transition: none;\n}\n\n.__PREFIX__text {\n margin-top: .33em;\n color: "+superpwa_ptr_obj.instrptr_font_color+";\n}\n\n.__PREFIX__icon {\n color: "+superpwa_ptr_obj.instrptr_font_color+";\n transition: transform .3s;\n}\n\n/*\nWhen at the top of the page, disable vertical overscroll so passive touch\nlisteners can take over.\n*/\n.__PREFIX__top {\n touch-action: pan-x pan-down pinch-zoom;\n}\n\n.__PREFIX__release .__PREFIX__icon {\n transform: rotate(180deg);\n}\n"},onInit:function(){},onRefresh:function(){return location.reload()},resistanceFunction:function(e){return Math.min(1,e/2.5)},shouldPullToRefresh:function(){return!window.scrollY}},o=["mainElement","ptrElement","triggerElement"],l=function(t){var n={};return Object.keys(i).forEach(function(e){n[e]=t[e]||i[e]}),n.refreshTimeout="number"==typeof t.refreshTimeout?t.refreshTimeout:i.refreshTimeout,o.forEach(function(e){"string"==typeof n[e]&&(n[e]=document.querySelector(n[e]))}),e.events||(e.events=r()),n.contains=function(e){return n.triggerElement.contains(e)},n.destroy=function(){clearTimeout(e.timeout);var t=e.handlers.indexOf(n);e.handlers.splice(t,1)},n};return{setPassiveMode:function(t){e.passive=t},setPointerEventsMode:function(t){e.pointerEventsEnabled=t},destroyAll:function(){e.events&&(e.events.destroy(),e.events=null),e.handlers.forEach(function(e){e.destroy()})},init:function(t){void 0===t&&(t={});var n=l(t);return e.handlers.push(n),n},_:{setupHandler:l,setupEvents:r,setupDOM:n.setupDOM,onReset:n.onReset,update:n.update}}});
5
+ //# sourceMappingURL=index.umd.min.js.map
6
+ PullToRefresh.init({
7
+ onRefresh: function() { location.reload(true); },
8
  });
admin/make-better-admin.css CHANGED
@@ -1,42 +1,42 @@
1
- /* makebetter admin css*/
2
-
3
- /**
4
- PLUGINS ADMIN PAGE
5
- */
6
- #superpwa-reloaded-feedback-overlay {
7
- /* Height & width depends on how you want to reveal the overlay (see JS below) */
8
- height: 100%;
9
- width: 100%;
10
- position: fixed; /* Stay in place */
11
- z-index: 10000; /* Sit on top */
12
- left: 0;
13
- top: 0;
14
- background-color: rgb(120,120,120); /* Black fallback color */
15
- background-color: rgba(0,0,0, 0.5); /* Black w/opacity */
16
- }
17
- #superpwa-reloaded-feedback-content {
18
- position: relative;
19
- top: 25%; /* 25% from the top */
20
- width: 500px;
21
- max-width: 100%;
22
- margin: auto;
23
- margin-top: 30px; /* 30px top margin to avoid conflict with the close button on smaller screens */
24
- max-height: 50%;
25
- padding: 20px;
26
- background-color: #fff;
27
- overflow-y: auto;
28
- }
29
- .mb-box{display: none;width:100%;}
30
- .superpwa-for-wp-feedback-not-deactivate { display: block; text-align: right; }
31
-
32
- #superpwa-reloaded-feedback-content h3{
33
- margin:5px;
34
- font-size: 1em;
35
- }
36
-
37
- @media screen and (max-width:400px){
38
- #superpwa-reloaded-feedback-content {
39
- padding:0px;
40
- padding-bottom:50px;
41
- }
42
  }
1
+ /* makebetter admin css*/
2
+
3
+ /**
4
+ PLUGINS ADMIN PAGE
5
+ */
6
+ #superpwa-reloaded-feedback-overlay {
7
+ /* Height & width depends on how you want to reveal the overlay (see JS below) */
8
+ height: 100%;
9
+ width: 100%;
10
+ position: fixed; /* Stay in place */
11
+ z-index: 10000; /* Sit on top */
12
+ left: 0;
13
+ top: 0;
14
+ background-color: rgb(120,120,120); /* Black fallback color */
15
+ background-color: rgba(0,0,0, 0.5); /* Black w/opacity */
16
+ }
17
+ #superpwa-reloaded-feedback-content {
18
+ position: relative;
19
+ top: 25%; /* 25% from the top */
20
+ width: 500px;
21
+ max-width: 100%;
22
+ margin: auto;
23
+ margin-top: 30px; /* 30px top margin to avoid conflict with the close button on smaller screens */
24
+ max-height: 50%;
25
+ padding: 20px;
26
+ background-color: #fff;
27
+ overflow-y: auto;
28
+ }
29
+ .mb-box{display: none;width:100%;}
30
+ .superpwa-for-wp-feedback-not-deactivate { display: block; text-align: right; }
31
+
32
+ #superpwa-reloaded-feedback-content h3{
33
+ margin:5px;
34
+ font-size: 1em;
35
+ }
36
+
37
+ @media screen and (max-width:400px){
38
+ #superpwa-reloaded-feedback-content {
39
+ padding:0px;
40
+ padding-bottom:50px;
41
+ }
42
  }
admin/make-better-admin.js CHANGED
@@ -1,82 +1,82 @@
1
- var strict;
2
-
3
- jQuery(document).ready(function ($) {
4
- /**
5
- * DEACTIVATION FEEDBACK FORM
6
- */
7
- // show overlay when clicked on "deactivate"
8
- superpwa_deactivate_link = $('.wp-admin.plugins-php tr[data-slug="super-progressive-web-apps"] .row-actions .deactivate a');
9
- superpwa_deactivate_link_url = superpwa_deactivate_link.attr('href');
10
-
11
- superpwa_deactivate_link.click(function (e) {
12
- e.preventDefault();
13
-
14
- // only show feedback form once per 30 days
15
- var c_value = superpwa_admin_get_cookie("superpwa_hide_deactivate_feedback");
16
-
17
- if (c_value === undefined) {
18
- $('#superpwa-reloaded-feedback-overlay').show();
19
- } else {
20
- // click on the link
21
- window.location.href = superpwa_deactivate_link_url;
22
- }
23
- });
24
- // show text fields
25
- $('#superpwa-reloaded-feedback-content input[type="radio"]').click(function () {
26
- // show text field if there is one
27
- var inputValue = $(this).attr("value");
28
- var targetBox = $("." + inputValue);
29
- $(".mb-box").not(targetBox).hide();
30
- $(targetBox).show();
31
- });
32
- // send form or close it
33
- $('#superpwa-reloaded-feedback-content .button').click(function (e) {
34
- e.preventDefault();
35
- // set cookie for 30 days
36
- var exdate = new Date();
37
- exdate.setSeconds(exdate.getSeconds() + 2592000);
38
- document.cookie = "superpwa_hide_deactivate_feedback=1; expires=" + exdate.toUTCString() + "; path=/";
39
-
40
- $('#superpwa-reloaded-feedback-overlay').hide();
41
- if ('superpwa-reloaded-feedback-submit' === this.id) {
42
- // Send form data
43
- $.ajax({
44
- type: 'POST',
45
- url: ajaxurl,
46
- dataType: 'json',
47
- data: {
48
- action: 'superpwa_send_feedback',
49
- data: $('#superpwa-reloaded-feedback-content form').serialize()
50
- },
51
- complete: function (MLHttpRequest, textStatus, errorThrown) {
52
- // deactivate the plugin and close the popup
53
- $('#superpwa-reloaded-feedback-overlay').remove();
54
- window.location.href = superpwa_deactivate_link_url;
55
-
56
- }
57
- });
58
- } else {
59
- $('#superpwa-reloaded-feedback-overlay').remove();
60
- window.location.href = superpwa_deactivate_link_url;
61
- }
62
- });
63
- // close form without doing anything
64
- $('.superpwa-for-wp-feedback-not-deactivate').click(function (e) {
65
- $('#superpwa-reloaded-feedback-overlay').hide();
66
- });
67
-
68
- function superpwa_admin_get_cookie (name) {
69
- var i, x, y, superpwa_cookies = document.cookie.split( ";" );
70
- for (i = 0; i < superpwa_cookies.length; i++)
71
- {
72
- x = superpwa_cookies[i].substr( 0, superpwa_cookies[i].indexOf( "=" ) );
73
- y = superpwa_cookies[i].substr( superpwa_cookies[i].indexOf( "=" ) + 1 );
74
- x = x.replace( /^\s+|\s+$/g, "" );
75
- if (x === name)
76
- {
77
- return unescape( y );
78
- }
79
- }
80
- }
81
-
82
  }); // document ready
1
+ var strict;
2
+
3
+ jQuery(document).ready(function ($) {
4
+ /**
5
+ * DEACTIVATION FEEDBACK FORM
6
+ */
7
+ // show overlay when clicked on "deactivate"
8
+ superpwa_deactivate_link = $('.wp-admin.plugins-php tr[data-slug="super-progressive-web-apps"] .row-actions .deactivate a');
9
+ superpwa_deactivate_link_url = superpwa_deactivate_link.attr('href');
10
+
11
+ superpwa_deactivate_link.click(function (e) {
12
+ e.preventDefault();
13
+
14
+ // only show feedback form once per 30 days
15
+ var c_value = superpwa_admin_get_cookie("superpwa_hide_deactivate_feedback");
16
+
17
+ if (c_value === undefined) {
18
+ $('#superpwa-reloaded-feedback-overlay').show();
19
+ } else {
20
+ // click on the link
21
+ window.location.href = superpwa_deactivate_link_url;
22
+ }
23
+ });
24
+ // show text fields
25
+ $('#superpwa-reloaded-feedback-content input[type="radio"]').click(function () {
26
+ // show text field if there is one
27
+ var inputValue = $(this).attr("value");
28
+ var targetBox = $("." + inputValue);
29
+ $(".mb-box").not(targetBox).hide();
30
+ $(targetBox).show();
31
+ });
32
+ // send form or close it
33
+ $('#superpwa-reloaded-feedback-content .button').click(function (e) {
34
+ e.preventDefault();
35
+ // set cookie for 30 days
36
+ var exdate = new Date();
37
+ exdate.setSeconds(exdate.getSeconds() + 2592000);
38
+ document.cookie = "superpwa_hide_deactivate_feedback=1; expires=" + exdate.toUTCString() + "; path=/";
39
+
40
+ $('#superpwa-reloaded-feedback-overlay').hide();
41
+ if ('superpwa-reloaded-feedback-submit' === this.id) {
42
+ // Send form data
43
+ $.ajax({
44
+ type: 'POST',
45
+ url: ajaxurl,
46
+ dataType: 'json',
47
+ data: {
48
+ action: 'superpwa_send_feedback',
49
+ data: $('#superpwa-reloaded-feedback-content form').serialize()
50
+ },
51
+ complete: function (MLHttpRequest, textStatus, errorThrown) {
52
+ // deactivate the plugin and close the popup
53
+ $('#superpwa-reloaded-feedback-overlay').remove();
54
+ window.location.href = superpwa_deactivate_link_url;
55
+
56
+ }
57
+ });
58
+ } else {
59
+ $('#superpwa-reloaded-feedback-overlay').remove();
60
+ window.location.href = superpwa_deactivate_link_url;
61
+ }
62
+ });
63
+ // close form without doing anything
64
+ $('.superpwa-for-wp-feedback-not-deactivate').click(function (e) {
65
+ $('#superpwa-reloaded-feedback-overlay').hide();
66
+ });
67
+
68
+ function superpwa_admin_get_cookie (name) {
69
+ var i, x, y, superpwa_cookies = document.cookie.split( ";" );
70
+ for (i = 0; i < superpwa_cookies.length; i++)
71
+ {
72
+ x = superpwa_cookies[i].substr( 0, superpwa_cookies[i].indexOf( "=" ) );
73
+ y = superpwa_cookies[i].substr( superpwa_cookies[i].indexOf( "=" ) + 1 );
74
+ x = x.replace( /^\s+|\s+$/g, "" );
75
+ if (x === name)
76
+ {
77
+ return unescape( y );
78
+ }
79
+ }
80
+ }
81
+
82
  }); // document ready
admin/mb-helper-function.php CHANGED
@@ -1,115 +1,115 @@
1
- <?php
2
-
3
-
4
- // Exit if accessed directly
5
- if( !defined( 'ABSPATH' ) )
6
- exit;
7
-
8
- /**
9
- * Helper method to check if user is in the plugins page.
10
- *
11
- * @author
12
- * @since 1.4.0
13
- *
14
- * @return bool
15
- */
16
- function superpwa_is_plugins_page() {
17
- global $pagenow;
18
-
19
- return ( 'plugins.php' === $pagenow );
20
- }
21
-
22
- /**
23
- * display deactivation logic on plugins page
24
- *
25
- * @since 1.4.0
26
- */
27
-
28
-
29
- function superpwa_add_deactivation_feedback_modal() {
30
-
31
-
32
- if( !is_admin() && !superpwa_is_plugins_page()) {
33
- return;
34
- }
35
-
36
- $current_user = wp_get_current_user();
37
- if( !($current_user instanceof WP_User) ) {
38
- $email = '';
39
- } else {
40
- $email = trim( $current_user->user_email );
41
- }
42
-
43
- require_once SUPERPWA_PATH_ABS."admin/deactivate-feedback.php";
44
-
45
- }
46
-
47
- /**
48
- * send feedback via email
49
- *
50
- * @since 1.4.0
51
- */
52
- function superpwa_send_feedback() {
53
-
54
- if( isset( $_POST['data'] ) ) {
55
- parse_str( $_POST['data'], $form );
56
- }
57
-
58
- $text = '';
59
- if( isset( $form['superpwa_disable_text'] ) ) {
60
- $text = implode( "\n\r", $form['superpwa_disable_text'] );
61
- }
62
-
63
- $headers = array();
64
-
65
- $from = isset( $form['superpwa_disable_from'] ) ? $form['superpwa_disable_from'] : '';
66
- if( $from ) {
67
- $headers[] = "From: $from";
68
- $headers[] = "Reply-To: $from";
69
- }
70
-
71
- $subject = isset( $form['superpwa_disable_reason'] ) ? $form['superpwa_disable_reason'] : '(no reason given)';
72
-
73
- $subject = $subject.' - Super Progressive Web Apps';
74
-
75
- if($subject == 'technical - Super Progressive Web Apps'){
76
-
77
- $text = trim($text);
78
-
79
- if(!empty($text)){
80
-
81
- $text = 'technical issue description: '.$text;
82
-
83
- }else{
84
-
85
- $text = 'no description: '.$text;
86
- }
87
-
88
- }
89
-
90
- $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
91
-
92
- die();
93
- }
94
- add_action( 'wp_ajax_superpwa_send_feedback', 'superpwa_send_feedback' );
95
-
96
-
97
-
98
- add_action( 'admin_enqueue_scripts', 'superpwa_enqueue_makebetter_email_js' );
99
-
100
- function superpwa_enqueue_makebetter_email_js(){
101
-
102
- if( !is_admin() && !superpwa_is_plugins_page()) {
103
- return;
104
- }
105
-
106
- wp_enqueue_script( 'superpwa-make-better-js', SUPERPWA_PATH_SRC . 'admin/make-better-admin.js', array( 'jquery' ), SUPERPWA_VERSION);
107
-
108
- wp_enqueue_style( 'superpwa-make-better-css', SUPERPWA_PATH_SRC . 'admin/make-better-admin.css', false , SUPERPWA_VERSION);
109
- }
110
-
111
- if( is_admin() && superpwa_is_plugins_page()) {
112
- add_filter('admin_footer', 'superpwa_add_deactivation_feedback_modal');
113
- }
114
-
115
-
1
+ <?php
2
+ // Exit if accessed directly
3
+ if( !defined( 'ABSPATH' ) )
4
+ exit;
5
+
6
+ /**
7
+ * Helper method to check if user is in the plugins page.
8
+ *
9
+ * @author
10
+ * @since 1.4.0
11
+ *
12
+ * @return bool
13
+ */
14
+ function superpwa_is_plugins_page() {
15
+ global $pagenow;
16
+
17
+ return ( 'plugins.php' === $pagenow );
18
+ }
19
+
20
+ /**
21
+ * display deactivation logic on plugins page
22
+ *
23
+ * @since 1.4.0
24
+ */
25
+
26
+
27
+ function superpwa_add_deactivation_feedback_modal() {
28
+
29
+
30
+ if( !is_admin() && !superpwa_is_plugins_page()) {
31
+ return;
32
+ }
33
+
34
+ $current_user = wp_get_current_user();
35
+ if( !($current_user instanceof WP_User) ) {
36
+ $email = '';
37
+ } else {
38
+ $email = trim( $current_user->user_email );
39
+ }
40
+
41
+ require_once SUPERPWA_PATH_ABS."admin/deactivate-feedback.php";
42
+
43
+ }
44
+
45
+ /**
46
+ * send feedback via email
47
+ *
48
+ * @since 1.4.0
49
+ */
50
+ function superpwa_send_feedback() {
51
+
52
+ if( isset( $_POST['data'] ) ) {
53
+ parse_str( $_POST['data'], $form );
54
+ }
55
+
56
+ if ( ! wp_verify_nonce( $form['superpwa_deactivate_nonce'], 'superpwa-deactivate-nonce' ) ) {
57
+ // nonce is not valid.
58
+ die( __( 'Security check', 'superpwa-for-wp' ) );
59
+ }
60
+
61
+ $text = '';
62
+ if( isset( $form['superpwa_disable_text'] ) ) {
63
+ $text = implode( "\n\r", $form['superpwa_disable_text'] );
64
+ }
65
+
66
+ $headers = array();
67
+
68
+ $from = isset( $form['superpwa_disable_from'] ) ? $form['superpwa_disable_from'] : '';
69
+ if( $from ) {
70
+ $headers[] = "From: $from";
71
+ $headers[] = "Reply-To: $from";
72
+ }
73
+
74
+ $subject = isset( $form['superpwa_disable_reason'] ) ? $form['superpwa_disable_reason'] : '(no reason given)';
75
+
76
+ $subject = $subject.' - Super Progressive Web Apps';
77
+
78
+ if($subject == 'technical - Super Progressive Web Apps'){
79
+
80
+ $text = trim($text);
81
+
82
+ if(!empty($text)){
83
+
84
+ $text = 'technical issue description: '.$text;
85
+
86
+ }else{
87
+
88
+ $text = 'no description: '.$text;
89
+ }
90
+
91
+ }
92
+
93
+ $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
94
+
95
+ die();
96
+ }
97
+ add_action( 'wp_ajax_superpwa_send_feedback', 'superpwa_send_feedback' );
98
+
99
+ add_action( 'admin_enqueue_scripts', 'superpwa_enqueue_makebetter_email_js' );
100
+
101
+ function superpwa_enqueue_makebetter_email_js(){
102
+
103
+ if( !is_admin() && !superpwa_is_plugins_page()) {
104
+ return;
105
+ }
106
+
107
+ wp_enqueue_script( 'superpwa-make-better-js', SUPERPWA_PATH_SRC . 'admin/make-better-admin.js', array( 'jquery' ), SUPERPWA_VERSION);
108
+
109
+ wp_enqueue_style( 'superpwa-make-better-css', SUPERPWA_PATH_SRC . 'admin/make-better-admin.css', false , SUPERPWA_VERSION);
110
+ }
111
+
112
+ if( is_admin() && superpwa_is_plugins_page()) {
113
+ add_filter('admin_footer', 'superpwa_add_deactivation_feedback_modal');
114
+ }
115
+
composer.json CHANGED
@@ -1,27 +1,27 @@
1
- {
2
- "name": "superpwa/super-progressive-web-apps",
3
- "description": "Super Progressive Web Apps WordPress plugin",
4
- "type": "wordpress-plugin",
5
- "license": "GPL-2.0-or-later",
6
- "authors": [
7
- {
8
- "name": "Arun Basil Lal",
9
- "email": "arun@superpwa.com"
10
- },
11
- {
12
- "name": "Jose Varghese",
13
- "email": "jose@superpwa.com"
14
- },
15
- {
16
- "name": "Maria Daniel Deepak",
17
- "email": "daniel@danieldeepak.com"
18
- }
19
- ],
20
- "minimum-stability": "stable",
21
- "require": {},
22
- "require-dev": {
23
- "squizlabs/php_codesniffer": "^3.3",
24
- "wp-coding-standards/wpcs": "^1.2",
25
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0"
26
- }
27
- }
1
+ {
2
+ "name": "superpwa/super-progressive-web-apps",
3
+ "description": "Super Progressive Web Apps WordPress plugin",
4
+ "type": "wordpress-plugin",
5
+ "license": "GPL-2.0-or-later",
6
+ "authors": [
7
+ {
8
+ "name": "Arun Basil Lal",
9
+ "email": "arun@superpwa.com"
10
+ },
11
+ {
12
+ "name": "Jose Varghese",
13
+ "email": "jose@superpwa.com"
14
+ },
15
+ {
16
+ "name": "Maria Daniel Deepak",
17
+ "email": "daniel@danieldeepak.com"
18
+ }
19
+ ],
20
+ "minimum-stability": "stable",
21
+ "require": {},
22
+ "require-dev": {
23
+ "squizlabs/php_codesniffer": "^3.3",
24
+ "wp-coding-standards/wpcs": "^1.2",
25
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0"
26
+ }
27
+ }
composer.lock CHANGED
@@ -1,178 +1,178 @@
1
- {
2
- "_readme": [
3
- "This file locks the dependencies of your project to a known state",
4
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
- "This file is @generated automatically"
6
- ],
7
- "content-hash": "79c1036666580515751ce8911524cb95",
8
- "packages": [],
9
- "packages-dev": [
10
- {
11
- "name": "dealerdirect/phpcodesniffer-composer-installer",
12
- "version": "v0.5.0",
13
- "source": {
14
- "type": "git",
15
- "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
16
- "reference": "e749410375ff6fb7a040a68878c656c2e610b132"
17
- },
18
- "dist": {
19
- "type": "zip",
20
- "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
21
- "reference": "e749410375ff6fb7a040a68878c656c2e610b132",
22
- "shasum": ""
23
- },
24
- "require": {
25
- "composer-plugin-api": "^1.0",
26
- "php": "^5.3|^7",
27
- "squizlabs/php_codesniffer": "^2|^3"
28
- },
29
- "require-dev": {
30
- "composer/composer": "*",
31
- "phpcompatibility/php-compatibility": "^9.0",
32
- "sensiolabs/security-checker": "^4.1.0"
33
- },
34
- "type": "composer-plugin",
35
- "extra": {
36
- "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
37
- },
38
- "autoload": {
39
- "psr-4": {
40
- "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
41
- }
42
- },
43
- "notification-url": "https://packagist.org/downloads/",
44
- "license": [
45
- "MIT"
46
- ],
47
- "authors": [
48
- {
49
- "name": "Franck Nijhof",
50
- "email": "franck.nijhof@dealerdirect.com",
51
- "homepage": "http://www.frenck.nl",
52
- "role": "Developer / IT Manager"
53
- }
54
- ],
55
- "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
56
- "homepage": "http://www.dealerdirect.com",
57
- "keywords": [
58
- "PHPCodeSniffer",
59
- "PHP_CodeSniffer",
60
- "code quality",
61
- "codesniffer",
62
- "composer",
63
- "installer",
64
- "phpcs",
65
- "plugin",
66
- "qa",
67
- "quality",
68
- "standard",
69
- "standards",
70
- "style guide",
71
- "stylecheck",
72
- "tests"
73
- ],
74
- "time": "2018-10-26T13:21:45+00:00"
75
- },
76
- {
77
- "name": "squizlabs/php_codesniffer",
78
- "version": "3.3.2",
79
- "source": {
80
- "type": "git",
81
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
82
- "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
83
- },
84
- "dist": {
85
- "type": "zip",
86
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
87
- "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
88
- "shasum": ""
89
- },
90
- "require": {
91
- "ext-simplexml": "*",
92
- "ext-tokenizer": "*",
93
- "ext-xmlwriter": "*",
94
- "php": ">=5.4.0"
95
- },
96
- "require-dev": {
97
- "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
98
- },
99
- "bin": [
100
- "bin/phpcs",
101
- "bin/phpcbf"
102
- ],
103
- "type": "library",
104
- "extra": {
105
- "branch-alias": {
106
- "dev-master": "3.x-dev"
107
- }
108
- },
109
- "notification-url": "https://packagist.org/downloads/",
110
- "license": [
111
- "BSD-3-Clause"
112
- ],
113
- "authors": [
114
- {
115
- "name": "Greg Sherwood",
116
- "role": "lead"
117
- }
118
- ],
119
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
120
- "homepage": "http://www.squizlabs.com/php-codesniffer",
121
- "keywords": [
122
- "phpcs",
123
- "standards"
124
- ],
125
- "time": "2018-09-23T23:08:17+00:00"
126
- },
127
- {
128
- "name": "wp-coding-standards/wpcs",
129
- "version": "1.2.0",
130
- "source": {
131
- "type": "git",
132
- "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
133
- "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b"
134
- },
135
- "dist": {
136
- "type": "zip",
137
- "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/7aa217ab38156c5cb4eae0f04ae376027c407a9b",
138
- "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b",
139
- "shasum": ""
140
- },
141
- "require": {
142
- "php": ">=5.3",
143
- "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
144
- },
145
- "require-dev": {
146
- "phpcompatibility/php-compatibility": "^9.0"
147
- },
148
- "suggest": {
149
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
150
- },
151
- "type": "phpcodesniffer-standard",
152
- "notification-url": "https://packagist.org/downloads/",
153
- "license": [
154
- "MIT"
155
- ],
156
- "authors": [
157
- {
158
- "name": "Contributors",
159
- "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
160
- }
161
- ],
162
- "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
163
- "keywords": [
164
- "phpcs",
165
- "standards",
166
- "wordpress"
167
- ],
168
- "time": "2018-11-12T10:13:12+00:00"
169
- }
170
- ],
171
- "aliases": [],
172
- "minimum-stability": "stable",
173
- "stability-flags": [],
174
- "prefer-stable": false,
175
- "prefer-lowest": false,
176
- "platform": [],
177
- "platform-dev": []
178
- }
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "79c1036666580515751ce8911524cb95",
8
+ "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
12
+ "version": "v0.5.0",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
16
+ "reference": "e749410375ff6fb7a040a68878c656c2e610b132"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
21
+ "reference": "e749410375ff6fb7a040a68878c656c2e610b132",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "composer-plugin-api": "^1.0",
26
+ "php": "^5.3|^7",
27
+ "squizlabs/php_codesniffer": "^2|^3"
28
+ },
29
+ "require-dev": {
30
+ "composer/composer": "*",
31
+ "phpcompatibility/php-compatibility": "^9.0",
32
+ "sensiolabs/security-checker": "^4.1.0"
33
+ },
34
+ "type": "composer-plugin",
35
+ "extra": {
36
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
37
+ },
38
+ "autoload": {
39
+ "psr-4": {
40
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
41
+ }
42
+ },
43
+ "notification-url": "https://packagist.org/downloads/",
44
+ "license": [
45
+ "MIT"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Franck Nijhof",
50
+ "email": "franck.nijhof@dealerdirect.com",
51
+ "homepage": "http://www.frenck.nl",
52
+ "role": "Developer / IT Manager"
53
+ }
54
+ ],
55
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
56
+ "homepage": "http://www.dealerdirect.com",
57
+ "keywords": [
58
+ "PHPCodeSniffer",
59
+ "PHP_CodeSniffer",
60
+ "code quality",
61
+ "codesniffer",
62
+ "composer",
63
+ "installer",
64
+ "phpcs",
65
+ "plugin",
66
+ "qa",
67
+ "quality",
68
+ "standard",
69
+ "standards",
70
+ "style guide",
71
+ "stylecheck",
72
+ "tests"
73
+ ],
74
+ "time": "2018-10-26T13:21:45+00:00"
75
+ },
76
+ {
77
+ "name": "squizlabs/php_codesniffer",
78
+ "version": "3.3.2",
79
+ "source": {
80
+ "type": "git",
81
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
82
+ "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
83
+ },
84
+ "dist": {
85
+ "type": "zip",
86
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
87
+ "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
88
+ "shasum": ""
89
+ },
90
+ "require": {
91
+ "ext-simplexml": "*",
92
+ "ext-tokenizer": "*",
93
+ "ext-xmlwriter": "*",
94
+ "php": ">=5.4.0"
95
+ },
96
+ "require-dev": {
97
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
98
+ },
99
+ "bin": [
100
+ "bin/phpcs",
101
+ "bin/phpcbf"
102
+ ],
103
+ "type": "library",
104
+ "extra": {
105
+ "branch-alias": {
106
+ "dev-master": "3.x-dev"
107
+ }
108
+ },
109
+ "notification-url": "https://packagist.org/downloads/",
110
+ "license": [
111
+ "BSD-3-Clause"
112
+ ],
113
+ "authors": [
114
+ {
115
+ "name": "Greg Sherwood",
116
+ "role": "lead"
117
+ }
118
+ ],
119
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
120
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
121
+ "keywords": [
122
+ "phpcs",
123
+ "standards"
124
+ ],
125
+ "time": "2018-09-23T23:08:17+00:00"
126
+ },
127
+ {
128
+ "name": "wp-coding-standards/wpcs",
129
+ "version": "1.2.0",
130
+ "source": {
131
+ "type": "git",
132
+ "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
133
+ "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b"
134
+ },
135
+ "dist": {
136
+ "type": "zip",
137
+ "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/7aa217ab38156c5cb4eae0f04ae376027c407a9b",
138
+ "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b",
139
+ "shasum": ""
140
+ },
141
+ "require": {
142
+ "php": ">=5.3",
143
+ "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
144
+ },
145
+ "require-dev": {
146
+ "phpcompatibility/php-compatibility": "^9.0"
147
+ },
148
+ "suggest": {
149
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
150
+ },
151
+ "type": "phpcodesniffer-standard",
152
+ "notification-url": "https://packagist.org/downloads/",
153
+ "license": [
154
+ "MIT"
155
+ ],
156
+ "authors": [
157
+ {
158
+ "name": "Contributors",
159
+ "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
160
+ }
161
+ ],
162
+ "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
163
+ "keywords": [
164
+ "phpcs",
165
+ "standards",
166
+ "wordpress"
167
+ ],
168
+ "time": "2018-11-12T10:13:12+00:00"
169
+ }
170
+ ],
171
+ "aliases": [],
172
+ "minimum-stability": "stable",
173
+ "stability-flags": [],
174
+ "prefer-stable": false,
175
+ "prefer-lowest": false,
176
+ "platform": [],
177
+ "platform-dev": []
178
+ }
functions/common.php CHANGED
@@ -1,452 +1,452 @@
1
- <?php
2
- /**
3
- * Operations and common functions of SuperPWA
4
- *
5
- * @since 1.0
6
- *
7
- * @function superpwa_is_amp() Check if any AMP plugin is installed
8
- * @function superpwa_get_start_url() Return Start Page URL
9
- * @function superpwa_httpsify() Convert http URL to https
10
- * @function superpwa_is_pwa_ready() Check if PWA is ready
11
- * @function superpwa_file_exists() Check if file exists
12
- * @function superpwa_is_static() Check if service worker or manifest is static or dynamic
13
- * @function superpwa_get_bloginfo() Returns WordPress URL v/s Site URL depending on the status of the file.
14
- */
15
-
16
- // Exit if accessed directly
17
- if ( ! defined( 'ABSPATH' ) ) exit;
18
-
19
- /**
20
- * Check if any AMP plugin is installed
21
- *
22
- * @return (string|bool) AMP page url on success, false otherwise
23
- *
24
- * @author Arun Basil Lal
25
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
26
- *
27
- * @since 1.2
28
- * @since 1.9 Added support for tagDiv AMP
29
- * @since 2.0 require wp-admin/includes/plugin.php if is_plugin_active isn't defined
30
- */
31
- function superpwa_is_amp() {
32
-
33
- if ( ! function_exists( 'is_plugin_active' ) ) {
34
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
35
- }
36
-
37
- // AMP for WordPress - https://wordpress.org/plugins/amp
38
- if ( is_plugin_active( 'amp/amp.php' ) ) {
39
- return defined( 'AMP_QUERY_VAR' ) ? AMP_QUERY_VAR . '/' : 'amp/';
40
- }
41
-
42
- // AMP for WP - https://wordpress.org/plugins/accelerated-mobile-pages/
43
- if ( is_plugin_active( 'accelerated-mobile-pages/accelerated-moblie-pages.php' ) ) {
44
- return defined( 'AMPFORWP_AMP_QUERY_VAR' ) ? AMPFORWP_AMP_QUERY_VAR . '/' : 'amp/';
45
- }
46
-
47
- // Better AMP - https://wordpress.org/plugins/better-amp/
48
- if ( is_plugin_active( 'better-amp/better-amp.php' ) ) {
49
- return 'amp/';
50
- }
51
-
52
- // AMP Supremacy - https://wordpress.org/plugins/amp-supremacy/
53
- if ( is_plugin_active( 'amp-supremacy/amp-supremacy.php' ) ) {
54
- return 'amp/';
55
- }
56
-
57
- // WP AMP - https://wordpress.org/plugins/wp-amp-ninja/
58
- if ( is_plugin_active( 'wp-amp-ninja/wp-amp-ninja.php' ) ) {
59
- return '?wpamp';
60
- }
61
-
62
- // tagDiv AMP - http://forum.tagdiv.com/tagdiv-amp/
63
- if ( is_plugin_active( 'td-amp/td-amp.php' ) ) {
64
- return defined( 'AMP_QUERY_VAR' ) ? AMP_QUERY_VAR . '/' : 'amp/';
65
- }
66
-
67
- return false;
68
- }
69
-
70
- /**
71
- * Return Start Page URL
72
- *
73
- * @param $rel (boolean) False by default. Set to true to return a relative URL (for use in manifest)
74
- *
75
- * @return (string) URL to be set as the start_url in manifest and startPage in service worker
76
- *
77
- * @since 1.2
78
- * @since 1.3.1 Force HTTPS by replacing http:// with https://
79
- * @since 1.6 Use superpwa_httpsify() to force HTTPS.
80
- * @since 1.6 Removed forcing of trailing slash and added dot (.) to the beginning.
81
- * @since 1.7 Added filter superpwa_manifest_start_url when $rel = true, for use with manifest. First ever filter in SuperPWA.
82
- */
83
- function superpwa_get_start_url( $rel = false ) {
84
-
85
- // Get Settings
86
- $settings = superpwa_get_settings();
87
-
88
- // Start Page
89
- $start_url = get_permalink( $settings['start_url'] ) ? get_permalink( $settings['start_url'] ) : superpwa_get_bloginfo( 'sw' );
90
-
91
- // Force HTTPS
92
- $start_url = superpwa_httpsify( $start_url );
93
-
94
- // AMP URL
95
- if ( superpwa_is_amp() !== false && isset( $settings['start_url_amp'] ) && $settings['start_url_amp'] == 1 ) {
96
- $start_url = trailingslashit( $start_url ) . superpwa_is_amp();
97
- }
98
-
99
- // Relative URL for manifest
100
- if ( $rel === true ) {
101
-
102
- // Make start_url relative for manifest
103
- $start_url = ( parse_url( $start_url, PHP_URL_PATH ) == '' ) ? '.' : parse_url( $start_url, PHP_URL_PATH );
104
-
105
- return apply_filters( 'superpwa_manifest_start_url', $start_url );
106
- }
107
-
108
- return $start_url;
109
- }
110
-
111
- /**
112
- * Convert http URL to https
113
- *
114
- * @param $url (string) The URL to convert to https
115
- *
116
- * @return (string) Returns the converted URL
117
- *
118
- * @since 1.6
119
- */
120
- function superpwa_httpsify( $url ) {
121
- return str_replace( 'http://', 'https://', $url );
122
- }
123
-
124
- /**
125
- * Check if PWA is ready
126
- *
127
- * Check for HTTPS.
128
- * Check if manifest is generated.
129
- * Check if service worker is generated.
130
- *
131
- * @return (bool) True if PWA is ready. False otherwise
132
- *
133
- * @author Arun Basil Lal
134
- *
135
- * @since 1.8.1
136
- * @since 2.0.1 replaced superpwa_get_contents() with superpwa_file_exists() to accommodate dynamic files.
137
- */
138
- function superpwa_is_pwa_ready() {
139
-
140
- if (
141
- is_ssl() &&
142
- superpwa_file_exists( superpwa_manifest( 'src' ) ) &&
143
- superpwa_file_exists( superpwa_sw( 'src' ) )
144
- ) {
145
- return apply_filters( 'superpwa_is_pwa_ready', true );
146
- }
147
-
148
- return false;
149
- }
150
-
151
- /**
152
- * Check if file exists
153
- *
154
- * Not to be confused with file_exists PHP function.
155
- * In SuperPWA context, file exists if the response code is 200.
156
- *
157
- * @param $file (string) URL to check
158
- *
159
- * @return (bool) True, if file exists. False otherwise.
160
- *
161
- * @author Arun Basil Lal
162
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
163
- *
164
- * @since 2.0.1
165
- */
166
- function superpwa_file_exists( $file ) {
167
-
168
- $response = wp_remote_head( $file, array( 'sslverify' => false ) );
169
- $response_code = wp_remote_retrieve_response_code( $response );
170
-
171
- if ( 200 === $response_code ) {
172
- return true;
173
- }
174
-
175
- return false;
176
- }
177
-
178
- /**
179
- * Check if service worker or manifest is static or dynamic
180
- *
181
- * @param (string) $file keyword 'manifest' to test manifest and 'sw' to test service worker.
182
- *
183
- * @return (bool) True if the file is static. False otherwise.
184
- *
185
- * @author Arun Basil Lal
186
- *
187
- * @since 2.0.1
188
- */
189
- function superpwa_is_static( $file = 'manifest' ) {
190
-
191
- // Get Settings
192
- $settings = superpwa_get_settings();
193
-
194
- switch ( $file ) {
195
-
196
- case 'sw':
197
-
198
- if ( $settings['is_static_sw'] === 1 ) {
199
- return true;
200
- }
201
-
202
- return false;
203
- break;
204
-
205
- case 'manifest':
206
- default:
207
-
208
- if ( $settings['is_static_manifest'] === 1 ) {
209
- return true;
210
- }
211
-
212
- return false;
213
- break;
214
- }
215
- }
216
-
217
- /**
218
- * Returns WordPress URL v/s Site URL depending on the status of the file.
219
- *
220
- * Static files are generated in the root directory of WordPress. So if static
221
- * files are used, the WordPress URL will be needed for many use cases, like
222
- * offline page, start_url etc.
223
- *
224
- * The status of the service worker is mostly relevant since the service worker
225
- * can work on the folder it is located and its sub folders. Not the folders above
226
- * its own directory.
227
- *
228
- * @param (string) $file keyword 'manifest' to test manifest and 'sw' to test service worker.
229
- *
230
- * @return (string) get_bloginfo( 'wpurl' ) if file is static. get_bloginfo( 'url' ) otherwise.
231
- *
232
- * @author Arun Basil Lal
233
- *
234
- * @since 2.0.1
235
- */
236
- function superpwa_get_bloginfo( $file = 'sw' ) {
237
-
238
- if ( superpwa_is_static( $file ) ) {
239
- return get_bloginfo( 'wpurl' );
240
- }
241
-
242
- return get_bloginfo( 'url' );
243
- }
244
-
245
- /**
246
- * only for Automattic amp Support
247
- * When user enabled Standard & Transitional mode
248
- * it will check and give respective values
249
- */
250
-
251
- function superpwa_is_automattic_amp($case=null){
252
- //Check if current theme support amp
253
- switch ($case) {
254
- case 'amp_support':
255
- if(class_exists('AMP_Theme_Support')){
256
- return current_theme_supports( AMP_Theme_Support::SLUG );
257
- }
258
- break;
259
- default:
260
- if ( current_theme_supports( 'amp' ) && function_exists('is_amp_endpoint') && is_amp_endpoint() ) {
261
- return true;
262
- }
263
- break;
264
- }
265
- return false;
266
- }
267
-
268
- function superpwa_home_url(){
269
-
270
- if ( is_multisite() ) {
271
- $link = get_site_url();
272
- }
273
- else {
274
- $link = home_url();
275
- }
276
- $link = superpwa_httpsify($link);
277
-
278
- return trailingslashit($link);
279
- }
280
- function superpwa_site_url(){
281
-
282
- if (is_multisite() ) {
283
-
284
- $link = get_site_url();
285
-
286
- }
287
- else {
288
- $link = site_url();
289
- }
290
- $link = superpwa_httpsify($link);
291
-
292
- return trailingslashit($link);
293
- }
294
-
295
- /**
296
- * Reset Settings Ajax Callback
297
- */
298
- function superpwa_reset_all_settings(){
299
-
300
- if ( ! isset( $_POST['superpwa_security_nonce'] ) ){
301
- return;
302
- }
303
- if ( !wp_verify_nonce( $_POST['superpwa_security_nonce'], 'superpwa_ajax_check_nonce' ) ){
304
- return;
305
- }
306
- if ( ! current_user_can( 'manage_options' ) ) {
307
- return;
308
- }
309
-
310
- $default = superpwa_get_default_settings();
311
-
312
- $result = update_option('superpwa_settings', $default);
313
- // delete_transient('pwaforwp_restapi_check');
314
-
315
- if($result){
316
-
317
- echo json_encode(array('status'=>'t'));
318
-
319
- }else{
320
-
321
- echo json_encode(array('status'=>'f'));
322
-
323
- }
324
- wp_die();
325
- }
326
-
327
- add_action('wp_ajax_superpwa_reset_all_settings', 'superpwa_reset_all_settings');
328
-
329
- /**
330
- * Returns Superpwa setting tabs html
331
- */
332
- function superpwa_setting_tabs_html(){
333
-
334
- $general_settings = admin_url( 'admin.php?page=superpwa#general-settings');
335
- $advance_settings = admin_url( 'admin.php?page=superpwa#advance-settings');
336
- $support_settings = admin_url( 'admin.php?page=superpwa#support-settings');
337
- $license_settings = admin_url( 'admin.php?page=superpwa#license-settings');
338
- $addon_page = admin_url( 'admin.php?page=superpwa-addons');
339
- if( $_GET['page'] == 'superpwa-upgrade' ) {
340
- $license_settings_class = $addon_page_class = '' ;
341
- if( isset( $_GET['page'] ) && $_GET['page'] == 'superpwa-upgrade' ) {
342
- $license_settings_class = 'active';
343
- }else{
344
- $addon_page_class = 'active';
345
- }
346
- }
347
-
348
- $license_settings_class = $addon_page_class = '' ;
349
- if( isset( $_GET['page'] ) && $_GET['page'] == 'superpwa-upgrade' ) {
350
- $license_settings_class = 'active';
351
- }else{
352
- $addon_page_class = 'active';
353
- }
354
- ?>
355
- <div class="spwa-tab">
356
- <a id="spwa-default" class="spwa-tablinks" href="<?php echo esc_url_raw($general_settings); ?>" data-href="yes">Settings</a>
357
- <a class="spwa-tablinks <?php echo $addon_page_class; ?>" href="<?php echo esc_url_raw($addon_page); ?>" data-href="yes">Features (Addons)</a>
358
- <a class="spwa-tablinks" href="<?php echo esc_url_raw($advance_settings); ?>" data-href="yes">Advanced</a>
359
- <a class="spwa-tablinks" href="<?php echo esc_url_raw($support_settings); ?>" data-href="yes">Help & Support</a>
360
- <?php if( defined('SUPERPWA_PRO_VERSION') && $_GET['page'] !== 'superpwa-upgrade' ) {
361
- $expiry_warning = superpwa_license_expire_warning();
362
- ?>
363
- <a class="spwa-tablinks" href="<?php echo esc_url_raw($license_settings); ?>" data-href="yes">License <?php echo $expiry_warning; ?></a>
364
- <?php } ?>
365
- <?php if( $_GET['page'] == 'superpwa-upgrade' ) { ?>
366
- <a class="spwa-tablinks <?php echo $license_settings_class; ?> " href="<?php echo esc_url_raw($license_settings); ?>" data-href="yes">License</a>
367
- <?php } ?>
368
-
369
- </div>
370
- <?php
371
- }
372
-
373
- /**
374
- * Returns Warning Icon When License Key is Expired
375
- */
376
- function superpwa_license_expire_warning(){
377
-
378
- $license_alert ='';
379
- if( defined('SUPERPWA_PRO_VERSION') ){
380
-
381
- $license_info = get_option("superpwa_pro_upgrade_license");
382
- if ($license_info) {
383
-
384
- $license_exp = date('Y-m-d', strtotime($license_info['pro']['license_key_expires']));
385
- $license_info_lifetime = $license_info['pro']['license_key_expires'];
386
- $today = date('Y-m-d');
387
- $exp_date = $license_exp;
388
-
389
- $license_alert = $today > $exp_date ? "<span class='superpwa_pro_icon dashicons dashicons-warning superpwa_pro_alert' style='color: #ffb229;left: 3px;position: relative;'></span>": "" ;
390
- }
391
- }
392
- return $license_alert;
393
- }
394
-
395
-
396
- /**
397
- * Returns Superpwa Setting tabs Styles
398
- */
399
- function superpwa_setting_tabs_styles(){
400
- ?>
401
- <style type="text/css">.spwa-tab {overflow: hidden;border: 1px solid #ccc;background-color: #fff;margin-top: 15px;margin-bottom: 6px;}.spwa-tab a {background-color: inherit;text-decoration: none;float: left;border: none;outline: none;cursor: pointer;padding: 14px 16px;transition: 0s;font-size: 15px;color: #2271b1;}.spwa-tab a:hover {color: #0a4b78;}.spwa-tab a.active {box-shadow: none;border-bottom: 4px solid #646970;color: #1d2327;}.spwa-tab a:focus {box-shadow: none;outline: none;}.spwa-tabcontent {display: none;padding: 6px 12px;border-top: none; animation: fadeEffect 1s; } @keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }</style>
402
- <?php
403
- }
404
- /**
405
- * Returns Superpwa Setting Newsletter Forms
406
- */
407
- function superpwa_newsletter_form(){
408
-
409
- $hide_form = get_option('superpwa_hide_newsletter');
410
-
411
- // Newsletter marker. Set this to false once newsletter subscription is displayed.
412
- $superpwa_newsletter = true;
413
-
414
- if ( $superpwa_newsletter === true && $hide_form !== 'yes') { ?>
415
- <div class="superpwa-newsletter-wrapper">
416
- <div class="plugin-card plugin-card-superpwa-newsletter" style="background: #fdfc35 url('<?php echo SUPERPWA_PATH_SRC . 'admin/img/email.png'; ?>') no-repeat right top;">
417
-
418
- <div class="plugin-card-top" style="min-height: 135px;">
419
- <span class="dashicons dashicons-dismiss superpwa_newsletter_hide" style="float: right;cursor: pointer;"></span>
420
- <span style="clear:both;"></span>
421
- <div class="name column-name" style="margin: 0px 10px;">
422
- <h3><?php _e( 'SuperPWA Newsletter', 'super-progressive-web-apps' ); ?></h3>
423
- </div>
424
- <div class="desc column-description" style="margin: 0px 10px;">
425
- <p><?php _e( 'Learn more about Progressive Web Apps and get latest updates about SuperPWA', 'super-progressive-web-apps' ); ?></p>
426
- </div>
427
-
428
- <div class="superpwa-newsletter-form" style="margin: 18px 10px 0px;">
429
-
430
- <form method="post" action="https://superpwa.com/newsletter/" target="_blank" id="superpwa_newsletter">
431
- <fieldset>
432
- <input name="newsletter-email" value="<?php $user = wp_get_current_user(); echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Enter your email', 'super-progressive-web-apps' ); ?>" style="width: 60%; margin-left: 0px;" type="email">
433
- <input name="source" value="superpwa-plugin" type="hidden">
434
- <input type="submit" class="button" value="<?php _e( 'Subscribe', 'super-progressive-web-apps' ); ?>" style="background: linear-gradient(to right, #fdfc35, #ffe258) !important; box-shadow: unset;">
435
- <span class="superpwa_newsletter_hide" style="box-shadow: unset;cursor: pointer;margin-left: 10px;">
436
- <?php _e( 'No thanks', 'super-progressive-web-apps' ); ?>
437
- </span>
438
- <small style="display:block; margin-top:8px;"><?php _e( 'we\'ll share our <code>root</code> password before we share your email with anyone else.', 'super-progressive-web-apps' ); ?></small>
439
-
440
- </fieldset>
441
- </form>
442
-
443
- </div>
444
-
445
- </div>
446
-
447
- </div>
448
- </div>
449
- <?php }
450
- // Set newsletter marker to false
451
- $superpwa_newsletter = false;
452
  }
1
+ <?php
2
+ /**
3
+ * Operations and common functions of SuperPWA
4
+ *
5
+ * @since 1.0
6
+ *
7
+ * @function superpwa_is_amp() Check if any AMP plugin is installed
8
+ * @function superpwa_get_start_url() Return Start Page URL
9
+ * @function superpwa_httpsify() Convert http URL to https
10
+ * @function superpwa_is_pwa_ready() Check if PWA is ready
11
+ * @function superpwa_file_exists() Check if file exists
12
+ * @function superpwa_is_static() Check if service worker or manifest is static or dynamic
13
+ * @function superpwa_get_bloginfo() Returns WordPress URL v/s Site URL depending on the status of the file.
14
+ */
15
+
16
+ // Exit if accessed directly
17
+ if ( ! defined( 'ABSPATH' ) ) exit;
18
+
19
+ /**
20
+ * Check if any AMP plugin is installed
21
+ *
22
+ * @return (string|bool) AMP page url on success, false otherwise
23
+ *
24
+ * @author Arun Basil Lal
25
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
26
+ *
27
+ * @since 1.2
28
+ * @since 1.9 Added support for tagDiv AMP
29
+ * @since 2.0 require wp-admin/includes/plugin.php if is_plugin_active isn't defined
30
+ */
31
+ function superpwa_is_amp() {
32
+
33
+ if ( ! function_exists( 'is_plugin_active' ) ) {
34
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
35
+ }
36
+
37
+ // AMP for WordPress - https://wordpress.org/plugins/amp
38
+ if ( is_plugin_active( 'amp/amp.php' ) ) {
39
+ return defined( 'AMP_QUERY_VAR' ) ? AMP_QUERY_VAR . '/' : 'amp/';
40
+ }
41
+
42
+ // AMP for WP - https://wordpress.org/plugins/accelerated-mobile-pages/
43
+ if ( is_plugin_active( 'accelerated-mobile-pages/accelerated-moblie-pages.php' ) ) {
44
+ return defined( 'AMPFORWP_AMP_QUERY_VAR' ) ? AMPFORWP_AMP_QUERY_VAR . '/' : 'amp/';
45
+ }
46
+
47
+ // Better AMP - https://wordpress.org/plugins/better-amp/
48
+ if ( is_plugin_active( 'better-amp/better-amp.php' ) ) {
49
+ return 'amp/';
50
+ }
51
+
52
+ // AMP Supremacy - https://wordpress.org/plugins/amp-supremacy/
53
+ if ( is_plugin_active( 'amp-supremacy/amp-supremacy.php' ) ) {
54
+ return 'amp/';
55
+ }
56
+
57
+ // WP AMP - https://wordpress.org/plugins/wp-amp-ninja/
58
+ if ( is_plugin_active( 'wp-amp-ninja/wp-amp-ninja.php' ) ) {
59
+ return '?wpamp';
60
+ }
61
+
62
+ // tagDiv AMP - http://forum.tagdiv.com/tagdiv-amp/
63
+ if ( is_plugin_active( 'td-amp/td-amp.php' ) ) {
64
+ return defined( 'AMP_QUERY_VAR' ) ? AMP_QUERY_VAR . '/' : 'amp/';
65
+ }
66
+
67
+ return false;
68
+ }
69
+
70
+ /**
71
+ * Return Start Page URL
72
+ *
73
+ * @param $rel (boolean) False by default. Set to true to return a relative URL (for use in manifest)
74
+ *
75
+ * @return (string) URL to be set as the start_url in manifest and startPage in service worker
76
+ *
77
+ * @since 1.2
78
+ * @since 1.3.1 Force HTTPS by replacing http:// with https://
79
+ * @since 1.6 Use superpwa_httpsify() to force HTTPS.
80
+ * @since 1.6 Removed forcing of trailing slash and added dot (.) to the beginning.
81
+ * @since 1.7 Added filter superpwa_manifest_start_url when $rel = true, for use with manifest. First ever filter in SuperPWA.
82
+ */
83
+ function superpwa_get_start_url( $rel = false ) {
84
+
85
+ // Get Settings
86
+ $settings = superpwa_get_settings();
87
+
88
+ // Start Page
89
+ $start_url = get_permalink( $settings['start_url'] ) ? get_permalink( $settings['start_url'] ) : superpwa_get_bloginfo( 'sw' );
90
+
91
+ // Force HTTPS
92
+ $start_url = superpwa_httpsify( $start_url );
93
+
94
+ // AMP URL
95
+ if ( superpwa_is_amp() !== false && isset( $settings['start_url_amp'] ) && $settings['start_url_amp'] == 1 ) {
96
+ $start_url = trailingslashit( $start_url ) . superpwa_is_amp();
97
+ }
98
+
99
+ // Relative URL for manifest
100
+ if ( $rel === true ) {
101
+
102
+ // Make start_url relative for manifest
103
+ $start_url = ( parse_url( $start_url, PHP_URL_PATH ) == '' ) ? '' : parse_url( $start_url, PHP_URL_PATH );
104
+
105
+ return apply_filters( 'superpwa_manifest_start_url', $start_url );
106
+ }
107
+
108
+ return $start_url;
109
+ }
110
+
111
+ /**
112
+ * Convert http URL to https
113
+ *
114
+ * @param $url (string) The URL to convert to https
115
+ *
116
+ * @return (string) Returns the converted URL
117
+ *
118
+ * @since 1.6
119
+ */
120
+ function superpwa_httpsify( $url ) {
121
+ return str_replace( 'http://', 'https://', $url );
122
+ }
123
+
124
+ /**
125
+ * Check if PWA is ready
126
+ *
127
+ * Check for HTTPS.
128
+ * Check if manifest is generated.
129
+ * Check if service worker is generated.
130
+ *
131
+ * @return (bool) True if PWA is ready. False otherwise
132
+ *
133
+ * @author Arun Basil Lal
134
+ *
135
+ * @since 1.8.1
136
+ * @since 2.0.1 replaced superpwa_get_contents() with superpwa_file_exists() to accommodate dynamic files.
137
+ */
138
+ function superpwa_is_pwa_ready() {
139
+
140
+ if (
141
+ is_ssl() &&
142
+ superpwa_file_exists( superpwa_manifest( 'src' ) ) &&
143
+ superpwa_file_exists( superpwa_sw( 'src' ) )
144
+ ) {
145
+ return apply_filters( 'superpwa_is_pwa_ready', true );
146
+ }
147
+
148
+ return false;
149
+ }
150
+
151
+ /**
152
+ * Check if file exists
153
+ *
154
+ * Not to be confused with file_exists PHP function.
155
+ * In SuperPWA context, file exists if the response code is 200.
156
+ *
157
+ * @param $file (string) URL to check
158
+ *
159
+ * @return (bool) True, if file exists. False otherwise.
160
+ *
161
+ * @author Arun Basil Lal
162
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
163
+ *
164
+ * @since 2.0.1
165
+ */
166
+ function superpwa_file_exists( $file ) {
167
+
168
+ $response = wp_remote_head( $file, array( 'sslverify' => false ) );
169
+ $response_code = wp_remote_retrieve_response_code( $response );
170
+
171
+ if ( 200 === $response_code ) {
172
+ return true;
173
+ }
174
+
175
+ return false;
176
+ }
177
+
178
+ /**
179
+ * Check if service worker or manifest is static or dynamic
180
+ *
181
+ * @param (string) $file keyword 'manifest' to test manifest and 'sw' to test service worker.
182
+ *
183
+ * @return (bool) True if the file is static. False otherwise.
184
+ *
185
+ * @author Arun Basil Lal
186
+ *
187
+ * @since 2.0.1
188
+ */
189
+ function superpwa_is_static( $file = 'manifest' ) {
190
+
191
+ // Get Settings
192
+ $settings = superpwa_get_settings();
193
+
194
+ switch ( $file ) {
195
+
196
+ case 'sw':
197
+
198
+ if ( $settings['is_static_sw'] === 1 ) {
199
+ return true;
200
+ }
201
+
202
+ return false;
203
+ break;
204
+
205
+ case 'manifest':
206
+ default:
207
+
208
+ if ( $settings['is_static_manifest'] === 1 ) {
209
+ return true;
210
+ }
211
+
212
+ return false;
213
+ break;
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Returns WordPress URL v/s Site URL depending on the status of the file.
219
+ *
220
+ * Static files are generated in the root directory of WordPress. So if static
221
+ * files are used, the WordPress URL will be needed for many use cases, like
222
+ * offline page, start_url etc.
223
+ *
224
+ * The status of the service worker is mostly relevant since the service worker
225
+ * can work on the folder it is located and its sub folders. Not the folders above
226
+ * its own directory.
227
+ *
228
+ * @param (string) $file keyword 'manifest' to test manifest and 'sw' to test service worker.
229
+ *
230
+ * @return (string) get_bloginfo( 'wpurl' ) if file is static. get_bloginfo( 'url' ) otherwise.
231
+ *
232
+ * @author Arun Basil Lal
233
+ *
234
+ * @since 2.0.1
235
+ */
236
+ function superpwa_get_bloginfo( $file = 'sw' ) {
237
+
238
+ if ( superpwa_is_static( $file ) ) {
239
+ return get_bloginfo( 'wpurl' );
240
+ }
241
+
242
+ return get_bloginfo( 'url' );
243
+ }
244
+
245
+ /**
246
+ * only for Automattic amp Support
247
+ * When user enabled Standard & Transitional mode
248
+ * it will check and give respective values
249
+ */
250
+
251
+ function superpwa_is_automattic_amp($case=null){
252
+ //Check if current theme support amp
253
+ switch ($case) {
254
+ case 'amp_support':
255
+ if(class_exists('AMP_Theme_Support')){
256
+ return current_theme_supports( AMP_Theme_Support::SLUG );
257
+ }
258
+ break;
259
+ default:
260
+ if ( current_theme_supports( 'amp' ) && function_exists('is_amp_endpoint') && is_amp_endpoint() ) {
261
+ return true;
262
+ }
263
+ break;
264
+ }
265
+ return false;
266
+ }
267
+
268
+ function superpwa_home_url(){
269
+
270
+ if ( is_multisite() ) {
271
+ $link = get_site_url();
272
+ }
273
+ else {
274
+ $link = home_url();
275
+ }
276
+ $link = superpwa_httpsify($link);
277
+
278
+ return trailingslashit($link);
279
+ }
280
+ function superpwa_site_url(){
281
+
282
+ if (is_multisite() ) {
283
+
284
+ $link = get_site_url();
285
+
286
+ }
287
+ else {
288
+ $link = site_url();
289
+ }
290
+ $link = superpwa_httpsify($link);
291
+
292
+ return trailingslashit($link);
293
+ }
294
+
295
+ /**
296
+ * Reset Settings Ajax Callback
297
+ */
298
+ function superpwa_reset_all_settings(){
299
+
300
+ if ( ! isset( $_POST['superpwa_security_nonce'] ) ){
301
+ return;
302
+ }
303
+ if ( !wp_verify_nonce( $_POST['superpwa_security_nonce'], 'superpwa_ajax_check_nonce' ) ){
304
+ return;
305
+ }
306
+ if ( ! current_user_can( 'manage_options' ) ) {
307
+ return;
308
+ }
309
+
310
+ $default = superpwa_get_default_settings();
311
+
312
+ $result = update_option('superpwa_settings', $default);
313
+ // delete_transient('pwaforwp_restapi_check');
314
+
315
+ if($result){
316
+
317
+ echo json_encode(array('status'=>'t'));
318
+
319
+ }else{
320
+
321
+ echo json_encode(array('status'=>'f'));
322
+
323
+ }
324
+ wp_die();
325
+ }
326
+
327
+ add_action('wp_ajax_superpwa_reset_all_settings', 'superpwa_reset_all_settings');
328
+
329
+ /**
330
+ * Returns Superpwa setting tabs html
331
+ */
332
+ function superpwa_setting_tabs_html(){
333
+
334
+ $general_settings = admin_url( 'admin.php?page=superpwa#general-settings');
335
+ $advance_settings = admin_url( 'admin.php?page=superpwa#advance-settings');
336
+ $support_settings = admin_url( 'admin.php?page=superpwa#support-settings');
337
+ $license_settings = admin_url( 'admin.php?page=superpwa#license-settings');
338
+ $addon_page = admin_url( 'admin.php?page=superpwa-addons');
339
+ if( $_GET['page'] == 'superpwa-upgrade' ) {
340
+ $license_settings_class = $addon_page_class = '' ;
341
+ if( isset( $_GET['page'] ) && $_GET['page'] == 'superpwa-upgrade' ) {
342
+ $license_settings_class = 'active';
343
+ }else{
344
+ $addon_page_class = 'active';
345
+ }
346
+ }
347
+
348
+ $license_settings_class = $addon_page_class = '' ;
349
+ if( isset( $_GET['page'] ) && $_GET['page'] == 'superpwa-upgrade' ) {
350
+ $license_settings_class = 'active';
351
+ }else{
352
+ $addon_page_class = 'active';
353
+ }
354
+ ?>
355
+ <div class="spwa-tab">
356
+ <a id="spwa-default" class="spwa-tablinks" href="<?php echo esc_url_raw($general_settings); ?>" data-href="yes"><?php _e('Settings', 'super-progressive-web-apps') ?></a>
357
+ <a class="spwa-tablinks <?php echo $addon_page_class; ?>" href="<?php echo esc_url_raw($addon_page); ?>" data-href="yes"><?php _e('Features (Addons)', 'super-progressive-web-apps') ?></a>
358
+ <a class="spwa-tablinks" href="<?php echo esc_url_raw($advance_settings); ?>" data-href="yes"><?php _e('Advanced', 'super-progressive-web-apps') ?></a>
359
+ <a class="spwa-tablinks" href="<?php echo esc_url_raw($support_settings); ?>" data-href="yes"><?php _e('Help & Support', 'super-progressive-web-apps') ?></a>
360
+ <?php if( defined('SUPERPWA_PRO_VERSION') && $_GET['page'] !== 'superpwa-upgrade' ) {
361
+ $expiry_warning = superpwa_license_expire_warning();
362
+ ?>
363
+ <a class="spwa-tablinks" href="<?php echo esc_url_raw($license_settings); ?>" data-href="yes">License <?php echo $expiry_warning; ?></a>
364
+ <?php } ?>
365
+ <?php if( $_GET['page'] == 'superpwa-upgrade' ) { ?>
366
+ <a class="spwa-tablinks <?php echo $license_settings_class; ?> " href="<?php echo esc_url_raw($license_settings); ?>" data-href="yes"><?php _e('License', 'super-progressive-web-apps') ?></a>
367
+ <?php } ?>
368
+
369
+ </div>
370
+ <?php
371
+ }
372
+
373
+ /**
374
+ * Returns Warning Icon When License Key is Expired
375
+ */
376
+ function superpwa_license_expire_warning(){
377
+
378
+ $license_alert ='';
379
+ if( defined('SUPERPWA_PRO_VERSION') ){
380
+
381
+ $license_info = get_option("superpwa_pro_upgrade_license");
382
+ if ($license_info) {
383
+
384
+ $license_exp = date('Y-m-d', strtotime($license_info['pro']['license_key_expires']));
385
+ $license_info_lifetime = $license_info['pro']['license_key_expires'];
386
+ $today = date('Y-m-d');
387
+ $exp_date = $license_exp;
388
+
389
+ $license_alert = $today > $exp_date ? "<span class='superpwa_pro_icon dashicons dashicons-warning superpwa_pro_alert' style='color: #ffb229;left: 3px;position: relative;'></span>": "" ;
390
+ }
391
+ }
392
+ return $license_alert;
393
+ }
394
+
395
+
396
+ /**
397
+ * Returns Superpwa Setting tabs Styles
398
+ */
399
+ function superpwa_setting_tabs_styles(){
400
+ ?>
401
+ <style type="text/css">.spwa-tab {overflow: hidden;border: 1px solid #ccc;background-color: #fff;margin-top: 15px;margin-bottom: 6px;}.spwa-tab a {background-color: inherit;text-decoration: none;float: left;border: none;outline: none;cursor: pointer;padding: 14px 16px;transition: 0s;font-size: 15px;color: #2271b1;}.spwa-tab a:hover {color: #0a4b78;}.spwa-tab a.active {box-shadow: none;border-bottom: 4px solid #646970;color: #1d2327;}.spwa-tab a:focus {box-shadow: none;outline: none;}.spwa-tabcontent {display: none;padding: 6px 12px;border-top: none; animation: fadeEffect 1s; } @keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }</style>
402
+ <?php
403
+ }
404
+ /**
405
+ * Returns Superpwa Setting Newsletter Forms
406
+ */
407
+ function superpwa_newsletter_form(){
408
+
409
+ $hide_form = get_option('superpwa_hide_newsletter');
410
+
411
+ // Newsletter marker. Set this to false once newsletter subscription is displayed.
412
+ $superpwa_newsletter = true;
413
+
414
+ if ( $superpwa_newsletter === true && $hide_form !== 'yes') { ?>
415
+ <div class="superpwa-newsletter-wrapper">
416
+ <div class="plugin-card plugin-card-superpwa-newsletter" style="background: #fdfc35 url('<?php echo SUPERPWA_PATH_SRC . 'admin/img/email.png'; ?>') no-repeat right top;">
417
+
418
+ <div class="plugin-card-top" style="min-height: 135px;">
419
+ <span class="dashicons dashicons-dismiss superpwa_newsletter_hide" style="float: right;cursor: pointer;"></span>
420
+ <span style="clear:both;"></span>
421
+ <div class="name column-name" style="margin: 0px 10px;">
422
+ <h3><?php _e( 'SuperPWA Newsletter', 'super-progressive-web-apps' ); ?></h3>
423
+ </div>
424
+ <div class="desc column-description" style="margin: 0px 10px;">
425
+ <p><?php _e( 'Learn more about Progressive Web Apps and get latest updates about SuperPWA', 'super-progressive-web-apps' ); ?></p>
426
+ </div>
427
+
428
+ <div class="superpwa-newsletter-form" style="margin: 18px 10px 0px;">
429
+
430
+ <form method="post" action="https://superpwa.com/newsletter/" target="_blank" id="superpwa_newsletter">
431
+ <fieldset>
432
+ <input name="newsletter-email" value="<?php $user = wp_get_current_user(); echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Enter your email', 'super-progressive-web-apps' ); ?>" style="width: 60%; margin-left: 0px;" type="email">
433
+ <input name="source" value="superpwa-plugin" type="hidden">
434
+ <input type="submit" class="button" value="<?php _e( 'Subscribe', 'super-progressive-web-apps' ); ?>" style="background: linear-gradient(to right, #fdfc35, #ffe258) !important; box-shadow: unset;">
435
+ <span class="superpwa_newsletter_hide" style="box-shadow: unset;cursor: pointer;margin-left: 10px;">
436
+ <?php _e( 'No thanks', 'super-progressive-web-apps' ); ?>
437
+ </span>
438
+ <small style="display:block; margin-top:8px;"><?php _e( 'we\'ll share our <code>root</code> password before we share your email with anyone else.', 'super-progressive-web-apps' ); ?></small>
439
+
440
+ </fieldset>
441
+ </form>
442
+
443
+ </div>
444
+
445
+ </div>
446
+
447
+ </div>
448
+ </div>
449
+ <?php }
450
+ // Set newsletter marker to false
451
+ $superpwa_newsletter = false;
452
  }
functions/filesystem.php CHANGED
@@ -1,107 +1,107 @@
1
- <?php
2
- /**
3
- * Filesystem Operations
4
- *
5
- * @since 1.0
6
- *
7
- * @function superpwa_wp_filesystem_init() Initialize the WP filesystem
8
- * @function superpwa_put_contents() Write to a file using WP_Filesystem() functions
9
- * @function superpwa_get_contents() Read contents of a file using WP_Filesystem() functions
10
- * @function superpwa_delete() Delete a file
11
- */
12
-
13
- // Exit if accessed directly
14
- if ( ! defined('ABSPATH') ) exit;
15
-
16
- /**
17
- * Initialize the WP filesystem
18
- *
19
- * @since 1.0
20
- */
21
- function superpwa_wp_filesystem_init() {
22
-
23
- global $wp_filesystem;
24
-
25
- if ( empty( $wp_filesystem ) ) {
26
- require_once( trailingslashit( ABSPATH ) . 'wp-admin/includes/file.php' );
27
- WP_Filesystem();
28
- }
29
- }
30
-
31
- /**
32
- * Write to a file using WP_Filesystem() functions
33
- *
34
- * @param $file Filename with path
35
- * @param $content Contents to be written to the file. Default null
36
- * @return True on success, false if file isn't passed or if writing failed.
37
- *
38
- * @since 1.0
39
- */
40
- function superpwa_put_contents( $file, $content = null ) {
41
-
42
- // Return false if no filename is provided
43
- if ( empty( $file ) ) {
44
- return false;
45
- }
46
-
47
- // Initialize the WP filesystem
48
- superpwa_wp_filesystem_init();
49
- global $wp_filesystem;
50
-
51
- if( ! $wp_filesystem->put_contents( $file, $content, 0644) ) {
52
- return false;
53
- }
54
-
55
- return true;
56
- }
57
-
58
- /**
59
- * Read contents of a file using WP_Filesystem() functions
60
- *
61
- * @param $file Filename with path.
62
- * @param $array Set true to return read data as an array. False by default.
63
- * @return (string|bool) The function returns the read data or false on failure.
64
- *
65
- * @since 1.0
66
- */
67
- function superpwa_get_contents( $file, $array = false ) {
68
-
69
- // Return false if no filename is provided
70
- if ( empty( $file ) ) {
71
- return false;
72
- }
73
-
74
- // Initialize the WP filesystem
75
- superpwa_wp_filesystem_init();
76
- global $wp_filesystem;
77
-
78
- // Reads entire file into a string
79
- if ( $array == false ) {
80
- return $wp_filesystem->get_contents( $file );
81
- }
82
-
83
- // Reads entire file into an array
84
- return $wp_filesystem->get_contents_array( $file );
85
- }
86
-
87
- /**
88
- * Delete a file
89
- *
90
- * @param $file Filename with path
91
- * @return bool True on success, false otherwise
92
- *
93
- * @since 1.0
94
- */
95
- function superpwa_delete( $file ) {
96
-
97
- // Return false if no filename is provided
98
- if ( empty( $file ) ) {
99
- return false;
100
- }
101
-
102
- // Initialize the WP filesystem
103
- superpwa_wp_filesystem_init();
104
- global $wp_filesystem;
105
-
106
- return $wp_filesystem->delete( $file );
107
  }
1
+ <?php
2
+ /**
3
+ * Filesystem Operations
4
+ *
5
+ * @since 1.0
6
+ *
7
+ * @function superpwa_wp_filesystem_init() Initialize the WP filesystem
8
+ * @function superpwa_put_contents() Write to a file using WP_Filesystem() functions
9
+ * @function superpwa_get_contents() Read contents of a file using WP_Filesystem() functions
10
+ * @function superpwa_delete() Delete a file
11
+ */
12
+
13
+ // Exit if accessed directly
14
+ if ( ! defined('ABSPATH') ) exit;
15
+
16
+ /**
17
+ * Initialize the WP filesystem
18
+ *
19
+ * @since 1.0
20
+ */
21
+ function superpwa_wp_filesystem_init() {
22
+
23
+ global $wp_filesystem;
24
+
25
+ if ( empty( $wp_filesystem ) ) {
26
+ require_once( trailingslashit( ABSPATH ) . 'wp-admin/includes/file.php' );
27
+ WP_Filesystem();
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Write to a file using WP_Filesystem() functions
33
+ *
34
+ * @param $file Filename with path
35
+ * @param $content Contents to be written to the file. Default null
36
+ * @return True on success, false if file isn't passed or if writing failed.
37
+ *
38
+ * @since 1.0
39
+ */
40
+ function superpwa_put_contents( $file, $content = null ) {
41
+
42
+ // Return false if no filename is provided
43
+ if ( empty( $file ) ) {
44
+ return false;
45
+ }
46
+
47
+ // Initialize the WP filesystem
48
+ superpwa_wp_filesystem_init();
49
+ global $wp_filesystem;
50
+
51
+ if( ! $wp_filesystem->put_contents( $file, $content, 0644) ) {
52
+ return false;
53
+ }
54
+
55
+ return true;
56
+ }
57
+
58
+ /**
59
+ * Read contents of a file using WP_Filesystem() functions
60
+ *
61
+ * @param $file Filename with path.
62
+ * @param $array Set true to return read data as an array. False by default.
63
+ * @return (string|bool) The function returns the read data or false on failure.
64
+ *
65
+ * @since 1.0
66
+ */
67
+ function superpwa_get_contents( $file, $array = false ) {
68
+
69
+ // Return false if no filename is provided
70
+ if ( empty( $file ) ) {
71
+ return false;
72
+ }
73
+
74
+ // Initialize the WP filesystem
75
+ superpwa_wp_filesystem_init();
76
+ global $wp_filesystem;
77
+
78
+ // Reads entire file into a string
79
+ if ( $array == false ) {
80
+ return $wp_filesystem->get_contents( $file );
81
+ }
82
+
83
+ // Reads entire file into an array
84
+ return $wp_filesystem->get_contents_array( $file );
85
+ }
86
+
87
+ /**
88
+ * Delete a file
89
+ *
90
+ * @param $file Filename with path
91
+ * @return bool True on success, false otherwise
92
+ *
93
+ * @since 1.0
94
+ */
95
+ function superpwa_delete( $file ) {
96
+
97
+ // Return false if no filename is provided
98
+ if ( empty( $file ) ) {
99
+ return false;
100
+ }
101
+
102
+ // Initialize the WP filesystem
103
+ superpwa_wp_filesystem_init();
104
+ global $wp_filesystem;
105
+
106
+ return $wp_filesystem->delete( $file );
107
  }
functions/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
functions/multisite.php CHANGED
@@ -1,106 +1,106 @@
1
- <?php
2
- /**
3
- * Functions for compatibility with WordPress multisites
4
- *
5
- * @since 1.6
6
- *
7
- * @function superpwa_multisite_filename_postfix() Filename postfix for multisites
8
- * @function superpwa_multisite_activation_status() Save activation status for current blog id
9
- * @function superpwa_multisite_network_deactivator() Handle multisite network deactivation
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- /**
16
- * Filename postfix for multisites
17
- *
18
- * @return (string) Returns the current blog ID on a multisite. An empty string otherwise
19
- *
20
- * @since 1.6
21
- */
22
- function superpwa_multisite_filename_postfix() {
23
-
24
- // Return empty string if not a multisite
25
- if ( ! is_multisite() ) {
26
- return '';
27
- }
28
-
29
- return '-' . get_current_blog_id();
30
- }
31
-
32
- /**
33
- * Save activation status for current blog id
34
- *
35
- * For clean multisite uninstall.
36
- * Manifest and service worker are deleted during deactivation.
37
- * Database settings are cleaned during uninstall
38
- *
39
- * @param (bool) $status True when plugin is activated, false when deactivated.
40
- *
41
- * @since 1.6
42
- */
43
- function superpwa_multisite_activation_status( $status ) {
44
-
45
- // Only for multisites
46
- if ( ! is_multisite() || ! isset( $status ) ) {
47
- return;
48
- }
49
-
50
- // Get current list of sites where SuperPWA is activated.
51
- $superpwa_sites = get_site_option( 'superpwa_active_sites', array() );
52
-
53
- // Set the status for the current blog.
54
- $superpwa_sites[ get_current_blog_id() ] = $status;
55
-
56
- // Save it back to the database.
57
- update_site_option( 'superpwa_active_sites', $superpwa_sites );
58
- }
59
-
60
- /**
61
- * Handle multisite network deactivation
62
- *
63
- * Deletes manifest and service worker of all sub-sites.
64
- * Sets the deactivation status for each site.
65
- *
66
- * Not used when wp_is_large_network() is true. Deleting that many files and db options will most likely time out.
67
- * This also this gives the user an option to decide if SuperPWA should handle this by changing the defenition of wp_is_large_network.
68
- * @link https://developer.wordpress.org/reference/functions/wp_is_large_network/
69
- */
70
- function superpwa_multisite_network_deactivator() {
71
-
72
- // Do not run on large networks
73
- if ( wp_is_large_network() ) {
74
- return;
75
- }
76
-
77
- // Retrieve the list of blog ids where SuperPWA is active. (saved with blog_id as $key and activation_status as $value)
78
- $superpwa_sites = get_site_option( 'superpwa_active_sites' );
79
-
80
- // Loop through each active site.
81
- foreach( $superpwa_sites as $blog_id => $actviation_status ) {
82
-
83
- // Switch to each blog
84
- switch_to_blog( $blog_id );
85
-
86
- // Delete manifest
87
- superpwa_delete_manifest();
88
-
89
- // Delete service worker
90
- superpwa_delete_sw();
91
-
92
- /**
93
- * Delete SuperPWA version info for current blog.
94
- *
95
- * This is required so that superpwa_upgrader() will run and create the manifest and service worker on next activation.
96
- * Known edge case: Database upgrade that relies on the version number will fail if user deactivates and later activates after SuperPWA is updated.
97
- */
98
- delete_option( 'superpwa_version' );
99
-
100
- // Save the de-activation status of current blog.
101
- superpwa_multisite_activation_status( false );
102
-
103
- // Return to main site
104
- restore_current_blog();
105
- }
106
  }
1
+ <?php
2
+ /**
3
+ * Functions for compatibility with WordPress multisites
4
+ *
5
+ * @since 1.6
6
+ *
7
+ * @function superpwa_multisite_filename_postfix() Filename postfix for multisites
8
+ * @function superpwa_multisite_activation_status() Save activation status for current blog id
9
+ * @function superpwa_multisite_network_deactivator() Handle multisite network deactivation
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ /**
16
+ * Filename postfix for multisites
17
+ *
18
+ * @return (string) Returns the current blog ID on a multisite. An empty string otherwise
19
+ *
20
+ * @since 1.6
21
+ */
22
+ function superpwa_multisite_filename_postfix() {
23
+
24
+ // Return empty string if not a multisite
25
+ if ( ! is_multisite() ) {
26
+ return '';
27
+ }
28
+
29
+ return '-' . get_current_blog_id();
30
+ }
31
+
32
+ /**
33
+ * Save activation status for current blog id
34
+ *
35
+ * For clean multisite uninstall.
36
+ * Manifest and service worker are deleted during deactivation.
37
+ * Database settings are cleaned during uninstall
38
+ *
39
+ * @param (bool) $status True when plugin is activated, false when deactivated.
40
+ *
41
+ * @since 1.6
42
+ */
43
+ function superpwa_multisite_activation_status( $status ) {
44
+
45
+ // Only for multisites
46
+ if ( ! is_multisite() || ! isset( $status ) ) {
47
+ return;
48
+ }
49
+
50
+ // Get current list of sites where SuperPWA is activated.
51
+ $superpwa_sites = get_site_option( 'superpwa_active_sites', array() );
52
+
53
+ // Set the status for the current blog.
54
+ $superpwa_sites[ get_current_blog_id() ] = $status;
55
+
56
+ // Save it back to the database.
57
+ update_site_option( 'superpwa_active_sites', $superpwa_sites );
58
+ }
59
+
60
+ /**
61
+ * Handle multisite network deactivation
62
+ *
63
+ * Deletes manifest and service worker of all sub-sites.
64
+ * Sets the deactivation status for each site.
65
+ *
66
+ * Not used when wp_is_large_network() is true. Deleting that many files and db options will most likely time out.
67
+ * This also this gives the user an option to decide if SuperPWA should handle this by changing the defenition of wp_is_large_network.
68
+ * @link https://developer.wordpress.org/reference/functions/wp_is_large_network/
69
+ */
70
+ function superpwa_multisite_network_deactivator() {
71
+
72
+ // Do not run on large networks
73
+ if ( wp_is_large_network() ) {
74
+ return;
75
+ }
76
+
77
+ // Retrieve the list of blog ids where SuperPWA is active. (saved with blog_id as $key and activation_status as $value)
78
+ $superpwa_sites = get_site_option( 'superpwa_active_sites' );
79
+
80
+ // Loop through each active site.
81
+ foreach( $superpwa_sites as $blog_id => $actviation_status ) {
82
+
83
+ // Switch to each blog
84
+ switch_to_blog( $blog_id );
85
+
86
+ // Delete manifest
87
+ superpwa_delete_manifest();
88
+
89
+ // Delete service worker
90
+ superpwa_delete_sw();
91
+
92
+ /**
93
+ * Delete SuperPWA version info for current blog.
94
+ *
95
+ * This is required so that superpwa_upgrader() will run and create the manifest and service worker on next activation.
96
+ * Known edge case: Database upgrade that relies on the version number will fail if user deactivates and later activates after SuperPWA is updated.
97
+ */
98
+ delete_option( 'superpwa_version' );
99
+
100
+ // Save the de-activation status of current blog.
101
+ superpwa_multisite_activation_status( false );
102
+
103
+ // Return to main site
104
+ restore_current_blog();
105
+ }
106
  }
includes/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
languages/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
languages/super-progressive-web-apps-fr_FR.po CHANGED
@@ -1,480 +1,480 @@
1
- # Copyright (C) 2018 Super Progressive Web Apps
2
- # This file is distributed under the same license as the Super Progressive Web Apps package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Super Progressive Web Apps 1.8\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/super-progressive-"
7
- "web-apps\n"
8
- "POT-Creation-Date: 2018-06-11 15:50:32+00:00\n"
9
- "PO-Revision-Date: 2018-06-11 21:30+0530\n"
10
- "Last-Translator: WP Media <contact@wp-rocket.me>\n"
11
- "Language-Team: \n"
12
- "Language: fr_FR\n"
13
- "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=UTF-8\n"
15
- "Content-Transfer-Encoding: 8bit\n"
16
- "X-Generator: Poedit 2.0.8\n"
17
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
18
-
19
- #: 3rd-party/onesignal.php:190
20
- msgid ""
21
- "<strong>SuperPWA</strong> is not compatible with OneSignal on multisites "
22
- "yet. Disable one of these plugins until the compatibility is available."
23
- "<br>Please refer to the <a href=\"%s\" target=\"_blank\">OneSignal "
24
- "integration documentation</a> for more info. "
25
- msgstr ""
26
-
27
- #: 3rd-party/onesignal.php:212
28
- msgid ""
29
- "<strong>Action Required to integrate SuperPWA with OneSignal:</strong><br>1. "
30
- "Go to <a href=\"%s\" target=\"_blank\">OneSignal Configuration > Scroll down "
31
- "to Advanced Settings &rarr;</a><br>2. Enable <strong>Use my own manifest."
32
- "json</strong><br>3. Set <code>%s</code>as <strong>Custom manifest.json URL</"
33
- "strong> and Save Settings.<br>Please refer the <a href=\"%s\" target=\"_blank"
34
- "\">OneSignal integration documentation</a> for more info. "
35
- msgstr ""
36
-
37
- #. Plugin Name of the plugin/theme
38
- #: addons/utm-tracking.php:35 admin/admin-ui-setup.php:28
39
- #: admin/admin-ui-setup.php:31 admin/admin-ui-setup.php:34
40
- msgid "Super Progressive Web Apps"
41
- msgstr "Super Progressive Web Apps"
42
-
43
- #: addons/utm-tracking.php:35 admin/admin-ui-render-addons.php:49
44
- msgid "UTM Tracking"
45
- msgstr "Suivi UTM"
46
-
47
- #: addons/utm-tracking.php:146
48
- msgid "Current Start URL"
49
- msgstr "URL de départ actuelle"
50
-
51
- #: addons/utm-tracking.php:155
52
- msgid "Campaign Source"
53
- msgstr "Source de Campagne"
54
-
55
- #: addons/utm-tracking.php:164
56
- msgid "Campaign Medium"
57
- msgstr "Medium de la Campagne"
58
-
59
- #: addons/utm-tracking.php:173
60
- msgid "Campaign Name"
61
- msgstr "Nom de la Campagne"
62
-
63
- #: addons/utm-tracking.php:182
64
- msgid "Campaign Term"
65
- msgstr "Terme de la Campagne"
66
-
67
- #: addons/utm-tracking.php:191
68
- msgid "Campaign Content"
69
- msgstr "Contenu de la Campagne"
70
-
71
- #: addons/utm-tracking.php:234
72
- msgid ""
73
- "This add-on automatically adds UTM campaign parameters to the <code>Start "
74
- "Page</code> URL in your <a href=\"%s\" target=\"_blank\">manifest</a>. This "
75
- "will help you identify visitors coming specifically from your app. <a href="
76
- "\"%s\" target=\"_blank\">Read more</a> about UTM Tracking."
77
- msgstr ""
78
- "Ce module ajoute automatiquement les paramètres de campagne UTM à l'URL de "
79
- "la <code>Page de Départ</code> dans votre <a href=\"%s\" target=\"_blank"
80
- "\">manifeste</a> . Cela vous aidera à identifier les visiteurs provenant "
81
- "spécifiquement de votre application. <a href=\"%s\" target=\"_blank\">En "
82
- "savoir plus</a> sur le Suivi UTM."
83
-
84
- #: addons/utm-tracking.php:264
85
- msgid ""
86
- "Campaign Source is mandatory and defaults to <code>superpwa</code>. The "
87
- "remaining fields are optional."
88
- msgstr ""
89
- "La source de la Campagne est obligatoire et utilise par défaut "
90
- "<code>superpwa</code>. Les autres champs sont facultatifs."
91
-
92
- #: addons/utm-tracking.php:362 admin/admin-ui-render-settings.php:360
93
- msgid "Settings saved."
94
- msgstr "Réglages enregistrés."
95
-
96
- #: addons/utm-tracking.php:371
97
- msgid "UTM Tracking for"
98
- msgstr "Suivi UTM pour"
99
-
100
- #: addons/utm-tracking.php:382 admin/admin-ui-render-settings.php:383
101
- msgid "Save Settings"
102
- msgstr "Sauvegarder les réglages"
103
-
104
- #: admin/admin-ui-render-addons.php:50
105
- msgid ""
106
- "Track visits from your app by adding UTM tracking parameters to the Start "
107
- "Page URL."
108
- msgstr ""
109
- "Suivez les visites de votre application en ajoutant les paramètres de suivi "
110
- "UTM à l’URL de page de départ."
111
-
112
- #: admin/admin-ui-render-addons.php:55
113
- msgid "Customize Settings &rarr;"
114
- msgstr "Personnaliser les paramètres de &rarr;"
115
-
116
- #: admin/admin-ui-render-addons.php:60
117
- msgid "Apple Touch Icons"
118
- msgstr "Icônes Apple Touch"
119
-
120
- #: admin/admin-ui-render-addons.php:61
121
- msgid ""
122
- "Set the Application Icon and Splash Screen Icon as Apple Touch Icons for "
123
- "compatibility with iOS devices."
124
- msgstr ""
125
- "Définir l’icône de l’Application et l’icône de l’écran d’accueil comme les "
126
- "icônes Apple Touch pour la compatibilité avec les appareils iOS."
127
-
128
- #: admin/admin-ui-render-addons.php:66
129
- msgid "More Details &rarr;"
130
- msgstr "Plus de détails &rarr;"
131
-
132
- #: admin/admin-ui-render-addons.php:115
133
- msgid "<strong>Add-On activated: %s.</strong> <a href=\"%s\"%s>%s</a>"
134
- msgstr "<strong>Module activé : %s.</strong> <a href=\"%s\" %s=\"\">%s</a>"
135
-
136
- #: admin/admin-ui-render-addons.php:123
137
- msgid "Add-On deactivated"
138
- msgstr "Module désactivé"
139
-
140
- #: admin/admin-ui-render-addons.php:135
141
- msgid "Add-Ons for"
142
- msgstr "Modules pour"
143
-
144
- #: admin/admin-ui-render-addons.php:137
145
- msgid "Add-Ons extend the functionality of SuperPWA."
146
- msgstr "Les modules étendent les fonctionnalités de SuperPWA."
147
-
148
- #: admin/admin-ui-render-addons.php:177 admin/admin-ui-render-addons.php:349
149
- msgid "Deactivate"
150
- msgstr "Désactiver"
151
-
152
- #: admin/admin-ui-render-addons.php:182
153
- msgid "More information about %s"
154
- msgstr "Plus d’informations sur %s"
155
-
156
- #: admin/admin-ui-render-addons.php:182
157
- msgid "More Details"
158
- msgstr "Plus de détails"
159
-
160
- #: admin/admin-ui-render-addons.php:197
161
- msgid ""
162
- "<span class=\"compatibility-compatible\"><strong>Add-On active.</strong> <a "
163
- "href=\"%s\"%s>%s</a></span>"
164
- msgstr ""
165
- "<span class=\"compatibility-compatible\"><strong>Le module actif.</strong> "
166
- "<a href=\"%s\" %s=\"\">%s</a></span>"
167
-
168
- #: admin/admin-ui-render-addons.php:200
169
- msgid ""
170
- "<span class=\"compatibility-compatible\"><strong>Compatible</strong> with "
171
- "your version of SuperPWA</span>"
172
- msgstr ""
173
- "<span class=\"compatibility-compatible\"><strong>Compatible</strong> avec "
174
- "votre version de SuperPWA</span>"
175
-
176
- #: admin/admin-ui-render-addons.php:203
177
- msgid ""
178
- "<span class=\"compatibility-incompatible\"><strong>Please upgrade</strong> "
179
- "to the latest version of SuperPWA</span>"
180
- msgstr ""
181
- "<span class=\"compatibility-incompatible\"><strong>Veuillez mettre à niveau</"
182
- "strong> vers la dernière version de SuperPWA</span>"
183
-
184
- #: admin/admin-ui-render-addons.php:217
185
- msgid "SuperPWA Newsletter"
186
- msgstr "Newsletter de SuperPWA"
187
-
188
- #: admin/admin-ui-render-addons.php:221
189
- msgid ""
190
- "Learn more about Progressive Web Apps<br>and get latest updates about "
191
- "SuperPWA"
192
- msgstr ""
193
- "En savoir plus sur les Progressive Web Apps<br>et recevez les dernières "
194
- "actualités de SuperPWA"
195
-
196
- #: admin/admin-ui-render-addons.php:229
197
- msgid "Enter your email"
198
- msgstr "Entrez votre email"
199
-
200
- #: admin/admin-ui-render-addons.php:231
201
- msgid "Subscribe"
202
- msgstr "S'abonner"
203
-
204
- #: admin/admin-ui-render-addons.php:233
205
- msgid ""
206
- "we'll share our <code>root</code> password before we share your email with "
207
- "anyone else."
208
- msgstr ""
209
- "nous partagerons notre mot de passe <code>root</code> avant de partager "
210
- "votre email avec qui que ce soit d'autre."
211
-
212
- #: admin/admin-ui-render-addons.php:345
213
- msgid "Activate"
214
- msgstr "Activer"
215
-
216
- #: admin/admin-ui-render-addons.php:354
217
- msgid "Install"
218
- msgstr "Installer"
219
-
220
- #: admin/admin-ui-render-settings.php:60
221
- msgid ""
222
- "Used when there is insufficient space to display the full name of the "
223
- "application. <code>12</code> characters or less."
224
- msgstr ""
225
- "Utilisé lorsque l'espace est insuffisant pour afficher le nom complet de "
226
- "l'application. <code>12</code> caractères ou moins."
227
-
228
- #: admin/admin-ui-render-settings.php:83
229
- msgid "A brief description of what your app is about."
230
- msgstr "Une brève description du sujet sur lequel porte votre application."
231
-
232
- #: admin/admin-ui-render-settings.php:104
233
- #: admin/admin-ui-render-settings.php:127
234
- msgid "Choose Icon"
235
- msgstr "Choisir une icône"
236
-
237
- #: admin/admin-ui-render-settings.php:108
238
- msgid ""
239
- "This will be the icon of your app when installed on the phone. Must be a "
240
- "<code>PNG</code> image exactly <code>192x192</code> in size."
241
- msgstr ""
242
- "Ce sera l'icône de votre application lorsqu'elle est installée sur un "
243
- "smartphone. Elle doit être une image <code>PNG</code> d'exactement "
244
- "<code>192x192</code> pixels."
245
-
246
- #: admin/admin-ui-render-settings.php:131
247
- msgid ""
248
- "This icon will be displayed on the splash screen of your app on supported "
249
- "devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in "
250
- "size."
251
- msgstr ""
252
- "Cette icône sera affichée sur l'écran de démarrage de votre application sur "
253
- "les appareils compatibles. Ça doit être une image <code>PNG</code> "
254
- "d'exactement <code>512x512</code> pixels."
255
-
256
- #: admin/admin-ui-render-settings.php:151
257
- msgid "Background color of the splash screen."
258
- msgstr "Couleur d’arrière-plan de l’écran de démarrage."
259
-
260
- #: admin/admin-ui-render-settings.php:171
261
- msgid ""
262
- "Theme color is used on supported devices to tint the UI elements of the "
263
- "browser and app switcher. When in doubt, use the same color as "
264
- "<code>Background Color</code>."
265
- msgstr ""
266
- "La couleur du thème est utilisée sur les appareils pris en charge pour "
267
- "personnaliser la teinte des éléments d’interface utilisateur du navigateur "
268
- "et du switcher d’app. En cas de doute, utilisez la même couleur que la "
269
- "<code>Couleur d’arrière-plan</code>."
270
-
271
- #: admin/admin-ui-render-settings.php:194
272
- msgid "&mdash; Homepage &mdash;"
273
- msgstr "&mdash; Page d’accueil &mdash;"
274
-
275
- #: admin/admin-ui-render-settings.php:201
276
- msgid ""
277
- "Specify the page to load when the application is launched from a device. "
278
- "Current start page is <code>%s</code>"
279
- msgstr ""
280
- "Spécifiez la page à charger lorsque l'application est lancée à partir d'un "
281
- "appareil. La page d'accueil actuelle est <code>%s</code>"
282
-
283
- #: admin/admin-ui-render-settings.php:209
284
- msgid "Use AMP version of the start page."
285
- msgstr "Utiliser la version AMP de la page de démarrage."
286
-
287
- #: admin/admin-ui-render-settings.php:215
288
- msgid ""
289
- "Do not check this if your start page is the homepage, the blog index, or the "
290
- "archives page. AMP for WordPress does not create AMP versions for these "
291
- "pages."
292
- msgstr ""
293
- "Ne cochez pas cette case si votre page de départ est la page d'accueil de "
294
- "votre site, l'index du blog ou la page d'archives. AMP pour WordPress ne "
295
- "crée pas de versions AMP pour ces pages."
296
-
297
- #: admin/admin-ui-render-settings.php:241
298
- msgid "&mdash; Default &mdash;"
299
- msgstr "&mdash; Par défaut &mdash;"
300
-
301
- #: admin/admin-ui-render-settings.php:248
302
- msgid ""
303
- "Offline page is displayed when the device is offline and the requested page "
304
- "is not already cached. Current offline page is <code>%s</code>"
305
- msgstr ""
306
- "La page hors connexion s’affiche lorsque l'appareil est hors connexion et "
307
- "que la page demandée n’est pas déjà mise en cache. La page hors connexion "
308
- "actuelle est <code>%s</code>"
309
-
310
- #: admin/admin-ui-render-settings.php:268
311
- msgid "Follow Device Orientation"
312
- msgstr "Suivre l'orientation de l'appareil"
313
-
314
- #: admin/admin-ui-render-settings.php:271
315
- msgid "Portrait"
316
- msgstr "Portrait"
317
-
318
- #: admin/admin-ui-render-settings.php:274
319
- msgid "Landscape"
320
- msgstr "Paysage"
321
-
322
- #: admin/admin-ui-render-settings.php:280
323
- msgid ""
324
- "Set the orientation of your app on devices. When set to <code>Follow Device "
325
- "Orientation</code> your app will rotate as the device is rotated."
326
- msgstr ""
327
- "Définissez l'orientation de votre application sur les appareils. Lorsque "
328
- "l'option <code>Suivre l'orientation de l'appareil</code> est définie, votre "
329
- "application tourne en fonction de l'appareil."
330
-
331
- #: admin/admin-ui-render-settings.php:302
332
- msgid ""
333
- "Manifest generated successfully. You can <a href=\"%s\" target=\"_blank"
334
- "\">see it here &rarr;</a>"
335
- msgstr ""
336
- "Le manifeste a été généré avec succès. Vous pouvez <a href=\"%s\" target="
337
- "\"_blank\">le voir ici &rarr;</a>"
338
-
339
- #: admin/admin-ui-render-settings.php:305
340
- msgid ""
341
- "Manifest generation failed. Check if WordPress can write to your root folder "
342
- "(the same folder with wp-config.php). <a href=\"%s\" target=\"_blank\">Read "
343
- "more &rarr;</a>"
344
- msgstr ""
345
- "Échec de génération du manifeste. Vérifiez si WordPress peut écrire dans "
346
- "votre dossier racine (même dossier que wp-config.php). <a href=\"%s\" target="
347
- "\"_blank\">En savoir plux &rarr;</a>"
348
-
349
- #: admin/admin-ui-render-settings.php:320
350
- msgid "Service worker generated successfully."
351
- msgstr "Service Worker généré avec succès."
352
-
353
- #: admin/admin-ui-render-settings.php:323
354
- msgid ""
355
- "Service worker generation failed. Check if WordPress can write to your root "
356
- "folder (the same folder with wp-config.php). <a href=\"%s\" target=\"_blank"
357
- "\">Read more &rarr;</a>"
358
- msgstr ""
359
- "La génération de Service Worker a échouée. Vérifiez si WordPress peut écrire "
360
- "dans votre dossier racine (même dossier que wp-config.php). <a href=\"%s\" "
361
- "target=\"_blank\">En savoir plus &rarr;</a>"
362
-
363
- #: admin/admin-ui-render-settings.php:336
364
- msgid "Your website is served over HTTPS."
365
- msgstr "Votre site Web est servi via HTTPS."
366
-
367
- #: admin/admin-ui-render-settings.php:339
368
- msgid ""
369
- "Progressive Web Apps require that your website is served over HTTPS. Please "
370
- "contact your host to add a SSL certificate to your domain."
371
- msgstr ""
372
- "Les applications Web progressives exigent que votre site est desservie via "
373
- "HTTPS. Contactez votre hébergeur pour ajouter un certificat SSL à votre "
374
- "domaine."
375
-
376
- #. Author of the plugin/theme
377
- #: admin/admin-ui-setup.php:28
378
- msgid "SuperPWA"
379
- msgstr "SuperPWA"
380
-
381
- #: admin/admin-ui-setup.php:31 admin/basic-setup.php:278
382
- msgid "Settings"
383
- msgstr "Réglages"
384
-
385
- #: admin/admin-ui-setup.php:34
386
- msgid "Add-Ons"
387
- msgstr "Add-ons"
388
-
389
- #: admin/admin-ui-setup.php:63
390
- msgid "Application Name"
391
- msgstr "Nom de l’application"
392
-
393
- #: admin/admin-ui-setup.php:72
394
- msgid "Application Short Name"
395
- msgstr "Nom court de l’application"
396
-
397
- #: admin/admin-ui-setup.php:81
398
- msgid "Description"
399
- msgstr "Description"
400
-
401
- #: admin/admin-ui-setup.php:90
402
- msgid "Application Icon"
403
- msgstr "Icône de l’application"
404
-
405
- #: admin/admin-ui-setup.php:99
406
- msgid "Splash Screen Icon"
407
- msgstr "Icône de l’écran de démarrage"
408
-
409
- #: admin/admin-ui-setup.php:108
410
- msgid "Background Color"
411
- msgstr "Couleur d'arrière plan"
412
-
413
- #: admin/admin-ui-setup.php:117
414
- msgid "Theme Color"
415
- msgstr "Couleur du thème"
416
-
417
- #: admin/admin-ui-setup.php:126
418
- msgid "Start Page"
419
- msgstr "Page de départ"
420
-
421
- #: admin/admin-ui-setup.php:135
422
- msgid "Offline Page"
423
- msgstr "Page hors ligne"
424
-
425
- #: admin/admin-ui-setup.php:144
426
- msgid "Orientation"
427
- msgstr "Orientation"
428
-
429
- #: admin/admin-ui-setup.php:153
430
- msgid "Status"
431
- msgstr "Statut"
432
-
433
- #: admin/admin-ui-setup.php:161
434
- msgid "Manifest"
435
- msgstr "Manifeste"
436
-
437
- #: admin/admin-ui-setup.php:170
438
- msgid "Service Worker"
439
- msgstr "Service Worker"
440
-
441
- #: admin/admin-ui-setup.php:179
442
- msgid "HTTPS"
443
- msgstr "HTTPS"
444
-
445
- #: admin/admin-ui-setup.php:305
446
- msgid ""
447
- "If you like SuperPWA, please <a href=\"%s\" target=\"_blank\">make a "
448
- "donation</a> or leave a <a href=\"%s\" target=\"_blank\">&#9733;&#9733;"
449
- "&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a "
450
- "bunch!"
451
- msgstr ""
452
- "Si vous aimez SuperPWA, <a href=\"%s\" target=\"_blank\">faites un don</a> "
453
- "ou laissez une note <a href=\"%s\" target=\"_blank\">&#9733;&#9733;&#9733;"
454
- "&#9733;&#9733;</a> pour soutenir son développement. Merci beaucoup !"
455
-
456
- #: admin/basic-setup.php:82 admin/basic-setup.php:116
457
- msgid ""
458
- "<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a "
459
- "href=\"%s\" target=\"_blank\">Discover new features and read the story &rarr;"
460
- "</a>"
461
- msgstr ""
462
- "<strong>SuperPWA</strong>: Succès de la mise à jour vers la version %s. "
463
- "Merci ! <a href=\"%s\" target=\"_blank\">Découvrez les nouvelles "
464
- "fonctionnalités et lisez notre histoire &rarr;</a>"
465
-
466
- #: admin/basic-setup.php:294
467
- msgid "Demo"
468
- msgstr "Démo"
469
-
470
- #. Plugin URI of the plugin/theme
471
- msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
472
- msgstr "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
473
-
474
- #. Description of the plugin/theme
475
- msgid "Convert your WordPress website into a Progressive Web App"
476
- msgstr "Transformer votre site WordPress en une application Web progressive"
477
-
478
- #. Author URI of the plugin/theme
479
- msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
480
- msgstr "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
1
+ # Copyright (C) 2018 Super Progressive Web Apps
2
+ # This file is distributed under the same license as the Super Progressive Web Apps package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Super Progressive Web Apps 1.8\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/super-progressive-"
7
+ "web-apps\n"
8
+ "POT-Creation-Date: 2018-06-11 15:50:32+00:00\n"
9
+ "PO-Revision-Date: 2018-06-11 21:30+0530\n"
10
+ "Last-Translator: WP Media <contact@wp-rocket.me>\n"
11
+ "Language-Team: \n"
12
+ "Language: fr_FR\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "X-Generator: Poedit 2.0.8\n"
17
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
18
+
19
+ #: 3rd-party/onesignal.php:190
20
+ msgid ""
21
+ "<strong>SuperPWA</strong> is not compatible with OneSignal on multisites "
22
+ "yet. Disable one of these plugins until the compatibility is available."
23
+ "<br>Please refer to the <a href=\"%s\" target=\"_blank\">OneSignal "
24
+ "integration documentation</a> for more info. "
25
+ msgstr ""
26
+
27
+ #: 3rd-party/onesignal.php:212
28
+ msgid ""
29
+ "<strong>Action Required to integrate SuperPWA with OneSignal:</strong><br>1. "
30
+ "Go to <a href=\"%s\" target=\"_blank\">OneSignal Configuration > Scroll down "
31
+ "to Advanced Settings &rarr;</a><br>2. Enable <strong>Use my own manifest."
32
+ "json</strong><br>3. Set <code>%s</code>as <strong>Custom manifest.json URL</"
33
+ "strong> and Save Settings.<br>Please refer the <a href=\"%s\" target=\"_blank"
34
+ "\">OneSignal integration documentation</a> for more info. "
35
+ msgstr ""
36
+
37
+ #. Plugin Name of the plugin/theme
38
+ #: addons/utm-tracking.php:35 admin/admin-ui-setup.php:28
39
+ #: admin/admin-ui-setup.php:31 admin/admin-ui-setup.php:34
40
+ msgid "Super Progressive Web Apps"
41
+ msgstr "Super Progressive Web Apps"
42
+
43
+ #: addons/utm-tracking.php:35 admin/admin-ui-render-addons.php:49
44
+ msgid "UTM Tracking"
45
+ msgstr "Suivi UTM"
46
+
47
+ #: addons/utm-tracking.php:146
48
+ msgid "Current Start URL"
49
+ msgstr "URL de départ actuelle"
50
+
51
+ #: addons/utm-tracking.php:155
52
+ msgid "Campaign Source"
53
+ msgstr "Source de Campagne"
54
+
55
+ #: addons/utm-tracking.php:164
56
+ msgid "Campaign Medium"
57
+ msgstr "Medium de la Campagne"
58
+
59
+ #: addons/utm-tracking.php:173
60
+ msgid "Campaign Name"
61
+ msgstr "Nom de la Campagne"
62
+
63
+ #: addons/utm-tracking.php:182
64
+ msgid "Campaign Term"
65
+ msgstr "Terme de la Campagne"
66
+
67
+ #: addons/utm-tracking.php:191
68
+ msgid "Campaign Content"
69
+ msgstr "Contenu de la Campagne"
70
+
71
+ #: addons/utm-tracking.php:234
72
+ msgid ""
73
+ "This add-on automatically adds UTM campaign parameters to the <code>Start "
74
+ "Page</code> URL in your <a href=\"%s\" target=\"_blank\">manifest</a>. This "
75
+ "will help you identify visitors coming specifically from your app. <a href="
76
+ "\"%s\" target=\"_blank\">Read more</a> about UTM Tracking."
77
+ msgstr ""
78
+ "Ce module ajoute automatiquement les paramètres de campagne UTM à l'URL de "
79
+ "la <code>Page de Départ</code> dans votre <a href=\"%s\" target=\"_blank"
80
+ "\">manifeste</a> . Cela vous aidera à identifier les visiteurs provenant "
81
+ "spécifiquement de votre application. <a href=\"%s\" target=\"_blank\">En "
82
+ "savoir plus</a> sur le Suivi UTM."
83
+
84
+ #: addons/utm-tracking.php:264
85
+ msgid ""
86
+ "Campaign Source is mandatory and defaults to <code>superpwa</code>. The "
87
+ "remaining fields are optional."
88
+ msgstr ""
89
+ "La source de la Campagne est obligatoire et utilise par défaut "
90
+ "<code>superpwa</code>. Les autres champs sont facultatifs."
91
+
92
+ #: addons/utm-tracking.php:362 admin/admin-ui-render-settings.php:360
93
+ msgid "Settings saved."
94
+ msgstr "Réglages enregistrés."
95
+
96
+ #: addons/utm-tracking.php:371
97
+ msgid "UTM Tracking for"
98
+ msgstr "Suivi UTM pour"
99
+
100
+ #: addons/utm-tracking.php:382 admin/admin-ui-render-settings.php:383
101
+ msgid "Save Settings"
102
+ msgstr "Sauvegarder les réglages"
103
+
104
+ #: admin/admin-ui-render-addons.php:50
105
+ msgid ""
106
+ "Track visits from your app by adding UTM tracking parameters to the Start "
107
+ "Page URL."
108
+ msgstr ""
109
+ "Suivez les visites de votre application en ajoutant les paramètres de suivi "
110
+ "UTM à l’URL de page de départ."
111
+
112
+ #: admin/admin-ui-render-addons.php:55
113
+ msgid "Customize Settings &rarr;"
114
+ msgstr "Personnaliser les paramètres de &rarr;"
115
+
116
+ #: admin/admin-ui-render-addons.php:60
117
+ msgid "Apple Touch Icons"
118
+ msgstr "Icônes Apple Touch"
119
+
120
+ #: admin/admin-ui-render-addons.php:61
121
+ msgid ""
122
+ "Set the Application Icon and Splash Screen Icon as Apple Touch Icons for "
123
+ "compatibility with iOS devices."
124
+ msgstr ""
125
+ "Définir l’icône de l’Application et l’icône de l’écran d’accueil comme les "
126
+ "icônes Apple Touch pour la compatibilité avec les appareils iOS."
127
+
128
+ #: admin/admin-ui-render-addons.php:66
129
+ msgid "More Details &rarr;"
130
+ msgstr "Plus de détails &rarr;"
131
+
132
+ #: admin/admin-ui-render-addons.php:115
133
+ msgid "<strong>Add-On activated: %s.</strong> <a href=\"%s\"%s>%s</a>"
134
+ msgstr "<strong>Module activé : %s.</strong> <a href=\"%s\" %s=\"\">%s</a>"
135
+
136
+ #: admin/admin-ui-render-addons.php:123
137
+ msgid "Add-On deactivated"
138
+ msgstr "Module désactivé"
139
+
140
+ #: admin/admin-ui-render-addons.php:135
141
+ msgid "Add-Ons for"
142
+ msgstr "Modules pour"
143
+
144
+ #: admin/admin-ui-render-addons.php:137
145
+ msgid "Add-Ons extend the functionality of SuperPWA."
146
+ msgstr "Les modules étendent les fonctionnalités de SuperPWA."
147
+
148
+ #: admin/admin-ui-render-addons.php:177 admin/admin-ui-render-addons.php:349
149
+ msgid "Deactivate"
150
+ msgstr "Désactiver"
151
+
152
+ #: admin/admin-ui-render-addons.php:182
153
+ msgid "More information about %s"
154
+ msgstr "Plus d’informations sur %s"
155
+
156
+ #: admin/admin-ui-render-addons.php:182
157
+ msgid "More Details"
158
+ msgstr "Plus de détails"
159
+
160
+ #: admin/admin-ui-render-addons.php:197
161
+ msgid ""
162
+ "<span class=\"compatibility-compatible\"><strong>Add-On active.</strong> <a "
163
+ "href=\"%s\"%s>%s</a></span>"
164
+ msgstr ""
165
+ "<span class=\"compatibility-compatible\"><strong>Le module actif.</strong> "
166
+ "<a href=\"%s\" %s=\"\">%s</a></span>"
167
+
168
+ #: admin/admin-ui-render-addons.php:200
169
+ msgid ""
170
+ "<span class=\"compatibility-compatible\"><strong>Compatible</strong> with "
171
+ "your version of SuperPWA</span>"
172
+ msgstr ""
173
+ "<span class=\"compatibility-compatible\"><strong>Compatible</strong> avec "
174
+ "votre version de SuperPWA</span>"
175
+
176
+ #: admin/admin-ui-render-addons.php:203
177
+ msgid ""
178
+ "<span class=\"compatibility-incompatible\"><strong>Please upgrade</strong> "
179
+ "to the latest version of SuperPWA</span>"
180
+ msgstr ""
181
+ "<span class=\"compatibility-incompatible\"><strong>Veuillez mettre à niveau</"
182
+ "strong> vers la dernière version de SuperPWA</span>"
183
+
184
+ #: admin/admin-ui-render-addons.php:217
185
+ msgid "SuperPWA Newsletter"
186
+ msgstr "Newsletter de SuperPWA"
187
+
188
+ #: admin/admin-ui-render-addons.php:221
189
+ msgid ""
190
+ "Learn more about Progressive Web Apps<br>and get latest updates about "
191
+ "SuperPWA"
192
+ msgstr ""
193
+ "En savoir plus sur les Progressive Web Apps<br>et recevez les dernières "
194
+ "actualités de SuperPWA"
195
+
196
+ #: admin/admin-ui-render-addons.php:229
197
+ msgid "Enter your email"
198
+ msgstr "Entrez votre email"
199
+
200
+ #: admin/admin-ui-render-addons.php:231
201
+ msgid "Subscribe"
202
+ msgstr "S'abonner"
203
+
204
+ #: admin/admin-ui-render-addons.php:233
205
+ msgid ""
206
+ "we'll share our <code>root</code> password before we share your email with "
207
+ "anyone else."
208
+ msgstr ""
209
+ "nous partagerons notre mot de passe <code>root</code> avant de partager "
210
+ "votre email avec qui que ce soit d'autre."
211
+
212
+ #: admin/admin-ui-render-addons.php:345
213
+ msgid "Activate"
214
+ msgstr "Activer"
215
+
216
+ #: admin/admin-ui-render-addons.php:354
217
+ msgid "Install"
218
+ msgstr "Installer"
219
+
220
+ #: admin/admin-ui-render-settings.php:60
221
+ msgid ""
222
+ "Used when there is insufficient space to display the full name of the "
223
+ "application. <code>12</code> characters or less."
224
+ msgstr ""
225
+ "Utilisé lorsque l'espace est insuffisant pour afficher le nom complet de "
226
+ "l'application. <code>12</code> caractères ou moins."
227
+
228
+ #: admin/admin-ui-render-settings.php:83
229
+ msgid "A brief description of what your app is about."
230
+ msgstr "Une brève description du sujet sur lequel porte votre application."
231
+
232
+ #: admin/admin-ui-render-settings.php:104
233
+ #: admin/admin-ui-render-settings.php:127
234
+ msgid "Choose Icon"
235
+ msgstr "Choisir une icône"
236
+
237
+ #: admin/admin-ui-render-settings.php:108
238
+ msgid ""
239
+ "This will be the icon of your app when installed on the phone. Must be a "
240
+ "<code>PNG</code> image exactly <code>192x192</code> in size."
241
+ msgstr ""
242
+ "Ce sera l'icône de votre application lorsqu'elle est installée sur un "
243
+ "smartphone. Elle doit être une image <code>PNG</code> d'exactement "
244
+ "<code>192x192</code> pixels."
245
+
246
+ #: admin/admin-ui-render-settings.php:131
247
+ msgid ""
248
+ "This icon will be displayed on the splash screen of your app on supported "
249
+ "devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in "
250
+ "size."
251
+ msgstr ""
252
+ "Cette icône sera affichée sur l'écran de démarrage de votre application sur "
253
+ "les appareils compatibles. Ça doit être une image <code>PNG</code> "
254
+ "d'exactement <code>512x512</code> pixels."
255
+
256
+ #: admin/admin-ui-render-settings.php:151
257
+ msgid "Background color of the splash screen."
258
+ msgstr "Couleur d’arrière-plan de l’écran de démarrage."
259
+
260
+ #: admin/admin-ui-render-settings.php:171
261
+ msgid ""
262
+ "Theme color is used on supported devices to tint the UI elements of the "
263
+ "browser and app switcher. When in doubt, use the same color as "
264
+ "<code>Background Color</code>."
265
+ msgstr ""
266
+ "La couleur du thème est utilisée sur les appareils pris en charge pour "
267
+ "personnaliser la teinte des éléments d’interface utilisateur du navigateur "
268
+ "et du switcher d’app. En cas de doute, utilisez la même couleur que la "
269
+ "<code>Couleur d’arrière-plan</code>."
270
+
271
+ #: admin/admin-ui-render-settings.php:194
272
+ msgid "&mdash; Homepage &mdash;"
273
+ msgstr "&mdash; Page d’accueil &mdash;"
274
+
275
+ #: admin/admin-ui-render-settings.php:201
276
+ msgid ""
277
+ "Specify the page to load when the application is launched from a device. "
278
+ "Current start page is <code>%s</code>"
279
+ msgstr ""
280
+ "Spécifiez la page à charger lorsque l'application est lancée à partir d'un "
281
+ "appareil. La page d'accueil actuelle est <code>%s</code>"
282
+
283
+ #: admin/admin-ui-render-settings.php:209
284
+ msgid "Use AMP version of the start page."
285
+ msgstr "Utiliser la version AMP de la page de démarrage."
286
+
287
+ #: admin/admin-ui-render-settings.php:215
288
+ msgid ""
289
+ "Do not check this if your start page is the homepage, the blog index, or the "
290
+ "archives page. AMP for WordPress does not create AMP versions for these "
291
+ "pages."
292
+ msgstr ""
293
+ "Ne cochez pas cette case si votre page de départ est la page d'accueil de "
294
+ "votre site, l'index du blog ou la page d'archives. AMP pour WordPress ne "
295
+ "crée pas de versions AMP pour ces pages."
296
+
297
+ #: admin/admin-ui-render-settings.php:241
298
+ msgid "&mdash; Default &mdash;"
299
+ msgstr "&mdash; Par défaut &mdash;"
300
+
301
+ #: admin/admin-ui-render-settings.php:248
302
+ msgid ""
303
+ "Offline page is displayed when the device is offline and the requested page "
304
+ "is not already cached. Current offline page is <code>%s</code>"
305
+ msgstr ""
306
+ "La page hors connexion s’affiche lorsque l'appareil est hors connexion et "
307
+ "que la page demandée n’est pas déjà mise en cache. La page hors connexion "
308
+ "actuelle est <code>%s</code>"
309
+
310
+ #: admin/admin-ui-render-settings.php:268
311
+ msgid "Follow Device Orientation"
312
+ msgstr "Suivre l'orientation de l'appareil"
313
+
314
+ #: admin/admin-ui-render-settings.php:271
315
+ msgid "Portrait"
316
+ msgstr "Portrait"
317
+
318
+ #: admin/admin-ui-render-settings.php:274
319
+ msgid "Landscape"
320
+ msgstr "Paysage"
321
+
322
+ #: admin/admin-ui-render-settings.php:280
323
+ msgid ""
324
+ "Set the orientation of your app on devices. When set to <code>Follow Device "
325
+ "Orientation</code> your app will rotate as the device is rotated."
326
+ msgstr ""
327
+ "Définissez l'orientation de votre application sur les appareils. Lorsque "
328
+ "l'option <code>Suivre l'orientation de l'appareil</code> est définie, votre "
329
+ "application tourne en fonction de l'appareil."
330
+
331
+ #: admin/admin-ui-render-settings.php:302
332
+ msgid ""
333
+ "Manifest generated successfully. You can <a href=\"%s\" target=\"_blank"
334
+ "\">see it here &rarr;</a>"
335
+ msgstr ""
336
+ "Le manifeste a été généré avec succès. Vous pouvez <a href=\"%s\" target="
337
+ "\"_blank\">le voir ici &rarr;</a>"
338
+
339
+ #: admin/admin-ui-render-settings.php:305
340
+ msgid ""
341
+ "Manifest generation failed. Check if WordPress can write to your root folder "
342
+ "(the same folder with wp-config.php). <a href=\"%s\" target=\"_blank\">Read "
343
+ "more &rarr;</a>"
344
+ msgstr ""
345
+ "Échec de génération du manifeste. Vérifiez si WordPress peut écrire dans "
346
+ "votre dossier racine (même dossier que wp-config.php). <a href=\"%s\" target="
347
+ "\"_blank\">En savoir plux &rarr;</a>"
348
+
349
+ #: admin/admin-ui-render-settings.php:320
350
+ msgid "Service worker generated successfully."
351
+ msgstr "Service Worker généré avec succès."
352
+
353
+ #: admin/admin-ui-render-settings.php:323
354
+ msgid ""
355
+ "Service worker generation failed. Check if WordPress can write to your root "
356
+ "folder (the same folder with wp-config.php). <a href=\"%s\" target=\"_blank"
357
+ "\">Read more &rarr;</a>"
358
+ msgstr ""
359
+ "La génération de Service Worker a échouée. Vérifiez si WordPress peut écrire "
360
+ "dans votre dossier racine (même dossier que wp-config.php). <a href=\"%s\" "
361
+ "target=\"_blank\">En savoir plus &rarr;</a>"
362
+
363
+ #: admin/admin-ui-render-settings.php:336
364
+ msgid "Your website is served over HTTPS."
365
+ msgstr "Votre site Web est servi via HTTPS."
366
+
367
+ #: admin/admin-ui-render-settings.php:339
368
+ msgid ""
369
+ "Progressive Web Apps require that your website is served over HTTPS. Please "
370
+ "contact your host to add a SSL certificate to your domain."
371
+ msgstr ""
372
+ "Les applications Web progressives exigent que votre site est desservie via "
373
+ "HTTPS. Contactez votre hébergeur pour ajouter un certificat SSL à votre "
374
+ "domaine."
375
+
376
+ #. Author of the plugin/theme
377
+ #: admin/admin-ui-setup.php:28
378
+ msgid "SuperPWA"
379
+ msgstr "SuperPWA"
380
+
381
+ #: admin/admin-ui-setup.php:31 admin/basic-setup.php:278
382
+ msgid "Settings"
383
+ msgstr "Réglages"
384
+
385
+ #: admin/admin-ui-setup.php:34
386
+ msgid "Add-Ons"
387
+ msgstr "Add-ons"
388
+
389
+ #: admin/admin-ui-setup.php:63
390
+ msgid "Application Name"
391
+ msgstr "Nom de l’application"
392
+
393
+ #: admin/admin-ui-setup.php:72
394
+ msgid "Application Short Name"
395
+ msgstr "Nom court de l’application"
396
+
397
+ #: admin/admin-ui-setup.php:81
398
+ msgid "Description"
399
+ msgstr "Description"
400
+
401
+ #: admin/admin-ui-setup.php:90
402
+ msgid "Application Icon"
403
+ msgstr "Icône de l’application"
404
+
405
+ #: admin/admin-ui-setup.php:99
406
+ msgid "Splash Screen Icon"
407
+ msgstr "Icône de l’écran de démarrage"
408
+
409
+ #: admin/admin-ui-setup.php:108
410
+ msgid "Background Color"
411
+ msgstr "Couleur d'arrière plan"
412
+
413
+ #: admin/admin-ui-setup.php:117
414
+ msgid "Theme Color"
415
+ msgstr "Couleur du thème"
416
+
417
+ #: admin/admin-ui-setup.php:126
418
+ msgid "Start Page"
419
+ msgstr "Page de départ"
420
+
421
+ #: admin/admin-ui-setup.php:135
422
+ msgid "Offline Page"
423
+ msgstr "Page hors ligne"
424
+
425
+ #: admin/admin-ui-setup.php:144
426
+ msgid "Orientation"
427
+ msgstr "Orientation"
428
+
429
+ #: admin/admin-ui-setup.php:153
430
+ msgid "Status"
431
+ msgstr "Statut"
432
+
433
+ #: admin/admin-ui-setup.php:161
434
+ msgid "Manifest"
435
+ msgstr "Manifeste"
436
+
437
+ #: admin/admin-ui-setup.php:170
438
+ msgid "Service Worker"
439
+ msgstr "Service Worker"
440
+
441
+ #: admin/admin-ui-setup.php:179
442
+ msgid "HTTPS"
443
+ msgstr "HTTPS"
444
+
445
+ #: admin/admin-ui-setup.php:305
446
+ msgid ""
447
+ "If you like SuperPWA, please <a href=\"%s\" target=\"_blank\">make a "
448
+ "donation</a> or leave a <a href=\"%s\" target=\"_blank\">&#9733;&#9733;"
449
+ "&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a "
450
+ "bunch!"
451
+ msgstr ""
452
+ "Si vous aimez SuperPWA, <a href=\"%s\" target=\"_blank\">faites un don</a> "
453
+ "ou laissez une note <a href=\"%s\" target=\"_blank\">&#9733;&#9733;&#9733;"
454
+ "&#9733;&#9733;</a> pour soutenir son développement. Merci beaucoup !"
455
+
456
+ #: admin/basic-setup.php:82 admin/basic-setup.php:116
457
+ msgid ""
458
+ "<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a "
459
+ "href=\"%s\" target=\"_blank\">Discover new features and read the story &rarr;"
460
+ "</a>"
461
+ msgstr ""
462
+ "<strong>SuperPWA</strong>: Succès de la mise à jour vers la version %s. "
463
+ "Merci ! <a href=\"%s\" target=\"_blank\">Découvrez les nouvelles "
464
+ "fonctionnalités et lisez notre histoire &rarr;</a>"
465
+
466
+ #: admin/basic-setup.php:294
467
+ msgid "Demo"
468
+ msgstr "Démo"
469
+
470
+ #. Plugin URI of the plugin/theme
471
+ msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
472
+ msgstr "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
473
+
474
+ #. Description of the plugin/theme
475
+ msgid "Convert your WordPress website into a Progressive Web App"
476
+ msgstr "Transformer votre site WordPress en une application Web progressive"
477
+
478
+ #. Author URI of the plugin/theme
479
+ msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
480
+ msgstr "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
languages/super-progressive-web-apps.pot CHANGED
@@ -1,390 +1,390 @@
1
- # Copyright (C) 2020 SuperPWA
2
- # This file is distributed under the same license as the Super Progressive Web Apps plugin.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Super Progressive Web Apps 2.1.2\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/super-progressive-web-apps\n"
7
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
- "Language-Team: LANGUAGE <LL@li.org>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-07-25T09:24:14+00:00\n"
13
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
- "X-Generator: WP-CLI 2.4.0\n"
15
- "X-Domain: super-progressive-web-apps\n"
16
-
17
- #. Plugin Name of the plugin
18
- #: addons/utm-tracking.php:35
19
- #: admin/admin-ui-setup.php:28
20
- #: admin/admin-ui-setup.php:31
21
- #: admin/admin-ui-setup.php:34
22
- msgid "Super Progressive Web Apps"
23
- msgstr ""
24
-
25
- #. Plugin URI of the plugin
26
- msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
27
- msgstr ""
28
-
29
- #. Description of the plugin
30
- msgid "Convert your WordPress website into a Progressive Web App"
31
- msgstr ""
32
-
33
- #. Author of the plugin
34
- #: admin/admin-ui-setup.php:28
35
- msgid "SuperPWA"
36
- msgstr ""
37
-
38
- #. Author URI of the plugin
39
- msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
40
- msgstr ""
41
-
42
- #: 3rd-party/onesignal.php:224
43
- msgid "<strong>SuperPWA</strong> is not compatible with OneSignal on multisites yet. Disable one of these plugins until the compatibility is available.<br>Please refer to the <a href=\"%s\" target=\"_blank\">OneSignal integration documentation</a> for more info. "
44
- msgstr ""
45
-
46
- #: addons/utm-tracking.php:35
47
- #: admin/admin-ui-render-addons.php:49
48
- msgid "UTM Tracking"
49
- msgstr ""
50
-
51
- #: addons/utm-tracking.php:148
52
- msgid "Current Start URL"
53
- msgstr ""
54
-
55
- #: addons/utm-tracking.php:157
56
- msgid "Campaign Source"
57
- msgstr ""
58
-
59
- #: addons/utm-tracking.php:166
60
- msgid "Campaign Medium"
61
- msgstr ""
62
-
63
- #: addons/utm-tracking.php:175
64
- msgid "Campaign Name"
65
- msgstr ""
66
-
67
- #: addons/utm-tracking.php:184
68
- msgid "Campaign Term"
69
- msgstr ""
70
-
71
- #: addons/utm-tracking.php:193
72
- msgid "Campaign Content"
73
- msgstr ""
74
-
75
- #: addons/utm-tracking.php:236
76
- msgid "This add-on automatically adds UTM campaign parameters to the <code>Start Page</code> URL in your <a href=\"%s\" target=\"_blank\">manifest</a>. This will help you identify visitors coming specifically from your app. <a href=\"%s\" target=\"_blank\">Read more</a> about UTM Tracking."
77
- msgstr ""
78
-
79
- #: addons/utm-tracking.php:266
80
- #: addons/utm-tracking.php:289
81
- #: addons/utm-tracking.php:312
82
- msgid "Campaign Source is mandatory and defaults to <code>superpwa</code>."
83
- msgstr ""
84
-
85
- #: addons/utm-tracking.php:372
86
- #: admin/admin-ui-render-settings.php:419
87
- msgid "Settings saved."
88
- msgstr ""
89
-
90
- #: addons/utm-tracking.php:381
91
- msgid "UTM Tracking for"
92
- msgstr ""
93
-
94
- #: addons/utm-tracking.php:392
95
- #: admin/admin-ui-render-settings.php:442
96
- msgid "Save Settings"
97
- msgstr ""
98
-
99
- #: admin/admin-ui-render-addons.php:50
100
- msgid "Track visits from your app by adding UTM tracking parameters to the Start Page URL."
101
- msgstr ""
102
-
103
- #: admin/admin-ui-render-addons.php:55
104
- msgid "Customize Settings &rarr;"
105
- msgstr ""
106
-
107
- #: admin/admin-ui-render-addons.php:60
108
- msgid "Apple Touch Icons"
109
- msgstr ""
110
-
111
- #: admin/admin-ui-render-addons.php:61
112
- msgid "Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices."
113
- msgstr ""
114
-
115
- #: admin/admin-ui-render-addons.php:66
116
- msgid "More Details &rarr;"
117
- msgstr ""
118
-
119
- #: admin/admin-ui-render-addons.php:115
120
- msgid "<strong>Add-On activated: %s.</strong> <a href=\"%s\"%s>%s</a>"
121
- msgstr ""
122
-
123
- #: admin/admin-ui-render-addons.php:123
124
- msgid "Add-On deactivated"
125
- msgstr ""
126
-
127
- #: admin/admin-ui-render-addons.php:135
128
- msgid "Add-Ons for"
129
- msgstr ""
130
-
131
- #: admin/admin-ui-render-addons.php:137
132
- msgid "Add-Ons extend the functionality of SuperPWA."
133
- msgstr ""
134
-
135
- #: admin/admin-ui-render-addons.php:177
136
- #: admin/admin-ui-render-addons.php:349
137
- msgid "Deactivate"
138
- msgstr ""
139
-
140
- #: admin/admin-ui-render-addons.php:182
141
- msgid "More information about %s"
142
- msgstr ""
143
-
144
- #: admin/admin-ui-render-addons.php:182
145
- msgid "More Details"
146
- msgstr ""
147
-
148
- #: admin/admin-ui-render-addons.php:197
149
- msgid "<span class=\"compatibility-compatible\"><strong>Add-On active.</strong> <a href=\"%s\"%s>%s</a></span>"
150
- msgstr ""
151
-
152
- #: admin/admin-ui-render-addons.php:200
153
- msgid "<span class=\"compatibility-compatible\"><strong>Compatible</strong> with your version of SuperPWA</span>"
154
- msgstr ""
155
-
156
- #: admin/admin-ui-render-addons.php:203
157
- msgid "<span class=\"compatibility-incompatible\"><strong>Please upgrade</strong> to the latest version of SuperPWA</span>"
158
- msgstr ""
159
-
160
- #: admin/admin-ui-render-addons.php:217
161
- msgid "SuperPWA Newsletter"
162
- msgstr ""
163
-
164
- #: admin/admin-ui-render-addons.php:221
165
- msgid "Learn more about Progressive Web Apps<br>and get latest updates about SuperPWA"
166
- msgstr ""
167
-
168
- #: admin/admin-ui-render-addons.php:229
169
- msgid "Enter your email"
170
- msgstr ""
171
-
172
- #: admin/admin-ui-render-addons.php:231
173
- msgid "Subscribe"
174
- msgstr ""
175
-
176
- #: admin/admin-ui-render-addons.php:233
177
- msgid "we'll share our <code>root</code> password before we share your email with anyone else."
178
- msgstr ""
179
-
180
- #: admin/admin-ui-render-addons.php:345
181
- msgid "Activate"
182
- msgstr ""
183
-
184
- #: admin/admin-ui-render-addons.php:354
185
- msgid "Install"
186
- msgstr ""
187
-
188
- #: admin/admin-ui-render-settings.php:61
189
- msgid "Used when there is insufficient space to display the full name of the application. <span id=\"superpwa-app-short-name-limit\"><code>12</code> characters or less.</span>"
190
- msgstr ""
191
-
192
- #: admin/admin-ui-render-settings.php:84
193
- msgid "A brief description of what your app is about."
194
- msgstr ""
195
-
196
- #: admin/admin-ui-render-settings.php:105
197
- #: admin/admin-ui-render-settings.php:128
198
- msgid "Choose Icon"
199
- msgstr ""
200
-
201
- #: admin/admin-ui-render-settings.php:109
202
- msgid "This will be the icon of your app when installed on the phone. Must be a <code>PNG</code> image exactly <code>192x192</code> in size."
203
- msgstr ""
204
-
205
- #: admin/admin-ui-render-settings.php:132
206
- msgid "This icon will be displayed on the splash screen of your app on supported devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in size."
207
- msgstr ""
208
-
209
- #: admin/admin-ui-render-settings.php:152
210
- msgid "Background color of the splash screen."
211
- msgstr ""
212
-
213
- #: admin/admin-ui-render-settings.php:172
214
- msgid "Theme color is used on supported devices to tint the UI elements of the browser and app switcher. When in doubt, use the same color as <code>Background Color</code>."
215
- msgstr ""
216
-
217
- #: admin/admin-ui-render-settings.php:202
218
- msgid "Specify the page to load when the application is launched from a device. Current start page is <code>%s</code>"
219
- msgstr ""
220
-
221
- #: admin/admin-ui-render-settings.php:210
222
- msgid "Use AMP version of the start page."
223
- msgstr ""
224
-
225
- #: admin/admin-ui-render-settings.php:216
226
- msgid "Do not check this if your start page is the homepage, the blog index, or the archives page. AMP for WordPress does not create AMP versions for these pages."
227
- msgstr ""
228
-
229
- #: admin/admin-ui-render-settings.php:229
230
- msgid "Please enable AMP support for Page in <a href=\"%s\">Theme Settings > Theme Panel</a> > AMP > Post Type Support."
231
- msgstr ""
232
-
233
- #: admin/admin-ui-render-settings.php:263
234
- msgid "Offline page is displayed when the device is offline and the requested page is not already cached. Current offline page is <code>%s</code>"
235
- msgstr ""
236
-
237
- #: admin/admin-ui-render-settings.php:283
238
- msgid "Follow Device Orientation"
239
- msgstr ""
240
-
241
- #: admin/admin-ui-render-settings.php:286
242
- msgid "Portrait"
243
- msgstr ""
244
-
245
- #: admin/admin-ui-render-settings.php:289
246
- msgid "Landscape"
247
- msgstr ""
248
-
249
- #: admin/admin-ui-render-settings.php:295
250
- msgid "Set the orientation of your app on devices. When set to <code>Follow Device Orientation</code> your app will rotate as the device is rotated."
251
- msgstr ""
252
-
253
- #: admin/admin-ui-render-settings.php:317
254
- msgid "Full Screen"
255
- msgstr ""
256
-
257
- #: admin/admin-ui-render-settings.php:320
258
- msgid "Standalone"
259
- msgstr ""
260
-
261
- #: admin/admin-ui-render-settings.php:323
262
- msgid "Minimal UI"
263
- msgstr ""
264
-
265
- #: admin/admin-ui-render-settings.php:326
266
- msgid "Browser"
267
- msgstr ""
268
-
269
- #: admin/admin-ui-render-settings.php:332
270
- msgid "Display mode decides what browser UI is shown when your app is launched. <code>Standalone</code> is default. <a href=\"%s\" target=\"_blank\">What's the difference? &rarr;</a>"
271
- msgstr ""
272
-
273
- #: admin/admin-ui-render-settings.php:355
274
- msgid "Manifest generated successfully. You can <a href=\"%s\" target=\"_blank\">See it here &rarr;</a>"
275
- msgstr ""
276
-
277
- #: admin/admin-ui-render-settings.php:358
278
- msgid "Manifest generation failed. <a href=\"%s\" target=\"_blank\">Fix it &rarr;</a>"
279
- msgstr ""
280
-
281
- #: admin/admin-ui-render-settings.php:379
282
- msgid "Service worker generated successfully. <a href=\"%s\" target=\"_blank\">See it here &rarr;</a>"
283
- msgstr ""
284
-
285
- #: admin/admin-ui-render-settings.php:382
286
- msgid "Service worker generation failed. <a href=\"%s\" target=\"_blank\">Fix it &rarr;</a>"
287
- msgstr ""
288
-
289
- #: admin/admin-ui-render-settings.php:395
290
- msgid "Your website is served over HTTPS."
291
- msgstr ""
292
-
293
- #: admin/admin-ui-render-settings.php:398
294
- msgid "Progressive Web Apps require that your website is served over HTTPS. Please contact your host to add a SSL certificate to your domain."
295
- msgstr ""
296
-
297
- #: admin/admin-ui-setup.php:31
298
- #: admin/basic-setup.php:365
299
- msgid "Settings"
300
- msgstr ""
301
-
302
- #: admin/admin-ui-setup.php:34
303
- msgid "Add-Ons"
304
- msgstr ""
305
-
306
- #: admin/admin-ui-setup.php:63
307
- msgid "Application Name"
308
- msgstr ""
309
-
310
- #: admin/admin-ui-setup.php:72
311
- msgid "Application Short Name"
312
- msgstr ""
313
-
314
- #: admin/admin-ui-setup.php:81
315
- msgid "Description"
316
- msgstr ""
317
-
318
- #: admin/admin-ui-setup.php:90
319
- msgid "Application Icon"
320
- msgstr ""
321
-
322
- #: admin/admin-ui-setup.php:99
323
- msgid "Splash Screen Icon"
324
- msgstr ""
325
-
326
- #: admin/admin-ui-setup.php:108
327
- msgid "Background Color"
328
- msgstr ""
329
-
330
- #: admin/admin-ui-setup.php:117
331
- msgid "Theme Color"
332
- msgstr ""
333
-
334
- #: admin/admin-ui-setup.php:126
335
- msgid "Start Page"
336
- msgstr ""
337
-
338
- #: admin/admin-ui-setup.php:135
339
- msgid "Offline Page"
340
- msgstr ""
341
-
342
- #: admin/admin-ui-setup.php:144
343
- msgid "Orientation"
344
- msgstr ""
345
-
346
- #: admin/admin-ui-setup.php:153
347
- msgid "Display"
348
- msgstr ""
349
-
350
- #: admin/admin-ui-setup.php:162
351
- msgid "Status"
352
- msgstr ""
353
-
354
- #: admin/admin-ui-setup.php:170
355
- msgid "Manifest"
356
- msgstr ""
357
-
358
- #: admin/admin-ui-setup.php:179
359
- msgid "Service Worker"
360
- msgstr ""
361
-
362
- #: admin/admin-ui-setup.php:188
363
- msgid "HTTPS"
364
- msgstr ""
365
-
366
- #: admin/admin-ui-setup.php:348
367
- msgid "If you like SuperPWA, please <a href=\"%s\" target=\"_blank\">make a donation</a> or leave a <a href=\"%s\" target=\"_blank\">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a bunch!"
368
- msgstr ""
369
-
370
- #: admin/basic-setup.php:113
371
- msgid "Your app is ready with the default settings. "
372
- msgstr ""
373
-
374
- #: admin/basic-setup.php:117
375
- msgid "<a href=\"%s\">Customize your app &rarr;</a>"
376
- msgstr ""
377
-
378
- #: admin/basic-setup.php:119
379
- #: admin/basic-setup.php:153
380
- msgid "Thank you for installing <strong>Super Progressive Web Apps!</strong> "
381
- msgstr ""
382
-
383
- #: admin/basic-setup.php:128
384
- #: admin/basic-setup.php:162
385
- msgid "<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a href=\"%s\" target=\"_blank\">Discover new features and read the story &rarr;</a>"
386
- msgstr ""
387
-
388
- #: admin/basic-setup.php:381
389
- msgid "Demo"
390
- msgstr ""
1
+ # Copyright (C) 2020 SuperPWA
2
+ # This file is distributed under the same license as the Super Progressive Web Apps plugin.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Super Progressive Web Apps 2.1.2\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/super-progressive-web-apps\n"
7
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
+ "Language-Team: LANGUAGE <LL@li.org>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-07-25T09:24:14+00:00\n"
13
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.4.0\n"
15
+ "X-Domain: super-progressive-web-apps\n"
16
+
17
+ #. Plugin Name of the plugin
18
+ #: addons/utm-tracking.php:35
19
+ #: admin/admin-ui-setup.php:28
20
+ #: admin/admin-ui-setup.php:31
21
+ #: admin/admin-ui-setup.php:34
22
+ msgid "Super Progressive Web Apps"
23
+ msgstr ""
24
+
25
+ #. Plugin URI of the plugin
26
+ msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
27
+ msgstr ""
28
+
29
+ #. Description of the plugin
30
+ msgid "Convert your WordPress website into a Progressive Web App"
31
+ msgstr ""
32
+
33
+ #. Author of the plugin
34
+ #: admin/admin-ui-setup.php:28
35
+ msgid "SuperPWA"
36
+ msgstr ""
37
+
38
+ #. Author URI of the plugin
39
+ msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
40
+ msgstr ""
41
+
42
+ #: 3rd-party/onesignal.php:224
43
+ msgid "<strong>SuperPWA</strong> is not compatible with OneSignal on multisites yet. Disable one of these plugins until the compatibility is available.<br>Please refer to the <a href=\"%s\" target=\"_blank\">OneSignal integration documentation</a> for more info. "
44
+ msgstr ""
45
+
46
+ #: addons/utm-tracking.php:35
47
+ #: admin/admin-ui-render-addons.php:49
48
+ msgid "UTM Tracking"
49
+ msgstr ""
50
+
51
+ #: addons/utm-tracking.php:148
52
+ msgid "Current Start URL"
53
+ msgstr ""
54
+
55
+ #: addons/utm-tracking.php:157
56
+ msgid "Campaign Source"
57
+ msgstr ""
58
+
59
+ #: addons/utm-tracking.php:166
60
+ msgid "Campaign Medium"
61
+ msgstr ""
62
+
63
+ #: addons/utm-tracking.php:175
64
+ msgid "Campaign Name"
65
+ msgstr ""
66
+
67
+ #: addons/utm-tracking.php:184
68
+ msgid "Campaign Term"
69
+ msgstr ""
70
+
71
+ #: addons/utm-tracking.php:193
72
+ msgid "Campaign Content"
73
+ msgstr ""
74
+
75
+ #: addons/utm-tracking.php:236
76
+ msgid "This add-on automatically adds UTM campaign parameters to the <code>Start Page</code> URL in your <a href=\"%s\" target=\"_blank\">manifest</a>. This will help you identify visitors coming specifically from your app. <a href=\"%s\" target=\"_blank\">Read more</a> about UTM Tracking."
77
+ msgstr ""
78
+
79
+ #: addons/utm-tracking.php:266
80
+ #: addons/utm-tracking.php:289
81
+ #: addons/utm-tracking.php:312
82
+ msgid "Campaign Source is mandatory and defaults to <code>superpwa</code>."
83
+ msgstr ""
84
+
85
+ #: addons/utm-tracking.php:372
86
+ #: admin/admin-ui-render-settings.php:419
87
+ msgid "Settings saved."
88
+ msgstr ""
89
+
90
+ #: addons/utm-tracking.php:381
91
+ msgid "UTM Tracking for"
92
+ msgstr ""
93
+
94
+ #: addons/utm-tracking.php:392
95
+ #: admin/admin-ui-render-settings.php:442
96
+ msgid "Save Settings"
97
+ msgstr ""
98
+
99
+ #: admin/admin-ui-render-addons.php:50
100
+ msgid "Track visits from your app by adding UTM tracking parameters to the Start Page URL."
101
+ msgstr ""
102
+
103
+ #: admin/admin-ui-render-addons.php:55
104
+ msgid "Customize Settings &rarr;"
105
+ msgstr ""
106
+
107
+ #: admin/admin-ui-render-addons.php:60
108
+ msgid "Apple Touch Icons"
109
+ msgstr ""
110
+
111
+ #: admin/admin-ui-render-addons.php:61
112
+ msgid "Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices."
113
+ msgstr ""
114
+
115
+ #: admin/admin-ui-render-addons.php:66
116
+ msgid "More Details &rarr;"
117
+ msgstr ""
118
+
119
+ #: admin/admin-ui-render-addons.php:115
120
+ msgid "<strong>Add-On activated: %s.</strong> <a href=\"%s\"%s>%s</a>"
121
+ msgstr ""
122
+
123
+ #: admin/admin-ui-render-addons.php:123
124
+ msgid "Add-On deactivated"
125
+ msgstr ""
126
+
127
+ #: admin/admin-ui-render-addons.php:135
128
+ msgid "Add-Ons for"
129
+ msgstr ""
130
+
131
+ #: admin/admin-ui-render-addons.php:137
132
+ msgid "Add-Ons extend the functionality of SuperPWA."
133
+ msgstr ""
134
+
135
+ #: admin/admin-ui-render-addons.php:177
136
+ #: admin/admin-ui-render-addons.php:349
137
+ msgid "Deactivate"
138
+ msgstr ""
139
+
140
+ #: admin/admin-ui-render-addons.php:182
141
+ msgid "More information about %s"
142
+ msgstr ""
143
+
144
+ #: admin/admin-ui-render-addons.php:182
145
+ msgid "More Details"
146
+ msgstr ""
147
+
148
+ #: admin/admin-ui-render-addons.php:197
149
+ msgid "<span class=\"compatibility-compatible\"><strong>Add-On active.</strong> <a href=\"%s\"%s>%s</a></span>"
150
+ msgstr ""
151
+
152
+ #: admin/admin-ui-render-addons.php:200
153
+ msgid "<span class=\"compatibility-compatible\"><strong>Compatible</strong> with your version of SuperPWA</span>"
154
+ msgstr ""
155
+
156
+ #: admin/admin-ui-render-addons.php:203
157
+ msgid "<span class=\"compatibility-incompatible\"><strong>Please upgrade</strong> to the latest version of SuperPWA</span>"
158
+ msgstr ""
159
+
160
+ #: admin/admin-ui-render-addons.php:217
161
+ msgid "SuperPWA Newsletter"
162
+ msgstr ""
163
+
164
+ #: admin/admin-ui-render-addons.php:221
165
+ msgid "Learn more about Progressive Web Apps<br>and get latest updates about SuperPWA"
166
+ msgstr ""
167
+
168
+ #: admin/admin-ui-render-addons.php:229
169
+ msgid "Enter your email"
170
+ msgstr ""
171
+
172
+ #: admin/admin-ui-render-addons.php:231
173
+ msgid "Subscribe"
174
+ msgstr ""
175
+
176
+ #: admin/admin-ui-render-addons.php:233
177
+ msgid "we'll share our <code>root</code> password before we share your email with anyone else."
178
+ msgstr ""
179
+
180
+ #: admin/admin-ui-render-addons.php:345
181
+ msgid "Activate"
182
+ msgstr ""
183
+
184
+ #: admin/admin-ui-render-addons.php:354
185
+ msgid "Install"
186
+ msgstr ""
187
+
188
+ #: admin/admin-ui-render-settings.php:61
189
+ msgid "Used when there is insufficient space to display the full name of the application. <span id=\"superpwa-app-short-name-limit\"><code>12</code> characters or less.</span>"
190
+ msgstr ""
191
+
192
+ #: admin/admin-ui-render-settings.php:84
193
+ msgid "A brief description of what your app is about."
194
+ msgstr ""
195
+
196
+ #: admin/admin-ui-render-settings.php:105
197
+ #: admin/admin-ui-render-settings.php:128
198
+ msgid "Choose Icon"
199
+ msgstr ""
200
+
201
+ #: admin/admin-ui-render-settings.php:109
202
+ msgid "This will be the icon of your app when installed on the phone. Must be a <code>PNG</code> image exactly <code>192x192</code> in size."
203
+ msgstr ""
204
+
205
+ #: admin/admin-ui-render-settings.php:132
206
+ msgid "This icon will be displayed on the splash screen of your app on supported devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in size."
207
+ msgstr ""
208
+
209
+ #: admin/admin-ui-render-settings.php:152
210
+ msgid "Background color of the splash screen."
211
+ msgstr ""
212
+
213
+ #: admin/admin-ui-render-settings.php:172
214
+ msgid "Theme color is used on supported devices to tint the UI elements of the browser and app switcher. When in doubt, use the same color as <code>Background Color</code>."
215
+ msgstr ""
216
+
217
+ #: admin/admin-ui-render-settings.php:202
218
+ msgid "Specify the page to load when the application is launched from a device. Current start page is <code>%s</code>"
219
+ msgstr ""
220
+
221
+ #: admin/admin-ui-render-settings.php:210
222
+ msgid "Use AMP version of the start page."
223
+ msgstr ""
224
+
225
+ #: admin/admin-ui-render-settings.php:216
226
+ msgid "Do not check this if your start page is the homepage, the blog index, or the archives page. AMP for WordPress does not create AMP versions for these pages."
227
+ msgstr ""
228
+
229
+ #: admin/admin-ui-render-settings.php:229
230
+ msgid "Please enable AMP support for Page in <a href=\"%s\">Theme Settings > Theme Panel</a> > AMP > Post Type Support."
231
+ msgstr ""
232
+
233
+ #: admin/admin-ui-render-settings.php:263
234
+ msgid "Offline page is displayed when the device is offline and the requested page is not already cached. Current offline page is <code>%s</code>"
235
+ msgstr ""
236
+
237
+ #: admin/admin-ui-render-settings.php:283
238
+ msgid "Follow Device Orientation"
239
+ msgstr ""
240
+
241
+ #: admin/admin-ui-render-settings.php:286
242
+ msgid "Portrait"
243
+ msgstr ""
244
+
245
+ #: admin/admin-ui-render-settings.php:289
246
+ msgid "Landscape"
247
+ msgstr ""
248
+
249
+ #: admin/admin-ui-render-settings.php:295
250
+ msgid "Set the orientation of your app on devices. When set to <code>Follow Device Orientation</code> your app will rotate as the device is rotated."
251
+ msgstr ""
252
+
253
+ #: admin/admin-ui-render-settings.php:317
254
+ msgid "Full Screen"
255
+ msgstr ""
256
+
257
+ #: admin/admin-ui-render-settings.php:320
258
+ msgid "Standalone"
259
+ msgstr ""
260
+
261
+ #: admin/admin-ui-render-settings.php:323
262
+ msgid "Minimal UI"
263
+ msgstr ""
264
+
265
+ #: admin/admin-ui-render-settings.php:326
266
+ msgid "Browser"
267
+ msgstr ""
268
+
269
+ #: admin/admin-ui-render-settings.php:332
270
+ msgid "Display mode decides what browser UI is shown when your app is launched. <code>Standalone</code> is default. <a href=\"%s\" target=\"_blank\">What's the difference? &rarr;</a>"
271
+ msgstr ""
272
+
273
+ #: admin/admin-ui-render-settings.php:355
274
+ msgid "Manifest generated successfully. You can <a href=\"%s\" target=\"_blank\">See it here &rarr;</a>"
275
+ msgstr ""
276
+
277
+ #: admin/admin-ui-render-settings.php:358
278
+ msgid "Manifest generation failed. <a href=\"%s\" target=\"_blank\">Fix it &rarr;</a>"
279
+ msgstr ""
280
+
281
+ #: admin/admin-ui-render-settings.php:379
282
+ msgid "Service worker generated successfully. <a href=\"%s\" target=\"_blank\">See it here &rarr;</a>"
283
+ msgstr ""
284
+
285
+ #: admin/admin-ui-render-settings.php:382
286
+ msgid "Service worker generation failed. <a href=\"%s\" target=\"_blank\">Fix it &rarr;</a>"
287
+ msgstr ""
288
+
289
+ #: admin/admin-ui-render-settings.php:395
290
+ msgid "Your website is served over HTTPS."
291
+ msgstr ""
292
+
293
+ #: admin/admin-ui-render-settings.php:398
294
+ msgid "Progressive Web Apps require that your website is served over HTTPS. Please contact your host to add a SSL certificate to your domain."
295
+ msgstr ""
296
+
297
+ #: admin/admin-ui-setup.php:31
298
+ #: admin/basic-setup.php:365
299
+ msgid "Settings"
300
+ msgstr ""
301
+
302
+ #: admin/admin-ui-setup.php:34
303
+ msgid "Add-Ons"
304
+ msgstr ""
305
+
306
+ #: admin/admin-ui-setup.php:63
307
+ msgid "Application Name"
308
+ msgstr ""
309
+
310
+ #: admin/admin-ui-setup.php:72
311
+ msgid "Application Short Name"
312
+ msgstr ""
313
+
314
+ #: admin/admin-ui-setup.php:81
315
+ msgid "Description"
316
+ msgstr ""
317
+
318
+ #: admin/admin-ui-setup.php:90
319
+ msgid "Application Icon"
320
+ msgstr ""
321
+
322
+ #: admin/admin-ui-setup.php:99
323
+ msgid "Splash Screen Icon"
324
+ msgstr ""
325
+
326
+ #: admin/admin-ui-setup.php:108
327
+ msgid "Background Color"
328
+ msgstr ""
329
+
330
+ #: admin/admin-ui-setup.php:117
331
+ msgid "Theme Color"
332
+ msgstr ""
333
+
334
+ #: admin/admin-ui-setup.php:126
335
+ msgid "Start Page"
336
+ msgstr ""
337
+
338
+ #: admin/admin-ui-setup.php:135
339
+ msgid "Offline Page"
340
+ msgstr ""
341
+
342
+ #: admin/admin-ui-setup.php:144
343
+ msgid "Orientation"
344
+ msgstr ""
345
+
346
+ #: admin/admin-ui-setup.php:153
347
+ msgid "Display"
348
+ msgstr ""
349
+
350
+ #: admin/admin-ui-setup.php:162
351
+ msgid "Status"
352
+ msgstr ""
353
+
354
+ #: admin/admin-ui-setup.php:170
355
+ msgid "Manifest"
356
+ msgstr ""
357
+
358
+ #: admin/admin-ui-setup.php:179
359
+ msgid "Service Worker"
360
+ msgstr ""
361
+
362
+ #: admin/admin-ui-setup.php:188
363
+ msgid "HTTPS"
364
+ msgstr ""
365
+
366
+ #: admin/admin-ui-setup.php:348
367
+ msgid "If you like SuperPWA, please <a href=\"%s\" target=\"_blank\">make a donation</a> or leave a <a href=\"%s\" target=\"_blank\">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a bunch!"
368
+ msgstr ""
369
+
370
+ #: admin/basic-setup.php:113
371
+ msgid "Your app is ready with the default settings. "
372
+ msgstr ""
373
+
374
+ #: admin/basic-setup.php:117
375
+ msgid "<a href=\"%s\">Customize your app &rarr;</a>"
376
+ msgstr ""
377
+
378
+ #: admin/basic-setup.php:119
379
+ #: admin/basic-setup.php:153
380
+ msgid "Thank you for installing <strong>Super Progressive Web Apps!</strong> "
381
+ msgstr ""
382
+
383
+ #: admin/basic-setup.php:128
384
+ #: admin/basic-setup.php:162
385
+ msgid "<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a href=\"%s\" target=\"_blank\">Discover new features and read the story &rarr;</a>"
386
+ msgstr ""
387
+
388
+ #: admin/basic-setup.php:381
389
+ msgid "Demo"
390
+ msgstr ""
license.txt CHANGED
@@ -1,281 +1,281 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
- 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
6
-
7
- Everyone is permitted to copy and distribute verbatim copies
8
- of this license document, but changing it is not allowed.
9
-
10
- Preamble
11
-
12
- The licenses for most software are designed to take away your
13
- freedom to share and change it. By contrast, the GNU General Public
14
- License is intended to guarantee your freedom to share and change free
15
- software--to make sure the software is free for all its users. This
16
- General Public License applies to most of the Free Software
17
- Foundation's software and to any other program whose authors commit to
18
- using it. (Some other Free Software Foundation software is covered by
19
- the GNU Library General Public License instead.) You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- this service if you wish), that you receive source code or can get it
26
- if you want it, that you can change the software or use pieces of it
27
- in new free programs; and that you know you can do these things.
28
-
29
- To protect your rights, we need to make restrictions that forbid
30
- anyone to deny you these rights or to ask you to surrender the rights.
31
- These restrictions translate to certain responsibilities for you if you
32
- distribute copies of the software, or if you modify it.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must give the recipients all the rights that
36
- you have. You must make sure that they, too, receive or can get the
37
- source code. And you must show them these terms so they know their
38
- rights.
39
-
40
- We protect your rights with two steps: (1) copyright the software, and
41
- (2) offer you this license which gives you legal permission to copy,
42
- distribute and/or modify the software.
43
-
44
- Also, for each author's protection and ours, we want to make certain
45
- that everyone understands that there is no warranty for this free
46
- software. If the software is modified by someone else and passed on, we
47
- want its recipients to know that what they have is not the original, so
48
- that any problems introduced by others will not reflect on the original
49
- authors' reputations.
50
-
51
- Finally, any free program is threatened constantly by software
52
- patents. We wish to avoid the danger that redistributors of a free
53
- program will individually obtain patent licenses, in effect making the
54
- program proprietary. To prevent this, we have made it clear that any
55
- patent must be licensed for everyone's free use or not licensed at all.
56
-
57
- The precise terms and conditions for copying, distribution and
58
- modification follow.
59
-
60
- GNU GENERAL PUBLIC LICENSE
61
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
-
63
- 0. This License applies to any program or other work which contains
64
- a notice placed by the copyright holder saying it may be distributed
65
- under the terms of this General Public License. The "Program", below,
66
- refers to any such program or work, and a "work based on the Program"
67
- means either the Program or any derivative work under copyright law:
68
- that is to say, a work containing the Program or a portion of it,
69
- either verbatim or with modifications and/or translated into another
70
- language. (Hereinafter, translation is included without limitation in
71
- the term "modification".) Each licensee is addressed as "you".
72
-
73
- Activities other than copying, distribution and modification are not
74
- covered by this License; they are outside its scope. The act of
75
- running the Program is not restricted, and the output from the Program
76
- is covered only if its contents constitute a work based on the
77
- Program (independent of having been made by running the Program).
78
- Whether that is true depends on what the Program does.
79
-
80
- 1. You may copy and distribute verbatim copies of the Program's
81
- source code as you receive it, in any medium, provided that you
82
- conspicuously and appropriately publish on each copy an appropriate
83
- copyright notice and disclaimer of warranty; keep intact all the
84
- notices that refer to this License and to the absence of any warranty;
85
- and give any other recipients of the Program a copy of this License
86
- along with the Program.
87
-
88
- You may charge a fee for the physical act of transferring a copy, and
89
- you may at your option offer warranty protection in exchange for a fee.
90
-
91
- 2. You may modify your copy or copies of the Program or any portion
92
- of it, thus forming a work based on the Program, and copy and
93
- distribute such modifications or work under the terms of Section 1
94
- above, provided that you also meet all of these conditions:
95
-
96
- a) You must cause the modified files to carry prominent notices
97
- stating that you changed the files and the date of any change.
98
-
99
- b) You must cause any work that you distribute or publish, that in
100
- whole or in part contains or is derived from the Program or any
101
- part thereof, to be licensed as a whole at no charge to all third
102
- parties under the terms of this License.
103
-
104
- c) If the modified program normally reads commands interactively
105
- when run, you must cause it, when started running for such
106
- interactive use in the most ordinary way, to print or display an
107
- announcement including an appropriate copyright notice and a
108
- notice that there is no warranty (or else, saying that you provide
109
- a warranty) and that users may redistribute the program under
110
- these conditions, and telling the user how to view a copy of this
111
- License. (Exception: if the Program itself is interactive but
112
- does not normally print such an announcement, your work based on
113
- the Program is not required to print an announcement.)
114
-
115
- These requirements apply to the modified work as a whole. If
116
- identifiable sections of that work are not derived from the Program,
117
- and can be reasonably considered independent and separate works in
118
- themselves, then this License, and its terms, do not apply to those
119
- sections when you distribute them as separate works. But when you
120
- distribute the same sections as part of a whole which is a work based
121
- on the Program, the distribution of the whole must be on the terms of
122
- this License, whose permissions for other licensees extend to the
123
- entire whole, and thus to each and every part regardless of who wrote it.
124
- Thus, it is not the intent of this section to claim rights or contest
125
- your rights to work written entirely by you; rather, the intent is to
126
- exercise the right to control the distribution of derivative or
127
- collective works based on the Program.
128
-
129
- In addition, mere aggregation of another work not based on the Program
130
- with the Program (or with a work based on the Program) on a volume of
131
- a storage or distribution medium does not bring the other work under
132
- the scope of this License.
133
-
134
- 3. You may copy and distribute the Program (or a work based on it,
135
- under Section 2) in object code or executable form under the terms of
136
- Sections 1 and 2 above provided that you also do one of the following:
137
-
138
- a) Accompany it with the complete corresponding machine-readable
139
- source code, which must be distributed under the terms of Sections
140
- 1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
- b) Accompany it with a written offer, valid for at least three
143
- years, to give any third party, for a charge no more than your
144
- cost of physically performing source distribution, a complete
145
- machine-readable copy of the corresponding source code, to be
146
- distributed under the terms of Sections 1 and 2 above on a medium
147
- customarily used for software interchange; or,
148
-
149
- c) Accompany it with the information you received as to the offer
150
- to distribute corresponding source code. (This alternative is
151
- allowed only for noncommercial distribution and only if you
152
- received the program in object code or executable form with such
153
- an offer, in accord with Subsection b above.)
154
-
155
- The source code for a work means the preferred form of the work for
156
- making modifications to it. For an executable work, complete source
157
- code means all the source code for all modules it contains, plus any
158
- associated interface definition files, plus the scripts used to
159
- control compilation and installation of the executable. However, as a
160
- special exception, the source code distributed need not include
161
- anything that is normally distributed (in either source or binary
162
- form) with the major components (compiler, kernel, and so on) of the
163
- operating system on which the executable runs, unless that component
164
- itself accompanies the executable.
165
-
166
- If distribution of executable or object code is made by offering
167
- access to copy from a designated place, then offering equivalent
168
- access to copy the source code from the same place counts as
169
- distribution of the source code, even though third parties are not
170
- compelled to copy the source along with the object code.
171
-
172
- 4. You may not copy, modify, sublicense, or distribute the Program
173
- except as expressly provided under this License. Any attempt
174
- otherwise to copy, modify, sublicense or distribute the Program is
175
- void, and will automatically terminate your rights under this License.
176
- However, parties who have received copies, or rights, from you under
177
- this License will not have their licenses terminated so long as such
178
- parties remain in full compliance.
179
-
180
- 5. You are not required to accept this License, since you have not
181
- signed it. However, nothing else grants you permission to modify or
182
- distribute the Program or its derivative works. These actions are
183
- prohibited by law if you do not accept this License. Therefore, by
184
- modifying or distributing the Program (or any work based on the
185
- Program), you indicate your acceptance of this License to do so, and
186
- all its terms and conditions for copying, distributing or modifying
187
- the Program or works based on it.
188
-
189
- 6. Each time you redistribute the Program (or any work based on the
190
- Program), the recipient automatically receives a license from the
191
- original licensor to copy, distribute or modify the Program subject to
192
- these terms and conditions. You may not impose any further
193
- restrictions on the recipients' exercise of the rights granted herein.
194
- You are not responsible for enforcing compliance by third parties to
195
- this License.
196
-
197
- 7. If, as a consequence of a court judgment or allegation of patent
198
- infringement or for any other reason (not limited to patent issues),
199
- conditions are imposed on you (whether by court order, agreement or
200
- otherwise) that contradict the conditions of this License, they do not
201
- excuse you from the conditions of this License. If you cannot
202
- distribute so as to satisfy simultaneously your obligations under this
203
- License and any other pertinent obligations, then as a consequence you
204
- may not distribute the Program at all. For example, if a patent
205
- license would not permit royalty-free redistribution of the Program by
206
- all those who receive copies directly or indirectly through you, then
207
- the only way you could satisfy both it and this License would be to
208
- refrain entirely from distribution of the Program.
209
-
210
- If any portion of this section is held invalid or unenforceable under
211
- any particular circumstance, the balance of the section is intended to
212
- apply and the section as a whole is intended to apply in other
213
- circumstances.
214
-
215
- It is not the purpose of this section to induce you to infringe any
216
- patents or other property right claims or to contest validity of any
217
- such claims; this section has the sole purpose of protecting the
218
- integrity of the free software distribution system, which is
219
- implemented by public license practices. Many people have made
220
- generous contributions to the wide range of software distributed
221
- through that system in reliance on consistent application of that
222
- system; it is up to the author/donor to decide if he or she is willing
223
- to distribute software through any other system and a licensee cannot
224
- impose that choice.
225
-
226
- This section is intended to make thoroughly clear what is believed to
227
- be a consequence of the rest of this License.
228
-
229
- 8. If the distribution and/or use of the Program is restricted in
230
- certain countries either by patents or by copyrighted interfaces, the
231
- original copyright holder who places the Program under this License
232
- may add an explicit geographical distribution limitation excluding
233
- those countries, so that distribution is permitted only in or among
234
- countries not thus excluded. In such case, this License incorporates
235
- the limitation as if written in the body of this License.
236
-
237
- 9. The Free Software Foundation may publish revised and/or new versions
238
- of the General Public License from time to time. Such new versions will
239
- be similar in spirit to the present version, but may differ in detail to
240
- address new problems or concerns.
241
-
242
- Each version is given a distinguishing version number. If the Program
243
- specifies a version number of this License which applies to it and "any
244
- later version", you have the option of following the terms and conditions
245
- either of that version or of any later version published by the Free
246
- Software Foundation. If the Program does not specify a version number of
247
- this License, you may choose any version ever published by the Free Software
248
- Foundation.
249
-
250
- 10. If you wish to incorporate parts of the Program into other free
251
- programs whose distribution conditions are different, write to the author
252
- to ask for permission. For software which is copyrighted by the Free
253
- Software Foundation, write to the Free Software Foundation; we sometimes
254
- make exceptions for this. Our decision will be guided by the two goals
255
- of preserving the free status of all derivatives of our free software and
256
- of promoting the sharing and reuse of software generally.
257
-
258
- NO WARRANTY
259
-
260
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
- REPAIR OR CORRECTION.
269
-
270
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
- POSSIBILITY OF SUCH DAMAGES.
279
-
280
- END OF TERMS AND CONDITIONS
281
-
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Library General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
loader.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php
2
- /**
3
- * Loads the plugin files
4
- *
5
- * @since 1.0
6
- */
7
-
8
- // Exit if accessed directly
9
- if ( ! defined('ABSPATH') ) exit;
10
-
11
- // Load admin
12
- require_once( SUPERPWA_PATH_ABS . 'admin/basic-setup.php' );
13
- require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-setup.php' );
14
- require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-render-settings.php' );
15
- require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-render-addons.php' );
16
- require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-render-upgrade.php' );
17
- require_once( SUPERPWA_PATH_ABS . 'admin/mb-helper-function.php' );
18
-
19
- // 3rd party compatibility
20
- require_once( SUPERPWA_PATH_ABS . '3rd-party/onesignal.php' );
21
- require_once( SUPERPWA_PATH_ABS . '3rd-party/yandex.php' );
22
- require_once( SUPERPWA_PATH_ABS . '3rd-party/amp.php' );
23
- require_once( SUPERPWA_PATH_ABS . '3rd-party/wonderpush.php' );
24
-
25
- // Load functions
26
- require_once( SUPERPWA_PATH_ABS . 'functions/common.php' );
27
- require_once( SUPERPWA_PATH_ABS . 'functions/filesystem.php' );
28
- require_once( SUPERPWA_PATH_ABS . 'functions/multisite.php' );
29
-
30
- // Public folder
31
- require_once( SUPERPWA_PATH_ABS . 'public/manifest.php' );
32
- require_once( SUPERPWA_PATH_ABS . 'public/sw.php' );
33
- require_once( SUPERPWA_PATH_ABS . 'public/amphtml.php' );
34
-
35
- // Load bundled add-ons
36
- if ( superpwa_addons_status( 'utm_tracking' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/utm-tracking.php' );
37
- if ( superpwa_addons_status( 'apple_touch_icons' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/apple-touch-icons.php' );
38
- if ( superpwa_addons_status( 'caching_strategies' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/caching-strategies.php' );
39
  if ( superpwa_addons_status( 'pull_to_refresh' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/pull-to-refresh.php' );
1
+ <?php
2
+ /**
3
+ * Loads the plugin files
4
+ *
5
+ * @since 1.0
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined('ABSPATH') ) exit;
10
+
11
+ // Load admin
12
+ require_once( SUPERPWA_PATH_ABS . 'admin/basic-setup.php' );
13
+ require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-setup.php' );
14
+ require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-render-settings.php' );
15
+ require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-render-addons.php' );
16
+ require_once( SUPERPWA_PATH_ABS . 'admin/admin-ui-render-upgrade.php' );
17
+ require_once( SUPERPWA_PATH_ABS . 'admin/mb-helper-function.php' );
18
+
19
+ // 3rd party compatibility
20
+ require_once( SUPERPWA_PATH_ABS . '3rd-party/onesignal.php' );
21
+ require_once( SUPERPWA_PATH_ABS . '3rd-party/yandex.php' );
22
+ require_once( SUPERPWA_PATH_ABS . '3rd-party/amp.php' );
23
+ require_once( SUPERPWA_PATH_ABS . '3rd-party/wonderpush.php' );
24
+
25
+ // Load functions
26
+ require_once( SUPERPWA_PATH_ABS . 'functions/common.php' );
27
+ require_once( SUPERPWA_PATH_ABS . 'functions/filesystem.php' );
28
+ require_once( SUPERPWA_PATH_ABS . 'functions/multisite.php' );
29
+
30
+ // Public folder
31
+ require_once( SUPERPWA_PATH_ABS . 'public/manifest.php' );
32
+ require_once( SUPERPWA_PATH_ABS . 'public/sw.php' );
33
+ require_once( SUPERPWA_PATH_ABS . 'public/amphtml.php' );
34
+
35
+ // Load bundled add-ons
36
+ if ( superpwa_addons_status( 'utm_tracking' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/utm-tracking.php' );
37
+ if ( superpwa_addons_status( 'apple_touch_icons' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/apple-touch-icons.php' );
38
+ if ( superpwa_addons_status( 'caching_strategies' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/caching-strategies.php' );
39
  if ( superpwa_addons_status( 'pull_to_refresh' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/pull-to-refresh.php' );
phpcs.xml CHANGED
@@ -1,6 +1,6 @@
1
- <?xml version="1.0"?>
2
- <ruleset name="Super Progressive Web Apps">
3
- <description>Super Progressive Web Apps coding standard</description>
4
-
5
- <rule ref="WordPress-Extra"/>
6
  </ruleset>
1
+ <?xml version="1.0"?>
2
+ <ruleset name="Super Progressive Web Apps">
3
+ <description>Super Progressive Web Apps coding standard</description>
4
+
5
+ <rule ref="WordPress-Extra"/>
6
  </ruleset>
public/amphtml.php CHANGED
@@ -1,36 +1,36 @@
1
- <?php
2
-
3
- function amp_service_worker_template(){
4
- $url = superpwa_site_url();
5
- $home_url = superpwa_home_url();
6
- $swjs_path_amp = $url.'superpwa-sw'.superpwa_multisite_filename_postfix().'.js';
7
- ?>
8
- <!doctype html>
9
- <html>
10
- <head>
11
- <title>Installing service worker</title>
12
- <script type="text/javascript">
13
- var swsource = "<?php echo $swjs_path_amp; ?>";
14
- if("serviceWorker" in navigator) {
15
- navigator.serviceWorker.register(swsource, {scope: '<?php echo $home_url; ?>'}).then(function(reg){
16
- console.log('Congratulations!!Service Worker Registered ServiceWorker scope: ', reg.scope);
17
- }).catch(function(err) {
18
- console.log('ServiceWorker registration failed: ', err);
19
- });
20
- };
21
-
22
- window.addEventListener('beforeinstallprompt', (e) => {
23
- {{swdefaultaddtohomebar}}
24
- deferredPrompt = e;
25
- })
26
-
27
- </script>
28
- <meta name="robots" content="noindex">
29
- </head>
30
- <body>
31
- Installing service worker...
32
- </body>
33
- </html>
34
-
35
- <?php
36
  }
1
+ <?php
2
+
3
+ function amp_service_worker_template(){
4
+ $url = superpwa_site_url();
5
+ $home_url = superpwa_home_url();
6
+ $swjs_path_amp = $url.'superpwa-sw'.superpwa_multisite_filename_postfix().'.js';
7
+ ?>
8
+ <!doctype html>
9
+ <html>
10
+ <head>
11
+ <title>Installing service worker</title>
12
+ <script type="text/javascript">
13
+ var swsource = "<?php echo $swjs_path_amp; ?>";
14
+ if("serviceWorker" in navigator) {
15
+ navigator.serviceWorker.register(swsource, {scope: '<?php echo $home_url; ?>'}).then(function(reg){
16
+ console.log('Congratulations!!Service Worker Registered ServiceWorker scope: ', reg.scope);
17
+ }).catch(function(err) {
18
+ console.log('ServiceWorker registration failed: ', err);
19
+ });
20
+ };
21
+
22
+ window.addEventListener('beforeinstallprompt', (e) => {
23
+ {{swdefaultaddtohomebar}}
24
+ deferredPrompt = e;
25
+ })
26
+
27
+ </script>
28
+ <meta name="robots" content="noindex">
29
+ </head>
30
+ <body>
31
+ Installing service worker...
32
+ </body>
33
+ </html>
34
+
35
+ <?php
36
  }
public/images/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
public/images/offers.png ADDED
Binary file
public/images/screenshot-472x1024.png ADDED
Binary file
public/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
public/js/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
public/js/register-sw.js CHANGED
@@ -1,261 +1,261 @@
1
- if ('serviceWorker' in navigator) {
2
- window.addEventListener('load', function() {
3
- navigator.serviceWorker.register(superpwa_sw.url)
4
- .then(function(registration) { console.log('SuperPWA service worker ready');
5
- registration.update();
6
- subOnlineOfflineIndicator();
7
- })
8
- .catch(function(error) { console.log('Registration failed with ' + error); });
9
-
10
- /****************** Start : Online/Offline Indicator ******************/
11
-
12
- // Variables & default values
13
- const snackbarTimeToHide = 5000; // 5s
14
- let isOffline = false,
15
- snackbarTimeoutHide = null,
16
- goOfflineMsg = 'You\'re currently offline',
17
- backOnlineMsg = 'You\'re back online <a href="javascript:location.reload()">refresh</a>';
18
-
19
- /**
20
- * Subscribe to online offline indicator
21
- */
22
- function subOnlineOfflineIndicator() {
23
- injectSnackbarHtml();
24
- injectSnackbarCss();
25
- runOnlineOfflineIndicator();
26
- }
27
-
28
- /**
29
- * Inject html of snackbar
30
- */
31
- function injectSnackbarHtml() {
32
- const container = document.createElement('div');
33
- container.className = 'snackbar';
34
-
35
- const parag = document.createElement('p');
36
- parag.id = 'snackbar-msg';
37
- container.appendChild(parag);
38
-
39
- const button = document.createElement('button');
40
- button.type = 'button';
41
- button.className = 'snackbar-close';
42
- button.setAttribute('aria-label', 'snackbar-close');
43
- button.addEventListener('click', hideSnackbar);
44
- button.innerHTML = '&times;';
45
-
46
- container.appendChild(button);
47
-
48
- document.body.appendChild(container);
49
-
50
- window.addEventListener('online', runOnlineOfflineIndicator);
51
- window.addEventListener('offline', runOnlineOfflineIndicator);
52
-
53
- window.addEventListener('fetch',() => console.log("fetch"));
54
-
55
- // Clean snackbarTimeToHide varibale when user hover on the snackbar to prevent hide it
56
- container.addEventListener('mouseover', function () {
57
- if (snackbarTimeoutHide !== null)
58
- clearTimeout(snackbarTimeoutHide);
59
- });
60
-
61
- // Call setTimeout and set snackbarTimeToHide variable to hide snackbar
62
- container.addEventListener('mouseout', function () {
63
- if (snackbarTimeoutHide !== null)
64
- snackbarTimeoutHide = setTimeout(hideSnackbar, snackbarTimeToHide / 2);
65
- });
66
- }
67
-
68
- /**
69
- * Inject style css of snackbar
70
- */
71
- function injectSnackbarCss() {
72
- const css = `body.snackbar--show .snackbar {
73
- -webkit-transform: translateY(0);
74
- transform: translateY(0);
75
- }
76
- .snackbar {
77
- box-sizing: border-box;
78
- background-color: #121213;
79
- color: #fff;
80
- padding: 10px 55px 10px 10px;
81
- position: fixed;
82
- z-index: 9999999999999999;
83
- left: 15px;
84
- bottom: 15px;
85
- border-radius: 5px 8px 8px 5px;
86
- max-width: 90%;
87
- min-height: 48px;
88
- line-height: 28px;
89
- font-size: 16px;
90
- -webkit-transform: translateY(150%);
91
- transform: translateY(150%);
92
- will-change: transform;
93
- -webkit-transition: -webkit-transform 200ms ease-in-out;
94
- -webkit-transition-delay: 0s;
95
- transition-delay: 0s;
96
- -webkit-transition: -webkit-transform 200ms ease-in-out false;
97
- transition: -webkit-transform 200ms ease-in-out false;
98
- transition: transform 200ms ease-in-out false;
99
- transition: transform 200ms ease-in-out false, -webkit-transform 200ms ease-in-out false;
100
- }
101
- .snackbar p {
102
- margin: 0;
103
- color: #fff;
104
- text-align: center;
105
- }
106
- .snackbar .snackbar-close {
107
- position: absolute;
108
- top: 0;
109
- right: 0;
110
- width: 45px;
111
- height: 100%;
112
- padding: 0;
113
- background: #2a2a2a;
114
- border: none;
115
- font-size: 28px;
116
- font-weight: normal;
117
- border-radius: 0 5px 5px 0;
118
- color: #FFF;
119
- font-family: Arial, Helvetica, sans-serif;
120
- }
121
- .snackbar .snackbar-close:hover,
122
- .snackbar .snackbar-close:focus {
123
- background: #3f3f3f;
124
- }
125
- .snackbar a {
126
- color: #FFF;
127
- font-weight: bold;
128
- text-decoration: underline;
129
- }`;
130
-
131
- const head = document.head || document.getElementsByTagName('head')[0];
132
- const style = document.createElement('style');
133
-
134
- style.type = 'text/css';
135
- if (style.styleSheet) {
136
- // This is required for IE8 and below.
137
- style.styleSheet.cssText = css;
138
- } else {
139
- style.appendChild(document.createTextNode(css));
140
- }
141
-
142
- head.appendChild(style);
143
- }
144
-
145
- /**
146
- * Show the state of the mode of connectivity to the user : back onLine | go offLine
147
- */
148
- function runOnlineOfflineIndicator() {
149
- if (navigator.onLine) {
150
- if (isOffline === true) {
151
- showSnackbar(backOnlineMsg);
152
- }
153
- isOffline = false;
154
- } else {
155
- showSnackbar(goOfflineMsg);
156
- isOffline = true;
157
- }
158
- }
159
-
160
- /**
161
- * Show with the given message in the snackbar
162
- * @param {String} msg
163
- */
164
- function showSnackbar(msg) {
165
- document.getElementById('snackbar-msg').innerHTML = msg;
166
- document.body.classList.add('snackbar--show');
167
-
168
- clearTimeout(snackbarTimeoutHide);
169
- snackbarTimeoutHide = setTimeout(hideSnackbar, snackbarTimeToHide);
170
- }
171
-
172
- /**
173
- * Hide snackbar
174
- */
175
- function hideSnackbar() {
176
- document.body.classList.remove('snackbar--show');
177
- }
178
-
179
- /****************** End : Online/Offline Indicator ******************/
180
-
181
- var deferredPrompt;
182
- window.addEventListener('beforeinstallprompt', function(e){
183
- deferredPrompt = e;
184
- if(deferredPrompt != null || deferredPrompt != undefined){
185
- if(superpwa_sw.disable_addtohome==1){
186
- deferredPrompt.preventDefault();
187
- }
188
-
189
- var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
190
- if(a2hsBanner.length){
191
- deferredPrompt.preventDefault();
192
- //Disable on desktop
193
- if(superpwa_sw.enableOnDesktop!=1 && !window.mobileCheck()){return ;}
194
- if(typeof super_check_bar_closed_or_not == 'function' && !super_check_bar_closed_or_not()){return ;}
195
- for (var i = 0; i < a2hsBanner.length; i++) {
196
- var showbanner = a2hsBanner[i].getAttribute("data-show");
197
- a2hsBanner[i].style.display="flex";
198
- }
199
- }
200
- document.cookie = "hidecta=no";
201
- }
202
- })
203
-
204
- window.addEventListener('appinstalled', function(evt){
205
- var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
206
- if(a2hsBanner.length){
207
- for (var i = 0; i < a2hsBanner.length; i++) {
208
- var showbanner = a2hsBanner[i].getAttribute("data-show");
209
- document.cookie = "hidecta=yes";
210
- a2hsBanner[i].style.display="none";
211
- }
212
- }
213
- });
214
-
215
- var a2hsviaClass = document.getElementsByClassName("superpwa-add-via-class");
216
- if(a2hsviaClass !== null){
217
- for (var i = 0; i < a2hsviaClass.length; i++) {
218
- a2hsviaClass[i].addEventListener("click", addToHome);
219
- }
220
- }
221
-
222
- function addToHome(){
223
- if(!deferredPrompt){return ;}
224
- deferredPrompt.prompt();
225
- deferredPrompt.userChoice.then(function(choiceResult) {
226
- if (choiceResult.outcome === "accepted") {
227
- var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
228
- if(a2hsBanner){
229
- for (var i = 0; i < a2hsBanner.length; i++) {
230
- var showbanner = a2hsBanner[i].getAttribute("data-show");
231
- a2hsBanner[i].style.display="none";
232
- }
233
- }//a2hsBanner if
234
- console.log("User accepted the prompt");
235
- }else{
236
- console.log("User dismissed the prompt");
237
- }
238
- deferredPrompt = null;
239
- });
240
- } // function closed addToHome
241
-
242
-
243
- });
244
- }
245
- window.mobileCheck = function() {
246
- let check = false;
247
- (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
248
- return check;
249
- };
250
-
251
- window.addEventListener('load', function() {
252
- var manifestLink = document.querySelectorAll("link[rel='manifest']");
253
- if(manifestLink.length > 1){
254
- for (var i = 0; i < manifestLink.length; i++) {
255
- var href = manifestLink[i].getAttribute("href");
256
- if(href.indexOf("superpwa-manifest.json") == -1){
257
- manifestLink[i].remove();
258
- }
259
- }
260
- }
261
- });
1
+ if ('serviceWorker' in navigator) {
2
+ window.addEventListener('load', function() {
3
+ navigator.serviceWorker.register(superpwa_sw.url)
4
+ .then(function(registration) { console.log('SuperPWA service worker ready');
5
+ registration.update();
6
+ subOnlineOfflineIndicator();
7
+ })
8
+ .catch(function(error) { console.log('Registration failed with ' + error); });
9
+
10
+ /****************** Start : Online/Offline Indicator ******************/
11
+
12
+ // Variables & default values
13
+ const snackbarTimeToHide = 5000; // 5s
14
+ let isOffline = false,
15
+ snackbarTimeoutHide = null,
16
+ goOfflineMsg = 'You\'re currently offline',
17
+ backOnlineMsg = 'You\'re back online <a href="javascript:location.reload()">refresh</a>';
18
+
19
+ /**
20
+ * Subscribe to online offline indicator
21
+ */
22
+ function subOnlineOfflineIndicator() {
23
+ injectSnackbarHtml();
24
+ injectSnackbarCss();
25
+ runOnlineOfflineIndicator();
26
+ }
27
+
28
+ /**
29
+ * Inject html of snackbar
30
+ */
31
+ function injectSnackbarHtml() {
32
+ const container = document.createElement('div');
33
+ container.className = 'snackbar';
34
+
35
+ const parag = document.createElement('p');
36
+ parag.id = 'snackbar-msg';
37
+ container.appendChild(parag);
38
+
39
+ const button = document.createElement('button');
40
+ button.type = 'button';
41
+ button.className = 'snackbar-close';
42
+ button.setAttribute('aria-label', 'snackbar-close');
43
+ button.addEventListener('click', hideSnackbar);
44
+ button.innerHTML = '&times;';
45
+
46
+ container.appendChild(button);
47
+
48
+ document.body.appendChild(container);
49
+
50
+ window.addEventListener('online', runOnlineOfflineIndicator);
51
+ window.addEventListener('offline', runOnlineOfflineIndicator);
52
+
53
+ window.addEventListener('fetch',() => console.log("fetch"));
54
+
55
+ // Clean snackbarTimeToHide varibale when user hover on the snackbar to prevent hide it
56
+ container.addEventListener('mouseover', function () {
57
+ if (snackbarTimeoutHide !== null)
58
+ clearTimeout(snackbarTimeoutHide);
59
+ });
60
+
61
+ // Call setTimeout and set snackbarTimeToHide variable to hide snackbar
62
+ container.addEventListener('mouseout', function () {
63
+ if (snackbarTimeoutHide !== null)
64
+ snackbarTimeoutHide = setTimeout(hideSnackbar, snackbarTimeToHide / 2);
65
+ });
66
+ }
67
+
68
+ /**
69
+ * Inject style css of snackbar
70
+ */
71
+ function injectSnackbarCss() {
72
+ const css = `body.snackbar--show .snackbar {
73
+ -webkit-transform: translateY(0);
74
+ transform: translateY(0);
75
+ }
76
+ .snackbar {
77
+ box-sizing: border-box;
78
+ background-color: #121213;
79
+ color: #fff;
80
+ padding: 10px 55px 10px 10px;
81
+ position: fixed;
82
+ z-index: 9999999999999999;
83
+ left: 15px;
84
+ bottom: 15px;
85
+ border-radius: 5px 8px 8px 5px;
86
+ max-width: 90%;
87
+ min-height: 48px;
88
+ line-height: 28px;
89
+ font-size: 16px;
90
+ -webkit-transform: translateY(150%);
91
+ transform: translateY(150%);
92
+ will-change: transform;
93
+ -webkit-transition: -webkit-transform 200ms ease-in-out;
94
+ -webkit-transition-delay: 0s;
95
+ transition-delay: 0s;
96
+ -webkit-transition: -webkit-transform 200ms ease-in-out false;
97
+ transition: -webkit-transform 200ms ease-in-out false;
98
+ transition: transform 200ms ease-in-out false;
99
+ transition: transform 200ms ease-in-out false, -webkit-transform 200ms ease-in-out false;
100
+ }
101
+ .snackbar p {
102
+ margin: 0;
103
+ color: #fff;
104
+ text-align: center;
105
+ }
106
+ .snackbar .snackbar-close {
107
+ position: absolute;
108
+ top: 0;
109
+ right: 0;
110
+ width: 45px;
111
+ height: 100%;
112
+ padding: 0;
113
+ background: #2a2a2a;
114
+ border: none;
115
+ font-size: 28px;
116
+ font-weight: normal;
117
+ border-radius: 0 5px 5px 0;
118
+ color: #FFF;
119
+ font-family: Arial, Helvetica, sans-serif;
120
+ }
121
+ .snackbar .snackbar-close:hover,
122
+ .snackbar .snackbar-close:focus {
123
+ background: #3f3f3f;
124
+ }
125
+ .snackbar a {
126
+ color: #FFF;
127
+ font-weight: bold;
128
+ text-decoration: underline;
129
+ }`;
130
+
131
+ const head = document.head || document.getElementsByTagName('head')[0];
132
+ const style = document.createElement('style');
133
+
134
+ style.type = 'text/css';
135
+ if (style.styleSheet) {
136
+ // This is required for IE8 and below.
137
+ style.styleSheet.cssText = css;
138
+ } else {
139
+ style.appendChild(document.createTextNode(css));
140
+ }
141
+
142
+ head.appendChild(style);
143
+ }
144
+
145
+ /**
146
+ * Show the state of the mode of connectivity to the user : back onLine | go offLine
147
+ */
148
+ function runOnlineOfflineIndicator() {
149
+ if (navigator.onLine) {
150
+ if (isOffline === true) {
151
+ showSnackbar(backOnlineMsg);
152
+ }
153
+ isOffline = false;
154
+ } else {
155
+ showSnackbar(goOfflineMsg);
156
+ isOffline = true;
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Show with the given message in the snackbar
162
+ * @param {String} msg
163
+ */
164
+ function showSnackbar(msg) {
165
+ document.getElementById('snackbar-msg').innerHTML = msg;
166
+ document.body.classList.add('snackbar--show');
167
+
168
+ clearTimeout(snackbarTimeoutHide);
169
+ snackbarTimeoutHide = setTimeout(hideSnackbar, snackbarTimeToHide);
170
+ }
171
+
172
+ /**
173
+ * Hide snackbar
174
+ */
175
+ function hideSnackbar() {
176
+ document.body.classList.remove('snackbar--show');
177
+ }
178
+
179
+ /****************** End : Online/Offline Indicator ******************/
180
+
181
+ var deferredPrompt;
182
+ window.addEventListener('beforeinstallprompt', function(e){
183
+ deferredPrompt = e;
184
+ if(deferredPrompt != null || deferredPrompt != undefined){
185
+ if(superpwa_sw.disable_addtohome==1){
186
+ deferredPrompt.preventDefault();
187
+ }
188
+
189
+ var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
190
+ if(a2hsBanner.length){
191
+ deferredPrompt.preventDefault();
192
+ //Disable on desktop
193
+ if(superpwa_sw.enableOnDesktop!=1 && !window.mobileCheck()){return ;}
194
+ if(typeof super_check_bar_closed_or_not == 'function' && !super_check_bar_closed_or_not()){return ;}
195
+ for (var i = 0; i < a2hsBanner.length; i++) {
196
+ var showbanner = a2hsBanner[i].getAttribute("data-show");
197
+ a2hsBanner[i].style.display="flex";
198
+ }
199
+ }
200
+ document.cookie = "hidecta=no";
201
+ }
202
+ })
203
+
204
+ window.addEventListener('appinstalled', function(evt){
205
+ var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
206
+ if(a2hsBanner.length){
207
+ for (var i = 0; i < a2hsBanner.length; i++) {
208
+ var showbanner = a2hsBanner[i].getAttribute("data-show");
209
+ document.cookie = "hidecta=yes";
210
+ a2hsBanner[i].style.display="none";
211
+ }
212
+ }
213
+ });
214
+
215
+ var a2hsviaClass = document.getElementsByClassName("superpwa-add-via-class");
216
+ if(a2hsviaClass !== null){
217
+ for (var i = 0; i < a2hsviaClass.length; i++) {
218
+ a2hsviaClass[i].addEventListener("click", addToHome);
219
+ }
220
+ }
221
+
222
+ function addToHome(){
223
+ if(!deferredPrompt){return ;}
224
+ deferredPrompt.prompt();
225
+ deferredPrompt.userChoice.then(function(choiceResult) {
226
+ if (choiceResult.outcome === "accepted") {
227
+ var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
228
+ if(a2hsBanner){
229
+ for (var i = 0; i < a2hsBanner.length; i++) {
230
+ var showbanner = a2hsBanner[i].getAttribute("data-show");
231
+ a2hsBanner[i].style.display="none";
232
+ }
233
+ }//a2hsBanner if
234
+ console.log("User accepted the prompt");
235
+ }else{
236
+ console.log("User dismissed the prompt");
237
+ }
238
+ deferredPrompt = null;
239
+ });
240
+ } // function closed addToHome
241
+
242
+
243
+ });
244
+ }
245
+ window.mobileCheck = function() {
246
+ let check = false;
247
+ (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
248
+ return check;
249
+ };
250
+
251
+ window.addEventListener('load', function() {
252
+ var manifestLink = document.querySelectorAll("link[rel='manifest']");
253
+ if(manifestLink.length > 1){
254
+ for (var i = 0; i < manifestLink.length; i++) {
255
+ var href = manifestLink[i].getAttribute("href");
256
+ if(href.indexOf("superpwa-manifest.json") == -1){
257
+ manifestLink[i].remove();
258
+ }
259
+ }
260
+ }
261
+ });
public/manifest.php CHANGED
@@ -1,467 +1,483 @@
1
- <?php
2
- /**
3
- * Manifest related functions of SuperPWA
4
- *
5
- * @since 1.0
6
- *
7
- * @function superpwa_manifest() Manifest filename, absolute path and link
8
- * @function superpwa_generate_manifest() Generate and write manifest
9
- * @function superpwa_add_manifest_to_wp_head() Add manifest to header (wp_head)
10
- * @function superpwa_register_service_worker() Register service worker in the footer (wp_footer)
11
- * @function superpwa_delete_manifest() Delete manifest
12
- * @function superpwa_get_pwa_icons() Get PWA Icons
13
- * @function superpwa_get_scope() Get navigation scope of PWA
14
- * @function superpwa_get_orientation() Get orientation of PWA
15
- * @function superpwa_get_display() Get display of PWA
16
- */
17
-
18
- // Exit if accessed directly
19
- if ( ! defined( 'ABSPATH' ) ) exit;
20
-
21
- /**
22
- * Returns the Manifest filename.
23
- *
24
- * @since 2.0
25
- *
26
- * @return string
27
- */
28
- function superpwa_get_manifest_filename() {
29
- return 'superpwa-manifest' . superpwa_multisite_filename_postfix() . '.json';
30
- }
31
-
32
- /**
33
- * Manifest filename, absolute path and link
34
- *
35
- * For Multisite compatibility. Used to be constants defined in superpwa.php
36
- * On a multisite, each sub-site needs a different manifest file.
37
- *
38
- * @uses superpwa_get_manifest_filename()
39
- *
40
- * @param $arg filename for manifest filename (replaces SUPERPWA_MANIFEST_FILENAME)
41
- * abs for absolute path to manifest (replaces SUPERPWA_MANIFEST_ABS)
42
- * src for link to manifest (replaces SUPERPWA_MANIFEST_SRC). Default value
43
- *
44
- * @return String filename, absolute path or link to manifest.
45
- *
46
- * @since 1.6
47
- * @since 2.0 src uses home_url instead of network_site_url since manifest is no longer in the root folder.
48
- */
49
- function superpwa_manifest( $arg = 'src' ) {
50
-
51
- $manifest_filename = superpwa_get_manifest_filename();
52
-
53
- switch ( $arg ) {
54
- // TODO: Case `filename` can be deprecated in favor of @see superpwa_get_manifest_filename().
55
- // Name of Manifest file
56
- case 'filename':
57
- return $manifest_filename;
58
- break;
59
-
60
- /**
61
- * Absolute path to manifest.
62
- *
63
- * Note: @since 2.0 manifest is no longer a physical file and absolute path doesn't make sense.
64
- * Also using home_url instead of network_site_url in "src" in 2.0 changes the apparent location of the file.
65
- * However, absolute path is preserved at the "old" location, so that phyiscal files can be deleted when upgrading from pre-2.0 versions.
66
- *
67
- * Since static files are being used in conditions where dynamic files are not possible, this path
68
- * pointing to the root folder of WordPress is still useful.
69
- */
70
- case 'abs':
71
- $filepath = trailingslashit( ABSPATH ) . $manifest_filename;
72
- if(!file_exists($filepath)){
73
- $filepath = trailingslashit( get_home_path() ). $manifest_filename;
74
- }
75
- return $filepath;
76
- break;
77
-
78
- // Link to manifest
79
- case 'src':
80
- default:
81
-
82
- // Get Settings
83
- $settings = superpwa_get_settings();
84
-
85
- /**
86
- * For static file, return site_url and network_site_url
87
- *
88
- * Static files are generated in the root directory.
89
- * The site_url template tag retrieves the site url for the
90
- * current site (where the WordPress core files reside).
91
- */
92
- if ( $settings['is_static_manifest'] === 1 ) {
93
- return trailingslashit( network_site_url() ) . $manifest_filename;
94
- }
95
-
96
- // For dynamic files, return the home_url
97
- return home_url( '/' ) . $manifest_filename;
98
-
99
- break;
100
- }
101
- }
102
-
103
- /**
104
- * Returns the Manifest template.
105
- *
106
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
107
- *
108
- * @return array
109
- *
110
- * @since 2.0 Replaces superpwa_generate_manifest()
111
- * @since 2.0 Added display
112
- */
113
- function superpwa_manifest_template() {
114
-
115
- // Get Settings
116
- $settings = superpwa_get_settings();
117
-
118
- $manifest = array();
119
- $manifest['name'] = $settings['app_name'];
120
- $manifest['short_name'] = $settings['app_short_name'];
121
-
122
- // Description
123
- if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
124
- $manifest['description'] = $settings['description'];
125
- }
126
-
127
- $manifest['icons'] = superpwa_get_pwa_icons();
128
- $manifest['screenshots'] = superpwa_get_pwa_icons();
129
- $manifest['background_color'] = $settings['background_color'];
130
- $manifest['theme_color'] = $settings['theme_color'];
131
- $manifest['display'] = superpwa_get_display();
132
- $manifest['dir'] = superpwa_get_text_dir();
133
- $manifest['orientation'] = superpwa_get_orientation();
134
- $manifest['start_url'] = strlen( superpwa_get_start_url( true ) )>2?user_trailingslashit(superpwa_get_start_url( true )) : superpwa_get_start_url( true );
135
- $manifest['categories'] = (!empty($settings['app_category']) ? $settings['app_category'] : '');
136
- $manifest['scope'] = strlen(superpwa_get_scope())>2? user_trailingslashit(superpwa_get_scope()) : superpwa_get_scope();
137
-
138
- // if(isset($settings['shortcut_url']) && $settings['shortcut_url']!=0){
139
- $shortcut_url = !empty($settings['shortcut_url']) ? get_permalink( $settings['shortcut_url'] ) : '';
140
- $shortcut_url = superpwa_httpsify( $shortcut_url );
141
- // AMP URL
142
- if ( superpwa_is_amp() !== false && isset( $settings['start_url_amp'] ) && $settings['start_url_amp'] == 1 ) {
143
- $shortcut_url = trailingslashit( $shortcut_url ) . superpwa_is_amp();
144
- }
145
- if(function_exists('superpwa_utm_tracking_for_start_url')){
146
- $shortcut_url = superpwa_utm_tracking_for_start_url($shortcut_url);
147
- }
148
-
149
-
150
- $manifest['shortcuts'] = array(
151
- array(
152
- 'name'=>get_the_title( $settings['shortcut_url'] ),
153
- 'short_name'=>get_the_title( $settings['shortcut_url'] ),
154
- 'description'=>get_the_title( $settings['shortcut_url'] ),
155
- 'url'=>user_trailingslashit( parse_url( trailingslashit( $shortcut_url ), PHP_URL_PATH ) ),
156
- 'icons'=>array(array('src'=>$settings['icon'], 'sizes'=>'192x192')),
157
- 'screenshots'=>array(array('src'=>$settings['screenshots'], 'sizes'=>'512x512')),
158
- 'categories'=>$settings['app_category'],
159
- 'shortcode'=>array('name'=>get_the_title( $settings['shortcut_url'] ),
160
- 'short_name'=>get_the_title( $settings['shortcut_url'] ),
161
- 'description'=>get_the_title( $settings['shortcut_url'] ),
162
- 'url'=>user_trailingslashit( parse_url( trailingslashit( $shortcut_url ), PHP_URL_PATH ) ),),
163
- )
164
- );
165
- // }
166
-
167
- /**
168
- * Values that go in to Manifest JSON.
169
- *
170
- * The Web app manifest is a simple JSON file that tells the browser about your web application.
171
- *
172
- * @param array $manifest
173
- */
174
- return apply_filters( 'superpwa_manifest', $manifest );
175
- }
176
-
177
- /**
178
- * Generate and write manifest into WordPress root folder
179
- *
180
- * Starting with 2.0, files are only generated if dynamic files are not possible.
181
- * Some webserver configurations does not load WordPress and attempts to server files directly
182
- * from the server. This returns 404 when files do not exist physically.
183
- *
184
- * @return (boolean) true on success, false on failure.
185
- *
186
- * @author Arun Basil Lal
187
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
188
- *
189
- * @since 1.0
190
- * @since 1.3 Added support for 512x512 icon.
191
- * @since 1.4 Added orientation and scope.
192
- * @since 1.5 Added gcm_sender_id
193
- * @since 1.6 Added description
194
- * @since 1.8 Removed gcm_sender_id and introduced filter superpwa_manifest. gcm_sender_id is added in /3rd-party/onesignal.php
195
- * @since 2.0 Deprecated since Manifest is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
196
- * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description.
197
- */
198
- function superpwa_generate_manifest() {
199
-
200
- // Delete manifest if it exists.
201
- superpwa_delete_manifest();
202
-
203
- // Get Settings
204
- $settings = superpwa_get_settings();
205
-
206
- // Return true if dynamic file returns a 200 response.
207
- if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_manifest_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
208
-
209
- // set file status as dynamic file in database.
210
- $settings['is_static_manifest'] = 0;
211
-
212
- // Write settings back to database.
213
- update_option( 'superpwa_settings', $settings );
214
-
215
- return true;
216
- }
217
-
218
- // Write the manfiest to disk.
219
- if ( superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( superpwa_manifest_template() ) ) ) {
220
-
221
- // set file status as satic file in database.
222
- $settings['is_static_manifest'] = 1;
223
-
224
- // Write settings back to database.
225
- update_option( 'superpwa_settings', $settings );
226
-
227
- return true;
228
- }
229
-
230
- return false;
231
- }
232
-
233
- /**
234
- * Add manifest to header (wp_head)
235
- *
236
- * @since 1.0
237
- * @since 1.8 Introduced filter superpwa_wp_head_tags
238
- * @since 1.9 Introduced filter superpwa_add_theme_color
239
- */
240
- function superpwa_add_manifest_to_wp_head() {
241
-
242
- $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
243
- $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
244
- $tags .= '<link rel="prefetch" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
245
-
246
- // theme-color meta tag
247
- if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
248
-
249
- // Get Settings
250
- $settings = superpwa_get_settings();
251
- $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
252
- }
253
-
254
- $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
255
-
256
- $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL;
257
-
258
- echo $tags;
259
- }
260
- $settings = superpwa_get_settings();
261
- $show_manifest_icon = 0;
262
- $current_page_url = home_url( $_SERVER['REQUEST_URI'] );
263
- if(!empty($settings['excluded_urls'])){
264
- $excluded_urls = explode(",", $settings['excluded_urls']);
265
- if(!empty($excluded_urls)){
266
- foreach($excluded_urls as $excluded_page_url) {
267
- if(trim($excluded_page_url) == trim($current_page_url)){
268
- $show_manifest_icon = 1;
269
- }
270
- }
271
- }
272
- }
273
- if($show_manifest_icon == 0){
274
- add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
275
- }
276
-
277
- /**
278
- * Delete manifest
279
- *
280
- * @return (boolean) true on success, false on failure
281
- *
282
- * @author Arun Basil Lal
283
- *
284
- * @since 1.0
285
- */
286
- function superpwa_delete_manifest() {
287
- return superpwa_delete( superpwa_manifest( 'abs' ) );
288
- }
289
-
290
- /**
291
- * Get PWA Icons
292
- *
293
- * @return array An array of icons to be used as the application icons and splash screen icons
294
- *
295
- * @author Jose Varghese
296
- * @since 1.3
297
- * @since 2.1.1 Added support for Maskable Icons
298
- *
299
- */
300
- function superpwa_get_pwa_icons() {
301
-
302
- // Get settings
303
- $settings = superpwa_get_settings();
304
-
305
- // Application icon
306
- $icons_array[] = array(
307
- 'src' => $settings['icon'],
308
- 'sizes' => '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
309
- 'type' => 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
310
- 'purpose'=> 'any', // any maskable to support adaptive icons
311
- );
312
- $icons_array[] = array(
313
- 'src' => $settings['icon'],
314
- 'sizes' => '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
315
- 'type' => 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
316
- 'purpose'=> 'maskable', // any maskable to support adaptive icons
317
- );
318
-
319
- // Splash screen icon - Added since 1.3
320
- if ( @$settings['splash_icon'] != '' ) {
321
-
322
- $icons_array[] = array(
323
- 'src' => $settings['splash_icon'],
324
- 'sizes' => '512x512', // must be 512x512.
325
- 'type' => 'image/png', // must be image/png
326
- 'purpose'=> 'any',
327
- );
328
- $icons_array[] = array(
329
- 'src' => $settings['splash_icon'],
330
- 'sizes' => '512x512', // must be 512x512.
331
- 'type' => 'image/png', // must be image/png
332
- 'purpose'=> 'maskable',
333
- );
334
- }
335
-
336
- // Screenshots - Added since 2.2.8
337
- if ( @$settings['screenshots'] != '' ) {
338
-
339
- $icons_array[] = array(
340
- 'src' => $settings['screenshots'],
341
- 'sizes' => '512x512', // must be 512x512.
342
- 'type' => 'image/png', // must be image/png
343
- 'purpose'=> 'any',
344
- );
345
- $icons_array[] = array(
346
- 'src' => $settings['screenshots'],
347
- 'sizes' => '512x512', // must be 512x512.
348
- 'type' => 'image/png', // must be image/png
349
- 'purpose'=> 'maskable',
350
- );
351
- }
352
-
353
- return $icons_array;
354
- }
355
-
356
- /**
357
- * Get navigation scope of PWA
358
- *
359
- * @return string Relative path to the folder where WordPress is installed. Same folder as manifest and wp-config.php
360
- * @since 1.4
361
- */
362
- function superpwa_get_scope() {
363
- return parse_url( trailingslashit( superpwa_get_bloginfo( 'sw' ) ), PHP_URL_PATH );
364
- }
365
-
366
- /**
367
- * Get orientation of PWA
368
- *
369
- * @return string Orientation of PWA as set in the plugin settings.
370
- * @since 1.4
371
- */
372
- function superpwa_get_orientation() {
373
-
374
- // Get Settings
375
- $settings = superpwa_get_settings();
376
-
377
- $orientation = isset( $settings['orientation'] ) ? $settings['orientation'] : 0;
378
-
379
- switch ( $orientation ) {
380
-
381
- case 0:
382
- return 'any';
383
- break;
384
-
385
- case 1:
386
- return 'portrait';
387
- break;
388
-
389
- case 2:
390
- return 'landscape';
391
- break;
392
-
393
- default:
394
- return 'any';
395
- }
396
- }
397
-
398
- /**
399
- * Get display of PWA
400
- *
401
- * @return (string) Display of PWA as set in the plugin settings.
402
- *
403
- * @author Jose Varghese
404
- *
405
- * @since 2.0
406
- */
407
- function superpwa_get_display() {
408
-
409
- // Get Settings
410
- $settings = superpwa_get_settings();
411
-
412
- $display = isset( $settings['display'] ) ? $settings['display'] : 1;
413
-
414
- switch ( $display ) {
415
-
416
- case 0:
417
- return 'fullscreen';
418
- break;
419
-
420
- case 1:
421
- return 'standalone';
422
- break;
423
-
424
- case 2:
425
- return 'minimal-ui';
426
- break;
427
-
428
- case 3:
429
- return 'browser';
430
- break;
431
-
432
- default:
433
- return 'standalone';
434
- }
435
- }
436
-
437
-
438
- /**
439
- * Get display of PWA
440
- *
441
- * @return (string) Display of PWA as set in the plugin settings.
442
- *
443
- * @author Jose Varghese
444
- *
445
- * @since 2.0
446
- */
447
- function superpwa_get_text_dir() {
448
-
449
- // Get Settings
450
- $settings = superpwa_get_settings();
451
-
452
- $display = isset( $settings['text_dir'] ) ? $settings['text_dir'] : 0;
453
-
454
- switch ( $display ) {
455
-
456
- case 0:
457
- return 'ltr';
458
- break;
459
-
460
- case 1:
461
- return 'rtl';
462
- break;
463
-
464
- default:
465
- return 'ltr';
466
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
1
+ <?php
2
+ /**
3
+ * Manifest related functions of SuperPWA
4
+ *
5
+ * @since 1.0
6
+ *
7
+ * @function superpwa_manifest() Manifest filename, absolute path and link
8
+ * @function superpwa_generate_manifest() Generate and write manifest
9
+ * @function superpwa_add_manifest_to_wp_head() Add manifest to header (wp_head)
10
+ * @function superpwa_register_service_worker() Register service worker in the footer (wp_footer)
11
+ * @function superpwa_delete_manifest() Delete manifest
12
+ * @function superpwa_get_pwa_icons() Get PWA Icons
13
+ * @function superpwa_get_scope() Get navigation scope of PWA
14
+ * @function superpwa_get_orientation() Get orientation of PWA
15
+ * @function superpwa_get_display() Get display of PWA
16
+ */
17
+
18
+ // Exit if accessed directly
19
+ if ( ! defined( 'ABSPATH' ) ) exit;
20
+
21
+ /**
22
+ * Returns the Manifest filename.
23
+ *
24
+ * @since 2.0
25
+ *
26
+ * @return string
27
+ */
28
+ function superpwa_get_manifest_filename() {
29
+ return 'superpwa-manifest' . superpwa_multisite_filename_postfix() . '.json';
30
+ }
31
+
32
+ /**
33
+ * Manifest filename, absolute path and link
34
+ *
35
+ * For Multisite compatibility. Used to be constants defined in superpwa.php
36
+ * On a multisite, each sub-site needs a different manifest file.
37
+ *
38
+ * @uses superpwa_get_manifest_filename()
39
+ *
40
+ * @param $arg filename for manifest filename (replaces SUPERPWA_MANIFEST_FILENAME)
41
+ * abs for absolute path to manifest (replaces SUPERPWA_MANIFEST_ABS)
42
+ * src for link to manifest (replaces SUPERPWA_MANIFEST_SRC). Default value
43
+ *
44
+ * @return String filename, absolute path or link to manifest.
45
+ *
46
+ * @since 1.6
47
+ * @since 2.0 src uses home_url instead of network_site_url since manifest is no longer in the root folder.
48
+ */
49
+ function superpwa_manifest( $arg = 'src' ) {
50
+
51
+ $manifest_filename = superpwa_get_manifest_filename();
52
+
53
+ switch ( $arg ) {
54
+ // TODO: Case `filename` can be deprecated in favor of @see superpwa_get_manifest_filename().
55
+ // Name of Manifest file
56
+ case 'filename':
57
+ return $manifest_filename;
58
+ break;
59
+
60
+ /**
61
+ * Absolute path to manifest.
62
+ *
63
+ * Note: @since 2.0 manifest is no longer a physical file and absolute path doesn't make sense.
64
+ * Also using home_url instead of network_site_url in "src" in 2.0 changes the apparent location of the file.
65
+ * However, absolute path is preserved at the "old" location, so that phyiscal files can be deleted when upgrading from pre-2.0 versions.
66
+ *
67
+ * Since static files are being used in conditions where dynamic files are not possible, this path
68
+ * pointing to the root folder of WordPress is still useful.
69
+ */
70
+ case 'abs':
71
+ $filepath = trailingslashit( ABSPATH ) . $manifest_filename;
72
+ if(!file_exists($filepath)){
73
+ $filepath = trailingslashit( get_home_path() ). $manifest_filename;
74
+ }
75
+ return $filepath;
76
+ break;
77
+
78
+ // Link to manifest
79
+ case 'src':
80
+ default:
81
+
82
+ // Get Settings
83
+ $settings = superpwa_get_settings();
84
+
85
+ /**
86
+ * For static file, return site_url and network_site_url
87
+ *
88
+ * Static files are generated in the root directory.
89
+ * The site_url template tag retrieves the site url for the
90
+ * current site (where the WordPress core files reside).
91
+ */
92
+ if ( $settings['is_static_manifest'] === 1 ) {
93
+ return trailingslashit( network_site_url() ) . $manifest_filename;
94
+ }
95
+
96
+ // For dynamic files, return the home_url
97
+ return home_url( '/' ) . $manifest_filename;
98
+
99
+ break;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Returns the Manifest template.
105
+ *
106
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
107
+ *
108
+ * @return array
109
+ *
110
+ * @since 2.0 Replaces superpwa_generate_manifest()
111
+ * @since 2.0 Added display
112
+ */
113
+ function superpwa_manifest_template() {
114
+
115
+ // Get Settings
116
+ $settings = superpwa_get_settings();
117
+
118
+ $manifest = array();
119
+ $manifest['name'] = $settings['app_name'];
120
+ $manifest['short_name'] = $settings['app_short_name'];
121
+
122
+ // Description
123
+ if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
124
+ $manifest['description'] = $settings['description'];
125
+ }
126
+
127
+ $manifest['icons'] = superpwa_get_pwa_icons();
128
+ $manifest['screenshots'] = superpwa_get_pwa_screenshots();
129
+ $manifest['background_color'] = $settings['background_color'];
130
+ $manifest['theme_color'] = $settings['theme_color'];
131
+ $manifest['display'] = superpwa_get_display();
132
+ $manifest['dir'] = superpwa_get_text_dir();
133
+ $manifest['orientation'] = superpwa_get_orientation();
134
+ $manifest['start_url'] = strlen( superpwa_get_start_url( true ) )>2?user_trailingslashit(superpwa_get_start_url( true )) : superpwa_get_start_url( true );
135
+ $manifest['categories'] = (!empty($settings['app_category']) ? $settings['app_category'] : '');
136
+ $manifest['scope'] = strlen(superpwa_get_scope())>2? user_trailingslashit(superpwa_get_scope()) : superpwa_get_scope();
137
+
138
+ // if(isset($settings['shortcut_url']) && $settings['shortcut_url']!=0){
139
+ $shortcut_url = !empty($settings['shortcut_url']) ? get_permalink( $settings['shortcut_url'] ) : '';
140
+ $shortcut_url = superpwa_httpsify( $shortcut_url );
141
+ // AMP URL
142
+ if ( superpwa_is_amp() !== false && isset( $settings['start_url_amp'] ) && $settings['start_url_amp'] == 1 ) {
143
+ $shortcut_url = trailingslashit( $shortcut_url ) . superpwa_is_amp();
144
+ }
145
+ if(function_exists('superpwa_utm_tracking_for_start_url')){
146
+ $shortcut_url = superpwa_utm_tracking_for_start_url($shortcut_url);
147
+ }
148
+
149
+
150
+ $manifest['shortcuts'] = array(
151
+ array(
152
+ 'name'=>$settings['app_short_name'],
153
+ 'url'=>user_trailingslashit( parse_url( trailingslashit( $shortcut_url ), PHP_URL_PATH ) ),
154
+ )
155
+ );
156
+
157
+
158
+ if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
159
+ $manifest['shortcuts'][0]['description'] = $settings['description'];
160
+ }
161
+
162
+ if ( isset( $settings['icon'] ) && ! empty( $settings['icon'] ) ) {
163
+ $manifest['shortcuts'][0]['icons'] = array(array('src'=>$settings['icon'], 'sizes'=>'192x192'));
164
+ }
165
+
166
+ // }
167
+
168
+ /**
169
+ * Values that go in to Manifest JSON.
170
+ *
171
+ * The Web app manifest is a simple JSON file that tells the browser about your web application.
172
+ *
173
+ * @param array $manifest
174
+ */
175
+ return apply_filters( 'superpwa_manifest', $manifest );
176
+ }
177
+
178
+ /**
179
+ * Generate and write manifest into WordPress root folder
180
+ *
181
+ * Starting with 2.0, files are only generated if dynamic files are not possible.
182
+ * Some webserver configurations does not load WordPress and attempts to server files directly
183
+ * from the server. This returns 404 when files do not exist physically.
184
+ *
185
+ * @return (boolean) true on success, false on failure.
186
+ *
187
+ * @author Arun Basil Lal
188
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
189
+ *
190
+ * @since 1.0
191
+ * @since 1.3 Added support for 512x512 icon.
192
+ * @since 1.4 Added orientation and scope.
193
+ * @since 1.5 Added gcm_sender_id
194
+ * @since 1.6 Added description
195
+ * @since 1.8 Removed gcm_sender_id and introduced filter superpwa_manifest. gcm_sender_id is added in /3rd-party/onesignal.php
196
+ * @since 2.0 Deprecated since Manifest is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
197
+ * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description.
198
+ */
199
+ function superpwa_generate_manifest() {
200
+
201
+ // Delete manifest if it exists.
202
+ superpwa_delete_manifest();
203
+
204
+ // Get Settings
205
+ $settings = superpwa_get_settings();
206
+
207
+ // Return true if dynamic file returns a 200 response.
208
+ if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_manifest_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
209
+
210
+ // set file status as dynamic file in database.
211
+ $settings['is_static_manifest'] = 0;
212
+
213
+ // Write settings back to database.
214
+ update_option( 'superpwa_settings', $settings );
215
+
216
+ return true;
217
+ }
218
+
219
+ // Write the manfiest to disk.
220
+ if ( superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( superpwa_manifest_template() ) ) ) {
221
+
222
+ // set file status as satic file in database.
223
+ $settings['is_static_manifest'] = 1;
224
+
225
+ // Write settings back to database.
226
+ update_option( 'superpwa_settings', $settings );
227
+
228
+ return true;
229
+ }
230
+
231
+ return false;
232
+ }
233
+
234
+ /**
235
+ * Add manifest to header (wp_head)
236
+ *
237
+ * @since 1.0
238
+ * @since 1.8 Introduced filter superpwa_wp_head_tags
239
+ * @since 1.9 Introduced filter superpwa_add_theme_color
240
+ */
241
+ function superpwa_add_manifest_to_wp_head() {
242
+
243
+ $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
244
+ $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
245
+ $tags .= '<link rel="prefetch" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
246
+
247
+ // theme-color meta tag
248
+ if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
249
+
250
+ // Get Settings
251
+ $settings = superpwa_get_settings();
252
+ $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
253
+ }
254
+
255
+ $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
256
+
257
+ $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL;
258
+
259
+ echo $tags;
260
+ }
261
+ $settings = superpwa_get_settings();
262
+ $show_manifest_icon = 0;
263
+ $current_page_url = home_url( $_SERVER['REQUEST_URI'] );
264
+ if(!empty($settings['excluded_urls'])){
265
+ $excluded_urls = explode(",", $settings['excluded_urls']);
266
+ if(!empty($excluded_urls)){
267
+ foreach($excluded_urls as $excluded_page_url) {
268
+ if(trim($excluded_page_url) == trim($current_page_url)){
269
+ $show_manifest_icon = 1;
270
+ }
271
+ }
272
+ }
273
+ }
274
+ if($show_manifest_icon == 0){
275
+ add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
276
+ }
277
+
278
+ /**
279
+ * Delete manifest
280
+ *
281
+ * @return (boolean) true on success, false on failure
282
+ *
283
+ * @author Arun Basil Lal
284
+ *
285
+ * @since 1.0
286
+ */
287
+ function superpwa_delete_manifest() {
288
+ return superpwa_delete( superpwa_manifest( 'abs' ) );
289
+ }
290
+
291
+ /**
292
+ * Get PWA Icons
293
+ *
294
+ * @return array An array of icons to be used as the application icons and splash screen icons
295
+ *
296
+ * @author Jose Varghese
297
+ * @since 1.3
298
+ * @since 2.1.1 Added support for Maskable Icons
299
+ *
300
+ */
301
+ function superpwa_get_pwa_icons() {
302
+
303
+ // Get settings
304
+ $settings = superpwa_get_settings();
305
+
306
+ // Application icon
307
+ $icons_array[] = array(
308
+ 'src' => $settings['icon'],
309
+ 'sizes' => '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
310
+ 'type' => 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
311
+ 'purpose'=> 'any', // any maskable to support adaptive icons
312
+ );
313
+ $icons_array[] = array(
314
+ 'src' => $settings['icon'],
315
+ 'sizes' => '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
316
+ 'type' => 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
317
+ 'purpose'=> 'maskable', // any maskable to support adaptive icons
318
+ );
319
+
320
+ // Splash screen icon - Added since 1.3
321
+ if ( @$settings['splash_icon'] != '' ) {
322
+
323
+ $icons_array[] = array(
324
+ 'src' => $settings['splash_icon'],
325
+ 'sizes' => '512x512', // must be 512x512.
326
+ 'type' => 'image/png', // must be image/png
327
+ 'purpose'=> 'any',
328
+ );
329
+ $icons_array[] = array(
330
+ 'src' => $settings['splash_icon'],
331
+ 'sizes' => '512x512', // must be 512x512.
332
+ 'type' => 'image/png', // must be image/png
333
+ 'purpose'=> 'maskable',
334
+ );
335
+ }
336
+
337
+ return $icons_array;
338
+ }
339
+
340
+ /**
341
+ * Get PWA Screenshot
342
+ *
343
+ * @return array An array of images to be used as the screenshot
344
+ *
345
+ * @since 2.2.8
346
+ *
347
+ */
348
+ function superpwa_get_pwa_screenshots() {
349
+
350
+ // Get settings
351
+ $settings = superpwa_get_settings();
352
+
353
+ // Screenshots - Added since 2.2.8
354
+
355
+ if ( @$settings['screenshots'] != '' ) {
356
+
357
+ $tmp_arr=explode(',',$settings['screenshots']);
358
+
359
+ foreach($tmp_arr as $item){
360
+ $screenshot_array[] = array(
361
+ 'src' => $item,
362
+ 'sizes' => '472x1024', // must be 472x1024.
363
+ 'type' => 'image/png', // must be image/png
364
+
365
+ );
366
+ }
367
+ }
368
+
369
+ return $screenshot_array;
370
+ }
371
+
372
+ /**
373
+ * Get navigation scope of PWA
374
+ *
375
+ * @return string Relative path to the folder where WordPress is installed. Same folder as manifest and wp-config.php
376
+ * @since 1.4
377
+ */
378
+ function superpwa_get_scope() {
379
+ return parse_url( trailingslashit( superpwa_get_bloginfo( 'sw' ) ), PHP_URL_PATH );
380
+ }
381
+
382
+ /**
383
+ * Get orientation of PWA
384
+ *
385
+ * @return string Orientation of PWA as set in the plugin settings.
386
+ * @since 1.4
387
+ */
388
+ function superpwa_get_orientation() {
389
+
390
+ // Get Settings
391
+ $settings = superpwa_get_settings();
392
+
393
+ $orientation = isset( $settings['orientation'] ) ? $settings['orientation'] : 0;
394
+
395
+ switch ( $orientation ) {
396
+
397
+ case 0:
398
+ return 'any';
399
+ break;
400
+
401
+ case 1:
402
+ return 'portrait';
403
+ break;
404
+
405
+ case 2:
406
+ return 'landscape';
407
+ break;
408
+
409
+ default:
410
+ return 'any';
411
+ }
412
+ }
413
+
414
+ /**
415
+ * Get display of PWA
416
+ *
417
+ * @return (string) Display of PWA as set in the plugin settings.
418
+ *
419
+ * @author Jose Varghese
420
+ *
421
+ * @since 2.0
422
+ */
423
+ function superpwa_get_display() {
424
+
425
+ // Get Settings
426
+ $settings = superpwa_get_settings();
427
+
428
+ $display = isset( $settings['display'] ) ? $settings['display'] : 1;
429
+
430
+ switch ( $display ) {
431
+
432
+ case 0:
433
+ return 'fullscreen';
434
+ break;
435
+
436
+ case 1:
437
+ return 'standalone';
438
+ break;
439
+
440
+ case 2:
441
+ return 'minimal-ui';
442
+ break;
443
+
444
+ case 3:
445
+ return 'browser';
446
+ break;
447
+
448
+ default:
449
+ return 'standalone';
450
+ }
451
+ }
452
+
453
+
454
+ /**
455
+ * Get display of PWA
456
+ *
457
+ * @return (string) Display of PWA as set in the plugin settings.
458
+ *
459
+ * @author Jose Varghese
460
+ *
461
+ * @since 2.0
462
+ */
463
+ function superpwa_get_text_dir() {
464
+
465
+ // Get Settings
466
+ $settings = superpwa_get_settings();
467
+
468
+ $display = isset( $settings['text_dir'] ) ? $settings['text_dir'] : 0;
469
+
470
+ switch ( $display ) {
471
+
472
+ case 0:
473
+ return 'ltr';
474
+ break;
475
+
476
+ case 1:
477
+ return 'rtl';
478
+ break;
479
+
480
+ default:
481
+ return 'ltr';
482
+ }
483
  }
public/sw.php CHANGED
@@ -1,482 +1,497 @@
1
- <?php
2
- /**
3
- * Service worker related functions of SuperPWA
4
- *
5
- * @since 1.0
6
- *
7
- * @function superpwa_sw() Service worker filename, absolute path and link
8
- * @function superpwa_generate_sw() Generate and write service worker into sw.js
9
- * @function superpwa_sw_template() Service worker tempalte
10
- * @function superpwa_register_sw() Register service worker
11
- * @function superpwa_delete_sw() Delete service worker
12
- * @function superpwa_offline_page_images() Add images from offline page to filesToCache
13
- */
14
-
15
- // Exit if accessed directly
16
- if ( ! defined( 'ABSPATH' ) ) exit;
17
-
18
- /**
19
- * Returns the Service worker's filename.
20
- *
21
- * @since 2.0
22
- *
23
- * @return string
24
- */
25
- function superpwa_get_sw_filename() {
26
- return apply_filters( 'superpwa_sw_filename', 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js' );
27
- }
28
-
29
- /**
30
- * Service worker filename, absolute path and link
31
- *
32
- * For Multisite compatibility. Used to be constants defined in superpwa.php
33
- * On a multisite, each sub-site needs a different service worker.
34
- *
35
- * @param $arg filename for service worker filename (replaces SUPERPWA_SW_FILENAME)
36
- * abs for absolute path to service worker (replaces SUPERPWA_SW_ABS)
37
- * src for link to service worker (replaces SUPERPWA_SW_SRC). Default value
38
- *
39
- * @return (string) filename, absolute path or link to manifest.
40
- *
41
- * @since 1.6
42
- * @since 1.7 src to service worker is made relative to accomodate for domain mapped multisites.
43
- * @since 1.8 Added filter superpwa_sw_filename.
44
- * @since 2.0 src actually returns the link and the URL_PATH is extracted in superpwa_register_sw().
45
- * @since 2.0 src uses home_url instead of network_site_url since manifest is no longer in the root folder.
46
- */
47
- function superpwa_sw( $arg = 'src' ) {
48
-
49
- $sw_filename = superpwa_get_sw_filename();
50
-
51
- switch( $arg ) {
52
- // TODO: Case `filename` can be deprecated in favor of @see superpwa_get_sw_filename().
53
- // Name of service worker file
54
- case 'filename':
55
- return $sw_filename;
56
- break;
57
-
58
- /**
59
- * Absolute path to service worker. SW must be in the root folder.
60
- *
61
- * @since 2.0 service worker is no longer a physical file and absolute path doesn't make sense.
62
- * Also using home_url instead of network_site_url in "src" in 2.0 changes the apparent location of the file.
63
- * However, absolute path is preserved at the "old" location, so that phyiscal files can be deleted when upgrading from pre-2.0 versions.
64
- */
65
- case 'abs':
66
- return trailingslashit( ABSPATH ) . $sw_filename;
67
- break;
68
-
69
- // Link to service worker
70
- case 'src':
71
- default:
72
-
73
- // Get Settings
74
- $settings = superpwa_get_settings();
75
-
76
- /**
77
- * For static file, return site_url and network_site_url
78
- *
79
- * Static files are generated in the root directory.
80
- * The site_url template tag retrieves the site url for the
81
- * current site (where the WordPress core files reside).
82
- */
83
- if ( $settings['is_static_sw'] === 1 ) {
84
- return trailingslashit( network_site_url() ) . $sw_filename;
85
- }
86
-
87
- // For dynamic files, return the home_url
88
- return home_url( '/' ) . $sw_filename;
89
-
90
- break;
91
- }
92
- }
93
-
94
- /**
95
- * Generate and write service worker into superpwa-sw.js
96
- *
97
- * Starting with 2.0, files are only generated if dynamic files are not possible.
98
- * Some webserver configurations does not load WordPress and attempts to server files directly
99
- * from the server. This returns 404 when files do not exist physically.
100
- *
101
- * @return (boolean) true on success, false on failure.
102
- *
103
- * @author Arun Basil Lal
104
- *
105
- * @since 1.0
106
- * @since 2.0 Deprecated since Service worker is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
107
- * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description.
108
- *
109
- */
110
- function superpwa_generate_sw() {
111
-
112
- // Delete service worker if it exists
113
- superpwa_delete_sw();
114
-
115
- // Get Settings
116
- $settings = superpwa_get_settings();
117
-
118
- // Return true if dynamic file returns a 200 response.
119
- if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_sw_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
120
-
121
- // set file status as dynamic file in database.
122
- $settings['is_static_sw'] = 0;
123
-
124
- // Write settings back to database.
125
- update_option( 'superpwa_settings', $settings );
126
-
127
- return true;
128
- }
129
-
130
- if ( superpwa_put_contents( superpwa_sw( 'abs' ), superpwa_sw_template() ) ) {
131
-
132
- // set file status as satic file in database.
133
- $settings['is_static_sw'] = 1;
134
-
135
- // Write settings back to database.
136
- update_option( 'superpwa_settings', $settings );
137
-
138
- return true;
139
- }
140
-
141
- return false;
142
- }
143
-
144
- /**
145
- * Service Worker Tempalte
146
- *
147
- * @return (string) Contents to be written to superpwa-sw.js
148
- *
149
- * @since 1.0
150
- * @since 1.7 added filter superpwa_sw_template
151
- * @since 1.9 added filter superpwa_sw_files_to_cache
152
- */
153
- function superpwa_sw_template() {
154
-
155
- // Get Settings
156
- $settings = superpwa_get_settings();
157
-
158
- $cache_version = SUPERPWA_VERSION;
159
-
160
- if(isset($settings['force_update_sw_setting']) && $settings['force_update_sw_setting'] !=''){
161
- $cache_version = $settings['force_update_sw_setting'];
162
- if(!version_compare($cache_version,SUPERPWA_VERSION, '>=') ){
163
- $cache_version = SUPERPWA_VERSION;
164
- }
165
- }
166
-
167
- // Start output buffer. Everything from here till ob_get_clean() is returned
168
- ob_start(); ?>
169
- 'use strict';
170
-
171
- /**
172
- * Service Worker of SuperPWA
173
- * To learn more and add one to your website, visit - https://superpwa.com
174
- */
175
-
176
- const cacheName = '<?php echo parse_url( get_bloginfo( 'url' ), PHP_URL_HOST ) . '-superpwa-' . $cache_version; ?>';
177
- const startPage = '<?php echo superpwa_get_start_url(); ?>';
178
- const offlinePage = '<?php echo superpwa_get_offline_page(); ?>';
179
- const filesToCache = [<?php echo apply_filters( 'superpwa_sw_files_to_cache', 'startPage, offlinePage' ); ?>];
180
- const neverCacheUrls = [<?php echo apply_filters( 'superpwa_sw_never_cache_urls', '/\/wp-admin/,/\/wp-login/,/preview=true/' ); ?>];
181
-
182
- // Install
183
- self.addEventListener('install', function(e) {
184
- console.log('SuperPWA service worker installation');
185
- e.waitUntil(
186
- caches.open(cacheName).then(function(cache) {
187
- console.log('SuperPWA service worker caching dependencies');
188
- filesToCache.map(function(url) {
189
- return cache.add(url).catch(function (reason) {
190
- return console.log('SuperPWA: ' + String(reason) + ' ' + url);
191
- });
192
- });
193
- })
194
- );
195
- });
196
-
197
- // Activate
198
- self.addEventListener('activate', function(e) {
199
- console.log('SuperPWA service worker activation');
200
- e.waitUntil(
201
- caches.keys().then(function(keyList) {
202
- return Promise.all(keyList.map(function(key) {
203
- if ( key !== cacheName ) {
204
- console.log('SuperPWA old cache removed', key);
205
- return caches.delete(key);
206
- }
207
- }));
208
- })
209
- );
210
- return self.clients.claim();
211
- });
212
-
213
- // Range Data Code
214
- var fetchRangeData = function(event){
215
- var pos = Number(/^bytes\=(\d+)\-$/g.exec(event.request.headers.get('range'))[1]);
216
- console.log('Range request for', event.request.url, ', starting position:', pos);
217
- event.respondWith(
218
- caches.open(cacheName)
219
- .then(function(cache) {
220
- return cache.match(event.request.url);
221
- }).then(function(res) {
222
- if (!res) {
223
- return fetch(event.request)
224
- .then(res => {
225
- return res.arrayBuffer();
226
- });
227
- }
228
- return res.arrayBuffer();
229
- }).then(function(ab) {
230
- return new Response(
231
- ab.slice(pos),
232
- {
233
- status: 206,
234
- statusText: 'Partial Content',
235
- headers: [
236
- // ['Content-Type', 'video/webm'],
237
- ['Content-Range', 'bytes ' + pos + '-' +
238
- (ab.byteLength - 1) + '/' + ab.byteLength]]
239
- });
240
- }));
241
- }
242
-
243
- // Fetch
244
- self.addEventListener('fetch', function(e) {
245
-
246
- // Return if the current request url is in the never cache list
247
- if ( ! neverCacheUrls.every(checkNeverCacheList, e.request.url) ) {
248
- console.log( 'SuperPWA: Current request is excluded from cache.' );
249
- return;
250
- }
251
-
252
- // Return if request url protocal isn't http or https
253
- if ( ! e.request.url.match(/^(http|https):\/\//i) )
254
- return;
255
-
256
- <?php if(!isset($settings['cache_external_urls']) || (isset($settings['cache_external_urls']) && $settings['cache_external_urls'] !== '1')){ ?>
257
- // Return if request url is from an external domain.
258
- if ( new URL(e.request.url).origin !== location.origin )
259
- return;
260
- <?php } ?>
261
- // For Range Headers
262
- // For POST requests, do not use the cache. Serve offline page if offline.
263
- if ( e.request.method !== 'GET' ) {
264
- e.respondWith(
265
- fetch(e.request).catch( function() {
266
- return caches.match(offlinePage);
267
- })
268
- );
269
- return;
270
- }
271
-
272
- // Revving strategy
273
- if ( (e.request.mode === 'navigate' || e.request.mode === 'cors') && navigator.onLine ) {
274
- e.respondWith(
275
- fetch(e.request).then(function(response) {
276
- return caches.open(cacheName).then(function(cache) {
277
- cache.put(e.request, response.clone());
278
- return response;
279
- });
280
- })
281
- );
282
- return;
283
- }
284
-
285
- e.respondWith(
286
- caches.match(e.request).then(function(response) {
287
- return response || fetch(e.request).then(function(response) {
288
- return caches.open(cacheName).then(function(cache) {
289
- cache.put(e.request, response.clone());
290
- return response;
291
- });
292
- });
293
- }).catch(function() {
294
- return caches.match(offlinePage);
295
- })
296
- );
297
-
298
- });
299
-
300
- // Check if current url is in the neverCacheUrls list
301
- function checkNeverCacheList(url) {
302
- if ( this.match(url) ) {
303
- return false;
304
- }
305
- return true;
306
- }
307
- <?php
308
- if(isset($settings['analytics_support']) && $settings['analytics_support']==1){
309
- echo 'importScripts("https://storage.googleapis.com/workbox-cdn/releases/6.0.2/workbox-sw.js");
310
- if(workbox.googleAnalytics){
311
- try{
312
- workbox.googleAnalytics.initialize();
313
- } catch (e){ console.log(e.message); }
314
- }';
315
- }
316
- ?>
317
- <?php return apply_filters( 'superpwa_sw_template', ob_get_clean() );
318
- }
319
-
320
- /**
321
- * Register service worker
322
- *
323
- * @refer https://developers.google.com/web/fundamentals/primers/service-workers/registration#conclusion
324
- *
325
- * @since 1.0
326
- */
327
- function superpwa_register_sw() {
328
-
329
- $settings = superpwa_get_settings();
330
- $include_script = true;
331
-
332
- if(isset($settings['exclude_homescreen']) && !empty($settings['exclude_homescreen'])){
333
- $exclude_homescrn_setting = $settings['exclude_homescreen'];
334
- $exclude_homescreen = explode(",",$settings['exclude_homescreen']);
335
-
336
- $siteUrl = filter_input(INPUT_SERVER, 'REQUEST_URI');
337
-
338
- $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http").'://'.$_SERVER['HTTP_HOST'].$siteUrl;
339
- if(in_array($actual_link, $exclude_homescreen)){
340
- $include_script = false;
341
- }
342
- }
343
-
344
- if($include_script){
345
- wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
346
- $localize = array(
347
- 'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
348
- 'disable_addtohome' => isset($settings['disable_add_to_home'])? $settings['disable_add_to_home'] : 0,
349
- 'enableOnDesktop'=> false,
350
- );
351
- $localize = apply_filters('superpwa_sw_localize_data', $localize);
352
- wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', $localize);
353
- }
354
-
355
- }
356
- add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
357
-
358
- /**
359
- * Delete Service Worker
360
- *
361
- * @return true on success, false on failure
362
- *
363
- * @author Arun Basil Lal
364
- *
365
- * @since 1.0
366
- */
367
- function superpwa_delete_sw() {
368
- return superpwa_delete( superpwa_sw( 'abs' ) );
369
- }
370
-
371
- /**
372
- * Add images from offline page to filesToCache
373
- *
374
- * If the offlinePage set by the user contains images, they need to be cached during sw install.
375
- * For most websites, other assets (css, js) would be same as that of startPage which would be cached
376
- * when user visits the startPage the first time. If not superpwa_sw_files_to_cache filter can be used.
377
- *
378
- * @param (string) $files_to_cache Comma separated list of files to cache during service worker install
379
- *
380
- * @return (string) Comma separated list with image src's appended to $files_to_cache
381
- *
382
- * @since 1.9
383
- */
384
- function superpwa_offline_page_images( $files_to_cache ) {
385
-
386
- // Get Settings
387
- $settings = superpwa_get_settings();
388
-
389
- // Retrieve the post
390
- $post = get_post( $settings['offline_page'] );
391
-
392
- // Return if the offline page is set to default
393
- if( $post === NULL ) {
394
- return $files_to_cache;
395
- }
396
-
397
- // Match all images
398
- preg_match_all( '/<img[^>]+src="([^">]+)"/', $post->post_content, $matches );
399
-
400
- // $matches[1] will be an array with all the src's
401
- if( ! empty( $matches[1] ) ) {
402
- return superpwa_httpsify( $files_to_cache . ', \'' . implode( '\', \'', $matches[1] ) . '\'' );
403
- }
404
-
405
- return $files_to_cache;
406
- }
407
- add_filter( 'superpwa_sw_files_to_cache', 'superpwa_offline_page_images' );
408
-
409
-
410
- /**
411
- * Exclude Urls from Cache list of service worker
412
- *
413
- * @since 2.1.2
414
- */
415
- function superpwa_exclude_urls_cache_sw($never_cacheurls){
416
-
417
- // Get Settings
418
- $settings = superpwa_get_settings();
419
- if(isset($settings['excluded_urls']) && !empty($settings['excluded_urls'])){
420
-
421
- $exclude_from_cache = $settings['excluded_urls'];
422
-
423
- $exclude_from_cache = str_replace('/', '\/', $exclude_from_cache);
424
- $exclude_from_cache = '/'.str_replace(',', '/,/', $exclude_from_cache);
425
-
426
- $exclude_from_cache = str_replace('\//', '/', $exclude_from_cache);
427
-
428
- $exclude_from_cache = $exclude_from_cache.'endslash';
429
-
430
- $exclude_from_cache = str_replace('\/endslash', '/', $exclude_from_cache);
431
-
432
- $exclude_from_cache = str_replace('endslash', '/', $exclude_from_cache);
433
-
434
- $never_cacheurls .= ','.$exclude_from_cache;
435
- }
436
-
437
- return $never_cacheurls;
438
- }
439
-
440
- add_filter( 'superpwa_sw_never_cache_urls', 'superpwa_exclude_urls_cache_sw' );
441
-
442
- /**
443
- * Get offline page
444
- *
445
- * @return (string) the URL of the offline page.
446
- *
447
- * @author Arun Basil Lal
448
- *
449
- * @since 2.0.1
450
- */
451
- function superpwa_get_offline_page() {
452
-
453
- // Get Settings
454
- $settings = superpwa_get_settings();
455
-
456
- return get_permalink( $settings['offline_page'] ) ? superpwa_httpsify( get_permalink( $settings['offline_page'] ) ) : superpwa_httpsify( superpwa_get_bloginfo( 'sw' ) );
457
- }
458
-
459
- /**
460
- * Change superpwa_sw_filename When WP Fastest Cache is active.
461
- * @since 2.1.6
462
- */
463
- function superpwa_wp_fastest_cache_sw_filename( $sw_filename ) {
464
- return 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js&action=wpfastestcache';
465
- }
466
-
467
- function superpwa_third_party_plugins_sw_filename(){
468
- /**
469
- * Change superpwa_sw_filename When WP Fastest Cache is active.
470
- *
471
- * @since 2.1.6
472
- */
473
- if ( class_exists('WpFastestCache') ) {
474
-
475
- // Change service worker filename to match WP Fastest Cache action type for js.
476
-
477
- add_filter( 'superpwa_sw_filename', 'superpwa_wp_fastest_cache_sw_filename',99 );
478
- }
479
-
480
- }
481
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  add_action('plugins_loaded','superpwa_third_party_plugins_sw_filename');
1
+ <?php
2
+ /**
3
+ * Service worker related functions of SuperPWA
4
+ *
5
+ * @since 1.0
6
+ *
7
+ * @function superpwa_sw() Service worker filename, absolute path and link
8
+ * @function superpwa_generate_sw() Generate and write service worker into sw.js
9
+ * @function superpwa_sw_template() Service worker tempalte
10
+ * @function superpwa_register_sw() Register service worker
11
+ * @function superpwa_delete_sw() Delete service worker
12
+ * @function superpwa_offline_page_images() Add images from offline page to filesToCache
13
+ */
14
+
15
+ // Exit if accessed directly
16
+ if ( ! defined( 'ABSPATH' ) ) exit;
17
+
18
+ /**
19
+ * Returns the Service worker's filename.
20
+ *
21
+ * @since 2.0
22
+ *
23
+ * @return string
24
+ */
25
+ function superpwa_get_sw_filename() {
26
+ return apply_filters( 'superpwa_sw_filename', 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js' );
27
+ }
28
+
29
+ /**
30
+ * Service worker filename, absolute path and link
31
+ *
32
+ * For Multisite compatibility. Used to be constants defined in superpwa.php
33
+ * On a multisite, each sub-site needs a different service worker.
34
+ *
35
+ * @param $arg filename for service worker filename (replaces SUPERPWA_SW_FILENAME)
36
+ * abs for absolute path to service worker (replaces SUPERPWA_SW_ABS)
37
+ * src for link to service worker (replaces SUPERPWA_SW_SRC). Default value
38
+ *
39
+ * @return (string) filename, absolute path or link to manifest.
40
+ *
41
+ * @since 1.6
42
+ * @since 1.7 src to service worker is made relative to accomodate for domain mapped multisites.
43
+ * @since 1.8 Added filter superpwa_sw_filename.
44
+ * @since 2.0 src actually returns the link and the URL_PATH is extracted in superpwa_register_sw().
45
+ * @since 2.0 src uses home_url instead of network_site_url since manifest is no longer in the root folder.
46
+ */
47
+ function superpwa_sw( $arg = 'src' ) {
48
+
49
+ $sw_filename = superpwa_get_sw_filename();
50
+
51
+ switch( $arg ) {
52
+ // TODO: Case `filename` can be deprecated in favor of @see superpwa_get_sw_filename().
53
+ // Name of service worker file
54
+ case 'filename':
55
+ return $sw_filename;
56
+ break;
57
+
58
+ /**
59
+ * Absolute path to service worker. SW must be in the root folder.
60
+ *
61
+ * @since 2.0 service worker is no longer a physical file and absolute path doesn't make sense.
62
+ * Also using home_url instead of network_site_url in "src" in 2.0 changes the apparent location of the file.
63
+ * However, absolute path is preserved at the "old" location, so that phyiscal files can be deleted when upgrading from pre-2.0 versions.
64
+ */
65
+ case 'abs':
66
+ return trailingslashit( ABSPATH ) . $sw_filename;
67
+ break;
68
+
69
+ // Link to service worker
70
+ case 'src':
71
+ default:
72
+
73
+ // Get Settings
74
+ $settings = superpwa_get_settings();
75
+
76
+ /**
77
+ * For static file, return site_url and network_site_url
78
+ *
79
+ * Static files are generated in the root directory.
80
+ * The site_url template tag retrieves the site url for the
81
+ * current site (where the WordPress core files reside).
82
+ */
83
+ if ( $settings['is_static_sw'] === 1 ) {
84
+ return trailingslashit( network_site_url() ) . $sw_filename;
85
+ }
86
+
87
+ // For dynamic files, return the home_url
88
+ return home_url( '/' ) . $sw_filename;
89
+
90
+ break;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Generate and write service worker into superpwa-sw.js
96
+ *
97
+ * Starting with 2.0, files are only generated if dynamic files are not possible.
98
+ * Some webserver configurations does not load WordPress and attempts to server files directly
99
+ * from the server. This returns 404 when files do not exist physically.
100
+ *
101
+ * @return (boolean) true on success, false on failure.
102
+ *
103
+ * @author Arun Basil Lal
104
+ *
105
+ * @since 1.0
106
+ * @since 2.0 Deprecated since Service worker is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
107
+ * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description.
108
+ *
109
+ */
110
+ function superpwa_generate_sw() {
111
+
112
+ // Delete service worker if it exists
113
+ superpwa_delete_sw();
114
+
115
+ // Get Settings
116
+ $settings = superpwa_get_settings();
117
+
118
+ // Return true if dynamic file returns a 200 response.
119
+ if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_sw_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
120
+
121
+ // set file status as dynamic file in database.
122
+ $settings['is_static_sw'] = 0;
123
+
124
+ // Write settings back to database.
125
+ update_option( 'superpwa_settings', $settings );
126
+
127
+ return true;
128
+ }
129
+
130
+ if ( superpwa_put_contents( superpwa_sw( 'abs' ), superpwa_sw_template() ) ) {
131
+
132
+ // set file status as satic file in database.
133
+ $settings['is_static_sw'] = 1;
134
+
135
+ // Write settings back to database.
136
+ update_option( 'superpwa_settings', $settings );
137
+
138
+ return true;
139
+ }
140
+
141
+ return false;
142
+ }
143
+
144
+ /**
145
+ * Service Worker Tempalte
146
+ *
147
+ * @return (string) Contents to be written to superpwa-sw.js
148
+ *
149
+ * @since 1.0
150
+ * @since 1.7 added filter superpwa_sw_template
151
+ * @since 1.9 added filter superpwa_sw_files_to_cache
152
+ */
153
+ function superpwa_sw_template() {
154
+
155
+ // Get Settings
156
+ $settings = superpwa_get_settings();
157
+
158
+ $cache_version = SUPERPWA_VERSION;
159
+
160
+ if(isset($settings['force_update_sw_setting']) && $settings['force_update_sw_setting'] !=''){
161
+ $cache_version = $settings['force_update_sw_setting'];
162
+ if(!version_compare($cache_version,SUPERPWA_VERSION, '>=') ){
163
+ $cache_version = SUPERPWA_VERSION;
164
+ }
165
+ }
166
+
167
+ // Start output buffer. Everything from here till ob_get_clean() is returned
168
+ ob_start(); ?>
169
+ 'use strict';
170
+
171
+ /**
172
+ * Service Worker of SuperPWA
173
+ * To learn more and add one to your website, visit - https://superpwa.com
174
+ */
175
+
176
+ const cacheName = '<?php echo parse_url( get_bloginfo( 'url' ), PHP_URL_HOST ) . '-superpwa-' . $cache_version; ?>';
177
+ const startPage = '<?php echo superpwa_get_start_url(); ?>';
178
+ const offlinePage = '<?php echo superpwa_get_offline_page(); ?>';
179
+ const filesToCache = [<?php echo apply_filters( 'superpwa_sw_files_to_cache', 'startPage, offlinePage' ); ?>];
180
+ const neverCacheUrls = [<?php echo apply_filters( 'superpwa_sw_never_cache_urls', '/\/wp-admin/,/\/wp-login/,/preview=true/' ); ?>];
181
+
182
+ // Install
183
+ self.addEventListener('install', function(e) {
184
+ console.log('SuperPWA service worker installation');
185
+ e.waitUntil(
186
+ caches.open(cacheName).then(function(cache) {
187
+ console.log('SuperPWA service worker caching dependencies');
188
+ filesToCache.map(function(url) {
189
+ return cache.add(url).catch(function (reason) {
190
+ return console.log('SuperPWA: ' + String(reason) + ' ' + url);
191
+ });
192
+ });
193
+ })
194
+ );
195
+ });
196
+
197
+ // Activate
198
+ self.addEventListener('activate', function(e) {
199
+ console.log('SuperPWA service worker activation');
200
+ e.waitUntil(
201
+ caches.keys().then(function(keyList) {
202
+ return Promise.all(keyList.map(function(key) {
203
+ if ( key !== cacheName ) {
204
+ console.log('SuperPWA old cache removed', key);
205
+ return caches.delete(key);
206
+ }
207
+ }));
208
+ })
209
+ );
210
+ return self.clients.claim();
211
+ });
212
+
213
+ // Range Data Code
214
+ var fetchRangeData = function(event){
215
+ var pos = Number(/^bytes\=(\d+)\-$/g.exec(event.request.headers.get('range'))[1]);
216
+ console.log('Range request for', event.request.url, ', starting position:', pos);
217
+ event.respondWith(
218
+ caches.open(cacheName)
219
+ .then(function(cache) {
220
+ return cache.match(event.request.url);
221
+ }).then(function(res) {
222
+ if (!res) {
223
+ return fetch(event.request)
224
+ .then(res => {
225
+ return res.arrayBuffer();
226
+ });
227
+ }
228
+ return res.arrayBuffer();
229
+ }).then(function(ab) {
230
+ return new Response(
231
+ ab.slice(pos),
232
+ {
233
+ status: 206,
234
+ statusText: 'Partial Content',
235
+ headers: [
236
+ // ['Content-Type', 'video/webm'],
237
+ ['Content-Range', 'bytes ' + pos + '-' +
238
+ (ab.byteLength - 1) + '/' + ab.byteLength]]
239
+ });
240
+ }));
241
+ }
242
+
243
+ // Fetch
244
+ self.addEventListener('fetch', function(e) {
245
+
246
+ // Return if the current request url is in the never cache list
247
+ if ( ! neverCacheUrls.every(checkNeverCacheList, e.request.url) ) {
248
+ console.log( 'SuperPWA: Current request is excluded from cache.' );
249
+ return;
250
+ }
251
+
252
+ // Return if request url protocal isn't http or https
253
+ if ( ! e.request.url.match(/^(http|https):\/\//i) )
254
+ return;
255
+
256
+ <?php if(!isset($settings['cache_external_urls']) || (isset($settings['cache_external_urls']) && $settings['cache_external_urls'] !== '1')){ ?>
257
+ // Return if request url is from an external domain.
258
+ if ( new URL(e.request.url).origin !== location.origin )
259
+ return;
260
+ <?php } ?>
261
+ // For Range Headers
262
+ // For POST requests, do not use the cache. Serve offline page if offline.
263
+ if ( e.request.method !== 'GET' ) {
264
+ e.respondWith(
265
+ fetch(e.request).catch( function() {
266
+ return caches.match(offlinePage);
267
+ })
268
+ );
269
+ return;
270
+ }
271
+
272
+ // Revving strategy
273
+ if ( (e.request.mode === 'navigate' || e.request.mode === 'cors') && navigator.onLine ) {
274
+ e.respondWith(
275
+ fetch(e.request).then(function(response) {
276
+ return caches.open(cacheName).then(function(cache) {
277
+ cache.put(e.request, response.clone());
278
+ return response;
279
+ });
280
+ })
281
+ );
282
+ return;
283
+ }
284
+
285
+ e.respondWith(
286
+ caches.match(e.request).then(function(response) {
287
+ return response || fetch(e.request).then(function(response) {
288
+ return caches.open(cacheName).then(function(cache) {
289
+ cache.put(e.request, response.clone());
290
+ return response;
291
+ });
292
+ });
293
+ }).catch(function() {
294
+ return caches.match(offlinePage);
295
+ })
296
+ );
297
+
298
+ });
299
+
300
+ // Check if current url is in the neverCacheUrls list
301
+ function checkNeverCacheList(url) {
302
+ if ( this.match(url) ) {
303
+ return false;
304
+ }
305
+ return true;
306
+ }
307
+ <?php
308
+ if(isset($settings['analytics_support']) && $settings['analytics_support']==1){
309
+ echo 'importScripts("https://storage.googleapis.com/workbox-cdn/releases/6.0.2/workbox-sw.js");
310
+ if(workbox.googleAnalytics){
311
+ try{
312
+ workbox.googleAnalytics.initialize();
313
+ } catch (e){ console.log(e.message); }
314
+ }';
315
+ }
316
+ ?>
317
+ <?php return apply_filters( 'superpwa_sw_template', ob_get_clean() );
318
+ }
319
+
320
+ /**
321
+ * Register service worker
322
+ *
323
+ * @refer https://developers.google.com/web/fundamentals/primers/service-workers/registration#conclusion
324
+ *
325
+ * @since 1.0
326
+ */
327
+ function superpwa_register_sw() {
328
+
329
+ $settings = superpwa_get_settings();
330
+ $include_script = true;
331
+
332
+ if(isset($settings['exclude_homescreen']) && !empty($settings['exclude_homescreen'])){
333
+ $exclude_homescrn_setting = $settings['exclude_homescreen'];
334
+ $exclude_homescreen = explode(",",$settings['exclude_homescreen']);
335
+
336
+ $siteUrl = filter_input(INPUT_SERVER, 'REQUEST_URI');
337
+
338
+ $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http").'://'.$_SERVER['HTTP_HOST'].$siteUrl;
339
+ if(in_array($actual_link, $exclude_homescreen)){
340
+ $include_script = false;
341
+ }
342
+ }
343
+
344
+ if($include_script){
345
+ wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
346
+ $localize = array(
347
+ 'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
348
+ 'disable_addtohome' => isset($settings['disable_add_to_home'])? $settings['disable_add_to_home'] : 0,
349
+ 'enableOnDesktop'=> false,
350
+ );
351
+ $localize = apply_filters('superpwa_sw_localize_data', $localize);
352
+ wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', $localize);
353
+ }
354
+
355
+ }
356
+ add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
357
+
358
+ /**
359
+ * Delete Service Worker
360
+ *
361
+ * @return true on success, false on failure
362
+ *
363
+ * @author Arun Basil Lal
364
+ *
365
+ * @since 1.0
366
+ */
367
+ function superpwa_delete_sw() {
368
+ return superpwa_delete( superpwa_sw( 'abs' ) );
369
+ }
370
+
371
+ /**
372
+ * Add images from offline page to filesToCache
373
+ *
374
+ * If the offlinePage set by the user contains images, they need to be cached during sw install.
375
+ * For most websites, other assets (css, js) would be same as that of startPage which would be cached
376
+ * when user visits the startPage the first time. If not superpwa_sw_files_to_cache filter can be used.
377
+ *
378
+ * @param (string) $files_to_cache Comma separated list of files to cache during service worker install
379
+ *
380
+ * @return (string) Comma separated list with image src's appended to $files_to_cache
381
+ *
382
+ * @since 1.9
383
+ */
384
+ function superpwa_offline_page_images( $files_to_cache ) {
385
+
386
+ // Get Settings
387
+ $settings = superpwa_get_settings();
388
+
389
+ // Retrieve the post
390
+ $post = get_post( $settings['offline_page'] );
391
+
392
+ // Return if the offline page is set to default
393
+ if( $post === NULL ) {
394
+ return $files_to_cache;
395
+ }
396
+
397
+ // Match all images
398
+ preg_match_all( '/<img[^>]+src="([^">]+)"/', $post->post_content, $matches );
399
+
400
+ // $matches[1] will be an array with all the src's
401
+ if( ! empty( $matches[1] ) ) {
402
+ return superpwa_httpsify( $files_to_cache . ', \'' . implode( '\', \'', $matches[1] ) . '\'' );
403
+ }
404
+
405
+ return $files_to_cache;
406
+ }
407
+ add_filter( 'superpwa_sw_files_to_cache', 'superpwa_offline_page_images' );
408
+
409
+
410
+ /**
411
+ * Exclude Urls from Cache list of service worker
412
+ *
413
+ * @since 2.1.2
414
+ */
415
+ function superpwa_exclude_urls_cache_sw($never_cacheurls){
416
+
417
+ // Get Settings
418
+ $settings = superpwa_get_settings();
419
+ if(isset($settings['excluded_urls']) && !empty($settings['excluded_urls'])){
420
+
421
+ $exclude_from_cache = $settings['excluded_urls'];
422
+
423
+ $exclude_from_cache = str_replace('/', '\/', $exclude_from_cache);
424
+ $exclude_from_cache = '/'.str_replace(',', '/,/', $exclude_from_cache);
425
+
426
+ $exclude_from_cache = str_replace('\//', '/', $exclude_from_cache);
427
+
428
+ $exclude_from_cache = $exclude_from_cache.'endslash';
429
+
430
+ $exclude_from_cache = str_replace('\/endslash', '/', $exclude_from_cache);
431
+
432
+ $exclude_from_cache = str_replace('endslash', '/', $exclude_from_cache);
433
+
434
+ $never_cacheurls .= ','.$exclude_from_cache;
435
+ }
436
+
437
+ return $never_cacheurls;
438
+ }
439
+
440
+ add_filter( 'superpwa_sw_never_cache_urls', 'superpwa_exclude_urls_cache_sw' );
441
+
442
+ /**
443
+ * Get offline page
444
+ *
445
+ * @return (string) the URL of the offline page.
446
+ *
447
+ * @author Arun Basil Lal
448
+ *
449
+ * @since 2.0.1
450
+ */
451
+ function superpwa_get_offline_page() {
452
+
453
+ // Get Settings
454
+ $settings = superpwa_get_settings();
455
+
456
+ return get_permalink( $settings['offline_page'] ) ? superpwa_httpsify( get_permalink( $settings['offline_page'] ) ) : superpwa_httpsify( superpwa_get_bloginfo( 'sw' ) );
457
+ }
458
+
459
+ /**
460
+ * Change superpwa_sw_filename When WP Fastest Cache is active.
461
+ * @since 2.1.6
462
+ */
463
+ function superpwa_wp_fastest_cache_sw_filename( $sw_filename ) {
464
+ return 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js&action=wpfastestcache';
465
+ }
466
+
467
+ /**
468
+ * Change superpwa_sw_filename When WP Fastest Cache is active.
469
+ * @since 2.1.6
470
+ */
471
+ function superpwa_wp_bypass_sw_url_cache_filename( $sw_filename ) {
472
+ return 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js&action=bypasscache';
473
+ }
474
+
475
+ function superpwa_third_party_plugins_sw_filename(){
476
+ /**
477
+ * Change superpwa_sw_filename When WP Fastest Cache is active.
478
+ *
479
+ * @since 2.1.6
480
+ */
481
+ if ( class_exists('WpFastestCache') ) {
482
+
483
+ // Change service worker filename to match WP Fastest Cache action type for js.
484
+
485
+ add_filter( 'superpwa_sw_filename', 'superpwa_wp_fastest_cache_sw_filename',99 );
486
+ }
487
+ else{
488
+ $settings = superpwa_get_settings();
489
+ if ( isset( $settings['bypass_sw_url_cache'] ) && $settings['bypass_sw_url_cache']==1)
490
+ {
491
+ add_filter( 'superpwa_sw_filename', 'superpwa_wp_bypass_sw_url_cache_filename',99 );
492
+ }
493
+ }
494
+
495
+ }
496
+
497
  add_action('plugins_loaded','superpwa_third_party_plugins_sw_filename');
readme.txt CHANGED
@@ -1,584 +1,596 @@
1
- === Super Progressive Web Apps ===
2
- Contributors: SuperPWA
3
- Tags: pwa, progressive web apps, manifest, web manifest, android app, chrome app, add to homescreen, mobile web
4
- Requires at least: 3.6.0
5
- Tested up to: 6.0.3
6
- Requires PHP: 5.3
7
- Stable tag: trunk
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- SuperPWA helps you convert your WordPress website into a Progressive Web App instantly.
12
-
13
- == Description ==
14
-
15
- Progressive Web Apps (PWA) is a new technology that combines the best of mobile web and the best of mobile apps to create a superior mobile web experience. They are installed on the phone like a normal app (web app) and can be accessed from the home screen.
16
-
17
- [Home](https://superpwa.com/) | [Documentation](https://superpwa.com/docs/) | [Help](https://superpwa.com/contact/) | [Premium version Features](https://superpwa.com/docs/#pro-doc)
18
-
19
- Users can come back to your website by launching the app from their home screen and interact with your website through an app-like interface. Your return visitors will experience almost-instant loading times and enjoy the great performance benefits of your PWA!
20
-
21
- Super Progressive Web Apps makes it easy for you to convert your WordPress website into a Progressive Web App instantly!
22
-
23
- Once SuperPWA is installed, users browsing your website from a supported mobile device will see a "Add To Home Screen" notice (from the bottom of the screen) and will be able to 'install your website' on the home screen of their device. Every page visited is stored locally on their device and will be available to read even when they are offline!
24
-
25
- SuperPWA is easy to configure, it takes less than a minute to set-up your Progressive Web App! SuperPWA does a clean uninstall, by removing every database entry and file that it creates. In fact, none of the default settings are saved to the database until you manually save it the first time. Go ahead and give it a try.
26
-
27
- And the best part? If you ever get stuck, we are here to watch your back! [Open a support](https://wordpress.org/support/plugin/super-progressive-web-apps) ticket if you have a question or need a feature. We are super excited to hear your feedback and we want to genuinely help you build the best Progressive Web App for your WordPress website!
28
-
29
- #### Quick Demo?
30
-
31
- * Open up [SuperPWA.com](https://superpwa.com/?utm_source=wordpress.org&utm_medium=description-demo) in a supported device.
32
- * Add the website to your home screen either from the Add to Home Screen prompt (Chrome for Android) or from the browser menu.
33
- * Open the app from your home screen and you will see the splash screen.
34
- * Turn off your data and wifi to go offline and open up the app. You will still be able to see the app and browse the pages you have already visited.
35
- * Browse to a page that you haven't visited before. The offline page will be displayed.
36
-
37
- #### Thank You PWA Enthusiasts!
38
-
39
- We are humbled by the feedback from the community. Thanks to everyone who believed in us and tried our plugin. Your feedback has been invaluable and we have learned a lot from your experience. Thank you for your love and support and we hope to return the love by striving to bring you the best ever Progressive Web Apps plugin for WordPress!
40
-
41
- ### What's in the box
42
-
43
- Here are the current features of Super Progressive Web Apps:
44
-
45
- * Generate a manifest for your website and add it to the head of your website.
46
- * Set the application icon for your Progressive Web App.
47
- * Set the background color for the splash screen of your Progressive Web App.
48
- * Your website will show the "Add to home screen" notice when accessed in a supported browser.
49
- * Aggressive caching of pages using CacheStorage API.
50
- * Pages once cached are served even if the user is offline.
51
- * Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
52
- * New in version 1.2: Support for theme-color meta property. Change the color of browser address bar of Chrome, Firefox OS and Opera to match your website colors.
53
- * New in version 1.2: Now you can edit the Application Name and Application Short name.
54
- * New in version 1.2: Set the start page of your PWA.
55
- * New in version 1.2: Set Accelerated Mobile Pages (AMP) version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
56
- * New in version 1.3: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
57
- * New in version 1.3: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
58
- * New in version 1.3: Improved in-browser service worker update handling.
59
- * New in version 1.4: You can now set the default orientation of your PWA. Choose from "any" (Follow Device Orientation), "Portrait" and "Landscape".
60
- * New in version 1.4: You can now set the theme_color property in the manifest.
61
- * New in version 1.5: OneSignal integration for Push notifications.
62
- * New in version 1.6: WordPress Multisite Network compatibility.
63
- * New in version 1.7: Add-Ons for SuperPWA is here! Ships with [UTM Tracking Add-On](https://superpwa.com/addons/utm-tracking/?utm_source=wordpress.org&utm_medium=description) to track visits coming from your PWA.
64
- * New in version 1.8: Compatibility issues with OneSignal are now resolved!
65
- * New in version 1.8: New Add-On: [Apple Touch Icons](https://superpwa.com/addons/apple-touch-icons/?utm_source=wordpress.org&utm_medium=description) that sets your app icons as Apple Touch Icons.
66
- * New in version 2.0: SuperPWA is now compatible with WordPress installed in a sub-folder.
67
- * New in version 2.0: You can now set [display property](https://superpwa.com/doc/web-app-manifest-display-modes/?utm_source=wordpress.org&utm_medium=description) from SuperPWA settings.
68
- * New in version 2.1.1: SuperPWA now supports Maskable Icons.
69
- * [Full changelog](https://superpwa.com/changelog/)
70
-
71
- **Upcoming features:**
72
-
73
- * Offline Indicator Notice.
74
-
75
- **PRO Version** support additional [advance feature](https://superpwa.com/docs/)
76
- * Call To Action (CTA) [More Info](https://superpwa.com/doc/call-to-action-cta-add-on-for-superpwa/)
77
- * Android APK APP Generator [More Info](https://superpwa.com/doc/android-apk-app-generator-add-on-for-superpwa/)
78
- * Data Analytics [More Info](https://superpwa.com/doc/data-analytics-add-on-for-superpwa/)
79
-
80
- ### Progressive Web App Minimum Requirements
81
-
82
- Progressive Web Apps require that your WordPress website is served from a secure origin i.e. your website should be HTTPS and not HTTP. If your website isn't HTTPS, please contact your host about it. You can also [ask us](https://wordpress.org/support/plugin/super-progressive-web-apps) if you need help.
83
-
84
- ### Device and Browser Support For PWA
85
-
86
- Progressive web apps need browsers that support manifests and service workers. Currently Google Chrome (version 57+), Chrome for Android (62), Mozilla Firefox (57), Firefox for Android (58) are the major browsers that support PWA.
87
-
88
- The list is fast growing and is likely to be supported in most major browsers by the end of this year.
89
-
90
- ### How To Convert Your WordPress Website Into A Progressive Web App
91
-
92
- #### WordPress Installation
93
-
94
- * Visit WordPress Admin > Plugins > Add New
95
- * Search for 'Super Progressive Web Apps'
96
- * Click "Install Now" and then "Activate" Super Progressive Web Apps
97
-
98
- To install manually:
99
-
100
- * Upload super-progressive-web-apps folder to the /wp-content/plugins/ directory on your server
101
- * Go to WordPress Admin > Plugins
102
- * Activate Super Progressive Web Apps plugin from the list.
103
-
104
- #### Customizing Your Progressive Web App
105
-
106
- Your Progressive Web App should be ready to test with the default settings on activation. You can customize it further and make it truly your own.
107
-
108
- * Go to WordPress Admin > SuperPWA
109
- * Set a Background Color for the splash screen to be shown when your PWA is opened on a mobile device.
110
- * Set the Application Icon. This will be the icon of your PWA when it is added to the homescreen in a mobile device. The icon must be a PNG image and exactly 192 x 192 pixels in size.
111
- * Set the Offline Page. This page will be displayed if the user is offline and the page he requested is not cached already. Ideally you should create a dedicated WordPress page and set it here. Within the page you create, you could add a note that reads, "It looks like you are offline and the page you requested is not available right now. Please check back again once you are online.".
112
- * Click "Save Settings".
113
-
114
- #### Testing Your Progressive Web App
115
-
116
- * Open a supported browser in a supported device (for eg: Chrome for Android (62 or higher) in an Android Phone)
117
- * Enter your website and wait till it fully loads
118
- * You should see a pop-up that has your Application Icon and a button that reads "ADD TO HOME SCREEN".
119
- * Click on it and your PWA will be added to your home screen. Wait for the install to complete.
120
- * Go to your home screen and open your PWA. Browse into a few pages if you like. Close the App.
121
- * Disconnect from the internet and now open your PWA again. You should be able to see all the pages that you previously browsed.
122
- * Try visiting a page that you did not visit before. You should see the page you set as your "Offline Page" in the settings of SuperPWA.
123
-
124
- #### Troubleshooting Your Progressive Web App
125
-
126
- Uh, oh. Your PWA did not work as expected? You do not see the "Add to Home Screen" notice?
127
-
128
- * Make sure your website has a SSL certificate installed. i.e. your website should be https instead of http (as in https://your-domain.com).
129
- * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
130
- * Make sure your Application Icon and Splash Screen Icon's are of PNG format and 192px X 192px and 512px X 512px in size respectively.
131
- * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
132
- * If the application icon does not update after first install, delete the PWA from your phone, clear browser cache and install again. (We are working on making it better.)
133
- * Create a [new support ticket](https://wordpress.org/support/plugin/super-progressive-web-apps) and share a link to your website. We will take a look and figure it out for you.
134
-
135
- ### Feature Requests, Issues, Pull Requests
136
-
137
- Here is our repository on [GitHub](https://github.com/SuperPWA/Super-Progressive-Web-Apps). Send us your pull requests, feature requests or issues, if any.
138
-
139
- ### About us
140
-
141
- We are a duo who got excited about the idea. Our mission is simple: Help you build an awesome PWA that your users would want to have on their home screen.
142
-
143
- When we first heard about PWA we wanted to learn everything about it. We have spent countless hours learning and wants to share it with the world.
144
-
145
- Please give us your constructive feedback and support.
146
-
147
- == Installation ==
148
-
149
- To install this plugin:
150
-
151
- 1. Install the plugin through the WordPress admin interface, or upload the plugin folder to /wp-content/plugins/ using FTP.
152
- 2. Activate the plugin through the 'Plugins' screen in WordPress.
153
- 3. Go to WordPress Admin > SuperPWA
154
-
155
- == Frequently Asked Questions ==
156
-
157
- If you have any questions, please ask it on the [support forum](https://wordpress.org/support/plugin/super-progressive-web-apps).
158
-
159
- = Will Progressive Web Apps work on iOS devices? =
160
-
161
- Starting with Safari for iOS 11.3, Apple devices offer partial support for PWA's. However, there is no native Add To Home Screen prompt just yet. You can add your app by tapping "Add to Home Screen" button in the share menu of the browser ( look for the square icon with an up arrow in the foreground ).
162
-
163
- Just like you, we are eagerly awaiting the upcoming releases and we hope to see better compatibility in the coming months.
164
-
165
- = How To Customize Splash Screen =
166
-
167
- You can easily change the icon and the background color in SuperPWA > Settings.
168
-
169
- Further customizations are not available right now, not because of any limitation of SuperPWA, but because they are not available in the PWA technology. When more options come up in the future, we will add them to SuperPWA then.
170
-
171
- = How To Track Visits Originating From Your Progressive Web App =
172
-
173
- You can track visits from your PWA in your analytics software (for e.g. Google Analytics) using the UTM Tracking add-on of SuperPWA. Go to SuperPWA > Add-Ons and activate UTM Tracking. Then in SuperPWA > UTM Tracking, you can set the UTM parameters as needed. Please [refer the documentation](https://superpwa.com/addons/utm-tracking/?utm_source=wordpress.org&utm_medium=description-faq) for further information.
174
-
175
- = GDPR Compliance =
176
-
177
- SuperPWA does not collect or store user data, nor does it set cookies or store tracking data. Content visited by users from your PWA is stored in the user's own device, in the cache of the browser. This is very similar to how modern browsers caches content offline for faster browsing.
178
-
179
- With the UTM Tracking Add-On, you will be able to differentiate the visits originating from your PWA in your analytics software. You may have to include this in your privacy policy. Please note that SuperPWA does not track the visits, we just help you add the UTM parameters to the URL of the Start Page of your app so that third party analytics tools can differentiate the visits.
180
-
181
- Feel free to get in touch if you have any questions.
182
-
183
- == Screenshots ==
184
-
185
- 1. Settings page in WordPress Admin > SuperPWA > Settings
186
-
187
- == Changelog ==
188
-
189
- = 2.2.8 =
190
- * Date: [09.November.2022](https://superpwa.com/superpwa-2-2-8-release-note/?utm_source=wordpress.org&utm_medium=changelog)
191
- * Enhancement : While testing the SupwerPwa on https://www.pwabuilder.com/tool, the service for offline shows zero scores. #316 (Screenshots, Category, Direction, Offline issue)
192
- * Enhancement : upgrade to pro button #319
193
- * Enhancement : feat (issue #101): Offline Indicator Notice feature #106
194
- * BugFixed : issue: excluded_urls" in /wp-content/plugins/super-progressive-web-apps/public/manifest.php on line 252 #333
195
-
196
- = 2.2.7 =
197
- * Date: [13.October.2022](https://superpwa.com/superpwa-2-2-7-release-note/?utm_source=wordpress.org&utm_medium=changelog)
198
- * BugFixed : Preloader not working in IOS device #288
199
- * BugFixed : Exclude URLs from Cache list option is not working properly. #300
200
- * BugFixed : getting error when we are adding range data in cache #311
201
- * BugFixed : Bug with network-first cache strategy and REST calls #329
202
-
203
- = 2.2.6 =
204
- * Date: [06.July.2022](https://superpwa.com/superpwa-2-2-6-release-note/?utm_source=wordpress.org&utm_medium=changelog)
205
- * BugFixed : Stop servicework for caching the videos. #279
206
- * BugFixed : Apple Touch Icons & Splash Screen not fetching Welcome screen image #284
207
- * Enhancement : Added New Addon Pull To Refresh #285
208
-
209
- = 2.2.5 =
210
- * Date: [21.April.2022](https://superpwa.com/superpwa-2-2-5-release-note/?utm_source=wordpress.org&utm_medium=changelog)
211
- * BugFixed : Add to home screen was not working when theme manifest is active #271
212
-
213
- = 2.2.4 =
214
- * Date: [8.April.2022](https://superpwa.com/superpwa-2-2-4-release-note/?utm_source=wordpress.org&utm_medium=changelog)
215
- * BugFixed : CTA Banner should be hidden once app is installed #264
216
-
217
- = 2.2.3 =
218
- * Date: [26.March.2022](https://superpwa.com/superpwa-2-2-3-release-note/?utm_source=wordpress.org&utm_medium=changelog)
219
- * Enhancement : Added New Addon QR Code Generator Array #255
220
- * Enhancement : Added Warning UI on License tab when key is expired #258
221
-
222
- = 2.2.2 =
223
- * Date: [16.March.2022](https://superpwa.com/superpwa-2-2-2-release-note/?utm_source=wordpress.org&utm_medium=changelog)
224
- * Enhancement : Added Compatibility with WonderPush Pushnotifications plugin #188
225
- * Enhancement : Improved the Design of User feedback auto email system #252
226
-
227
- = 2.2.1 =
228
- * Date: [17.February.2022](https://superpwa.com/superpwa-2-2-1-release-note/?utm_source=wordpress.org&utm_medium=changelog)
229
- * Bug Fixed : Some extension addon features are not working properly #245
230
-
231
- = 2.2 =
232
- * Date: [14.December.2021](https://superpwa.com/superpwa-2-2-release-note/?utm_source=wordpress.org&utm_medium=changelog)
233
- * Bug Fixed : Fixed Manifest Warnings Regarding Icon Purpose Value#237
234
- * Enhancement : Added AMP Support with Official AMP and AMPforWP Plugins#218
235
- * Enhancement : Added New option to Reset Settings#233
236
-
237
- = 2.1.19 =
238
- * Date: [23.November.2021](https://superpwa.com/superpwa-2-1-19-release-note/?utm_source=wordpress.org&utm_medium=changelog)
239
- * Enhancement : Added New option to exclude Add to homescreen banner on particular pages #232
240
-
241
- = 2.1.18 =
242
- * Date: [1.November.2021](https://superpwa.com/superpwa-2-1-18-release-note/?utm_source=wordpress.org&utm_medium=changelog)
243
- * Bug Fixed : Resolved the issue of License alert showing when key is not activated #230
244
- * Bug Fixed : PHP Warning: Trying to access array offset on value of type bool #230
245
- * Enhancement : Added New Addon PreLoader Array #226
246
-
247
- = 2.1.17 =
248
- * Date: [23.October.2021](https://superpwa.com/superpwa-2-1-17-release-note/?utm_source=wordpress.org&utm_medium=changelog)
249
- * Bug Fixed : Resolved the issue of Invalid regular expression error when exclude cache URL is placed without end slash #216
250
- * Bug Fixed : Added Seperate caching for range header request urls to aviod 206 type error #220
251
- * Enhancement : Added Pre Caching Feature in Caching Strategies Addon. #222
252
- * Enhancement : Updated License Page to display Complete License Information. #227
253
- * Enhancement : Added Status bar style option for apple icons. #210
254
- * Enhancement : Added Proper Method to render Application name and shortname of PWA App even with non-standard characters. #112
255
-
256
- = 2.1.16 =
257
- * Date: [26.August.2021](https://superpwa.com/superpwa-2-1-16-release-note/?utm_source=wordpress.org&utm_medium=changelog)
258
- * Bug Fixed : "Add to homescreen" banner was not showing when Wp fastest cache plugin is active #209
259
- * Enhancement : Added an Option to Re-Install Service Worker #211
260
- * Enhancement : Added an Option to Cache External Origin URLs by Service Worker #213
261
-
262
- = 2.1.15 =
263
- * Date: [12.July.2021](https://superpwa.com/superpwa-2-1-15-release-note/?utm_source=wordpress.org&utm_medium=changelog)
264
- * Bug Fixed : User end issue: Apple splash icon not working properly #200
265
- * Bug Fixed : Centralize image with background color not getting saved. #205
266
-
267
- = 2.1.14 =
268
- * Date: [30.June.2021](https://superpwa.com/superpwa-2-1-14-release-note/?utm_source=wordpress.org&utm_medium=changelog)
269
- * Enhancement: Need to Improve Admin UI #196
270
-
271
- = 2.1.13 =
272
- * Date: [15.June.2021](https://superpwa.com/superpwa-2-1-13-release-note/?utm_source=wordpress.org&utm_medium=changelog)
273
- * BugFixed: iOS Splash Screen Images are not getting saved #191
274
-
275
- = 2.1.12 =
276
- * Date: [29.May.2021](https://superpwa.com/superpwa-2-1-12-release-note/?utm_source=wordpress.org&utm_medium=changelog)
277
- Enhancement: Need An Option to exclude the URL #183
278
- Enhancement: Improved Tabs UI design #190
279
-
280
- = 2.1.11 =
281
- * Date: [17.May.2021](https://superpwa.com/superpwa-2-1-11-release-note/?utm_source=wordpress.org&utm_medium=changelog)
282
- BugFixed: Remediation of Splash Screen Settings #178
283
-
284
- = 2.1.10 =
285
- * Date: [10.May.2021](https://superpwa.com/superpwa-2-1-10-release-note/?utm_source=wordpress.org&utm_medium=changelog)
286
- BugFixed: iOS splash screen not working using apple icons addon #182
287
- BugFixed: iOS - Splash Screen #175
288
-
289
- = 2.1.9 =
290
- * Date: [17.April.2021](https://superpwa.com/changelog/)
291
- Minor Improvment: Added Data Analytics Addon Array #152
292
-
293
- = 2.1.8 =
294
- * Date: [15.March.2021](https://superpwa.com/superpwa-2-1-8/?utm_source=wordpress.org&utm_medium=changelog)
295
- BugFixed: manifest json file taking a long time to load #130
296
- Enhancement: Compatibility with Onesignal on multisite #94
297
-
298
-
299
- = 2.1.7 =
300
- * Date: [16.February.2021](https://superpwa.com/superpwa-2-1-7/?utm_source=wordpress.org&utm_medium=changelog)
301
- BugFixed: Manifest shortcut icons json issue resolve image size 192x192 #163
302
- Enhancement: iOS application splash screen support for all screens #160
303
- Enhancement: Feature of caching, multiple strategies #138
304
-
305
- = 2.1.6 =
306
- * Date: [04.February.2021](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
307
- BugFixed: Manifest shows start URL is out of the scope URL in Specific cases #162
308
- BugFixed: Offline analytics undefined variable #99
309
- Enhancement: iOS application icons are blur overwrite by WordPress #161
310
- BugFixed: Quick action feature for PWA icons need to specify size #147
311
-
312
-
313
- = 2.1.5 =
314
- * Date: [06.January.2021](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
315
- Enhancement: Added the support of google analytics #149
316
- Enhancement: Disabling “Add to home screen” #150
317
- Enhancement: Support for Yandex manifest #146
318
- Enhancement: Addex Quick action (shortcut) feature for PWA #147
319
- Enhancement: Improve user interface #142
320
- Enhancement: Added the tutorial link for Call To Action and Android APK APP Generator #145
321
-
322
- = 2.1.4 =
323
- * Date: [18.December.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
324
- Bug Fix: Wrong manifest path if installed WordPress in a sub-folder #134
325
- Enhancement: Need to increase character limit of APP name. #139
326
- Bug Fix: Default Add to home screen banner is not showing #140
327
- Bug Fix: Changes in Presentation #141 / #143
328
-
329
-
330
- = 2.1.3 =
331
- Improvement: Changes in Admin Options
332
- Enhancement: Added more pages
333
-
334
- = 2.1.2 =
335
- * Date: [25.July.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
336
- * Bug Fix: Fixed issue where Application Icon was not showing.
337
-
338
- = 2.1.1 =
339
- * Date: [4.July.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
340
- * Tested with WordPress 5.4.2.
341
- * Enhancement: Added support for Maskable Icons [#127](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/127)
342
-
343
- = 2.1 =
344
- * Date: [29.May.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
345
- * Tested with WordPress 5.4.1.
346
- * Enhancement: Removed the WordPress admin notice suggesting to add SuperPWA manifest to OneSignal. [#114] (https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/114)
347
- * Enhancement: Updated fallback value in superpwa_get_display() to match the default value in superpwa_get_settings().
348
- * Enhancement: UTM Tracking Add-on: Added default values for Campaign Medium and Campaign Name.
349
- * Bug Fix: Fixed a rare PHP Notice: Array to string conversion in basic-setup.php on line 415. [#92](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/92)
350
- * Bug Fix: Added a check to see if WP_Plugins_List_Table class is available before using it. [#93](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/93)
351
-
352
- = 2.0.2 =
353
- * Date: 16.January.2019
354
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
355
-
356
- = 2.0.1 =
357
- * Date: [15.January.2019](https://superpwa.com/superpwa-2-0/?utm_source=wordpress.org&utm_medium=changelog#2.0.1)
358
- * Enhancement: Added compatibility for setups where dynamic files are not supported.
359
-
360
- = 2.0 =
361
- * Date: [28.December.2018](https://superpwa.com/superpwa-2-0/?utm_source=wordpress.org&utm_medium=changelog)
362
- * Tested with WordPress 5.0.2.
363
- * Enhancement: Dynamic service worker and manifest.
364
- * Enhancement: SuperPWA is now compatible with WordPress in a sub-folder.
365
- * Enhancement: Added UI to set [Display property](https://superpwa.com/doc/web-app-manifest-display-modes/?utm_source=wordpress.org&utm_medium=changelog) in the web app manifest.
366
- * Enhancement: Limit short_name to 12 characters to meet Lighthouse recommendation.
367
- * Enhancement: Added PHP CodeSniffer to stick to "WordPress-Extra" coding standards. Thanks Daniel for the work.
368
- * Enhancement: SuperPWA is available in 12 languages now, thanks to the awesome translators! Translators are credited in the [release note](https://superpwa.com/superpwa-2-0/).
369
-
370
- = 1.9 =
371
- * Date: [25.July.2018](https://superpwa.com/superpwa-1-9-chrome-mini-infobar-ready/?utm_source=wordpress.org&utm_medium=changelog)
372
- * Tested with WordPress 4.9.7.
373
- * Enhancement: Added compatibility with Google Chrome 68 Mini Info-Bar.
374
- * Enhancement: Added support for tagDiv AMP Plugin which ships with Newspaper theme and Newsmag theme. If you use this theme, you can now use AMP version of the start page.
375
- * Enhancement: Added support for images in offline page. Images added to offline page are now cached during service worker activation.
376
- * Enhancement: Improved the service worker installation routine to handle invalid entities in the service worker dependencies.
377
- * Enhancement: SuperPWA is now translated to French, thanks to [@romainvincent](https://profiles.wordpress.org/romainvincent) and Spanish, thanks to [@arkangel](https://profiles.wordpress.org/arkangel/).
378
- * Bug Fix: Fixed issue where translation files in /languages/ folder was not being loaded.
379
-
380
- = 1.8.1 =
381
- * Date: [05.June.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog#1.8.1)
382
- * Enhancement: Added an admin notice with [instructions for OneSignal integration](https://superpwa.com/doc/setup-onesignal-with-superpwa/?utm_source=wordpress.org&utm_medium=changelog).
383
- * Enhancement: Updated console log message for URLs excluded from cache for better clarity.
384
-
385
- = 1.8 =
386
- * Date: [31.May.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog)
387
- * Tested with WordPress 4.9.6.
388
- * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
389
- * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
390
- * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
391
- * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
392
- * Enhancement: Generated a .pot file with all strings for translation. You can also translate SuperPWA to your language by visiting [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/super-progressive-web-apps)
393
- * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
394
- * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
395
-
396
- = 1.7.1 =
397
- * Date: 05.May.2018
398
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
399
-
400
- = 1.7 =
401
- * Date: [03.May.2018](https://superpwa.com/introducing-add-ons-for-superpwa/?utm_source=wordpress.org&utm_medium=changelog)
402
- * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
403
- * New Feature: Add-Ons for SuperPWA is here!
404
- * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
405
- * New Feature: Add UTM Tracking parameters to the Start URL with the [UTM Tracking Add-On](https://superpwa.com/addons/utm-tracking/?utm_source=wordpress.org&utm_medium=changelog).
406
- * Enhancement: Service worker URLs are now relative to accommodate for domain mapped Multisites.
407
- * Bug Fix: Incorrect start_url when WordPress is installed in a folder, or when inner pages are used as start_url.
408
- * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
409
-
410
- = 1.6 =
411
- * Date: [23.April.2018](https://superpwa.com/1-6-released-multisite-network-support/?utm_source=wordpress.org&utm_medium=changelog)
412
- * New Feature: WordPress Multisite Network Compatibility. One of the most requested features for SuperPWA is now here! Thanks [@juslintek](https://wordpress.org/support/topic/add-manifest-json-support-for-multisite/#post-9998629) for doing a major share of the heavy lifting.
413
- * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
414
- * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
415
- * Enhancement: Improved the file and folder naming, organization, and inline documentation for better readability.
416
- * Enhancement: Force https:// on all assets and dependencies solving the problem of http:// URLs in manifest and service worker once and for all.
417
- * Enhancement: Relative URL for manifest for out of the box compatibility with CDN's.
418
- * Enhancement: Removed forcing of trailing slash on manifest and service worker URLs for better compatibility.
419
-
420
- = 1.5 =
421
- * Date: 18.March.2018
422
- * New Feature: OneSignal integration for Push notifications.
423
- * Enhancement: Moved manifest to the top of wp_head for easier detection by browsers.
424
- * Enhancement: Added support for custom AMP endpoints for AMP for WordPress and AMP for WP.
425
- * Enhancement: Added UI notice when using AMP for WordPress to warn user not to use the AMP version of start page if the start page is the homepage, the blog index, or the archives page.
426
-
427
- = 1.4 =
428
- * Date: [21.February.2018](https://wordpress.org/support/topic/you-asked-and-we-listened-superpwa-1-4-ships-with-two-user-feature-requests/)
429
- * New Feature: Added UI for default orientation of your PWA. Orientation can now be set as "any", "portrait" or "landscape". [Feature request from @doofustoo](https://wordpress.org/support/topic/almost-perfect-335/).
430
- * New Feature: Added UI for theme_color property in manifest. [Feature request from @krunalsm](https://wordpress.org/support/topic/diffrent-theme_color-and-background_color/).
431
- * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
432
- * Enhancement: Improved handling of external resources.
433
-
434
- = 1.3.1 =
435
- * Date: 15.February.2018
436
- * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
437
- * Enhancement: Improved how start_url is handled in the manifest.
438
- * Enhancement: Better handling of external resources.
439
-
440
- = 1.3 =
441
- * Date: 10.February.2018
442
- * New Feature: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
443
- * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
444
- * Enhancement: Improved in-browser service worker update handling.
445
- * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
446
- * Bug Fix: Only GET requests are served from the cache now. Fixes [this](https://wordpress.org/support/topic/errors-in-firefox-and-chrome/).
447
-
448
- = 1.2 =
449
- * Date: 06.February.2018
450
- * New Feature: Support for theme-color.
451
- * New Feature: Now you can edit the Application Name and Application Short name.
452
- * New Feature: Set the start page of your PWA.
453
- * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
454
- * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
455
- * UI Improvement: Added admin notice with a link to settings page on plugin activation.
456
- * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
457
- * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
458
-
459
- = 1.1.1 =
460
- * Date: 30.January.2018
461
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context". PHP manual says "Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error."
462
-
463
- = 1.1 =
464
- * Date: 28.January.2018
465
- * New Feature: Aggressive caching of pages using CacheStorage API.
466
- * New Feature: Pages once cached are served even if the user is offline.
467
- * New Feature: Set custom offline page. Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
468
-
469
- = 1.0 =
470
- * Date: 22.January.2018
471
- * First release of the plugin.
472
-
473
- == Upgrade Notice ==
474
-
475
- = 2.1 =
476
- * Tested with WordPress 5.4.1.
477
- * Enhancement: Removed the WordPress admin notice suggesting to add SuperPWA manifest to OneSignal.
478
- * Enhancement: Updated fallback value in superpwa_get_display() to match the default value in superpwa_get_settings().
479
- * Enhancement: UTM Tracking Add-on: Added default values for Campaign Medium and Campaign Name.
480
- * Bug Fix: Fixed a rare PHP Notice: Array to string conversion in basic-setup.php on line 415.
481
- * Bug Fix: Added a check to see if WP_Plugins_List_Table class is available before using it.
482
-
483
- = 2.0.2 =
484
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
485
-
486
- = 2.0.1 =
487
- * Enhancement: Added compatibility for setups where dynamic files are not supported.
488
-
489
- = 2.0 =
490
- * Tested with WordPress 5.0.2.
491
- * Enhancement: Dynamic service worker and manifest.
492
- * Enhancement: SuperPWA is now compatible with WordPress in a sub-folder.
493
- * Enhancement: Added UI to set Display property in the web app manifest.
494
- * Enhancement: Limit short_name to 12 characters to meet Lighthouse recommendation.
495
- * Enhancement: Added PHP CodeSniffer to stick to "WordPress-Extra" coding standards. Thanks Daniel for the work.
496
- * Enhancement: SuperPWA is available in 12 languages now, thanks to the awesome translators! Translators are credited in the release note.
497
-
498
- = 1.9 =
499
- * Tested with WordPress 4.9.7.
500
- * Enhancement: Added compatibility with Google Chrome 68 Mini Info-Bar.
501
- * Enhancement: Added support for tagDiv AMP Plugin which ships with Newspaper theme and Newsmag theme. If you use this theme, you can now use AMP version of the start page.
502
- * Enhancement: Added support for images in offline page. Images added to offline page are now cached during service worker activation.
503
- * Enhancement: Improved the service worker installation routine to handle invalid entities in the service worker dependencies.
504
- * Enhancement: SuperPWA is now translated to French, thanks to @romainvincent and Spanish, thanks to @arkangel.
505
- * Bug Fix: Fixed issue where translation files in /languages/ folder was not being loaded.
506
-
507
- = 1.8.1 =
508
- * Enhancement: Added an admin notice with instructions for OneSignal integration.
509
- * Enhancement: Updated console log message for URLs excluded from cache for better clarity.
510
-
511
- = 1.8 =
512
- * Tested with WordPress 4.9.6.
513
- * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
514
- * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
515
- * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
516
- * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
517
- * Enhancement: Generated a .pot file with all strings for translation. You can also translate SuperPWA to your language by visiting translate.wordpress.org/projects/wp-plugins/super-progressive-web-apps
518
- * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
519
- * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
520
-
521
- = 1.7.1 =
522
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
523
-
524
- = 1.7 =
525
- * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
526
- * New Feature: Add-Ons for SuperPWA is here!
527
- * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
528
- * New Feature: Add UTM Tracking parameters to the Start URL with the [UTM Tracking Add-On](https://superpwa.com/addons/utm-tracking/?utm_source=wordpress.org&utm_medium=upgrade-notice).
529
- * Enhancement: Service worker URLs are now relative to accommodate for domain mapped Multisites.
530
- * Bug Fix: Incorrect start_url when WordPress is installed in a folder, or when inner pages are used as start_url.
531
- * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
532
-
533
- = 1.6 =
534
- * New Feature: WordPress Multisite Network Compatibility. One of the most requested features for SuperPWA is now here! Thanks [@juslintek](https://wordpress.org/support/topic/add-manifest-json-support-for-multisite/#post-9998629) for doing a major share of the heavy lifting.
535
- * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
536
- * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
537
- * Enhancement: Improved the file and folder naming, organization, and inline documentation for better readability.
538
- * Enhancement: Force https:// on all assets and dependencies solving the problem of http:// URLs in manifest and service worker once and for all.
539
- * Enhancement: Relative URL for manifest for out of the box compatibility with CDN's.
540
- * Enhancement: Removed forcing of trailing slash on manifest and service worker URLs for better compatibility.
541
-
542
- = 1.5 =
543
- * New Feature: OneSignal integration for Push notifications.
544
- * Enhancement: Moved manifest to the top of wp_head for easier detection by browsers.
545
- * Enhancement: Added support for custom AMP endpoints for AMP for WordPress and AMP for WP.
546
- * Enhancement: Added UI notice when using AMP for WordPress to warn user not to use the AMP version of start page if the start page is the homepage, the blog index, or the archives page.
547
-
548
- = 1.4 =
549
- * New Feature: Added UI for default orientation of your PWA. Orientation can now be set as "any", "portrait" or "landscape".
550
- * New Feature: Added UI for theme_color property in manifest.
551
- * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
552
- * Enhancement: Improved handling of external resources.
553
-
554
- = 1.3.1 =
555
- * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
556
- * Enhancement: Improved how start_url is handled in the manifest.
557
- * Enhancement: Better handling of external resources.
558
-
559
- = 1.3 =
560
- * New Feature: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
561
- * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
562
- * Enhancement: Improved in-browser service worker update handling.
563
- * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
564
-
565
- = 1.2 =
566
- * New Feature: Support for theme-color.
567
- * New Feature: Now you can edit the Application Name and Application Short name.
568
- * New Feature: Set the start page of your PWA.
569
- * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
570
- * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
571
- * UI Improvement: Added admin notice with a link to settings page on plugin activation.
572
- * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
573
- * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
574
-
575
- = 1.1.1 =
576
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context". PHP manual says "Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error."
577
-
578
- = 1.1 =
579
- * New Feature: Aggressive caching of pages using CacheStorage API.
580
- * New Feature: Pages once cached are served even if the user is offline.
581
- * New Feature: Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
582
-
583
- = 1.0 =
584
- * First release of the plugin.
1
+ === Super Progressive Web Apps ===
2
+ Contributors: SuperPWA
3
+ Tags: pwa, progressive web apps, manifest, web manifest, android app, chrome app, add to homescreen, mobile web
4
+ Requires at least: 3.6.0
5
+ Tested up to: 6.1
6
+ Requires PHP