Changeset 3399014
- Timestamp:
- 11/19/2025 01:56:00 PM (3 months ago)
- Location:
- admin-safety-guard
- Files:
-
- 2 added
- 14 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from admin-safety-guard/trunk)
-
tags/1.1.0/admin-safety-guard.php (modified) (2 diffs)
-
tags/1.1.0/app/Classes/Admin.php (modified) (1 diff)
-
tags/1.1.0/app/Classes/Settings.php (modified) (2 diffs)
-
tags/1.1.0/app/Classes/Wizard.php (modified) (7 diffs)
-
tags/1.1.0/inc/functions.php (modified) (1 diff)
-
tags/1.1.0/readme.txt (modified) (2 diffs)
-
tags/1.1.0/views/settings/parts/topbar.php (modified) (4 diffs)
-
tags/1.1.0/views/settings/support.php (added)
-
trunk/admin-safety-guard.php (modified) (2 diffs)
-
trunk/app/Classes/Admin.php (modified) (1 diff)
-
trunk/app/Classes/Settings.php (modified) (2 diffs)
-
trunk/app/Classes/Wizard.php (modified) (7 diffs)
-
trunk/inc/functions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/views/settings/parts/topbar.php (modified) (4 diffs)
-
trunk/views/settings/support.php (added)
Legend:
- Unmodified
- Added
- Removed
-
admin-safety-guard/tags/1.1.0/admin-safety-guard.php
r3394970 r3399014 4 4 Plugin URI: http://themepaste.com/product/themepaste-secure-admin-pro/ 5 5 Description: Secure your WordPress login with Admin safety guard to ensure secured access with limit login attempts, 2FA, reCaptcha, IP Blocking, Disable XML-RPC and activity tracking. 6 Version: 1. 0.96 Version: 1.1.0 7 7 Author: Themepaste Team 8 8 Author URI: http://themepaste.com/ … … 39 39 define( 'TPSA_PLUGIN_FILE', __FILE__ ); 40 40 define( 'TPSA_PREFIX', 'tpsa' ); 41 define( 'TPSA_PLUGIN_VERSION', '1. 0.9' );41 define( 'TPSA_PLUGIN_VERSION', '1.1.0' ); 42 42 define( 'TPSA_PLUGIN_DIRNAME', dirname( TPSA_PLUGIN_FILE ) ); 43 43 define( 'TPSA_PLUGIN_BASENAME', plugin_basename( TPSA_PLUGIN_FILE ) ); -
admin-safety-guard/tags/1.1.0/app/Classes/Admin.php
r3389497 r3399014 49 49 */ 50 50 public function admin_enqueue_styles( $screen ) { 51 if ( 'toplevel_page_' . Settings::$SETTING_PAGE_ID === $screen || 'admin-safety-guard_page_tp-admin-safety-guard-pro' === $screen ) {51 if ( 'toplevel_page_' . Settings::$SETTING_PAGE_ID === $screen || 'admin-safety-guard_page_tp-admin-safety-guard-pro' === $screen || 'admin-safety-guard_page_asg-support' === $screen ) { 52 52 $this->enqueue_style( 53 53 'tpsa-settings', -
admin-safety-guard/tags/1.1.0/app/Classes/Settings.php
r3337798 r3399014 5 5 defined( 'ABSPATH' ) || exit; 6 6 7 use ThemePaste\SecureAdmin\Helpers\Utility; 8 use ThemePaste\SecureAdmin\Traits\Asset; 7 9 use ThemePaste\SecureAdmin\Traits\Hook; 8 use ThemePaste\SecureAdmin\Traits\Asset;9 use ThemePaste\SecureAdmin\Helpers\Utility;10 10 11 11 /** … … 18 18 class Settings { 19 19 20 use Hook;21 use Asset;20 use Hook; 21 use Asset; 22 22 23 /**24 * Settings Page Slug.25 *26 * @var string27 */28 public static $SETTING_PAGE_ID = 'tp-admin-safety-guard';23 /** 24 * Settings Page Slug. 25 * 26 * @var string 27 */ 28 public static $SETTING_PAGE_ID = 'tp-admin-safety-guard'; 29 29 30 /**31 * Admin settings page URL.32 *33 * @var string34 */35 public $setting_page_url = '';30 /** 31 * Admin settings page URL. 32 * 33 * @var string 34 */ 35 public $setting_page_url = ''; 36 36 37 /**38 * Constructor.39 */40 public function init() {41 $this->setting_page_url = add_query_arg(42 [43 'page' => self::$SETTING_PAGE_ID,44 ],45 admin_url( 'admin.php' )46 );37 /** 38 * Constructor. 39 */ 40 public function init() { 41 $this->setting_page_url = add_query_arg( 42 [ 43 'page' => self::$SETTING_PAGE_ID, 44 ], 45 admin_url( 'admin.php' ) 46 ); 47 47 48 $this->action( 'admin_menu', [ $this, 'register_settings_page'] );49 $this->filter( 'plugin_action_links_' . TPSA_PLUGIN_BASENAME, [ $this, 'add_settings_link'] );48 $this->action( 'admin_menu', [$this, 'register_settings_page'] ); 49 $this->filter( 'plugin_action_links_' . TPSA_PLUGIN_BASENAME, [$this, 'add_settings_link'] ); 50 50 51 //Process and save settings52 $this->action( 'admin_post_tpsa_process_form', [ FormProcessor::class, 'process_form'] );53 $this->action( 'admin_init', [ $this, 'redirect_to_default_tab'] );54 }51 //Process and save settings 52 $this->action( 'admin_post_tpsa_process_form', [FormProcessor::class, 'process_form'] ); 53 $this->action( 'admin_init', [$this, 'redirect_to_default_tab'] ); 54 } 55 55 56 /** 57 * Registers the settings page in the admin menu. 58 * 59 * @return void 60 */ 61 public function register_settings_page() { 62 add_menu_page( 63 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 64 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 65 'manage_options', 66 self::$SETTING_PAGE_ID, 67 [ $this, 'render_settings_page' ], 68 'dashicons-lock', 69 56 70 ); 71 } 56 /** 57 * Registers the settings page in the admin menu. 58 * 59 * @return void 60 */ 61 public function register_settings_page() { 62 add_menu_page( 63 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 64 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 65 'manage_options', 66 self::$SETTING_PAGE_ID, 67 [$this, 'render_settings_page'], 68 'dashicons-lock', 69 56 70 ); 72 71 73 /** 74 * Renders the settings page layout. 75 * 76 * @return void 77 */ 78 public function render_settings_page() { 72 add_submenu_page( 73 self::$SETTING_PAGE_ID, // parent slug 74 __( 'Support', 'tp-secure-plugin' ), // page title 75 __( 'Support', 'tp-secure-plugin' ), // menu title 76 'manage_options', // capability 77 'asg-support', // submenu slug 78 [$this, 'render_asg_support_page']// callback function 79 ); 80 81 } 82 83 /** 84 * Renders the settings page layout. 85 * 86 * @return void 87 */ 88 public function render_settings_page() { 79 89 printf( '%s', Utility::get_template( 'settings/layout.php' ) ); 80 }90 } 81 91 82 public function redirect_to_default_tab() { 83 if ( 84 is_admin() && 85 current_user_can( 'manage_options' ) && 86 isset( $_GET['page'] ) && 87 $_GET['page'] === self::$SETTING_PAGE_ID && 88 ! isset( $_GET['tpsa-setting'] ) 89 ) { 90 $redirect_url = add_query_arg( 91 [ 92 'page' => self::$SETTING_PAGE_ID, 93 'tpsa-setting' => 'analytics', 94 ], 95 admin_url( 'admin.php' ) 96 ); 97 wp_safe_redirect( $redirect_url ); 98 exit; 99 } 100 } 92 public function render_asg_support_page() { 93 printf( '%s', Utility::get_template( 'settings/support.php' ) ); 94 } 101 95 102 /** 103 * Adds a "Settings" link to the plugin actions. 104 * 105 * @param array $links Existing plugin action links. 106 * 107 * @return array Modified plugin action links. 108 */ 109 public function add_settings_link( $links ) { 110 $settings_link = sprintf( 111 '<a href="%1$s">%2$s</a>', 112 esc_url( $this->setting_page_url ), 113 esc_html__( 'Settings', 'tp-secure-plugin' ) 114 ); 96 public function redirect_to_default_tab() { 97 if ( 98 is_admin() && 99 current_user_can( 'manage_options' ) && 100 isset( $_GET['page'] ) && 101 $_GET['page'] === self::$SETTING_PAGE_ID && 102 !isset( $_GET['tpsa-setting'] ) 103 ) { 104 $redirect_url = add_query_arg( 105 [ 106 'page' => self::$SETTING_PAGE_ID, 107 'tpsa-setting' => 'analytics', 108 ], 109 admin_url( 'admin.php' ) 110 ); 111 wp_safe_redirect( $redirect_url ); 112 exit; 113 } 114 } 115 115 116 array_unshift( $links, $settings_link ); 116 /** 117 * Adds a "Settings" link to the plugin actions. 118 * 119 * @param array $links Existing plugin action links. 120 * 121 * @return array Modified plugin action links. 122 */ 123 public function add_settings_link( $links ) { 124 $settings_link = sprintf( 125 '<a href="%1$s">%2$s</a>', 126 esc_url( $this->setting_page_url ), 127 esc_html__( 'Settings', 'tp-secure-plugin' ) 128 ); 117 129 118 return $links; 119 } 130 array_unshift( $links, $settings_link ); 120 131 121 public static function get_current_screen( ) { 122 return $_GET['tpsa-setting'] ?? null; 123 } 132 return $links; 133 } 134 135 public static function get_current_screen() { 136 return $_GET['tpsa-setting'] ?? null; 137 } 124 138 } -
admin-safety-guard/tags/1.1.0/app/Classes/Wizard.php
r3340906 r3399014 1 <?php 1 <?php 2 2 3 3 namespace ThemePaste\SecureAdmin\Classes; … … 5 5 defined( 'ABSPATH' ) || exit; 6 6 7 use ThemePaste\SecureAdmin\Helpers\Utility; 8 use ThemePaste\SecureAdmin\Traits\Asset; 7 9 use ThemePaste\SecureAdmin\Traits\Hook; 8 use ThemePaste\SecureAdmin\Traits\Asset;9 use ThemePaste\SecureAdmin\Helpers\Utility;10 10 11 11 class Wizard { … … 19 19 $this->action( 'admin_enqueue_scripts', [$this, 'enqueue_assets'] ); 20 20 $this->action( 'admin_init', [$this, 'setup_wizard_process'] ); 21 $this->action( 'admin_head', [$this, 'hide_setup_wizard_menu'] ); 21 22 } 22 23 23 function setup_wizard_process() {24 if ( ! isset( $_POST['tpsm_optin_submit'] ) ) {24 public function setup_wizard_process() { 25 if ( !isset( $_POST['tpsm_optin_submit'] ) ) { 25 26 return; 26 27 } 27 28 28 if ( ! isset( $_POST['tpsm-nonce_name'] ) || !wp_verify_nonce( $_POST['tpsm-nonce_name'], 'tpsm-nonce_action' ) ) {29 if ( !isset( $_POST['tpsm-nonce_name'] ) || !wp_verify_nonce( $_POST['tpsm-nonce_name'], 'tpsm-nonce_action' ) ) { 29 30 wp_die( esc_html__( 'Nonce verification failed.', 'shipping-manager' ) ); 30 31 } 31 32 32 // Check capabilities if needed 33 if ( ! current_user_can( 'manage_options' ) ) { 33 if ( !current_user_can( 'manage_options' ) ) { 34 34 wp_die( esc_html__( 'Unauthorized user', 'shipping-manager' ) ); 35 35 } 36 36 37 // Sanitize the choice38 37 $choice = isset( $_POST['tpsm_optin_choice'] ) ? sanitize_text_field( $_POST['tpsm_optin_choice'] ) : '0'; 39 40 // Convert to int and sanitize41 38 $value = (int) $choice === 1 ? 1 : 0; 42 39 43 // Save the option44 40 update_option( 'tpsm_is_setup_wizard', $value ); 45 41 46 // Save remote data if enabled 47 if( $value === 1 ) { 42 if ( $value === 1 ) { 48 43 tpsm_saved_remote_data(); 49 44 } 50 45 51 $redirect_url = add_query_arg( 46 $redirect_url = add_query_arg( 52 47 array( 53 48 'page' => 'tp-admin-safety-guard', … … 57 52 ); 58 53 59 wp_ redirect( $redirect_url );54 wp_safe_redirect( $redirect_url ); 60 55 error_log( 'Redirecting to: ' . $redirect_url ); 61 56 exit; 62 63 57 } 64 58 … … 67 61 $this->enqueue_style( 68 62 'tpasg-setup-wizard', 69 TPSA_ASSETS_URL . '/admin/css/wizard.css' ,63 TPSA_ASSETS_URL . '/admin/css/wizard.css' 70 64 ); 71 65 } … … 74 68 public function redirect_to_setup_wizard_page() { 75 69 if ( get_transient( 'tpsm_do_activation_redirect' ) ) { 76 delete_transient( 'tpsm_do_activation_redirect');77 78 if ( get_option( 'tpsm_is_setup_wizard', 0 ) ) {70 delete_transient( 'tpsm_do_activation_redirect' ); 71 72 if ( get_option( 'tpsm_is_setup_wizard', 0 ) ) { 79 73 return; 80 74 } 81 wp_redirect( add_query_arg( 82 array( 83 'page' => 'tpasg_setup_wizard', 84 ), 85 admin_url( 'admin.php' ) 86 ) ); 75 76 wp_safe_redirect( 77 add_query_arg( 78 array( 79 'page' => 'tpasg_setup_wizard', 80 ), 81 admin_url( 'admin.php' ) 82 ) 83 ); 87 84 exit; 88 85 } … … 91 88 public function add_setup_wizard_page() { 92 89 add_menu_page( 93 'Shipping Manager', // Page title94 'Shipping Manager', // Menu title (temporarily)95 'manage_options', 96 'tpasg_setup_wizard', 97 [ $this, 'render_setup_wizard_page' ], // Callback98 '', 99 100 90 'Shipping Manager', // Page title 91 'Shipping Manager', // Menu title (won't be visible due to CSS) 92 'manage_options', 93 'tpasg_setup_wizard', 94 [$this, 'render_setup_wizard_page'], 95 '', 96 100 100 97 ); 98 } 101 99 102 add_submenu_page( 103 null, // No parent slug means it's hidden 104 'Shipping Manager Setup Wizard', // Page title 105 'Setup Wizard', // Menu title (not shown) 106 'manage_options', // Capability 107 'tpasg_setup_wizard', // Menu slug 108 [ $this, 'render_setup_wizard_page' ] // Callback function 109 ); 110 111 // Remove it right after adding to hide from menu 112 remove_menu_page( 'tpasg_setup_wizard' ); 113 } 100 /** 101 * Hide the wizard menu item visually, but keep it in $menu 102 * so get_admin_page_title() works and no PHP 8 deprecation is triggered. 103 */ 104 public function hide_setup_wizard_menu() { 105 ?> 106 <style> 107 /* Hide the top-level wizard menu item everywhere */ 108 #toplevel_page_tpasg_setup_wizard { 109 display: none !important; 110 } 111 </style> 112 <?php 113 } 114 114 115 115 public function render_setup_wizard_page() { -
admin-safety-guard/tags/1.1.0/inc/functions.php
r3370983 r3399014 477 477 $site_url = get_site_url(); 478 478 479 $response = wp_remote_post( 'http ://18.215.124.169/wp-json/v2/collect-email/admin-safety-guard', [479 $response = wp_remote_post( 'https://themepaste.com/wp-json/v2/collect-email/admin-safety-guard', [ 480 480 'headers' => [ 481 481 'X-Auth-Token' => 'c7fc312817194d30c79da538204eaec3', -
admin-safety-guard/tags/1.1.0/readme.txt
r3394970 r3399014 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.0 7 Stable tag: 1. 0.97 Stable tag: 1.1.0 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 150 150 == Changelog == 151 151 152 = 1.1.0 = 153 * [fix] – Resolved several important WordPress admin warnings. 154 * [new] – Added an in-plugin support system. 155 152 156 = 1.0.9 = 153 157 [new] Added deactivation email feature on plugin activation -
admin-safety-guard/tags/1.1.0/views/settings/parts/topbar.php
r3340906 r3399014 2 2 <!-- Top bar wrapper for the Shipping Manager plugin --> 3 3 <div class="tpsa-plugin-topbar-wrapper"> 4 4 5 5 <!-- Logo and title area --> 6 6 <div class="tpsa-logo-title-area"> … … 8 8 <!-- Plugin icon --> 9 9 <div class="tpsa-icons"> 10 <?php 11 // Set the path for the top bar icon12 $tpsm_icon = TPSA_ASSETS_URL . '/admin/img/plugin-icon.png';10 <?php 11 // Set the path for the top bar icon 12 $tpsm_icon = TPSA_ASSETS_URL . '/admin/img/plugin-icon.png'; 13 13 14 // Output the icon with proper escaping15 printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) );16 ?>14 // Output the icon with proper escaping 15 printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) ); 16 ?> 17 17 </div> 18 18 … … 20 20 <div class="tpsa-titles"> 21 21 <h1><?php esc_html_e( 'Admin Safety Guard', 'tp-secure-plugin' ); ?></h1> 22 <p style="margin:0; color:#814bfe;"><?php esc_html_e( 'Shield Your Site with Confidence', 'tp-secure-plugin' ); ?></p> 22 <p style="margin:0; color:#814bfe;"> 23 <?php esc_html_e( 'Shield Your Site with Confidence', 'tp-secure-plugin' ); ?></p> 23 24 </div> 24 25 </div> … … 27 28 <div class="tpsa-topbar-info-area"> 28 29 <!-- Link to plugin documentation --> 29 <a href="https://themepaste.com/ documentation/admin-safety-guard-documentation" target="_blank">30 <a href="https://themepaste.com/product-doc" target="_blank"> 30 31 <?php esc_html_e( 'Documentation', 'tp-secure-plugin' ); ?> 31 32 </a> -
admin-safety-guard/trunk/admin-safety-guard.php
r3394970 r3399014 4 4 Plugin URI: http://themepaste.com/product/themepaste-secure-admin-pro/ 5 5 Description: Secure your WordPress login with Admin safety guard to ensure secured access with limit login attempts, 2FA, reCaptcha, IP Blocking, Disable XML-RPC and activity tracking. 6 Version: 1. 0.96 Version: 1.1.0 7 7 Author: Themepaste Team 8 8 Author URI: http://themepaste.com/ … … 39 39 define( 'TPSA_PLUGIN_FILE', __FILE__ ); 40 40 define( 'TPSA_PREFIX', 'tpsa' ); 41 define( 'TPSA_PLUGIN_VERSION', '1. 0.9' );41 define( 'TPSA_PLUGIN_VERSION', '1.1.0' ); 42 42 define( 'TPSA_PLUGIN_DIRNAME', dirname( TPSA_PLUGIN_FILE ) ); 43 43 define( 'TPSA_PLUGIN_BASENAME', plugin_basename( TPSA_PLUGIN_FILE ) ); -
admin-safety-guard/trunk/app/Classes/Admin.php
r3389497 r3399014 49 49 */ 50 50 public function admin_enqueue_styles( $screen ) { 51 if ( 'toplevel_page_' . Settings::$SETTING_PAGE_ID === $screen || 'admin-safety-guard_page_tp-admin-safety-guard-pro' === $screen ) {51 if ( 'toplevel_page_' . Settings::$SETTING_PAGE_ID === $screen || 'admin-safety-guard_page_tp-admin-safety-guard-pro' === $screen || 'admin-safety-guard_page_asg-support' === $screen ) { 52 52 $this->enqueue_style( 53 53 'tpsa-settings', -
admin-safety-guard/trunk/app/Classes/Settings.php
r3337798 r3399014 5 5 defined( 'ABSPATH' ) || exit; 6 6 7 use ThemePaste\SecureAdmin\Helpers\Utility; 8 use ThemePaste\SecureAdmin\Traits\Asset; 7 9 use ThemePaste\SecureAdmin\Traits\Hook; 8 use ThemePaste\SecureAdmin\Traits\Asset;9 use ThemePaste\SecureAdmin\Helpers\Utility;10 10 11 11 /** … … 18 18 class Settings { 19 19 20 use Hook;21 use Asset;20 use Hook; 21 use Asset; 22 22 23 /**24 * Settings Page Slug.25 *26 * @var string27 */28 public static $SETTING_PAGE_ID = 'tp-admin-safety-guard';23 /** 24 * Settings Page Slug. 25 * 26 * @var string 27 */ 28 public static $SETTING_PAGE_ID = 'tp-admin-safety-guard'; 29 29 30 /**31 * Admin settings page URL.32 *33 * @var string34 */35 public $setting_page_url = '';30 /** 31 * Admin settings page URL. 32 * 33 * @var string 34 */ 35 public $setting_page_url = ''; 36 36 37 /**38 * Constructor.39 */40 public function init() {41 $this->setting_page_url = add_query_arg(42 [43 'page' => self::$SETTING_PAGE_ID,44 ],45 admin_url( 'admin.php' )46 );37 /** 38 * Constructor. 39 */ 40 public function init() { 41 $this->setting_page_url = add_query_arg( 42 [ 43 'page' => self::$SETTING_PAGE_ID, 44 ], 45 admin_url( 'admin.php' ) 46 ); 47 47 48 $this->action( 'admin_menu', [ $this, 'register_settings_page'] );49 $this->filter( 'plugin_action_links_' . TPSA_PLUGIN_BASENAME, [ $this, 'add_settings_link'] );48 $this->action( 'admin_menu', [$this, 'register_settings_page'] ); 49 $this->filter( 'plugin_action_links_' . TPSA_PLUGIN_BASENAME, [$this, 'add_settings_link'] ); 50 50 51 //Process and save settings52 $this->action( 'admin_post_tpsa_process_form', [ FormProcessor::class, 'process_form'] );53 $this->action( 'admin_init', [ $this, 'redirect_to_default_tab'] );54 }51 //Process and save settings 52 $this->action( 'admin_post_tpsa_process_form', [FormProcessor::class, 'process_form'] ); 53 $this->action( 'admin_init', [$this, 'redirect_to_default_tab'] ); 54 } 55 55 56 /** 57 * Registers the settings page in the admin menu. 58 * 59 * @return void 60 */ 61 public function register_settings_page() { 62 add_menu_page( 63 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 64 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 65 'manage_options', 66 self::$SETTING_PAGE_ID, 67 [ $this, 'render_settings_page' ], 68 'dashicons-lock', 69 56 70 ); 71 } 56 /** 57 * Registers the settings page in the admin menu. 58 * 59 * @return void 60 */ 61 public function register_settings_page() { 62 add_menu_page( 63 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 64 esc_html__( 'Admin Safety Guard', 'tp-secure-plugin' ), 65 'manage_options', 66 self::$SETTING_PAGE_ID, 67 [$this, 'render_settings_page'], 68 'dashicons-lock', 69 56 70 ); 72 71 73 /** 74 * Renders the settings page layout. 75 * 76 * @return void 77 */ 78 public function render_settings_page() { 72 add_submenu_page( 73 self::$SETTING_PAGE_ID, // parent slug 74 __( 'Support', 'tp-secure-plugin' ), // page title 75 __( 'Support', 'tp-secure-plugin' ), // menu title 76 'manage_options', // capability 77 'asg-support', // submenu slug 78 [$this, 'render_asg_support_page']// callback function 79 ); 80 81 } 82 83 /** 84 * Renders the settings page layout. 85 * 86 * @return void 87 */ 88 public function render_settings_page() { 79 89 printf( '%s', Utility::get_template( 'settings/layout.php' ) ); 80 }90 } 81 91 82 public function redirect_to_default_tab() { 83 if ( 84 is_admin() && 85 current_user_can( 'manage_options' ) && 86 isset( $_GET['page'] ) && 87 $_GET['page'] === self::$SETTING_PAGE_ID && 88 ! isset( $_GET['tpsa-setting'] ) 89 ) { 90 $redirect_url = add_query_arg( 91 [ 92 'page' => self::$SETTING_PAGE_ID, 93 'tpsa-setting' => 'analytics', 94 ], 95 admin_url( 'admin.php' ) 96 ); 97 wp_safe_redirect( $redirect_url ); 98 exit; 99 } 100 } 92 public function render_asg_support_page() { 93 printf( '%s', Utility::get_template( 'settings/support.php' ) ); 94 } 101 95 102 /** 103 * Adds a "Settings" link to the plugin actions. 104 * 105 * @param array $links Existing plugin action links. 106 * 107 * @return array Modified plugin action links. 108 */ 109 public function add_settings_link( $links ) { 110 $settings_link = sprintf( 111 '<a href="%1$s">%2$s</a>', 112 esc_url( $this->setting_page_url ), 113 esc_html__( 'Settings', 'tp-secure-plugin' ) 114 ); 96 public function redirect_to_default_tab() { 97 if ( 98 is_admin() && 99 current_user_can( 'manage_options' ) && 100 isset( $_GET['page'] ) && 101 $_GET['page'] === self::$SETTING_PAGE_ID && 102 !isset( $_GET['tpsa-setting'] ) 103 ) { 104 $redirect_url = add_query_arg( 105 [ 106 'page' => self::$SETTING_PAGE_ID, 107 'tpsa-setting' => 'analytics', 108 ], 109 admin_url( 'admin.php' ) 110 ); 111 wp_safe_redirect( $redirect_url ); 112 exit; 113 } 114 } 115 115 116 array_unshift( $links, $settings_link ); 116 /** 117 * Adds a "Settings" link to the plugin actions. 118 * 119 * @param array $links Existing plugin action links. 120 * 121 * @return array Modified plugin action links. 122 */ 123 public function add_settings_link( $links ) { 124 $settings_link = sprintf( 125 '<a href="%1$s">%2$s</a>', 126 esc_url( $this->setting_page_url ), 127 esc_html__( 'Settings', 'tp-secure-plugin' ) 128 ); 117 129 118 return $links; 119 } 130 array_unshift( $links, $settings_link ); 120 131 121 public static function get_current_screen( ) { 122 return $_GET['tpsa-setting'] ?? null; 123 } 132 return $links; 133 } 134 135 public static function get_current_screen() { 136 return $_GET['tpsa-setting'] ?? null; 137 } 124 138 } -
admin-safety-guard/trunk/app/Classes/Wizard.php
r3340906 r3399014 1 <?php 1 <?php 2 2 3 3 namespace ThemePaste\SecureAdmin\Classes; … … 5 5 defined( 'ABSPATH' ) || exit; 6 6 7 use ThemePaste\SecureAdmin\Helpers\Utility; 8 use ThemePaste\SecureAdmin\Traits\Asset; 7 9 use ThemePaste\SecureAdmin\Traits\Hook; 8 use ThemePaste\SecureAdmin\Traits\Asset;9 use ThemePaste\SecureAdmin\Helpers\Utility;10 10 11 11 class Wizard { … … 19 19 $this->action( 'admin_enqueue_scripts', [$this, 'enqueue_assets'] ); 20 20 $this->action( 'admin_init', [$this, 'setup_wizard_process'] ); 21 $this->action( 'admin_head', [$this, 'hide_setup_wizard_menu'] ); 21 22 } 22 23 23 function setup_wizard_process() {24 if ( ! isset( $_POST['tpsm_optin_submit'] ) ) {24 public function setup_wizard_process() { 25 if ( !isset( $_POST['tpsm_optin_submit'] ) ) { 25 26 return; 26 27 } 27 28 28 if ( ! isset( $_POST['tpsm-nonce_name'] ) || !wp_verify_nonce( $_POST['tpsm-nonce_name'], 'tpsm-nonce_action' ) ) {29 if ( !isset( $_POST['tpsm-nonce_name'] ) || !wp_verify_nonce( $_POST['tpsm-nonce_name'], 'tpsm-nonce_action' ) ) { 29 30 wp_die( esc_html__( 'Nonce verification failed.', 'shipping-manager' ) ); 30 31 } 31 32 32 // Check capabilities if needed 33 if ( ! current_user_can( 'manage_options' ) ) { 33 if ( !current_user_can( 'manage_options' ) ) { 34 34 wp_die( esc_html__( 'Unauthorized user', 'shipping-manager' ) ); 35 35 } 36 36 37 // Sanitize the choice38 37 $choice = isset( $_POST['tpsm_optin_choice'] ) ? sanitize_text_field( $_POST['tpsm_optin_choice'] ) : '0'; 39 40 // Convert to int and sanitize41 38 $value = (int) $choice === 1 ? 1 : 0; 42 39 43 // Save the option44 40 update_option( 'tpsm_is_setup_wizard', $value ); 45 41 46 // Save remote data if enabled 47 if( $value === 1 ) { 42 if ( $value === 1 ) { 48 43 tpsm_saved_remote_data(); 49 44 } 50 45 51 $redirect_url = add_query_arg( 46 $redirect_url = add_query_arg( 52 47 array( 53 48 'page' => 'tp-admin-safety-guard', … … 57 52 ); 58 53 59 wp_ redirect( $redirect_url );54 wp_safe_redirect( $redirect_url ); 60 55 error_log( 'Redirecting to: ' . $redirect_url ); 61 56 exit; 62 63 57 } 64 58 … … 67 61 $this->enqueue_style( 68 62 'tpasg-setup-wizard', 69 TPSA_ASSETS_URL . '/admin/css/wizard.css' ,63 TPSA_ASSETS_URL . '/admin/css/wizard.css' 70 64 ); 71 65 } … … 74 68 public function redirect_to_setup_wizard_page() { 75 69 if ( get_transient( 'tpsm_do_activation_redirect' ) ) { 76 delete_transient( 'tpsm_do_activation_redirect');77 78 if ( get_option( 'tpsm_is_setup_wizard', 0 ) ) {70 delete_transient( 'tpsm_do_activation_redirect' ); 71 72 if ( get_option( 'tpsm_is_setup_wizard', 0 ) ) { 79 73 return; 80 74 } 81 wp_redirect( add_query_arg( 82 array( 83 'page' => 'tpasg_setup_wizard', 84 ), 85 admin_url( 'admin.php' ) 86 ) ); 75 76 wp_safe_redirect( 77 add_query_arg( 78 array( 79 'page' => 'tpasg_setup_wizard', 80 ), 81 admin_url( 'admin.php' ) 82 ) 83 ); 87 84 exit; 88 85 } … … 91 88 public function add_setup_wizard_page() { 92 89 add_menu_page( 93 'Shipping Manager', // Page title94 'Shipping Manager', // Menu title (temporarily)95 'manage_options', 96 'tpasg_setup_wizard', 97 [ $this, 'render_setup_wizard_page' ], // Callback98 '', 99 100 90 'Shipping Manager', // Page title 91 'Shipping Manager', // Menu title (won't be visible due to CSS) 92 'manage_options', 93 'tpasg_setup_wizard', 94 [$this, 'render_setup_wizard_page'], 95 '', 96 100 100 97 ); 98 } 101 99 102 add_submenu_page( 103 null, // No parent slug means it's hidden 104 'Shipping Manager Setup Wizard', // Page title 105 'Setup Wizard', // Menu title (not shown) 106 'manage_options', // Capability 107 'tpasg_setup_wizard', // Menu slug 108 [ $this, 'render_setup_wizard_page' ] // Callback function 109 ); 110 111 // Remove it right after adding to hide from menu 112 remove_menu_page( 'tpasg_setup_wizard' ); 113 } 100 /** 101 * Hide the wizard menu item visually, but keep it in $menu 102 * so get_admin_page_title() works and no PHP 8 deprecation is triggered. 103 */ 104 public function hide_setup_wizard_menu() { 105 ?> 106 <style> 107 /* Hide the top-level wizard menu item everywhere */ 108 #toplevel_page_tpasg_setup_wizard { 109 display: none !important; 110 } 111 </style> 112 <?php 113 } 114 114 115 115 public function render_setup_wizard_page() { -
admin-safety-guard/trunk/inc/functions.php
r3370983 r3399014 477 477 $site_url = get_site_url(); 478 478 479 $response = wp_remote_post( 'http ://18.215.124.169/wp-json/v2/collect-email/admin-safety-guard', [479 $response = wp_remote_post( 'https://themepaste.com/wp-json/v2/collect-email/admin-safety-guard', [ 480 480 'headers' => [ 481 481 'X-Auth-Token' => 'c7fc312817194d30c79da538204eaec3', -
admin-safety-guard/trunk/readme.txt
r3394970 r3399014 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.0 7 Stable tag: 1. 0.97 Stable tag: 1.1.0 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 150 150 == Changelog == 151 151 152 = 1.1.0 = 153 * [fix] – Resolved several important WordPress admin warnings. 154 * [new] – Added an in-plugin support system. 155 152 156 = 1.0.9 = 153 157 [new] Added deactivation email feature on plugin activation -
admin-safety-guard/trunk/views/settings/parts/topbar.php
r3340906 r3399014 2 2 <!-- Top bar wrapper for the Shipping Manager plugin --> 3 3 <div class="tpsa-plugin-topbar-wrapper"> 4 4 5 5 <!-- Logo and title area --> 6 6 <div class="tpsa-logo-title-area"> … … 8 8 <!-- Plugin icon --> 9 9 <div class="tpsa-icons"> 10 <?php 11 // Set the path for the top bar icon12 $tpsm_icon = TPSA_ASSETS_URL . '/admin/img/plugin-icon.png';10 <?php 11 // Set the path for the top bar icon 12 $tpsm_icon = TPSA_ASSETS_URL . '/admin/img/plugin-icon.png'; 13 13 14 // Output the icon with proper escaping15 printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) );16 ?>14 // Output the icon with proper escaping 15 printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) ); 16 ?> 17 17 </div> 18 18 … … 20 20 <div class="tpsa-titles"> 21 21 <h1><?php esc_html_e( 'Admin Safety Guard', 'tp-secure-plugin' ); ?></h1> 22 <p style="margin:0; color:#814bfe;"><?php esc_html_e( 'Shield Your Site with Confidence', 'tp-secure-plugin' ); ?></p> 22 <p style="margin:0; color:#814bfe;"> 23 <?php esc_html_e( 'Shield Your Site with Confidence', 'tp-secure-plugin' ); ?></p> 23 24 </div> 24 25 </div> … … 27 28 <div class="tpsa-topbar-info-area"> 28 29 <!-- Link to plugin documentation --> 29 <a href="https://themepaste.com/ documentation/admin-safety-guard-documentation" target="_blank">30 <a href="https://themepaste.com/product-doc" target="_blank"> 30 31 <?php esc_html_e( 'Documentation', 'tp-secure-plugin' ); ?> 31 32 </a>
Note: See TracChangeset
for help on using the changeset viewer.