Plugin Directory

Changeset 3479687


Ignore:
Timestamp:
03/11/2026 04:06:15 AM (3 weeks ago)
Author:
wpcodequill
Message:

Releasing version 1.0.5 with Premium UI and code splitting

Location:
codequill-web-to-app/trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • codequill-web-to-app/trunk/codequill-web-to-app.php

    r3478841 r3479687  
    44Plugin URI: https://wpcodequill.com/free-files/codequill-web-to-app/
    55Description: Convert your WordPress site into a Progressive Web App (PWA). Add an Install App button and manage settings directly from the dashboard.
    6 Version: 1.0.4
     6Version: 1.0.5
    77Author: WPCodeQuill
    88Author URI: https://wpcodequill.com
     
    2121
    2222// Include the functional logic from the function folder
     23require_once CODEQUILL_PWA_DIR . 'admin/admin.php';
    2324require_once CODEQUILL_PWA_DIR . 'function/function.php';
    2425
    2526// Initialize the plugin safely once all plugins have loaded
    2627function codequill_pwa_initialize() {
    27     new CodeQuill_Web_To_App_Managed();
     28    new CodeQuill_Web_To_App_Admin();
     29    new CodeQuill_Web_To_App_Function();
    2830}
    2931add_action( 'plugins_loaded', 'codequill_pwa_initialize' );
  • codequill-web-to-app/trunk/function/function.php

    r3478841 r3479687  
    22if ( ! defined( 'ABSPATH' ) ) exit;
    33
    4 class CodeQuill_Web_To_App_Managed {
     4class CodeQuill_Web_To_App_Function {
    55
    66    public function __construct() {
    7         // Admin Menu
    8         add_action('admin_menu', array($this, 'create_admin_menu'));
    9         add_action('admin_init', array($this, 'register_settings'));
    10        
    117        // Frontend PWA functionality
    128        add_action('wp_head', array($this, 'add_manifest_link'));
     
    1814    }
    1915
    20     // --- 1. ADMIN SETTINGS PAGE ---
    21     public function create_admin_menu() {
    22         add_menu_page(
    23             esc_html__('PWA Settings', 'codequill-web-to-app'),
    24             esc_html__('App Settings', 'codequill-web-to-app'),
    25             'manage_options',
    26             'codequill-pwa-settings',
    27             array($this, 'settings_page_html'),
    28             'dashicons-smartphone',
    29             100
    30         );
    31     }
    32 
    33     public function register_settings() {
    34         register_setting('codequill_pwa_settings_group', 'codequill_app_name', 'sanitize_text_field');
    35         register_setting('codequill_pwa_settings_group', 'codequill_short_name', 'sanitize_text_field');
    36         register_setting('codequill_pwa_settings_group', 'codequill_theme_color', 'sanitize_hex_color');
    37         register_setting('codequill_pwa_settings_group', 'codequill_bg_color', 'sanitize_hex_color');
    38         register_setting('codequill_pwa_settings_group', 'codequill_icon_192', 'esc_url_raw');
    39         register_setting('codequill_pwa_settings_group', 'codequill_icon_512', 'esc_url_raw');
    40     }
    41 
    42     public function settings_page_html() {
    43         if (!current_user_can('manage_options')) {
    44             return;
    45         }
    46         ?>
    47         <div class="wrap">
    48             <h1><?php echo esc_html__('Web to App (PWA) Settings', 'codequill-web-to-app'); ?></h1>
    49             <form method="post" action="options.php">
    50                 <?php settings_fields('codequill_pwa_settings_group'); ?>
    51                 <table class="form-table">
    52                     <tr valign="top">
    53                         <th scope="row"><?php echo esc_html__('App Name', 'codequill-web-to-app'); ?></th>
    54                         <td><input type="text" name="codequill_app_name" value="<?php echo esc_attr(get_option('codequill_app_name', get_bloginfo('name'))); ?>" class="regular-text" /></td>
    55                     </tr>
    56                     <tr valign="top">
    57                         <th scope="row"><?php echo esc_html__('Short Name', 'codequill-web-to-app'); ?></th>
    58                         <td><input type="text" name="codequill_short_name" value="<?php echo esc_attr(get_option('codequill_short_name', 'MyApp')); ?>" class="regular-text" /></td>
    59                     </tr>
    60                     <tr valign="top">
    61                         <th scope="row"><?php echo esc_html__('Theme Color', 'codequill-web-to-app'); ?></th>
    62                         <td><input type="color" name="codequill_theme_color" value="<?php echo esc_attr(get_option('codequill_theme_color', '#0073aa')); ?>" /></td>
    63                     </tr>
    64                     <tr valign="top">
    65                         <th scope="row"><?php echo esc_html__('Background Color', 'codequill-web-to-app'); ?></th>
    66                         <td><input type="color" name="codequill_bg_color" value="<?php echo esc_attr(get_option('codequill_bg_color', '#ffffff')); ?>" /></td>
    67                     </tr>
    68                     <tr valign="top">
    69                         <th scope="row"><?php echo esc_html__('Icon URL (192x192)', 'codequill-web-to-app'); ?></th>
    70                         <td><input type="text" name="codequill_icon_192" value="<?php echo esc_attr(get_option('codequill_icon_192')); ?>" class="large-text" placeholder="https://..." /></td>
    71                     </tr>
    72                     <tr valign="top">
    73                         <th scope="row"><?php echo esc_html__('Icon URL (512x512)', 'codequill-web-to-app'); ?></th>
    74                         <td><input type="text" name="codequill_icon_512" value="<?php echo esc_attr(get_option('codequill_icon_512')); ?>" class="large-text" placeholder="https://..." /></td>
    75                     </tr>
    76                 </table>
    77                 <?php submit_button(); ?>
    78             </form>
    79         </div>
    80         <?php
    81     }
    82 
    83     // --- 2. DYNAMIC MANIFEST & SERVICE WORKER GENERATOR ---
    8416    public function serve_manifest() {
    8517        // 1. Serve Manifest
     
    11244        }
    11345
    114         // 2. Serve Service Worker dynamically to fix scope issues
     46        // 2. Serve Service Worker dynamically
    11547        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    11648        if (isset($_GET['codequill_sw']) && $_GET['codequill_sw'] == '1') {
     
    11850            header('Service-Worker-Allowed: /');
    11951           
    120             // ---> UPDATED: Look for sw.js in the new assets/js/ folder <---
    12152            $sw_path = CODEQUILL_PWA_DIR . 'assets/js/sw.js';
    12253           
    12354            if (file_exists($sw_path)) {
    124                 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     55                // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile, WordPress.Security.EscapeOutput.OutputNotEscaped
    12556                readfile($sw_path);
    12657            }
     
    12960    }
    13061
    131     // --- 3. LINK MANIFEST IN HEADER ---
    13262    public function add_manifest_link() {
    13363        $manifest_url = site_url('?codequill_manifest=1');
     
    13666    }
    13767
    138     // --- 4. INSTALL BUTTON HTML ---
    13968    public function add_install_ui() {
    14069        ?>
     
    14574    }
    14675
    147     // --- 5. ENQUEUE INLINE SCRIPTS ---
    14876    public function enqueue_pwa_scripts() {
    149         // Register a clean handle (no jQuery required)
    150         wp_register_script('codequill-pwa-js', false);
    151         wp_enqueue_script('codequill-pwa-js');
     77        wp_register_script('codequill-pwa-js', false, array(), '1.0.5', true);
    15278
    15379        $sw_url = esc_url(site_url('?codequill_sw=1'));
    15480       
    15581        $js_code = "
    156         if ('serviceWorker' in navigator) {
    157             window.addEventListener('load', function() {
    158                 navigator.serviceWorker.register('" . $sw_url . "', { scope: '/' })
    159                 .then(function(registration) {
    160                     console.log('PWA ServiceWorker registration successful with scope: ', registration.scope);
    161                 }).catch(function(err) {
    162                     console.log('PWA ServiceWorker registration failed: ', err);
    163                 });
    164             });
    165         }
    166 
    167         let deferredPrompt;
    168         window.addEventListener('beforeinstallprompt', (e) => {
    169             e.preventDefault();
    170             deferredPrompt = e;
    171             const installBtn = document.getElementById('codequill-pwa-install-btn');
    172            
    173             if(installBtn) {
    174                 installBtn.style.display = 'block';
    175                 installBtn.addEventListener('click', (e) => {
    176                     installBtn.style.display = 'none';
    177                     deferredPrompt.prompt();
    178                     deferredPrompt.userChoice.then((choiceResult) => {
    179                         deferredPrompt = null;
     82        (function() {
     83            if ('serviceWorker' in navigator) {
     84                window.addEventListener('load', function() {
     85                    navigator.serviceWorker.register('" . $sw_url . "', { scope: '/' })
     86                    .then(function(registration) {
     87                        console.log('PWA ServiceWorker registration successful');
     88                    }).catch(function(err) {
     89                        console.log('PWA ServiceWorker registration failed: ', err);
    18090                    });
    18191                });
    18292            }
    183         });
     93
     94            let deferredPrompt;
     95            window.addEventListener('beforeinstallprompt', (e) => {
     96                e.preventDefault();
     97                deferredPrompt = e;
     98                const installBtn = document.getElementById('codequill-pwa-install-btn');
     99               
     100                if(installBtn) {
     101                    installBtn.style.display = 'block';
     102                    installBtn.addEventListener('click', (e) => {
     103                        installBtn.style.display = 'none';
     104                        deferredPrompt.prompt();
     105                        deferredPrompt.userChoice.then((choiceResult) => {
     106                            deferredPrompt = null;
     107                        });
     108                    });
     109                }
     110            });
     111        })();
    184112        ";
    185113
  • codequill-web-to-app/trunk/readme.txt

    r3478841 r3479687  
    44Requires at least: 6.0
    55Tested up to: 6.9
    6 Stable tag: 1.0.4
     6Stable tag: 1.0.5
    77Requires PHP: 8.0
    88License: GPLv2 or later
     
    5555== Changelog ==
    5656
     57= 1.0.5 =
     58* New: Completely redesigned the plugin settings dashboard with a premium, modern UI.
     59* New: Added a WPCodeQuill product showcase to discover more premium plugins and themes.
     60* Fix: Resolved a critical issue where the Service Worker was not properly caching pages for offline use.
     61* Fix: Corrected the dynamic manifest generation to ensure the "Install App" prompt triggers reliably.
     62* Tweak: Restructured plugin core files (separated admin and frontend code) for better performance and security.
     63* Tweak: Resolved WPCS strict coding standards warnings for script enqueuing.
     64
     65= 1.0.4 =
     66* Resolved minor code standard warnings for WordPress Repository compliance.
     67* Fixed output escaping issues.
     68
    5769= 1.0.4 =
    5870* Resolved minor code standard warnings for WordPress Repository compliance.
Note: See TracChangeset for help on using the changeset viewer.