Super Progressive Web Apps - Version 2.1.3

Version Description

Improvement: Changes in Admin Options Enhancement: Added more pages

Download this release

Release Info

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

Code changes from version 2.1.2 to 2.1.3

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,231 +1,231 @@
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
- }
48
-
49
- // Show admin notice.
50
- add_action( 'admin_notices', 'superpwa_onesignal_admin_notices', 9 );
51
- add_action( 'network_admin_notices', 'superpwa_onesignal_admin_notices', 9 );
52
- }
53
- }
54
- add_action( 'plugins_loaded', 'superpwa_onesignal_todo' );
55
-
56
- /**
57
- * Add gcm_sender_id to SuperPWA manifest
58
- *
59
- * OneSignal's gcm_sender_id is 482941778795
60
- *
61
- * @param (array) $manifest Array with the manifest entries passed via the superpwa_manifest filter.
62
- *
63
- * @return (array) Array appended with the gcm_sender_id of OneSignal
64
- *
65
- * @since 1.8
66
- */
67
- function superpwa_onesignal_add_gcm_sender_id( $manifest ) {
68
-
69
- $manifest['gcm_sender_id'] = '482941778795';
70
-
71
- return $manifest;
72
- }
73
-
74
- /**
75
- * Change Service Worker filename to OneSignalSDKWorker.js.php
76
- *
77
- * OneSignalSDKWorker.js.php is the name of the service worker of OneSignal.
78
- * Since only one service worker is allowed in a given scope, OneSignal unregisters all other service workers and registers theirs.
79
- * Having the same name prevents OneSignal from unregistering our service worker.
80
- *
81
- * @link https://documentation.onesignal.com/docs/web-push-setup-faq
82
- *
83
- * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
84
- *
85
- * @return (string) Service worker filename changed to OneSignalSDKWorker.js.php
86
- *
87
- * @since 1.8
88
- */
89
- function superpwa_onesignal_sw_filename( $sw_filename ) {
90
- return 'OneSignalSDKWorker.js.php';
91
- }
92
-
93
- /**
94
- * Import OneSignal service worker in SuperPWA
95
- *
96
- * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
97
- *
98
- * @return (string) Import OneSignal's service worker into SuperPWA
99
- *
100
- * @author Arun Basil Lal
101
- *
102
- * @since 1.8
103
- * @since 2.0 Removed content-type header for compatibility with dynamic service workers.
104
- * @since 2.0.1 Added back compatibility with static service workers by sending content-type header.
105
- */
106
- function superpwa_onesignal_sw( $sw ) {
107
-
108
- /**
109
- * Checking to see if we are already sending the Content-Type header.
110
- *
111
- * @see superpwa_generate_sw_and_manifest_on_fly()
112
- */
113
- $match = preg_grep( '#Content-Type: text/javascript#i', headers_list() );
114
-
115
- if ( ! empty ( $match ) ) {
116
-
117
- $onesignal = 'importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );' . PHP_EOL;
118
-
119
- return $onesignal . $sw;
120
- }
121
-
122
- $onesignal = '<?php' . PHP_EOL;
123
- $onesignal .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
124
- $onesignal .= 'echo "importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );";' . PHP_EOL;
125
- $onesignal .= '?>' . PHP_EOL . PHP_EOL;
126
-
127
- return $onesignal . $sw;
128
- }
129
-
130
- /**
131
- * OneSignal activation todo
132
- *
133
- * Regenerates SuperPWA manifest with the gcm_sender_id added.
134
- * Delete current service worker.
135
- * Regenerate SuperPWA service worker with the new filename.
136
- *
137
- * @author Arun Basil Lal
138
- *
139
- * @since 1.8
140
- * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
141
- */
142
- function superpwa_onesignal_activation() {
143
-
144
- // Do not do anything for multisites
145
- if ( is_multisite() ) {
146
- return;
147
- }
148
-
149
- // Filter in gcm_sender_id to SuperPWA manifest
150
- add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
151
-
152
- // Regenerate SuperPWA manifest
153
- superpwa_generate_manifest();
154
-
155
- // Delete service worker if it exists
156
- superpwa_delete_sw();
157
-
158
- // Change service worker filename to match OneSignal's service worker
159
- add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
160
-
161
- // Import OneSignal service worker in SuperPWA
162
- add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
163
-
164
- // Regenerate SuperPWA service worker
165
- superpwa_generate_sw();
166
- }
167
- add_action( 'activate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_activation', 11 );
168
-
169
- /**
170
- * OneSignal deactivation todo
171
- *
172
- * Regenerates SuperPWA manifest.
173
- * Delete current service worker.
174
- * Regenerate SuperPWA service worker.
175
- *
176
- * @author Arun Basil Lal
177
- *
178
- * @since 1.8
179
- * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
180
- */
181
- function superpwa_onesignal_deactivation() {
182
-
183
- // Do not do anything for multisites
184
- if ( is_multisite() ) {
185
- return;
186
- }
187
-
188
- // Remove gcm_sender_id from SuperPWA manifest
189
- remove_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
190
-
191
- // Regenerate SuperPWA manifest
192
- superpwa_generate_manifest();
193
-
194
- // Delete service worker if it exists
195
- superpwa_delete_sw();
196
-
197
- // Restore the default service worker of SuperPWA
198
- remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
199
-
200
- // Remove OneSignal service worker in SuperPWA
201
- remove_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
202
-
203
- // Regenerate SuperPWA service worker
204
- superpwa_generate_sw();
205
- }
206
- add_action( 'deactivate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_deactivation', 11 );
207
-
208
- /**
209
- * Admin notices for OneSignal compatibility
210
- *
211
- * One Single installs, warn users to add SuperPWA manifest as custom manifest in OneSignal settings.
212
- * One multisites, warn users that SuperPWA and OneSignal cannot work together.
213
- *
214
- * @since 1.8.1
215
- * @since 2.1 Removed the notice recommending customers to add manifest to OneSignal.
216
- */
217
- function superpwa_onesignal_admin_notices() {
218
-
219
- // Incompatibility notice for Multisites
220
- if ( is_multisite() && current_user_can( 'manage_options' ) ) {
221
-
222
- echo '<div class="notice notice-warning"><p>' .
223
- sprintf(
224
- __( '<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' ),
225
- 'https://superpwa.com/doc/setup-onesignal-with-superpwa/?utm_source=superpwa-plugin&utm_medium=onesignal-multisite-admin-notice#multisites'
226
- ) . '</p></div>';
227
-
228
- // Filter PWA status since PWA is not ready yet.
229
- add_filter( 'superpwa_is_pwa_ready', '__return_false' );
230
- }
231
  }
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
+ }
48
+
49
+ // Show admin notice.
50
+ add_action( 'admin_notices', 'superpwa_onesignal_admin_notices', 9 );
51
+ add_action( 'network_admin_notices', 'superpwa_onesignal_admin_notices', 9 );
52
+ }
53
+ }
54
+ add_action( 'plugins_loaded', 'superpwa_onesignal_todo' );
55
+
56
+ /**
57
+ * Add gcm_sender_id to SuperPWA manifest
58
+ *
59
+ * OneSignal's gcm_sender_id is 482941778795
60
+ *
61
+ * @param (array) $manifest Array with the manifest entries passed via the superpwa_manifest filter.
62
+ *
63
+ * @return (array) Array appended with the gcm_sender_id of OneSignal
64
+ *
65
+ * @since 1.8
66
+ */
67
+ function superpwa_onesignal_add_gcm_sender_id( $manifest ) {
68
+
69
+ $manifest['gcm_sender_id'] = '482941778795';
70
+
71
+ return $manifest;
72
+ }
73
+
74
+ /**
75
+ * Change Service Worker filename to OneSignalSDKWorker.js.php
76
+ *
77
+ * OneSignalSDKWorker.js.php is the name of the service worker of OneSignal.
78
+ * Since only one service worker is allowed in a given scope, OneSignal unregisters all other service workers and registers theirs.
79
+ * Having the same name prevents OneSignal from unregistering our service worker.
80
+ *
81
+ * @link https://documentation.onesignal.com/docs/web-push-setup-faq
82
+ *
83
+ * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
84
+ *
85
+ * @return (string) Service worker filename changed to OneSignalSDKWorker.js.php
86
+ *
87
+ * @since 1.8
88
+ */
89
+ function superpwa_onesignal_sw_filename( $sw_filename ) {
90
+ return 'OneSignalSDKWorker.js.php';
91
+ }
92
+
93
+ /**
94
+ * Import OneSignal service worker in SuperPWA
95
+ *
96
+ * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
97
+ *
98
+ * @return (string) Import OneSignal's service worker into SuperPWA
99
+ *
100
+ * @author Arun Basil Lal
101
+ *
102
+ * @since 1.8
103
+ * @since 2.0 Removed content-type header for compatibility with dynamic service workers.
104
+ * @since 2.0.1 Added back compatibility with static service workers by sending content-type header.
105
+ */
106
+ function superpwa_onesignal_sw( $sw ) {
107
+
108
+ /**
109
+ * Checking to see if we are already sending the Content-Type header.
110
+ *
111
+ * @see superpwa_generate_sw_and_manifest_on_fly()
112
+ */
113
+ $match = preg_grep( '#Content-Type: text/javascript#i', headers_list() );
114
+
115
+ if ( ! empty ( $match ) ) {
116
+
117
+ $onesignal = 'importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );' . PHP_EOL;
118
+
119
+ return $onesignal . $sw;
120
+ }
121
+
122
+ $onesignal = '<?php' . PHP_EOL;
123
+ $onesignal .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
124
+ $onesignal .= 'echo "importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );";' . PHP_EOL;
125
+ $onesignal .= '?>' . PHP_EOL . PHP_EOL;
126
+
127
+ return $onesignal . $sw;
128
+ }
129
+
130
+ /**
131
+ * OneSignal activation todo
132
+ *
133
+ * Regenerates SuperPWA manifest with the gcm_sender_id added.
134
+ * Delete current service worker.
135
+ * Regenerate SuperPWA service worker with the new filename.
136
+ *
137
+ * @author Arun Basil Lal
138
+ *
139
+ * @since 1.8
140
+ * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
141
+ */
142
+ function superpwa_onesignal_activation() {
143
+
144
+ // Do not do anything for multisites
145
+ if ( is_multisite() ) {
146
+ return;
147
+ }
148
+
149
+ // Filter in gcm_sender_id to SuperPWA manifest
150
+ add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
151
+
152
+ // Regenerate SuperPWA manifest
153
+ superpwa_generate_manifest();
154
+
155
+ // Delete service worker if it exists
156
+ superpwa_delete_sw();
157
+
158
+ // Change service worker filename to match OneSignal's service worker
159
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
160
+
161
+ // Import OneSignal service worker in SuperPWA
162
+ add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
163
+
164
+ // Regenerate SuperPWA service worker
165
+ superpwa_generate_sw();
166
+ }
167
+ add_action( 'activate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_activation', 11 );
168
+
169
+ /**
170
+ * OneSignal deactivation todo
171
+ *
172
+ * Regenerates SuperPWA manifest.
173
+ * Delete current service worker.
174
+ * Regenerate SuperPWA service worker.
175
+ *
176
+ * @author Arun Basil Lal
177
+ *
178
+ * @since 1.8
179
+ * @since 1.8.1 Excluded multisites. No OneSignal compatibility on multisites yet. In 1.8 onesignal.php was not loaded for multisites.
180
+ */
181
+ function superpwa_onesignal_deactivation() {
182
+
183
+ // Do not do anything for multisites
184
+ if ( is_multisite() ) {
185
+ return;
186
+ }
187
+
188
+ // Remove gcm_sender_id from SuperPWA manifest
189
+ remove_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
190
+
191
+ // Regenerate SuperPWA manifest
192
+ superpwa_generate_manifest();
193
+
194
+ // Delete service worker if it exists
195
+ superpwa_delete_sw();
196
+
197
+ // Restore the default service worker of SuperPWA
198
+ remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
199
+
200
+ // Remove OneSignal service worker in SuperPWA
201
+ remove_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
202
+
203
+ // Regenerate SuperPWA service worker
204
+ superpwa_generate_sw();
205
+ }
206
+ add_action( 'deactivate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_deactivation', 11 );
207
+
208
+ /**
209
+ * Admin notices for OneSignal compatibility
210
+ *
211
+ * One Single installs, warn users to add SuperPWA manifest as custom manifest in OneSignal settings.
212
+ * One multisites, warn users that SuperPWA and OneSignal cannot work together.
213
+ *
214
+ * @since 1.8.1
215
+ * @since 2.1 Removed the notice recommending customers to add manifest to OneSignal.
216
+ */
217
+ function superpwa_onesignal_admin_notices() {
218
+
219
+ // Incompatibility notice for Multisites
220
+ if ( is_multisite() && current_user_can( 'manage_options' ) ) {
221
+
222
+ echo '<div class="notice notice-warning"><p>' .
223
+ sprintf(
224
+ __( '<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' ),
225
+ 'https://superpwa.com/doc/setup-onesignal-with-superpwa/?utm_source=superpwa-plugin&utm_medium=onesignal-multisite-admin-notice#multisites'
226
+ ) . '</p></div>';
227
+
228
+ // Filter PWA status since PWA is not ready yet.
229
+ add_filter( 'superpwa_is_pwa_ready', '__return_false' );
230
+ }
231
  }
README.MD CHANGED
@@ -1,239 +1,236 @@
1
- **Help decide on the future of SuperPWA**
2
- We are looking for your input to decide on the future of SuperPWA. If you wish to acquire SuperPWA as a whole and continue it's development or if you are interested in a premium version of the plugin with extended features, [please fill in the form and let us know](https://superpwa.com/superpwa-2-1/?utm_source=github&utm_medium=description-future).
3
-
4
- # Super Progressive Web Apps
5
- <p>
6
- <a href="https://twitter.com/intent/follow?screen_name=superpwa">
7
- <img src="https://img.shields.io/twitter/follow/superpwa.svg?style=social&logo=twitter" alt="follow SuperPWA on Twitter">
8
- </a>
9
- <a href="https://github.com/SuperPWA/Super-Progressive-Web-Apps">
10
- <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">
11
- </a>
12
-
13
-
14
- </p>
15
-
16
- <p align="center">
17
- <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-SuperPWALogo">
18
- <img src="https://pbs.twimg.com/profile_images/975224418543681536/X9-CESOD_400x400.jpg" alt="Super Progressive Web Apps" width=175 height=175>
19
- </a>
20
-
21
- <h3 align="center">Super Progressive Web Apps</h3>
22
-
23
- <p align="center">
24
- SuperPWA helps to convert your WordPress website into Progressive Web Apps easily.
25
- <br>
26
- <br>
27
- <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-viewWeb"><strong>Visit Website »</strong></a>
28
- <br>
29
- <br>
30
- <a href="https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/new?template=bug.md">Report bug</a>
31
- ·
32
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">WordPress Plugin</a>
33
- ·
34
- <a href="https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/">Reviews</a>
35
- ·
36
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/#faq">FAQ</a>
37
- ·
38
- <a href="#-contributions">Contributions</a>
39
- </p>
40
- </p>
41
-
42
-
43
- <p align="center">
44
- <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=Readme-LighthouseScore">
45
- <img src="https://lighthouse-badge.appspot.com?score=100" alt="LightHouse Score">
46
- </a>
47
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
48
- <img src="https://img.shields.io/wordpress/plugin/dt/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Downloads">
49
- </a>
50
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
51
- <img src="https://img.shields.io/wordpress/plugin/r/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Rating">
52
- </a>
53
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
54
- <img src="https://img.shields.io/wordpress/plugin/v/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Version">
55
- </a>
56
- <a href="https://wordpress.org/plugins/super-progressive-web-apps/">
57
- <img src="https://img.shields.io/wordpress/v/super-progressive-web-apps.svg?style=plastic" alt="Super Progressive Web Apps Version">
58
- </a>
59
- </p>
60
-
61
- ## Welcome to the Super PWA GitHub repository
62
-
63
- ⚡️ 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)
64
-
65
- ## What is Progressive Web Apps
66
- 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.
67
-
68
- 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!
69
-
70
- <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!
71
-
72
- ## Support the project
73
- 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.
74
-
75
- <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>
76
-
77
- Also you can support us via [following on social media's and share about us](#share-via-social-medias-and-spread-superpwa).
78
-
79
- ## 🏗 Installation
80
- 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!
81
-
82
- 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.
83
-
84
- ### 💡 Progressive Web App Minimum Requirments
85
- - [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.
86
- </br>
87
-
88
- ##### Videos on How Add to Home Screen & Progressive Web Apps works on Different Browsers
89
-
90
- |<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 |
91
- | :---------: | :---------: | :---------: | :---------: | :---------: |
92
- </br>
93
-
94
- ##### Detailed Documentations for testing PWA on Browsers
95
-
96
- * [PWA on Chrome for Android](https://superpwa.com/doc/test-pwa-google-chrome/)
97
- * [PWA on Desktop - Chrome](https://superpwa.com/doc/test-pwa-on-desktop/)
98
- * [PWA on iOS device - Safari Browser](https://superpwa.com/doc/test-pwa-ios-devices/)
99
- * [PWA on Microsoft Edge Browser for Android](https://superpwa.com/doc/test-pwa-microsoft-edge/)
100
- * [PWA on Samsung Internet Browser for Android](https://superpwa.com/doc/test-pwa-samsung-internet-browser/)
101
-
102
- #### 📦 What's in the box
103
-
104
- Here are the current features of Super Progressive Web Apps:
105
-
106
- * Generate a manifest for your website and add it to the head of your website.
107
- * Set the application icon for your Progressive Web App.
108
- * Set the background color for the splash screen of your Progressive Web App.
109
- * Your website will show the "Add to home screen" notice when accessed in a supported browser.
110
- * Aggressive caching of pages using CacheStorage API.
111
- * Pages once cached are served even if the user is offline.
112
- * 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.
113
- * New in version 1.2: Support for theme-color.
114
- * New in version 1.2: Now you can edit the Application Name and Application Short name.
115
- * New in version 1.2: Set the start page of your PWA.
116
- * 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.
117
- * 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.
118
- * New in version 1.3: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
119
- * New in version 1.3: Improved in-browser service worker update handling.
120
- * New in version 1.4: You can now set the default orientation of your PWA. Choose from "any" (Follow Device Orientation), "Portrait" and "Landscape".
121
- * New in version 1.4: You can now set the theme_color property in the manifest.
122
- * New in version 1.5: OneSignal integration for Push notifications.
123
- * New in version 1.6: WordPress Multisite Network compatibility.
124
- * 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.
125
- * New in version 1.8: Compatibility issues with OneSignal are now resolved!
126
- * 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.
127
- * New in version 2.0: SuperPWA is now compatible with WordPress installed in a sub-folder.
128
- * 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.
129
- * New in version 2.1.1: Support for maskabale icons.
130
-
131
- #### 🔮 Upcoming features:
132
- * Offline Indicator Notice.
133
-
134
- ### Device and Browser Support For PWA
135
- | | <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 |
136
- | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: |
137
- | 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" /> |
138
- | 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" /> |
139
- | 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" /> |
140
- | 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" /> | - | - |
141
- | 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" /> |
142
-
143
- </br>
144
-
145
- <p align="center">
146
- <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> Supported
147
- &nbsp;
148
- &nbsp;
149
- &nbsp;
150
- &nbsp;
151
- <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="32px" height="32px" /> Beta or Partial Support
152
- &nbsp;
153
- &nbsp;
154
- &nbsp;
155
- &nbsp;
156
- <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> In Development
157
- </p>
158
-
159
-
160
- 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.
161
-
162
- The list is fast growing and is likely to be supported in most major browsers by the end of this year.
163
-
164
- ### Why Build Progressive Web Apps?
165
- [![Why Build Progressive Web Apps](http://i3.ytimg.com/vi/1QILz1lAzWY/maxresdefault.jpg)](https://www.youtube.com/embed/1QILz1lAzWY)
166
-
167
- ### How To Convert Your WordPress Website Into A Progressive Web App
168
-
169
- #### ⚙️ WordPress Installation
170
-
171
- * Visit WordPress Admin > **Plugins** > **Add New**
172
- * Search for **Super Progressive Web Apps**
173
- * Click "**Install Now**" and then "**Activate**" Super Progressive Web Apps
174
-
175
- #### ⚙️ To install manually:
176
-
177
- * Upload super-progressive-web-apps folder to the /wp-content/plugins/ directory on your server
178
- * Go to WordPress Admin > **Plugins**
179
- * Activate **Super Progressive Web Apps** plugin from the list.
180
-
181
- #### Customizing Your Progressive Web App
182
-
183
- 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.
184
-
185
- * Go to WordPress Admin > "**SuperPWA**" > **Settings**
186
- * Set a Background Color for the splash screen to be shown when your PWA is opened on a mobile device.
187
- * 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.
188
- * 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.".
189
- * Click "Save Settings".
190
-
191
- #### Testing Your Progressive Web App
192
-
193
- * Open a supported browser in a supported device (for eg: Chrome for Android (62 or higher) in an Android device)
194
- * Enter your website and wait till it fully loads
195
- * You should see a pop-up that has your Application Icon and a button that reads "ADD TO HOME SCREEN".
196
- * Click on it and your PWA will be added to your home screen. Wait for the install to complete.
197
- * Go to your home screen and open your PWA. Browse into a few pages if you like. Close the App.
198
- * Disconnect from the internet and now open your PWA again. You should be able to see all the pages that you previously browsed.
199
- * 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.
200
-
201
-
202
- ### 🤝 About us
203
- > 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.
204
-
205
- ## ⛷️ Support
206
- This is a developer's portal for Super Progressive Web Apps and should not be used for support. Please visit the
207
- [Support Forums](https://wordpress.org/support/plugin/super-progressive-web-apps).
208
-
209
- ## 🐛 Reporting bugs
210
- 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!
211
-
212
- ## 🎍 Contributions
213
- Anyone is welcome to contribute to Super PWA to make it SUPER.
214
-
215
- There are various ways you can contribute:
216
-
217
- * [Raise an issue](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues) on GitHub.
218
- * Follow and Engage with us on Social Media
219
-
220
- &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;
221
- <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;
222
- <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;
223
- <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;
224
-
225
- * Send us a Pull Request with your bug fixes and/or new features.
226
- * 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).
227
- * ##### Share via Social Media's and spread SuperPWA
228
-
229
- &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;
230
- <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>
231
- <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>
232
-
233
- ## 📇 Changelog
234
- [superpwa.com/changelog/](https://superpwa.com/changelog/?utm_source=GitHub&utm_medium=Readme-Changelog).
235
-
236
- Emoji Credits : [Emojipedia](emojipedia.org)
237
- Social Media Icon Credits : [Flaticon](flaticon.com)
238
-
239
- **[⬆ 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,36 +1,36 @@
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
-
30
- foreach( $icons as $icon ) {
31
- $tags .= '<link rel="apple-touch-icon" sizes="' . $icon['sizes'] . '" href="' . $icon['src'] . '">' . PHP_EOL;
32
- }
33
-
34
- return $tags;
35
- }
36
  add_filter( 'superpwa_wp_head_tags', 'superpwa_ati_add_apple_touch_icons' );
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
+
30
+ foreach( $icons as $icon ) {
31
+ $tags .= '<link rel="apple-touch-icon" sizes="' . $icon['sizes'] . '" href="' . $icon['src'] . '">' . PHP_EOL;
32
+ }
33
+
34
+ return $tags;
35
+ }
36
  add_filter( 'superpwa_wp_head_tags', 'superpwa_ati_add_apple_touch_icons' );
addons/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
addons/utm-tracking.php CHANGED
@@ -1,397 +1,385 @@
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
- * Add sub-menu page for UTM Tracking
29
- *
30
- * @since 1.7
31
- */
32
- function superpwa_utm_tracking_sub_menu() {
33
-
34
- // UTM Tracking sub-menu
35
- 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' );
36
- }
37
- add_action( 'admin_menu', 'superpwa_utm_tracking_sub_menu' );
38
-
39
- /**
40
- * Get UTM Tracking settings
41
- *
42
- * @since 1.7
43
- */
44
- function superpwa_utm_tracking_get_settings() {
45
-
46
- $defaults = array(
47
- 'utm_source' => 'superpwa',
48
- 'utm_medium' => 'superpwa',
49
- 'utm_campaign' => 'superpwa',
50
- );
51
-
52
- return get_option( 'superpwa_utm_tracking_settings', $defaults );
53
- }
54
-
55
- /**
56
- * Add UTM Tracking to the start_url
57
- *
58
- * Hooks onto the superpwa_manifest_start_url filter to add the
59
- * UTM tracking parameters to the start_url
60
- *
61
- * Example: https://superpwa.com/?utm_source=superpwa&utm_medium=medium&utm_campaign=name&utm_term=terms&utm_content=content
62
- *
63
- * @param $start_url (string) the start_url for manifest from superpwa_get_start_url()
64
- * @return (string) Filtered start_url with UTM tracking added
65
- *
66
- * @since 1.7
67
- */
68
- function superpwa_utm_tracking_for_start_url( $start_url ) {
69
-
70
- // Get UTM Tracking settings
71
- $utm_params = superpwa_utm_tracking_get_settings();
72
-
73
- // Add the initial '/?'
74
- $start_url = trailingslashit( $start_url ) . '?';
75
-
76
- // Build the URL
77
- foreach ( $utm_params as $param => $value ) {
78
-
79
- if ( ! empty( $value ) ) {
80
- $start_url = $start_url . $param . '=' . rawurlencode( $value ) . '&';
81
- }
82
- }
83
-
84
- // Remove trailing '&'
85
- return rtrim( $start_url, '&' );
86
- }
87
- add_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
88
-
89
- /**
90
- * Todo list after saving UTM Tracking settings
91
- *
92
- * Regenerate manifest when settings are saved.
93
- * Also used when add-on is activated and deactivated.
94
- *
95
- * @since 1.7
96
- */
97
- function superpwa_utm_tracking_save_settings_todo() {
98
-
99
- // Regenerate manifest
100
- superpwa_generate_manifest();
101
- }
102
- add_action( 'add_option_superpwa_utm_tracking_settings', 'superpwa_utm_tracking_save_settings_todo' );
103
- add_action( 'update_option_superpwa_utm_tracking_settings', 'superpwa_utm_tracking_save_settings_todo' );
104
- add_action( 'superpwa_addon_activated_utm_tracking', 'superpwa_utm_tracking_save_settings_todo' );
105
-
106
- /**
107
- * Deactivation Todo
108
- *
109
- * Unhook the filter and regenerate manifest
110
- *
111
- * @since 1.7
112
- */
113
- function superpwa_utm_tracking_deactivate_todo() {
114
-
115
- // Unhook the UTM tracking params filter
116
- remove_filter( 'superpwa_manifest_start_url', 'superpwa_utm_tracking_for_start_url' );
117
-
118
- // Regenerate manifest
119
- superpwa_generate_manifest();
120
- }
121
- add_action( 'superpwa_addon_deactivated_utm_tracking', 'superpwa_utm_tracking_deactivate_todo' );
122
-
123
- /**
124
- * Register UTM Tracking settings
125
- *
126
- * @since 1.7
127
- */
128
- function superpwa_utm_tracking_register_settings() {
129
-
130
- // Register Setting
131
- register_setting(
132
- 'superpwa_utm_tracking_settings_group', // Group name
133
- 'superpwa_utm_tracking_settings', // Setting name = html form <input> name on settings form
134
- 'superpwa_utm_tracking_validater_sanitizer' // Input validator and sanitizer
135
- );
136
-
137
- // UTM Tracking
138
- add_settings_section(
139
- 'superpwa_utm_tracking_section', // ID
140
- __return_false(), // Title
141
- 'superpwa_utm_tracking_section_cb', // Callback Function
142
- 'superpwa_utm_tracking_section' // Page slug
143
- );
144
-
145
- // Current Start URL
146
- add_settings_field(
147
- 'superpwa_utm_tracking_start_url', // ID
148
- __('Current Start URL', 'super-progressive-web-apps'), // Title
149
- 'superpwa_utm_tracking_start_url_cb', // CB
150
- 'superpwa_utm_tracking_section', // Page slug
151
- 'superpwa_utm_tracking_section' // Settings Section ID
152
- );
153
-
154
- // Campaign Source
155
- add_settings_field(
156
- 'superpwa_utm_tracking_source', // ID
157
- __('Campaign Source', 'super-progressive-web-apps'), // Title
158
- 'superpwa_utm_tracking_source_cb', // CB
159
- 'superpwa_utm_tracking_section', // Page slug
160
- 'superpwa_utm_tracking_section' // Settings Section ID
161
- );
162
-
163
- // Campaign Medium
164
- add_settings_field(
165
- 'superpwa_utm_tracking_medium', // ID
166
- __('Campaign Medium', 'super-progressive-web-apps'), // Title
167
- 'superpwa_utm_tracking_medium_cb', // CB
168
- 'superpwa_utm_tracking_section', // Page slug
169
- 'superpwa_utm_tracking_section' // Settings Section ID
170
- );
171
-
172
- // Campaign Name
173
- add_settings_field(
174
- 'superpwa_utm_tracking_name', // ID
175
- __('Campaign Name', 'super-progressive-web-apps'), // Title
176
- 'superpwa_utm_tracking_name_cb', // CB
177
- 'superpwa_utm_tracking_section', // Page slug
178
- 'superpwa_utm_tracking_section' // Settings Section ID
179
- );
180
-
181
- // Campaign Term
182
- add_settings_field(
183
- 'superpwa_utm_tracking_term', // ID
184
- __('Campaign Term', 'super-progressive-web-apps'), // Title
185
- 'superpwa_utm_tracking_term_cb', // CB
186
- 'superpwa_utm_tracking_section', // Page slug
187
- 'superpwa_utm_tracking_section' // Settings Section ID
188
- );
189
-
190
- // Campaign Content
191
- add_settings_field(
192
- 'superpwa_utm_tracking_content', // ID
193
- __('Campaign Content', 'super-progressive-web-apps'), // Title
194
- 'superpwa_utm_tracking_content_cb', // CB
195
- 'superpwa_utm_tracking_section', // Page slug
196
- 'superpwa_utm_tracking_section' // Settings Section ID
197
- );
198
- }
199
- add_action( 'admin_init', 'superpwa_utm_tracking_register_settings' );
200
-
201
- /**
202
- * Validate and sanitize user input
203
- *
204
- * @since 1.7
205
- */
206
- function superpwa_utm_tracking_validater_sanitizer( $settings ) {
207
-
208
- // Sanitize and validate campaign source. Campaign source cannot be empty.
209
- $settings['utm_source'] = sanitize_text_field( $settings['utm_source'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_source'] );
210
-
211
- // Sanitize campaign medium
212
- $settings['utm_medium'] = sanitize_text_field( $settings['utm_medium'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_medium'] );
213
-
214
- // Sanitize campaign name
215
- $settings['utm_campaign'] = sanitize_text_field( $settings['utm_campaign'] ) == '' ? 'superpwa' : sanitize_text_field( $settings['utm_campaign'] );
216
-
217
- // Sanitize campaign term
218
- $settings['utm_term'] = sanitize_text_field( $settings['utm_term'] );
219
-
220
- // Sanitize campaign medium
221
- $settings['utm_content'] = sanitize_text_field( $settings['utm_content'] );
222
-
223
- return $settings;
224
- }
225
-
226
- /**
227
- * Callback function for UTM Tracking section
228
- *
229
- * @since 1.7
230
- */
231
- function superpwa_utm_tracking_section_cb() {
232
-
233
- // Get add-on info
234
- $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
235
-
236
- 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' );
237
- }
238
-
239
- /**
240
- * Current Start URL
241
- *
242
- * @since 1.7
243
- */
244
- function superpwa_utm_tracking_start_url_cb() {
245
-
246
- echo '<code style="word-break: break-all;">' . superpwa_get_start_url( true ) . '</code>';
247
- }
248
-
249
- /**
250
- * Campaign Source
251
- *
252
- * @since 1.7
253
- */
254
- function superpwa_utm_tracking_source_cb() {
255
-
256
- // Get Settings
257
- $settings = superpwa_utm_tracking_get_settings(); ?>
258
-
259
- <fieldset>
260
-
261
- <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'] ); ?>"/>
262
-
263
- </fieldset>
264
-
265
- <p class="description">
266
- <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
267
- </p>
268
-
269
- <?php
270
- }
271
-
272
- /**
273
- * Campaign Medium
274
- *
275
- * @since 1.7
276
- */
277
- function superpwa_utm_tracking_medium_cb() {
278
-
279
- // Get Settings
280
- $settings = superpwa_utm_tracking_get_settings(); ?>
281
-
282
- <fieldset>
283
-
284
- <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'] ); ?>"/>
285
-
286
- </fieldset>
287
-
288
- <p class="description">
289
- <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
290
- </p>
291
-
292
- <?php
293
- }
294
-
295
- /**
296
- * Campaign Name
297
- *
298
- * @since 1.7
299
- */
300
- function superpwa_utm_tracking_name_cb() {
301
-
302
- // Get Settings
303
- $settings = superpwa_utm_tracking_get_settings(); ?>
304
-
305
- <fieldset>
306
-
307
- <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'] ); ?>"/>
308
-
309
- </fieldset>
310
-
311
- <p class="description">
312
- <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>.', 'super-progressive-web-apps' ); ?>
313
- </p>
314
-
315
- <?php
316
- }
317
-
318
- /**
319
- * Campaign Term
320
- *
321
- * @since 1.7
322
- */
323
- function superpwa_utm_tracking_term_cb() {
324
-
325
- // Get Settings
326
- $settings = superpwa_utm_tracking_get_settings(); ?>
327
-
328
- <fieldset>
329
-
330
- <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'] ); ?>"/>
331
-
332
- </fieldset>
333
-
334
- <?php
335
- }
336
-
337
- /**
338
- * Campaign Content
339
- *
340
- * @since 1.7
341
- */
342
- function superpwa_utm_tracking_content_cb() {
343
-
344
- // Get Settings
345
- $settings = superpwa_utm_tracking_get_settings(); ?>
346
-
347
- <fieldset>
348
-
349
- <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'] ); ?>"/>
350
-
351
- </fieldset>
352
-
353
- <?php
354
- }
355
-
356
- /**
357
- * UTM Tracking UI renderer
358
- *
359
- * @since 1.7
360
- */
361
- function superpwa_utm_tracking_interface_render() {
362
-
363
- // Authentication
364
- if ( ! current_user_can( 'manage_options' ) ) {
365
- return;
366
- }
367
-
368
- // Handing save settings
369
- if ( isset( $_GET['settings-updated'] ) ) {
370
-
371
- // Add settings saved message with the class of "updated"
372
- add_settings_error( 'superpwa_settings_group', 'superpwa_utm_tracking_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
373
-
374
- // Show Settings Saved Message
375
- settings_errors( 'superpwa_settings_group' );
376
- }
377
-
378
- ?>
379
-
380
- <div class="wrap">
381
- <h1><?php _e( 'UTM Tracking for', 'super-progressive-web-apps' ); ?> SuperPWA <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
382
-
383
- <form action="options.php" method="post" enctype="multipart/form-data">
384
- <?php
385
- // Output nonce, action, and option_page fields for a settings page.
386
- settings_fields( 'superpwa_utm_tracking_settings_group' );
387
-
388
- // Status
389
- do_settings_sections( 'superpwa_utm_tracking_section' ); // Page slug
390
-
391
- // Output save settings button
392
- submit_button( __('Save Settings', 'super-progressive-web-apps') );
393
- ?>
394
- </form>
395
- </div>
396
- <?php
397
  }
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
+
366
+ ?>
367
+
368
+ <div class="wrap">
369
+ <h1><?php _e( 'UTM Tracking for', 'super-progressive-web-apps' ); ?> SuperPWA <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
370
+
371
+ <form action="options.php" method="post" enctype="multipart/form-data">
372
+ <?php
373
+ // Output nonce, action, and option_page fields for a settings page.
374
+ settings_fields( 'superpwa_utm_tracking_settings_group' );
375
+
376
+ // Status
377
+ do_settings_sections( 'superpwa_utm_tracking_section' ); // Page slug
378
+
379
+ // Output save settings button
380
+ submit_button( __('Save Settings', 'super-progressive-web-apps') );
381
+ ?>
382
+ </form>
383
+ </div>
384
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
385
  }
admin/admin-ui-render-addons.php CHANGED
@@ -1,500 +1,550 @@
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
- 'utm_tracking' => array(
49
- 'name' => __( 'UTM Tracking', 'super-progressive-web-apps' ),
50
- 'description' => __( 'Track visits from your app by adding UTM tracking parameters to the Start Page URL.', 'super-progressive-web-apps' ),
51
- 'type' => 'bundled',
52
- 'icon' => 'superpwa-128x128.png',
53
- 'link' => 'https://superpwa.com/addons/utm-tracking/',
54
- 'admin_link' => admin_url( 'admin.php?page=superpwa-utm-tracking' ),
55
- 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
56
- 'admin_link_target' => 'admin',
57
- 'superpwa_min_version' => '1.7',
58
- ),
59
- 'apple_touch_icons' => array(
60
- 'name' => __( 'Apple Touch Icons', 'super-progressive-web-apps' ),
61
- 'description' => __( 'Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.', 'super-progressive-web-apps' ),
62
- 'type' => 'bundled',
63
- 'icon' => 'superpwa-128x128.png',
64
- 'link' => 'https://superpwa.com/addons/apple-touch-icons/',
65
- 'admin_link' => 'https://superpwa.com/addons/apple-touch-icons/',
66
- 'admin_link_text' => __( 'More Details &rarr;', 'super-progressive-web-apps' ),
67
- 'admin_link_target' => 'external',
68
- 'superpwa_min_version' => '1.8',
69
- ),
70
- );
71
-
72
- if ( $slug === false ) {
73
- return $addons;
74
- }
75
-
76
- if ( ! isset( $addons[$slug] ) ) {
77
- return false;
78
- }
79
-
80
- return $addons[$slug];
81
- }
82
-
83
- /**
84
- * Add-Ons UI renderer
85
- *
86
- * @since 1.7
87
- */
88
- function superpwa_addons_interface_render() {
89
-
90
- // Authentication
91
- if ( ! current_user_can( 'manage_options' ) ) {
92
- return;
93
- }
94
-
95
- // Add-on activation todo
96
- if ( isset( $_GET['activated'] ) && isset( $_GET['addon'] ) ) {
97
-
98
- // Add-on activation action. Functions defined in the add-on file are loaded by now.
99
- do_action( 'superpwa_addon_activated_' . $_GET['addon'] );
100
-
101
- // Get add-on info
102
- $addon = superpwa_get_addons( $_GET['addon'] );
103
-
104
- // Add UTM Tracking to admin_link_text if its not an admin page.
105
- if ( $addon['admin_link_target'] === 'external' ) {
106
- $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-activation-notice';
107
- }
108
-
109
- // Set link target attribute so that external links open in a new tab.
110
- $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
111
-
112
- if ( $addon !== false ) {
113
-
114
- // Add-on activation notice
115
- 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>';
116
- }
117
- }
118
-
119
- // Add-on de-activation notice
120
- if ( isset( $_GET['deactivated'] ) ) {
121
-
122
- // Add settings saved message with the class of "updated"
123
- add_settings_error( 'superpwa_settings_group', 'superpwa_addon_deactivated_message', __( 'Add-On deactivated', 'super-progressive-web-apps' ), 'updated' );
124
-
125
- // Show Settings Saved Message
126
- settings_errors( 'superpwa_settings_group' );
127
- }
128
-
129
- // Get add-ons array
130
- $addons = superpwa_get_addons();
131
-
132
- ?>
133
-
134
- <div class="wrap">
135
- <h1><?php _e( 'Add-Ons for', 'super-progressive-web-apps' ); ?> SuperPWA <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
136
-
137
- <p><?php _e( 'Add-Ons extend the functionality of SuperPWA.', 'super-progressive-web-apps' ); ?></p>
138
-
139
- <!-- Add-Ons UI -->
140
- <div class="wp-list-table widefat addon-install">
141
-
142
- <div id="the-list">
143
-
144
- <?php
145
- // Newsletter marker. Set this to false once newsletter subscription is displayed.
146
- $superpwa_newsletter = true;
147
-
148
- // Looping over each add-on
149
- foreach( $addons as $slug => $addon ) {
150
-
151
- // Add UTM Tracking to admin_link_text if its not an admin page.
152
- if ( $addon['admin_link_target'] === 'external' ) {
153
- $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-card';
154
- }
155
-
156
- // Set link target attribute so that external links open in a new tab.
157
- $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
158
-
159
- ?>
160
-
161
- <div class="plugin-card plugin-card-<?php echo $slug; ?>">
162
-
163
- <div class="plugin-card-top">
164
-
165
- <div class="name column-name">
166
- <h3>
167
- <a href="<?php echo $addon['link'] . '?utm_source=superpwa-plugin&utm_medium=addon-card'; ?>" target="_blank">
168
- <?php echo $addon['name']; ?>
169
- <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/' . $addon['icon']; ?>" class="plugin-icon" alt="">
170
- </a>
171
- </h3>
172
- </div>
173
-
174
- <div class="action-links">
175
- <ul class="plugin-action-buttons">
176
- <li>
177
- <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']; ?>">
178
- <?php echo superpwa_addons_button_text( $slug ); ?>
179
- </a>
180
- </li>
181
- <li>
182
- <a href="<?php echo $addon['link'] . '?utm_source=superpwa-plugin&utm_medium=addon-card'; ?>" 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>
183
- </li>
184
- </ul>
185
- </div>
186
-
187
- <div class="desc column-description">
188
- <p><?php echo $addon['description']; ?></p>
189
- </div>
190
-
191
- </div>
192
-
193
- <div class="plugin-card-bottom">
194
- <div class="column-compatibility">
195
- <?php
196
- if ( superpwa_addons_status( $slug ) == 'active' ) {
197
- 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'] );
198
- }
199
- else if ( version_compare( SUPERPWA_VERSION, $addon['superpwa_min_version'], '>=' ) ) {
200
- _e( '<span class="compatibility-compatible"><strong>Compatible</strong> with your version of SuperPWA</span>', 'super-progressive-web-apps' );
201
- }
202
- else {
203
- _e( '<span class="compatibility-incompatible"><strong>Please upgrade</strong> to the latest version of SuperPWA</span>', 'super-progressive-web-apps' );
204
- } ?>
205
- </div>
206
- </div>
207
-
208
- </div>
209
-
210
- <?php if ( $superpwa_newsletter === true ) { ?>
211
-
212
- <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;">
213
-
214
- <div class="plugin-card-top" style="min-height: 178px;">
215
-
216
- <div class="name column-name" style="margin: 0px 10px;">
217
- <h3><?php _e( 'SuperPWA Newsletter', 'super-progressive-web-apps' ); ?></h3>
218
- </div>
219
-
220
- <div class="desc column-description" style="margin: 0px 10px;">
221
- <p><?php _e( 'Learn more about Progressive Web Apps<br>and get latest updates about SuperPWA', 'super-progressive-web-apps' ); ?></p>
222
- </div>
223
-
224
- <div class="superpwa-newsletter-form" style="margin: 18px 10px 0px;">
225
-
226
- <form method="post" action="https://superpwa.com/newsletter/" target="_blank">
227
- <fieldset>
228
-
229
- <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">
230
- <input name="source" value="superpwa-plugin" type="hidden">
231
- <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;">
232
-
233
- <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>
234
-
235
- </fieldset>
236
- </form>
237
-
238
- </div>
239
-
240
- </div>
241
-
242
- </div>
243
-
244
- <?php
245
-
246
- // Set newsletter marker to false
247
- $superpwa_newsletter = false;
248
- }
249
- } ?>
250
-
251
- </div>
252
- </div>
253
-
254
- </div>
255
- <?php
256
- }
257
-
258
- /**
259
- * Find add-on status
260
- *
261
- * Returns one of these statuses:
262
- * active when the add-on is installed and active.
263
- * inactive when the add-on is installed but not activated.
264
- * uninstalled when the add-on is not installed and not available.
265
- *
266
- * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
267
- * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
268
- *
269
- * @return (string) one of the statuses as described above. False if $slug is not a valid add-on.
270
- *
271
- * @since 1.7
272
- */
273
- function superpwa_addons_status( $slug ) {
274
-
275
- // Get add-on details
276
- $addon = superpwa_get_addons( $slug );
277
-
278
- // A security check to make sure that the add-on under consideration exist.
279
- if ( $addon === false ) {
280
- return false;
281
- }
282
-
283
- // Get active add-ons
284
- $active_addons = get_option( 'superpwa_active_addons', array() );
285
-
286
- switch( $addon['type'] ) {
287
-
288
- // Bundled add-ons ships with SuperPWA and need not be installed separately.
289
- case 'bundled':
290
-
291
- // True means, add-on is installed and active
292
- if ( in_array( $slug, $active_addons ) ) {
293
- return 'active';
294
- }
295
-
296
- // add-on is installed, but inactive
297
- return 'inactive';
298
-
299
- break;
300
-
301
- // Add-ons installed as a separate plugin
302
- case 'addon':
303
-
304
- // True means, add-on is installed and active
305
- if ( is_plugin_active( $slug ) ) {
306
- return 'active';
307
- }
308
-
309
- // Add-on is inactive, check if add-on is installed
310
- if ( file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
311
- return 'inactive';
312
- }
313
-
314
- // If we are here, add-on is not installed and not active
315
- return 'uninstalled';
316
-
317
- break;
318
-
319
- default:
320
- return false;
321
- break;
322
- }
323
- }
324
-
325
- /**
326
- * Button text based on add-on status
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) 'Activate', if plugin status is 'inactive'
332
- * 'Deactivate', if plugin status is 'active'
333
- * 'Install', if plugin status is 'uninstalled'
334
- *
335
- * @since 1.7
336
- */
337
- function superpwa_addons_button_text( $slug ) {
338
-
339
- // Get the add-on status
340
- $addon_status = superpwa_addons_status( $slug );
341
-
342
- switch( $addon_status ) {
343
-
344
- case 'inactive':
345
- return __( 'Activate', 'super-progressive-web-apps' );
346
- break;
347
-
348
- case 'active':
349
- return __( 'Deactivate', 'super-progressive-web-apps' );
350
- break;
351
-
352
- case 'uninstalled':
353
- default: // Safety net for edge cases if any.
354
- return __( 'Install', 'super-progressive-web-apps' );
355
- break;
356
- }
357
- }
358
-
359
- /**
360
- * Action URL based on add-on status
361
- *
362
- * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
363
- * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
364
- *
365
- * @return (string) activation / deactivation / install url with nonce as necessary
366
- *
367
- * @since 1.7
368
- */
369
- function superpwa_addons_button_link( $slug ) {
370
-
371
- // Get the add-on status
372
- $addon_status = superpwa_addons_status( $slug );
373
-
374
- // Get add-on details
375
- $addon = superpwa_get_addons( $slug );
376
-
377
- switch( $addon_status ) {
378
-
379
- // Add-on inactive, send activation link.
380
- case 'inactive':
381
-
382
- // Plugin activation link for add-on plugins that are installed separately.
383
- if ( $addon['type'] == 'addon' ) {
384
- wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $slug ), 'activate-plugin_' . $slug );
385
- }
386
-
387
- // Activation link for bundled add-ons.
388
- return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_activate_addon&addon=' . $slug ), 'activate', 'superpwa_addon_activate_nonce' );
389
-
390
- break;
391
-
392
- // Add-on active, send deactivation link.
393
- case 'active':
394
-
395
- // Plugin deactivation link for add-on plugins that are installed separately.
396
- if ( $addon['type'] == 'addon' ) {
397
- wp_nonce_url( admin_url( 'plugins.php?action=deactivate&plugin=' . $slug ), 'deactivate-plugin_' . $slug );
398
- }
399
-
400
- // Deactivation link for bundled add-ons.
401
- return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_deactivate_addon&addon=' . $slug ), 'deactivate', 'superpwa_addon_deactivate_nonce' );
402
-
403
- break;
404
-
405
- // If add-on is not installed and for edge cases where $addon_status is false, we use the add-on link.
406
- case 'uninstalled':
407
- default:
408
- return $addon['link'];
409
- break;
410
- }
411
- }
412
-
413
- /**
414
- * Handle add-on activation
415
- *
416
- * Verifies that the activation request is valid and then redirects the page back to the add-ons page.
417
- * Hooked onto admin_post_superpwa_activate_addon action hook
418
- *
419
- * @since 1.7
420
- * @since 1.8 Handles only activation. Used to handle both activation and deactivation.
421
- * @since 1.8 Hooked onto admin_post_superpwa_activate_addon. Was hooked to load-superpwa_page_superpwa-addons before.
422
- */
423
- function superpwa_addons_handle_activation() {
424
-
425
- // Get the add-on status
426
- $addon_status = superpwa_addons_status( $_GET['addon'] );
427
-
428
- // Authentication
429
- if (
430
- ! current_user_can( 'manage_options' ) ||
431
- ! isset( $_GET['addon'] ) ||
432
- ! ( isset( $_GET['superpwa_addon_activate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_activate_nonce'], 'activate' ) ) ||
433
- ! ( $addon_status == 'inactive' )
434
- ) {
435
-
436
- // Return to referer if authentication fails.
437
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
438
- exit;
439
- }
440
-
441
- // Get active add-ons
442
- $active_addons = get_option( 'superpwa_active_addons', array() );
443
-
444
- // Add the add-on to the list of active add-ons
445
- $active_addons[] = $_GET['addon'];
446
-
447
- // Write settings back to database
448
- update_option( 'superpwa_active_addons', $active_addons );
449
-
450
- // Redirect back to add-ons sub-menu
451
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons&activated=1&addon=' . $_GET['addon'] ) );
452
- exit;
453
- }
454
- add_action( 'admin_post_superpwa_activate_addon', 'superpwa_addons_handle_activation' );
455
-
456
- /**
457
- * Handle add-on deactivation
458
- *
459
- * Verifies that the deactivation request is valid and then redirects the page back to the add-ons page.
460
- * Hooked onto admin_post_superpwa_deactivate_addon action hook.
461
- *
462
- * @since 1.8
463
- */
464
- function superpwa_addons_handle_deactivation() {
465
-
466
- // Get the add-on status
467
- $addon_status = superpwa_addons_status( $_GET['addon'] );
468
-
469
- // Authentication
470
- if (
471
- ! current_user_can( 'manage_options' ) ||
472
- ! isset( $_GET['addon'] ) ||
473
- ! ( isset( $_GET['superpwa_addon_deactivate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_deactivate_nonce'], 'deactivate' ) ) ||
474
- ! ( $addon_status == 'active' )
475
- ) {
476
-
477
- // Return to referer if authentication fails.
478
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
479
- exit;
480
- }
481
-
482
- // Get active add-ons
483
- $active_addons = get_option( 'superpwa_active_addons', array() );
484
-
485
- // Delete the add-on from the active_addons array in SuperPWA settings.
486
- $active_addons = array_flip( $active_addons );
487
- unset( $active_addons[ $_GET['addon'] ] );
488
- $active_addons = array_flip( $active_addons );
489
-
490
- // Write settings back to database
491
- update_option( 'superpwa_active_addons', $active_addons );
492
-
493
- // Add-on deactivation action. Functions defined in the add-on file are still availalbe at this point.
494
- do_action( 'superpwa_addon_deactivated_' . $_GET['addon'] );
495
-
496
- // Redirect back to add-ons sub-menu
497
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons&deactivated=1&addon=' . $_GET['addon'] ) );
498
- exit;
499
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
  add_action( 'admin_post_superpwa_deactivate_addon', 'superpwa_addons_handle_deactivation' );
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
+ 'utm_tracking' => array(
49
+ 'name' => __( 'UTM Tracking', 'super-progressive-web-apps' ),
50
+ 'description' => __( 'Track visits from your app by adding UTM tracking parameters to the Start Page URL.', 'super-progressive-web-apps' ),
51
+ 'type' => 'bundled',
52
+ 'icon' => 'utm-action.png',
53
+ 'link' => 'https://superpwa.com/addons/utm-tracking/',
54
+ 'admin_link' => admin_url( 'admin.php?page=superpwa-utm-tracking' ),
55
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
56
+ 'admin_link_target' => 'admin',
57
+ 'superpwa_min_version' => '1.7',
58
+ ),
59
+ 'apple_touch_icons' => array(
60
+ 'name' => __( 'Apple Touch Icons', 'super-progressive-web-apps' ),
61
+ 'description' => __( 'Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.', 'super-progressive-web-apps' ),
62
+ 'type' => 'bundled',
63
+ 'icon' => 'apple-touch.png',
64
+ 'link' => 'https://superpwa.com/addons/apple-touch-icons/',
65
+ 'admin_link' => 'https://superpwa.com/addons/apple-touch-icons/',
66
+ 'admin_link_text' => __( 'More Details &rarr;', 'super-progressive-web-apps' ),
67
+ 'admin_link_target' => 'external',
68
+ 'superpwa_min_version' => '1.8',
69
+ ),
70
+ 'call_to_action' => array(
71
+ 'name' => __( 'Call To Action', 'super-progressive-web-apps' ),
72
+ 'description' => __( 'Easily gives notification banner your users to Add to Homescreen on website.', 'super-progressive-web-apps' ),
73
+ 'type' => 'addon_pro',
74
+ 'icon' => 'call-to-action.png',
75
+ 'link' => admin_url('admin.php?page=superpwa-upgrade'),
76
+ 'admin_link' => admin_url('admin.php?page=superpwa-call-to-action'),
77
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
78
+ 'admin_link_target' => 'admin',
79
+ 'superpwa_min_version' => '2.1.2',
80
+ ),
81
+ 'android_apk_app_generator' => array(
82
+ 'name' => __( 'Android APK APP Generator', 'super-progressive-web-apps' ),
83
+ 'description' => __( 'Easily generate APK APP of your current PWA website.', 'super-progressive-web-apps' ),
84
+ 'type' => 'addon_pro',
85
+ 'icon' => 'android-apk-app.png',
86
+ 'link' => admin_url('admin.php?page=superpwa-upgrade'),
87
+ 'admin_link' => admin_url('admin.php?page=superpwa-android-apk-app'),
88
+ 'admin_link_text' => __( 'Customize Settings &rarr;', 'super-progressive-web-apps' ),
89
+ 'admin_link_target' => 'admin',
90
+ 'superpwa_min_version' => '2.1.2',
91
+ ),
92
+ );
93
+
94
+ if ( $slug === false ) {
95
+ return $addons;
96
+ }
97
+
98
+ if ( ! isset( $addons[$slug] ) ) {
99
+ return false;
100
+ }
101
+
102
+ return $addons[$slug];
103
+ }
104
+
105
+ /**
106
+ * Add-Ons UI renderer
107
+ *
108
+ * @since 1.7
109
+ */
110
+ function superpwa_addons_interface_render() {
111
+
112
+ // Authentication
113
+ if ( ! current_user_can( 'manage_options' ) ) {
114
+ return;
115
+ }
116
+
117
+ // Add-on activation todo
118
+ if ( isset( $_GET['activated'] ) && isset( $_GET['addon'] ) ) {
119
+
120
+ // Add-on activation action. Functions defined in the add-on file are loaded by now.
121
+ do_action( 'superpwa_addon_activated_' . $_GET['addon'] );
122
+
123
+ // Get add-on info
124
+ $addon = superpwa_get_addons( $_GET['addon'] );
125
+
126
+ // Add UTM Tracking to admin_link_text if its not an admin page.
127
+ if ( $addon['admin_link_target'] === 'external' ) {
128
+ $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-activation-notice';
129
+ }
130
+
131
+ // Set link target attribute so that external links open in a new tab.
132
+ $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
133
+
134
+ if ( $addon !== false ) {
135
+
136
+ // Add-on activation notice
137
+ 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>';
138
+ }
139
+ }
140
+
141
+ // Add-on de-activation notice
142
+ if ( isset( $_GET['deactivated'] ) ) {
143
+
144
+ // Add settings saved message with the class of "updated"
145
+ add_settings_error( 'superpwa_settings_group', 'superpwa_addon_deactivated_message', __( 'Add-On deactivated', 'super-progressive-web-apps' ), 'updated' );
146
+
147
+ // Show Settings Saved Message
148
+ settings_errors( 'superpwa_settings_group' );
149
+ }
150
+
151
+ // Get add-ons array
152
+ $addons = superpwa_get_addons();
153
+
154
+ ?>
155
+
156
+ <div class="wrap">
157
+ <h1><?php _e( 'Add-ons for', 'super-progressive-web-apps' ); ?> SuperPWA <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
158
+
159
+ <p><?php _e( 'Add-Ons extend the functionality of SuperPWA.', 'super-progressive-web-apps' ); ?></p>
160
+
161
+ <!-- Add-Ons UI -->
162
+ <div class="wp-list-table widefat addon-install">
163
+
164
+ <div id="the-list">
165
+
166
+ <?php
167
+ // Newsletter marker. Set this to false once newsletter subscription is displayed.
168
+ $superpwa_newsletter = true;
169
+
170
+ // Looping over each add-on
171
+ foreach( $addons as $slug => $addon ) {
172
+
173
+ // Add UTM Tracking to admin_link_text if its not an admin page.
174
+ if ( $addon['admin_link_target'] === 'external' ) {
175
+ $addon['admin_link'] .= '?utm_source=superpwa-plugin&utm_medium=addon-card';
176
+ }
177
+
178
+ // Set link target attribute so that external links open in a new tab.
179
+ $link_target = ( $addon['admin_link_target'] === 'external' ) ? 'target="_blank"' : '';
180
+
181
+ ?>
182
+
183
+ <div class="plugin-card plugin-card-<?php echo $slug; ?>">
184
+
185
+ <div class="plugin-card-top">
186
+
187
+ <div class="name column-name">
188
+ <h3>
189
+ <a href="<?php echo $addon['link'] . (($addon['admin_link_target'] === 'external')? '?utm_source=superpwa-plugin&utm_medium=addon-card': '') ; ?>" target="_blank">
190
+ <?php echo $addon['name']; ?>
191
+ <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/' . $addon['icon']; ?>" class="plugin-icon" alt="">
192
+ </a>
193
+ </h3>
194
+ </div>
195
+
196
+ <div class="action-links">
197
+ <ul class="plugin-action-buttons">
198
+ <li>
199
+ <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']; ?>">
200
+ <?php echo superpwa_addons_button_text( $slug ); ?>
201
+ </a>
202
+ </li>
203
+ <li>
204
+ <a href="<?php echo $addon['link'] . (($addon['admin_link_target'] === 'external')?'?utm_source=superpwa-plugin&utm_medium=addon-card': ''); ?>" 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>
205
+ </li>
206
+ </ul>
207
+ </div>
208
+
209
+ <div class="desc column-description">
210
+ <p><?php echo $addon['description']; ?></p>
211
+ </div>
212
+
213
+ </div>
214
+
215
+ <div class="plugin-card-bottom">
216
+ <div class="column-compatibility">
217
+ <?php
218
+ if ( superpwa_addons_status( $slug ) == 'active' ) {
219
+ 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'] );
220
+ }
221
+ else if ( version_compare( SUPERPWA_VERSION, $addon['superpwa_min_version'], '>=' ) ) {
222
+ _e( '<span class="compatibility-compatible"><strong>Compatible</strong> with your version of SuperPWA</span>', 'super-progressive-web-apps' );
223
+ }
224
+ else {
225
+ _e( '<span class="compatibility-incompatible"><strong>Please upgrade</strong> to the latest version of SuperPWA</span>', 'super-progressive-web-apps' );
226
+ } ?>
227
+ </div>
228
+ </div>
229
+
230
+ </div>
231
+
232
+ <?php if ( $superpwa_newsletter === true ) { ?>
233
+
234
+ <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;">
235
+
236
+ <div class="plugin-card-top" style="min-height: 178px;">
237
+
238
+ <div class="name column-name" style="margin: 0px 10px;">
239
+ <h3><?php _e( 'SuperPWA Newsletter', 'super-progressive-web-apps' ); ?></h3>
240
+ </div>
241
+
242
+ <div class="desc column-description" style="margin: 0px 10px;">
243
+ <p><?php _e( 'Learn more about Progressive Web Apps<br>and get latest updates about SuperPWA', 'super-progressive-web-apps' ); ?></p>
244
+ </div>
245
+
246
+ <div class="superpwa-newsletter-form" style="margin: 18px 10px 0px;">
247
+
248
+ <form method="post" action="https://superpwa.com/newsletter/" target="_blank">
249
+ <fieldset>
250
+
251
+ <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">
252
+ <input name="source" value="superpwa-plugin" type="hidden">
253
+ <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;">
254
+
255
+ <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>
256
+
257
+ </fieldset>
258
+ </form>
259
+
260
+ </div>
261
+
262
+ </div>
263
+
264
+ </div>
265
+
266
+ <?php
267
+
268
+ // Set newsletter marker to false
269
+ $superpwa_newsletter = false;
270
+ }
271
+ } ?>
272
+
273
+ </div>
274
+ </div>
275
+
276
+ </div>
277
+ <?php
278
+ }
279
+
280
+ /**
281
+ * Find add-on status
282
+ *
283
+ * Returns one of these statuses:
284
+ * active when the add-on is installed and active.
285
+ * inactive when the add-on is installed but not activated.
286
+ * uninstalled when the add-on is not installed and not available.
287
+ *
288
+ * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
289
+ * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
290
+ *
291
+ * @return (string) one of the statuses as described above. False if $slug is not a valid add-on.
292
+ *
293
+ * @since 1.7
294
+ */
295
+ function superpwa_addons_status( $slug ) {
296
+
297
+ // Get add-on details
298
+ $addon = superpwa_get_addons( $slug );
299
+
300
+ // A security check to make sure that the add-on under consideration exist.
301
+ if ( $addon === false ) {
302
+ return false;
303
+ }
304
+
305
+ // Get active add-ons
306
+ $active_addons = get_option( 'superpwa_active_addons', array() );
307
+
308
+ switch( $addon['type'] ) {
309
+
310
+ // Bundled add-ons ships with SuperPWA and need not be installed separately.
311
+ case 'bundled':
312
+
313
+ // True means, add-on is installed and active
314
+ if ( in_array( $slug, $active_addons ) ) {
315
+ return 'active';
316
+ }
317
+
318
+ // add-on is installed, but inactive
319
+ return 'inactive';
320
+
321
+ break;
322
+
323
+ // Add-ons installed as a separate plugin
324
+ case 'addon':
325
+
326
+ // True means, add-on is installed and active
327
+ if ( is_plugin_active( $slug ) ) {
328
+ return 'active';
329
+ }
330
+
331
+ // Add-on is inactive, check if add-on is installed
332
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
333
+ return 'inactive';
334
+ }
335
+
336
+ // If we are here, add-on is not installed and not active
337
+ return 'uninstalled';
338
+
339
+ break;
340
+ // Add-ons pro installed as a separate plugin
341
+ case 'addon_pro':
342
+ $pro_plugin = 'super-progressive-web-apps-pro/super-progressive-web-apps-pro.php';
343
+ // True means, add-on is installed and active
344
+ if ( is_plugin_active( $pro_plugin ) ) {
345
+ // True means, add-on is installed and active
346
+ if ( in_array( $slug, $active_addons ) ) {
347
+ return 'active';
348
+ }
349
+ return 'inactive';
350
+ }
351
+
352
+
353
+ // Add-on is inactive, check if add-on is installed
354
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $pro_plugin ) ) {
355
+ return 'upgrade';
356
+ }
357
+
358
+ // If we are here, add-on is not installed and not active
359
+ return 'upgrade';
360
+
361
+
362
+
363
+ break;
364
+
365
+ default:
366
+ return false;
367
+ break;
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Button text based on add-on status
373
+ *
374
+ * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
375
+ * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
376
+ *
377
+ * @return (string) 'Activate', if plugin status is 'inactive'
378
+ * 'Deactivate', if plugin status is 'active'
379
+ * 'Install', if plugin status is 'uninstalled'
380
+ *
381
+ * @since 1.7
382
+ */
383
+ function superpwa_addons_button_text( $slug ) {
384
+
385
+ // Get the add-on status
386
+ $addon_status = superpwa_addons_status( $slug );
387
+
388
+ switch( $addon_status ) {
389
+
390
+ case 'inactive':
391
+ return __( 'Activate', 'super-progressive-web-apps' );
392
+ break;
393
+
394
+ case 'active':
395
+ return __( 'Deactivate', 'super-progressive-web-apps' );
396
+ break;
397
+
398
+ case 'upgrade':
399
+ return __( 'Upgrade', 'super-progressive-web-apps' );
400
+ break;
401
+ case 'uninstalled':
402
+ default: // Safety net for edge cases if any.
403
+ return __( 'Install', 'super-progressive-web-apps' );
404
+ break;
405
+ }
406
+ }
407
+
408
+ /**
409
+ * Action URL based on add-on status
410
+ *
411
+ * @param $slug this is the $key used in the $addons array in superpwa_get_addons().
412
+ * For add-ons installed as a separate plugin, this will be plugin-directory/main-plugin-file.php
413
+ *
414
+ * @return (string) activation / deactivation / install url with nonce as necessary
415
+ *
416
+ * @since 1.7
417
+ */
418
+ function superpwa_addons_button_link( $slug ) {
419
+
420
+ // Get the add-on status
421
+ $addon_status = superpwa_addons_status( $slug );
422
+
423
+ // Get add-on details
424
+ $addon = superpwa_get_addons( $slug );
425
+
426
+ switch( $addon_status ) {
427
+
428
+ // Add-on inactive, send activation link.
429
+ case 'inactive':
430
+
431
+ // Plugin activation link for add-on plugins that are installed separately.
432
+ if ( $addon['type'] == 'addon' ) {
433
+ wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $slug ), 'activate-plugin_' . $slug );
434
+ }
435
+
436
+ // Activation link for bundled add-ons.
437
+ return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_activate_addon&addon=' . $slug ), 'activate', 'superpwa_addon_activate_nonce' );
438
+
439
+ break;
440
+
441
+ // Add-on active, send deactivation link.
442
+ case 'active':
443
+
444
+ // Plugin deactivation link for add-on plugins that are installed separately.
445
+ if ( $addon['type'] == 'addon' ) {
446
+ wp_nonce_url( admin_url( 'plugins.php?action=deactivate&plugin=' . $slug ), 'deactivate-plugin_' . $slug );
447
+ }
448
+
449
+ // Deactivation link for bundled add-ons.
450
+ return wp_nonce_url( admin_url( 'admin-post.php?action=superpwa_deactivate_addon&addon=' . $slug ), 'deactivate', 'superpwa_addon_deactivate_nonce' );
451
+
452
+ break;
453
+
454
+ // If add-on is not installed and for edge cases where $addon_status is false, we use the add-on link.
455
+ case 'uninstalled':
456
+ case 'upgrade':
457
+ default:
458
+ return $addon['link'];
459
+ break;
460
+ }
461
+ }
462
+
463
+ /**
464
+ * Handle add-on activation
465
+ *
466
+ * Verifies that the activation request is valid and then redirects the page back to the add-ons page.
467
+ * Hooked onto admin_post_superpwa_activate_addon action hook
468
+ *
469
+ * @since 1.7
470
+ * @since 1.8 Handles only activation. Used to handle both activation and deactivation.
471
+ * @since 1.8 Hooked onto admin_post_superpwa_activate_addon. Was hooked to load-superpwa_page_superpwa-addons before.
472
+ */
473
+ function superpwa_addons_handle_activation() {
474
+
475
+ // Get the add-on status
476
+ $addon_status = superpwa_addons_status( $_GET['addon'] );
477
+
478
+ // Authentication
479
+ if (
480
+ ! current_user_can( 'manage_options' ) ||
481
+ ! isset( $_GET['addon'] ) ||
482
+ ! ( isset( $_GET['superpwa_addon_activate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_activate_nonce'], 'activate' ) ) ||
483
+ ! ( $addon_status == 'inactive' )
484
+ ) {
485
+
486
+ // Return to referer if authentication fails.
487
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
488
+ exit;
489
+ }
490
+
491
+ // Get active add-ons
492
+ $active_addons = get_option( 'superpwa_active_addons', array() );
493
+
494
+ // Add the add-on to the list of active add-ons
495
+ $active_addons[] = $_GET['addon'];
496
+
497
+ // Write settings back to database
498
+ update_option( 'superpwa_active_addons', $active_addons );
499
+
500
+ // Redirect back to add-ons sub-menu
501
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons&activated=1&addon=' . $_GET['addon'] ) );
502
+ exit;
503
+ }
504
+ add_action( 'admin_post_superpwa_activate_addon', 'superpwa_addons_handle_activation' );
505
+
506
+ /**
507
+ * Handle add-on deactivation
508
+ *
509
+ * Verifies that the deactivation request is valid and then redirects the page back to the add-ons page.
510
+ * Hooked onto admin_post_superpwa_deactivate_addon action hook.
511
+ *
512
+ * @since 1.8
513
+ */
514
+ function superpwa_addons_handle_deactivation() {
515
+
516
+ // Get the add-on status
517
+ $addon_status = superpwa_addons_status( $_GET['addon'] );
518
+
519
+ // Authentication
520
+ if (
521
+ ! current_user_can( 'manage_options' ) ||
522
+ ! isset( $_GET['addon'] ) ||
523
+ ! ( isset( $_GET['superpwa_addon_deactivate_nonce'] ) && wp_verify_nonce( $_GET['superpwa_addon_deactivate_nonce'], 'deactivate' ) ) ||
524
+ ! ( $addon_status == 'active' )
525
+ ) {
526
+
527
+ // Return to referer if authentication fails.
528
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons' ) );
529
+ exit;
530
+ }
531
+
532
+ // Get active add-ons
533
+ $active_addons = get_option( 'superpwa_active_addons', array() );
534
+
535
+ // Delete the add-on from the active_addons array in SuperPWA settings.
536
+ $active_addons = array_flip( $active_addons );
537
+ unset( $active_addons[ $_GET['addon'] ] );
538
+ $active_addons = array_flip( $active_addons );
539
+
540
+ // Write settings back to database
541
+ update_option( 'superpwa_active_addons', $active_addons );
542
+
543
+ // Add-on deactivation action. Functions defined in the add-on file are still availalbe at this point.
544
+ do_action( 'superpwa_addon_deactivated_' . $_GET['addon'] );
545
+
546
+ // Redirect back to add-ons sub-menu
547
+ wp_redirect( admin_url( 'admin.php?page=superpwa-addons&deactivated=1&addon=' . $_GET['addon'] ) );
548
+ exit;
549
+ }
550
  add_action( 'admin_post_superpwa_deactivate_addon', 'superpwa_addons_handle_deactivation' );
admin/admin-ui-render-settings.php CHANGED
@@ -1,447 +1,451 @@
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_start_url_cb() Start URL Dropdown
15
- * @function superpwa_offline_page_cb() Offline Page Dropdown
16
- * @function superpwa_orientation_cb() Default Orientation Dropdown
17
- * @function superpwa_display_cb() Default Display Dropdown
18
- * @function superpwa_manifest_status_cb() Manifest Status
19
- * @function superpwa_sw_status_cb() Service Worker Status
20
- * @function superpwa_https_status_cb() HTTPS Status
21
- * @function superpwa_admin_interface_render() Admin interface renderer
22
- */
23
-
24
- // Exit if accessed directly
25
- if ( ! defined( 'ABSPATH' ) ) exit;
26
-
27
- /**
28
- * Application Name
29
- *
30
- * @since 1.2
31
- */
32
- function superpwa_app_name_cb() {
33
-
34
- // Get Settings
35
- $settings = superpwa_get_settings(); ?>
36
-
37
- <fieldset>
38
-
39
- <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']); ?>"/>
40
-
41
- </fieldset>
42
-
43
- <?php
44
- }
45
-
46
- /**
47
- * Application Short Name
48
- *
49
- * @since 1.2
50
- */
51
- function superpwa_app_short_name_cb() {
52
-
53
- // Get Settings
54
- $settings = superpwa_get_settings(); ?>
55
-
56
- <fieldset>
57
-
58
- <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']); ?>"/>
59
-
60
- <p class="description">
61
- <?php _e('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>', 'super-progressive-web-apps'); ?>
62
- </p>
63
-
64
- </fieldset>
65
-
66
- <?php
67
- }
68
-
69
- /**
70
- * Description
71
- *
72
- * @since 1.6
73
- */
74
- function superpwa_description_cb() {
75
-
76
- // Get Settings
77
- $settings = superpwa_get_settings(); ?>
78
-
79
- <fieldset>
80
-
81
- <input type="text" name="superpwa_settings[description]" class="regular-text" value="<?php if ( isset( $settings['description'] ) && ( ! empty( $settings['description'] ) ) ) echo esc_attr( $settings['description'] ); ?>"/>
82
-
83
- <p class="description">
84
- <?php _e( 'A brief description of what your app is about.', 'super-progressive-web-apps' ); ?>
85
- </p>
86
-
87
- </fieldset>
88
-
89
- <?php
90
- }
91
-
92
- /**
93
- * Application Icon
94
- *
95
- * @since 1.0
96
- */
97
- function superpwa_app_icon_cb() {
98
-
99
- // Get Settings
100
- $settings = superpwa_get_settings(); ?>
101
-
102
- <!-- Application Icon -->
103
- <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']) : ''; ?>">
104
- <button type="button" class="button superpwa-icon-upload" data-editor="content">
105
- <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
106
- </button>
107
-
108
- <p class="description">
109
- <?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'); ?>
110
- </p>
111
-
112
- <?php
113
- }
114
-
115
- /**
116
- * Splash Screen Icon
117
- *
118
- * @since 1.3
119
- */
120
- function superpwa_splash_icon_cb() {
121
-
122
- // Get Settings
123
- $settings = superpwa_get_settings(); ?>
124
-
125
- <!-- Splash Screen Icon -->
126
- <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']) : ''; ?>">
127
- <button type="button" class="button superpwa-splash-icon-upload" data-editor="content">
128
- <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
129
- </button>
130
-
131
- <p class="description">
132
- <?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'); ?>
133
- </p>
134
-
135
- <?php
136
- }
137
-
138
- /**
139
- * Splash Screen Background Color
140
- *
141
- * @since 1.0
142
- */
143
- function superpwa_background_color_cb() {
144
-
145
- // Get Settings
146
- $settings = superpwa_get_settings(); ?>
147
-
148
- <!-- Background Color -->
149
- <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">
150
-
151
- <p class="description">
152
- <?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?>
153
- </p>
154
-
155
- <?php
156
- }
157
-
158
- /**
159
- * Theme Color
160
- *
161
- * @since 1.4
162
- */
163
- function superpwa_theme_color_cb() {
164
-
165
- // Get Settings
166
- $settings = superpwa_get_settings(); ?>
167
-
168
- <!-- Theme Color -->
169
- <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">
170
-
171
- <p class="description">
172
- <?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'); ?>
173
- </p>
174
-
175
- <?php
176
- }
177
-
178
- /**
179
- * Start URL Dropdown
180
- *
181
- * @since 1.2
182
- */
183
- function superpwa_start_url_cb() {
184
-
185
- // Get Settings
186
- $settings = superpwa_get_settings(); ?>
187
-
188
- <fieldset>
189
-
190
- <!-- WordPress Pages Dropdown -->
191
- <label for="superpwa_settings[start_url]">
192
- <?php echo wp_dropdown_pages( array(
193
- 'name' => 'superpwa_settings[start_url]',
194
- 'echo' => 0,
195
- 'show_option_none' => __( '&mdash; Homepage &mdash;' ),
196
- 'option_none_value' => '0',
197
- 'selected' => isset($settings['start_url']) ? $settings['start_url'] : '',
198
- )); ?>
199
- </label>
200
-
201
- <p class="description">
202
- <?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() ); ?>
203
- </p>
204
-
205
- <?php if ( superpwa_is_amp() ) { ?>
206
-
207
- <!-- AMP Page As Start Page -->
208
- <br><input type="checkbox" name="superpwa_settings[start_url_amp]" id="superpwa_settings[start_url_amp]" value="1"
209
- <?php if ( isset( $settings['start_url_amp'] ) ) { checked( '1', $settings['start_url_amp'] ); } ?>>
210
- <label for="superpwa_settings[start_url_amp]"><?php _e('Use AMP version of the start page.', 'super-progressive-web-apps') ?></label>
211
- <br>
212
-
213
- <!-- AMP for WordPress 0.6.2 doesn't support homepage, the blog index, and archive pages. -->
214
- <?php if ( is_plugin_active( 'amp/amp.php' ) ) { ?>
215
- <p class="description">
216
- <?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' ); ?>
217
- </p>
218
- <?php } ?>
219
-
220
- <!-- tagDiv AMP 1.2 doesn't enable AMP for pages by default and needs to be enabled manually in settings -->
221
- <?php if ( is_plugin_active( 'td-amp/td-amp.php' ) && method_exists( 'td_util', 'get_option' ) ) {
222
-
223
- // Read option value from db
224
- $td_amp_page_post_type = td_util::get_option( 'tds_amp_post_type_page' );
225
-
226
- // Show notice if option to enable AMP for pages is disabled.
227
- if ( empty( $td_amp_page_post_type ) ) { ?>
228
- <p class="description">
229
- <?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' ) ); ?>
230
- </p>
231
- <?php }
232
- } ?>
233
-
234
- <?php } ?>
235
-
236
- </fieldset>
237
-
238
- <?php
239
- }
240
-
241
- /**
242
- * Offline Page Dropdown
243
- *
244
- * @since 1.1
245
- */
246
- function superpwa_offline_page_cb() {
247
-
248
- // Get Settings
249
- $settings = superpwa_get_settings(); ?>
250
-
251
- <!-- WordPress Pages Dropdown -->
252
- <label for="superpwa_settings[offline_page]">
253
- <?php echo wp_dropdown_pages( array(
254
- 'name' => 'superpwa_settings[offline_page]',
255
- 'echo' => 0,
256
- 'show_option_none' => __( '&mdash; Default &mdash;' ),
257
- 'option_none_value' => '0',
258
- 'selected' => isset($settings['offline_page']) ? $settings['offline_page'] : '',
259
- )); ?>
260
- </label>
261
-
262
- <p class="description">
263
- <?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() ); ?>
264
- </p>
265
-
266
- <?php
267
- }
268
-
269
- /**
270
- * Default Orientation Dropdown
271
- *
272
- * @since 1.4
273
- */
274
- function superpwa_orientation_cb() {
275
-
276
- // Get Settings
277
- $settings = superpwa_get_settings(); ?>
278
-
279
- <!-- Orientation Dropdown -->
280
- <label for="superpwa_settings[orientation]">
281
- <select name="superpwa_settings[orientation]" id="superpwa_settings[orientation]">
282
- <option value="0" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 0 ); } ?>>
283
- <?php _e( 'Follow Device Orientation', 'super-progressive-web-apps' ); ?>
284
- </option>
285
- <option value="1" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 1 ); } ?>>
286
- <?php _e( 'Portrait', 'super-progressive-web-apps' ); ?>
287
- </option>
288
- <option value="2" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 2 ); } ?>>
289
- <?php _e( 'Landscape', 'super-progressive-web-apps' ); ?>
290
- </option>
291
- </select>
292
- </label>
293
-
294
- <p class="description">
295
- <?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' ); ?>
296
- </p>
297
-
298
- <?php
299
- }
300
-
301
- /**
302
- * Default Display Dropdown
303
- *
304
- * @author Jose Varghese
305
- *
306
- * @since 2.0
307
- */
308
- function superpwa_display_cb() {
309
-
310
- // Get Settings
311
- $settings = superpwa_get_settings(); ?>
312
-
313
- <!-- Display Dropdown -->
314
- <label for="superpwa_settings[display]">
315
- <select name="superpwa_settings[display]" id="superpwa_settings[display]">
316
- <option value="0" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 0 ); } ?>>
317
- <?php _e( 'Full Screen', 'super-progressive-web-apps' ); ?>
318
- </option>
319
- <option value="1" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 1 ); } ?>>
320
- <?php _e( 'Standalone', 'super-progressive-web-apps' ); ?>
321
- </option>
322
- <option value="2" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 2 ); } ?>>
323
- <?php _e( 'Minimal UI', 'super-progressive-web-apps' ); ?>
324
- </option>
325
- <option value="3" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 3 ); } ?>>
326
- <?php _e( 'Browser', 'super-progressive-web-apps' ); ?>
327
- </option>
328
- </select>
329
- </label>
330
-
331
- <p class="description">
332
- <?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' ); ?>
333
- </p>
334
-
335
- <?php
336
- }
337
-
338
- /**
339
- * Manifest Status
340
- *
341
- * @author Arun Basil Lal
342
- *
343
- * @since 1.2
344
- * @since 1.8 Attempt to generate manifest again if the manifest doesn't exist.
345
- * @since 2.0 Remove logic to check if manifest exists in favour of dynamic manifest.
346
- * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
347
- */
348
- function superpwa_manifest_status_cb() {
349
-
350
- /**
351
- * Check to see if the file exists, If not attempts to generate a new one.
352
- */
353
- if ( superpwa_file_exists( superpwa_manifest( 'src' ) ) || superpwa_generate_manifest() ) {
354
-
355
- 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' ) );
356
- } else {
357
-
358
- 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' );
359
- }
360
- }
361
-
362
- /**
363
- * Service Worker Status
364
- *
365
- * @author Arun Basil Lal
366
- *
367
- * @since 1.2
368
- * @since 1.8 Attempt to generate service worker again if it doesn't exist.
369
- * @since 2.0 Modify logic to check if Service worker exists.
370
- * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
371
- */
372
- function superpwa_sw_status_cb() {
373
-
374
- /**
375
- * Check to see if the file exists, If not attempts to generate a new one.
376
- */
377
- if ( superpwa_file_exists( superpwa_sw( 'src' ) ) || superpwa_generate_sw() ) {
378
-
379
- 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' ) );
380
- } else {
381
-
382
- 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' );
383
- }
384
- }
385
-
386
- /**
387
- * HTTPS Status
388
- *
389
- * @since 1.2
390
- */
391
- function superpwa_https_status_cb() {
392
-
393
- if ( is_ssl() ) {
394
-
395
- printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Your website is served over HTTPS.', 'super-progressive-web-apps' ) . '</p>' );
396
- } else {
397
-
398
- 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>' );
399
- }
400
- }
401
-
402
- /**
403
- * Admin interface renderer
404
- *
405
- * @since 1.0
406
- * @since 1.7 Handling of settings saved messages since UI is its own menu item in the admin menu.
407
- */
408
- function superpwa_admin_interface_render() {
409
-
410
- // Authentication
411
- if ( ! current_user_can( 'manage_options' ) ) {
412
- return;
413
- }
414
-
415
- // Handing save settings
416
- if ( isset( $_GET['settings-updated'] ) ) {
417
-
418
- // Add settings saved message with the class of "updated"
419
- add_settings_error( 'superpwa_settings_group', 'superpwa_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
420
-
421
- // Show Settings Saved Message
422
- settings_errors( 'superpwa_settings_group' );
423
- }
424
-
425
- ?>
426
-
427
- <div class="wrap">
428
- <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
429
-
430
- <form action="options.php" method="post" enctype="multipart/form-data">
431
- <?php
432
- // Output nonce, action, and option_page fields for a settings page.
433
- settings_fields( 'superpwa_settings_group' );
434
-
435
- // Basic Application Settings
436
- do_settings_sections( 'superpwa_basic_settings_section' ); // Page slug
437
-
438
- // Status
439
- do_settings_sections( 'superpwa_pwa_status_section' ); // Page slug
440
-
441
- // Output save settings button
442
- submit_button( __('Save Settings', 'super-progressive-web-apps') );
443
- ?>
444
- </form>
445
- </div>
446
- <?php
447
- }
 
 
 
 
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_start_url_cb() Start URL Dropdown
15
+ * @function superpwa_offline_page_cb() Offline Page Dropdown
16
+ * @function superpwa_orientation_cb() Default Orientation Dropdown
17
+ * @function superpwa_display_cb() Default Display Dropdown
18
+ * @function superpwa_manifest_status_cb() Manifest Status
19
+ * @function superpwa_sw_status_cb() Service Worker Status
20
+ * @function superpwa_https_status_cb() HTTPS Status
21
+ * @function superpwa_admin_interface_render() Admin interface renderer
22
+ */
23
+
24
+ // Exit if accessed directly
25
+ if ( ! defined( 'ABSPATH' ) ) exit;
26
+
27
+ /**
28
+ * Application Name
29
+ *
30
+ * @since 1.2
31
+ */
32
+ function superpwa_app_name_cb() {
33
+
34
+ // Get Settings
35
+ $settings = superpwa_get_settings(); ?>
36
+
37
+ <fieldset>
38
+
39
+ <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']); ?>"/>
40
+
41
+ </fieldset>
42
+
43
+ <?php
44
+ }
45
+
46
+ /**
47
+ * Application Short Name
48
+ *
49
+ * @since 1.2
50
+ */
51
+ function superpwa_app_short_name_cb() {
52
+
53
+ // Get Settings
54
+ $settings = superpwa_get_settings(); ?>
55
+
56
+ <fieldset>
57
+
58
+ <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']); ?>"/>
59
+
60
+ <p class="description">
61
+ <?php _e('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>', 'super-progressive-web-apps'); ?>
62
+ </p>
63
+
64
+ </fieldset>
65
+
66
+ <?php
67
+ }
68
+
69
+ /**
70
+ * Description
71
+ *
72
+ * @since 1.6
73
+ */
74
+ function superpwa_description_cb() {
75
+
76
+ // Get Settings
77
+ $settings = superpwa_get_settings(); ?>
78
+
79
+ <fieldset>
80
+
81
+ <input type="text" name="superpwa_settings[description]" class="regular-text" value="<?php if ( isset( $settings['description'] ) && ( ! empty( $settings['description'] ) ) ) echo esc_attr( $settings['description'] ); ?>"/>
82
+
83
+ <p class="description">
84
+ <?php _e( 'A brief description of what your app is about.', 'super-progressive-web-apps' ); ?>
85
+ </p>
86
+
87
+ </fieldset>
88
+
89
+ <?php
90
+ }
91
+
92
+ /**
93
+ * Application Icon
94
+ *
95
+ * @since 1.0
96
+ */
97
+ function superpwa_app_icon_cb() {
98
+
99
+ // Get Settings
100
+ $settings = superpwa_get_settings(); ?>
101
+
102
+ <!-- Application Icon -->
103
+ <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']) : ''; ?>">
104
+ <button type="button" class="button superpwa-icon-upload" data-editor="content">
105
+ <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
106
+ </button>
107
+
108
+ <p class="description">
109
+ <?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'); ?>
110
+ </p>
111
+
112
+ <?php
113
+ }
114
+
115
+ /**
116
+ * Splash Screen Icon
117
+ *
118
+ * @since 1.3
119
+ */
120
+ function superpwa_splash_icon_cb() {
121
+
122
+ // Get Settings
123
+ $settings = superpwa_get_settings(); ?>
124
+
125
+ <!-- Splash Screen Icon -->
126
+ <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']) : ''; ?>">
127
+ <button type="button" class="button superpwa-splash-icon-upload" data-editor="content">
128
+ <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> <?php _e( 'Choose Icon', 'super-progressive-web-apps' ); ?>
129
+ </button>
130
+
131
+ <p class="description">
132
+ <?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'); ?>
133
+ </p>
134
+
135
+ <?php
136
+ }
137
+
138
+ /**
139
+ * Splash Screen Background Color
140
+ *
141
+ * @since 1.0
142
+ */
143
+ function superpwa_background_color_cb() {
144
+
145
+ // Get Settings
146
+ $settings = superpwa_get_settings(); ?>
147
+
148
+ <!-- Background Color -->
149
+ <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">
150
+
151
+ <p class="description">
152
+ <?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?>
153
+ </p>
154
+
155
+ <?php
156
+ }
157
+
158
+ /**
159
+ * Theme Color
160
+ *
161
+ * @since 1.4
162
+ */
163
+ function superpwa_theme_color_cb() {
164
+
165
+ // Get Settings
166
+ $settings = superpwa_get_settings(); ?>
167
+
168
+ <!-- Theme Color -->
169
+ <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">
170
+
171
+ <p class="description">
172
+ <?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'); ?>
173
+ </p>
174
+
175
+ <?php
176
+ }
177
+
178
+ /**
179
+ * Start URL Dropdown
180
+ *
181
+ * @since 1.2
182
+ */
183
+ function superpwa_start_url_cb() {
184
+
185
+ // Get Settings
186
+ $settings = superpwa_get_settings(); ?>
187
+
188
+ <fieldset>
189
+
190
+ <!-- WordPress Pages Dropdown -->
191
+ <label for="superpwa_settings[start_url]">
192
+ <?php echo wp_dropdown_pages( array(
193
+ 'name' => 'superpwa_settings[start_url]',
194
+ 'echo' => 0,
195
+ 'show_option_none' => __( '&mdash; Homepage &mdash;' ),
196
+ 'option_none_value' => '0',
197
+ 'selected' => isset($settings['start_url']) ? $settings['start_url'] : '',
198
+ )); ?>
199
+ </label>
200
+
201
+ <p class="description">
202
+ <?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() ); ?>
203
+ </p>
204
+
205
+ <?php if ( superpwa_is_amp() ) { ?>
206
+
207
+ <!-- AMP Page As Start Page -->
208
+ <br><input type="checkbox" name="superpwa_settings[start_url_amp]" id="superpwa_settings[start_url_amp]" value="1"
209
+ <?php if ( isset( $settings['start_url_amp'] ) ) { checked( '1', $settings['start_url_amp'] ); } ?>>
210
+ <label for="superpwa_settings[start_url_amp]"><?php _e('Use AMP version of the start page.', 'super-progressive-web-apps') ?></label>
211
+ <br>
212
+
213
+ <!-- AMP for WordPress 0.6.2 doesn't support homepage, the blog index, and archive pages. -->
214
+ <?php if ( is_plugin_active( 'amp/amp.php' ) ) { ?>
215
+ <p class="description">
216
+ <?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' ); ?>
217
+ </p>
218
+ <?php } ?>
219
+
220
+ <!-- tagDiv AMP 1.2 doesn't enable AMP for pages by default and needs to be enabled manually in settings -->
221
+ <?php if ( is_plugin_active( 'td-amp/td-amp.php' ) && method_exists( 'td_util', 'get_option' ) ) {
222
+
223
+ // Read option value from db
224
+ $td_amp_page_post_type = td_util::get_option( 'tds_amp_post_type_page' );
225
+
226
+ // Show notice if option to enable AMP for pages is disabled.
227
+ if ( empty( $td_amp_page_post_type ) ) { ?>
228
+ <p class="description">
229
+ <?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' ) ); ?>
230
+ </p>
231
+ <?php }
232
+ } ?>
233
+
234
+ <?php } ?>
235
+
236
+ </fieldset>
237
+
238
+ <?php
239
+ }
240
+
241
+ /**
242
+ * Offline Page Dropdown
243
+ *
244
+ * @since 1.1
245
+ */
246
+ function superpwa_offline_page_cb() {
247
+
248
+ // Get Settings
249
+ $settings = superpwa_get_settings(); ?>
250
+
251
+ <!-- WordPress Pages Dropdown -->
252
+ <label for="superpwa_settings[offline_page]">
253
+ <?php echo wp_dropdown_pages( array(
254
+ 'name' => 'superpwa_settings[offline_page]',
255
+ 'echo' => 0,
256
+ 'show_option_none' => __( '&mdash; Default &mdash;' ),
257
+ 'option_none_value' => '0',
258
+ 'selected' => isset($settings['offline_page']) ? $settings['offline_page'] : '',
259
+ )); ?>
260
+ </label>
261
+
262
+ <p class="description">
263
+ <?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() ); ?>
264
+ </p>
265
+
266
+ <?php
267
+ }
268
+
269
+ /**
270
+ * Default Orientation Dropdown
271
+ *
272
+ * @since 1.4
273
+ */
274
+ function superpwa_orientation_cb() {
275
+
276
+ // Get Settings
277
+ $settings = superpwa_get_settings(); ?>
278
+
279
+ <!-- Orientation Dropdown -->
280
+ <label for="superpwa_settings[orientation]">
281
+ <select name="superpwa_settings[orientation]" id="superpwa_settings[orientation]">
282
+ <option value="0" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 0 ); } ?>>
283
+ <?php _e( 'Follow Device Orientation', 'super-progressive-web-apps' ); ?>
284
+ </option>
285
+ <option value="1" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 1 ); } ?>>
286
+ <?php _e( 'Portrait', 'super-progressive-web-apps' ); ?>
287
+ </option>
288
+ <option value="2" <?php if ( isset( $settings['orientation'] ) ) { selected( $settings['orientation'], 2 ); } ?>>
289
+ <?php _e( 'Landscape', 'super-progressive-web-apps' ); ?>
290
+ </option>
291
+ </select>
292
+ </label>
293
+
294
+ <p class="description">
295
+ <?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' ); ?>
296
+ </p>
297
+
298
+ <?php
299
+ }
300
+
301
+ /**
302
+ * Default Display Dropdown
303
+ *
304
+ * @author Jose Varghese
305
+ *
306
+ * @since 2.0
307
+ */
308
+ function superpwa_display_cb() {
309
+
310
+ // Get Settings
311
+ $settings = superpwa_get_settings(); ?>
312
+
313
+ <!-- Display Dropdown -->
314
+ <label for="superpwa_settings[display]">
315
+ <select name="superpwa_settings[display]" id="superpwa_settings[display]">
316
+ <option value="0" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 0 ); } ?>>
317
+ <?php _e( 'Full Screen', 'super-progressive-web-apps' ); ?>
318
+ </option>
319
+ <option value="1" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 1 ); } ?>>
320
+ <?php _e( 'Standalone', 'super-progressive-web-apps' ); ?>
321
+ </option>
322
+ <option value="2" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 2 ); } ?>>
323
+ <?php _e( 'Minimal UI', 'super-progressive-web-apps' ); ?>
324
+ </option>
325
+ <option value="3" <?php if ( isset( $settings['display'] ) ) { selected( $settings['display'], 3 ); } ?>>
326
+ <?php _e( 'Browser', 'super-progressive-web-apps' ); ?>
327
+ </option>
328
+ </select>
329
+ </label>
330
+
331
+ <p class="description">
332
+ <?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' ); ?>
333
+ </p>
334
+
335
+ <?php
336
+ }
337
+
338
+ /**
339
+ * Manifest Status
340
+ *
341
+ * @author Arun Basil Lal
342
+ *
343
+ * @since 1.2
344
+ * @since 1.8 Attempt to generate manifest again if the manifest doesn't exist.
345
+ * @since 2.0 Remove logic to check if manifest exists in favour of dynamic manifest.
346
+ * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
347
+ */
348
+ function superpwa_manifest_status_cb() {
349
+
350
+ /**
351
+ * Check to see if the file exists, If not attempts to generate a new one.
352
+ */
353
+ if ( superpwa_file_exists( superpwa_manifest( 'src' ) ) || superpwa_generate_manifest() ) {
354
+
355
+ 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' ) );
356
+ } else {
357
+
358
+ 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' );
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Service Worker Status
364
+ *
365
+ * @author Arun Basil Lal
366
+ *
367
+ * @since 1.2
368
+ * @since 1.8 Attempt to generate service worker again if it doesn't exist.
369
+ * @since 2.0 Modify logic to check if Service worker exists.
370
+ * @since 2.0.1 Added checks to see if dynamic file is valid. If not, generates a physical file.
371
+ */
372
+ function superpwa_sw_status_cb() {
373
+
374
+ /**
375
+ * Check to see if the file exists, If not attempts to generate a new one.
376
+ */
377
+ if ( superpwa_file_exists( superpwa_sw( 'src' ) ) || superpwa_generate_sw() ) {
378
+
379
+ 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' ) );
380
+ } else {
381
+
382
+ 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' );
383
+ }
384
+ }
385
+
386
+ /**
387
+ * HTTPS Status
388
+ *
389
+ * @since 1.2
390
+ */
391
+ function superpwa_https_status_cb() {
392
+
393
+ if ( is_ssl() ) {
394
+
395
+ printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Your website is served over HTTPS.', 'super-progressive-web-apps' ) . '</p>' );
396
+ } else {
397
+
398
+ 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>' );
399
+ }
400
+ }
401
+
402
+ /**
403
+ * Admin interface renderer
404
+ *
405
+ * @since 1.0
406
+ * @since 1.7 Handling of settings saved messages since UI is its own menu item in the admin menu.
407
+ */
408
+ function superpwa_admin_interface_render() {
409
+
410
+ // Authentication
411
+ if ( ! current_user_can( 'manage_options' ) ) {
412
+ return;
413
+ }
414
+
415
+ // Handing save settings
416
+ if ( isset( $_GET['settings-updated'] ) ) {
417
+
418
+ // Add settings saved message with the class of "updated"
419
+ add_settings_error( 'superpwa_settings_group', 'superpwa_settings_saved_message', __( 'Settings saved.', 'super-progressive-web-apps' ), 'updated' );
420
+
421
+ // Show Settings Saved Message
422
+ settings_errors( 'superpwa_settings_group' );
423
+ }
424
+
425
+ ?>
426
+
427
+ <div class="wrap">
428
+ <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
429
+
430
+ <form action="options.php" method="post" enctype="multipart/form-data">
431
+ <?php
432
+ // Output nonce, action, and option_page fields for a settings page.
433
+ settings_fields( 'superpwa_settings_group' );
434
+
435
+ // Basic Application Settings
436
+ do_settings_sections( 'superpwa_basic_settings_section' ); // Page slug
437
+
438
+ // Status
439
+ do_settings_sections( 'superpwa_pwa_status_section' ); // Page slug
440
+
441
+ // Output save settings button
442
+ echo '<style>.submit{float:left;}</style>';
443
+ submit_button( __('Save Settings', 'super-progressive-web-apps') );
444
+ if(!defined('SUPERPWA_PRO_VERSION')){
445
+ 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>';
446
+ }
447
+ ?>
448
+ </form>
449
+ </div>
450
+ <?php
451
+ }
admin/admin-ui-render-upgrade.php ADDED
@@ -0,0 +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 that 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, we’ll 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
+ }
admin/admin-ui-setup.php CHANGED
@@ -1,372 +1,383 @@
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' );
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' );
35
- }
36
- add_action( 'admin_menu', 'superpwa_add_menu_links' );
37
-
38
- /**
39
- * Register Settings
40
- *
41
- * @since 1.0
42
- */
43
- function superpwa_register_settings() {
44
-
45
- // Register Setting
46
- register_setting(
47
- 'superpwa_settings_group', // Group name
48
- 'superpwa_settings', // Setting name = html form <input> name on settings form
49
- 'superpwa_validater_and_sanitizer' // Input sanitizer
50
- );
51
-
52
- // Basic Application Settings
53
- add_settings_section(
54
- 'superpwa_basic_settings_section', // ID
55
- __return_false(), // Title
56
- '__return_false', // Callback Function
57
- 'superpwa_basic_settings_section' // Page slug
58
- );
59
-
60
- // Application Name
61
- add_settings_field(
62
- 'superpwa_app_name', // ID
63
- __('Application Name', 'super-progressive-web-apps'), // Title
64
- 'superpwa_app_name_cb', // CB
65
- 'superpwa_basic_settings_section', // Page slug
66
- 'superpwa_basic_settings_section' // Settings Section ID
67
- );
68
-
69
- // Application Short Name
70
- add_settings_field(
71
- 'superpwa_app_short_name', // ID
72
- __('Application Short Name', 'super-progressive-web-apps'), // Title
73
- 'superpwa_app_short_name_cb', // CB
74
- 'superpwa_basic_settings_section', // Page slug
75
- 'superpwa_basic_settings_section' // Settings Section ID
76
- );
77
-
78
- // Description
79
- add_settings_field(
80
- 'superpwa_description', // ID
81
- __( 'Description', 'super-progressive-web-apps' ), // Title
82
- 'superpwa_description_cb', // CB
83
- 'superpwa_basic_settings_section', // Page slug
84
- 'superpwa_basic_settings_section' // Settings Section ID
85
- );
86
-
87
- // Application Icon
88
- add_settings_field(
89
- 'superpwa_icons', // ID
90
- __('Application Icon', 'super-progressive-web-apps'), // Title
91
- 'superpwa_app_icon_cb', // Callback function
92
- 'superpwa_basic_settings_section', // Page slug
93
- 'superpwa_basic_settings_section' // Settings Section ID
94
- );
95
-
96
- // Splash Screen Icon
97
- add_settings_field(
98
- 'superpwa_splash_icon', // ID
99
- __('Splash Screen Icon', 'super-progressive-web-apps'), // Title
100
- 'superpwa_splash_icon_cb', // Callback function
101
- 'superpwa_basic_settings_section', // Page slug
102
- 'superpwa_basic_settings_section' // Settings Section ID
103
- );
104
-
105
- // Splash Screen Background Color
106
- add_settings_field(
107
- 'superpwa_background_color', // ID
108
- __('Background Color', 'super-progressive-web-apps'), // Title
109
- 'superpwa_background_color_cb', // CB
110
- 'superpwa_basic_settings_section', // Page slug
111
- 'superpwa_basic_settings_section' // Settings Section ID
112
- );
113
-
114
- // Theme Color
115
- add_settings_field(
116
- 'superpwa_theme_color', // ID
117
- __('Theme Color', 'super-progressive-web-apps'), // Title
118
- 'superpwa_theme_color_cb', // CB
119
- 'superpwa_basic_settings_section', // Page slug
120
- 'superpwa_basic_settings_section' // Settings Section ID
121
- );
122
-
123
- // Start URL
124
- add_settings_field(
125
- 'superpwa_start_url', // ID
126
- __('Start Page', 'super-progressive-web-apps'), // Title
127
- 'superpwa_start_url_cb', // CB
128
- 'superpwa_basic_settings_section', // Page slug
129
- 'superpwa_basic_settings_section' // Settings Section ID
130
- );
131
-
132
- // Offline Page
133
- add_settings_field(
134
- 'superpwa_offline_page', // ID
135
- __('Offline Page', 'super-progressive-web-apps'), // Title
136
- 'superpwa_offline_page_cb', // CB
137
- 'superpwa_basic_settings_section', // Page slug
138
- 'superpwa_basic_settings_section' // Settings Section ID
139
- );
140
-
141
- // Orientation
142
- add_settings_field(
143
- 'superpwa_orientation', // ID
144
- __('Orientation', 'super-progressive-web-apps'), // Title
145
- 'superpwa_orientation_cb', // CB
146
- 'superpwa_basic_settings_section', // Page slug
147
- 'superpwa_basic_settings_section' // Settings Section ID
148
- );
149
-
150
- // Display
151
- add_settings_field(
152
- 'superpwa_display', // ID
153
- __('Display', 'super-progressive-web-apps'), // Title
154
- 'superpwa_display_cb', // CB
155
- 'superpwa_basic_settings_section', // Page slug
156
- 'superpwa_basic_settings_section' // Settings Section ID
157
- );
158
-
159
- // PWA Status
160
- add_settings_section(
161
- 'superpwa_pwa_status_section', // ID
162
- __('Status', 'super-progressive-web-apps'), // Title
163
- '__return_false', // Callback Function
164
- 'superpwa_pwa_status_section' // Page slug
165
- );
166
-
167
- // Manifest status
168
- add_settings_field(
169
- 'superpwa_manifest_status', // ID
170
- __('Manifest', 'super-progressive-web-apps'), // Title
171
- 'superpwa_manifest_status_cb', // CB
172
- 'superpwa_pwa_status_section', // Page slug
173
- 'superpwa_pwa_status_section' // Settings Section ID
174
- );
175
-
176
- // Service Worker status
177
- add_settings_field(
178
- 'superpwa_sw_status', // ID
179
- __('Service Worker', 'super-progressive-web-apps'), // Title
180
- 'superpwa_sw_status_cb', // CB
181
- 'superpwa_pwa_status_section', // Page slug
182
- 'superpwa_pwa_status_section' // Settings Section ID
183
- );
184
-
185
- // HTTPS status
186
- add_settings_field(
187
- 'superpwa_https_status', // ID
188
- __('HTTPS', 'super-progressive-web-apps'), // Title
189
- 'superpwa_https_status_cb', // CB
190
- 'superpwa_pwa_status_section', // Page slug
191
- 'superpwa_pwa_status_section' // Settings Section ID
192
- );
193
- }
194
- add_action( 'admin_init', 'superpwa_register_settings' );
195
-
196
- /**
197
- * Validate and sanitize user input before its saved to database
198
- *
199
- * @author Arun Basil Lal
200
- *
201
- * @param (array) $settings Values passed from the Settings API from SuperPWA > Settings
202
- *
203
- * @since 1.0
204
- * @since 1.3 Added splash_icon
205
- * @since 1.6 Added description
206
- * @since 2.0 Limit app_short_name to 12 characters
207
- * @since 2.0.1 Added is_static_sw and is_static_manifest
208
- */
209
- function superpwa_validater_and_sanitizer( $settings ) {
210
-
211
- // Sanitize Application Name
212
- $settings['app_name'] = sanitize_text_field( $settings['app_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_name'] );
213
-
214
- // Sanitize Application Short Name
215
- $settings['app_short_name'] = substr( sanitize_text_field( $settings['app_short_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_short_name'] ), 0, 12 );
216
-
217
- // Sanitize description
218
- $settings['description'] = sanitize_text_field( $settings['description'] );
219
-
220
- // Sanitize hex color input for background_color
221
- $settings['background_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['background_color'] ) ? sanitize_text_field( $settings['background_color'] ) : '#D5E0EB';
222
-
223
- // Sanitize hex color input for theme_color
224
- $settings['theme_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['theme_color'] ) ? sanitize_text_field( $settings['theme_color'] ) : '#D5E0EB';
225
-
226
- // Sanitize application icon
227
- $settings['icon'] = sanitize_text_field( $settings['icon'] ) == '' ? superpwa_httpsify( SUPERPWA_PATH_SRC . 'public/images/logo.png' ) : sanitize_text_field( superpwa_httpsify( $settings['icon'] ) );
228
-
229
- // Sanitize splash screen icon
230
- $settings['splash_icon'] = sanitize_text_field( superpwa_httpsify( $settings['splash_icon'] ) );
231
-
232
- /**
233
- * Get current settings already saved in the database.
234
- *
235
- * When the SuperPWA > Settings page is saved, the form does not have the values for
236
- * is_static_sw or is_static_manifest. So this is added here to match the already saved
237
- * values in the database.
238
- */
239
- $current_settings = superpwa_get_settings();
240
-
241
- if ( ! isset( $settings['is_static_sw'] ) ) {
242
- $settings['is_static_sw'] = $current_settings['is_static_sw'];
243
- }
244
-
245
- if ( ! isset( $settings['is_static_manifest'] ) ) {
246
- $settings['is_static_manifest'] = $current_settings['is_static_manifest'];
247
- }
248
-
249
- return $settings;
250
- }
251
-
252
- /**
253
- * Get settings from database
254
- *
255
- * @return (Array) A merged array of default and settings saved in database.
256
- *
257
- * @author Arun Basil Lal
258
- *
259
- * @since 1.0
260
- * @since 2.0 Added display
261
- * @since 2.0.1 Added is_static_manifest. 1 for static files, 0 for dynamic files.
262
- * @since 2.0.1 Added is_static_sw. 1 for static files, 0 for dynamic files.
263
- */
264
- function superpwa_get_settings() {
265
-
266
- $defaults = array(
267
- 'app_name' => get_bloginfo( 'name' ),
268
- 'app_short_name' => substr( get_bloginfo( 'name' ), 0, 12 ),
269
- 'description' => get_bloginfo( 'description' ),
270
- 'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
271
- 'splash_icon' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
272
- 'background_color' => '#D5E0EB',
273
- 'theme_color' => '#D5E0EB',
274
- 'start_url' => 0,
275
- 'start_url_amp' => 0,
276
- 'offline_page' => 0,
277
- 'orientation' => 1,
278
- 'display' => 1,
279
- 'is_static_manifest'=> 0,
280
- 'is_static_sw' => 0,
281
- );
282
-
283
- $settings = get_option( 'superpwa_settings', $defaults );
284
-
285
- return $settings;
286
- }
287
-
288
- /**
289
- * Todo list after saving admin options
290
- *
291
- * Regenerate manifest
292
- * Regenerate service worker
293
- *
294
- * @author Arun Basil Lal
295
- *
296
- * @since 1.0
297
- */
298
- function superpwa_after_save_settings_todo() {
299
-
300
- // Regenerate manifest
301
- superpwa_generate_manifest();
302
-
303
- // Regenerate service worker
304
- superpwa_generate_sw();
305
- }
306
- add_action( 'add_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
307
- add_action( 'update_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
308
-
309
- /**
310
- * Enqueue CSS and JS
311
- *
312
- * @since 1.0
313
- */
314
- function superpwa_enqueue_css_js( $hook ) {
315
-
316
- // Load only on SuperPWA plugin pages
317
- if ( strpos( $hook, 'superpwa' ) === false ) {
318
- return;
319
- }
320
-
321
- // Color picker CSS
322
- // @refer https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
323
- wp_enqueue_style( 'wp-color-picker' );
324
-
325
- // Everything needed for media upload
326
- wp_enqueue_media();
327
-
328
- // Main JS
329
- wp_enqueue_script( 'superpwa-main-js', SUPERPWA_PATH_SRC . 'admin/js/main.js', array( 'wp-color-picker' ), SUPERPWA_VERSION, true );
330
- }
331
- add_action( 'admin_enqueue_scripts', 'superpwa_enqueue_css_js' );
332
-
333
- /**
334
- * Admin footer text
335
- *
336
- * A function to add footer text to the settings page of the plugin.
337
- * @since 1.2
338
- * @refer https://codex.wordpress.org/Function_Reference/get_current_screen
339
- */
340
- function superpwa_footer_text( $default ) {
341
-
342
- // Retun default on non-plugin pages
343
- $screen = get_current_screen();
344
- if ( strpos( $screen->id, 'superpwa' ) === false ) {
345
- return $default;
346
- }
347
-
348
- $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' ),
349
- 'https://millionclues.com/donate/',
350
- 'https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?rate=5#new-post'
351
- );
352
-
353
- return $superpwa_footer_text;
354
- }
355
- add_filter( 'admin_footer_text', 'superpwa_footer_text' );
356
-
357
- /**
358
- * Admin footer version
359
- *
360
- * @since 1.0
361
- */
362
- function superpwa_footer_version( $default ) {
363
-
364
- // Retun default on non-plugin pages
365
- $screen = get_current_screen();
366
- if ( strpos( $screen->id, 'superpwa' ) === false ) {
367
- return $default;
368
- }
369
-
370
- return 'SuperPWA ' . SUPERPWA_VERSION;
371
- }
 
 
 
 
 
 
 
 
 
 
 
372
  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
+ // Upgrade to pro page
42
+ $textlicense = __( 'Upgrade to Pro', 'super-progressive-web-apps' );
43
+ if(defined('SUPERPWA_PRO_VERSION')){ $textlicense = __( 'License', 'super-progressive-web-apps' ); }
44
+ add_submenu_page( 'superpwa', __( 'Super Progressive Web Apps', 'super-progressive-web-apps' ), $textlicense, 'manage_options', 'superpwa-upgrade', 'superpwa_upgread_pro_interface_render' , 9999999);
45
+
46
+ }
47
+ add_action( 'admin_menu', 'superpwa_add_menu_links' );
48
+
49
+ /**
50
+ * Register Settings
51
+ *
52
+ * @since 1.0
53
+ */
54
+ function superpwa_register_settings() {
55
+
56
+ // Register Setting
57
+ register_setting(
58
+ 'superpwa_settings_group', // Group name
59
+ 'superpwa_settings', // Setting name = html form <input> name on settings form
60
+ 'superpwa_validater_and_sanitizer' // Input sanitizer
61
+ );
62
+
63
+ // Basic Application Settings
64
+ add_settings_section(
65
+ 'superpwa_basic_settings_section', // ID
66
+ __return_false(), // Title
67
+ '__return_false', // Callback Function
68
+ 'superpwa_basic_settings_section' // Page slug
69
+ );
70
+
71
+ // Application Name
72
+ add_settings_field(
73
+ 'superpwa_app_name', // ID
74
+ __('Application Name', 'super-progressive-web-apps'), // Title
75
+ 'superpwa_app_name_cb', // CB
76
+ 'superpwa_basic_settings_section', // Page slug
77
+ 'superpwa_basic_settings_section' // Settings Section ID
78
+ );
79
+
80
+ // Application Short Name
81
+ add_settings_field(
82
+ 'superpwa_app_short_name', // ID
83
+ __('Application Short Name', 'super-progressive-web-apps'), // Title
84
+ 'superpwa_app_short_name_cb', // CB
85
+ 'superpwa_basic_settings_section', // Page slug
86
+ 'superpwa_basic_settings_section' // Settings Section ID
87
+ );
88
+
89
+ // Description
90
+ add_settings_field(
91
+ 'superpwa_description', // ID
92
+ __( 'Description', 'super-progressive-web-apps' ), // Title
93
+ 'superpwa_description_cb', // CB
94
+ 'superpwa_basic_settings_section', // Page slug
95
+ 'superpwa_basic_settings_section' // Settings Section ID
96
+ );
97
+
98
+ // Application Icon
99
+ add_settings_field(
100
+ 'superpwa_icons', // ID
101
+ __('Application Icon', 'super-progressive-web-apps'), // Title
102
+ 'superpwa_app_icon_cb', // Callback function
103
+ 'superpwa_basic_settings_section', // Page slug
104
+ 'superpwa_basic_settings_section' // Settings Section ID
105
+ );
106
+
107
+ // Splash Screen Icon
108
+ add_settings_field(
109
+ 'superpwa_splash_icon', // ID
110
+ __('Splash Screen Icon', 'super-progressive-web-apps'), // Title
111
+ 'superpwa_splash_icon_cb', // Callback function
112
+ 'superpwa_basic_settings_section', // Page slug
113
+ 'superpwa_basic_settings_section' // Settings Section ID
114
+ );
115
+
116
+ // Splash Screen Background Color
117
+ add_settings_field(
118
+ 'superpwa_background_color', // ID
119
+ __('Background Color', 'super-progressive-web-apps'), // Title
120
+ 'superpwa_background_color_cb', // CB
121
+ 'superpwa_basic_settings_section', // Page slug
122
+ 'superpwa_basic_settings_section' // Settings Section ID
123
+ );
124
+
125
+ // Theme Color
126
+ add_settings_field(
127
+ 'superpwa_theme_color', // ID
128
+ __('Theme Color', 'super-progressive-web-apps'), // Title
129
+ 'superpwa_theme_color_cb', // CB
130
+ 'superpwa_basic_settings_section', // Page slug
131
+ 'superpwa_basic_settings_section' // Settings Section ID
132
+ );
133
+
134
+ // Start URL
135
+ add_settings_field(
136
+ 'superpwa_start_url', // ID
137
+ __('Start Page', 'super-progressive-web-apps'), // Title
138
+ 'superpwa_start_url_cb', // CB
139
+ 'superpwa_basic_settings_section', // Page slug
140
+ 'superpwa_basic_settings_section' // Settings Section ID
141
+ );
142
+
143
+ // Offline Page
144
+ add_settings_field(
145
+ 'superpwa_offline_page', // ID
146
+ __('Offline Page', 'super-progressive-web-apps'), // Title
147
+ 'superpwa_offline_page_cb', // CB
148
+ 'superpwa_basic_settings_section', // Page slug
149
+ 'superpwa_basic_settings_section' // Settings Section ID
150
+ );
151
+
152
+ // Orientation
153
+ add_settings_field(
154
+ 'superpwa_orientation', // ID
155
+ __('Orientation', 'super-progressive-web-apps'), // Title
156
+ 'superpwa_orientation_cb', // CB
157
+ 'superpwa_basic_settings_section', // Page slug
158
+ 'superpwa_basic_settings_section' // Settings Section ID
159
+ );
160
+
161
+ // Display
162
+ add_settings_field(
163
+ 'superpwa_display', // ID
164
+ __('Display', 'super-progressive-web-apps'), // Title
165
+ 'superpwa_display_cb', // CB
166
+ 'superpwa_basic_settings_section', // Page slug
167
+ 'superpwa_basic_settings_section' // Settings Section ID
168
+ );
169
+
170
+ // PWA Status
171
+ add_settings_section(
172
+ 'superpwa_pwa_status_section', // ID
173
+ __('Status', 'super-progressive-web-apps'), // Title
174
+ '__return_false', // Callback Function
175
+ 'superpwa_pwa_status_section' // Page slug
176
+ );
177
+
178
+ // Manifest status
179
+ add_settings_field(
180
+ 'superpwa_manifest_status', // ID
181
+ __('Manifest', 'super-progressive-web-apps'), // Title
182
+ 'superpwa_manifest_status_cb', // CB
183
+ 'superpwa_pwa_status_section', // Page slug
184
+ 'superpwa_pwa_status_section' // Settings Section ID
185
+ );
186
+
187
+ // Service Worker status
188
+ add_settings_field(
189
+ 'superpwa_sw_status', // ID
190
+ __('Service Worker', 'super-progressive-web-apps'), // Title
191
+ 'superpwa_sw_status_cb', // CB
192
+ 'superpwa_pwa_status_section', // Page slug
193
+ 'superpwa_pwa_status_section' // Settings Section ID
194
+ );
195
+
196
+ // HTTPS status
197
+ add_settings_field(
198
+ 'superpwa_https_status', // ID
199
+ __('HTTPS', 'super-progressive-web-apps'), // Title
200
+ 'superpwa_https_status_cb', // CB
201
+ 'superpwa_pwa_status_section', // Page slug
202
+ 'superpwa_pwa_status_section' // Settings Section ID
203
+ );
204
+ }
205
+ add_action( 'admin_init', 'superpwa_register_settings' );
206
+
207
+ /**
208
+ * Validate and sanitize user input before its saved to database
209
+ *
210
+ * @author Arun Basil Lal
211
+ *
212
+ * @param (array) $settings Values passed from the Settings API from SuperPWA > Settings
213
+ *
214
+ * @since 1.0
215
+ * @since 1.3 Added splash_icon
216
+ * @since 1.6 Added description
217
+ * @since 2.0 Limit app_short_name to 12 characters
218
+ * @since 2.0.1 Added is_static_sw and is_static_manifest
219
+ */
220
+ function superpwa_validater_and_sanitizer( $settings ) {
221
+
222
+ // Sanitize Application Name
223
+ $settings['app_name'] = sanitize_text_field( $settings['app_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_name'] );
224
+
225
+ // Sanitize Application Short Name
226
+ $settings['app_short_name'] = substr( sanitize_text_field( $settings['app_short_name'] ) == '' ? get_bloginfo( 'name' ) : sanitize_text_field( $settings['app_short_name'] ), 0, 12 );
227
+
228
+ // Sanitize description
229
+ $settings['description'] = sanitize_text_field( $settings['description'] );
230
+
231
+ // Sanitize hex color input for background_color
232
+ $settings['background_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['background_color'] ) ? sanitize_text_field( $settings['background_color'] ) : '#D5E0EB';
233
+
234
+ // Sanitize hex color input for theme_color
235
+ $settings['theme_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['theme_color'] ) ? sanitize_text_field( $settings['theme_color'] ) : '#D5E0EB';
236
+
237
+ // Sanitize application icon
238
+ $settings['icon'] = sanitize_text_field( $settings['icon'] ) == '' ? superpwa_httpsify( SUPERPWA_PATH_SRC . 'public/images/logo.png' ) : sanitize_text_field( superpwa_httpsify( $settings['icon'] ) );
239
+
240
+ // Sanitize splash screen icon
241
+ $settings['splash_icon'] = sanitize_text_field( superpwa_httpsify( $settings['splash_icon'] ) );
242
+
243
+ /**
244
+ * Get current settings already saved in the database.
245
+ *
246
+ * When the SuperPWA > Settings page is saved, the form does not have the values for
247
+ * is_static_sw or is_static_manifest. So this is added here to match the already saved
248
+ * values in the database.
249
+ */
250
+ $current_settings = superpwa_get_settings();
251
+
252
+ if ( ! isset( $settings['is_static_sw'] ) ) {
253
+ $settings['is_static_sw'] = $current_settings['is_static_sw'];
254
+ }
255
+
256
+ if ( ! isset( $settings['is_static_manifest'] ) ) {
257
+ $settings['is_static_manifest'] = $current_settings['is_static_manifest'];
258
+ }
259
+
260
+ return $settings;
261
+ }
262
+
263
+ /**
264
+ * Get settings from database
265
+ *
266
+ * @return (Array) A merged array of default and settings saved in database.
267
+ *
268
+ * @author Arun Basil Lal
269
+ *
270
+ * @since 1.0
271
+ * @since 2.0 Added display
272
+ * @since 2.0.1 Added is_static_manifest. 1 for static files, 0 for dynamic files.
273
+ * @since 2.0.1 Added is_static_sw. 1 for static files, 0 for dynamic files.
274
+ */
275
+ function superpwa_get_settings() {
276
+
277
+ $defaults = array(
278
+ 'app_name' => get_bloginfo( 'name' ),
279
+ 'app_short_name' => substr( get_bloginfo( 'name' ), 0, 12 ),
280
+ 'description' => get_bloginfo( 'description' ),
281
+ 'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
282
+ 'splash_icon' => SUPERPWA_PATH_SRC . 'public/images/logo-512x512.png',
283
+ 'background_color' => '#D5E0EB',
284
+ 'theme_color' => '#D5E0EB',
285
+ 'start_url' => 0,
286
+ 'start_url_amp' => 0,
287
+ 'offline_page' => 0,
288
+ 'orientation' => 1,
289
+ 'display' => 1,
290
+ 'is_static_manifest'=> 0,
291
+ 'is_static_sw' => 0,
292
+ );
293
+
294
+ $settings = get_option( 'superpwa_settings', $defaults );
295
+
296
+ return $settings;
297
+ }
298
+
299
+ /**
300
+ * Todo list after saving admin options
301
+ *
302
+ * Regenerate manifest
303
+ * Regenerate service worker
304
+ *
305
+ * @author Arun Basil Lal
306
+ *
307
+ * @since 1.0
308
+ */
309
+ function superpwa_after_save_settings_todo() {
310
+
311
+ // Regenerate manifest
312
+ superpwa_generate_manifest();
313
+
314
+ // Regenerate service worker
315
+ superpwa_generate_sw();
316
+ }
317
+ add_action( 'add_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
318
+ add_action( 'update_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
319
+
320
+ /**
321
+ * Enqueue CSS and JS
322
+ *
323
+ * @since 1.0
324
+ */
325
+ function superpwa_enqueue_css_js( $hook ) {
326
+
327
+ // Load only on SuperPWA plugin pages
328
+ if ( strpos( $hook, 'superpwa' ) === false ) {
329
+ return;
330
+ }
331
+
332
+ // Color picker CSS
333
+ // @refer https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
334
+ wp_enqueue_style( 'wp-color-picker' );
335
+
336
+ // Everything needed for media upload
337
+ wp_enqueue_media();
338
+
339
+ // Main JS
340
+ wp_enqueue_script( 'superpwa-main-js', SUPERPWA_PATH_SRC . 'admin/js/main.js', array( 'wp-color-picker' ), SUPERPWA_VERSION, true );
341
+ }
342
+ add_action( 'admin_enqueue_scripts', 'superpwa_enqueue_css_js' );
343
+
344
+ /**
345
+ * Admin footer text
346
+ *
347
+ * A function to add footer text to the settings page of the plugin.
348
+ * @since 1.2
349
+ * @refer https://codex.wordpress.org/Function_Reference/get_current_screen
350
+ */
351
+ function superpwa_footer_text( $default ) {
352
+
353
+ // Retun default on non-plugin pages
354
+ $screen = get_current_screen();
355
+ if ( strpos( $screen->id, 'superpwa' ) === false ) {
356
+ return $default;
357
+ }
358
+
359
+ $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' ),
360
+ 'https://millionclues.com/donate/',
361
+ 'https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?rate=5#new-post'
362
+ );
363
+
364
+ return $superpwa_footer_text;
365
+ }
366
+ add_filter( 'admin_footer_text', 'superpwa_footer_text' );
367
+
368
+ /**
369
+ * Admin footer version
370
+ *
371
+ * @since 1.0
372
+ */
373
+ function superpwa_footer_version( $default ) {
374
+
375
+ // Retun default on non-plugin pages
376
+ $screen = get_current_screen();
377
+ if ( strpos( $screen->id, 'superpwa' ) === false ) {
378
+ return $default;
379
+ }
380
+
381
+ return 'SuperPWA ' . SUPERPWA_VERSION;
382
+ }
383
  add_filter( 'update_footer', 'superpwa_footer_version', 11 );
admin/basic-setup.php CHANGED
@@ -1,460 +1,461 @@
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
- // Not network active i.e. plugin is activated on a single install (normal WordPress install) or a single site on a multisite network
41
- if ( ! $network_active ) {
42
-
43
- // Set transient for single site activation notice
44
- set_transient( 'superpwa_admin_notice_activation', true, 60 );
45
-
46
- return;
47
- }
48
-
49
- // If we are here, then plugin is network activated on a multisite. Set transient for activation notice on network admin.
50
- set_transient( 'superpwa_network_admin_notice_activation', true, 60 );
51
- }
52
- register_activation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_activate_plugin' );
53
-
54
- /**
55
- * Redirect to SuperPWA UI on plugin activation.
56
- *
57
- * Will redirect to SuperPWA settings page when plugin is activated.
58
- * Will not redirect if multiple plugins are activated at the same time.
59
- * Will not redirect when activated network wide on multisite. Network admins know their way.
60
- *
61
- * @param (string) $plugin Path to the main plugin file from plugins directory.
62
- * @param (bool) $network_wide True when network activated on multisites. False otherwise.
63
- *
64
- * @author Arun Basil Lal
65
- *
66
- * @since 2.0
67
- * @since 2.1 Added a check to see if WP_Plugins_List_Table class is available.
68
- */
69
- function superpwa_activation_redirect( $plugin, $network_wide ) {
70
-
71
- // Return if not SuperPWA or if plugin is activated network wide.
72
- if ( $plugin !== plugin_basename( SUPERPWA_PLUGIN_FILE ) || $network_wide === true ) {
73
- return false;
74
- }
75
-
76
- if ( ! class_exists( 'WP_Plugins_List_Table' ) ) {
77
- return false;
78
- }
79
-
80
- /**
81
- * An instance of the WP_Plugins_List_Table class.
82
- *
83
- * @link https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-admin/plugins.php#L15
84
- */
85
- $wp_list_table_instance = new WP_Plugins_List_Table();
86
- $current_action = $wp_list_table_instance->current_action();
87
-
88
- // When only one plugin is activated, the current_action() method will return activate.
89
- if ( $current_action !== 'activate' ) {
90
- return false;
91
- }
92
-
93
- // Redirect to SuperPWA settings page.
94
- exit( wp_redirect( admin_url( 'admin.php?page=superpwa' ) ) );
95
- }
96
- add_action( 'activated_plugin', 'superpwa_activation_redirect', PHP_INT_MAX, 2 );
97
-
98
- /**
99
- * Admin Notices
100
- *
101
- * @since 1.2 Admin notice on plugin activation
102
- */
103
- function superpwa_admin_notices() {
104
-
105
- // Notices only for admins
106
- if ( ! current_user_can( 'manage_options' ) ) {
107
- return;
108
- }
109
-
110
- // Admin notice on plugin activation
111
- if ( get_transient( 'superpwa_admin_notice_activation' ) ) {
112
-
113
- $superpwa_is_ready = superpwa_is_pwa_ready() ? __( 'Your app is ready with the default settings. ', 'super-progressive-web-apps' ) : '';
114
-
115
- // Do not display link to settings UI if we are already in the UI.
116
- $screen = get_current_screen();
117
- $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' ) ) : '';
118
-
119
- 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>';
120
-
121
- // Delete transient
122
- delete_transient( 'superpwa_admin_notice_activation' );
123
- }
124
-
125
- // Admin notice on plugin upgrade
126
- if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
127
-
128
- 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>';
129
-
130
- // Delete transient
131
- delete_transient( 'superpwa_admin_notice_upgrade_complete' );
132
- }
133
- }
134
- add_action( 'admin_notices', 'superpwa_admin_notices' );
135
-
136
- /**
137
- * Network Admin notices
138
- *
139
- * @since 1.6 Admin notice on multisite network activation
140
- */
141
- function superpwa_network_admin_notices() {
142
-
143
- // Notices only for admins
144
- if ( ! current_user_can( 'manage_options' ) ) {
145
- return;
146
- }
147
-
148
- // Network admin notice on multisite network activation
149
- if ( get_transient( 'superpwa_network_admin_notice_activation' ) ) {
150
-
151
- $superpwa_is_ready = superpwa_is_pwa_ready() ? 'Your app is ready on the main website with the default settings. ' : '';
152
-
153
- 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>';
154
-
155
- // Delete transient
156
- delete_transient( 'superpwa_network_admin_notice_activation' );
157
- }
158
-
159
- // Network admin notice on plugin upgrade
160
- if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
161
-
162
- 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>';
163
-
164
- // Delete transient
165
- delete_transient( 'superpwa_admin_notice_upgrade_complete' );
166
- }
167
- }
168
- add_action( 'network_admin_notices', 'superpwa_network_admin_notices' );
169
-
170
- /**
171
- * Plugin upgrade todo list
172
- *
173
- * @since 1.3.1
174
- * @since 1.4 Added orientation setting and theme_color to database when upgrading from pre 1.4 versions.
175
- * @since 1.6 Added multisite compatibility.
176
- */
177
- function superpwa_upgrader() {
178
-
179
- $current_ver = get_option( 'superpwa_version' );
180
-
181
- // Return if we have already done this todo
182
- if ( version_compare( $current_ver, SUPERPWA_VERSION, '==' ) ) {
183
- return;
184
- }
185
-
186
- /**
187
- * Todo list for fresh install.
188
- *
189
- * On a multisite, during network activation, the activation hook (and activation todo) is not fired.
190
- * Manifest and service worker is generated the first time the wp-admin is loaded (when admin_init is fired).
191
- */
192
- if ( $current_ver === false ) {
193
-
194
- // Generate manifest
195
- superpwa_generate_manifest();
196
-
197
- // Generate service worker
198
- superpwa_generate_sw();
199
-
200
- if ( is_multisite() ) {
201
-
202
- // For multisites, save the activation status of current blog.
203
- superpwa_multisite_activation_status( true );
204
- }
205
-
206
- // Save SuperPWA version to database.
207
- add_option( 'superpwa_version', SUPERPWA_VERSION );
208
-
209
- return;
210
- }
211
-
212
- /**
213
- * Add orientation and theme_color to database when upgrading from pre 1.4 versions.
214
- *
215
- * Until 1.4, there was no UI for orientation and theme_color.
216
- * In the manifest, orientation was hard coded as 'natural'.
217
- * background_color had UI and this value was used for both background_color and theme_color in the manifest.
218
- *
219
- * @since 1.4
220
- */
221
- if ( version_compare( $current_ver, '1.3.1', '<=' ) ) {
222
-
223
- // Get settings
224
- $settings = superpwa_get_settings();
225
-
226
- // Orientation was set as 'natural' until version 1.4. Set it as 1, which is 'portrait'.
227
- $settings['orientation'] = 1;
228
-
229
- // theme_color was same as background_color until version 1.4
230
- $settings['theme_color'] = $settings['background_color'];
231
-
232
- // Write settings back to database
233
- update_option( 'superpwa_settings', $settings );
234
- }
235
-
236
- /**
237
- * Delete existing service worker for single sites that use OneSignal.
238
- *
239
- * For OneSignal compatibility, in version 1.8 the service worker filename is renamed.
240
- * If OneSignal is active, by this point, the new filename will be filtered in.
241
- * This upgrade routine restores the defaul service worker filename and deletes the existing service worker.
242
- * Also adds back the filter for new filename. OneSignal compatibility for multisites is not available at this point.
243
- *
244
- * @since 1.8
245
- */
246
- if ( version_compare( $current_ver, '1.7.1', '<=' ) && class_exists( 'OneSignal' ) && ! is_multisite() ) {
247
-
248
- // Restore the default service worker filename of SuperPWA.
249
- remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
250
-
251
- // Delete service worker
252
- superpwa_delete_sw();
253
-
254
- // Change service worker filename to match OneSignal's service worker.
255
- add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
256
- }
257
-
258
- /**
259
- * Add display to database when upgrading from pre 2.0 versions.
260
- * Delete manifest and service worker files.
261
- *
262
- * Until 2.0, there was no UI for display.
263
- * In the manifest, display was hard coded as 'standalone'.
264
- *
265
- * Starting with 2.0, manifest and service worker files are dynamic and no longer static.
266
- *
267
- * @since 2.0
268
- */
269
- if ( version_compare( $current_ver, '1.9', '<=' ) ) {
270
-
271
- // Get settings
272
- $settings = superpwa_get_settings();
273
-
274
- // Display was set as 'standalone' until version 2.0. Set it as 1, which is 'standalone'.
275
- $settings['display'] = 1;
276
-
277
- // Write settings back to database
278
- update_option( 'superpwa_settings', $settings );
279
- }
280
-
281
- /**
282
- * Add file state variables to database
283
- *
284
- * @since 2.0.1
285
- */
286
- if ( version_compare( $current_ver, '2.0', '<=' ) ) {
287
-
288
- // Get settings
289
- $settings = superpwa_get_settings();
290
-
291
- // 1 for static files, 0 for dynamic files (default).
292
- $settings['is_static_manifest'] = 0;
293
- $settings['is_static_sw'] = 0;
294
-
295
- // Write settings back to database
296
- update_option( 'superpwa_settings', $settings );
297
- }
298
-
299
- // Re-generate manifest
300
- superpwa_generate_manifest();
301
-
302
- // Re-generate service worker
303
- superpwa_generate_sw();
304
-
305
- // Add current version to database
306
- update_option( 'superpwa_version', SUPERPWA_VERSION );
307
-
308
- // For multisites, save the activation status of current blog.
309
- superpwa_multisite_activation_status( true );
310
-
311
- // Set transient for upgrade complete notice
312
- set_transient( 'superpwa_admin_notice_upgrade_complete', true, 60 );
313
- }
314
- add_action( 'admin_init', 'superpwa_upgrader' );
315
-
316
- /**
317
- * Plugin deactivation todo list
318
- *
319
- * Runs during deactivation.
320
- * During uninstall uninstall.php is also executed.
321
- *
322
- * @param $network_active (Boolean) True if the plugin is network activated, false otherwise.
323
- * @link https://www.alexgeorgiou.gr/network-activated-wordpress-plugins/ (Thanks Alex!)
324
- *
325
- * @since 1.0
326
- * @since 1.6 register_deactivation_hook() moved to this file (basic-setup.php) from main plugin file (superpwa.php)
327
- */
328
- function superpwa_deactivate_plugin( $network_active ) {
329
-
330
- // Delete manifest
331
- superpwa_delete_manifest();
332
-
333
- // Delete service worker
334
- superpwa_delete_sw();
335
-
336
- // For multisites, save the de-activation status of current blog.
337
- superpwa_multisite_activation_status( false );
338
-
339
- // Run the network deactivator during network deactivation
340
- if ( $network_active === true ) {
341
- superpwa_multisite_network_deactivator();
342
- }
343
- }
344
- register_deactivation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_deactivate_plugin' );
345
-
346
- /**
347
- * Load plugin text domain
348
- *
349
- * @since 1.0
350
- */
351
- function superpwa_load_plugin_textdomain() {
352
- load_plugin_textdomain( 'super-progressive-web-apps', false, '/super-progressive-web-apps/languages/' );
353
- }
354
- add_action( 'plugins_loaded', 'superpwa_load_plugin_textdomain' );
355
-
356
- /**
357
- * Print direct link to plugin settings in plugins list in admin
358
- *
359
- * @since 1.0
360
- */
361
- function superpwa_settings_link( $links ) {
362
-
363
- return array_merge(
364
- array(
365
- 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>'
366
- ),
367
- $links
368
- );
369
- }
370
- add_filter( 'plugin_action_links_' . plugin_basename( SUPERPWA_PLUGIN_FILE ), 'superpwa_settings_link' );
371
-
372
- /**
373
- * Add donate and other links to plugins list
374
- *
375
- * @since 1.0
376
- */
377
- function superpwa_plugin_row_meta( $links, $file ) {
378
-
379
- if ( strpos( $file, 'superpwa.php' ) !== false ) {
380
- $new_links = array(
381
- 'demo' => '<a href="https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin_row_meta" target="_blank">' . __( 'Demo', 'super-progressive-web-apps' ) . '</a>',
382
- );
383
- $links = array_merge( $links, $new_links );
384
- }
385
-
386
- return $links;
387
- }
388
- add_filter( 'plugin_row_meta', 'superpwa_plugin_row_meta', 10, 2 );
389
-
390
- /**
391
- * Adds rewrite rules to handle request to SW javascript and Manifest json.
392
- *
393
- * @since 2.0
394
- *
395
- * @uses superpwa_get_sw_filename()
396
- * @uses superpwa_get_manifest_filename()
397
- */
398
- function superpwa_add_rewrite_rules() {
399
- $sw_filename = superpwa_get_sw_filename();
400
- add_rewrite_rule( "^/{$sw_filename}$",
401
- "index.php?{$sw_filename}=1"
402
- );
403
-
404
- $manifest_filename = superpwa_get_manifest_filename();
405
- add_rewrite_rule( "^/{$manifest_filename}$",
406
- "index.php?{$manifest_filename}=1"
407
- );
408
- }
409
-
410
- /**
411
- * Generates SW and Manifest on the fly.
412
- *
413
- * This way no physical files have to be placed on WP root folder. Hallelujah!
414
- *
415
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
416
- *
417
- * @uses superpwa_get_sw_filename()
418
- * @uses superpwa_get_manifest_filename()
419
- * @uses superpwa_manifest_template()
420
- * @uses superpwa_sw_template()
421
- *
422
- * @since 2.0
423
- * @since 2.1 uses http_build_query() instead of implode() to convert query_vars to string.
424
- */
425
- function superpwa_generate_sw_and_manifest_on_fly( $query ) {
426
- if ( ! property_exists( $query, 'query_vars' ) || ! is_array( $query->query_vars ) ) {
427
- return;
428
- }
429
- $query_vars_as_string = http_build_query( $query->query_vars );
430
- $manifest_filename = superpwa_get_manifest_filename();
431
- $sw_filename = superpwa_get_sw_filename();
432
-
433
- if ( strpos( $query_vars_as_string, $manifest_filename ) !== false ) {
434
- // Generate manifest from Settings and send the response w/ header.
435
- header( 'Content-Type: application/json' );
436
- echo json_encode( superpwa_manifest_template() );
437
- exit();
438
- }
439
- if ( strpos( $query_vars_as_string, $sw_filename ) !== false ) {
440
- header( 'Content-Type: text/javascript' );
441
- echo superpwa_sw_template();
442
- exit();
443
- }
444
- }
445
-
446
- /**
447
- * Sets up the hooks once.
448
- *
449
- * Possibly put in the same order as execution for better understanding.
450
- *
451
- * @link https://codex.wordpress.org/Plugin_API/Action_Reference Actions run during a typical Request.
452
- * @link https://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded
453
- *
454
- * @since 2.0
455
- */
456
- function superpwa_setup_hooks() {
457
- add_action( 'init', 'superpwa_add_rewrite_rules' );
458
- add_action( 'parse_request', 'superpwa_generate_sw_and_manifest_on_fly' );
459
- }
 
460
  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
+ // Not network active i.e. plugin is activated on a single install (normal WordPress install) or a single site on a multisite network
41
+ if ( ! $network_active ) {
42
+
43
+ // Set transient for single site activation notice
44
+ set_transient( 'superpwa_admin_notice_activation', true, 60 );
45
+
46
+ return;
47
+ }
48
+
49
+ // If we are here, then plugin is network activated on a multisite. Set transient for activation notice on network admin.
50
+ set_transient( 'superpwa_network_admin_notice_activation', true, 60 );
51
+ }
52
+ register_activation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_activate_plugin' );
53
+
54
+ /**
55
+ * Redirect to SuperPWA UI on plugin activation.
56
+ *
57
+ * Will redirect to SuperPWA settings page when plugin is activated.
58
+ * Will not redirect if multiple plugins are activated at the same time.
59
+ * Will not redirect when activated network wide on multisite. Network admins know their way.
60
+ *
61
+ * @param (string) $plugin Path to the main plugin file from plugins directory.
62
+ * @param (bool) $network_wide True when network activated on multisites. False otherwise.
63
+ *
64
+ * @author Arun Basil Lal
65
+ *
66
+ * @since 2.0
67
+ * @since 2.1 Added a check to see if WP_Plugins_List_Table class is available.
68
+ */
69
+ function superpwa_activation_redirect( $plugin, $network_wide ) {
70
+
71
+ // Return if not SuperPWA or if plugin is activated network wide.
72
+ if ( $plugin !== plugin_basename( SUPERPWA_PLUGIN_FILE ) || $network_wide === true ) {
73
+ return false;
74
+ }
75
+
76
+ if ( ! class_exists( 'WP_Plugins_List_Table' ) ) {
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * An instance of the WP_Plugins_List_Table class.
82
+ *
83
+ * @link https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-admin/plugins.php#L15
84
+ */
85
+ $wp_list_table_instance = new WP_Plugins_List_Table();
86
+ $current_action = $wp_list_table_instance->current_action();
87
+
88
+ // When only one plugin is activated, the current_action() method will return activate.
89
+ if ( $current_action !== 'activate' ) {
90
+ return false;
91
+ }
92
+
93
+ // Redirect to SuperPWA settings page.
94
+ exit( wp_redirect( admin_url( 'admin.php?page=superpwa' ) ) );
95
+ }
96
+ add_action( 'activated_plugin', 'superpwa_activation_redirect', PHP_INT_MAX, 2 );
97
+
98
+ /**
99
+ * Admin Notices
100
+ *
101
+ * @since 1.2 Admin notice on plugin activation
102
+ */
103
+ function superpwa_admin_notices() {
104
+
105
+ // Notices only for admins
106
+ if ( ! current_user_can( 'manage_options' ) ) {
107
+ return;
108
+ }
109
+
110
+ // Admin notice on plugin activation
111
+ if ( get_transient( 'superpwa_admin_notice_activation' ) ) {
112
+
113
+ $superpwa_is_ready = superpwa_is_pwa_ready() ? __( 'Your app is ready with the default settings. ', 'super-progressive-web-apps' ) : '';
114
+
115
+ // Do not display link to settings UI if we are already in the UI.
116
+ $screen = get_current_screen();
117
+ $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' ) ) : '';
118
+
119
+ 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>';
120
+
121
+ // Delete transient
122
+ delete_transient( 'superpwa_admin_notice_activation' );
123
+ }
124
+
125
+ // Admin notice on plugin upgrade
126
+ if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
127
+
128
+ 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>';
129
+
130
+ // Delete transient
131
+ delete_transient( 'superpwa_admin_notice_upgrade_complete' );
132
+ }
133
+ }
134
+ add_action( 'admin_notices', 'superpwa_admin_notices' );
135
+
136
+ /**
137
+ * Network Admin notices
138
+ *
139
+ * @since 1.6 Admin notice on multisite network activation
140
+ */
141
+ function superpwa_network_admin_notices() {
142
+
143
+ // Notices only for admins
144
+ if ( ! current_user_can( 'manage_options' ) ) {
145
+ return;
146
+ }
147
+
148
+ // Network admin notice on multisite network activation
149
+ if ( get_transient( 'superpwa_network_admin_notice_activation' ) ) {
150
+
151
+ $superpwa_is_ready = superpwa_is_pwa_ready() ? 'Your app is ready on the main website with the default settings. ' : '';
152
+
153
+ 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>';
154
+
155
+ // Delete transient
156
+ delete_transient( 'superpwa_network_admin_notice_activation' );
157
+ }
158
+
159
+ // Network admin notice on plugin upgrade
160
+ if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
161
+
162
+ 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>';
163
+
164
+ // Delete transient
165
+ delete_transient( 'superpwa_admin_notice_upgrade_complete' );
166
+ }
167
+ }
168
+ add_action( 'network_admin_notices', 'superpwa_network_admin_notices' );
169
+
170
+ /**
171
+ * Plugin upgrade todo list
172
+ *
173
+ * @since 1.3.1
174
+ * @since 1.4 Added orientation setting and theme_color to database when upgrading from pre 1.4 versions.
175
+ * @since 1.6 Added multisite compatibility.
176
+ */
177
+ function superpwa_upgrader() {
178
+
179
+ $current_ver = get_option( 'superpwa_version' );
180
+
181
+ // Return if we have already done this todo
182
+ if ( version_compare( $current_ver, SUPERPWA_VERSION, '==' ) ) {
183
+ return;
184
+ }
185
+
186
+ /**
187
+ * Todo list for fresh install.
188
+ *
189
+ * On a multisite, during network activation, the activation hook (and activation todo) is not fired.
190
+ * Manifest and service worker is generated the first time the wp-admin is loaded (when admin_init is fired).
191
+ */
192
+ if ( $current_ver === false ) {
193
+
194
+ // Generate manifest
195
+ superpwa_generate_manifest();
196
+
197
+ // Generate service worker
198
+ superpwa_generate_sw();
199
+
200
+ if ( is_multisite() ) {
201
+
202
+ // For multisites, save the activation status of current blog.
203
+ superpwa_multisite_activation_status( true );
204
+ }
205
+
206
+ // Save SuperPWA version to database.
207
+ add_option( 'superpwa_version', SUPERPWA_VERSION );
208
+
209
+ return;
210
+ }
211
+
212
+ /**
213
+ * Add orientation and theme_color to database when upgrading from pre 1.4 versions.
214
+ *
215
+ * Until 1.4, there was no UI for orientation and theme_color.
216
+ * In the manifest, orientation was hard coded as 'natural'.
217
+ * background_color had UI and this value was used for both background_color and theme_color in the manifest.
218
+ *
219
+ * @since 1.4
220
+ */
221
+ if ( version_compare( $current_ver, '1.3.1', '<=' ) ) {
222
+
223
+ // Get settings
224
+ $settings = superpwa_get_settings();
225
+
226
+ // Orientation was set as 'natural' until version 1.4. Set it as 1, which is 'portrait'.
227
+ $settings['orientation'] = 1;
228
+
229
+ // theme_color was same as background_color until version 1.4
230
+ $settings['theme_color'] = $settings['background_color'];
231
+
232
+ // Write settings back to database
233
+ update_option( 'superpwa_settings', $settings );
234
+ }
235
+
236
+ /**
237
+ * Delete existing service worker for single sites that use OneSignal.
238
+ *
239
+ * For OneSignal compatibility, in version 1.8 the service worker filename is renamed.
240
+ * If OneSignal is active, by this point, the new filename will be filtered in.
241
+ * This upgrade routine restores the defaul service worker filename and deletes the existing service worker.
242
+ * Also adds back the filter for new filename. OneSignal compatibility for multisites is not available at this point.
243
+ *
244
+ * @since 1.8
245
+ */
246
+ if ( version_compare( $current_ver, '1.7.1', '<=' ) && class_exists( 'OneSignal' ) && ! is_multisite() ) {
247
+
248
+ // Restore the default service worker filename of SuperPWA.
249
+ remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
250
+
251
+ // Delete service worker
252
+ superpwa_delete_sw();
253
+
254
+ // Change service worker filename to match OneSignal's service worker.
255
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
256
+ }
257
+
258
+ /**
259
+ * Add display to database when upgrading from pre 2.0 versions.
260
+ * Delete manifest and service worker files.
261
+ *
262
+ * Until 2.0, there was no UI for display.
263
+ * In the manifest, display was hard coded as 'standalone'.
264
+ *
265
+ * Starting with 2.0, manifest and service worker files are dynamic and no longer static.
266
+ *
267
+ * @since 2.0
268
+ */
269
+ if ( version_compare( $current_ver, '1.9', '<=' ) ) {
270
+
271
+ // Get settings
272
+ $settings = superpwa_get_settings();
273
+
274
+ // Display was set as 'standalone' until version 2.0. Set it as 1, which is 'standalone'.
275
+ $settings['display'] = 1;
276
+
277
+ // Write settings back to database
278
+ update_option( 'superpwa_settings', $settings );
279
+ }
280
+
281
+ /**
282
+ * Add file state variables to database
283
+ *
284
+ * @since 2.0.1
285
+ */
286
+ if ( version_compare( $current_ver, '2.0', '<=' ) ) {
287
+
288
+ // Get settings
289
+ $settings = superpwa_get_settings();
290
+
291
+ // 1 for static files, 0 for dynamic files (default).
292
+ $settings['is_static_manifest'] = 0;
293
+ $settings['is_static_sw'] = 0;
294
+
295
+ // Write settings back to database
296
+ update_option( 'superpwa_settings', $settings );
297
+ }
298
+
299
+ // Re-generate manifest
300
+ superpwa_generate_manifest();
301
+
302
+ // Re-generate service worker
303
+ superpwa_generate_sw();
304
+
305
+ // Add current version to database
306
+ update_option( 'superpwa_version', SUPERPWA_VERSION );
307
+
308
+ // For multisites, save the activation status of current blog.
309
+ superpwa_multisite_activation_status( true );
310
+
311
+ // Set transient for upgrade complete notice
312
+ set_transient( 'superpwa_admin_notice_upgrade_complete', true, 60 );
313
+ }
314
+ add_action( 'admin_init', 'superpwa_upgrader' );
315
+
316
+ /**
317
+ * Plugin deactivation todo list
318
+ *
319
+ * Runs during deactivation.
320
+ * During uninstall uninstall.php is also executed.
321
+ *
322
+ * @param $network_active (Boolean) True if the plugin is network activated, false otherwise.
323
+ * @link https://www.alexgeorgiou.gr/network-activated-wordpress-plugins/ (Thanks Alex!)
324
+ *
325
+ * @since 1.0
326
+ * @since 1.6 register_deactivation_hook() moved to this file (basic-setup.php) from main plugin file (superpwa.php)
327
+ */
328
+ function superpwa_deactivate_plugin( $network_active ) {
329
+
330
+ // Delete manifest
331
+ superpwa_delete_manifest();
332
+
333
+ // Delete service worker
334
+ superpwa_delete_sw();
335
+
336
+ // For multisites, save the de-activation status of current blog.
337
+ superpwa_multisite_activation_status( false );
338
+
339
+ // Run the network deactivator during network deactivation
340
+ if ( $network_active === true ) {
341
+ superpwa_multisite_network_deactivator();
342
+ }
343
+ }
344
+ register_deactivation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_deactivate_plugin' );
345
+
346
+ /**
347
+ * Load plugin text domain
348
+ *
349
+ * @since 1.0
350
+ */
351
+ function superpwa_load_plugin_textdomain() {
352
+ load_plugin_textdomain( 'super-progressive-web-apps', false, '/super-progressive-web-apps/languages/' );
353
+ }
354
+ add_action( 'plugins_loaded', 'superpwa_load_plugin_textdomain' );
355
+
356
+ /**
357
+ * Print direct link to plugin settings in plugins list in admin
358
+ *
359
+ * @since 1.0
360
+ */
361
+ function superpwa_settings_link( $links ) {
362
+
363
+ return array_merge(
364
+ array(
365
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>',
366
+ 'upgrade' => '<a href="' . admin_url( 'admin.php?page=superpwa-upgrade' ) . '">' . __( 'Upgrade to Pro', 'super-progressive-web-apps' ) . '</a>'
367
+ ),
368
+ $links
369
+ );
370
+ }
371
+ add_filter( 'plugin_action_links_' . plugin_basename( SUPERPWA_PLUGIN_FILE ), 'superpwa_settings_link' );
372
+
373
+ /**
374
+ * Add donate and other links to plugins list
375
+ *
376
+ * @since 1.0
377
+ */
378
+ function superpwa_plugin_row_meta( $links, $file ) {
379
+
380
+ if ( strpos( $file, 'superpwa.php' ) !== false ) {
381
+ $new_links = array(
382
+ 'demo' => '<a href="https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin_row_meta" target="_blank">' . __( 'Demo', 'super-progressive-web-apps' ) . '</a>',
383
+ );
384
+ $links = array_merge( $links, $new_links );
385
+ }
386
+
387
+ return $links;
388
+ }
389
+ add_filter( 'plugin_row_meta', 'superpwa_plugin_row_meta', 10, 2 );
390
+
391
+ /**
392
+ * Adds rewrite rules to handle request to SW javascript and Manifest json.
393
+ *
394
+ * @since 2.0
395
+ *
396
+ * @uses superpwa_get_sw_filename()
397
+ * @uses superpwa_get_manifest_filename()
398
+ */
399
+ function superpwa_add_rewrite_rules() {
400
+ $sw_filename = superpwa_get_sw_filename();
401
+ add_rewrite_rule( "^/{$sw_filename}$",
402
+ "index.php?{$sw_filename}=1"
403
+ );
404
+
405
+ $manifest_filename = superpwa_get_manifest_filename();
406
+ add_rewrite_rule( "^/{$manifest_filename}$",
407
+ "index.php?{$manifest_filename}=1"
408
+ );
409
+ }
410
+
411
+ /**
412
+ * Generates SW and Manifest on the fly.
413
+ *
414
+ * This way no physical files have to be placed on WP root folder. Hallelujah!
415
+ *
416
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
417
+ *
418
+ * @uses superpwa_get_sw_filename()
419
+ * @uses superpwa_get_manifest_filename()
420
+ * @uses superpwa_manifest_template()
421
+ * @uses superpwa_sw_template()
422
+ *
423
+ * @since 2.0
424
+ * @since 2.1 uses http_build_query() instead of implode() to convert query_vars to string.
425
+ */
426
+ function superpwa_generate_sw_and_manifest_on_fly( $query ) {
427
+ if ( ! property_exists( $query, 'query_vars' ) || ! is_array( $query->query_vars ) ) {
428
+ return;
429
+ }
430
+ $query_vars_as_string = http_build_query( $query->query_vars );
431
+ $manifest_filename = superpwa_get_manifest_filename();
432
+ $sw_filename = superpwa_get_sw_filename();
433
+
434
+ if ( strpos( $query_vars_as_string, $manifest_filename ) !== false ) {
435
+ // Generate manifest from Settings and send the response w/ header.
436
+ header( 'Content-Type: application/json' );
437
+ echo json_encode( superpwa_manifest_template() );
438
+ exit();
439
+ }
440
+ if ( strpos( $query_vars_as_string, $sw_filename ) !== false ) {
441
+ header( 'Content-Type: text/javascript' );
442
+ echo superpwa_sw_template();
443
+ exit();
444
+ }
445
+ }
446
+
447
+ /**
448
+ * Sets up the hooks once.
449
+ *
450
+ * Possibly put in the same order as execution for better understanding.
451
+ *
452
+ * @link https://codex.wordpress.org/Plugin_API/Action_Reference Actions run during a typical Request.
453
+ * @link https://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded
454
+ *
455
+ * @since 2.0
456
+ */
457
+ function superpwa_setup_hooks() {
458
+ add_action( 'init', 'superpwa_add_rewrite_rules' );
459
+ add_action( 'parse_request', 'superpwa_generate_sw_and_manifest_on_fly' );
460
+ }
461
  add_action( 'plugins_loaded', 'superpwa_setup_hooks' );
admin/css/upgrade-ui.css ADDED
@@ -0,0 +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
+ }
admin/img/android-apk-app.png ADDED
Binary file
admin/img/apple-touch.png ADDED
Binary file
admin/img/call-to-action.png ADDED
Binary file
admin/img/rating.png ADDED
Binary file
admin/img/tick.png ADDED
Binary file
admin/img/utm-action.png ADDED
Binary file
admin/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
admin/js/main.js CHANGED
@@ -1,42 +1,42 @@
1
- jQuery(document).ready(function($){
2
- $('.superpwa-colorpicker').wpColorPicker(); // Color picker
3
- $('.superpwa-icon-upload').click(function(e) { // Application Icon upload
4
- e.preventDefault();
5
- var superpwa_meda_uploader = wp.media({
6
- title: 'Application Icon',
7
- button: {
8
- text: 'Select Icon'
9
- },
10
- multiple: false // Set this to true to allow multiple files to be selected
11
- })
12
- .on('select', function() {
13
- var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
14
- $('.superpwa-icon').val(attachment.url);
15
- })
16
- .open();
17
- });
18
- $('.superpwa-splash-icon-upload').click(function(e) { // Splash Screen Icon upload
19
- e.preventDefault();
20
- var superpwa_meda_uploader = wp.media({
21
- title: 'Splash Screen Icon',
22
- button: {
23
- text: 'Select Icon'
24
- },
25
- multiple: false // Set this to true to allow multiple files to be selected
26
- })
27
- .on('select', function() {
28
- var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
29
- $('.superpwa-splash-icon').val(attachment.url);
30
- })
31
- .open();
32
- });
33
- $('.superpwa-app-short-name').on('input', function(e) { // Warn when app_short_name exceeds 12 characters.
34
- if ( $('.superpwa-app-short-name').val().length > 12 ) {
35
- $('.superpwa-app-short-name').css({'color': '#dc3232'});
36
- $('#superpwa-app-short-name-limit').css({'color': '#dc3232'});
37
- } else {
38
- $('.superpwa-app-short-name').css({'color': 'inherit'});
39
- $('#superpwa-app-short-name-limit').css({'color': 'inherit'});
40
- }
41
- });
42
  });
1
+ jQuery(document).ready(function($){
2
+ $('.superpwa-colorpicker').wpColorPicker(); // Color picker
3
+ $('.superpwa-icon-upload').click(function(e) { // Application Icon upload
4
+ e.preventDefault();
5
+ var superpwa_meda_uploader = wp.media({
6
+ title: 'Application Icon',
7
+ button: {
8
+ text: 'Select Icon'
9
+ },
10
+ multiple: false // Set this to true to allow multiple files to be selected
11
+ })
12
+ .on('select', function() {
13
+ var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
14
+ $('.superpwa-icon').val(attachment.url);
15
+ })
16
+ .open();
17
+ });
18
+ $('.superpwa-splash-icon-upload').click(function(e) { // Splash Screen Icon upload
19
+ e.preventDefault();
20
+ var superpwa_meda_uploader = wp.media({
21
+ title: 'Splash Screen Icon',
22
+ button: {
23
+ text: 'Select Icon'
24
+ },
25
+ multiple: false // Set this to true to allow multiple files to be selected
26
+ })
27
+ .on('select', function() {
28
+ var attachment = superpwa_meda_uploader.state().get('selection').first().toJSON();
29
+ $('.superpwa-splash-icon').val(attachment.url);
30
+ })
31
+ .open();
32
+ });
33
+ $('.superpwa-app-short-name').on('input', function(e) { // Warn when app_short_name exceeds 12 characters.
34
+ if ( $('.superpwa-app-short-name').val().length > 12 ) {
35
+ $('.superpwa-app-short-name').css({'color': '#dc3232'});
36
+ $('#superpwa-app-short-name-limit').css({'color': '#dc3232'});
37
+ } else {
38
+ $('.superpwa-app-short-name').css({'color': 'inherit'});
39
+ $('#superpwa-app-short-name-limit').css({'color': 'inherit'});
40
+ }
41
+ });
42
  });
functions/common.php CHANGED
@@ -1,243 +1,243 @@
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
  }
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
  }
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,31 +1,32 @@
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
-
17
- // 3rd party compatibility
18
- require_once( SUPERPWA_PATH_ABS . '3rd-party/onesignal.php' );
19
-
20
- // Load functions
21
- require_once( SUPERPWA_PATH_ABS . 'functions/common.php' );
22
- require_once( SUPERPWA_PATH_ABS . 'functions/filesystem.php' );
23
- require_once( SUPERPWA_PATH_ABS . 'functions/multisite.php' );
24
-
25
- // Public folder
26
- require_once( SUPERPWA_PATH_ABS . 'public/manifest.php' );
27
- require_once( SUPERPWA_PATH_ABS . 'public/sw.php' );
28
-
29
- // Load bundled add-ons
30
- if ( superpwa_addons_status( 'utm_tracking' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/utm-tracking.php' );
 
31
  if ( superpwa_addons_status( 'apple_touch_icons' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/apple-touch-icons.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
+
18
+ // 3rd party compatibility
19
+ require_once( SUPERPWA_PATH_ABS . '3rd-party/onesignal.php' );
20
+
21
+ // Load functions
22
+ require_once( SUPERPWA_PATH_ABS . 'functions/common.php' );
23
+ require_once( SUPERPWA_PATH_ABS . 'functions/filesystem.php' );
24
+ require_once( SUPERPWA_PATH_ABS . 'functions/multisite.php' );
25
+
26
+ // Public folder
27
+ require_once( SUPERPWA_PATH_ABS . 'public/manifest.php' );
28
+ require_once( SUPERPWA_PATH_ABS . 'public/sw.php' );
29
+
30
+ // Load bundled add-ons
31
+ if ( superpwa_addons_status( 'utm_tracking' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/utm-tracking.php' );
32
  if ( superpwa_addons_status( 'apple_touch_icons' ) == 'active' ) require_once( SUPERPWA_PATH_ABS . 'addons/apple-touch-icons.php' );
public/images/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  // Silence is golden
1
+ <?php
2
  // Silence is golden
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,7 +1,62 @@
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'); registration.update(); })
5
- .catch(function(error) { console.log('Registration failed with ' + error); });
6
- });
7
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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'); registration.update(); })
5
+ .catch(function(error) { console.log('Registration failed with ' + error); });
6
+
7
+
8
+ var deferredPrompt;
9
+ window.addEventListener('beforeinstallprompt', function(e){
10
+ deferredPrompt = e;
11
+ if(deferredPrompt != null || deferredPrompt != undefined){
12
+ var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
13
+ if(a2hsBanner){
14
+ deferredPrompt.preventDefault();
15
+ for (var i = 0; i < a2hsBanner.length; i++) {
16
+ var showbanner = a2hsBanner[i].getAttribute("data-show");
17
+ a2hsBanner[i].style.display="flex";
18
+ }
19
+ }
20
+ }
21
+ })
22
+
23
+ window.addEventListener('appinstalled', function(evt){
24
+ var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
25
+ if(a2hsBanner){
26
+ for (var i = 0; i < a2hsBanner.length; i++) {
27
+ var showbanner = a2hsBanner[i].getAttribute("data-show");
28
+ a2hsBanner[i].style.display="none";
29
+ }
30
+ }
31
+ });
32
+
33
+ var a2hsviaClass = document.getElementsByClassName("superpwa-add-via-class");
34
+ if(a2hsviaClass !== null){
35
+ for (var i = 0; i < a2hsviaClass.length; i++) {
36
+ a2hsviaClass[i].addEventListener("click", addToHome);
37
+ }
38
+ }
39
+
40
+ function addToHome(){
41
+ if(!deferredPrompt){return ;}
42
+ deferredPrompt.prompt();
43
+ deferredPrompt.userChoice.then(function(choiceResult) {
44
+ if (choiceResult.outcome === "accepted") {
45
+ var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
46
+ if(a2hsBanner){
47
+ for (var i = 0; i < a2hsBanner.length; i++) {
48
+ var showbanner = a2hsBanner[i].getAttribute("data-show");
49
+ a2hsBanner[i].style.display="none";
50
+ }
51
+ }//a2hsBanner if
52
+ console.log("User accepted the prompt");
53
+ }else{
54
+ console.log("User dismissed the prompt");
55
+ }
56
+ deferredPrompt = null;
57
+ });
58
+ } // function closed addToHome
59
+
60
+
61
+ });
62
+ }
public/manifest.php CHANGED
@@ -1,353 +1,353 @@
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
- return trailingslashit( ABSPATH ) . $manifest_filename;
72
- break;
73
-
74
- // Link to manifest
75
- case 'src':
76
- default:
77
-
78
- // Get Settings
79
- $settings = superpwa_get_settings();
80
-
81
- /**
82
- * For static file, return site_url and network_site_url
83
- *
84
- * Static files are generated in the root directory.
85
- * The site_url template tag retrieves the site url for the
86
- * current site (where the WordPress core files reside).
87
- */
88
- if ( $settings['is_static_manifest'] === 1 ) {
89
- return trailingslashit( network_site_url() ) . $manifest_filename;
90
- }
91
-
92
- // For dynamic files, return the home_url
93
- return home_url( '/' ) . $manifest_filename;
94
-
95
- break;
96
- }
97
- }
98
-
99
- /**
100
- * Returns the Manifest template.
101
- *
102
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
103
- *
104
- * @return array
105
- *
106
- * @since 2.0 Replaces superpwa_generate_manifest()
107
- * @since 2.0 Added display
108
- */
109
- function superpwa_manifest_template() {
110
-
111
- // Get Settings
112
- $settings = superpwa_get_settings();
113
-
114
- $manifest = array();
115
- $manifest['name'] = $settings['app_name'];
116
- $manifest['short_name'] = $settings['app_short_name'];
117
-
118
- // Description
119
- if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
120
- $manifest['description'] = $settings['description'];
121
- }
122
-
123
- $manifest['icons'] = superpwa_get_pwa_icons();
124
- $manifest['background_color'] = $settings['background_color'];
125
- $manifest['theme_color'] = $settings['theme_color'];
126
- $manifest['display'] = superpwa_get_display();
127
- $manifest['orientation'] = superpwa_get_orientation();
128
- $manifest['start_url'] = superpwa_get_start_url( true );
129
- $manifest['scope'] = superpwa_get_scope();
130
-
131
- /**
132
- * Values that go in to Manifest JSON.
133
- *
134
- * The Web app manifest is a simple JSON file that tells the browser about your web application.
135
- *
136
- * @param array $manifest
137
- */
138
- return apply_filters( 'superpwa_manifest', $manifest );
139
- }
140
-
141
- /**
142
- * Generate and write manifest into WordPress root folder
143
- *
144
- * Starting with 2.0, files are only generated if dynamic files are not possible.
145
- * Some webserver configurations does not load WordPress and attempts to server files directly
146
- * from the server. This returns 404 when files do not exist physically.
147
- *
148
- * @return (boolean) true on success, false on failure.
149
- *
150
- * @author Arun Basil Lal
151
- * @author Maria Daniel Deepak <daniel@danieldeepak.com>
152
- *
153
- * @since 1.0
154
- * @since 1.3 Added support for 512x512 icon.
155
- * @since 1.4 Added orientation and scope.
156
- * @since 1.5 Added gcm_sender_id
157
- * @since 1.6 Added description
158
- * @since 1.8 Removed gcm_sender_id and introduced filter superpwa_manifest. gcm_sender_id is added in /3rd-party/onesignal.php
159
- * @since 2.0 Deprecated since Manifest is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
160
- * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description.
161
- */
162
- function superpwa_generate_manifest() {
163
-
164
- // Delete manifest if it exists.
165
- superpwa_delete_manifest();
166
-
167
- // Get Settings
168
- $settings = superpwa_get_settings();
169
-
170
- // Return true if dynamic file returns a 200 response.
171
- if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_manifest_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
172
-
173
- // set file status as dynamic file in database.
174
- $settings['is_static_manifest'] = 0;
175
-
176
- // Write settings back to database.
177
- update_option( 'superpwa_settings', $settings );
178
-
179
- return true;
180
- }
181
-
182
- // Write the manfiest to disk.
183
- if ( superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( superpwa_manifest_template() ) ) ) {
184
-
185
- // set file status as satic file in database.
186
- $settings['is_static_manifest'] = 1;
187
-
188
- // Write settings back to database.
189
- update_option( 'superpwa_settings', $settings );
190
-
191
- return true;
192
- }
193
-
194
- return false;
195
- }
196
-
197
- /**
198
- * Add manifest to header (wp_head)
199
- *
200
- * @since 1.0
201
- * @since 1.8 Introduced filter superpwa_wp_head_tags
202
- * @since 1.9 Introduced filter superpwa_add_theme_color
203
- */
204
- function superpwa_add_manifest_to_wp_head() {
205
-
206
- $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
207
- $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
208
-
209
- // theme-color meta tag
210
- if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
211
-
212
- // Get Settings
213
- $settings = superpwa_get_settings();
214
- $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
215
- }
216
-
217
- $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
218
-
219
- $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL;
220
-
221
- echo $tags;
222
- }
223
- add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
224
-
225
- /**
226
- * Delete manifest
227
- *
228
- * @return (boolean) true on success, false on failure
229
- *
230
- * @author Arun Basil Lal
231
- *
232
- * @since 1.0
233
- */
234
- function superpwa_delete_manifest() {
235
- return superpwa_delete( superpwa_manifest( 'abs' ) );
236
- }
237
-
238
- /**
239
- * Get PWA Icons
240
- *
241
- * @return array An array of icons to be used as the application icons and splash screen icons
242
- *
243
- * @author Jose Varghese
244
- * @since 1.3
245
- * @since 2.1.1 Added support for Maskable Icons
246
- *
247
- */
248
- function superpwa_get_pwa_icons() {
249
-
250
- // Get settings
251
- $settings = superpwa_get_settings();
252
-
253
- // Application icon
254
- $icons_array[] = array(
255
- 'src' => $settings['icon'],
256
- 'sizes' => '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
257
- 'type' => 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
258
- 'purpose'=> 'any maskable', // any maskable to support adaptive icons
259
- );
260
-
261
- // Splash screen icon - Added since 1.3
262
- if ( @$settings['splash_icon'] != '' ) {
263
-
264
- $icons_array[] = array(
265
- 'src' => $settings['splash_icon'],
266
- 'sizes' => '512x512', // must be 512x512.
267
- 'type' => 'image/png', // must be image/png
268
- );
269
- }
270
-
271
- return $icons_array;
272
- }
273
-
274
- /**
275
- * Get navigation scope of PWA
276
- *
277
- * @return string Relative path to the folder where WordPress is installed. Same folder as manifest and wp-config.php
278
- * @since 1.4
279
- */
280
- function superpwa_get_scope() {
281
- return parse_url( trailingslashit( superpwa_get_bloginfo( 'sw' ) ), PHP_URL_PATH );
282
- }
283
-
284
- /**
285
- * Get orientation of PWA
286
- *
287
- * @return string Orientation of PWA as set in the plugin settings.
288
- * @since 1.4
289
- */
290
- function superpwa_get_orientation() {
291
-
292
- // Get Settings
293
- $settings = superpwa_get_settings();
294
-
295
- $orientation = isset( $settings['orientation'] ) ? $settings['orientation'] : 0;
296
-
297
- switch ( $orientation ) {
298
-
299
- case 0:
300
- return 'any';
301
- break;
302
-
303
- case 1:
304
- return 'portrait';
305
- break;
306
-
307
- case 2:
308
- return 'landscape';
309
- break;
310
-
311
- default:
312
- return 'any';
313
- }
314
- }
315
-
316
- /**
317
- * Get display of PWA
318
- *
319
- * @return (string) Display of PWA as set in the plugin settings.
320
- *
321
- * @author Jose Varghese
322
- *
323
- * @since 2.0
324
- */
325
- function superpwa_get_display() {
326
-
327
- // Get Settings
328
- $settings = superpwa_get_settings();
329
-
330
- $display = isset( $settings['display'] ) ? $settings['display'] : 1;
331
-
332
- switch ( $display ) {
333
-
334
- case 0:
335
- return 'fullscreen';
336
- break;
337
-
338
- case 1:
339
- return 'standalone';
340
- break;
341
-
342
- case 2:
343
- return 'minimal-ui';
344
- break;
345
-
346
- case 3:
347
- return 'browser';
348
- break;
349
-
350
- default:
351
- return 'standalone';
352
- }
353
- }
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
+ return trailingslashit( ABSPATH ) . $manifest_filename;
72
+ break;
73
+
74
+ // Link to manifest
75
+ case 'src':
76
+ default:
77
+
78
+ // Get Settings
79
+ $settings = superpwa_get_settings();
80
+
81
+ /**
82
+ * For static file, return site_url and network_site_url
83
+ *
84
+ * Static files are generated in the root directory.
85
+ * The site_url template tag retrieves the site url for the
86
+ * current site (where the WordPress core files reside).
87
+ */
88
+ if ( $settings['is_static_manifest'] === 1 ) {
89
+ return trailingslashit( network_site_url() ) . $manifest_filename;
90
+ }
91
+
92
+ // For dynamic files, return the home_url
93
+ return home_url( '/' ) . $manifest_filename;
94
+
95
+ break;
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Returns the Manifest template.
101
+ *
102
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
103
+ *
104
+ * @return array
105
+ *
106
+ * @since 2.0 Replaces superpwa_generate_manifest()
107
+ * @since 2.0 Added display
108
+ */
109
+ function superpwa_manifest_template() {
110
+
111
+ // Get Settings
112
+ $settings = superpwa_get_settings();
113
+
114
+ $manifest = array();
115
+ $manifest['name'] = $settings['app_name'];
116
+ $manifest['short_name'] = $settings['app_short_name'];
117
+
118
+ // Description
119
+ if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
120
+ $manifest['description'] = $settings['description'];
121
+ }
122
+
123
+ $manifest['icons'] = superpwa_get_pwa_icons();
124
+ $manifest['background_color'] = $settings['background_color'];
125
+ $manifest['theme_color'] = $settings['theme_color'];
126
+ $manifest['display'] = superpwa_get_display();
127
+ $manifest['orientation'] = superpwa_get_orientation();
128
+ $manifest['start_url'] = superpwa_get_start_url( true );
129
+ $manifest['scope'] = superpwa_get_scope();
130
+
131
+ /**
132
+ * Values that go in to Manifest JSON.
133
+ *
134
+ * The Web app manifest is a simple JSON file that tells the browser about your web application.
135
+ *
136
+ * @param array $manifest
137
+ */
138
+ return apply_filters( 'superpwa_manifest', $manifest );
139
+ }
140
+
141
+ /**
142
+ * Generate and write manifest into WordPress root folder
143
+ *
144
+ * Starting with 2.0, files are only generated if dynamic files are not possible.
145
+ * Some webserver configurations does not load WordPress and attempts to server files directly
146
+ * from the server. This returns 404 when files do not exist physically.
147
+ *
148
+ * @return (boolean) true on success, false on failure.
149
+ *
150
+ * @author Arun Basil Lal
151
+ * @author Maria Daniel Deepak <daniel@danieldeepak.com>
152
+ *
153
+ * @since 1.0
154
+ * @since 1.3 Added support for 512x512 icon.
155
+ * @since 1.4 Added orientation and scope.
156
+ * @since 1.5 Added gcm_sender_id
157
+ * @since 1.6 Added description
158
+ * @since 1.8 Removed gcm_sender_id and introduced filter superpwa_manifest. gcm_sender_id is added in /3rd-party/onesignal.php
159
+ * @since 2.0 Deprecated since Manifest is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
160
+ * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description.
161
+ */
162
+ function superpwa_generate_manifest() {
163
+
164
+ // Delete manifest if it exists.
165
+ superpwa_delete_manifest();
166
+
167
+ // Get Settings
168
+ $settings = superpwa_get_settings();
169
+
170
+ // Return true if dynamic file returns a 200 response.
171
+ if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_manifest_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
172
+
173
+ // set file status as dynamic file in database.
174
+ $settings['is_static_manifest'] = 0;
175
+
176
+ // Write settings back to database.
177
+ update_option( 'superpwa_settings', $settings );
178
+
179
+ return true;
180
+ }
181
+
182
+ // Write the manfiest to disk.
183
+ if ( superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( superpwa_manifest_template() ) ) ) {
184
+
185
+ // set file status as satic file in database.
186
+ $settings['is_static_manifest'] = 1;
187
+
188
+ // Write settings back to database.
189
+ update_option( 'superpwa_settings', $settings );
190
+
191
+ return true;
192
+ }
193
+
194
+ return false;
195
+ }
196
+
197
+ /**
198
+ * Add manifest to header (wp_head)
199
+ *
200
+ * @since 1.0
201
+ * @since 1.8 Introduced filter superpwa_wp_head_tags
202
+ * @since 1.9 Introduced filter superpwa_add_theme_color
203
+ */
204
+ function superpwa_add_manifest_to_wp_head() {
205
+
206
+ $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
207
+ $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
208
+
209
+ // theme-color meta tag
210
+ if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
211
+
212
+ // Get Settings
213
+ $settings = superpwa_get_settings();
214
+ $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
215
+ }
216
+
217
+ $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
218
+
219
+ $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL;
220
+
221
+ echo $tags;
222
+ }
223
+ add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
224
+
225
+ /**
226
+ * Delete manifest
227
+ *
228
+ * @return (boolean) true on success, false on failure
229
+ *
230
+ * @author Arun Basil Lal
231
+ *
232
+ * @since 1.0
233
+ */
234
+ function superpwa_delete_manifest() {
235
+ return superpwa_delete( superpwa_manifest( 'abs' ) );
236
+ }
237
+
238
+ /**
239
+ * Get PWA Icons
240
+ *
241
+ * @return array An array of icons to be used as the application icons and splash screen icons
242
+ *
243
+ * @author Jose Varghese
244
+ * @since 1.3
245
+ * @since 2.1.1 Added support for Maskable Icons
246
+ *
247
+ */
248
+ function superpwa_get_pwa_icons() {
249
+
250
+ // Get settings
251
+ $settings = superpwa_get_settings();
252
+
253
+ // Application icon
254
+ $icons_array[] = array(
255
+ 'src' => $settings['icon'],
256
+ 'sizes' => '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
257
+ 'type' => 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
258
+ 'purpose'=> 'any maskable', // any maskable to support adaptive icons
259
+ );
260
+
261
+ // Splash screen icon - Added since 1.3
262
+ if ( @$settings['splash_icon'] != '' ) {
263
+
264
+ $icons_array[] = array(
265
+ 'src' => $settings['splash_icon'],
266
+ 'sizes' => '512x512', // must be 512x512.
267
+ 'type' => 'image/png', // must be image/png
268
+ );
269
+ }
270
+
271
+ return $icons_array;
272
+ }
273
+
274
+ /**
275
+ * Get navigation scope of PWA
276
+ *
277
+ * @return string Relative path to the folder where WordPress is installed. Same folder as manifest and wp-config.php
278
+ * @since 1.4
279
+ */
280
+ function superpwa_get_scope() {
281
+ return parse_url( trailingslashit( superpwa_get_bloginfo( 'sw' ) ), PHP_URL_PATH );
282
+ }
283
+
284
+ /**
285
+ * Get orientation of PWA
286
+ *
287
+ * @return string Orientation of PWA as set in the plugin settings.
288
+ * @since 1.4
289
+ */
290
+ function superpwa_get_orientation() {
291
+
292
+ // Get Settings
293
+ $settings = superpwa_get_settings();
294
+
295
+ $orientation = isset( $settings['orientation'] ) ? $settings['orientation'] : 0;
296
+
297
+ switch ( $orientation ) {
298
+
299
+ case 0:
300
+ return 'any';
301
+ break;
302
+
303
+ case 1:
304
+ return 'portrait';
305
+ break;
306
+
307
+ case 2:
308
+ return 'landscape';
309
+ break;
310
+
311
+ default:
312
+ return 'any';
313
+ }
314
+ }
315
+
316
+ /**
317
+ * Get display of PWA
318
+ *
319
+ * @return (string) Display of PWA as set in the plugin settings.
320
+ *
321
+ * @author Jose Varghese
322
+ *
323
+ * @since 2.0
324
+ */
325
+ function superpwa_get_display() {
326
+
327
+ // Get Settings
328
+ $settings = superpwa_get_settings();
329
+
330
+ $display = isset( $settings['display'] ) ? $settings['display'] : 1;
331
+
332
+ switch ( $display ) {
333
+
334
+ case 0:
335
+ return 'fullscreen';
336
+ break;
337
+
338
+ case 1:
339
+ return 'standalone';
340
+ break;
341
+
342
+ case 2:
343
+ return 'minimal-ui';
344
+ break;
345
+
346
+ case 3:
347
+ return 'browser';
348
+ break;
349
+
350
+ default:
351
+ return 'standalone';
352
+ }
353
+ }
public/sw.php CHANGED
@@ -1,351 +1,351 @@
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
- // Start output buffer. Everything from here till ob_get_clean() is returned
159
- ob_start(); ?>
160
- 'use strict';
161
-
162
- /**
163
- * Service Worker of SuperPWA
164
- * To learn more and add one to your website, visit - https://superpwa.com
165
- */
166
-
167
- const cacheName = '<?php echo parse_url( get_bloginfo( 'url' ), PHP_URL_HOST ) . '-superpwa-' . SUPERPWA_VERSION; ?>';
168
- const startPage = '<?php echo superpwa_get_start_url(); ?>';
169
- const offlinePage = '<?php echo superpwa_get_offline_page(); ?>';
170
- const filesToCache = [<?php echo apply_filters( 'superpwa_sw_files_to_cache', 'startPage, offlinePage' ); ?>];
171
- const neverCacheUrls = [<?php echo apply_filters( 'superpwa_sw_never_cache_urls', '/\/wp-admin/,/\/wp-login/,/preview=true/' ); ?>];
172
-
173
- // Install
174
- self.addEventListener('install', function(e) {
175
- console.log('SuperPWA service worker installation');
176
- e.waitUntil(
177
- caches.open(cacheName).then(function(cache) {
178
- console.log('SuperPWA service worker caching dependencies');
179
- filesToCache.map(function(url) {
180
- return cache.add(url).catch(function (reason) {
181
- return console.log('SuperPWA: ' + String(reason) + ' ' + url);
182
- });
183
- });
184
- })
185
- );
186
- });
187
-
188
- // Activate
189
- self.addEventListener('activate', function(e) {
190
- console.log('SuperPWA service worker activation');
191
- e.waitUntil(
192
- caches.keys().then(function(keyList) {
193
- return Promise.all(keyList.map(function(key) {
194
- if ( key !== cacheName ) {
195
- console.log('SuperPWA old cache removed', key);
196
- return caches.delete(key);
197
- }
198
- }));
199
- })
200
- );
201
- return self.clients.claim();
202
- });
203
-
204
- // Fetch
205
- self.addEventListener('fetch', function(e) {
206
-
207
- // Return if the current request url is in the never cache list
208
- if ( ! neverCacheUrls.every(checkNeverCacheList, e.request.url) ) {
209
- console.log( 'SuperPWA: Current request is excluded from cache.' );
210
- return;
211
- }
212
-
213
- // Return if request url protocal isn't http or https
214
- if ( ! e.request.url.match(/^(http|https):\/\//i) )
215
- return;
216
-
217
- // Return if request url is from an external domain.
218
- if ( new URL(e.request.url).origin !== location.origin )
219
- return;
220
-
221
- // For POST requests, do not use the cache. Serve offline page if offline.
222
- if ( e.request.method !== 'GET' ) {
223
- e.respondWith(
224
- fetch(e.request).catch( function() {
225
- return caches.match(offlinePage);
226
- })
227
- );
228
- return;
229
- }
230
-
231
- // Revving strategy
232
- if ( e.request.mode === 'navigate' && navigator.onLine ) {
233
- e.respondWith(
234
- fetch(e.request).then(function(response) {
235
- return caches.open(cacheName).then(function(cache) {
236
- cache.put(e.request, response.clone());
237
- return response;
238
- });
239
- })
240
- );
241
- return;
242
- }
243
-
244
- e.respondWith(
245
- caches.match(e.request).then(function(response) {
246
- return response || fetch(e.request).then(function(response) {
247
- return caches.open(cacheName).then(function(cache) {
248
- cache.put(e.request, response.clone());
249
- return response;
250
- });
251
- });
252
- }).catch(function() {
253
- return caches.match(offlinePage);
254
- })
255
- );
256
- });
257
-
258
- // Check if current url is in the neverCacheUrls list
259
- function checkNeverCacheList(url) {
260
- if ( this.match(url) ) {
261
- return false;
262
- }
263
- return true;
264
- }
265
- <?php return apply_filters( 'superpwa_sw_template', ob_get_clean() );
266
- }
267
-
268
- /**
269
- * Register service worker
270
- *
271
- * @refer https://developers.google.com/web/fundamentals/primers/service-workers/registration#conclusion
272
- *
273
- * @since 1.0
274
- */
275
- function superpwa_register_sw() {
276
-
277
- wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
278
- wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', array(
279
- 'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
280
- )
281
- );
282
- }
283
- add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
284
-
285
- /**
286
- * Delete Service Worker
287
- *
288
- * @return true on success, false on failure
289
- *
290
- * @author Arun Basil Lal
291
- *
292
- * @since 1.0
293
- */
294
- function superpwa_delete_sw() {
295
- return superpwa_delete( superpwa_sw( 'abs' ) );
296
- }
297
-
298
- /**
299
- * Add images from offline page to filesToCache
300
- *
301
- * If the offlinePage set by the user contains images, they need to be cached during sw install.
302
- * For most websites, other assets (css, js) would be same as that of startPage which would be cached
303
- * when user visits the startPage the first time. If not superpwa_sw_files_to_cache filter can be used.
304
- *
305
- * @param (string) $files_to_cache Comma separated list of files to cache during service worker install
306
- *
307
- * @return (string) Comma separated list with image src's appended to $files_to_cache
308
- *
309
- * @since 1.9
310
- */
311
- function superpwa_offline_page_images( $files_to_cache ) {
312
-
313
- // Get Settings
314
- $settings = superpwa_get_settings();
315
-
316
- // Retrieve the post
317
- $post = get_post( $settings['offline_page'] );
318
-
319
- // Return if the offline page is set to default
320
- if( $post === NULL ) {
321
- return $files_to_cache;
322
- }
323
-
324
- // Match all images
325
- preg_match_all( '/<img[^>]+src="([^">]+)"/', $post->post_content, $matches );
326
-
327
- // $matches[1] will be an array with all the src's
328
- if( ! empty( $matches[1] ) ) {
329
- return superpwa_httpsify( $files_to_cache . ', \'' . implode( '\', \'', $matches[1] ) . '\'' );
330
- }
331
-
332
- return $files_to_cache;
333
- }
334
- add_filter( 'superpwa_sw_files_to_cache', 'superpwa_offline_page_images' );
335
-
336
- /**
337
- * Get offline page
338
- *
339
- * @return (string) the URL of the offline page.
340
- *
341
- * @author Arun Basil Lal
342
- *
343
- * @since 2.0.1
344
- */
345
- function superpwa_get_offline_page() {
346
-
347
- // Get Settings
348
- $settings = superpwa_get_settings();
349
-
350
- return get_permalink( $settings['offline_page'] ) ? superpwa_httpsify( get_permalink( $settings['offline_page'] ) ) : superpwa_httpsify( superpwa_get_bloginfo( 'sw' ) );
351
  }
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
+ // Start output buffer. Everything from here till ob_get_clean() is returned
159
+ ob_start(); ?>
160
+ 'use strict';
161
+
162
+ /**
163
+ * Service Worker of SuperPWA
164
+ * To learn more and add one to your website, visit - https://superpwa.com
165
+ */
166
+
167
+ const cacheName = '<?php echo parse_url( get_bloginfo( 'url' ), PHP_URL_HOST ) . '-superpwa-' . SUPERPWA_VERSION; ?>';
168
+ const startPage = '<?php echo superpwa_get_start_url(); ?>';
169
+ const offlinePage = '<?php echo superpwa_get_offline_page(); ?>';
170
+ const filesToCache = [<?php echo apply_filters( 'superpwa_sw_files_to_cache', 'startPage, offlinePage' ); ?>];
171
+ const neverCacheUrls = [<?php echo apply_filters( 'superpwa_sw_never_cache_urls', '/\/wp-admin/,/\/wp-login/,/preview=true/' ); ?>];
172
+
173
+ // Install
174
+ self.addEventListener('install', function(e) {
175
+ console.log('SuperPWA service worker installation');
176
+ e.waitUntil(
177
+ caches.open(cacheName).then(function(cache) {
178
+ console.log('SuperPWA service worker caching dependencies');
179
+ filesToCache.map(function(url) {
180
+ return cache.add(url).catch(function (reason) {
181
+ return console.log('SuperPWA: ' + String(reason) + ' ' + url);
182
+ });
183
+ });
184
+ })
185
+ );
186
+ });
187
+
188
+ // Activate
189
+ self.addEventListener('activate', function(e) {
190
+ console.log('SuperPWA service worker activation');
191
+ e.waitUntil(
192
+ caches.keys().then(function(keyList) {
193
+ return Promise.all(keyList.map(function(key) {
194
+ if ( key !== cacheName ) {
195
+ console.log('SuperPWA old cache removed', key);
196
+ return caches.delete(key);
197
+ }
198
+ }));
199
+ })
200
+ );
201
+ return self.clients.claim();
202
+ });
203
+
204
+ // Fetch
205
+ self.addEventListener('fetch', function(e) {
206
+
207
+ // Return if the current request url is in the never cache list
208
+ if ( ! neverCacheUrls.every(checkNeverCacheList, e.request.url) ) {
209
+ console.log( 'SuperPWA: Current request is excluded from cache.' );
210
+ return;
211
+ }
212
+
213
+ // Return if request url protocal isn't http or https
214
+ if ( ! e.request.url.match(/^(http|https):\/\//i) )
215
+ return;
216
+
217
+ // Return if request url is from an external domain.
218
+ if ( new URL(e.request.url).origin !== location.origin )
219
+ return;
220
+
221
+ // For POST requests, do not use the cache. Serve offline page if offline.
222
+ if ( e.request.method !== 'GET' ) {
223
+ e.respondWith(
224
+ fetch(e.request).catch( function() {
225
+ return caches.match(offlinePage);
226
+ })
227
+ );
228
+ return;
229
+ }
230
+
231
+ // Revving strategy
232
+ if ( e.request.mode === 'navigate' && navigator.onLine ) {
233
+ e.respondWith(
234
+ fetch(e.request).then(function(response) {
235
+ return caches.open(cacheName).then(function(cache) {
236
+ cache.put(e.request, response.clone());
237
+ return response;
238
+ });
239
+ })
240
+ );
241
+ return;
242
+ }
243
+
244
+ e.respondWith(
245
+ caches.match(e.request).then(function(response) {
246
+ return response || fetch(e.request).then(function(response) {
247
+ return caches.open(cacheName).then(function(cache) {
248
+ cache.put(e.request, response.clone());
249
+ return response;
250
+ });
251
+ });
252
+ }).catch(function() {
253
+ return caches.match(offlinePage);
254
+ })
255
+ );
256
+ });
257
+
258
+ // Check if current url is in the neverCacheUrls list
259
+ function checkNeverCacheList(url) {
260
+ if ( this.match(url) ) {
261
+ return false;
262
+ }
263
+ return true;
264
+ }
265
+ <?php return apply_filters( 'superpwa_sw_template', ob_get_clean() );
266
+ }
267
+
268
+ /**
269
+ * Register service worker
270
+ *
271
+ * @refer https://developers.google.com/web/fundamentals/primers/service-workers/registration#conclusion
272
+ *
273
+ * @since 1.0
274
+ */
275
+ function superpwa_register_sw() {
276
+
277
+ wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
278
+ wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', array(
279
+ 'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
280
+ )
281
+ );
282
+ }
283
+ add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
284
+
285
+ /**
286
+ * Delete Service Worker
287
+ *
288
+ * @return true on success, false on failure
289
+ *
290
+ * @author Arun Basil Lal
291
+ *
292
+ * @since 1.0
293
+ */
294
+ function superpwa_delete_sw() {
295
+ return superpwa_delete( superpwa_sw( 'abs' ) );
296
+ }
297
+
298
+ /**
299
+ * Add images from offline page to filesToCache
300
+ *
301
+ * If the offlinePage set by the user contains images, they need to be cached during sw install.
302
+ * For most websites, other assets (css, js) would be same as that of startPage which would be cached
303
+ * when user visits the startPage the first time. If not superpwa_sw_files_to_cache filter can be used.
304
+ *
305
+ * @param (string) $files_to_cache Comma separated list of files to cache during service worker install
306
+ *
307
+ * @return (string) Comma separated list with image src's appended to $files_to_cache
308
+ *
309
+ * @since 1.9
310
+ */
311
+ function superpwa_offline_page_images( $files_to_cache ) {
312
+
313
+ // Get Settings
314
+ $settings = superpwa_get_settings();
315
+
316
+ // Retrieve the post
317
+ $post = get_post( $settings['offline_page'] );
318
+
319
+ // Return if the offline page is set to default
320
+ if( $post === NULL ) {
321
+ return $files_to_cache;
322
+ }
323
+
324
+ // Match all images
325
+ preg_match_all( '/<img[^>]+src="([^">]+)"/', $post->post_content, $matches );
326
+
327
+ // $matches[1] will be an array with all the src's
328
+ if( ! empty( $matches[1] ) ) {
329
+ return superpwa_httpsify( $files_to_cache . ', \'' . implode( '\', \'', $matches[1] ) . '\'' );
330
+ }
331
+
332
+ return $files_to_cache;
333
+ }
334
+ add_filter( 'superpwa_sw_files_to_cache', 'superpwa_offline_page_images' );
335
+
336
+ /**
337
+ * Get offline page
338
+ *
339
+ * @return (string) the URL of the offline page.
340
+ *
341
+ * @author Arun Basil Lal
342
+ *
343
+ * @since 2.0.1
344
+ */
345
+ function superpwa_get_offline_page() {
346
+
347
+ // Get Settings
348
+ $settings = superpwa_get_settings();
349
+
350
+ return get_permalink( $settings['offline_page'] ) ? superpwa_httpsify( get_permalink( $settings['offline_page'] ) ) : superpwa_httpsify( superpwa_get_bloginfo( 'sw' ) );
351
  }
readme.txt CHANGED
@@ -1,435 +1,438 @@
1
- === Super Progressive Web Apps ===
2
- Contributors: superpwa, arunbasillal, josevarghese
3
- Donate link: http://millionclues.com/donate/
4
- Tags: pwa, progressive web apps, manifest, web manifest, android app, chrome app, add to homescreen, mobile web
5
- Requires at least: 3.6.0
6
- Tested up to: 5.4.2
7
- Requires PHP: 5.3
8
- Stable tag: trunk
9
- License: GPLv2 or later
10
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- SuperPWA helps you convert your WordPress website into a Progressive Web App instantly.
13
-
14
- == Description ==
15
-
16
- > **Help decide on the future of SuperPWA**
17
- > We are looking for your input to decide on the future of SuperPWA. If you wish to acquire SuperPWA as a whole and continue it's development or if you are interested in a premium version of the plugin with extended features, [please fill in the form and let us know](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=description-future).
18
-
19
- 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.
20
-
21
- 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!
22
-
23
- Super Progressive Web Apps makes it easy for you to convert your WordPress website into a Progressive Web App instantly!
24
-
25
- 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!
26
-
27
- 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.
28
-
29
- 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!
30
-
31
- #### Quick Demo?
32
-
33
- * Open up [SuperPWA.com](https://superpwa.com/?utm_source=wordpress.org&utm_medium=description-demo) in a supported device.
34
- * Add the website to your home screen either from the Add to Home Screen prompt (Chrome for Android) or from the browser menu.
35
- * Open the app from your home screen and you will see the splash screen.
36
- * 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.
37
- * Browse to a page that you haven't visited before. The offline page will be displayed.
38
-
39
- #### Thank You PWA Enthusiasts!
40
-
41
- 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!
42
-
43
- ### What's in the box
44
-
45
- Here are the current features of Super Progressive Web Apps:
46
-
47
- * Generate a manifest for your website and add it to the head of your website.
48
- * Set the application icon for your Progressive Web App.
49
- * Set the background color for the splash screen of your Progressive Web App.
50
- * Your website will show the "Add to home screen" notice when accessed in a supported browser.
51
- * Aggressive caching of pages using CacheStorage API.
52
- * Pages once cached are served even if the user is offline.
53
- * 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.
54
- * 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.
55
- * New in version 1.2: Now you can edit the Application Name and Application Short name.
56
- * New in version 1.2: Set the start page of your PWA.
57
- * 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.
58
- * 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.
59
- * New in version 1.3: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
60
- * New in version 1.3: Improved in-browser service worker update handling.
61
- * New in version 1.4: You can now set the default orientation of your PWA. Choose from "any" (Follow Device Orientation), "Portrait" and "Landscape".
62
- * New in version 1.4: You can now set the theme_color property in the manifest.
63
- * New in version 1.5: OneSignal integration for Push notifications.
64
- * New in version 1.6: WordPress Multisite Network compatibility.
65
- * 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.
66
- * New in version 1.8: Compatibility issues with OneSignal are now resolved!
67
- * 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.
68
- * New in version 2.0: SuperPWA is now compatible with WordPress installed in a sub-folder.
69
- * 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.
70
- * New in version 2.1.1: SuperPWA now supports Maskable Icons.
71
-
72
- **Upcoming features:**
73
-
74
- * Offline Indicator Notice.
75
-
76
- ### Progressive Web App Minimum Requirements
77
-
78
- 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.
79
-
80
- ### Device and Browser Support For PWA
81
-
82
- 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.
83
-
84
- The list is fast growing and is likely to be supported in most major browsers by the end of this year.
85
-
86
- ### How To Convert Your WordPress Website Into A Progressive Web App
87
-
88
- #### WordPress Installation
89
-
90
- * Visit WordPress Admin > Plugins > Add New
91
- * Search for 'Super Progressive Web Apps'
92
- * Click "Install Now" and then "Activate" Super Progressive Web Apps
93
-
94
- To install manually:
95
-
96
- * Upload super-progressive-web-apps folder to the /wp-content/plugins/ directory on your server
97
- * Go to WordPress Admin > Plugins
98
- * Activate Super Progressive Web Apps plugin from the list.
99
-
100
- #### Customizing Your Progressive Web App
101
-
102
- 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.
103
-
104
- * Go to WordPress Admin > SuperPWA
105
- * Set a Background Color for the splash screen to be shown when your PWA is opened on a mobile device.
106
- * 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.
107
- * 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.".
108
- * Click "Save Settings".
109
-
110
- #### Testing Your Progressive Web App
111
-
112
- * Open a supported browser in a supported device (for eg: Chrome for Android (62 or higher) in an Android Phone)
113
- * Enter your website and wait till it fully loads
114
- * You should see a pop-up that has your Application Icon and a button that reads "ADD TO HOME SCREEN".
115
- * Click on it and your PWA will be added to your home screen. Wait for the install to complete.
116
- * Go to your home screen and open your PWA. Browse into a few pages if you like. Close the App.
117
- * Disconnect from the internet and now open your PWA again. You should be able to see all the pages that you previously browsed.
118
- * 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.
119
-
120
- #### Troubleshooting Your Progressive Web App
121
-
122
- Uh, oh. Your PWA did not work as expected? You do not see the "Add to Home Screen" notice?
123
-
124
- * 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).
125
- * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
126
- * 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.
127
- * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
128
- * 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.)
129
- * 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.
130
-
131
- ### Feature Requests, Issues, Pull Requests
132
-
133
- 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.
134
-
135
- ### About us
136
-
137
- 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.
138
-
139
- 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.
140
-
141
- Please give us your constructive feedback and support.
142
-
143
- == Installation ==
144
-
145
- To install this plugin:
146
-
147
- 1. Install the plugin through the WordPress admin interface, or upload the plugin folder to /wp-content/plugins/ using FTP.
148
- 2. Activate the plugin through the 'Plugins' screen in WordPress.
149
- 3. Go to WordPress Admin > SuperPWA
150
-
151
- == Frequently Asked Questions ==
152
-
153
- If you have any questions, please ask it on the [support forum](https://wordpress.org/support/plugin/super-progressive-web-apps).
154
-
155
- = Will Progressive Web Apps work on iOS devices? =
156
-
157
- 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 ).
158
-
159
- Just like you, we are eagerly awaiting the upcoming releases and we hope to see better compatibility in the coming months.
160
-
161
- = How To Customize Splash Screen =
162
-
163
- You can easily change the icon and the background color in SuperPWA > Settings.
164
-
165
- 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.
166
-
167
- = How To Track Visits Originating From Your Progressive Web App =
168
-
169
- 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.
170
-
171
- = GDPR Compliance =
172
-
173
- 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.
174
-
175
- 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.
176
-
177
- Feel free to get in touch if you have any questions.
178
-
179
- == Screenshots ==
180
-
181
- 1. Settings page in WordPress Admin > SuperPWA > Settings
182
-
183
- == Changelog ==
184
-
185
- = 2.1.2 =
186
- * Date: [25.July.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
187
- * Bug Fix: Fixed issue where Application Icon was not showing.
188
-
189
- = 2.1.1 =
190
- * Date: [4.July.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
191
- * Tested with WordPress 5.4.2.
192
- * Enhancement: Added support for Maskable Icons [#127](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/127)
193
-
194
- = 2.1 =
195
- * Date: [29.May.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
196
- * Tested with WordPress 5.4.1.
197
- * Enhancement: Removed the WordPress admin notice suggesting to add SuperPWA manifest to OneSignal. [#114] (https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/114)
198
- * Enhancement: Updated fallback value in superpwa_get_display() to match the default value in superpwa_get_settings().
199
- * Enhancement: UTM Tracking Add-on: Added default values for Campaign Medium and Campaign Name.
200
- * 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)
201
- * 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)
202
-
203
- = 2.0.2 =
204
- * Date: 16.January.2019
205
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
206
-
207
- = 2.0.1 =
208
- * Date: [15.January.2019](https://superpwa.com/superpwa-2-0/?utm_source=wordpress.org&utm_medium=changelog#2.0.1)
209
- * Enhancement: Added compatibility for setups where dynamic files are not supported.
210
-
211
- = 2.0 =
212
- * Date: [28.December.2018](https://superpwa.com/superpwa-2-0/?utm_source=wordpress.org&utm_medium=changelog)
213
- * Tested with WordPress 5.0.2.
214
- * Enhancement: Dynamic service worker and manifest.
215
- * Enhancement: SuperPWA is now compatible with WordPress in a sub-folder.
216
- * 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.
217
- * Enhancement: Limit short_name to 12 characters to meet Lighthouse recommendation.
218
- * Enhancement: Added PHP CodeSniffer to stick to "WordPress-Extra" coding standards. Thanks Daniel for the work.
219
- * 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/).
220
-
221
- = 1.9 =
222
- * Date: [25.July.2018](https://superpwa.com/superpwa-1-9-chrome-mini-infobar-ready/?utm_source=wordpress.org&utm_medium=changelog)
223
- * Tested with WordPress 4.9.7.
224
- * Enhancement: Added compatibility with Google Chrome 68 Mini Info-Bar.
225
- * 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.
226
- * Enhancement: Added support for images in offline page. Images added to offline page are now cached during service worker activation.
227
- * Enhancement: Improved the service worker installation routine to handle invalid entities in the service worker dependencies.
228
- * 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/).
229
- * Bug Fix: Fixed issue where translation files in /languages/ folder was not being loaded.
230
-
231
- = 1.8.1 =
232
- * Date: [05.June.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog#1.8.1)
233
- * 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).
234
- * Enhancement: Updated console log message for URLs excluded from cache for better clarity.
235
-
236
- = 1.8 =
237
- * Date: [31.May.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog)
238
- * Tested with WordPress 4.9.6.
239
- * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
240
- * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
241
- * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
242
- * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
243
- * 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)
244
- * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
245
- * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
246
-
247
- = 1.7.1 =
248
- * Date: 05.May.2018
249
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
250
-
251
- = 1.7 =
252
- * Date: [03.May.2018](https://superpwa.com/introducing-add-ons-for-superpwa/?utm_source=wordpress.org&utm_medium=changelog)
253
- * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
254
- * New Feature: Add-Ons for SuperPWA is here!
255
- * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
256
- * 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).
257
- * Enhancement: Service worker URLs are now relative to accommodate for domain mapped Multisites.
258
- * Bug Fix: Incorrect start_url when WordPress is installed in a folder, or when inner pages are used as start_url.
259
- * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
260
-
261
- = 1.6 =
262
- * Date: [23.April.2018](https://superpwa.com/1-6-released-multisite-network-support/?utm_source=wordpress.org&utm_medium=changelog)
263
- * 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.
264
- * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
265
- * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
266
- * Enhancement: Improved the file and folder naming, organization, and inline documentation for better readability.
267
- * Enhancement: Force https:// on all assets and dependencies solving the problem of http:// URLs in manifest and service worker once and for all.
268
- * Enhancement: Relative URL for manifest for out of the box compatibility with CDN's.
269
- * Enhancement: Removed forcing of trailing slash on manifest and service worker URLs for better compatibility.
270
-
271
- = 1.5 =
272
- * Date: 18.March.2018
273
- * New Feature: OneSignal integration for Push notifications.
274
- * Enhancement: Moved manifest to the top of wp_head for easier detection by browsers.
275
- * Enhancement: Added support for custom AMP endpoints for AMP for WordPress and AMP for WP.
276
- * 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.
277
-
278
- = 1.4 =
279
- * Date: [21.February.2018](https://wordpress.org/support/topic/you-asked-and-we-listened-superpwa-1-4-ships-with-two-user-feature-requests/)
280
- * 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/).
281
- * 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/).
282
- * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
283
- * Enhancement: Improved handling of external resources.
284
-
285
- = 1.3.1 =
286
- * Date: 15.February.2018
287
- * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
288
- * Enhancement: Improved how start_url is handled in the manifest.
289
- * Enhancement: Better handling of external resources.
290
-
291
- = 1.3 =
292
- * Date: 10.February.2018
293
- * 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.
294
- * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
295
- * Enhancement: Improved in-browser service worker update handling.
296
- * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
297
- * Bug Fix: Only GET requests are served from the cache now. Fixes [this](https://wordpress.org/support/topic/errors-in-firefox-and-chrome/).
298
-
299
- = 1.2 =
300
- * Date: 06.February.2018
301
- * New Feature: Support for theme-color.
302
- * New Feature: Now you can edit the Application Name and Application Short name.
303
- * New Feature: Set the start page of your PWA.
304
- * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
305
- * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
306
- * UI Improvement: Added admin notice with a link to settings page on plugin activation.
307
- * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
308
- * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
309
-
310
- = 1.1.1 =
311
- * Date: 30.January.2018
312
- * 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."
313
-
314
- = 1.1 =
315
- * Date: 28.January.2018
316
- * New Feature: Aggressive caching of pages using CacheStorage API.
317
- * New Feature: Pages once cached are served even if the user is offline.
318
- * 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.
319
-
320
- = 1.0 =
321
- * Date: 22.January.2018
322
- * First release of the plugin.
323
-
324
- == Upgrade Notice ==
325
-
326
- = 2.1 =
327
- * Tested with WordPress 5.4.1.
328
- * Enhancement: Removed the WordPress admin notice suggesting to add SuperPWA manifest to OneSignal.
329
- * Enhancement: Updated fallback value in superpwa_get_display() to match the default value in superpwa_get_settings().
330
- * Enhancement: UTM Tracking Add-on: Added default values for Campaign Medium and Campaign Name.
331
- * Bug Fix: Fixed a rare PHP Notice: Array to string conversion in basic-setup.php on line 415.
332
- * Bug Fix: Added a check to see if WP_Plugins_List_Table class is available before using it.
333
-
334
- = 2.0.2 =
335
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
336
-
337
- = 2.0.1 =
338
- * Enhancement: Added compatibility for setups where dynamic files are not supported.
339
-
340
- = 2.0 =
341
- * Tested with WordPress 5.0.2.
342
- * Enhancement: Dynamic service worker and manifest.
343
- * Enhancement: SuperPWA is now compatible with WordPress in a sub-folder.
344
- * Enhancement: Added UI to set Display property in the web app manifest.
345
- * Enhancement: Limit short_name to 12 characters to meet Lighthouse recommendation.
346
- * Enhancement: Added PHP CodeSniffer to stick to "WordPress-Extra" coding standards. Thanks Daniel for the work.
347
- * Enhancement: SuperPWA is available in 12 languages now, thanks to the awesome translators! Translators are credited in the release note.
348
-
349
- = 1.9 =
350
- * Tested with WordPress 4.9.7.
351
- * Enhancement: Added compatibility with Google Chrome 68 Mini Info-Bar.
352
- * 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.
353
- * Enhancement: Added support for images in offline page. Images added to offline page are now cached during service worker activation.
354
- * Enhancement: Improved the service worker installation routine to handle invalid entities in the service worker dependencies.
355
- * Enhancement: SuperPWA is now translated to French, thanks to @romainvincent and Spanish, thanks to @arkangel.
356
- * Bug Fix: Fixed issue where translation files in /languages/ folder was not being loaded.
357
-
358
- = 1.8.1 =
359
- * Enhancement: Added an admin notice with instructions for OneSignal integration.
360
- * Enhancement: Updated console log message for URLs excluded from cache for better clarity.
361
-
362
- = 1.8 =
363
- * Tested with WordPress 4.9.6.
364
- * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
365
- * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
366
- * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
367
- * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
368
- * 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
369
- * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
370
- * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
371
-
372
- = 1.7.1 =
373
- * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
374
-
375
- = 1.7 =
376
- * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
377
- * New Feature: Add-Ons for SuperPWA is here!
378
- * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
379
- * 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).
380
- * Enhancement: Service worker URLs are now relative to accommodate for domain mapped Multisites.
381
- * Bug Fix: Incorrect start_url when WordPress is installed in a folder, or when inner pages are used as start_url.
382
- * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
383
-
384
- = 1.6 =
385
- * 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.
386
- * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
387
- * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
388
- * Enhancement: Improved the file and folder naming, organization, and inline documentation for better readability.
389
- * Enhancement: Force https:// on all assets and dependencies solving the problem of http:// URLs in manifest and service worker once and for all.
390
- * Enhancement: Relative URL for manifest for out of the box compatibility with CDN's.
391
- * Enhancement: Removed forcing of trailing slash on manifest and service worker URLs for better compatibility.
392
-
393
- = 1.5 =
394
- * New Feature: OneSignal integration for Push notifications.
395
- * Enhancement: Moved manifest to the top of wp_head for easier detection by browsers.
396
- * Enhancement: Added support for custom AMP endpoints for AMP for WordPress and AMP for WP.
397
- * 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.
398
-
399
- = 1.4 =
400
- * New Feature: Added UI for default orientation of your PWA. Orientation can now be set as "any", "portrait" or "landscape".
401
- * New Feature: Added UI for theme_color property in manifest.
402
- * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
403
- * Enhancement: Improved handling of external resources.
404
-
405
- = 1.3.1 =
406
- * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
407
- * Enhancement: Improved how start_url is handled in the manifest.
408
- * Enhancement: Better handling of external resources.
409
-
410
- = 1.3 =
411
- * 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.
412
- * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
413
- * Enhancement: Improved in-browser service worker update handling.
414
- * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
415
-
416
- = 1.2 =
417
- * New Feature: Support for theme-color.
418
- * New Feature: Now you can edit the Application Name and Application Short name.
419
- * New Feature: Set the start page of your PWA.
420
- * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
421
- * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
422
- * UI Improvement: Added admin notice with a link to settings page on plugin activation.
423
- * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
424
- * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
425
-
426
- = 1.1.1 =
427
- * 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."
428
-
429
- = 1.1 =
430
- * New Feature: Aggressive caching of pages using CacheStorage API.
431
- * New Feature: Pages once cached are served even if the user is offline.
432
- * 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.
433
-
434
- = 1.0 =
435
- * 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: 5.5
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
+ > **Help decide on the future of SuperPWA**
16
+ > We are looking for your input to decide on the future of SuperPWA. If you wish to acquire SuperPWA as a whole and continue it's development or if you are interested in a premium version of the plugin with extended features, [please fill in the form and let us know](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=description-future).
17
+
18
+ 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.
19
+
20
+ 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!
21
+
22
+ Super Progressive Web Apps makes it easy for you to convert your WordPress website into a Progressive Web App instantly!
23
+
24
+ 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!
25
+
26
+ 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.
27
+
28
+ 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!
29
+
30
+ #### Quick Demo?
31
+
32
+ * Open up [SuperPWA.com](https://superpwa.com/?utm_source=wordpress.org&utm_medium=description-demo) in a supported device.
33
+ * Add the website to your home screen either from the Add to Home Screen prompt (Chrome for Android) or from the browser menu.
34
+ * Open the app from your home screen and you will see the splash screen.
35
+ * 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.
36
+ * Browse to a page that you haven't visited before. The offline page will be displayed.
37
+
38
+ #### Thank You PWA Enthusiasts!
39
+
40
+ 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!
41
+
42
+ ### What's in the box
43
+
44
+ Here are the current features of Super Progressive Web Apps:
45
+
46
+ * Generate a manifest for your website and add it to the head of your website.
47
+ * Set the application icon for your Progressive Web App.
48
+ * Set the background color for the splash screen of your Progressive Web App.
49
+ * Your website will show the "Add to home screen" notice when accessed in a supported browser.
50
+ * Aggressive caching of pages using CacheStorage API.
51
+ * Pages once cached are served even if the user is offline.
52
+ * 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.
53
+ * 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.
54
+ * New in version 1.2: Now you can edit the Application Name and Application Short name.
55
+ * New in version 1.2: Set the start page of your PWA.
56
+ * 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.
57
+ * 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.
58
+ * New in version 1.3: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
59
+ * New in version 1.3: Improved in-browser service worker update handling.
60
+ * New in version 1.4: You can now set the default orientation of your PWA. Choose from "any" (Follow Device Orientation), "Portrait" and "Landscape".
61
+ * New in version 1.4: You can now set the theme_color property in the manifest.
62
+ * New in version 1.5: OneSignal integration for Push notifications.
63
+ * New in version 1.6: WordPress Multisite Network compatibility.
64
+ * 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.
65
+ * New in version 1.8: Compatibility issues with OneSignal are now resolved!
66
+ * 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.
67
+ * New in version 2.0: SuperPWA is now compatible with WordPress installed in a sub-folder.
68
+ * 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.
69
+ * New in version 2.1.1: SuperPWA now supports Maskable Icons.
70
+
71
+ **Upcoming features:**
72
+
73
+ * Offline Indicator Notice.
74
+
75
+ ### Progressive Web App Minimum Requirements
76
+
77
+ 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.
78
+
79
+ ### Device and Browser Support For PWA
80
+
81
+ 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.
82
+
83
+ The list is fast growing and is likely to be supported in most major browsers by the end of this year.
84
+
85
+ ### How To Convert Your WordPress Website Into A Progressive Web App
86
+
87
+ #### WordPress Installation
88
+
89
+ * Visit WordPress Admin > Plugins > Add New
90
+ * Search for 'Super Progressive Web Apps'
91
+ * Click "Install Now" and then "Activate" Super Progressive Web Apps
92
+
93
+ To install manually:
94
+
95
+ * Upload super-progressive-web-apps folder to the /wp-content/plugins/ directory on your server
96
+ * Go to WordPress Admin > Plugins
97
+ * Activate Super Progressive Web Apps plugin from the list.
98
+
99
+ #### Customizing Your Progressive Web App
100
+
101
+ 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.
102
+
103
+ * Go to WordPress Admin > SuperPWA
104
+ * Set a Background Color for the splash screen to be shown when your PWA is opened on a mobile device.
105
+ * 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.
106
+ * 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.".
107
+ * Click "Save Settings".
108
+
109
+ #### Testing Your Progressive Web App
110
+
111
+ * Open a supported browser in a supported device (for eg: Chrome for Android (62 or higher) in an Android Phone)
112
+ * Enter your website and wait till it fully loads
113
+ * You should see a pop-up that has your Application Icon and a button that reads "ADD TO HOME SCREEN".
114
+ * Click on it and your PWA will be added to your home screen. Wait for the install to complete.
115
+ * Go to your home screen and open your PWA. Browse into a few pages if you like. Close the App.
116
+ * Disconnect from the internet and now open your PWA again. You should be able to see all the pages that you previously browsed.
117
+ * 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.
118
+
119
+ #### Troubleshooting Your Progressive Web App
120
+
121
+ Uh, oh. Your PWA did not work as expected? You do not see the "Add to Home Screen" notice?
122
+
123
+ * 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).
124
+ * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
125
+ * 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.
126
+ * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
127
+ * 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.)
128
+ * 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.
129
+
130
+ ### Feature Requests, Issues, Pull Requests
131
+
132
+ 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.
133
+
134
+ ### About us
135
+
136
+ 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.
137
+
138
+ 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.
139
+
140
+ Please give us your constructive feedback and support.
141
+
142
+ == Installation ==
143
+
144
+ To install this plugin:
145
+
146
+ 1. Install the plugin through the WordPress admin interface, or upload the plugin folder to /wp-content/plugins/ using FTP.
147
+ 2. Activate the plugin through the 'Plugins' screen in WordPress.
148
+ 3. Go to WordPress Admin > SuperPWA
149
+
150
+ == Frequently Asked Questions ==
151
+
152
+ If you have any questions, please ask it on the [support forum](https://wordpress.org/support/plugin/super-progressive-web-apps).
153
+
154
+ = Will Progressive Web Apps work on iOS devices? =
155
+
156
+ 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 ).
157
+
158
+ Just like you, we are eagerly awaiting the upcoming releases and we hope to see better compatibility in the coming months.
159
+
160
+ = How To Customize Splash Screen =
161
+
162
+ You can easily change the icon and the background color in SuperPWA > Settings.
163
+
164
+ 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.
165
+
166
+ = How To Track Visits Originating From Your Progressive Web App =
167
+
168
+ 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.
169
+
170
+ = GDPR Compliance =
171
+
172
+ 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.
173
+
174
+ 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.
175
+
176
+ Feel free to get in touch if you have any questions.
177
+
178
+ == Screenshots ==
179
+
180
+ 1. Settings page in WordPress Admin > SuperPWA > Settings
181
+
182
+ == Changelog ==
183
+
184
+ = 2.1.3 =
185
+ Improvement: Changes in Admin Options
186
+ Enhancement: Added more pages
187
+
188
+ = 2.1.2 =
189
+ * Date: [25.July.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
190
+ * Bug Fix: Fixed issue where Application Icon was not showing.
191
+
192
+ = 2.1.1 =
193
+ * Date: [4.July.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
194
+ * Tested with WordPress 5.4.2.
195
+ * Enhancement: Added support for Maskable Icons [#127](https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/127)
196
+
197
+ = 2.1 =
198
+ * Date: [29.May.2020](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
199
+ * Tested with WordPress 5.4.1.
200
+ * Enhancement: Removed the WordPress admin notice suggesting to add SuperPWA manifest to OneSignal. [#114] (https://github.com/SuperPWA/Super-Progressive-Web-Apps/issues/114)
201
+ * Enhancement: Updated fallback value in superpwa_get_display() to match the default value in superpwa_get_settings().
202
+ * Enhancement: UTM Tracking Add-on: Added default values for Campaign Medium and Campaign Name.
203
+ * 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)
204
+ * 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)
205
+
206
+ = 2.0.2 =
207
+ * Date: 16.January.2019
208
+ * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
209
+
210
+ = 2.0.1 =
211
+ * Date: [15.January.2019](https://superpwa.com/superpwa-2-0/?utm_source=wordpress.org&utm_medium=changelog#2.0.1)
212
+ * Enhancement: Added compatibility for setups where dynamic files are not supported.
213
+
214
+ = 2.0 =
215
+ * Date: [28.December.2018](https://superpwa.com/superpwa-2-0/?utm_source=wordpress.org&utm_medium=changelog)
216
+ * Tested with WordPress 5.0.2.
217
+ * Enhancement: Dynamic service worker and manifest.
218
+ * Enhancement: SuperPWA is now compatible with WordPress in a sub-folder.
219
+ * 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.
220
+ * Enhancement: Limit short_name to 12 characters to meet Lighthouse recommendation.
221
+ * Enhancement: Added PHP CodeSniffer to stick to "WordPress-Extra" coding standards. Thanks Daniel for the work.
222
+ * 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/).
223
+
224
+ = 1.9 =
225
+ * Date: [25.July.2018](https://superpwa.com/superpwa-1-9-chrome-mini-infobar-ready/?utm_source=wordpress.org&utm_medium=changelog)
226
+ * Tested with WordPress 4.9.7.
227
+ * Enhancement: Added compatibility with Google Chrome 68 Mini Info-Bar.
228
+ * 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.
229
+ * Enhancement: Added support for images in offline page. Images added to offline page are now cached during service worker activation.
230
+ * Enhancement: Improved the service worker installation routine to handle invalid entities in the service worker dependencies.
231
+ * 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/).
232
+ * Bug Fix: Fixed issue where translation files in /languages/ folder was not being loaded.
233
+
234
+ = 1.8.1 =
235
+ * Date: [05.June.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog#1.8.1)
236
+ * 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).
237
+ * Enhancement: Updated console log message for URLs excluded from cache for better clarity.
238
+
239
+ = 1.8 =
240
+ * Date: [31.May.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog)
241
+ * Tested with WordPress 4.9.6.
242
+ * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
243
+ * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
244
+ * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
245
+ * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
246
+ * 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)
247
+ * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
248
+ * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
249
+
250
+ = 1.7.1 =
251
+ * Date: 05.May.2018
252
+ * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
253
+
254
+ = 1.7 =
255
+ * Date: [03.May.2018](https://superpwa.com/introducing-add-ons-for-superpwa/?utm_source=wordpress.org&utm_medium=changelog)
256
+ * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
257
+ * New Feature: Add-Ons for SuperPWA is here!
258
+ * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
259
+ * 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).
260
+ * Enhancement: Service worker URLs are now relative to accommodate for domain mapped Multisites.
261
+ * Bug Fix: Incorrect start_url when WordPress is installed in a folder, or when inner pages are used as start_url.
262
+ * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
263
+
264
+ = 1.6 =
265
+ * Date: [23.April.2018](https://superpwa.com/1-6-released-multisite-network-support/?utm_source=wordpress.org&utm_medium=changelog)
266
+ * 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.
267
+ * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
268
+ * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
269
+ * Enhancement: Improved the file and folder naming, organization, and inline documentation for better readability.
270
+ * Enhancement: Force https:// on all assets and dependencies solving the problem of http:// URLs in manifest and service worker once and for all.
271
+ * Enhancement: Relative URL for manifest for out of the box compatibility with CDN's.
272
+ * Enhancement: Removed forcing of trailing slash on manifest and service worker URLs for better compatibility.
273
+
274
+ = 1.5 =
275
+ * Date: 18.March.2018
276
+ * New Feature: OneSignal integration for Push notifications.
277
+ * Enhancement: Moved manifest to the top of wp_head for easier detection by browsers.
278
+ * Enhancement: Added support for custom AMP endpoints for AMP for WordPress and AMP for WP.
279
+ * 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.
280
+
281
+ = 1.4 =
282
+ * Date: [21.February.2018](https://wordpress.org/support/topic/you-asked-and-we-listened-superpwa-1-4-ships-with-two-user-feature-requests/)
283
+ * 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/).
284
+ * 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/).
285
+ * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
286
+ * Enhancement: Improved handling of external resources.
287
+
288
+ = 1.3.1 =
289
+ * Date: 15.February.2018
290
+ * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
291
+ * Enhancement: Improved how start_url is handled in the manifest.
292
+ * Enhancement: Better handling of external resources.
293
+
294
+ = 1.3 =
295
+ * Date: 10.February.2018
296
+ * 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.
297
+ * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
298
+ * Enhancement: Improved in-browser service worker update handling.
299
+ * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
300
+ * Bug Fix: Only GET requests are served from the cache now. Fixes [this](https://wordpress.org/support/topic/errors-in-firefox-and-chrome/).
301
+
302
+ = 1.2 =
303
+ * Date: 06.February.2018
304
+ * New Feature: Support for theme-color.
305
+ * New Feature: Now you can edit the Application Name and Application Short name.
306
+ * New Feature: Set the start page of your PWA.
307
+ * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
308
+ * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
309
+ * UI Improvement: Added admin notice with a link to settings page on plugin activation.
310
+ * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
311
+ * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
312
+
313
+ = 1.1.1 =
314
+ * Date: 30.January.2018
315
+ * 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."
316
+
317
+ = 1.1 =
318
+ * Date: 28.January.2018
319
+ * New Feature: Aggressive caching of pages using CacheStorage API.
320
+ * New Feature: Pages once cached are served even if the user is offline.
321
+ * 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.
322
+
323
+ = 1.0 =
324
+ * Date: 22.January.2018
325
+ * First release of the plugin.
326
+
327
+ == Upgrade Notice ==
328
+
329
+ = 2.1 =
330
+ * Tested with WordPress 5.4.1.
331
+ * Enhancement: Removed the WordPress admin notice suggesting to add SuperPWA manifest to OneSignal.
332
+ * Enhancement: Updated fallback value in superpwa_get_display() to match the default value in superpwa_get_settings().
333
+ * Enhancement: UTM Tracking Add-on: Added default values for Campaign Medium and Campaign Name.
334
+ * Bug Fix: Fixed a rare PHP Notice: Array to string conversion in basic-setup.php on line 415.
335
+ * Bug Fix: Added a check to see if WP_Plugins_List_Table class is available before using it.
336
+
337
+ = 2.0.2 =
338
+ * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
339
+
340
+ = 2.0.1 =
341
+ * Enhancement: Added compatibility for setups where dynamic files are not supported.
342
+
343
+ = 2.0 =
344
+ * Tested with WordPress 5.0.2.
345
+ * Enhancement: Dynamic service worker and manifest.
346
+ * Enhancement: SuperPWA is now compatible with WordPress in a sub-folder.
347
+ * Enhancement: Added UI to set Display property in the web app manifest.
348
+ * Enhancement: Limit short_name to 12 characters to meet Lighthouse recommendation.
349
+ * Enhancement: Added PHP CodeSniffer to stick to "WordPress-Extra" coding standards. Thanks Daniel for the work.
350
+ * Enhancement: SuperPWA is available in 12 languages now, thanks to the awesome translators! Translators are credited in the release note.
351
+
352
+ = 1.9 =
353
+ * Tested with WordPress 4.9.7.
354
+ * Enhancement: Added compatibility with Google Chrome 68 Mini Info-Bar.
355
+ * 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.
356
+ * Enhancement: Added support for images in offline page. Images added to offline page are now cached during service worker activation.
357
+ * Enhancement: Improved the service worker installation routine to handle invalid entities in the service worker dependencies.
358
+ * Enhancement: SuperPWA is now translated to French, thanks to @romainvincent and Spanish, thanks to @arkangel.
359
+ * Bug Fix: Fixed issue where translation files in /languages/ folder was not being loaded.
360
+
361
+ = 1.8.1 =
362
+ * Enhancement: Added an admin notice with instructions for OneSignal integration.
363
+ * Enhancement: Updated console log message for URLs excluded from cache for better clarity.
364
+
365
+ = 1.8 =
366
+ * Tested with WordPress 4.9.6.
367
+ * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
368
+ * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
369
+ * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
370
+ * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
371
+ * 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
372
+ * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
373
+ * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
374
+
375
+ = 1.7.1 =
376
+ * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
377
+
378
+ = 1.7 =
379
+ * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
380
+ * New Feature: Add-Ons for SuperPWA is here!
381
+ * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
382
+ * 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).
383
+ * Enhancement: Service worker URLs are now relative to accommodate for domain mapped Multisites.
384
+ * Bug Fix: Incorrect start_url when WordPress is installed in a folder, or when inner pages are used as start_url.
385
+ * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
386
+
387
+ = 1.6 =
388
+ * 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.
389
+ * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
390
+ * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
391
+ * Enhancement: Improved the file and folder naming, organization, and inline documentation for better readability.
392
+ * Enhancement: Force https:// on all assets and dependencies solving the problem of http:// URLs in manifest and service worker once and for all.
393
+ * Enhancement: Relative URL for manifest for out of the box compatibility with CDN's.
394
+ * Enhancement: Removed forcing of trailing slash on manifest and service worker URLs for better compatibility.
395
+
396
+ = 1.5 =
397
+ * New Feature: OneSignal integration for Push notifications.
398
+ * Enhancement: Moved manifest to the top of wp_head for easier detection by browsers.
399
+ * Enhancement: Added support for custom AMP endpoints for AMP for WordPress and AMP for WP.
400
+ * 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.
401
+
402
+ = 1.4 =
403
+ * New Feature: Added UI for default orientation of your PWA. Orientation can now be set as "any", "portrait" or "landscape".
404
+ * New Feature: Added UI for theme_color property in manifest.
405
+ * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
406
+ * Enhancement: Improved handling of external resources.
407
+
408
+ = 1.3.1 =
409
+ * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
410
+ * Enhancement: Improved how start_url is handled in the manifest.
411
+ * Enhancement: Better handling of external resources.
412
+
413
+ = 1.3 =
414
+ * 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.
415
+ * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
416
+ * Enhancement: Improved in-browser service worker update handling.
417
+ * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
418
+
419
+ = 1.2 =
420
+ * New Feature: Support for theme-color.
421
+ * New Feature: Now you can edit the Application Name and Application Short name.
422
+ * New Feature: Set the start page of your PWA.
423
+ * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
424
+ * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
425
+ * UI Improvement: Added admin notice with a link to settings page on plugin activation.
426
+ * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
427
+ * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
428
+
429
+ = 1.1.1 =
430
+ * 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."
431
+
432
+ = 1.1 =
433
+ * New Feature: Aggressive caching of pages using CacheStorage API.
434
+ * New Feature: Pages once cached are served even if the user is offline.
435
+ * 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.
436
+
437
+ = 1.0 =
438
+ * First release of the plugin.
superpwa.php CHANGED
@@ -1,80 +1,80 @@
1
- <?php
2
- /**
3
- * Plugin Name: Super Progressive Web Apps
4
- * Plugin URI: https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri
5
- * Description: Convert your WordPress website into a Progressive Web App
6
- * Author: SuperPWA
7
- * Author URI: https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri
8
- * Contributors: Arun Basil Lal, Jose Varghese
9
- * Version: 2.1.2
10
- * Text Domain: super-progressive-web-apps
11
- * Domain Path: /languages
12
- * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
- */
14
-
15
- /**
16
- * ~ Directory Structure ~
17
- *
18
- * Based on the WordPress starter plugin template
19
- * @link https://github.com/arunbasillal/WordPress-Starter-Plugin
20
- *
21
- * /3rd-party/ - Functions for compatibility with 3rd party plugins and hosts.
22
- * /addons/ - Bundled add-ons
23
- * /admin/ - Plugin backend.
24
- * /functions/ - Functions and utilites.
25
- * /includes/ - External third party classes and libraries.
26
- * /languages/ - Translation files go here.
27
- * /public/ - Front end files go here.
28
- * index.php - Dummy file.
29
- * license.txt - GPL v2
30
- * loader.php - Loads everything.
31
- * superpwa.php - Main plugin file.
32
- * README.MD - Readme for GitHub.
33
- * readme.txt - Readme for WordPress plugin repository.
34
- * uninstall.php - Fired when the plugin is uninstalled.
35
- */
36
-
37
- // Exit if accessed directly
38
- if ( ! defined('ABSPATH') ) exit;
39
-
40
- /**
41
- * SuperPWA current version
42
- *
43
- * @since 1.0
44
- */
45
- if ( ! defined( 'SUPERPWA_VERSION' ) ) {
46
- define( 'SUPERPWA_VERSION' , '2.1.2' );
47
- }
48
-
49
- /**
50
- * Absolute path to the plugin directory.
51
- * eg - /var/www/html/wp-content/plugins/super-progressive-web-apps/
52
- *
53
- * @since 1.0
54
- */
55
- if ( ! defined( 'SUPERPWA_PATH_ABS' ) ) {
56
- define( 'SUPERPWA_PATH_ABS' , plugin_dir_path( __FILE__ ) );
57
- }
58
-
59
- /**
60
- * Link to the plugin folder.
61
- * eg - https://example.com/wp-content/plugins/super-progressive-web-apps/
62
- *
63
- * @since 1.0
64
- */
65
- if ( ! defined( 'SUPERPWA_PATH_SRC' ) ) {
66
- define( 'SUPERPWA_PATH_SRC' , plugin_dir_url( __FILE__ ) );
67
- }
68
-
69
- /**
70
- * Full path to the plugin file.
71
- * eg - /var/www/html/wp-content/plugins/Super-Progressive-Web-Apps/superpwa.php
72
- *
73
- * @since 2.0
74
- */
75
- if ( ! defined( 'SUPERPWA_PLUGIN_FILE' ) ) {
76
- define( 'SUPERPWA_PLUGIN_FILE', __FILE__ );
77
- }
78
-
79
- // Load everything
80
- require_once( SUPERPWA_PATH_ABS . 'loader.php' );
1
+ <?php
2
+ /**
3
+ * Plugin Name: Super Progressive Web Apps
4
+ * Plugin URI: https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri
5
+ * Description: Convert your WordPress website into a Progressive Web App
6
+ * Author: SuperPWA
7
+ * Author URI: https://profiles.wordpress.org/superpwa/
8
+ * Contributors: SuperPWA
9
+ * Version: 2.1.3
10
+ * Text Domain: super-progressive-web-apps
11
+ * Domain Path: /languages
12
+ * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
+ */
14
+
15
+ /**
16
+ * ~ Directory Structure ~
17
+ *
18
+ * Based on the WordPress starter plugin template
19
+ * @link https://github.com/arunbasillal/WordPress-Starter-Plugin
20
+ *
21
+ * /3rd-party/ - Functions for compatibility with 3rd party plugins and hosts.
22
+ * /addons/ - Bundled add-ons
23
+ * /admin/ - Plugin backend.
24
+ * /functions/ - Functions and utilites.
25
+ * /includes/ - External third party classes and libraries.
26
+ * /languages/ - Translation files go here.
27
+ * /public/ - Front end files go here.
28
+ * index.php - Dummy file.
29
+ * license.txt - GPL v2
30
+ * loader.php - Loads everything.
31
+ * superpwa.php - Main plugin file.
32
+ * README.MD - Readme for GitHub.
33
+ * readme.txt - Readme for WordPress plugin repository.
34
+ * uninstall.php - Fired when the plugin is uninstalled.
35
+ */
36
+
37
+ // Exit if accessed directly
38
+ if ( ! defined('ABSPATH') ) exit;
39
+
40
+ /**
41
+ * SuperPWA current version
42
+ *
43
+ * @since 1.0
44
+ */
45
+ if ( ! defined( 'SUPERPWA_VERSION' ) ) {
46
+ define( 'SUPERPWA_VERSION' , '2.1.3' );
47
+ }
48
+
49
+ /**
50
+ * Absolute path to the plugin directory.
51
+ * eg - /var/www/html/wp-content/plugins/super-progressive-web-apps/
52
+ *
53
+ * @since 1.0
54
+ */
55
+ if ( ! defined( 'SUPERPWA_PATH_ABS' ) ) {
56
+ define( 'SUPERPWA_PATH_ABS' , plugin_dir_path( __FILE__ ) );
57
+ }
58
+
59
+ /**
60
+ * Link to the plugin folder.
61
+ * eg - https://example.com/wp-content/plugins/super-progressive-web-apps/
62
+ *
63
+ * @since 1.0
64
+ */
65
+ if ( ! defined( 'SUPERPWA_PATH_SRC' ) ) {
66
+ define( 'SUPERPWA_PATH_SRC' , plugin_dir_url( __FILE__ ) );
67
+ }
68
+
69
+ /**
70
+ * Full path to the plugin file.
71
+ * eg - /var/www/html/wp-content/plugins/Super-Progressive-Web-Apps/superpwa.php
72
+ *
73
+ * @since 2.0
74
+ */
75
+ if ( ! defined( 'SUPERPWA_PLUGIN_FILE' ) ) {
76
+ define( 'SUPERPWA_PLUGIN_FILE', __FILE__ );
77
+ }
78
+
79
+ // Load everything
80
+ require_once( SUPERPWA_PATH_ABS . 'loader.php' );
uninstall.php CHANGED
@@ -1,56 +1,56 @@
1
- <?php
2
- /**
3
- * Fired when the plugin is uninstalled.
4
- *
5
- * Everything in uninstall.php will be executed when user decides to delete the plugin.
6
- *
7
- * @since 1.0
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) ) exit;
12
-
13
- // If uninstall not called from WordPress, then die.
14
- if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) die;
15
-
16
- /**
17
- * Delete database settings
18
- *
19
- * @since 1.0
20
- * @since 1.7 Added clean-up for superpwa_active_addons and superpwa_utm_tracking_settings
21
- */
22
- delete_option( 'superpwa_settings' );
23
- delete_option( 'superpwa_active_addons' );
24
- delete_option( 'superpwa_utm_tracking_settings' );
25
- delete_option( 'superpwa_version' );
26
-
27
- /**
28
- * Clean up for Multisites
29
- *
30
- * @since 1.6
31
- * @since 1.7 Added clean-up for superpwa_active_addons and superpwa_utm_tracking_settings
32
- */
33
- if ( is_multisite() ) {
34
-
35
- // Retrieve the list of blog ids where SuperPWA is active. (saved with blog_id as $key and activation_status as $value)
36
- $superpwa_sites = get_site_option( 'superpwa_active_sites' );
37
-
38
- // Loop through each active site.
39
- foreach( $superpwa_sites as $blog_id => $actviation_status ) {
40
-
41
- // Switch to each blog
42
- switch_to_blog( $blog_id );
43
-
44
- // Delete database settings for each site.
45
- delete_option( 'superpwa_settings' );
46
- delete_option( 'superpwa_active_addons' );
47
- delete_option( 'superpwa_utm_tracking_settings' );
48
- delete_option( 'superpwa_version' );
49
-
50
- // Return to main site
51
- restore_current_blog();
52
- }
53
-
54
- // Delete the list of websites where SuperPWA was activated.
55
- delete_site_option( 'superpwa_active_sites' );
56
  }
1
+ <?php
2
+ /**
3
+ * Fired when the plugin is uninstalled.
4
+ *
5
+ * Everything in uninstall.php will be executed when user decides to delete the plugin.
6
+ *
7
+ * @since 1.0
8
+ */
9
+
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) ) exit;
12
+
13
+ // If uninstall not called from WordPress, then die.
14
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) die;
15
+
16
+ /**
17
+ * Delete database settings
18
+ *
19
+ * @since 1.0
20
+ * @since 1.7 Added clean-up for superpwa_active_addons and superpwa_utm_tracking_settings
21
+ */
22
+ delete_option( 'superpwa_settings' );
23
+ delete_option( 'superpwa_active_addons' );
24
+ delete_option( 'superpwa_utm_tracking_settings' );
25
+ delete_option( 'superpwa_version' );
26
+
27
+ /**
28
+ * Clean up for Multisites
29
+ *
30
+ * @since 1.6
31
+ * @since 1.7 Added clean-up for superpwa_active_addons and superpwa_utm_tracking_settings
32
+ */
33
+ if ( is_multisite() ) {
34
+
35
+ // Retrieve the list of blog ids where SuperPWA is active. (saved with blog_id as $key and activation_status as $value)
36
+ $superpwa_sites = get_site_option( 'superpwa_active_sites' );
37
+
38
+ // Loop through each active site.
39
+ foreach( $superpwa_sites as $blog_id => $actviation_status ) {
40
+
41
+ // Switch to each blog
42
+ switch_to_blog( $blog_id );
43
+
44
+ // Delete database settings for each site.
45
+ delete_option( 'superpwa_settings' );
46
+ delete_option( 'superpwa_active_addons' );
47
+ delete_option( 'superpwa_utm_tracking_settings' );
48
+ delete_option( 'superpwa_version' );
49
+
50
+ // Return to main site
51
+ restore_current_blog();
52
+ }
53
+
54
+ // Delete the list of websites where SuperPWA was activated.
55
+ delete_site_option( 'superpwa_active_sites' );
56
  }