Super Progressive Web Apps - Version 1.2

Version Description

  • Date: 06.February.2018
  • New Feature: Support for theme-color.
  • New Feature: Now you can edit the Application Name and Application Short name.
  • New Feature: Set the start page of your PWA.
  • New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
  • UI Improvement: Better organization of plugin settings. More intuitive with inline help.
  • UI Improvement: Added admin notice with a link to settings page on plugin activation.
  • UI Improvement: Added checks for manifest, serice worker and HTTPS and display the status neatly in the UI.
  • Bug fix: Fix a parse error that showed up only on PHP 5.3.
Download this release

Release Info

Developer arunbasillal
Plugin Icon 128x128 Super Progressive Web Apps
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.2

admin/admin-setup.php CHANGED
@@ -38,66 +38,102 @@ function superpwa_register_settings() {
38
  'superpwa_validater_and_sanitizer' // Input sanitizer
39
  );
40
 
41
- // Manifest
42
  add_settings_section(
43
- 'superpwa_manifest_section', // ID
44
- __('Manifest', 'super-progressive-web-apps'), // Title
45
- 'superpwa_manifest_cb', // Callback Function
46
- 'superpwa_manifest_section' // Page slug
47
  );
48
 
49
- // Manifest status
50
  add_settings_field(
51
- 'superpwa_manifest_status', // ID
52
- __('Manifest Status', 'super-progressive-web-apps'), // Title
53
- 'superpwa_manifest_status_cb', // Callback function
54
- 'superpwa_manifest_section', // Page slug
55
- 'superpwa_manifest_section' // Settings Section ID
56
  );
57
-
58
- // Splash Screen Settings
59
- add_settings_section(
60
- 'superpwa_splash_screen_section', // ID
61
- __('Splash Screen', 'super-progressive-web-apps'), // Title
62
- 'superpwa_splash_screen_cb', // Callback Function
63
- 'superpwa_splash_screen_section' // Page slug
64
- );
65
-
66
- // Background Color
67
  add_settings_field(
68
- 'superpwa_background_color', // ID
69
- __('Background Color', 'super-progressive-web-apps'), // Title
70
- 'superpwa_background_color_cb', // Callback function
71
- 'superpwa_splash_screen_section', // Page slug
72
- 'superpwa_splash_screen_section' // Settings Section ID
73
  );
74
 
75
- // Icons
76
  add_settings_field(
77
  'superpwa_icons', // ID
78
  __('Application Icon', 'super-progressive-web-apps'), // Title
79
  'superpwa_icons_cb', // Callback function
80
- 'superpwa_splash_screen_section', // Page slug
81
- 'superpwa_splash_screen_section' // Settings Section ID
82
  );
83
 
84
- // Offline Page
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  add_settings_section(
86
- 'superpwa_offline_page_section', // ID
87
- __('Offline Page', 'super-progressive-web-apps'), // Title
88
- 'superpwa_offline_page_note_cb', // Callback Function
89
- 'superpwa_offline_page_section' // Page slug
90
  );
91
 
92
- // Background Color
93
  add_settings_field(
94
- 'superpwa_offline_page', // ID
95
- __('Offline Page', 'super-progressive-web-apps'), // Title
96
- 'superpwa_offline_page_cb', // Callback function
97
- 'superpwa_offline_page_section', // Page slug
98
- 'superpwa_offline_page_section' // Settings Section ID
99
  );
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
  add_action( 'admin_init', 'superpwa_register_settings' );
103
 
@@ -108,6 +144,12 @@ add_action( 'admin_init', 'superpwa_register_settings' );
108
  */
109
  function superpwa_validater_and_sanitizer( $settings ) {
110
 
 
 
 
 
 
 
111
  // Sanitize hex color input
112
  $settings['background_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['background_color'] ) ? sanitize_text_field( $settings['background_color'] ) : '#D5E0EB';
113
 
@@ -126,8 +168,12 @@ function superpwa_validater_and_sanitizer( $settings ) {
126
  function superpwa_get_settings() {
127
 
128
  $defaults = array(
129
- 'background_color' => '#D5E0EB',
 
130
  'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
 
 
 
131
  'offline_page' => 0,
132
  );
133
 
38
  'superpwa_validater_and_sanitizer' // Input sanitizer
39
  );
40
 
41
+ // Basic Application Settings
42
  add_settings_section(
43
+ 'superpwa_basic_settings_section', // ID
44
+ __return_false(), // Title
45
+ '__return_false', // Callback Function
46
+ 'superpwa_basic_settings_section' // Page slug
47
  );
48
 
49
+ // Application Name
50
  add_settings_field(
51
+ 'superpwa_app_name', // ID
52
+ __('Application Name', 'super-progressive-web-apps'), // Title
53
+ 'superpwa_app_name_cb', // CB
54
+ 'superpwa_basic_settings_section', // Page slug
55
+ 'superpwa_basic_settings_section' // Settings Section ID
56
  );
57
+
58
+ // Application Short Name
 
 
 
 
 
 
 
 
59
  add_settings_field(
60
+ 'superpwa_app_short_name', // ID
61
+ __('Application Short Name', 'super-progressive-web-apps'), // Title
62
+ 'superpwa_app_short_name_cb', // CB
63
+ 'superpwa_basic_settings_section', // Page slug
64
+ 'superpwa_basic_settings_section' // Settings Section ID
65
  );
66
 
67
+ // Application Icon
68
  add_settings_field(
69
  'superpwa_icons', // ID
70
  __('Application Icon', 'super-progressive-web-apps'), // Title
71
  'superpwa_icons_cb', // Callback function
72
+ 'superpwa_basic_settings_section', // Page slug
73
+ 'superpwa_basic_settings_section' // Settings Section ID
74
  );
75
 
76
+ // Splash Screen Background Color
77
+ add_settings_field(
78
+ 'superpwa_background_color', // ID
79
+ __('Background Color', 'super-progressive-web-apps'), // Title
80
+ 'superpwa_background_color_cb', // CB
81
+ 'superpwa_basic_settings_section', // Page slug
82
+ 'superpwa_basic_settings_section' // Settings Section ID
83
+ );
84
+
85
+ // Start URL
86
+ add_settings_field(
87
+ 'superpwa_start_url', // ID
88
+ __('Start Page', 'super-progressive-web-apps'), // Title
89
+ 'superpwa_start_url_cb', // CB
90
+ 'superpwa_basic_settings_section', // Page slug
91
+ 'superpwa_basic_settings_section' // Settings Section ID
92
+ );
93
+
94
+ // Offline Page
95
+ add_settings_field(
96
+ 'superpwa_offline_page', // ID
97
+ __('Offline Page', 'super-progressive-web-apps'), // Title
98
+ 'superpwa_offline_page_cb', // CB
99
+ 'superpwa_basic_settings_section', // Page slug
100
+ 'superpwa_basic_settings_section' // Settings Section ID
101
+ );
102
+
103
+ // PWA Status
104
  add_settings_section(
105
+ 'superpwa_pwa_status_section', // ID
106
+ __('Status', 'super-progressive-web-apps'), // Title
107
+ '__return_false', // Callback Function
108
+ 'superpwa_pwa_status_section' // Page slug
109
  );
110
 
111
+ // Manifest status
112
  add_settings_field(
113
+ 'superpwa_manifest_status', // ID
114
+ __('Manifest', 'super-progressive-web-apps'), // Title
115
+ 'superpwa_manifest_status_cb', // CB
116
+ 'superpwa_pwa_status_section', // Page slug
117
+ 'superpwa_pwa_status_section' // Settings Section ID
118
  );
119
 
120
+ // Service Worker status
121
+ add_settings_field(
122
+ 'superpwa_sw_status', // ID
123
+ __('Service Worker', 'super-progressive-web-apps'), // Title
124
+ 'superpwa_sw_status_cb', // CB
125
+ 'superpwa_pwa_status_section', // Page slug
126
+ 'superpwa_pwa_status_section' // Settings Section ID
127
+ );
128
+
129
+ // HTTPS status
130
+ add_settings_field(
131
+ 'superpwa_https_status', // ID
132
+ __('HTTPS', 'super-progressive-web-apps'), // Title
133
+ 'superpwa_https_status_cb', // CB
134
+ 'superpwa_pwa_status_section', // Page slug
135
+ 'superpwa_pwa_status_section' // Settings Section ID
136
+ );
137
  }
138
  add_action( 'admin_init', 'superpwa_register_settings' );
139
 
144
  */
145
  function superpwa_validater_and_sanitizer( $settings ) {
146
 
147
+ // Sanitize Application Name
148
+ $settings['app_name'] = sanitize_text_field($settings['app_name']) == '' ? get_bloginfo('name') : sanitize_text_field($settings['app_name']);
149
+
150
+ // Sanitize Application Short Name
151
+ $settings['app_short_name'] = sanitize_text_field($settings['app_short_name']) == '' ? get_bloginfo('name') : sanitize_text_field($settings['app_short_name']);
152
+
153
  // Sanitize hex color input
154
  $settings['background_color'] = preg_match( '/#([a-f0-9]{3}){1,2}\b/i', $settings['background_color'] ) ? sanitize_text_field( $settings['background_color'] ) : '#D5E0EB';
155
 
168
  function superpwa_get_settings() {
169
 
170
  $defaults = array(
171
+ 'app_name' => get_bloginfo('name'),
172
+ 'app_short_name' => get_bloginfo('name'),
173
  'icon' => SUPERPWA_PATH_SRC . 'public/images/logo.png',
174
+ 'background_color' => '#D5E0EB',
175
+ 'start_url' => 0,
176
+ 'start_url_amp' => 0,
177
  'offline_page' => 0,
178
  );
179
 
admin/admin-ui-render.php CHANGED
@@ -3,13 +3,15 @@
3
  * Admin UI setup and render
4
  *
5
  * @since 1.0
6
- * @function superpwa_manifest_cb() Manifest Callback
7
- * @function superpwa_manifest_status_cb Manifest Status
8
- * @function superpwa_splash_screen_cb() Splash Screen Callback
9
- * @function superpwa_background_color_cb() Background Color
10
  * @function superpwa_icons_cb() Application Icons
11
- * @function superpwa_offline_page_note_cb() Offline Page Note
12
  * @function superpwa_offline_page_cb() Offline Page Dropdown
 
 
 
13
  * @function superpwa_admin_interface_render() Admin interface renderer
14
  */
15
 
@@ -17,44 +19,68 @@
17
  if ( ! defined('ABSPATH') ) exit;
18
 
19
  /**
20
- * Manifest Callback
21
  *
22
- * @since 1.0
23
  */
24
- function superpwa_manifest_cb() {
 
 
 
25
 
26
- echo '<p>' . __('The manifest includes all the information about your Progressive Web App. SuperPWA generates the manifest automatically.') . '</p>';
 
 
 
 
 
 
27
  }
28
 
29
  /**
30
- * Manifest Status
31
  *
32
- * @since 1.0
33
  */
34
- function superpwa_manifest_status_cb() {
35
 
36
- if ( superpwa_get_contents( ABSPATH . SUPERPWA_MANIFEST_FILENAME ) ) {
 
 
 
37
 
38
- printf( __( 'Manifest was generated successfully. You can <a href="%s" target="_blank">see it here</a>.', 'super-progressive-web-apps' ), SUPERPWA_MANIFEST_SRC );
39
- } else {
40
 
41
- echo '<p>' . __('Manifest generation failed. Check if WordPress can write to your root folder (the same folder with wp-config.php).', 'super-progressive-web-apps') . '</p>';
42
- }
43
-
 
 
44
  }
45
 
46
  /**
47
- * Splash Screen Callback
48
  *
49
- * @since 1.0
50
  */
51
- function superpwa_splash_screen_cb() {
 
 
 
52
 
53
- echo '<p>' . __('The values you set here will be used for the splash screen that supported browsers choose to display.', 'super-progressive-web-apps') . '</p>';
 
 
 
 
 
 
 
 
54
  }
55
 
56
  /**
57
- * Background Color
58
  *
59
  * @since 1.0
60
  */
@@ -65,40 +91,52 @@ function superpwa_background_color_cb() {
65
 
66
  <!-- Background Color -->
67
  <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">
 
 
68
 
69
  <?php
70
  }
71
 
72
  /**
73
- * Application Icons
74
  *
75
- * @since 1.0
76
  */
77
- function superpwa_icons_cb() {
78
 
79
  // Get Settings
80
  $settings = superpwa_get_settings(); ?>
81
 
82
- <!-- Application Icon -->
83
- <p style="margin-bottom: 8px;"><?php _e('This will be the icon of your PWA when installed on the phone. Must be a <code>PNG</code> image exactly <code>192x192</code> in size.', 'super-progressive-web-apps'); ?></p>
84
- <input type="text" name="superpwa_settings[icon]" id="superpwa_settings[icon]" class="superpwa-icon" size="50" value="<?php echo isset( $settings['icon'] ) ? esc_attr( $settings['icon']) : ''; ?>">
85
- <button type="button" class="button superpwa-icon-upload" data-editor="content">
86
- <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> Choose Icon
87
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  <?php
90
  }
91
 
92
- /**
93
- * Offline Page Note
94
- *
95
- * @since 1.0
96
- */
97
- function superpwa_offline_page_note_cb() {
98
-
99
- echo '<p>' . __('The page you set here will be displayed if the requested page is not cached and the user is offline. Defaults to <code>WordPress Address</code> in <code>Settings</code> > <code>General</code>)', 'super-progressive-web-apps') . '</p>';
100
- }
101
-
102
  /**
103
  * Offline Page Dropdown
104
  *
@@ -119,9 +157,59 @@ function superpwa_offline_page_cb() {
119
  'selected' => isset($settings['offline_page']) ? $settings['offline_page'] : '',
120
  )); ?>
121
  </label>
 
 
122
 
123
  <?php
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  /**
127
  * Admin interface renderer
@@ -145,7 +233,8 @@ function superpwa_admin_interface_render () {
145
  }
146
 
147
  // Show Settings Saved Message
148
- settings_errors( 'superpwa_settings_saved_message' ); */?>
 
149
 
150
  <div class="wrap">
151
  <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
@@ -155,14 +244,11 @@ function superpwa_admin_interface_render () {
155
  // Output nonce, action, and option_page fields for a settings page.
156
  settings_fields( 'superpwa_settings_group' );
157
 
158
- // Manifest
159
- do_settings_sections( 'superpwa_manifest_section' ); // Page slug
160
-
161
- // Splash Screen
162
- do_settings_sections( 'superpwa_splash_screen_section' ); // Page slug
163
 
164
- // Offline Page
165
- do_settings_sections( 'superpwa_offline_page_section' ); // Page slug
166
 
167
  // Output save settings button
168
  submit_button( __('Save Settings', 'super-progressive-web-apps') );
3
  * Admin UI setup and render
4
  *
5
  * @since 1.0
6
+ * @function superpwa_app_name_cb() Application Name
7
+ * @function superpwa_app_short_name_cb() Application Short Name
8
+ * @function superpwa_background_color_cb() Splash Screen Background Color
 
9
  * @function superpwa_icons_cb() Application Icons
10
+ * @function superpwa_start_url_cb() Start URL Dropdown
11
  * @function superpwa_offline_page_cb() Offline Page Dropdown
12
+ * @function superpwa_manifest_status_cb() Manifest Status
13
+ * @function superpwa_sw_status_cb() Service Worker Status
14
+ * @function superpwa_https_status_cb() HTTPS Status
15
  * @function superpwa_admin_interface_render() Admin interface renderer
16
  */
17
 
19
  if ( ! defined('ABSPATH') ) exit;
20
 
21
  /**
22
+ * Application Name
23
  *
24
+ * @since 1.2
25
  */
26
+ function superpwa_app_name_cb() {
27
+
28
+ // Get Settings
29
+ $settings = superpwa_get_settings(); ?>
30
 
31
+ <fieldset>
32
+
33
+ <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']); ?>"/>
34
+
35
+ </fieldset>
36
+
37
+ <?php
38
  }
39
 
40
  /**
41
+ * Application Short Name
42
  *
43
+ * @since 1.2
44
  */
45
+ function superpwa_app_short_name_cb() {
46
 
47
+ // Get Settings
48
+ $settings = superpwa_get_settings(); ?>
49
+
50
+ <fieldset>
51
 
52
+ <input type="text" name="superpwa_settings[app_short_name]" class="regular-text" value="<?php if ( isset( $settings['app_short_name'] ) && ( ! empty($settings['app_short_name']) ) ) echo esc_attr($settings['app_short_name']); ?>"/>
 
53
 
54
+ <p class="description" id="tagline-description"><?php _e('Used when there is insufficient space to display the full name of the application.', 'super-progressive-web-apps'); ?></p>
55
+
56
+ </fieldset>
57
+
58
+ <?php
59
  }
60
 
61
  /**
62
+ * Application Icon
63
  *
64
+ * @since 1.0
65
  */
66
+ function superpwa_icons_cb() {
67
+
68
+ // Get Settings
69
+ $settings = superpwa_get_settings(); ?>
70
 
71
+ <!-- Application Icon -->
72
+ <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']) : ''; ?>">
73
+ <button type="button" class="button superpwa-icon-upload" data-editor="content">
74
+ <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> Choose Icon
75
+ </button>
76
+
77
+ <p class="description" id="tagline-description"><?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'); ?></p>
78
+
79
+ <?php
80
  }
81
 
82
  /**
83
+ * Splash Screen Background Color
84
  *
85
  * @since 1.0
86
  */
91
 
92
  <!-- Background Color -->
93
  <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">
94
+
95
+ <p class="description" id="tagline-description"><?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?></p>
96
 
97
  <?php
98
  }
99
 
100
  /**
101
+ * Start URL Dropdown
102
  *
103
+ * @since 1.2
104
  */
105
+ function superpwa_start_url_cb() {
106
 
107
  // Get Settings
108
  $settings = superpwa_get_settings(); ?>
109
 
110
+ <fieldset>
111
+
112
+ <!-- WordPress Pages Dropdown -->
113
+ <label for="superpwa_settings[start_url]">
114
+ <?php echo wp_dropdown_pages( array(
115
+ 'name' => 'superpwa_settings[start_url]',
116
+ 'echo' => 0,
117
+ 'show_option_none' => __( '&mdash; Homepage &mdash;' ),
118
+ 'option_none_value' => '0',
119
+ 'selected' => isset($settings['start_url']) ? $settings['start_url'] : '',
120
+ )); ?>
121
+ </label>
122
+
123
+ <p class="description" id="tagline-description"><?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() ); ?></p>
124
+
125
+ <?php if ( superpwa_is_amp() ) { ?>
126
+
127
+ <!-- AMP Page As Start Page -->
128
+ <br><input type="checkbox" name="superpwa_settings[start_url_amp]" id="superpwa_settings[start_url_amp]" value="1"
129
+ <?php if ( isset( $settings['start_url_amp'] ) ) { checked( '1', $settings['start_url_amp'] ); } ?>>
130
+ <label for="superpwa_settings[start_url_amp]"><?php _e('Use AMP version of the start page.', 'super-progressive-web-apps') ?></label>
131
+ <br>
132
+
133
+ <?php } ?>
134
+
135
+ </fieldset>
136
 
137
  <?php
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
140
  /**
141
  * Offline Page Dropdown
142
  *
157
  'selected' => isset($settings['offline_page']) ? $settings['offline_page'] : '',
158
  )); ?>
159
  </label>
160
+
161
+ <p class="description" id="tagline-description"><?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' ), get_permalink($settings['offline_page']) ? trailingslashit(get_permalink($settings['offline_page'])) : trailingslashit(get_bloginfo( 'wpurl' )) ); ?></p>
162
 
163
  <?php
164
  }
165
+
166
+ /**
167
+ * Manifest Status
168
+ *
169
+ * @since 1.0
170
+ */
171
+ function superpwa_manifest_status_cb() {
172
+
173
+ if ( superpwa_get_contents( SUPERPWA_MANIFEST_ABS ) ) {
174
+
175
+ 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 );
176
+ } else {
177
+
178
+ echo '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __('Manifest generation failed. Check if WordPress can write to your root folder (the same folder with wp-config.php).', 'super-progressive-web-apps') . '</p>';
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Service Worker Status
184
+ *
185
+ * @since 1.2
186
+ */
187
+ function superpwa_sw_status_cb() {
188
+
189
+ if ( superpwa_get_contents( SUPERPWA_SW_ABS ) ) {
190
+
191
+ printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Service worker generated successfully.', 'super-progressive-web-apps' ) . '</p>' );
192
+ } else {
193
+
194
+ echo '<p><span class="dashicons dashicons-no-alt" style="color: #dc3232;"></span> ' . __('Service worker generation failed. Check if WordPress can write to your root folder (the same folder with wp-config.php).', 'super-progressive-web-apps') . '</p>';
195
+ }
196
+ }
197
+
198
+ /**
199
+ * HTTPS Status
200
+ *
201
+ * @since 1.2
202
+ */
203
+ function superpwa_https_status_cb() {
204
+
205
+ if ( is_ssl() ) {
206
+
207
+ printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Your website is served over HTTPS.', 'super-progressive-web-apps' ) . '</p>' );
208
+ } else {
209
+
210
+ 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>' );
211
+ }
212
+ }
213
 
214
  /**
215
  * Admin interface renderer
233
  }
234
 
235
  // Show Settings Saved Message
236
+ settings_errors( 'superpwa_settings_saved_message' ); */
237
+ ?>
238
 
239
  <div class="wrap">
240
  <h1>Super Progressive Web Apps <sup><?php echo SUPERPWA_VERSION; ?></sup></h1>
244
  // Output nonce, action, and option_page fields for a settings page.
245
  settings_fields( 'superpwa_settings_group' );
246
 
247
+ // Basic Application Settings
248
+ do_settings_sections( 'superpwa_basic_settings_section' ); // Page slug
 
 
 
249
 
250
+ // Status
251
+ do_settings_sections( 'superpwa_pwa_status_section' ); // Page slug
252
 
253
  // Output save settings button
254
  submit_button( __('Save Settings', 'super-progressive-web-apps') );
admin/basic-setup.php CHANGED
@@ -4,6 +4,7 @@
4
  *
5
  * @since 1.0
6
  * @function superpwa_activate_plugin() Plugin activatation todo list
 
7
  * @function superpwa_deactivate_plugin Plugin deactivation todo list
8
  * @function superpwa_load_plugin_textdomain() Load plugin text domain
9
  * @function superpwa_settings_link() Print direct link to plugin settings in plugins list in admin
@@ -28,6 +29,35 @@ function superpwa_activate_plugin() {
28
 
29
  // Generate service worker
30
  superpwa_generate_sw();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  /**
@@ -94,10 +124,10 @@ function superpwa_plugin_row_meta( $links, $file ) {
94
  * Admin footer text
95
  *
96
  * A function to add footer text to the settings page of the plugin.
97
- * @since 1.0
98
  * @refer https://codex.wordpress.org/Function_Reference/get_current_screen
99
  */
100
- function superpwa_footer_text($default) {
101
 
102
  // Retun default on non-plugin pages
103
  $screen = get_current_screen();
@@ -105,13 +135,13 @@ function superpwa_footer_text($default) {
105
  return $default;
106
  }
107
 
108
- $superpwa_footer_text = sprintf( __( 'If you like SuperPWA, please 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' ),
109
  'https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?rate=5#new-post'
110
  );
111
 
112
  return $superpwa_footer_text;
113
  }
114
- // add_filter('admin_footer_text', 'superpwa_footer_text'); // Todo: Wait till ver 1.1 or more to add this
115
 
116
  /**
117
  * Admin footer version
4
  *
5
  * @since 1.0
6
  * @function superpwa_activate_plugin() Plugin activatation todo list
7
+ * @function superpwa_admin_notice_activation() Admin notice on plugin activation
8
  * @function superpwa_deactivate_plugin Plugin deactivation todo list
9
  * @function superpwa_load_plugin_textdomain() Load plugin text domain
10
  * @function superpwa_settings_link() Print direct link to plugin settings in plugins list in admin
29
 
30
  // Generate service worker
31
  superpwa_generate_sw();
32
+
33
+ // Set transient for activation notice
34
+ set_transient( 'superpwa_admin_notice_activation', true, 5 );
35
+ }
36
+
37
+ /**
38
+ * Add admin notice on activation
39
+ *
40
+ * @since 1.2
41
+ */
42
+ add_action( 'admin_notices', 'superpwa_admin_notice_activation' );
43
+
44
+ /**
45
+ * Admin notice on plugin activation
46
+ *
47
+ * @since 1.2
48
+ */
49
+ function superpwa_admin_notice_activation() {
50
+
51
+ // Return if transient is not set
52
+ if ( ! get_transient( 'superpwa_admin_notice_activation' ) )
53
+ return;
54
+
55
+ $superpwa_is_ready = is_ssl() && superpwa_get_contents( SUPERPWA_MANIFEST_ABS ) && superpwa_get_contents( SUPERPWA_SW_ABS ) ? 'Your app is ready with the default settings. ' : '';
56
+
57
+ 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>', 'super-progressive-web-apps' ), admin_url( 'options-general.php?page=superpwa' ) ) . '</p></div>';
58
+
59
+ // Delete transient
60
+ delete_transient( 'superpwa_admin_notice_activation' );
61
  }
62
 
63
  /**
124
  * Admin footer text
125
  *
126
  * A function to add footer text to the settings page of the plugin.
127
+ * @since 1.2
128
  * @refer https://codex.wordpress.org/Function_Reference/get_current_screen
129
  */
130
+ function superpwa_footer_text( $default ) {
131
 
132
  // Retun default on non-plugin pages
133
  $screen = get_current_screen();
135
  return $default;
136
  }
137
 
138
+ $superpwa_footer_text = sprintf( __( 'If you like our plugin, please 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' ),
139
  'https://wordpress.org/support/plugin/super-progressive-web-apps/reviews/?rate=5#new-post'
140
  );
141
 
142
  return $superpwa_footer_text;
143
  }
144
+ add_filter('admin_footer_text', 'superpwa_footer_text');
145
 
146
  /**
147
  * Admin footer version
admin/do.php CHANGED
@@ -4,6 +4,8 @@
4
  *
5
  * @since 1.0
6
  * @function superpwa_after_save_settings_todo() Todo list after saving admin options
 
 
7
  */
8
 
9
  // Exit if accessed directly
@@ -26,4 +28,61 @@ function superpwa_after_save_settings_todo() {
26
  superpwa_generate_sw();
27
  }
28
  add_action( 'add_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
29
- add_action( 'update_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  *
5
  * @since 1.0
6
  * @function superpwa_after_save_settings_todo() Todo list after saving admin options
7
+ * @function superpwa_is_amp() Check if any AMP plugin is installed
8
+ * @function superpwa_get_start_url() Return Start Page URL
9
  */
10
 
11
  // Exit if accessed directly
28
  superpwa_generate_sw();
29
  }
30
  add_action( 'add_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
31
+ add_action( 'update_option_superpwa_settings', 'superpwa_after_save_settings_todo' );
32
+
33
+ /**
34
+ * Check if any AMP plugin is installed
35
+ *
36
+ * @return String|Bool AMP page url on success, false otherwise
37
+ * @since 1.2
38
+ */
39
+ function superpwa_is_amp() {
40
+
41
+ // AMP for WordPress - https://wordpress.org/plugins/amp
42
+ if ( function_exists( 'amp_init' ) )
43
+ return 'amp/';
44
+
45
+ // AMP for WP - https://wordpress.org/plugins/accelerated-mobile-pages/
46
+ if ( function_exists( 'ampforwp_generate_endpoint' ) )
47
+ return 'amp/';
48
+
49
+ // Better AMP � https://wordpress.org/plugins/better-amp/
50
+ if ( class_exists( 'Better_AMP' ) )
51
+ return 'amp/';
52
+
53
+ // AMP Supremacy - https://wordpress.org/plugins/amp-supremacy/
54
+ if ( class_exists( 'AMP_Init' ) )
55
+ return 'amp/';
56
+
57
+ // WP AMP - https://wordpress.org/plugins/wp-amp-ninja/
58
+ if ( function_exists( 'wpamp_init' ) )
59
+ return '?wpamp';
60
+
61
+ return false;
62
+ }
63
+
64
+ /**
65
+ * Return Start Page URL
66
+ *
67
+ * @param $rel False by default. Set to true to return a relative URL (for use in manifest)
68
+ * @return String URL to be set as the start_url in manifest and startPage in service worker
69
+ * @since 1.2
70
+ */
71
+ function superpwa_get_start_url( $rel = false ) {
72
+
73
+ // Get Settings
74
+ $settings = superpwa_get_settings();
75
+
76
+ // Start Page
77
+ $start_url = get_permalink( $settings['start_url'] ) ? trailingslashit( get_permalink( $settings['start_url'] ) ) : trailingslashit( get_bloginfo( 'wpurl' ) );
78
+
79
+ if ( $rel === true ) {
80
+
81
+ $start_url = str_replace( untrailingslashit( get_bloginfo( 'wpurl' ) ), '', $start_url );
82
+ }
83
+
84
+ // AMP URL
85
+ $amp_url = superpwa_is_amp() !== false && ( isset( $settings['start_url_amp'] ) && $settings['start_url_amp'] == 1 ) ? superpwa_is_amp() : '';
86
+
87
+ return $start_url . $amp_url;
88
+ }
public/manifest.php CHANGED
@@ -24,8 +24,8 @@ function superpwa_generate_manifest() {
24
  $settings = superpwa_get_settings();
25
 
26
  $manifest = array(
27
- 'name' => get_bloginfo('name'),
28
- 'short_name' => get_bloginfo('name'),
29
  'icons' => array(
30
  array(
31
  'src' => $settings['icon'],
@@ -37,7 +37,7 @@ function superpwa_generate_manifest() {
37
  'theme_color' => $settings['background_color'],
38
  'display' => 'standalone',
39
  'orientation' => 'natural',
40
- 'start_url' => '/',
41
  );
42
 
43
  // Delete manifest if it exists
@@ -56,7 +56,11 @@ function superpwa_generate_manifest() {
56
  */
57
  function superpwa_add_manifest_to_header() {
58
 
59
- echo '<!-- Manifest added by SuperPWA -->' . PHP_EOL . '<link rel="manifest" href="'. SUPERPWA_MANIFEST_SRC . '">';
 
 
 
 
60
  }
61
  add_action( 'wp_head', 'superpwa_add_manifest_to_header' );
62
 
24
  $settings = superpwa_get_settings();
25
 
26
  $manifest = array(
27
+ 'name' => $settings['app_name'],
28
+ 'short_name' => $settings['app_short_name'],
29
  'icons' => array(
30
  array(
31
  'src' => $settings['icon'],
37
  'theme_color' => $settings['background_color'],
38
  'display' => 'standalone',
39
  'orientation' => 'natural',
40
+ 'start_url' => superpwa_get_start_url(true),
41
  );
42
 
43
  // Delete manifest if it exists
56
  */
57
  function superpwa_add_manifest_to_header() {
58
 
59
+ // Get Settings
60
+ $settings = superpwa_get_settings();
61
+
62
+ echo '<!-- Manifest added by SuperPWA -->' . PHP_EOL . '<link rel="manifest" href="'. SUPERPWA_MANIFEST_SRC . '">' . PHP_EOL;
63
+ echo '<meta name="theme-color" content="'. $settings['background_color'] .'">' . PHP_EOL;
64
  }
65
  add_action( 'wp_head', 'superpwa_add_manifest_to_header' );
66
 
public/sw.php CHANGED
@@ -55,8 +55,8 @@ function superpwa_sw_template() {
55
  * https://wordpress.org/plugins/super-progressive-web-apps/
56
  */
57
 
58
- const cacheName = '<?php echo parse_url( get_bloginfo( 'wpurl' ) )['host'] . '-superpwa-' . SUPERPWA_VERSION; ?>';
59
- const startPage = '<?php echo trailingslashit(get_bloginfo( 'wpurl' )); ?>';
60
  const offlinePage = '<?php echo get_permalink($settings['offline_page']) ? trailingslashit(get_permalink($settings['offline_page'])) : trailingslashit(get_bloginfo( 'wpurl' )); ?>';
61
  const fallbackImage = '<?php echo $settings['icon']; ?>';
62
  const filesToCache = [startPage, offlinePage, fallbackImage];
55
  * https://wordpress.org/plugins/super-progressive-web-apps/
56
  */
57
 
58
+ const cacheName = '<?php echo parse_url( get_bloginfo( 'wpurl' ), PHP_URL_HOST ) . '-superpwa-' . SUPERPWA_VERSION; ?>';
59
+ const startPage = '<?php echo superpwa_get_start_url(); ?>';
60
  const offlinePage = '<?php echo get_permalink($settings['offline_page']) ? trailingslashit(get_permalink($settings['offline_page'])) : trailingslashit(get_bloginfo( 'wpurl' )); ?>';
61
  const fallbackImage = '<?php echo $settings['icon']; ?>';
62
  const filesToCache = [startPage, offlinePage, fallbackImage];
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: 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.5.0
6
- Tested up to: 4.9.2
7
  Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2 or later
@@ -21,19 +21,22 @@ Users can come back to your website by launching the app from their home screen
21
 
22
  Here are the current features of Super Progressive Web Apps:
23
 
24
- * Generate a manifest for your website and add it to the <head> of the page
25
  * Set the application icon for your Progressive Web App.
26
  * Set the background color for the splash screen of your Progressive Web App.
27
  * Your website will show the "Add to home screen" notice when accessed in a supported browser.
28
  * Aggressive caching of pages using CacheStorage API.
29
  * Pages once cached are served even if the user is offline.
30
  * 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.
 
 
 
 
31
 
32
  **Features are we currently working on:**
33
 
34
  * Cache busting features.
35
  * Better handling of service worker updates.
36
- * Better admin notices and info.
37
  * Better UI.
38
 
39
  ### Progressive Web App Minimum Requirements
@@ -46,18 +49,6 @@ Progressive web apps need browsers that support manifests and service workers. C
46
 
47
  The list is fast growing and is likely to be supported in most major browsers by the end of this year.
48
 
49
- ### About us
50
-
51
- 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.
52
-
53
- 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.
54
-
55
- Please give us your constructive feedback and support.
56
-
57
- ### Feature Requests, Issues, Pull Requests
58
-
59
- 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.
60
-
61
  ### How To Convert Your WordPress Website Into A Progressive Web App
62
 
63
  #### WordPress Installation
@@ -98,10 +89,23 @@ Uh, oh. Your PWA did not work as expected? You do not see the "Add to Home Scree
98
 
99
  * 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).
100
  * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
 
101
  * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
102
  * 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.)
103
  * 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.
104
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  == Installation ==
106
 
107
  To install this plugin:
@@ -120,6 +124,17 @@ If you have any questions, please ask it on the [support forum](https://wordpres
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
 
 
 
 
123
  = 1.1.1 =
124
  * Date: 30.January.2018
125
  * 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."
@@ -136,6 +151,17 @@ If you have any questions, please ask it on the [support forum](https://wordpres
136
 
137
  == Upgrade Notice ==
138
 
 
 
 
 
 
 
 
 
 
 
 
139
  = 1.1.1 =
140
  * Date: 30.January.2018
141
  * 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."
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.5.0
6
+ Tested up to: 4.9.3
7
  Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2 or later
21
 
22
  Here are the current features of Super Progressive Web Apps:
23
 
24
+ * Generate a manifest for your website and add it to the head of your website.
25
  * Set the application icon for your Progressive Web App.
26
  * Set the background color for the splash screen of your Progressive Web App.
27
  * Your website will show the "Add to home screen" notice when accessed in a supported browser.
28
  * Aggressive caching of pages using CacheStorage API.
29
  * Pages once cached are served even if the user is offline.
30
  * 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.
31
+ * New in version 1.2: Support for theme-color.
32
+ * New in version 1.2: Now you can edit the Application Name and Application Short name.
33
+ * New in version 1.2: Set the start page of your PWA.
34
+ * New in version 1.2: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
35
 
36
  **Features are we currently working on:**
37
 
38
  * Cache busting features.
39
  * Better handling of service worker updates.
 
40
  * Better UI.
41
 
42
  ### Progressive Web App Minimum Requirements
49
 
50
  The list is fast growing and is likely to be supported in most major browsers by the end of this year.
51
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  ### How To Convert Your WordPress Website Into A Progressive Web App
53
 
54
  #### WordPress Installation
89
 
90
  * 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).
91
  * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
92
+ * Make sure your icon is a PNG and 192px X 192 px in size.
93
  * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
94
  * 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.)
95
  * 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.
96
 
97
+ ### Feature Requests, Issues, Pull Requests
98
+
99
+ 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.
100
+
101
+ ### About us
102
+
103
+ 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.
104
+
105
+ 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.
106
+
107
+ Please give us your constructive feedback and support.
108
+
109
  == Installation ==
110
 
111
  To install this plugin:
124
 
125
  == Changelog ==
126
 
127
+ = 1.2 =
128
+ * Date: 06.February.2018
129
+ * New Feature: Support for theme-color.
130
+ * New Feature: Now you can edit the Application Name and Application Short name.
131
+ * New Feature: Set the start page of your PWA.
132
+ * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
133
+ * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
134
+ * UI Improvement: Added admin notice with a link to settings page on plugin activation.
135
+ * UI Improvement: Added checks for manifest, serice worker and HTTPS and display the status neatly in the UI.
136
+ * Bug fix: Fix a parse error that showed up only on PHP 5.3.
137
+
138
  = 1.1.1 =
139
  * Date: 30.January.2018
140
  * 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."
151
 
152
  == Upgrade Notice ==
153
 
154
+ = 1.2 =
155
+ * Date: 06.February.2018
156
+ * New Feature: Support for theme-color.
157
+ * New Feature: Now you can edit the Application Name and Application Short name.
158
+ * New Feature: Set the start page of your PWA.
159
+ * New Feature: Set AMP version of the start page. Supported plugins: AMP for WordPress, AMP for WP, Better AMP, AMP Supremacy, WP AMP.
160
+ * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
161
+ * UI Improvement: Added admin notice with a link to settings page on plugin activation.
162
+ * UI Improvement: Added checks for manifest, serice worker and HTTPS and display the status neatly in the UI.
163
+ * Bug fix: Fix a parse error that showed up only on PHP 5.3.
164
+
165
  = 1.1.1 =
166
  * Date: 30.January.2018
167
  * 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."
superpwa.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Convert your WordPress website into a Progressive Web App
6
  * Author: SuperPWA
7
  * Contributors: Arun Basil Lal, Jose Varghese
8
- * Version: 1.1.1
9
  * Text Domain: super-progressive-web-apps
10
  * Domain Path: /languages
11
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@@ -47,7 +47,7 @@ if ( ! defined('ABSPATH') ) exit;
47
  */
48
  if ( ! defined('SUPERPWA_PATH_ABS ') ) define('SUPERPWA_PATH_ABS', plugin_dir_path( __FILE__ )); // absolute path to the plugin directory. eg - /var/www/html/wp-content/plugins/superpwa/
49
  if ( ! defined('SUPERPWA_PATH_SRC') ) define('SUPERPWA_PATH_SRC', plugin_dir_url( __FILE__ )); // link to the plugin folder. eg - http://example.com/wp/wp-content/plugins/superpwa/
50
- if ( ! defined('SUPERPWA_VERSION') ) define('SUPERPWA_VERSION', '1.1.1'); // Plugin version
51
  if ( ! defined('SUPERPWA_MANIFEST_FILENAME') ) define('SUPERPWA_MANIFEST_FILENAME', 'superpwa-manifest.json'); // Name of Manifest file
52
  if ( ! defined('SUPERPWA_MANIFEST_ABS') ) define('SUPERPWA_MANIFEST_ABS', trailingslashit( ABSPATH ) . SUPERPWA_MANIFEST_FILENAME); // Absolute path to manifest
53
  if ( ! defined('SUPERPWA_MANIFEST_SRC') ) define('SUPERPWA_MANIFEST_SRC', trailingslashit( get_bloginfo('wpurl') ) . SUPERPWA_MANIFEST_FILENAME); // Link to manifest
5
  * Description: Convert your WordPress website into a Progressive Web App
6
  * Author: SuperPWA
7
  * Contributors: Arun Basil Lal, Jose Varghese
8
+ * Version: 1.2
9
  * Text Domain: super-progressive-web-apps
10
  * Domain Path: /languages
11
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
47
  */
48
  if ( ! defined('SUPERPWA_PATH_ABS ') ) define('SUPERPWA_PATH_ABS', plugin_dir_path( __FILE__ )); // absolute path to the plugin directory. eg - /var/www/html/wp-content/plugins/superpwa/
49
  if ( ! defined('SUPERPWA_PATH_SRC') ) define('SUPERPWA_PATH_SRC', plugin_dir_url( __FILE__ )); // link to the plugin folder. eg - http://example.com/wp/wp-content/plugins/superpwa/
50
+ if ( ! defined('SUPERPWA_VERSION') ) define('SUPERPWA_VERSION', '1.2'); // Plugin version
51
  if ( ! defined('SUPERPWA_MANIFEST_FILENAME') ) define('SUPERPWA_MANIFEST_FILENAME', 'superpwa-manifest.json'); // Name of Manifest file
52
  if ( ! defined('SUPERPWA_MANIFEST_ABS') ) define('SUPERPWA_MANIFEST_ABS', trailingslashit( ABSPATH ) . SUPERPWA_MANIFEST_FILENAME); // Absolute path to manifest
53
  if ( ! defined('SUPERPWA_MANIFEST_SRC') ) define('SUPERPWA_MANIFEST_SRC', trailingslashit( get_bloginfo('wpurl') ) . SUPERPWA_MANIFEST_FILENAME); // Link to manifest