Plugin Directory

Changeset 3349527


Ignore:
Timestamp:
08/25/2025 08:34:20 AM (7 months ago)
Author:
madquick
Message:

Tag 1.0.3

Location:
madquick-ppg/tags/1.0.3
Files:
32 added
2 edited
18 copied

Legend:

Unmodified
Added
Removed
  • madquick-ppg/tags/1.0.3

    • Property svn:ignore set to
      .git
  • madquick-ppg/tags/1.0.3/madquick-ppg.php

    r3319446 r3349527  
    22/**
    33 * Plugin Name: Privacy Policy Generator - Madquick
     4 * Author: madquick
    45 * Author URI: https://github.com/Madquick-Private-Limited/
    56 * Requires at least: 6.8
    67 * Requires PHP: 7.4
    7  * Version: 1.0.2
     8 * Version: 1.0.3
    89 * Description: Generate privacy policy, terms, and legal pages required for your website.
    910 * License: GPLv2 or later
    1011 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1112 * Text Domain: madquick-ppg
     13 * Domain Path: /languages
    1214 *
    1315 * @package madquick-ppg
     
    2123// Required files
    2224require_once MADQUICK_PPG_PATH . 'ajax/create-ppg-page.php';
     25require_once MADQUICK_PPG_PATH . 'inc/class-madquick-ppg-strong-pass-checker.php';
     26require_once MADQUICK_PPG_PATH . 'inc/madquick-ppg-activator.php';
     27
     28// Register hooks
     29register_activation_hook(__FILE__, ['Madquick_PPG_Activator', 'activate']);
     30register_deactivation_hook(__FILE__, ['Madquick_PPG_Activator', 'deactivate']);
    2331
    2432if (!class_exists('Madquick_PPG')) {
    25 
    26     class Madquick_PPG {
    27 
     33    final class Madquick_PPG {
     34        private $settings = [];
     35       
    2836        public function __construct() {
    29             add_action('admin_menu', [$this, 'register_admin_menu']);
     37            // Load settings once
     38            $this->settings = get_option('madquick_ppg_settings', []);
     39           
     40            add_action('admin_menu', [$this, 'register_admin_menu']);                 // default priority 10
     41            add_action('admin_menu', [$this, 'hide_create_submenu_item'], 999);       // remove it from UI
    3042            add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_assets']);
     43            add_action('admin_init', [$this, 'register_settings']);
     44
     45            // Public-side banners
     46            add_action('wp_enqueue_scripts', [$this, 'enqueue_update_my_browser_assets']);
     47            add_action('wp_footer', [$this, 'output_update_my_browser_html']);
     48
     49            add_action('wp_enqueue_scripts', [$this, 'enqueue_cookie_banner_assets']);
     50            add_action('wp_footer', [$this, 'output_cookie_banner']);
     51        }
     52
     53        public function register_settings() {
     54            register_setting(
     55                'madquick_ppg_options_group', // Option group
     56                'madquick_ppg_settings',      // Option name (array)
     57                [
     58                    'type'              => 'array',
     59                    'sanitize_callback' => [$this, 'sanitize_settings'],
     60                    'default'           => [
     61                        'enable_checker' => true,
     62                        'enable_cookie_banner' => true,
     63                        'enable_update_banner' => true, 
     64                    ]
     65                ]
     66            );
     67
     68            add_settings_section(
     69                'madquick_ppg_main_section',
     70                __('General Settings', 'madquick-ppg'),
     71                '__return_false',
     72                'madquick-ppg-settings'
     73            );
     74
     75            add_settings_field(
     76                'enable_checker',
     77                __('Enable Strong Password Checker', 'madquick-ppg'),
     78                function () {
     79                    $options = get_option('madquick_ppg_settings', []);
     80                    $value   = isset($options['enable_checker']) ? (bool) $options['enable_checker'] : true;
     81                    ?>
     82                    <input type="checkbox" name="madquick_ppg_settings[enable_checker]" value="1" <?php checked($value, true); ?>>
     83                    <label><?php esc_html_e('Check to enforce strong password rules on login/registration.', 'madquick-ppg'); ?></label>
     84                    <?php
     85                },
     86                'madquick-ppg-settings',
     87                'madquick_ppg_main_section'
     88            );
     89
     90            add_settings_field(
     91                'enable_cookie_banner',
     92                __('Enable Cookie Banner', 'madquick-ppg'),
     93                function () {
     94                    $value = !empty($this->settings['enable_cookie_banner']);
     95                    ?>
     96                    <input type="checkbox" name="madquick_ppg_settings[enable_cookie_banner]" value="1" <?php checked($value, true); ?>>
     97                    <label><?php esc_html_e('Show cookie consent banner on the site.', 'madquick-ppg'); ?></label>
     98                    <?php
     99                },
     100                'madquick-ppg-settings',
     101                'madquick_ppg_main_section'
     102            );
     103
     104            add_settings_field(
     105                'enable_update_banner',
     106                __('Enable Update My Browser Banner', 'madquick-ppg'),
     107                function () {
     108                    $value = !empty($this->settings['enable_update_banner']);
     109                    ?>
     110                    <input type="checkbox" name="madquick_ppg_settings[enable_update_banner]" value="1" <?php checked($value, true); ?>>
     111                    <label><?php esc_html_e('Display update notification banner for outdated browsers.', 'madquick-ppg'); ?></label>
     112                    <?php
     113                },
     114                'madquick-ppg-settings',
     115                'madquick_ppg_main_section'
     116            );
     117
     118        }
     119
     120        public function sanitize_settings($input) {
     121            // Load current saved settings
     122            $output = get_option('madquick_ppg_settings', []);
     123
     124            // Update only the keys that came from the settings form
     125            $output['enable_checker']       = !empty($input['enable_checker']);
     126            $output['enable_cookie_banner'] = !empty($input['enable_cookie_banner']);
     127            $output['enable_update_banner'] = !empty($input['enable_update_banner']);
     128
     129            return $output;
    31130        }
    32131
    33132        /**
    34          * Enqueue plugin scripts and styles only on our pages.
     133         * Enqueue plugin scripts/styles only on our admin pages.
     134         * Use $hook_suffix (string) to avoid null-to-string deprecations.
     135         *
     136         * @param string $hook_suffix
    35137         */
    36         public function enqueue_admin_assets($hook) {
    37             $screen = get_current_screen();
    38             if (
    39                 isset($screen->id) &&
    40                 (strpos($screen->id, 'madquick-ppg-home') !== false ||
    41                  strpos($screen->id, 'madquick-ppg-help') !== false ||
    42                  strpos($screen->id, 'madquick-ppg-create') !== false)
    43             ) {
     138        public function enqueue_admin_assets($hook_suffix) {
     139            $hook = (string)($hook_suffix ?? '');
     140            if ($hook === '') {
     141                return;
     142            }
     143
     144            // Accept multiple variants WP may generate for submenu parents.
     145            // e.g. 'toplevel_page_madquick-ppg-home', 'privacy-policy-generator_page_madquick-ppg-settings', etc.
     146            $is_plugin_screen =
     147                preg_match('~_page_madquick-ppg-(home|help|create|settings)$~', $hook) === 1
     148                || $hook === 'toplevel_page_madquick-ppg-home';
     149
     150            if (!$is_plugin_screen) {
     151                return;
     152            }
     153
     154            $css_plugin_page = MADQUICK_PPG_PATH . 'assets/css/plugin-page.css';
     155            $css_home_page   = MADQUICK_PPG_PATH . 'assets/css/home-page.css';
     156            $js_generate     = MADQUICK_PPG_PATH . 'assets/js/generate-policy.js';
     157
     158            if (file_exists($css_plugin_page)) {
    44159                wp_enqueue_style(
    45160                    'madquick-ppg-plugin-page',
    46161                    MADQUICK_PPG_URL . 'assets/css/plugin-page.css',
    47162                    [],
    48                     filemtime(MADQUICK_PPG_PATH . 'assets/css/plugin-page.css')
     163                    (string) filemtime($css_plugin_page)
    49164                );
     165            }
     166
     167            if (file_exists($css_home_page)) {
    50168                wp_enqueue_style(
    51169                    'madquick-ppg-home-page',
    52170                    MADQUICK_PPG_URL . 'assets/css/home-page.css',
    53171                    [],
    54                     filemtime(MADQUICK_PPG_PATH . 'assets/css/home-page.css')
     172                    (string) filemtime($css_home_page)
    55173                );
     174            }
     175
     176            if (file_exists($js_generate)) {
    56177                wp_enqueue_script(
    57178                    'madquick-ppg-generate-policy',
    58179                    MADQUICK_PPG_URL . 'assets/js/generate-policy.js',
    59180                    ['jquery'],
    60                     filemtime(MADQUICK_PPG_PATH . 'assets/js/generate-policy.js'),
     181                    (string) filemtime($js_generate),
    61182                    true
    62183                );
     184
    63185                wp_localize_script('madquick-ppg-generate-policy', 'madquick_ppg_ajax', [
    64186                    'ajax_url' => admin_url('admin-ajax.php'),
     
    68190        }
    69191
    70         /**
    71          * Register admin menu and submenus.
    72          */
     192        public function enqueue_update_my_browser_assets() {
     193            if (is_admin() || empty($this->settings['enable_update_banner'])) return;
     194
     195            wp_enqueue_style(
     196                'madquick-ppg-update-browser',
     197                MADQUICK_PPG_URL . 'modules/update-my-browser/update-banner.css',
     198                [],
     199                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/update-banner.css')
     200            );
     201
     202            wp_enqueue_script(
     203                'madquick-ppg-update-browser',
     204                MADQUICK_PPG_URL . 'modules/update-my-browser/update-banner.js',
     205                [],
     206                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/update-banner.js'),
     207                true
     208            );
     209        }
     210
    73211        public function register_admin_menu() {
    74212            add_menu_page(
     
    91229            );
    92230
    93             // "Create" page, hidden from menu but routable
     231            // ✅ Register "Create" under the real parent (string), not null.
    94232            add_submenu_page(
    95                 null,
     233                'madquick-ppg-home',
    96234                __('Create Legal Page', 'madquick-ppg'),
    97235                __('Create', 'madquick-ppg'),
     
    100238                [$this, 'render_create_page']
    101239            );
    102         }
    103 
    104         /**
    105          * Main dashboard/page router.
    106          */
     240
     241            add_submenu_page(
     242                'madquick-ppg-home',
     243                __('Settings', 'madquick-ppg'),
     244                __('Settings', 'madquick-ppg'),
     245                'manage_options',
     246                'madquick-ppg-settings',
     247                [$this, 'render_settings_page']
     248            );
     249        }
     250
    107251        public function render_main_page() {
    108252            $action = isset($_GET['current-action']) ? sanitize_text_field(wp_unslash($_GET['current-action'])) : '';
     
    111255            if ($action && $nonce && wp_verify_nonce($nonce, 'madquick_create_ppg_nonce')) {
    112256                $this->include_page('madquick-ppg-create.php');
    113             } else {
    114                 $this->include_page('madquick-ppg-main.php');
    115             }
    116         }
    117 
    118         /**
    119          * Help submenu page.
    120          */
     257                return;
     258            }
     259            $this->include_page('madquick-ppg-main.php');
     260        }
     261
    121262        public function render_help_page() {
    122263            $this->include_page('madquick-ppg-help.php');
    123264        }
    124265
    125         /**
    126          * Create page, can be routed directly.
    127          */
    128266        public function render_create_page() {
    129267            $this->include_page('madquick-ppg-create.php');
    130268        }
    131269
     270        public function render_settings_page() {
     271            $this->include_page('madquick-ppg-settings.php');
     272        }
     273
     274        private function include_page($file) {
     275            $filepath = MADQUICK_PPG_PATH . 'pages/' . ltrim($file, '/');
     276            if (is_file($filepath)) {
     277                include $filepath;
     278                return;
     279            }
     280            echo esc_html__('Page not found.', 'madquick-ppg');
     281        }
     282
    132283        /**
    133          * Utility to include a page from /pages.
     284         * Remove the "Create" item from the visible submenu, but keep it routable.
    134285         */
    135         private function include_page($file) {
    136             $filepath = MADQUICK_PPG_PATH . 'pages/' . $file;
    137             if (file_exists($filepath)) {
    138                 include $filepath;
    139             } else {
    140                 echo esc_html__('Page not found.', 'madquick-ppg');
    141             }
     286        public function hide_create_submenu_item() {
     287            remove_submenu_page('madquick-ppg-home', 'madquick-ppg-create');
     288        }
     289
     290        public function output_update_my_browser_html() {
     291            if (is_admin() || empty($this->settings['enable_update_banner'])) return;
     292            include MADQUICK_PPG_PATH . 'modules/update-my-browser/update-banner.php';
     293        }
     294
     295        public function enqueue_cookie_banner_assets() {
     296            if (is_admin() || empty($this->settings['enable_cookie_banner'])) return;
     297
     298            wp_enqueue_style(
     299                'madquick-cookie-banner',
     300                MADQUICK_PPG_URL . 'modules/update-my-browser/cookie-banner.css',
     301                [],
     302                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/cookie-banner.css')
     303            );
     304
     305            wp_enqueue_script(
     306                'madquick-cookie-banner',
     307                MADQUICK_PPG_URL . 'modules/update-my-browser/cookie-banner.js',
     308                [],
     309                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/cookie-banner.js'),
     310                true
     311            );
     312        }
     313
     314        public function output_cookie_banner() {
     315            if (is_admin() || empty($this->settings['enable_cookie_banner'])) return;
     316            include MADQUICK_PPG_PATH . 'modules/update-my-browser/cookie-banner.php';
    142317        }
    143318    }
    144319
    145     // Initialize plugin
    146320    new Madquick_PPG();
    147321}
  • madquick-ppg/tags/1.0.3/pages/madquick-ppg-main.php

    r3319446 r3349527  
    2727    </div>
    2828
    29     <div style="height: 64px; border-bottom: 1px dashed #d1d1d1" >
     29    <div style="height: 32px; border-bottom: 1px dashed #d1d1d1" >
    3030
    3131    </div>
  • madquick-ppg/tags/1.0.3/readme.txt

    r3319446 r3349527  
    11=== Privacy Policy Generator - Madquick ===
    2 Contributors: madquick team
     2Contributors: madquick
    33Tags: privacy, policy, terms, legal, GDPR 
    44Requires at least: 6.8
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2323- Mobile responsive design for easy access.
    2424- User-friendly interface for beginners and professionals.
     25- Strong password checker
     26- Update browser with cookie banner
    2527
    2628== Installation ==
     
    60622. **Generated Policy Page** – Example of a generated policy.
    6163
     64= 1.0.3 = 
     65
     66Remove deprecation warnings
     67Added strong password checker
     68Added a new page called 'settings'
     69Register strong password checker settings
     70Imple update browser with cookie banner
     71
    6272== License ==
    6373
  • madquick-ppg/tags/1.0.3/trunk

    • Property svn:ignore set to
      .git
  • madquick-ppg/tags/1.0.3/trunk/madquick-ppg.php

    r3319446 r3349527  
    22/**
    33 * Plugin Name: Privacy Policy Generator - Madquick
     4 * Author: madquick
    45 * Author URI: https://github.com/Madquick-Private-Limited/
    56 * Requires at least: 6.8
    67 * Requires PHP: 7.4
    7  * Version: 1.0.2
     8 * Version: 1.0.3
    89 * Description: Generate privacy policy, terms, and legal pages required for your website.
    910 * License: GPLv2 or later
    1011 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1112 * Text Domain: madquick-ppg
     13 * Domain Path: /languages
    1214 *
    1315 * @package madquick-ppg
     
    2123// Required files
    2224require_once MADQUICK_PPG_PATH . 'ajax/create-ppg-page.php';
     25require_once MADQUICK_PPG_PATH . 'inc/class-madquick-ppg-strong-pass-checker.php';
     26require_once MADQUICK_PPG_PATH . 'inc/madquick-ppg-activator.php';
     27
     28// Register hooks
     29register_activation_hook(__FILE__, ['Madquick_PPG_Activator', 'activate']);
     30register_deactivation_hook(__FILE__, ['Madquick_PPG_Activator', 'deactivate']);
    2331
    2432if (!class_exists('Madquick_PPG')) {
    25 
    26     class Madquick_PPG {
    27 
     33    final class Madquick_PPG {
     34        private $settings = [];
     35       
    2836        public function __construct() {
    29             add_action('admin_menu', [$this, 'register_admin_menu']);
     37            // Load settings once
     38            $this->settings = get_option('madquick_ppg_settings', []);
     39           
     40            add_action('admin_menu', [$this, 'register_admin_menu']);                 // default priority 10
     41            add_action('admin_menu', [$this, 'hide_create_submenu_item'], 999);       // remove it from UI
    3042            add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_assets']);
     43            add_action('admin_init', [$this, 'register_settings']);
     44
     45            // Public-side banners
     46            add_action('wp_enqueue_scripts', [$this, 'enqueue_update_my_browser_assets']);
     47            add_action('wp_footer', [$this, 'output_update_my_browser_html']);
     48
     49            add_action('wp_enqueue_scripts', [$this, 'enqueue_cookie_banner_assets']);
     50            add_action('wp_footer', [$this, 'output_cookie_banner']);
     51        }
     52
     53        public function register_settings() {
     54            register_setting(
     55                'madquick_ppg_options_group', // Option group
     56                'madquick_ppg_settings',      // Option name (array)
     57                [
     58                    'type'              => 'array',
     59                    'sanitize_callback' => [$this, 'sanitize_settings'],
     60                    'default'           => [
     61                        'enable_checker' => true,
     62                        'enable_cookie_banner' => true,
     63                        'enable_update_banner' => true, 
     64                    ]
     65                ]
     66            );
     67
     68            add_settings_section(
     69                'madquick_ppg_main_section',
     70                __('General Settings', 'madquick-ppg'),
     71                '__return_false',
     72                'madquick-ppg-settings'
     73            );
     74
     75            add_settings_field(
     76                'enable_checker',
     77                __('Enable Strong Password Checker', 'madquick-ppg'),
     78                function () {
     79                    $options = get_option('madquick_ppg_settings', []);
     80                    $value   = isset($options['enable_checker']) ? (bool) $options['enable_checker'] : true;
     81                    ?>
     82                    <input type="checkbox" name="madquick_ppg_settings[enable_checker]" value="1" <?php checked($value, true); ?>>
     83                    <label><?php esc_html_e('Check to enforce strong password rules on login/registration.', 'madquick-ppg'); ?></label>
     84                    <?php
     85                },
     86                'madquick-ppg-settings',
     87                'madquick_ppg_main_section'
     88            );
     89
     90            add_settings_field(
     91                'enable_cookie_banner',
     92                __('Enable Cookie Banner', 'madquick-ppg'),
     93                function () {
     94                    $value = !empty($this->settings['enable_cookie_banner']);
     95                    ?>
     96                    <input type="checkbox" name="madquick_ppg_settings[enable_cookie_banner]" value="1" <?php checked($value, true); ?>>
     97                    <label><?php esc_html_e('Show cookie consent banner on the site.', 'madquick-ppg'); ?></label>
     98                    <?php
     99                },
     100                'madquick-ppg-settings',
     101                'madquick_ppg_main_section'
     102            );
     103
     104            add_settings_field(
     105                'enable_update_banner',
     106                __('Enable Update My Browser Banner', 'madquick-ppg'),
     107                function () {
     108                    $value = !empty($this->settings['enable_update_banner']);
     109                    ?>
     110                    <input type="checkbox" name="madquick_ppg_settings[enable_update_banner]" value="1" <?php checked($value, true); ?>>
     111                    <label><?php esc_html_e('Display update notification banner for outdated browsers.', 'madquick-ppg'); ?></label>
     112                    <?php
     113                },
     114                'madquick-ppg-settings',
     115                'madquick_ppg_main_section'
     116            );
     117
     118        }
     119
     120        public function sanitize_settings($input) {
     121            // Load current saved settings
     122            $output = get_option('madquick_ppg_settings', []);
     123
     124            // Update only the keys that came from the settings form
     125            $output['enable_checker']       = !empty($input['enable_checker']);
     126            $output['enable_cookie_banner'] = !empty($input['enable_cookie_banner']);
     127            $output['enable_update_banner'] = !empty($input['enable_update_banner']);
     128
     129            return $output;
    31130        }
    32131
    33132        /**
    34          * Enqueue plugin scripts and styles only on our pages.
     133         * Enqueue plugin scripts/styles only on our admin pages.
     134         * Use $hook_suffix (string) to avoid null-to-string deprecations.
     135         *
     136         * @param string $hook_suffix
    35137         */
    36         public function enqueue_admin_assets($hook) {
    37             $screen = get_current_screen();
    38             if (
    39                 isset($screen->id) &&
    40                 (strpos($screen->id, 'madquick-ppg-home') !== false ||
    41                  strpos($screen->id, 'madquick-ppg-help') !== false ||
    42                  strpos($screen->id, 'madquick-ppg-create') !== false)
    43             ) {
     138        public function enqueue_admin_assets($hook_suffix) {
     139            $hook = (string)($hook_suffix ?? '');
     140            if ($hook === '') {
     141                return;
     142            }
     143
     144            // Accept multiple variants WP may generate for submenu parents.
     145            // e.g. 'toplevel_page_madquick-ppg-home', 'privacy-policy-generator_page_madquick-ppg-settings', etc.
     146            $is_plugin_screen =
     147                preg_match('~_page_madquick-ppg-(home|help|create|settings)$~', $hook) === 1
     148                || $hook === 'toplevel_page_madquick-ppg-home';
     149
     150            if (!$is_plugin_screen) {
     151                return;
     152            }
     153
     154            $css_plugin_page = MADQUICK_PPG_PATH . 'assets/css/plugin-page.css';
     155            $css_home_page   = MADQUICK_PPG_PATH . 'assets/css/home-page.css';
     156            $js_generate     = MADQUICK_PPG_PATH . 'assets/js/generate-policy.js';
     157
     158            if (file_exists($css_plugin_page)) {
    44159                wp_enqueue_style(
    45160                    'madquick-ppg-plugin-page',
    46161                    MADQUICK_PPG_URL . 'assets/css/plugin-page.css',
    47162                    [],
    48                     filemtime(MADQUICK_PPG_PATH . 'assets/css/plugin-page.css')
     163                    (string) filemtime($css_plugin_page)
    49164                );
     165            }
     166
     167            if (file_exists($css_home_page)) {
    50168                wp_enqueue_style(
    51169                    'madquick-ppg-home-page',
    52170                    MADQUICK_PPG_URL . 'assets/css/home-page.css',
    53171                    [],
    54                     filemtime(MADQUICK_PPG_PATH . 'assets/css/home-page.css')
     172                    (string) filemtime($css_home_page)
    55173                );
     174            }
     175
     176            if (file_exists($js_generate)) {
    56177                wp_enqueue_script(
    57178                    'madquick-ppg-generate-policy',
    58179                    MADQUICK_PPG_URL . 'assets/js/generate-policy.js',
    59180                    ['jquery'],
    60                     filemtime(MADQUICK_PPG_PATH . 'assets/js/generate-policy.js'),
     181                    (string) filemtime($js_generate),
    61182                    true
    62183                );
     184
    63185                wp_localize_script('madquick-ppg-generate-policy', 'madquick_ppg_ajax', [
    64186                    'ajax_url' => admin_url('admin-ajax.php'),
     
    68190        }
    69191
    70         /**
    71          * Register admin menu and submenus.
    72          */
     192        public function enqueue_update_my_browser_assets() {
     193            if (is_admin() || empty($this->settings['enable_update_banner'])) return;
     194
     195            wp_enqueue_style(
     196                'madquick-ppg-update-browser',
     197                MADQUICK_PPG_URL . 'modules/update-my-browser/update-banner.css',
     198                [],
     199                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/update-banner.css')
     200            );
     201
     202            wp_enqueue_script(
     203                'madquick-ppg-update-browser',
     204                MADQUICK_PPG_URL . 'modules/update-my-browser/update-banner.js',
     205                [],
     206                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/update-banner.js'),
     207                true
     208            );
     209        }
     210
    73211        public function register_admin_menu() {
    74212            add_menu_page(
     
    91229            );
    92230
    93             // "Create" page, hidden from menu but routable
     231            // ✅ Register "Create" under the real parent (string), not null.
    94232            add_submenu_page(
    95                 null,
     233                'madquick-ppg-home',
    96234                __('Create Legal Page', 'madquick-ppg'),
    97235                __('Create', 'madquick-ppg'),
     
    100238                [$this, 'render_create_page']
    101239            );
    102         }
    103 
    104         /**
    105          * Main dashboard/page router.
    106          */
     240
     241            add_submenu_page(
     242                'madquick-ppg-home',
     243                __('Settings', 'madquick-ppg'),
     244                __('Settings', 'madquick-ppg'),
     245                'manage_options',
     246                'madquick-ppg-settings',
     247                [$this, 'render_settings_page']
     248            );
     249        }
     250
    107251        public function render_main_page() {
    108252            $action = isset($_GET['current-action']) ? sanitize_text_field(wp_unslash($_GET['current-action'])) : '';
     
    111255            if ($action && $nonce && wp_verify_nonce($nonce, 'madquick_create_ppg_nonce')) {
    112256                $this->include_page('madquick-ppg-create.php');
    113             } else {
    114                 $this->include_page('madquick-ppg-main.php');
    115             }
    116         }
    117 
    118         /**
    119          * Help submenu page.
    120          */
     257                return;
     258            }
     259            $this->include_page('madquick-ppg-main.php');
     260        }
     261
    121262        public function render_help_page() {
    122263            $this->include_page('madquick-ppg-help.php');
    123264        }
    124265
    125         /**
    126          * Create page, can be routed directly.
    127          */
    128266        public function render_create_page() {
    129267            $this->include_page('madquick-ppg-create.php');
    130268        }
    131269
     270        public function render_settings_page() {
     271            $this->include_page('madquick-ppg-settings.php');
     272        }
     273
     274        private function include_page($file) {
     275            $filepath = MADQUICK_PPG_PATH . 'pages/' . ltrim($file, '/');
     276            if (is_file($filepath)) {
     277                include $filepath;
     278                return;
     279            }
     280            echo esc_html__('Page not found.', 'madquick-ppg');
     281        }
     282
    132283        /**
    133          * Utility to include a page from /pages.
     284         * Remove the "Create" item from the visible submenu, but keep it routable.
    134285         */
    135         private function include_page($file) {
    136             $filepath = MADQUICK_PPG_PATH . 'pages/' . $file;
    137             if (file_exists($filepath)) {
    138                 include $filepath;
    139             } else {
    140                 echo esc_html__('Page not found.', 'madquick-ppg');
    141             }
     286        public function hide_create_submenu_item() {
     287            remove_submenu_page('madquick-ppg-home', 'madquick-ppg-create');
     288        }
     289
     290        public function output_update_my_browser_html() {
     291            if (is_admin() || empty($this->settings['enable_update_banner'])) return;
     292            include MADQUICK_PPG_PATH . 'modules/update-my-browser/update-banner.php';
     293        }
     294
     295        public function enqueue_cookie_banner_assets() {
     296            if (is_admin() || empty($this->settings['enable_cookie_banner'])) return;
     297
     298            wp_enqueue_style(
     299                'madquick-cookie-banner',
     300                MADQUICK_PPG_URL . 'modules/update-my-browser/cookie-banner.css',
     301                [],
     302                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/cookie-banner.css')
     303            );
     304
     305            wp_enqueue_script(
     306                'madquick-cookie-banner',
     307                MADQUICK_PPG_URL . 'modules/update-my-browser/cookie-banner.js',
     308                [],
     309                filemtime(MADQUICK_PPG_PATH . 'modules/update-my-browser/cookie-banner.js'),
     310                true
     311            );
     312        }
     313
     314        public function output_cookie_banner() {
     315            if (is_admin() || empty($this->settings['enable_cookie_banner'])) return;
     316            include MADQUICK_PPG_PATH . 'modules/update-my-browser/cookie-banner.php';
    142317        }
    143318    }
    144319
    145     // Initialize plugin
    146320    new Madquick_PPG();
    147321}
  • madquick-ppg/tags/1.0.3/trunk/pages/madquick-ppg-main.php

    r3319446 r3349527  
    2727    </div>
    2828
    29     <div style="height: 64px; border-bottom: 1px dashed #d1d1d1" >
     29    <div style="height: 32px; border-bottom: 1px dashed #d1d1d1" >
    3030
    3131    </div>
  • madquick-ppg/tags/1.0.3/trunk/readme.txt

    r3319446 r3349527  
    11=== Privacy Policy Generator - Madquick ===
    2 Contributors: madquick team
     2Contributors: madquick
    33Tags: privacy, policy, terms, legal, GDPR 
    44Requires at least: 6.8
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2323- Mobile responsive design for easy access.
    2424- User-friendly interface for beginners and professionals.
     25- Strong password checker
     26- Update browser with cookie banner
    2527
    2628== Installation ==
     
    60622. **Generated Policy Page** – Example of a generated policy.
    6163
     64= 1.0.3 = 
     65
     66Remove deprecation warnings
     67Added strong password checker
     68Added a new page called 'settings'
     69Register strong password checker settings
     70Imple update browser with cookie banner
     71
    6272== License ==
    6373
Note: See TracChangeset for help on using the changeset viewer.