Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
iworks committed Sep 16, 2024
1 parent aebc4e6 commit bfb489d
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 6 deletions.
2 changes: 1 addition & 1 deletion assets/scripts/frontend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* PWA — easy way to Progressive Web App - v1.6.2
* PWA — easy way to Progressive Web App - v1.6.3
* https://github.com/iworks/iworks-pwa
* Copyright (c) 2024; * Licensed GPLv3+ */
window.addEventListener('load', function(event) {
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/frontend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions etc/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,53 @@ function iworks_pwa_options() {
),
'rows' => 10,
),
/**
* Section "Categories"
*
* @since 1.6.3
*/
array(
'type' => 'heading',
'label' => __( 'Categories', 'iworks-pwa' ),
'description' => esc_html__(
'The categories member is an array of strings defining the names of categories that the application supposedly belongs to.',
'iworks-pwa'
),
),
array(
'name' => 'categories',
'type' => 'checkbox_group',
'options' => array(
'books' => esc_html__( 'Books', 'iworks-pwa' ),
'business' => esc_html__( 'Business', 'iworks-pwa' ),
'education' => esc_html__( 'Education', 'iworks-pwa' ),
'entertainment' => esc_html__( 'Entertainment', 'iworks-pwa' ),
'finance' => esc_html__( 'Finance', 'iworks-pwa' ),
'fitness' => esc_html__( 'Fitness', 'iworks-pwa' ),
'food' => esc_html__( 'Food', 'iworks-pwa' ),
'games' => esc_html__( 'Games', 'iworks-pwa' ),
'government' => esc_html__( 'Government', 'iworks-pwa' ),
'health' => esc_html__( 'Health', 'iworks-pwa' ),
'kids' => esc_html__( 'Kids', 'iworks-pwa' ),
'lifestyle' => esc_html__( 'Lifestyle', 'iworks-pwa' ),
'magazines' => esc_html__( 'Magazines', 'iworks-pwa' ),
'medical' => esc_html__( 'Medical', 'iworks-pwa' ),
'music' => esc_html__( 'Music', 'iworks-pwa' ),
'navigation' => esc_html__( 'Navigation', 'iworks-pwa' ),
'news' => esc_html__( 'News', 'iworks-pwa' ),
'personalization' => esc_html__( 'Personalization', 'iworks-pwa' ),
'photo' => esc_html__( 'Photo', 'iworks-pwa' ),
'politics' => esc_html__( 'Politics', 'iworks-pwa' ),
'productivity' => esc_html__( 'Productivity', 'iworks-pwa' ),
'security' => esc_html__( 'Security', 'iworks-pwa' ),
'shopping' => esc_html__( 'Shopping', 'iworks-pwa' ),
'social' => esc_html__( 'Social', 'iworks-pwa' ),
'sports' => esc_html__( 'Sports', 'iworks-pwa' ),
'travel' => esc_html__( 'Travel', 'iworks-pwa' ),
'utilities' => esc_html__( 'Utilities', 'iworks-pwa' ),
'weather' => esc_html__( 'Weather', 'iworks-pwa' ),
),
),
/**
* Section "Add to Home screen"
*
Expand Down
1 change: 1 addition & 0 deletions includes/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden.
22 changes: 20 additions & 2 deletions includes/iworks/class-iworks-pwa.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class iWorks_PWA {
*
* @since 1.1.1
*/
protected $eol;
protected $eol = PHP_EOL;

/**
* Check for OG plugin: https://wordpress.org/plugins/og/
Expand Down Expand Up @@ -68,7 +68,7 @@ protected function __construct() {
/**
* End of line
*/
$this->eol = $this->debug ? PHP_EOL : '';
$this->eol = apply_filters( 'iworks/pwa/eol', $this->eol );
/**
* set options
*/
Expand Down Expand Up @@ -168,6 +168,7 @@ private function _set_configuration() {
),
'splash_pages' => apply_filters( 'iworks_pwa_configuration_splash_pages', null ),
'icons' => $this->get_configuration_icons(),
'categories' => $this->get_configuration_categories(),
)
);
if ( ! is_admin() ) {
Expand Down Expand Up @@ -698,5 +699,22 @@ protected function get_configuration_scope() {
return apply_filters( 'iworks_pwa_configuration_scope', '/' );
}

/**
* get configuration categories
*
* @since 1.6.3
*/
protected function get_configuration_categories() {
$value = $this->options->get_option( 'categories' );
if ( is_array( $value ) ) {
$value = array_values( $value );
} else {
$value = null;
}
return apply_filters(
'iworks/pwa/configuration/categories',
$value
);
}

}
1 change: 1 addition & 0 deletions includes/iworks/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden.
2 changes: 1 addition & 1 deletion includes/iworks/pwa/class-iworks-pwa-apple.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function html_head() {
echo PHP_EOL;
}
printf(
'<meta name="apple-mobile-web-app-capable" content="yes">%s',
'<meta name="mobile-web-app-capable" content="yes">%s',
$this->eol
);
printf(
Expand Down
10 changes: 10 additions & 0 deletions includes/iworks/pwa/class-iworks-pwa-manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ private function print_manifest_json() {
*/
$data['id'] = $this->get_configuration_app_id();
header( 'Content-Type: application/json' );
/**
* remove empty values
*
* @since 1.6.3
*/
foreach ( $data as $key => $value ) {
if ( empty( $value ) ) {
unset( $data[ $key ] );
}
}
/**
* filter manifest data
*/
Expand Down
1 change: 1 addition & 0 deletions includes/iworks/pwa/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden.
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "PWA — easy way to Progressive Web App",
"tagline": "Your easy way to Progressive Web Application.",
"description": "Progressive Web Apps (PWA) is a technology that combines the best of mobile web and the best of mobile apps to create a superior mobile web experience. They are installed on the phone like a normal app (web app) and can be accessed from the home screen.",
"version": "1.6.2",
"version": "1.6.3",
"homepage": "https://github.com/iworks/iworks-pwa",
"author": [
{
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ A2HS is supported in all mobile browsers, except iOS web view. It's also support

== Changelog ==

= 1.6.3 (2024-09-16) =
* All empty values where been removed from `manifest.json`.
* The categories element has been added into `manifest.json`.
* The deprecated key `apple-mobile-web-app-capable` has been changed into `mobile-web-app-capable`.

= 1.6.2 (2024-08-26) =
* The scope value is now relative to or limited to the site URL. Props for [leighcc](https://wordpress.org/support/users/leighcc/). Check configuration screen for new option.
* The plugin version has been added to cache key, to force refresh data after plugin update.
Expand Down

0 comments on commit bfb489d

Please sign in to comment.