Version Description
- Date: 23.November.2021
- Enhancement : Added New option to exclude Add to homescreen banner on particular pages #232
Download this release
Release Info
Developer | superpwa |
Plugin | Super Progressive Web Apps |
Version | 2.1.19 |
Comparing to | |
See all releases |
Code changes from version 2.1.18 to 2.1.19
- admin/admin-ui-render-settings.php +17 -0
- admin/admin-ui-setup.php +8 -0
- functions/common.php +2 -2
- public/sw.php +25 -8
- readme.txt +5 -1
- superpwa.php +2 -2
admin/admin-ui-render-settings.php
CHANGED
@@ -505,6 +505,23 @@ function superpwa_exclude_url_cache_cb(){
|
|
505 |
<?php
|
506 |
}
|
507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
/**
|
509 |
* Force Update Service Worker
|
510 |
*
|
505 |
<?php
|
506 |
}
|
507 |
|
508 |
+
/**
|
509 |
+
* Exclude add to home screen popup on particular pages
|
510 |
+
*
|
511 |
+
* @since 2.1.19
|
512 |
+
*/
|
513 |
+
|
514 |
+
function superpwa_exclude_add_to_homescreen_cb(){
|
515 |
+
// Get Settings
|
516 |
+
$settings = superpwa_get_settings();
|
517 |
+
?>
|
518 |
+
<label><textarea placeholder="https://example.com/contact-us/, https://example.com/checkout/" rows="4" cols="70" id="superpwa_settings[exclude_homescreen]" name="superpwa_settings[exclude_homescreen]"><?php echo (isset($settings['exclude_homescreen']) ? esc_attr($settings['exclude_homescreen']): ''); ?></textarea></label>
|
519 |
+
<p><?php echo esc_html__('Note: Seperate the URLs using a Comma(,)', 'super-progressive-web-apps'); ?></p>
|
520 |
+
<p><?php echo esc_html__('Place the list of URLs on which add to homescreen will be hidden', 'super-progressive-web-apps'); ?></p>
|
521 |
+
|
522 |
+
<?php
|
523 |
+
}
|
524 |
+
|
525 |
/**
|
526 |
* Force Update Service Worker
|
527 |
*
|
admin/admin-ui-setup.php
CHANGED
@@ -311,6 +311,14 @@ function superpwa_register_settings() {
|
|
311 |
'superpwa_pwa_advance_section', // Page slug
|
312 |
'superpwa_pwa_advance_section' // Settings Section ID
|
313 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
}
|
315 |
add_action( 'admin_init', 'superpwa_register_settings' );
|
316 |
|
311 |
'superpwa_pwa_advance_section', // Page slug
|
312 |
'superpwa_pwa_advance_section' // Settings Section ID
|
313 |
);
|
314 |
+
// Exclude Urls from Cache list
|
315 |
+
add_settings_field(
|
316 |
+
'superpwa_exclude_add_to_homescreen_shortcut', // ID
|
317 |
+
__('Exclude Add to homescreen banner', 'super-progressive-web-apps'), // Title
|
318 |
+
'superpwa_exclude_add_to_homescreen_cb', // CB
|
319 |
+
'superpwa_pwa_advance_section', // Page slug
|
320 |
+
'superpwa_pwa_advance_section' // Settings Section ID
|
321 |
+
);
|
322 |
}
|
323 |
add_action( 'admin_init', 'superpwa_register_settings' );
|
324 |
|
functions/common.php
CHANGED
@@ -259,14 +259,14 @@ function superpwa_setting_tabs_html(){
|
|
259 |
$addon_page_class = 'active';
|
260 |
}
|
261 |
}
|
262 |
-
|
263 |
$license_settings_class = $addon_page_class = '' ;
|
264 |
if( isset( $_GET['page'] ) && $_GET['page'] == 'superpwa-upgrade' ) {
|
265 |
$license_settings_class = 'active';
|
266 |
}else{
|
267 |
$addon_page_class = 'active';
|
268 |
}
|
269 |
-
|
270 |
<div class="spwa-tab">
|
271 |
<a id="spwa-default" class="spwa-tablinks" href="<?php echo esc_url_raw($general_settings); ?>" data-href="yes">Settings</a>
|
272 |
<a class="spwa-tablinks <?php echo $addon_page_class; ?>" href="<?php echo esc_url_raw($addon_page); ?>" data-href="yes">Features (Addons)</a>
|
259 |
$addon_page_class = 'active';
|
260 |
}
|
261 |
}
|
262 |
+
|
263 |
$license_settings_class = $addon_page_class = '' ;
|
264 |
if( isset( $_GET['page'] ) && $_GET['page'] == 'superpwa-upgrade' ) {
|
265 |
$license_settings_class = 'active';
|
266 |
}else{
|
267 |
$addon_page_class = 'active';
|
268 |
}
|
269 |
+
?>
|
270 |
<div class="spwa-tab">
|
271 |
<a id="spwa-default" class="spwa-tablinks" href="<?php echo esc_url_raw($general_settings); ?>" data-href="yes">Settings</a>
|
272 |
<a class="spwa-tablinks <?php echo $addon_page_class; ?>" href="<?php echo esc_url_raw($addon_page); ?>" data-href="yes">Features (Addons)</a>
|
public/sw.php
CHANGED
@@ -330,14 +330,31 @@ function checkNeverCacheList(url) {
|
|
330 |
function superpwa_register_sw() {
|
331 |
|
332 |
$settings = superpwa_get_settings();
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
}
|
342 |
add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
|
343 |
|
330 |
function superpwa_register_sw() {
|
331 |
|
332 |
$settings = superpwa_get_settings();
|
333 |
+
$include_script = true;
|
334 |
+
|
335 |
+
if(isset($settings['exclude_homescreen']) && !empty($settings['exclude_homescreen'])){
|
336 |
+
$exclude_homescrn_setting = $settings['exclude_homescreen'];
|
337 |
+
$exclude_homescreen = explode(",",$settings['exclude_homescreen']);
|
338 |
+
|
339 |
+
$siteUrl = filter_input(INPUT_SERVER, 'REQUEST_URI');
|
340 |
+
|
341 |
+
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http").'://'.$_SERVER['HTTP_HOST'].$siteUrl;
|
342 |
+
if(in_array($actual_link, $exclude_homescreen)){
|
343 |
+
$include_script = false;
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
if($include_script){
|
348 |
+
wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
|
349 |
+
$localize = array(
|
350 |
+
'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
|
351 |
+
'disable_addtohome' => isset($settings['disable_add_to_home'])? $settings['disable_add_to_home'] : 0,
|
352 |
+
'enableOnDesktop'=> false,
|
353 |
+
);
|
354 |
+
$localize = apply_filters('superpwa_sw_localize_data', $localize);
|
355 |
+
wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', $localize);
|
356 |
+
}
|
357 |
+
|
358 |
}
|
359 |
add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
|
360 |
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: SuperPWA
|
3 |
Tags: pwa, progressive web apps, manifest, web manifest, android app, chrome app, add to homescreen, mobile web
|
4 |
Requires at least: 3.6.0
|
5 |
-
Tested up to: 5.8.
|
6 |
Requires PHP: 5.3
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
@@ -186,6 +186,10 @@ Feel free to get in touch if you have any questions.
|
|
186 |
|
187 |
== Changelog ==
|
188 |
|
|
|
|
|
|
|
|
|
189 |
= 2.1.18 =
|
190 |
* Date: [1.November.2021](https://superpwa.com/superpwa-2-1-18-release-note/?utm_source=wordpress.org&utm_medium=changelog)
|
191 |
* Bug Fixed : Resolved the issue of License alert showing when key is not activated #230
|
2 |
Contributors: SuperPWA
|
3 |
Tags: pwa, progressive web apps, manifest, web manifest, android app, chrome app, add to homescreen, mobile web
|
4 |
Requires at least: 3.6.0
|
5 |
+
Tested up to: 5.8.2
|
6 |
Requires PHP: 5.3
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
186 |
|
187 |
== Changelog ==
|
188 |
|
189 |
+
= 2.1.19 =
|
190 |
+
* Date: [23.November.2021](https://superpwa.com/superpwa-2-1-19-release-note/?utm_source=wordpress.org&utm_medium=changelog)
|
191 |
+
* Enhancement : Added New option to exclude Add to homescreen banner on particular pages #232
|
192 |
+
|
193 |
= 2.1.18 =
|
194 |
* Date: [1.November.2021](https://superpwa.com/superpwa-2-1-18-release-note/?utm_source=wordpress.org&utm_medium=changelog)
|
195 |
* Bug Fixed : Resolved the issue of License alert showing when key is not activated #230
|
superpwa.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Author: SuperPWA
|
7 |
* Author URI: https://profiles.wordpress.org/superpwa/
|
8 |
* Contributors: SuperPWA
|
9 |
-
* Version: 2.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.0
|
44 |
*/
|
45 |
if ( ! defined( 'SUPERPWA_VERSION' ) ) {
|
46 |
-
define( 'SUPERPWA_VERSION' , '2.1.
|
47 |
}
|
48 |
|
49 |
/**
|
6 |
* Author: SuperPWA
|
7 |
* Author URI: https://profiles.wordpress.org/superpwa/
|
8 |
* Contributors: SuperPWA
|
9 |
+
* Version: 2.1.19
|
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.0
|
44 |
*/
|
45 |
if ( ! defined( 'SUPERPWA_VERSION' ) ) {
|
46 |
+
define( 'SUPERPWA_VERSION' , '2.1.19' );
|
47 |
}
|
48 |
|
49 |
/**
|