Super Progressive Web Apps - Version 1.8

Version Description

  • Date: 31.May.2018
  • Tested with WordPress 4.9.6.
  • New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
  • Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
  • Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
  • Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
  • Enhancement: Generated a .pot file with all strings for translation. You can also translate SuperPWA to your language by visiting translate.wordpress.org
  • Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
  • Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
Download this release

Release Info

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

Code changes from version 1.7.1 to 1.8

3rd-party/onesignal.php CHANGED
@@ -2,58 +2,147 @@
2
  /**
3
  * OneSignal integration
4
  *
 
 
5
  * @since 1.6
6
- * @function superpwa_onesignal_manifest_notice_check() Check if OneSignal integration notice should be displayed or not.
7
- * @function superpwa_onesignal_get_gcm_sender_id() Extract gcm_sender_id from OneSignal settings
 
 
 
 
8
  */
9
 
10
  // Exit if accessed directly
11
  if ( ! defined('ABSPATH') ) exit;
12
 
13
- /**
14
- * Check if OneSignal integration notice should be displayed or not.
15
- *
16
- * @return Bool True if notice should be displayed. False otherwise.
17
- * @since 1.5
18
- */
19
- function superpwa_onesignal_manifest_notice_check() {
20
-
21
- // No notice needed if OneSignal is not installed or there is no gcm_sender_id
22
- if ( ! superpwa_onesignal_get_gcm_sender_id() ) {
23
- return false;
24
- }
25
-
26
- // Get OneSignal settins
27
- $onesignal_wp_settings = get_option( 'OneSignalWPSetting' );
28
-
29
- // No notice needed if OneSignal custom manifest is enabled and the manifest is the SuperPWA manifest
30
- if (
31
- ( isset( $onesignal_wp_settings["use_custom_manifest"] ) ) && ( $onesignal_wp_settings["use_custom_manifest"] == 1 ) &&
32
- ( isset( $onesignal_wp_settings["custom_manifest_url"] ) ) && ( strcasecmp( trim( $onesignal_wp_settings["custom_manifest_url"] ), superpwa_manifest( 'src' ) ) == 0 )
33
- ) {
34
- return false;
35
- }
36
-
37
- // Display notice for every other case
38
- return true;
39
  }
40
 
41
  /**
42
- * Extract gcm_sender_id from OneSignal settings
43
  *
44
- * @link https://wordpress.org/plugins/onesignal-free-web-push-notifications/
45
  *
46
- * @return (String|Bool) gcm_sender_id of OneSignal if OneSignal is installed, false otherwise
47
- * @since 1.5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  */
49
- function superpwa_onesignal_get_gcm_sender_id() {
50
 
51
- // If OneSignal is installed and active
52
- if ( class_exists( 'OneSignal' ) ) {
53
-
54
- // This is the gcm_sender_id of OneSignal, same for all installs.
55
- return '482941778795';
56
- }
57
 
58
- return false;
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_add_gcm_sender_id() Add gcm_sender_id to SuperPWA manifest
10
+ * @function superpwa_onesignal_sw_filename() Change Service Worker filename to OneSignalSDKWorker.js.php
11
+ * @function superpwa_onesignal_sw() Import OneSignal service worker in SuperPWA
12
+ * @function superpwa_onesignal_activation() OneSignal activation todo
13
+ * @function superpwa_onesignal_deactivation() OneSignal deactivation todo
14
  */
15
 
16
  // Exit if accessed directly
17
  if ( ! defined('ABSPATH') ) exit;
18
 
19
+ // If OneSignal is installed and active
20
+ if ( class_exists( 'OneSignal' ) ) {
21
+
22
+ // Add gcm_sender_id to SuperPWA manifest
23
+ add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
24
+
25
+ // Change service worker filename to match OneSignal's service worker
26
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
27
+
28
+ // Import OneSignal service worker in SuperPWA
29
+ add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  /**
33
+ * Add gcm_sender_id to SuperPWA manifest
34
  *
35
+ * OneSignal's gcm_sender_id is 482941778795
36
  *
37
+ * @param (array) $manifest Array with the manifest entries passed via the superpwa_manifest filter.
38
+ *
39
+ * @return (array) Array appended with the gcm_sender_id of OneSignal
40
+ *
41
+ * @since 1.8
42
+ */
43
+ function superpwa_onesignal_add_gcm_sender_id( $manifest ) {
44
+
45
+ $manifest['gcm_sender_id'] = '482941778795';
46
+
47
+ return $manifest;
48
+ }
49
+
50
+ /**
51
+ * Change Service Worker filename to OneSignalSDKWorker.js.php
52
+ *
53
+ * OneSignalSDKWorker.js.php is the name of the service worker of OneSignal.
54
+ * Since only one service worker is allowed in a given scope, OneSignal unregisters all other service workers and registers theirs.
55
+ * Having the same name prevents OneSignal from unregistering our service worker.
56
+ *
57
+ * @link https://documentation.onesignal.com/docs/web-push-setup-faq
58
+ *
59
+ * @param (string) $sw_filename Filename of SuperPWA service worker passed via superpwa_sw_filename filter.
60
+ *
61
+ * @return (string) Service worker filename changed to OneSignalSDKWorker.js.php
62
+ *
63
+ * @since 1.8
64
+ */
65
+ function superpwa_onesignal_sw_filename( $sw_filename ) {
66
+ return 'OneSignalSDKWorker.js.php';
67
+ }
68
+
69
+ /**
70
+ * Import OneSignal service worker in SuperPWA
71
+ *
72
+ * @param (string) $sw Service worker template of SuperPWA passed via superpwa_sw_template filter
73
+ *
74
+ * @return (string) Import OneSignal's service worker into SuperPWA
75
+ *
76
+ * @since 1.8
77
  */
78
+ function superpwa_onesignal_sw( $sw ) {
79
 
80
+ $onesignal = '<?php' . PHP_EOL;
81
+ $onesignal .= 'header( "Content-Type: application/javascript" );' . PHP_EOL;
82
+ $onesignal .= 'echo "importScripts( \'' . superpwa_httpsify( plugin_dir_url( 'onesignal-free-web-push-notifications/onesignal.php' ) ) . 'sdk_files/OneSignalSDKWorker.js.php\' );";' . PHP_EOL;
83
+ $onesignal .= '?>' . PHP_EOL . PHP_EOL;
 
 
84
 
85
+ return $onesignal . $sw;
86
+ }
87
+
88
+ /**
89
+ * OneSignal activation todo
90
+ *
91
+ * Regenerates SuperPWA manifest with the gcm_sender_id added.
92
+ * Delete current service worker.
93
+ * Regenerate SuperPWA service worker with the new filename.
94
+ *
95
+ * @since 1.8
96
+ */
97
+ function superpwa_onesignal_activation() {
98
+
99
+ // Filter in gcm_sender_id to SuperPWA manifest
100
+ add_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
101
+
102
+ // Regenerate SuperPWA manifest
103
+ superpwa_generate_manifest();
104
+
105
+ // Delete service worker if it exists
106
+ superpwa_delete_sw();
107
+
108
+ // Change service worker filename to match OneSignal's service worker
109
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
110
+
111
+ // Import OneSignal service worker in SuperPWA
112
+ add_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
113
+
114
+ // Regenerate SuperPWA service worker
115
+ superpwa_generate_sw();
116
+ }
117
+ add_action( 'activate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_activation', 11 );
118
+
119
+ /**
120
+ * OneSignal deactivation todo
121
+ *
122
+ * Regenerates SuperPWA manifest.
123
+ * Delete current service worker.
124
+ * Regenerate SuperPWA service worker.
125
+ *
126
+ * @since 1.8
127
+ */
128
+ function superpwa_onesignal_deactivation() {
129
+
130
+ // Remove gcm_sender_id from SuperPWA manifest
131
+ remove_filter( 'superpwa_manifest', 'superpwa_onesignal_add_gcm_sender_id' );
132
+
133
+ // Regenerate SuperPWA manifest
134
+ superpwa_generate_manifest();
135
+
136
+ // Delete service worker if it exists
137
+ superpwa_delete_sw();
138
+
139
+ // Restore the default service worker of SuperPWA
140
+ remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
141
+
142
+ // Remove OneSignal service worker in SuperPWA
143
+ remove_filter( 'superpwa_sw_template', 'superpwa_onesignal_sw' );
144
+
145
+ // Regenerate SuperPWA service worker
146
+ superpwa_generate_sw();
147
+ }
148
+ add_action( 'deactivate_onesignal-free-web-push-notifications/onesignal.php', 'superpwa_onesignal_deactivation', 11 );
README.MD CHANGED
@@ -11,8 +11,8 @@
11
  </p>
12
 
13
  <p align="center">
14
- <a href="https://superpwa.com">
15
- <img src="https://pbs.twimg.com/profile_images/975224418543681536/X9-CESOD_400x400.jpg" alt="" width=150 height=150>
16
  </a>
17
 
18
  <h3 align="center">Super Progressive Web Apps</h3>
@@ -21,7 +21,7 @@
21
  SuperPWA helps to convert your WordPress website into Progressive Web Apps easily.
22
  <br>
23
  <br>
24
- <a href="https://superpwa.com"><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>
@@ -57,14 +57,21 @@
57
 
58
  ## Welcome to the Super PWA GitHub repository
59
 
60
- ⚡️ Demo : <a href="https://superpwa.com/?utm=GitHub">superpwa.com</a>
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">Super Progressive Web Apps</a> makes it easy for you to convert your WordPress website into a Progressive Web App easily!
 
 
 
 
 
 
 
68
 
69
  ## 🏗 Installation
70
  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!
@@ -96,16 +103,38 @@ Here are the current features of Super Progressive Web Apps:
96
  * New in version 1.4: You can now set the theme_color property in the manifest.
97
  * New in version 1.5: OneSignal integration for Push notifications.
98
  * New in version 1.6: WordPress Multisite Network compatibility.
99
- * 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) to track visits coming from your PWA.
 
 
100
 
101
  #### 🔮 Upcoming features:
102
  * Offline Indicator Notice.
103
 
104
  ### Device and Browser Support For PWA
105
- | <img src="https://user-images.githubusercontent.com/1215767/34348387-a2e64588-ea4d-11e7-8267-a43365103afe.png" alt="Chrome" width="16px" height="16px" /> Chrome | <img src="https://user-images.githubusercontent.com/1215767/34348383-9e7ed492-ea4d-11e7-910c-03b39d52f496.png" alt="Firefox" width="16px" height="16px" /> Firefox | <img src="https://user-images.githubusercontent.com/1215767/34348394-a981f892-ea4d-11e7-9156-d128d58386b9.png" alt="Safari" width="16px" height="16px" /> Safari | <img src="https://user-images.githubusercontent.com/1215767/34348380-93e77ae8-ea4d-11e7-8696-9a989ddbbbf5.png" alt="Edge" width="16px" height="16px" /> Edge | <img src="https://user-images.githubusercontent.com/1215767/34348380-93e77ae8-ea4d-11e7-8696-9a989ddbbbf5.png" alt="Edge" width="16px" height="16px" /> Edge (Mobile) | Opera Mini | Samsung Internet | Brave |
106
- | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: |
107
- | Yes | Yes | Partially | Beta | Yes | No | Yes | Yes |
108
- | 57+ | 57+ | 11.3+ | 17 ships | 1.0.0.1921 | - | 6.2+ | 1.0.44+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  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.
111
 
11
  </p>
12
 
13
  <p align="center">
14
+ <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=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>
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>
57
 
58
  ## Welcome to the Super PWA GitHub repository
59
 
60
+ ⚡️ Demo : <a href="https://superpwa.com/?utm_source=GitHub&utm_medium=readme-welcome">superpwa.com</a>
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://github.com/josevarghese/Progressive-Web-Apps-and-Service-Worker-Supported-Browsers/blob/master/20180513_120136.gif?raw=true" alt="Chrome" 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!
103
  * New in version 1.4: You can now set the theme_color property in the manifest.
104
  * New in version 1.5: OneSignal integration for Push notifications.
105
  * New in version 1.6: WordPress Multisite Network compatibility.
106
+ * 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.
107
+ * New in version 1.8: Compatibility issues with OneSignal are now resolved!
108
+ * 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.
109
 
110
  #### 🔮 Upcoming features:
111
  * Offline Indicator Notice.
112
 
113
  ### Device and Browser Support For PWA
114
+ | | <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 |
115
+ | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: | :---------: |
116
+ | 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" /> |
117
+ | 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" /> |
118
+ | 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" /> |
119
+ | 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" /> | - | - |
120
+ | 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" /> |
121
+
122
+ </br>
123
+
124
+ <p align="center">
125
+ <img src="https://image.flaticon.com/icons/svg/144/144008.svg" alt="Supported" width="32px" height="32px" /> Supported
126
+ &nbsp;
127
+ &nbsp;
128
+ &nbsp;
129
+ &nbsp;
130
+ <img src="https://image.flaticon.com/icons/svg/123/123381.svg" alt="Beta or Partial Support" width="32px" height="32px" /> Beta or Partial Support
131
+ &nbsp;
132
+ &nbsp;
133
+ &nbsp;
134
+ &nbsp;
135
+ <img src="https://image.flaticon.com/icons/svg/876/876101.svg" alt="In Development" width="32px" height="32px" /> In Development
136
+ </p>
137
+
138
 
139
  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.
140
 
addons/apple-touch-icons.php ADDED
@@ -0,0 +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' );
addons/utm-tracking.php CHANGED
@@ -231,7 +231,7 @@ function superpwa_utm_tracking_section_cb() {
231
  // Get add-on info
232
  $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
233
 
234
- printf( '<p>' . __( 'Add 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' );
235
  }
236
 
237
  /**
@@ -241,7 +241,7 @@ function superpwa_utm_tracking_section_cb() {
241
  */
242
  function superpwa_utm_tracking_start_url_cb() {
243
 
244
- echo '<code>' . superpwa_get_start_url( true ) . '</code>';
245
  }
246
 
247
  /**
@@ -260,8 +260,8 @@ function superpwa_utm_tracking_source_cb() {
260
 
261
  </fieldset>
262
 
263
- <p class="description" id="tagline-description">
264
- <?php _e( 'Source is mandatory and defaults to <code>superpwa</code>', 'super-progressive-web-apps' ); ?>
265
  </p>
266
 
267
  <?php
@@ -279,7 +279,7 @@ function superpwa_utm_tracking_medium_cb() {
279
 
280
  <fieldset>
281
 
282
- <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'] ); ?>"/>
283
 
284
  </fieldset>
285
 
@@ -298,7 +298,7 @@ function superpwa_utm_tracking_name_cb() {
298
 
299
  <fieldset>
300
 
301
- <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'] ); ?>"/>
302
 
303
  </fieldset>
304
 
@@ -317,7 +317,7 @@ function superpwa_utm_tracking_term_cb() {
317
 
318
  <fieldset>
319
 
320
- <input type="text" name="superpwa_utm_tracking_settings[utm_term]" class="regular-text" value="<?php if ( isset( $settings['utm_term'] ) && ( ! empty($settings['utm_term']) ) ) echo esc_attr( $settings['utm_term'] ); ?>"/>
321
 
322
  </fieldset>
323
 
@@ -336,7 +336,7 @@ function superpwa_utm_tracking_content_cb() {
336
 
337
  <fieldset>
338
 
339
- <input type="text" name="superpwa_utm_tracking_settings[utm_content]" class="regular-text" value="<?php if ( isset( $settings['utm_content'] ) && ( ! empty($settings['utm_content']) ) ) echo esc_attr( $settings['utm_content'] ); ?>"/>
340
 
341
  </fieldset>
342
 
231
  // Get add-on info
232
  $addon_utm_tracking = superpwa_get_addons( 'utm_tracking' );
233
 
234
+ 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' );
235
  }
236
 
237
  /**
241
  */
242
  function superpwa_utm_tracking_start_url_cb() {
243
 
244
+ echo '<code style="word-break: break-all;">' . superpwa_get_start_url( true ) . '</code>';
245
  }
246
 
247
  /**
260
 
261
  </fieldset>
262
 
263
+ <p class="description">
264
+ <?php _e( 'Campaign Source is mandatory and defaults to <code>superpwa</code>. The remaining fields are optional.', 'super-progressive-web-apps' ); ?>
265
  </p>
266
 
267
  <?php
279
 
280
  <fieldset>
281
 
282
+ <input type="text" name="superpwa_utm_tracking_settings[utm_medium]" placeholder="Optional" class="regular-text" value="<?php if ( isset( $settings['utm_medium'] ) && ( ! empty($settings['utm_medium']) ) ) echo esc_attr( $settings['utm_medium'] ); ?>"/>
283
 
284
  </fieldset>
285
 
298
 
299
  <fieldset>
300
 
301
+ <input type="text" name="superpwa_utm_tracking_settings[utm_campaign]" placeholder="Optional" class="regular-text" value="<?php if ( isset( $settings['utm_campaign'] ) && ( ! empty($settings['utm_campaign']) ) ) echo esc_attr( $settings['utm_campaign'] ); ?>"/>
302
 
303
  </fieldset>
304
 
317
 
318
  <fieldset>
319
 
320
+ <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'] ); ?>"/>
321
 
322
  </fieldset>
323
 
336
 
337
  <fieldset>
338
 
339
+ <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'] ); ?>"/>
340
 
341
  </fieldset>
342
 
admin/admin-ui-render-addons.php CHANGED
@@ -9,8 +9,8 @@
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_activator() Do bundled add-on activation and deactivation
13
- * @function superpwa_addons_handle_activation() Handle add-on activation and deactivation
14
  */
15
 
16
  // Exit if accessed directly
@@ -23,19 +23,23 @@ if ( ! defined( 'ABSPATH' ) ) exit;
23
  * array(
24
  * 'addon-slug' => array(
25
  * 'name' => 'Add-On Name',
26
- * 'type' => 'bundled | addon',
27
  * 'description' => 'Add-On description',
 
28
  * 'icon' => 'icon-for-addon-128x128.png',
29
  * 'link' => 'https://superpwa.com/addons/details-page-of-addon',
 
 
 
30
  * 'superpwa_min_version' => '1.7' // min version of SuperPWA required to use the add-on.
31
  * )
32
  * );
33
  *
34
  * @param (string) addon-slug to retrieve the details about a specific add-on. False by default and then returns all add-ons.
35
  *
36
- * @return (array) an associative array containing all the info about SuperPWA add-ons.
37
  *
38
  * @since 1.7
 
39
  */
40
  function superpwa_get_addons( $slug = false ) {
41
 
@@ -43,18 +47,36 @@ function superpwa_get_addons( $slug = false ) {
43
  $addons = array(
44
  'utm_tracking' => array(
45
  'name' => __( 'UTM Tracking', 'super-progressive-web-apps' ),
46
- 'type' => 'bundled',
47
  'description' => __( 'Track visits from your app by adding UTM tracking parameters to the Start Page URL.', 'super-progressive-web-apps' ),
 
48
  'icon' => 'superpwa-128x128.png',
49
  'link' => 'https://superpwa.com/addons/utm-tracking/',
 
 
 
50
  'superpwa_min_version' => '1.7',
51
  ),
 
 
 
 
 
 
 
 
 
 
 
52
  );
53
 
54
- if ( ( $slug === false ) || ( ! isset( $addons[$slug] ) ) ) {
55
  return $addons;
56
  }
57
 
 
 
 
 
58
  return $addons[$slug];
59
  }
60
 
@@ -70,24 +92,35 @@ function superpwa_addons_interface_render() {
70
  return;
71
  }
72
 
73
- // Add-on activation notice
74
  if ( isset( $_GET['activated'] ) && isset( $_GET['addon'] ) ) {
75
 
76
  // Add-on activation action. Functions defined in the add-on file are loaded by now.
77
  do_action( 'superpwa_addon_activated_' . $_GET['addon'] );
78
-
79
- // Add settings saved message with the class of "updated"
80
- add_settings_error( 'superpwa_settings_group', 'superpwa_addon_activated_message', __( 'Add-On activated.', 'super-progressive-web-apps' ), 'updated' );
81
 
82
- // Show Settings Saved Message
83
- settings_errors( 'superpwa_settings_group' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
  // Add-on de-activation notice
87
  if ( isset( $_GET['deactivated'] ) ) {
88
 
89
  // Add settings saved message with the class of "updated"
90
- add_settings_error( 'superpwa_settings_group', 'superpwa_addon_deactivated_message', __( 'Add-On deactivated.', 'super-progressive-web-apps' ), 'updated' );
91
 
92
  // Show Settings Saved Message
93
  settings_errors( 'superpwa_settings_group' );
@@ -113,7 +146,17 @@ function superpwa_addons_interface_render() {
113
  $superpwa_newsletter = true;
114
 
115
  // Looping over each add-on
116
- foreach( $addons as $slug => $addon ) { ?>
 
 
 
 
 
 
 
 
 
 
117
 
118
  <div class="plugin-card plugin-card-<?php echo $slug; ?>">
119
 
@@ -121,7 +164,7 @@ function superpwa_addons_interface_render() {
121
 
122
  <div class="name column-name">
123
  <h3>
124
- <a href="<?php echo $addon['link'] . '?utm_source=superpwa-plugin&utm_medium=addon-card'; ?>">
125
  <?php echo $addon['name']; ?>
126
  <img src="<?php echo SUPERPWA_PATH_SRC . 'admin/img/' . $addon['icon']; ?>" class="plugin-icon" alt="">
127
  </a>
@@ -149,11 +192,16 @@ function superpwa_addons_interface_render() {
149
 
150
  <div class="plugin-card-bottom">
151
  <div class="column-compatibility">
152
- <?php if ( version_compare( SUPERPWA_VERSION, $addon['superpwa_min_version'], '>=' ) ) { ?>
153
- <span class="compatibility-compatible"><?php _e( '<strong>Compatible</strong> with your version of SuperPWA', 'super-progressive-web-apps' ); ?></span>
154
- <?php } else { ?>
155
- <span class="compatibility-incompatible"><?php _e( '<strong>Please upgrade</strong> to the latest version of SuperPWA', 'super-progressive-web-apps' ); ?></span>
156
- <?php } ?>
 
 
 
 
 
157
  </div>
158
  </div>
159
 
@@ -224,18 +272,18 @@ function superpwa_addons_interface_render() {
224
  */
225
  function superpwa_addons_status( $slug ) {
226
 
227
- // Get add-ons array
228
- $addons = superpwa_get_addons();
229
 
230
  // A security check to make sure that the add-on under consideration exist.
231
- if ( ! isset( $addons[$slug] ) ) {
232
  return false;
233
  }
234
 
235
  // Get active add-ons
236
  $active_addons = get_option( 'superpwa_active_addons', array() );
237
 
238
- switch( $addons[$slug]['type'] ) {
239
 
240
  // Bundled add-ons ships with SuperPWA and need not be installed separately.
241
  case 'bundled':
@@ -323,8 +371,8 @@ function superpwa_addons_button_link( $slug ) {
323
  // Get the add-on status
324
  $addon_status = superpwa_addons_status( $slug );
325
 
326
- // Get add-ons array
327
- $addons = superpwa_get_addons();
328
 
329
  switch( $addon_status ) {
330
 
@@ -332,12 +380,12 @@ function superpwa_addons_button_link( $slug ) {
332
  case 'inactive':
333
 
334
  // Plugin activation link for add-on plugins that are installed separately.
335
- if ( $addons[$slug]['type'] == 'addon' ) {
336
  wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $slug ), 'activate-plugin_' . $slug );
337
  }
338
 
339
  // Activation link for bundled add-ons.
340
- return wp_nonce_url( admin_url( 'admin.php?page=superpwa-addons&addon=' . $slug ), 'activate', 'superpwa_addon_activate_nonce' );
341
 
342
  break;
343
 
@@ -345,122 +393,108 @@ function superpwa_addons_button_link( $slug ) {
345
  case 'active':
346
 
347
  // Plugin deactivation link for add-on plugins that are installed separately.
348
- if ( $addons[$slug]['type'] == 'addon' ) {
349
  wp_nonce_url( admin_url( 'plugins.php?action=deactivate&plugin=' . $slug ), 'deactivate-plugin_' . $slug );
350
  }
351
 
352
  // Deactivation link for bundled add-ons.
353
- return wp_nonce_url( admin_url( 'admin.php?page=superpwa-addons&addon=' . $slug ), 'deactivate', 'superpwa_addon_deactivate_nonce' );
354
 
355
  break;
356
 
357
  // If add-on is not installed and for edge cases where $addon_status is false, we use the add-on link.
358
  case 'uninstalled':
359
  default:
360
- return $addons[$slug]['link'];
361
  break;
362
  }
363
  }
364
 
365
  /**
366
- * Do add-on activation and deactivation
367
- *
368
- * Adds/removes the Add-On slug from the $settings['active_addons'] in SuperPWA settings.
369
- *
370
- * @param $slug (string) this is the $key used in the $addons array in superpwa_get_addons().
371
- * @param $status (boolean) True to activate, False to deactivate.
372
- *
373
- * @return (boolean) True on success, false otherwise.
374
- * Success = intended action, i.e. if deactivation is the intend, then success means successful deactivation.
375
  *
 
 
 
376
  * @since 1.7
 
 
377
  */
378
- function superpwa_addons_activator( $slug, $status ) {
379
 
380
  // Get the add-on status
381
- $addon_status = superpwa_addons_status( $slug );
382
 
383
- // Check if its a valid add-on
384
- if ( ! $addon_status ) {
385
- return false;
 
 
 
 
 
 
 
 
386
  }
387
-
388
  // Get active add-ons
389
  $active_addons = get_option( 'superpwa_active_addons', array() );
390
 
391
- // Activate add-on
392
- if ( ( $status === true ) && ( $addon_status == 'inactive' ) ) {
393
-
394
- // Add the add-on to the list of active add-ons
395
- $active_addons[] = $slug;
396
-
397
- // Write settings back to database
398
- update_option( 'superpwa_active_addons', $active_addons );
399
-
400
- return true;
401
- }
402
 
403
- // De-activate add-on
404
- if ( ( $status === false ) && ( $addon_status == 'active' ) ) {
405
-
406
- // Delete the add-on from the active_addons array in SuperPWA settings.
407
- $active_addons = array_flip( $active_addons );
408
- unset( $active_addons[$slug] );
409
- $active_addons = array_flip( $active_addons );
410
-
411
- // Write settings back to database
412
- update_option( 'superpwa_active_addons', $active_addons );
413
-
414
- // Add-on deactivation action. Functions defined in the add-on file are still availalbe at this point.
415
- do_action( 'superpwa_addon_deactivated_' . $slug );
416
 
417
- return true;
418
- }
419
-
420
- return false;
421
  }
 
422
 
423
  /**
424
- * Handle add-on activation and deactivation
425
- *
426
- * Verifies that the activation / deactivation request is valid and calls superpwa_addons_activator()
427
- * then redirects the page back to the add-ons page.
428
- *
429
- * Hooked onto load-superpwa_page_superpwa-addons action hook and is called every time the add-ons page is loaded
430
  *
431
- * @param void
432
- * @return void
433
  *
434
- * @since 1.7
435
  */
436
- function superpwa_addons_handle_activation() {
 
 
 
437
 
438
  // Authentication
439
- if ( ! isset( $_GET['addon'] ) || ! current_user_can( 'manage_options' ) ) {
440
- return;
441
- }
442
-
443
- // Handing add-on activation
444
- if ( isset( $_GET['superpwa_addon_activate_nonce'] ) && isset( $_GET['addon'] ) && wp_verify_nonce( $_GET['superpwa_addon_activate_nonce'], 'activate' ) ) {
445
 
446
- // Handling activation
447
- if ( superpwa_addons_activator( $_GET['addon'], true ) === true ) {
448
-
449
- // Redirect to add-ons sub-menu
450
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons&activated=1&addon=' . $_GET['addon'] ) );
451
- exit;
452
- }
453
  }
454
 
455
- // Handing add-on de-activation
456
- if ( isset( $_GET['superpwa_addon_deactivate_nonce'] ) && isset( $_GET['addon'] ) && wp_verify_nonce( $_GET['superpwa_addon_deactivate_nonce'], 'deactivate' ) ) {
 
 
 
 
 
457
 
458
- // Handling deactivation
459
- if ( superpwa_addons_activator( $_GET['addon'], false ) === true ) {
460
-
461
- wp_redirect( admin_url( 'admin.php?page=superpwa-addons&deactivated=1&addon=' . $_GET['addon'] ) );
462
- exit;
463
- }
464
- }
 
 
465
  }
466
- add_action( 'load-superpwa_page_superpwa-addons', 'superpwa_addons_handle_activation' );
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
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
 
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
 
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' );
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
 
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>
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
 
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':
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
 
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
 
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' );
admin/admin-ui-render-settings.php CHANGED
@@ -56,7 +56,7 @@ function superpwa_app_short_name_cb() {
56
 
57
  <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']); ?>"/>
58
 
59
- <p class="description" id="tagline-description">
60
  <?php _e('Used when there is insufficient space to display the full name of the application. <code>12</code> characters or less.', 'super-progressive-web-apps'); ?>
61
  </p>
62
 
@@ -79,7 +79,7 @@ function superpwa_description_cb() {
79
 
80
  <input type="text" name="superpwa_settings[description]" class="regular-text" value="<?php if ( isset( $settings['description'] ) && ( ! empty( $settings['description'] ) ) ) echo esc_attr( $settings['description'] ); ?>"/>
81
 
82
- <p class="description" id="tagline-description">
83
  <?php _e( 'A brief description of what your app is about.', 'super-progressive-web-apps' ); ?>
84
  </p>
85
 
@@ -104,7 +104,7 @@ function superpwa_app_icon_cb() {
104
  <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> Choose Icon
105
  </button>
106
 
107
- <p class="description" id="tagline-description">
108
  <?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'); ?>
109
  </p>
110
 
@@ -127,7 +127,7 @@ function superpwa_splash_icon_cb() {
127
  <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> Choose Icon
128
  </button>
129
 
130
- <p class="description" id="tagline-description">
131
  <?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'); ?>
132
  </p>
133
 
@@ -147,7 +147,7 @@ function superpwa_background_color_cb() {
147
  <!-- Background Color -->
148
  <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">
149
 
150
- <p class="description" id="tagline-description">
151
  <?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?>
152
  </p>
153
 
@@ -167,7 +167,7 @@ function superpwa_theme_color_cb() {
167
  <!-- Theme Color -->
168
  <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">
169
 
170
- <p class="description" id="tagline-description">
171
  <?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'); ?>
172
  </p>
173
 
@@ -197,7 +197,7 @@ function superpwa_start_url_cb() {
197
  )); ?>
198
  </label>
199
 
200
- <p class="description" id="tagline-description">
201
  <?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() ); ?>
202
  </p>
203
 
@@ -211,7 +211,7 @@ function superpwa_start_url_cb() {
211
 
212
  <!-- AMP for WordPress 0.6.2 doesn't support homepage, the blog index, and archive pages. -->
213
  <?php if ( function_exists( 'amp_init' ) ) { ?>
214
- <p class="description" id="tagline-description">
215
  <?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' ); ?>
216
  </p>
217
  <?php } ?>
@@ -244,7 +244,7 @@ function superpwa_offline_page_cb() {
244
  )); ?>
245
  </label>
246
 
247
- <p class="description" id="tagline-description">
248
  <?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']) ? get_permalink( $settings['offline_page'] ) : get_bloginfo( 'wpurl' ) ); ?>
249
  </p>
250
 
@@ -276,7 +276,7 @@ function superpwa_orientation_cb() {
276
  </select>
277
  </label>
278
 
279
- <p class="description" id="tagline-description">
280
  <?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' ); ?>
281
  </p>
282
 
@@ -286,16 +286,23 @@ function superpwa_orientation_cb() {
286
  /**
287
  * Manifest Status
288
  *
289
- * @since 1.0
 
290
  */
291
  function superpwa_manifest_status_cb() {
292
-
293
- if ( superpwa_get_contents( superpwa_manifest( 'abs' ) ) ) {
 
 
 
 
 
 
294
 
295
- 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' ) );
296
  } else {
297
 
298
- 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>';
299
  }
300
  }
301
 
@@ -303,15 +310,17 @@ function superpwa_manifest_status_cb() {
303
  * Service Worker Status
304
  *
305
  * @since 1.2
 
306
  */
307
  function superpwa_sw_status_cb() {
308
 
309
- if ( superpwa_get_contents( superpwa_sw( 'abs' ) ) ) {
 
310
 
311
  printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Service worker generated successfully.', 'super-progressive-web-apps' ) . '</p>' );
312
  } else {
313
 
314
- 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>';
315
  }
316
  }
317
 
@@ -352,18 +361,6 @@ function superpwa_admin_interface_render() {
352
 
353
  // Show Settings Saved Message
354
  settings_errors( 'superpwa_settings_group' );
355
- }
356
-
357
- // Display the notice to use SuperPWA manifest as OneSignal custom manifest.
358
- if ( superpwa_onesignal_manifest_notice_check() ) {
359
-
360
- echo '<div class="notice notice-error"><p>' .
361
- sprintf(
362
- __( '<strong>To integrate with OneSignal:</strong> Enable <strong>Use my own manifest.json</strong> and set <code>%s</code><br>as <strong>Custom manifest.json URL</strong> in <a href="%s" target="_blank">OneSignal Configuration > Advanced Settings &rarr;</a>', 'super-progressive-web-apps' ),
363
- superpwa_manifest( 'src' ),
364
- admin_url( 'admin.php?page=onesignal-push#configuration' )
365
- ) .
366
- '</p></div>';
367
  }
368
 
369
  ?>
56
 
57
  <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']); ?>"/>
58
 
59
+ <p class="description">
60
  <?php _e('Used when there is insufficient space to display the full name of the application. <code>12</code> characters or less.', 'super-progressive-web-apps'); ?>
61
  </p>
62
 
79
 
80
  <input type="text" name="superpwa_settings[description]" class="regular-text" value="<?php if ( isset( $settings['description'] ) && ( ! empty( $settings['description'] ) ) ) echo esc_attr( $settings['description'] ); ?>"/>
81
 
82
+ <p class="description">
83
  <?php _e( 'A brief description of what your app is about.', 'super-progressive-web-apps' ); ?>
84
  </p>
85
 
104
  <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> Choose Icon
105
  </button>
106
 
107
+ <p class="description">
108
  <?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'); ?>
109
  </p>
110
 
127
  <span class="dashicons dashicons-format-image" style="margin-top: 4px;"></span> Choose Icon
128
  </button>
129
 
130
+ <p class="description">
131
  <?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'); ?>
132
  </p>
133
 
147
  <!-- Background Color -->
148
  <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">
149
 
150
+ <p class="description">
151
  <?php _e('Background color of the splash screen.', 'super-progressive-web-apps'); ?>
152
  </p>
153
 
167
  <!-- Theme Color -->
168
  <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">
169
 
170
+ <p class="description">
171
  <?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'); ?>
172
  </p>
173
 
197
  )); ?>
198
  </label>
199
 
200
+ <p class="description">
201
  <?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() ); ?>
202
  </p>
203
 
211
 
212
  <!-- AMP for WordPress 0.6.2 doesn't support homepage, the blog index, and archive pages. -->
213
  <?php if ( function_exists( 'amp_init' ) ) { ?>
214
+ <p class="description">
215
  <?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' ); ?>
216
  </p>
217
  <?php } ?>
244
  )); ?>
245
  </label>
246
 
247
+ <p class="description">
248
  <?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']) ? get_permalink( $settings['offline_page'] ) : get_bloginfo( 'wpurl' ) ); ?>
249
  </p>
250
 
276
  </select>
277
  </label>
278
 
279
+ <p class="description">
280
  <?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' ); ?>
281
  </p>
282
 
286
  /**
287
  * Manifest Status
288
  *
289
+ * @since 1.2
290
+ * @since 1.8 Attempt to generate manifest again if the manifest doesn't exist.
291
  */
292
  function superpwa_manifest_status_cb() {
293
+
294
+ /**
295
+ * Check to see if the manifest exists, If not attempts to generate a new one.
296
+ *
297
+ * Users who had permissions issue in the beginning will check the status after changing file system permissions.
298
+ * At this point we try to generate the manifest and service worker to see if its possible with the new permissions.
299
+ */
300
+ if ( superpwa_get_contents( superpwa_manifest( 'abs' ) ) || superpwa_generate_manifest() ) {
301
 
302
+ 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' ) );
303
  } else {
304
 
305
+ printf( '<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). <a href="%s" target="_blank">Read more &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' );
306
  }
307
  }
308
 
310
  * Service Worker Status
311
  *
312
  * @since 1.2
313
+ * @since 1.8 Attempt to generate service worker again if it doesn't exist.
314
  */
315
  function superpwa_sw_status_cb() {
316
 
317
+ // See superpwa_manifest_status_cb() for documentation.
318
+ if ( superpwa_get_contents( superpwa_sw( 'abs' ) ) || superpwa_generate_sw() ) {
319
 
320
  printf( '<p><span class="dashicons dashicons-yes" style="color: #46b450;"></span> ' . __( 'Service worker generated successfully.', 'super-progressive-web-apps' ) . '</p>' );
321
  } else {
322
 
323
+ printf( '<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). <a href="%s" target="_blank">Read more &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' );
324
  }
325
  }
326
 
361
 
362
  // Show Settings Saved Message
363
  settings_errors( 'superpwa_settings_group' );
 
 
 
 
 
 
 
 
 
 
 
 
364
  }
365
 
366
  ?>
admin/{admin-setup.php → admin-ui-setup.php} RENAMED
@@ -7,6 +7,7 @@
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_after_save_settings_todo() Todo list after saving admin options
11
  * @function superpwa_footer_text() Admin footer text
12
  * @function superpwa_footer_version() Admin footer version
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
admin/basic-setup.php CHANGED
@@ -5,8 +5,8 @@
5
  * @since 1.0
6
  *
7
  * @function superpwa_activate_plugin() Plugin activatation todo list
8
- * @function superpwa_admin_notice_activation() Admin notice on plugin activation
9
- * @function superpwa_network_admin_notice_activation() Admin notice on multisite network activation
10
  * @function superpwa_upgrader() Plugin upgrade todo list
11
  * @function superpwa_deactivate_plugin() Plugin deactivation todo list
12
  * @function superpwa_load_plugin_textdomain() Load plugin text domain
@@ -43,57 +43,83 @@ function superpwa_activate_plugin( $network_active ) {
43
  if ( ! $network_active ) {
44
 
45
  // Set transient for single site activation notice
46
- set_transient( 'superpwa_admin_notice_activation', true, 5 );
47
 
48
  return;
49
  }
50
 
51
  // If we are here, then plugin is network activated on a multisite. Set transient for activation notice on network admin.
52
- set_transient( 'superpwa_network_admin_notice_activation', true, 5 );
53
  }
54
  register_activation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_activate_plugin' );
55
 
56
  /**
57
- * Admin notice on plugin activation
58
  *
59
- * @since 1.2
60
  */
61
- function superpwa_admin_notice_activation() {
62
-
63
- // Return if transient is not set
64
- if ( ! get_transient( 'superpwa_admin_notice_activation' ) ) {
65
  return;
66
  }
 
 
 
67
 
68
- $superpwa_is_ready = is_ssl() && superpwa_get_contents( superpwa_manifest( 'abs' ) ) && superpwa_get_contents( superpwa_sw( 'abs' ) ) && ( ! superpwa_onesignal_manifest_notice_check() ) ? 'Your app is ready with the default settings. ' : '';
69
-
70
- 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>';
 
 
 
 
71
 
72
- // Delete transient
73
- delete_transient( 'superpwa_admin_notice_activation' );
 
 
 
 
 
 
74
  }
75
- add_action( 'admin_notices', 'superpwa_admin_notice_activation' );
76
 
77
  /**
78
- * Admin notice on multisite network activation
79
  *
80
- * @since 1.6
81
  */
82
- function superpwa_network_admin_notice_activation() {
83
-
84
- // Return if transient is not set
85
- if ( ! get_transient( 'superpwa_network_admin_notice_activation' ) ) {
86
  return;
87
  }
 
 
 
88
 
89
- $superpwa_is_ready = is_ssl() && superpwa_get_contents( superpwa_manifest( 'abs' ) ) && superpwa_get_contents( superpwa_sw( 'abs' ) ) && ( ! superpwa_onesignal_manifest_notice_check() ) ? 'Your app is ready on the main website with the default settings. ' : '';
90
-
91
- 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( 'options-general.php?page=superpwa' ) ) . '</p></div>';
 
 
 
 
92
 
93
- // Delete transient
94
- delete_transient( 'superpwa_network_admin_notice_activation' );
 
 
 
 
 
 
95
  }
96
- add_action( 'network_admin_notices', 'superpwa_network_admin_notice_activation' );
97
 
98
  /**
99
  * Plugin upgrade todo list
@@ -112,7 +138,7 @@ function superpwa_upgrader() {
112
  }
113
 
114
  /**
115
- * Return if this is the first time the plugin is installed.
116
  *
117
  * On a multisite, during network activation, the activation hook (and activation todo) is not fired.
118
  * Manifest and service worker is generated the first time the wp-admin is loaded (when admin_init is fired).
@@ -138,13 +164,15 @@ function superpwa_upgrader() {
138
  }
139
 
140
  /**
141
- * Add orientation and theme_color to database when upgrading from pre 1.4 versions
142
  *
143
  * Until 1.4, there was no UI for orientation and theme_color.
144
  * In the manifest, orientation was hard coded as 'natural'.
145
  * background_color had UI and this value was used for both background_color and theme_color in the manifest.
 
 
146
  */
147
- if ( version_compare( $current_ver, '1.4', '<' ) ) {
148
 
149
  // Get settings
150
  $settings = superpwa_get_settings();
@@ -159,6 +187,28 @@ function superpwa_upgrader() {
159
  update_option( 'superpwa_settings', $settings );
160
  }
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  // Re-generate manifest
163
  superpwa_generate_manifest();
164
 
@@ -170,6 +220,9 @@ function superpwa_upgrader() {
170
 
171
  // For multisites, save the activation status of current blog.
172
  superpwa_multisite_activation_status( true );
 
 
 
173
  }
174
  add_action( 'admin_init', 'superpwa_upgrader' );
175
 
@@ -223,7 +276,7 @@ function superpwa_settings_link( $links ) {
223
 
224
  return array_merge(
225
  array(
226
- 'settings' => '<a href="' . admin_url( 'options-general.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>'
227
  ),
228
  $links
229
  );
@@ -239,7 +292,7 @@ function superpwa_plugin_row_meta( $links, $file ) {
239
 
240
  if ( strpos( $file, 'superpwa.php' ) !== false ) {
241
  $new_links = array(
242
- 'demo' => '<a href="https://superpwa.com" target="_blank">' . __( 'Demo', 'super-progressive-web-apps' ) . '</a>',
243
  );
244
  $links = array_merge( $links, $new_links );
245
  }
5
  * @since 1.0
6
  *
7
  * @function superpwa_activate_plugin() Plugin activatation todo list
8
+ * @function superpwa_admin_notices() Admin notices
9
+ * @function superpwa_network_admin_notices() Network Admin notices
10
  * @function superpwa_upgrader() Plugin upgrade todo list
11
  * @function superpwa_deactivate_plugin() Plugin deactivation todo list
12
  * @function superpwa_load_plugin_textdomain() Load plugin text domain
43
  if ( ! $network_active ) {
44
 
45
  // Set transient for single site activation notice
46
+ set_transient( 'superpwa_admin_notice_activation', true, 60 );
47
 
48
  return;
49
  }
50
 
51
  // If we are here, then plugin is network activated on a multisite. Set transient for activation notice on network admin.
52
+ set_transient( 'superpwa_network_admin_notice_activation', true, 60 );
53
  }
54
  register_activation_hook( SUPERPWA_PATH_ABS . 'superpwa.php', 'superpwa_activate_plugin' );
55
 
56
  /**
57
+ * Admin Notices
58
  *
59
+ * @since 1.2 Admin notice on plugin activation
60
  */
61
+ function superpwa_admin_notices() {
62
+
63
+ // Notices only for admins
64
+ if ( ! current_user_can( 'manage_options' ) ) {
65
  return;
66
  }
67
+
68
+ // Admin notice on plugin activation
69
+ if ( get_transient( 'superpwa_admin_notice_activation' ) ) {
70
 
71
+ $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. ' : '';
72
+
73
+ 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( 'admin.php?page=superpwa' ) ) . '</p></div>';
74
+
75
+ // Delete transient
76
+ delete_transient( 'superpwa_admin_notice_activation' );
77
+ }
78
 
79
+ // Admin notice on plugin upgrade
80
+ if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
81
+
82
+ 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>';
83
+
84
+ // Delete transient
85
+ delete_transient( 'superpwa_admin_notice_upgrade_complete' );
86
+ }
87
  }
88
+ add_action( 'admin_notices', 'superpwa_admin_notices' );
89
 
90
  /**
91
+ * Network Admin notices
92
  *
93
+ * @since 1.6 Admin notice on multisite network activation
94
  */
95
+ function superpwa_network_admin_notices() {
96
+
97
+ // Notices only for admins
98
+ if ( ! current_user_can( 'manage_options' ) ) {
99
  return;
100
  }
101
+
102
+ // Network admin notice on multisite network activation
103
+ if ( get_transient( 'superpwa_network_admin_notice_activation' ) ) {
104
 
105
+ $superpwa_is_ready = is_ssl() && superpwa_get_contents( superpwa_manifest( 'abs' ) ) && superpwa_get_contents( superpwa_sw( 'abs' ) ) ? 'Your app is ready on the main website with the default settings. ' : '';
106
+
107
+ 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>';
108
+
109
+ // Delete transient
110
+ delete_transient( 'superpwa_network_admin_notice_activation' );
111
+ }
112
 
113
+ // Network admin notice on plugin upgrade
114
+ if ( get_transient( 'superpwa_admin_notice_upgrade_complete' ) ) {
115
+
116
+ 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-mu' ) . '</p></div>';
117
+
118
+ // Delete transient
119
+ delete_transient( 'superpwa_admin_notice_upgrade_complete' );
120
+ }
121
  }
122
+ add_action( 'network_admin_notices', 'superpwa_network_admin_notices' );
123
 
124
  /**
125
  * Plugin upgrade todo list
138
  }
139
 
140
  /**
141
+ * Todo list for fresh install.
142
  *
143
  * On a multisite, during network activation, the activation hook (and activation todo) is not fired.
144
  * Manifest and service worker is generated the first time the wp-admin is loaded (when admin_init is fired).
164
  }
165
 
166
  /**
167
+ * Add orientation and theme_color to database when upgrading from pre 1.4 versions.
168
  *
169
  * Until 1.4, there was no UI for orientation and theme_color.
170
  * In the manifest, orientation was hard coded as 'natural'.
171
  * background_color had UI and this value was used for both background_color and theme_color in the manifest.
172
+ *
173
+ * @since 1.4
174
  */
175
+ if ( version_compare( $current_ver, '1.3.1', '<=' ) ) {
176
 
177
  // Get settings
178
  $settings = superpwa_get_settings();
187
  update_option( 'superpwa_settings', $settings );
188
  }
189
 
190
+ /**
191
+ * Delete existing service worker for single sites that use OneSignal.
192
+ *
193
+ * For OneSignal compatibility, in version 1.8 the service worker filename is renamed.
194
+ * If OneSignal is active, by this point, the new filename will be filtered in.
195
+ * This upgrade routine restores the defaul service worker filename and deletes the existing service worker.
196
+ * Also adds back the filter for new filename. OneSignal compatibility for multisites is not available at this point.
197
+ *
198
+ * @since 1.8
199
+ */
200
+ if ( version_compare( $current_ver, '1.7.1', '<=' ) && class_exists( 'OneSignal' ) && ! is_multisite() ) {
201
+
202
+ // Restore the default service worker filename of SuperPWA.
203
+ remove_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
204
+
205
+ // Delete service worker if it exists.
206
+ superpwa_delete_sw();
207
+
208
+ // Change service worker filename to match OneSignal's service worker.
209
+ add_filter( 'superpwa_sw_filename', 'superpwa_onesignal_sw_filename' );
210
+ }
211
+
212
  // Re-generate manifest
213
  superpwa_generate_manifest();
214
 
220
 
221
  // For multisites, save the activation status of current blog.
222
  superpwa_multisite_activation_status( true );
223
+
224
+ // Set transient for upgrade complete notice
225
+ set_transient( 'superpwa_admin_notice_upgrade_complete', true, 60 );
226
  }
227
  add_action( 'admin_init', 'superpwa_upgrader' );
228
 
276
 
277
  return array_merge(
278
  array(
279
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=superpwa' ) . '">' . __( 'Settings', 'super-progressive-web-apps' ) . '</a>'
280
  ),
281
  $links
282
  );
292
 
293
  if ( strpos( $file, 'superpwa.php' ) !== false ) {
294
  $new_links = array(
295
+ 'demo' => '<a href="https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin_row_meta" target="_blank">' . __( 'Demo', 'super-progressive-web-apps' ) . '</a>',
296
  );
297
  $links = array_merge( $links, $new_links );
298
  }
functions/filesystem.php CHANGED
@@ -3,6 +3,7 @@
3
  * Filesystem Operations
4
  *
5
  * @since 1.0
 
6
  * @function superpwa_wp_filesystem_init() Initialize the WP filesystem
7
  * @function superpwa_put_contents() Write to a file using WP_Filesystem() functions
8
  * @function superpwa_get_contents() Read contents of a file using WP_Filesystem() functions
@@ -33,13 +34,15 @@ function superpwa_wp_filesystem_init() {
33
  * @param $file Filename with path
34
  * @param $content Contents to be written to the file. Default null
35
  * @return True on success, false if file isn't passed or if writing failed.
 
36
  * @since 1.0
37
  */
38
  function superpwa_put_contents( $file, $content = null ) {
39
 
40
  // Return false if no filename is provided
41
- if ( empty( $file ) )
42
  return false;
 
43
 
44
  // Initialize the WP filesystem
45
  superpwa_wp_filesystem_init();
@@ -56,23 +59,26 @@ function superpwa_put_contents( $file, $content = null ) {
56
  * Read contents of a file using WP_Filesystem() functions
57
  *
58
  * @param $file Filename with path.
59
- * @paral $array Set true to return read data as an array. False by default.
60
- * @return string|bool The function returns the read data or false on failure.
 
61
  * @since 1.0
62
  */
63
  function superpwa_get_contents( $file, $array = false ) {
64
 
65
  // Return false if no filename is provided
66
- if ( empty( $file ) )
67
  return false;
 
68
 
69
  // Initialize the WP filesystem
70
  superpwa_wp_filesystem_init();
71
  global $wp_filesystem;
72
 
73
  // Reads entire file into a string
74
- if ( $array == false )
75
  return $wp_filesystem->get_contents( $file );
 
76
 
77
  // Reads entire file into an array
78
  return $wp_filesystem->get_contents_array( $file );
@@ -83,13 +89,15 @@ function superpwa_get_contents( $file, $array = false ) {
83
  *
84
  * @param $file Filename with path
85
  * @return bool True on success, false otherwise
 
86
  * @since 1.0
87
  */
88
  function superpwa_delete( $file ) {
89
 
90
  // Return false if no filename is provided
91
- if ( empty( $file ) )
92
  return false;
 
93
 
94
  // Initialize the WP filesystem
95
  superpwa_wp_filesystem_init();
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
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();
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 );
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();
languages/super-progressive-web-apps.pot CHANGED
@@ -0,0 +1,395 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-05-30 17:29:08+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #. #-#-#-#-# super-progressive-web-apps.pot (Super Progressive Web Apps 1.8) #-#-#-#-#
17
+ #. Plugin Name of the plugin/theme
18
+ #: addons/utm-tracking.php:35 admin/admin-ui-setup.php:28
19
+ #: admin/admin-ui-setup.php:31 admin/admin-ui-setup.php:34
20
+ msgid "Super Progressive Web Apps"
21
+ msgstr ""
22
+
23
+ #: addons/utm-tracking.php:35 admin/admin-ui-render-addons.php:49
24
+ msgid "UTM Tracking"
25
+ msgstr ""
26
+
27
+ #: addons/utm-tracking.php:146
28
+ msgid "Current Start URL"
29
+ msgstr ""
30
+
31
+ #: addons/utm-tracking.php:155
32
+ msgid "Campaign Source"
33
+ msgstr ""
34
+
35
+ #: addons/utm-tracking.php:164
36
+ msgid "Campaign Medium"
37
+ msgstr ""
38
+
39
+ #: addons/utm-tracking.php:173
40
+ msgid "Campaign Name"
41
+ msgstr ""
42
+
43
+ #: addons/utm-tracking.php:182
44
+ msgid "Campaign Term"
45
+ msgstr ""
46
+
47
+ #: addons/utm-tracking.php:191
48
+ msgid "Campaign Content"
49
+ msgstr ""
50
+
51
+ #: addons/utm-tracking.php:234
52
+ msgid ""
53
+ "This add-on automatically adds UTM campaign parameters to the <code>Start "
54
+ "Page</code> URL in your <a href=\"%s\" target=\"_blank\">manifest</a>. This "
55
+ "will help you identify visitors coming specifically from your app. <a href="
56
+ "\"%s\" target=\"_blank\">Read more</a> about UTM Tracking."
57
+ msgstr ""
58
+
59
+ #: addons/utm-tracking.php:264
60
+ msgid ""
61
+ "Campaign Source is mandatory and defaults to <code>superpwa</code>. The "
62
+ "remaining fields are optional."
63
+ msgstr ""
64
+
65
+ #: addons/utm-tracking.php:362 admin/admin-ui-render-settings.php:360
66
+ msgid "Settings saved."
67
+ msgstr ""
68
+
69
+ #: addons/utm-tracking.php:371
70
+ msgid "UTM Tracking for"
71
+ msgstr ""
72
+
73
+ #: addons/utm-tracking.php:382 admin/admin-ui-render-settings.php:383
74
+ msgid "Save Settings"
75
+ msgstr ""
76
+
77
+ #: admin/admin-ui-render-addons.php:50
78
+ msgid ""
79
+ "Track visits from your app by adding UTM tracking parameters to the Start "
80
+ "Page URL."
81
+ msgstr ""
82
+
83
+ #: admin/admin-ui-render-addons.php:55
84
+ msgid "Customize Settings &rarr;"
85
+ msgstr ""
86
+
87
+ #: admin/admin-ui-render-addons.php:60
88
+ msgid "Apple Touch Icons"
89
+ msgstr ""
90
+
91
+ #: admin/admin-ui-render-addons.php:61
92
+ msgid ""
93
+ "Set the Application Icon and Splash Screen Icon as Apple Touch Icons for "
94
+ "compatibility with iOS devices."
95
+ msgstr ""
96
+
97
+ #: admin/admin-ui-render-addons.php:66
98
+ msgid "More Details &rarr;"
99
+ msgstr ""
100
+
101
+ #: admin/admin-ui-render-addons.php:115
102
+ msgid "<strong>Add-On activated: %s.</strong> <a href=\"%s\"%s>%s</a>"
103
+ msgstr ""
104
+
105
+ #: admin/admin-ui-render-addons.php:123
106
+ msgid "Add-On deactivated"
107
+ msgstr ""
108
+
109
+ #: admin/admin-ui-render-addons.php:135
110
+ msgid "Add-Ons for"
111
+ msgstr ""
112
+
113
+ #: admin/admin-ui-render-addons.php:137
114
+ msgid "Add-Ons extend the functionality of SuperPWA."
115
+ msgstr ""
116
+
117
+ #: admin/admin-ui-render-addons.php:177 admin/admin-ui-render-addons.php:349
118
+ msgid "Deactivate"
119
+ msgstr ""
120
+
121
+ #: admin/admin-ui-render-addons.php:182
122
+ msgid "More information about %s"
123
+ msgstr ""
124
+
125
+ #: admin/admin-ui-render-addons.php:182
126
+ msgid "More Details"
127
+ msgstr ""
128
+
129
+ #: admin/admin-ui-render-addons.php:197
130
+ msgid ""
131
+ "<span class=\"compatibility-compatible\"><strong>Add-On active.</strong> <a "
132
+ "href=\"%s\"%s>%s</a></span>"
133
+ msgstr ""
134
+
135
+ #: admin/admin-ui-render-addons.php:200
136
+ msgid ""
137
+ "<span class=\"compatibility-compatible\"><strong>Compatible</strong> with "
138
+ "your version of SuperPWA</span>"
139
+ msgstr ""
140
+
141
+ #: admin/admin-ui-render-addons.php:203
142
+ msgid ""
143
+ "<span class=\"compatibility-incompatible\"><strong>Please upgrade</strong> "
144
+ "to the latest version of SuperPWA</span>"
145
+ msgstr ""
146
+
147
+ #: admin/admin-ui-render-addons.php:217
148
+ msgid "SuperPWA Newsletter"
149
+ msgstr ""
150
+
151
+ #: admin/admin-ui-render-addons.php:221
152
+ msgid ""
153
+ "Learn more about Progressive Web Apps<br>and get latest updates about "
154
+ "SuperPWA"
155
+ msgstr ""
156
+
157
+ #: admin/admin-ui-render-addons.php:229
158
+ msgid "Enter your email"
159
+ msgstr ""
160
+
161
+ #: admin/admin-ui-render-addons.php:231
162
+ msgid "Subscribe"
163
+ msgstr ""
164
+
165
+ #: admin/admin-ui-render-addons.php:233
166
+ msgid ""
167
+ "we'll share our <code>root</code> password before we share your email with "
168
+ "anyone else."
169
+ msgstr ""
170
+
171
+ #: admin/admin-ui-render-addons.php:345
172
+ msgid "Activate"
173
+ msgstr ""
174
+
175
+ #: admin/admin-ui-render-addons.php:354
176
+ msgid "Install"
177
+ msgstr ""
178
+
179
+ #: admin/admin-ui-render-settings.php:60
180
+ msgid ""
181
+ "Used when there is insufficient space to display the full name of the "
182
+ "application. <code>12</code> characters or less."
183
+ msgstr ""
184
+
185
+ #: admin/admin-ui-render-settings.php:83
186
+ msgid "A brief description of what your app is about."
187
+ msgstr ""
188
+
189
+ #: admin/admin-ui-render-settings.php:108
190
+ msgid ""
191
+ "This will be the icon of your app when installed on the phone. Must be a "
192
+ "<code>PNG</code> image exactly <code>192x192</code> in size."
193
+ msgstr ""
194
+
195
+ #: admin/admin-ui-render-settings.php:131
196
+ msgid ""
197
+ "This icon will be displayed on the splash screen of your app on supported "
198
+ "devices. Must be a <code>PNG</code> image exactly <code>512x512</code> in "
199
+ "size."
200
+ msgstr ""
201
+
202
+ #: admin/admin-ui-render-settings.php:151
203
+ msgid "Background color of the splash screen."
204
+ msgstr ""
205
+
206
+ #: admin/admin-ui-render-settings.php:171
207
+ msgid ""
208
+ "Theme color is used on supported devices to tint the UI elements of the "
209
+ "browser and app switcher. When in doubt, use the same color as "
210
+ "<code>Background Color</code>."
211
+ msgstr ""
212
+
213
+ #: admin/admin-ui-render-settings.php:194
214
+ msgid "&mdash; Homepage &mdash;"
215
+ msgstr ""
216
+
217
+ #: admin/admin-ui-render-settings.php:201
218
+ msgid ""
219
+ "Specify the page to load when the application is launched from a device. "
220
+ "Current start page is <code>%s</code>"
221
+ msgstr ""
222
+
223
+ #: admin/admin-ui-render-settings.php:209
224
+ msgid "Use AMP version of the start page."
225
+ msgstr ""
226
+
227
+ #: admin/admin-ui-render-settings.php:215
228
+ msgid ""
229
+ "Do not check this if your start page is the homepage, the blog index, or the "
230
+ "archives page. AMP for WordPress does not create AMP versions for these "
231
+ "pages."
232
+ msgstr ""
233
+
234
+ #: admin/admin-ui-render-settings.php:241
235
+ msgid "&mdash; Default &mdash;"
236
+ msgstr ""
237
+
238
+ #: admin/admin-ui-render-settings.php:248
239
+ msgid ""
240
+ "Offline page is displayed when the device is offline and the requested page "
241
+ "is not already cached. Current offline page is <code>%s</code>"
242
+ msgstr ""
243
+
244
+ #: admin/admin-ui-render-settings.php:268
245
+ msgid "Follow Device Orientation"
246
+ msgstr ""
247
+
248
+ #: admin/admin-ui-render-settings.php:271
249
+ msgid "Portrait"
250
+ msgstr ""
251
+
252
+ #: admin/admin-ui-render-settings.php:274
253
+ msgid "Landscape"
254
+ msgstr ""
255
+
256
+ #: admin/admin-ui-render-settings.php:280
257
+ msgid ""
258
+ "Set the orientation of your app on devices. When set to <code>Follow Device "
259
+ "Orientation</code> your app will rotate as the device is rotated."
260
+ msgstr ""
261
+
262
+ #: admin/admin-ui-render-settings.php:302
263
+ msgid ""
264
+ "Manifest generated successfully. You can <a href=\"%s\" target=\"_blank"
265
+ "\">see it here &rarr;</a>"
266
+ msgstr ""
267
+
268
+ #: admin/admin-ui-render-settings.php:305
269
+ msgid ""
270
+ "Manifest generation failed. Check if WordPress can write to your root folder "
271
+ "(the same folder with wp-config.php). <a href=\"%s\" target=\"_blank\">Read "
272
+ "more &rarr;</a>"
273
+ msgstr ""
274
+
275
+ #: admin/admin-ui-render-settings.php:320
276
+ msgid "Service worker generated successfully."
277
+ msgstr ""
278
+
279
+ #: admin/admin-ui-render-settings.php:323
280
+ msgid ""
281
+ "Service worker generation failed. Check if WordPress can write to your root "
282
+ "folder (the same folder with wp-config.php). <a href=\"%s\" target=\"_blank"
283
+ "\">Read more &rarr;</a>"
284
+ msgstr ""
285
+
286
+ #: admin/admin-ui-render-settings.php:336
287
+ msgid "Your website is served over HTTPS."
288
+ msgstr ""
289
+
290
+ #: admin/admin-ui-render-settings.php:339
291
+ msgid ""
292
+ "Progressive Web Apps require that your website is served over HTTPS. Please "
293
+ "contact your host to add a SSL certificate to your domain."
294
+ msgstr ""
295
+
296
+ #. #-#-#-#-# super-progressive-web-apps.pot (Super Progressive Web Apps 1.8) #-#-#-#-#
297
+ #. Author of the plugin/theme
298
+ #: admin/admin-ui-setup.php:28
299
+ msgid "SuperPWA"
300
+ msgstr ""
301
+
302
+ #: admin/admin-ui-setup.php:31 admin/basic-setup.php:279
303
+ msgid "Settings"
304
+ msgstr ""
305
+
306
+ #: admin/admin-ui-setup.php:34
307
+ msgid "Add-Ons"
308
+ msgstr ""
309
+
310
+ #: admin/admin-ui-setup.php:63
311
+ msgid "Application Name"
312
+ msgstr ""
313
+
314
+ #: admin/admin-ui-setup.php:72
315
+ msgid "Application Short Name"
316
+ msgstr ""
317
+
318
+ #: admin/admin-ui-setup.php:81
319
+ msgid "Description"
320
+ msgstr ""
321
+
322
+ #: admin/admin-ui-setup.php:90
323
+ msgid "Application Icon"
324
+ msgstr ""
325
+
326
+ #: admin/admin-ui-setup.php:99
327
+ msgid "Splash Screen Icon"
328
+ msgstr ""
329
+
330
+ #: admin/admin-ui-setup.php:108
331
+ msgid "Background Color"
332
+ msgstr ""
333
+
334
+ #: admin/admin-ui-setup.php:117
335
+ msgid "Theme Color"
336
+ msgstr ""
337
+
338
+ #: admin/admin-ui-setup.php:126
339
+ msgid "Start Page"
340
+ msgstr ""
341
+
342
+ #: admin/admin-ui-setup.php:135
343
+ msgid "Offline Page"
344
+ msgstr ""
345
+
346
+ #: admin/admin-ui-setup.php:144
347
+ msgid "Orientation"
348
+ msgstr ""
349
+
350
+ #: admin/admin-ui-setup.php:153
351
+ msgid "Status"
352
+ msgstr ""
353
+
354
+ #: admin/admin-ui-setup.php:161
355
+ msgid "Manifest"
356
+ msgstr ""
357
+
358
+ #: admin/admin-ui-setup.php:170
359
+ msgid "Service Worker"
360
+ msgstr ""
361
+
362
+ #: admin/admin-ui-setup.php:179
363
+ msgid "HTTPS"
364
+ msgstr ""
365
+
366
+ #: admin/admin-ui-setup.php:305
367
+ msgid ""
368
+ "If you like SuperPWA, please <a href=\"%s\" target=\"_blank\">make a "
369
+ "donation</a> or leave a <a href=\"%s\" target=\"_blank\">&#9733;&#9733;"
370
+ "&#9733;&#9733;&#9733;</a> rating to support continued development. Thanks a "
371
+ "bunch!"
372
+ msgstr ""
373
+
374
+ #: admin/basic-setup.php:82 admin/basic-setup.php:116
375
+ msgid ""
376
+ "<strong>SuperPWA</strong>: Successfully updated to version %s. Thank you! <a "
377
+ "href=\"%s\" target=\"_blank\">Discover new features and read the story &rarr;"
378
+ "</a>"
379
+ msgstr ""
380
+
381
+ #: admin/basic-setup.php:295
382
+ msgid "Demo"
383
+ msgstr ""
384
+
385
+ #. Plugin URI of the plugin/theme
386
+ msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=plugin-uri"
387
+ msgstr ""
388
+
389
+ #. Description of the plugin/theme
390
+ msgid "Convert your WordPress website into a Progressive Web App"
391
+ msgstr ""
392
+
393
+ #. Author URI of the plugin/theme
394
+ msgid "https://superpwa.com/?utm_source=superpwa-plugin&utm_medium=author-uri"
395
+ msgstr ""
loader.php CHANGED
@@ -10,12 +10,12 @@ 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-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' );
@@ -27,6 +27,5 @@ 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' ) {
31
- require_once( SUPERPWA_PATH_ABS . 'addons/utm-tracking.php' );
32
- }
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
+ if ( ! is_multisite() ) require_once( SUPERPWA_PATH_ABS . '3rd-party/onesignal.php' );
19
 
20
  // Load functions
21
  require_once( SUPERPWA_PATH_ABS . 'functions/common.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' );
 
public/js/register-sw.js CHANGED
@@ -3,5 +3,6 @@ if ('serviceWorker' in navigator) {
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
  }
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
+ window.addEventListener('beforeinstallprompt', (e) => { e.prompt(); });
7
  });
8
  }
public/manifest.php CHANGED
@@ -60,11 +60,12 @@ function superpwa_manifest( $arg = 'src' ) {
60
  *
61
  * @return (boolean) true on success, false on failure.
62
  *
63
- * @since 1.0
64
- * @since 1.3 Added support for 512x512 icon.
65
- * @since 1.4 Added orientation and scope.
66
- * @since 1.5 Added gcm_sender_id
67
- * @since 1.6 Added description
 
68
  */
69
  function superpwa_generate_manifest() {
70
 
@@ -75,7 +76,7 @@ function superpwa_generate_manifest() {
75
  $manifest['name'] = $settings['app_name'];
76
  $manifest['short_name'] = $settings['app_short_name'];
77
 
78
- // description
79
  if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
80
  $manifest['description'] = $settings['description'];
81
  }
@@ -88,14 +89,13 @@ function superpwa_generate_manifest() {
88
  $manifest['start_url'] = superpwa_get_start_url( true );
89
  $manifest['scope'] = superpwa_get_scope();
90
 
91
- // gcm_sender_id
92
- if ( superpwa_onesignal_get_gcm_sender_id() !== false ) {
93
- $manifest['gcm_sender_id'] = superpwa_onesignal_get_gcm_sender_id();
94
- }
95
 
96
- // Delete manifest if it exists
97
  superpwa_delete_manifest();
98
 
 
99
  if ( ! superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( $manifest ) ) ) {
100
  return false;
101
  }
@@ -107,14 +107,22 @@ function superpwa_generate_manifest() {
107
  * Add manifest to header (wp_head)
108
  *
109
  * @since 1.0
 
110
  */
111
  function superpwa_add_manifest_to_wp_head() {
112
 
113
  // Get Settings
114
  $settings = superpwa_get_settings();
115
 
116
- echo '<!-- Manifest added by SuperPWA -->' . PHP_EOL . '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
117
- echo '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
 
 
 
 
 
 
 
118
  }
119
  add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
120
 
60
  *
61
  * @return (boolean) true on success, false on failure.
62
  *
63
+ * @since 1.0
64
+ * @since 1.3 Added support for 512x512 icon.
65
+ * @since 1.4 Added orientation and scope.
66
+ * @since 1.5 Added gcm_sender_id
67
+ * @since 1.6 Added description
68
+ * @since 1.8 Removed gcm_sender_id and introduced filter superpwa_manifest. gcm_sender_id is added in /3rd-party/onesignal.php
69
  */
70
  function superpwa_generate_manifest() {
71
 
76
  $manifest['name'] = $settings['app_name'];
77
  $manifest['short_name'] = $settings['app_short_name'];
78
 
79
+ // Description
80
  if ( isset( $settings['description'] ) && ! empty( $settings['description'] ) ) {
81
  $manifest['description'] = $settings['description'];
82
  }
89
  $manifest['start_url'] = superpwa_get_start_url( true );
90
  $manifest['scope'] = superpwa_get_scope();
91
 
92
+ // Filter the manifest.
93
+ $manifest = apply_filters( 'superpwa_manifest', $manifest );
 
 
94
 
95
+ // Delete manifest if it exists.
96
  superpwa_delete_manifest();
97
 
98
+ // Write the manfiest to disk.
99
  if ( ! superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( $manifest ) ) ) {
100
  return false;
101
  }
107
  * Add manifest to header (wp_head)
108
  *
109
  * @since 1.0
110
+ * @since 1.8 Introduced filter superpwa_wp_head_tags
111
  */
112
  function superpwa_add_manifest_to_wp_head() {
113
 
114
  // Get Settings
115
  $settings = superpwa_get_settings();
116
 
117
+ $tags = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL;
118
+ $tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
119
+ $tags .= '<meta name="theme-color" content="'. $settings['theme_color'] .'">' . PHP_EOL;
120
+
121
+ $tags = apply_filters( 'superpwa_wp_head_tags', $tags );
122
+
123
+ $tags .= '<!-- / SuperPWA.com -->' . PHP_EOL . PHP_EOL;
124
+
125
+ echo $tags;
126
  }
127
  add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
128
 
public/sw.php CHANGED
@@ -28,10 +28,11 @@ if ( ! defined( 'ABSPATH' ) ) exit;
28
  *
29
  * @since 1.6
30
  * @since 1.7 src to service worker is made relative to accomodate for domain mapped multisites.
 
31
  */
32
  function superpwa_sw( $arg = 'src' ) {
33
 
34
- $sw_filename = 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js';
35
 
36
  switch( $arg ) {
37
 
@@ -105,7 +106,7 @@ const startPage = '<?php echo superpwa_get_start_url(); ?>';
105
  const offlinePage = '<?php echo get_permalink( $settings['offline_page'] ) ? superpwa_httpsify( get_permalink( $settings['offline_page'] ) ) : superpwa_httpsify( get_bloginfo( 'wpurl' ) ); ?>';
106
  const fallbackImage = '<?php echo $settings['icon']; ?>';
107
  const filesToCache = [startPage, offlinePage, fallbackImage];
108
- const neverCacheUrls = [/\/wp-admin/,/\/wp-login/,/preview=true/];
109
 
110
  // Install
111
  self.addEventListener('install', function(e) {
28
  *
29
  * @since 1.6
30
  * @since 1.7 src to service worker is made relative to accomodate for domain mapped multisites.
31
+ * @since 1.8 Added filter superpwa_sw_filename.
32
  */
33
  function superpwa_sw( $arg = 'src' ) {
34
 
35
+ $sw_filename = apply_filters( 'superpwa_sw_filename', 'superpwa-sw' . superpwa_multisite_filename_postfix() . '.js' );
36
 
37
  switch( $arg ) {
38
 
106
  const offlinePage = '<?php echo get_permalink( $settings['offline_page'] ) ? superpwa_httpsify( get_permalink( $settings['offline_page'] ) ) : superpwa_httpsify( get_bloginfo( 'wpurl' ) ); ?>';
107
  const fallbackImage = '<?php echo $settings['icon']; ?>';
108
  const filesToCache = [startPage, offlinePage, fallbackImage];
109
+ const neverCacheUrls = [<?php echo apply_filters( 'superpwa_sw_never_cache_urls', '/\/wp-admin/,/\/wp-login/,/preview=true/' ); ?>];
110
 
111
  // Install
112
  self.addEventListener('install', function(e) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: arunbasillal, josevarghese, superpwa
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: 4.9.5
7
  Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2 or later
@@ -25,6 +25,14 @@ SuperPWA is easy to configure, it takes less than a minute to set-up your Progre
25
 
26
  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!
27
 
 
 
 
 
 
 
 
 
28
  #### Thank You PWA Enthusiasts!
29
 
30
  We are humbled by the feedback from the community. Thanks to everyone who believed in us and tried our plugin. Your feedback has been invaluable and we have learned a lot from your experience. Thank you for your love and support and we hope to return the love by striving to bring you the best ever Progressive Web Apps plugin for WordPress!
@@ -40,7 +48,7 @@ Here are the current features of Super Progressive Web Apps:
40
  * Aggressive caching of pages using CacheStorage API.
41
  * Pages once cached are served even if the user is offline.
42
  * 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.
43
- * New in version 1.2: Support for theme-color.
44
  * New in version 1.2: Now you can edit the Application Name and Application Short name.
45
  * New in version 1.2: Set the start page of your PWA.
46
  * 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.
@@ -52,6 +60,8 @@ Here are the current features of Super Progressive Web Apps:
52
  * New in version 1.5: OneSignal integration for Push notifications.
53
  * New in version 1.6: WordPress Multisite Network compatibility.
54
  * 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.
 
 
55
 
56
  **Upcoming features:**
57
 
@@ -107,7 +117,7 @@ Uh, oh. Your PWA did not work as expected? You do not see the "Add to Home Scree
107
 
108
  * 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).
109
  * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
110
- * Make sure your icon is a PNG and 192px X 192 px in size.
111
  * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
112
  * 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.)
113
  * 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.
@@ -138,7 +148,27 @@ If you have any questions, please ask it on the [support forum](https://wordpres
138
 
139
  = Will Progressive Web Apps work on iOS devices? =
140
 
141
- PWA's require browsers with support for service workers and for iOS devices, support is available in Safari Technology Preview 48, macOS High Sierra 10.13.4 and iOS 11.3 beta seed 2. Since none of these are production releases, the general public will not be able to install your app on their mobile phones and smart devices. We will hopefully see full support by mid 2018.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
  == Screenshots ==
144
 
@@ -146,12 +176,23 @@ PWA's require browsers with support for service workers and for iOS devices, sup
146
 
147
  == Changelog ==
148
 
 
 
 
 
 
 
 
 
 
 
 
149
  = 1.7.1 =
150
  * Date: 05.May.2018
151
  * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
152
 
153
  = 1.7 =
154
- * Date: 03.May.2018
155
  * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
156
  * New Feature: Add-Ons for SuperPWA is here!
157
  * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
@@ -161,7 +202,7 @@ PWA's require browsers with support for service workers and for iOS devices, sup
161
  * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
162
 
163
  = 1.6 =
164
- * Date: 23.April.2018
165
  * 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.
166
  * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
167
  * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
@@ -178,7 +219,7 @@ PWA's require browsers with support for service workers and for iOS devices, sup
178
  * 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.
179
 
180
  = 1.4 =
181
- * Date: 21.February.2018
182
  * 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/).
183
  * 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/).
184
  * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
@@ -225,6 +266,16 @@ PWA's require browsers with support for service workers and for iOS devices, sup
225
 
226
  == Upgrade Notice ==
227
 
 
 
 
 
 
 
 
 
 
 
228
  = 1.7.1 =
229
  * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
230
 
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: 4.9.6
7
  Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2 or later
25
 
26
  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!
27
 
28
+ #### Quick Demo?
29
+
30
+ * Open up [SuperPWA.com](https://superpwa.com/?utm_source=wordpress.org&utm_medium=description-demo) in a supported device.
31
+ * Add the website to your home screen either from the Add to Home Screen prompt (Chrome for Android) or from the browser menu.
32
+ * Open the app from your home screen and you will see the splash screen.
33
+ * 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.
34
+ * Browse to a page that you haven't visited before. The offline page will be displayed.
35
+
36
  #### Thank You PWA Enthusiasts!
37
 
38
  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!
48
  * Aggressive caching of pages using CacheStorage API.
49
  * Pages once cached are served even if the user is offline.
50
  * 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.
51
+ * 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.
52
  * New in version 1.2: Now you can edit the Application Name and Application Short name.
53
  * New in version 1.2: Set the start page of your PWA.
54
  * 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.
60
  * New in version 1.5: OneSignal integration for Push notifications.
61
  * New in version 1.6: WordPress Multisite Network compatibility.
62
  * 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.
63
+ * New in version 1.8: Compatibility issues with OneSignal are now resolved!
64
+ * 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.
65
 
66
  **Upcoming features:**
67
 
117
 
118
  * 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).
119
  * Make sure you are using a supported device and a supported browser. Refer to the "Device and Browser Support For PWA" list above.
120
+ * 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.
121
  * Clear the browser cache and try again. In Chrome for Android, go to Settings > Privacy > "Clear browsing data".
122
  * 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.)
123
  * 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.
148
 
149
  = Will Progressive Web Apps work on iOS devices? =
150
 
151
+ 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 ).
152
+
153
+ Just like you, we are eagerly awaiting the upcoming releases and we hope to see better compatibility in the coming months.
154
+
155
+ = How To Customize Splash Screen =
156
+
157
+ You can easily change the icon and the background color in SuperPWA > Settings.
158
+
159
+ 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.
160
+
161
+ = How To Track Visits Originating From Your Progressive Web App =
162
+
163
+ 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.
164
+
165
+ = GDPR Compliance =
166
+
167
+ 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.
168
+
169
+ 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.
170
+
171
+ Feel free to get in touch if you have any questions.
172
 
173
  == Screenshots ==
174
 
176
 
177
  == Changelog ==
178
 
179
+ = 1.8 =
180
+ * Date: [31.May.2018](https://superpwa.com/push-notifications-are-here-again/?utm_source=wordpress.org&utm_medium=changelog)
181
+ * Tested with WordPress 4.9.6.
182
+ * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
183
+ * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
184
+ * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
185
+ * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
186
+ * 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)
187
+ * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
188
+ * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
189
+
190
  = 1.7.1 =
191
  * Date: 05.May.2018
192
  * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
193
 
194
  = 1.7 =
195
+ * Date: [03.May.2018](https://superpwa.com/introducing-add-ons-for-superpwa/?utm_source=wordpress.org&utm_medium=changelog)
196
  * Minimum required WordPress version is now 3.6.0 (previously 3.5.0).
197
  * New Feature: Add-Ons for SuperPWA is here!
198
  * New Feature: SuperPWA is now a top-level menu to accommodate for the Add-Ons sub-menu page.
202
  * Bug Fix: Incorrect manifest and service worker URLs when WordPress is installed in a folder.
203
 
204
  = 1.6 =
205
+ * Date: [23.April.2018](https://superpwa.com/1-6-released-multisite-network-support/?utm_source=wordpress.org&utm_medium=changelog)
206
  * 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.
207
  * New Feature: Added description to the manifest. You can now include a brief description of what your app is about.
208
  * Enhancement: Moved manifest to the very top of wp_head for better compatibility with some browsers.
219
  * 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.
220
 
221
  = 1.4 =
222
+ * Date: [21.February.2018](https://wordpress.org/support/topic/you-asked-and-we-listened-superpwa-1-4-ships-with-two-user-feature-requests/)
223
  * 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/).
224
  * 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/).
225
  * Enhancement: Improved compatibility with all major Accelerated Mobile Pages (AMP) plugins.
266
 
267
  == Upgrade Notice ==
268
 
269
+ = 1.8 =
270
+ * Tested with WordPress 4.9.6.
271
+ * New Add-On: Apple Touch Icons. Set the Application Icon and Splash Screen Icon as Apple Touch Icons for compatibility with iOS devices.
272
+ * Enhancement: Added support for Add to Home Screen prompt for Chrome 68 and beyond.
273
+ * Enhancement: Better add-on activation and deactivation by hooking onto admin_post action.
274
+ * Enhancement: Attempt to generate manifest and service worker automatically on visiting the SuperPWA settings page after adjusting root folder permissions.
275
+ * 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
276
+ * Bug Fix: Compatibility issues with OneSignal are resolved for single installs.
277
+ * Bug Fix: Updated plugin action links and admin notices with the correct admin menu link.
278
+
279
  = 1.7.1 =
280
  * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context".
281
 
superpwa.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
  /**
3
  * Plugin Name: Super Progressive Web Apps
4
- * Plugin URI: https://superpwa.com
5
  * Description: Convert your WordPress website into a Progressive Web App
6
  * Author: SuperPWA
7
- * Author URI: https://superpwa.com
8
  * Contributors: Arun Basil Lal, Jose Varghese
9
- * Version: 1.7.1
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
@@ -43,7 +43,7 @@ if ( ! defined('ABSPATH') ) exit;
43
  * @since 1.6 Depreciated constants for multisite compatibility: SUPERPWA_MANIFEST_FILENAME, SUPERPWA_MANIFEST_ABS, SUPERPWA_MANIFEST_SRC
44
  * @since 1.6 Depreciated constants for multisite compatibility: SUPERPWA_SW_FILENAME, SUPERPWA_SW_ABS, SUPERPWA_SW_SRC
45
  */
46
- if ( ! defined( 'SUPERPWA_VERSION' ) ) define( 'SUPERPWA_VERSION' , '1.7.1' ); // SuperPWA current version
47
  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/super-progressive-web-apps/
48
  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/super-progressive-web-apps/
49
 
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: 1.8
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
43
  * @since 1.6 Depreciated constants for multisite compatibility: SUPERPWA_MANIFEST_FILENAME, SUPERPWA_MANIFEST_ABS, SUPERPWA_MANIFEST_SRC
44
  * @since 1.6 Depreciated constants for multisite compatibility: SUPERPWA_SW_FILENAME, SUPERPWA_SW_ABS, SUPERPWA_SW_SRC
45
  */
46
+ if ( ! defined( 'SUPERPWA_VERSION' ) ) define( 'SUPERPWA_VERSION' , '1.8' ); // SuperPWA current version
47
  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/super-progressive-web-apps/
48
  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/super-progressive-web-apps/
49