Changeset 3349527
- Timestamp:
- 08/25/2025 08:34:20 AM (7 months ago)
- Location:
- madquick-ppg/tags/1.0.3
- Files:
-
- 32 added
- 2 edited
- 18 copied
-
. (copied) (copied from madquick-ppg/trunk) (1 prop)
-
LICENSE.txt (copied) (copied from madquick-ppg/trunk/LICENSE.txt)
-
ajax/create-ppg-page.php (copied) (copied from madquick-ppg/trunk/ajax/create-ppg-page.php)
-
assets/css/home-page.css (copied) (copied from madquick-ppg/trunk/assets/css/home-page.css)
-
assets/css/plugin-page.css (copied) (copied from madquick-ppg/trunk/assets/css/plugin-page.css)
-
assets/css/strong-pass.css (added)
-
assets/js/generate-policy.js (copied) (copied from madquick-ppg/trunk/assets/js/generate-policy.js)
-
assets/js/strong-pass.js (added)
-
inc (added)
-
inc/class-madquick-ppg-strong-pass-checker.php (added)
-
inc/madquick-ppg-activator.php (added)
-
languages (added)
-
madquick-ppg.php (copied) (copied from madquick-ppg/trunk/madquick-ppg.php) (6 diffs)
-
modules (added)
-
modules/update-my-browser (added)
-
modules/update-my-browser/cookie-banner.css (added)
-
modules/update-my-browser/cookie-banner.js (added)
-
modules/update-my-browser/cookie-banner.php (added)
-
modules/update-my-browser/index.php (added)
-
modules/update-my-browser/update-banner.css (added)
-
modules/update-my-browser/update-banner.js (added)
-
modules/update-my-browser/update-banner.php (added)
-
pages (copied) (copied from madquick-ppg/trunk/pages)
-
pages/madquick-ppg-main.php (modified) (1 diff)
-
pages/madquick-ppg-settings.php (added)
-
readme.txt (copied) (copied from madquick-ppg/trunk/readme.txt) (3 diffs)
-
trunk (copied) (copied from madquick-ppg/trunk) (1 prop)
-
trunk/LICENSE.txt (copied) (copied from madquick-ppg/trunk/LICENSE.txt)
-
trunk/ajax/create-ppg-page.php (copied) (copied from madquick-ppg/trunk/ajax/create-ppg-page.php)
-
trunk/assets/css/home-page.css (copied) (copied from madquick-ppg/trunk/assets/css/home-page.css)
-
trunk/assets/css/plugin-page.css (copied) (copied from madquick-ppg/trunk/assets/css/plugin-page.css)
-
trunk/assets/css/strong-pass.css (added)
-
trunk/assets/js/generate-policy.js (copied) (copied from madquick-ppg/trunk/assets/js/generate-policy.js)
-
trunk/assets/js/strong-pass.js (added)
-
trunk/inc (added)
-
trunk/inc/class-madquick-ppg-strong-pass-checker.php (added)
-
trunk/inc/madquick-ppg-activator.php (added)
-
trunk/languages (added)
-
trunk/madquick-ppg.php (copied) (copied from madquick-ppg/trunk/madquick-ppg.php) (6 diffs)
-
trunk/modules (added)
-
trunk/modules/update-my-browser (added)
-
trunk/modules/update-my-browser/cookie-banner.css (added)
-
trunk/modules/update-my-browser/cookie-banner.js (added)
-
trunk/modules/update-my-browser/cookie-banner.php (added)
-
trunk/modules/update-my-browser/index.php (added)
-
trunk/modules/update-my-browser/update-banner.css (added)
-
trunk/modules/update-my-browser/update-banner.js (added)
-
trunk/modules/update-my-browser/update-banner.php (added)
-
trunk/pages (copied) (copied from madquick-ppg/trunk/pages)
-
trunk/pages/madquick-ppg-main.php (modified) (1 diff)
-
trunk/pages/madquick-ppg-settings.php (added)
-
trunk/readme.txt (copied) (copied from madquick-ppg/trunk/readme.txt) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
madquick-ppg/tags/1.0.3
-
Property
svn:ignore
set to
.git
-
Property
svn:ignore
set to
-
madquick-ppg/tags/1.0.3/madquick-ppg.php
r3319446 r3349527 2 2 /** 3 3 * Plugin Name: Privacy Policy Generator - Madquick 4 * Author: madquick 4 5 * Author URI: https://github.com/Madquick-Private-Limited/ 5 6 * Requires at least: 6.8 6 7 * Requires PHP: 7.4 7 * Version: 1.0. 28 * Version: 1.0.3 8 9 * Description: Generate privacy policy, terms, and legal pages required for your website. 9 10 * License: GPLv2 or later 10 11 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 11 12 * Text Domain: madquick-ppg 13 * Domain Path: /languages 12 14 * 13 15 * @package madquick-ppg … … 21 23 // Required files 22 24 require_once MADQUICK_PPG_PATH . 'ajax/create-ppg-page.php'; 25 require_once MADQUICK_PPG_PATH . 'inc/class-madquick-ppg-strong-pass-checker.php'; 26 require_once MADQUICK_PPG_PATH . 'inc/madquick-ppg-activator.php'; 27 28 // Register hooks 29 register_activation_hook(__FILE__, ['Madquick_PPG_Activator', 'activate']); 30 register_deactivation_hook(__FILE__, ['Madquick_PPG_Activator', 'deactivate']); 23 31 24 32 if (!class_exists('Madquick_PPG')) { 25 26 class Madquick_PPG {27 33 final class Madquick_PPG { 34 private $settings = []; 35 28 36 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 30 42 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; 31 130 } 32 131 33 132 /** 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 35 137 */ 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)) { 44 159 wp_enqueue_style( 45 160 'madquick-ppg-plugin-page', 46 161 MADQUICK_PPG_URL . 'assets/css/plugin-page.css', 47 162 [], 48 filemtime(MADQUICK_PPG_PATH . 'assets/css/plugin-page.css')163 (string) filemtime($css_plugin_page) 49 164 ); 165 } 166 167 if (file_exists($css_home_page)) { 50 168 wp_enqueue_style( 51 169 'madquick-ppg-home-page', 52 170 MADQUICK_PPG_URL . 'assets/css/home-page.css', 53 171 [], 54 filemtime(MADQUICK_PPG_PATH . 'assets/css/home-page.css')172 (string) filemtime($css_home_page) 55 173 ); 174 } 175 176 if (file_exists($js_generate)) { 56 177 wp_enqueue_script( 57 178 'madquick-ppg-generate-policy', 58 179 MADQUICK_PPG_URL . 'assets/js/generate-policy.js', 59 180 ['jquery'], 60 filemtime(MADQUICK_PPG_PATH . 'assets/js/generate-policy.js'),181 (string) filemtime($js_generate), 61 182 true 62 183 ); 184 63 185 wp_localize_script('madquick-ppg-generate-policy', 'madquick_ppg_ajax', [ 64 186 'ajax_url' => admin_url('admin-ajax.php'), … … 68 190 } 69 191 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 73 211 public function register_admin_menu() { 74 212 add_menu_page( … … 91 229 ); 92 230 93 // "Create" page, hidden from menu but routable231 // ✅ Register "Create" under the real parent (string), not null. 94 232 add_submenu_page( 95 null,233 'madquick-ppg-home', 96 234 __('Create Legal Page', 'madquick-ppg'), 97 235 __('Create', 'madquick-ppg'), … … 100 238 [$this, 'render_create_page'] 101 239 ); 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 107 251 public function render_main_page() { 108 252 $action = isset($_GET['current-action']) ? sanitize_text_field(wp_unslash($_GET['current-action'])) : ''; … … 111 255 if ($action && $nonce && wp_verify_nonce($nonce, 'madquick_create_ppg_nonce')) { 112 256 $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 121 262 public function render_help_page() { 122 263 $this->include_page('madquick-ppg-help.php'); 123 264 } 124 265 125 /**126 * Create page, can be routed directly.127 */128 266 public function render_create_page() { 129 267 $this->include_page('madquick-ppg-create.php'); 130 268 } 131 269 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 132 283 /** 133 * Utility to include a page from /pages.284 * Remove the "Create" item from the visible submenu, but keep it routable. 134 285 */ 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'; 142 317 } 143 318 } 144 319 145 // Initialize plugin146 320 new Madquick_PPG(); 147 321 } -
madquick-ppg/tags/1.0.3/pages/madquick-ppg-main.php
r3319446 r3349527 27 27 </div> 28 28 29 <div style="height: 64px; border-bottom: 1px dashed #d1d1d1" >29 <div style="height: 32px; border-bottom: 1px dashed #d1d1d1" > 30 30 31 31 </div> -
madquick-ppg/tags/1.0.3/readme.txt
r3319446 r3349527 1 1 === Privacy Policy Generator - Madquick === 2 Contributors: madquick team2 Contributors: madquick 3 3 Tags: privacy, policy, terms, legal, GDPR 4 4 Requires at least: 6.8 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 23 23 - Mobile responsive design for easy access. 24 24 - User-friendly interface for beginners and professionals. 25 - Strong password checker 26 - Update browser with cookie banner 25 27 26 28 == Installation == … … 60 62 2. **Generated Policy Page** – Example of a generated policy. 61 63 64 = 1.0.3 = 65 66 Remove deprecation warnings 67 Added strong password checker 68 Added a new page called 'settings' 69 Register strong password checker settings 70 Imple update browser with cookie banner 71 62 72 == License == 63 73 -
madquick-ppg/tags/1.0.3/trunk
-
Property
svn:ignore
set to
.git
-
Property
svn:ignore
set to
-
madquick-ppg/tags/1.0.3/trunk/madquick-ppg.php
r3319446 r3349527 2 2 /** 3 3 * Plugin Name: Privacy Policy Generator - Madquick 4 * Author: madquick 4 5 * Author URI: https://github.com/Madquick-Private-Limited/ 5 6 * Requires at least: 6.8 6 7 * Requires PHP: 7.4 7 * Version: 1.0. 28 * Version: 1.0.3 8 9 * Description: Generate privacy policy, terms, and legal pages required for your website. 9 10 * License: GPLv2 or later 10 11 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 11 12 * Text Domain: madquick-ppg 13 * Domain Path: /languages 12 14 * 13 15 * @package madquick-ppg … … 21 23 // Required files 22 24 require_once MADQUICK_PPG_PATH . 'ajax/create-ppg-page.php'; 25 require_once MADQUICK_PPG_PATH . 'inc/class-madquick-ppg-strong-pass-checker.php'; 26 require_once MADQUICK_PPG_PATH . 'inc/madquick-ppg-activator.php'; 27 28 // Register hooks 29 register_activation_hook(__FILE__, ['Madquick_PPG_Activator', 'activate']); 30 register_deactivation_hook(__FILE__, ['Madquick_PPG_Activator', 'deactivate']); 23 31 24 32 if (!class_exists('Madquick_PPG')) { 25 26 class Madquick_PPG {27 33 final class Madquick_PPG { 34 private $settings = []; 35 28 36 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 30 42 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; 31 130 } 32 131 33 132 /** 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 35 137 */ 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)) { 44 159 wp_enqueue_style( 45 160 'madquick-ppg-plugin-page', 46 161 MADQUICK_PPG_URL . 'assets/css/plugin-page.css', 47 162 [], 48 filemtime(MADQUICK_PPG_PATH . 'assets/css/plugin-page.css')163 (string) filemtime($css_plugin_page) 49 164 ); 165 } 166 167 if (file_exists($css_home_page)) { 50 168 wp_enqueue_style( 51 169 'madquick-ppg-home-page', 52 170 MADQUICK_PPG_URL . 'assets/css/home-page.css', 53 171 [], 54 filemtime(MADQUICK_PPG_PATH . 'assets/css/home-page.css')172 (string) filemtime($css_home_page) 55 173 ); 174 } 175 176 if (file_exists($js_generate)) { 56 177 wp_enqueue_script( 57 178 'madquick-ppg-generate-policy', 58 179 MADQUICK_PPG_URL . 'assets/js/generate-policy.js', 59 180 ['jquery'], 60 filemtime(MADQUICK_PPG_PATH . 'assets/js/generate-policy.js'),181 (string) filemtime($js_generate), 61 182 true 62 183 ); 184 63 185 wp_localize_script('madquick-ppg-generate-policy', 'madquick_ppg_ajax', [ 64 186 'ajax_url' => admin_url('admin-ajax.php'), … … 68 190 } 69 191 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 73 211 public function register_admin_menu() { 74 212 add_menu_page( … … 91 229 ); 92 230 93 // "Create" page, hidden from menu but routable231 // ✅ Register "Create" under the real parent (string), not null. 94 232 add_submenu_page( 95 null,233 'madquick-ppg-home', 96 234 __('Create Legal Page', 'madquick-ppg'), 97 235 __('Create', 'madquick-ppg'), … … 100 238 [$this, 'render_create_page'] 101 239 ); 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 107 251 public function render_main_page() { 108 252 $action = isset($_GET['current-action']) ? sanitize_text_field(wp_unslash($_GET['current-action'])) : ''; … … 111 255 if ($action && $nonce && wp_verify_nonce($nonce, 'madquick_create_ppg_nonce')) { 112 256 $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 121 262 public function render_help_page() { 122 263 $this->include_page('madquick-ppg-help.php'); 123 264 } 124 265 125 /**126 * Create page, can be routed directly.127 */128 266 public function render_create_page() { 129 267 $this->include_page('madquick-ppg-create.php'); 130 268 } 131 269 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 132 283 /** 133 * Utility to include a page from /pages.284 * Remove the "Create" item from the visible submenu, but keep it routable. 134 285 */ 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'; 142 317 } 143 318 } 144 319 145 // Initialize plugin146 320 new Madquick_PPG(); 147 321 } -
madquick-ppg/tags/1.0.3/trunk/pages/madquick-ppg-main.php
r3319446 r3349527 27 27 </div> 28 28 29 <div style="height: 64px; border-bottom: 1px dashed #d1d1d1" >29 <div style="height: 32px; border-bottom: 1px dashed #d1d1d1" > 30 30 31 31 </div> -
madquick-ppg/tags/1.0.3/trunk/readme.txt
r3319446 r3349527 1 1 === Privacy Policy Generator - Madquick === 2 Contributors: madquick team2 Contributors: madquick 3 3 Tags: privacy, policy, terms, legal, GDPR 4 4 Requires at least: 6.8 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 23 23 - Mobile responsive design for easy access. 24 24 - User-friendly interface for beginners and professionals. 25 - Strong password checker 26 - Update browser with cookie banner 25 27 26 28 == Installation == … … 60 62 2. **Generated Policy Page** – Example of a generated policy. 61 63 64 = 1.0.3 = 65 66 Remove deprecation warnings 67 Added strong password checker 68 Added a new page called 'settings' 69 Register strong password checker settings 70 Imple update browser with cookie banner 71 62 72 == License == 63 73
Note: See TracChangeset
for help on using the changeset viewer.