Plugin Directory

Changeset 3399014


Ignore:
Timestamp:
11/19/2025 01:56:00 PM (3 months ago)
Author:
themepaste
Message:

Update to version 1.1.0 from GitHub

Location:
admin-safety-guard
Files:
2 added
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • admin-safety-guard/tags/1.1.0/admin-safety-guard.php

    r3394970 r3399014  
    44Plugin URI: http://themepaste.com/product/themepaste-secure-admin-pro/
    55Description: 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.9
     6Version: 1.1.0
    77Author: Themepaste Team
    88Author URI: http://themepaste.com/
     
    3939        define( 'TPSA_PLUGIN_FILE', __FILE__ );
    4040        define( 'TPSA_PREFIX', 'tpsa' );
    41         define( 'TPSA_PLUGIN_VERSION', '1.0.9' );
     41        define( 'TPSA_PLUGIN_VERSION', '1.1.0' );
    4242        define( 'TPSA_PLUGIN_DIRNAME', dirname( TPSA_PLUGIN_FILE ) );
    4343        define( 'TPSA_PLUGIN_BASENAME', plugin_basename( TPSA_PLUGIN_FILE ) );
  • admin-safety-guard/tags/1.1.0/app/Classes/Admin.php

    r3389497 r3399014  
    4949     */
    5050    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 ) {
    5252            $this->enqueue_style(
    5353                'tpsa-settings',
  • admin-safety-guard/tags/1.1.0/app/Classes/Settings.php

    r3337798 r3399014  
    55defined( 'ABSPATH' ) || exit;
    66
     7use ThemePaste\SecureAdmin\Helpers\Utility;
     8use ThemePaste\SecureAdmin\Traits\Asset;
    79use ThemePaste\SecureAdmin\Traits\Hook;
    8 use ThemePaste\SecureAdmin\Traits\Asset;
    9 use ThemePaste\SecureAdmin\Helpers\Utility;
    1010
    1111/**
     
    1818class Settings {
    1919
    20     use Hook;
    21     use Asset;
     20    use Hook;
     21    use Asset;
    2222
    23     /**
    24     * Settings Page Slug.
    25     *
    26     * @var string
    27     */
    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';
    2929
    30     /**
    31     * Admin settings page URL.
    32     *
    33     * @var string
    34     */
    35     public $setting_page_url = '';
     30    /**
     31    * Admin settings page URL.
     32    *
     33    * @var string
     34    */
     35    public $setting_page_url = '';
    3636
    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        );
    4747
    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'] );
    5050
    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     }
     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    }
    5555
    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        );
    7271
    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() {
    7989        printf( '%s', Utility::get_template( 'settings/layout.php' ) );
    80     }
     90    }
    8191
    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    }
    10195
    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    }
    115115
    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        );
    117129
    118         return $links;
    119     }
     130        array_unshift( $links, $settings_link );
    120131
    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    }
    124138}
  • admin-safety-guard/tags/1.1.0/app/Classes/Wizard.php

    r3340906 r3399014  
    1 <?php 
     1<?php
    22
    33namespace ThemePaste\SecureAdmin\Classes;
     
    55defined( 'ABSPATH' ) || exit;
    66
     7use ThemePaste\SecureAdmin\Helpers\Utility;
     8use ThemePaste\SecureAdmin\Traits\Asset;
    79use ThemePaste\SecureAdmin\Traits\Hook;
    8 use ThemePaste\SecureAdmin\Traits\Asset;
    9 use ThemePaste\SecureAdmin\Helpers\Utility;
    1010
    1111class Wizard {
     
    1919        $this->action( 'admin_enqueue_scripts', [$this, 'enqueue_assets'] );
    2020        $this->action( 'admin_init', [$this, 'setup_wizard_process'] );
     21        $this->action( 'admin_head', [$this, 'hide_setup_wizard_menu'] );
    2122    }
    2223
    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'] ) ) {
    2526            return;
    2627        }
    2728
    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' ) ) {
    2930            wp_die( esc_html__( 'Nonce verification failed.', 'shipping-manager' ) );
    3031        }
    3132
    32         // Check capabilities if needed
    33         if ( ! current_user_can( 'manage_options' ) ) {
     33        if ( !current_user_can( 'manage_options' ) ) {
    3434            wp_die( esc_html__( 'Unauthorized user', 'shipping-manager' ) );
    3535        }
    3636
    37         // Sanitize the choice
    3837        $choice = isset( $_POST['tpsm_optin_choice'] ) ? sanitize_text_field( $_POST['tpsm_optin_choice'] ) : '0';
    39 
    40         // Convert to int and sanitize
    4138        $value = (int) $choice === 1 ? 1 : 0;
    4239
    43         // Save the option
    4440        update_option( 'tpsm_is_setup_wizard', $value );
    4541
    46         // Save remote data if enabled
    47         if( $value === 1 ) {
     42        if ( $value === 1 ) {
    4843            tpsm_saved_remote_data();
    4944        }
    5045
    51         $redirect_url = add_query_arg( 
     46        $redirect_url = add_query_arg(
    5247            array(
    5348                'page'         => 'tp-admin-safety-guard',
     
    5752        );
    5853
    59         wp_redirect( $redirect_url );
     54        wp_safe_redirect( $redirect_url );
    6055        error_log( 'Redirecting to: ' . $redirect_url );
    6156        exit;
    62 
    6357    }
    6458
     
    6761            $this->enqueue_style(
    6862                'tpasg-setup-wizard',
    69                 TPSA_ASSETS_URL . '/admin/css/wizard.css',
     63                TPSA_ASSETS_URL . '/admin/css/wizard.css'
    7064            );
    7165        }
     
    7468    public function redirect_to_setup_wizard_page() {
    7569        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 ) ) {
    7973                return;
    8074            }
    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            );
    8784            exit;
    8885        }
     
    9188    public function add_setup_wizard_page() {
    9289        add_menu_page(
    93             'Shipping Manager',                     // Page title
    94             'Shipping Manager',                     // Menu title (temporarily)
    95             'manage_options',                       
    96             'tpasg_setup_wizard',                   
    97             [ $this, 'render_setup_wizard_page' ],  // Callback
    98             '',                                     
    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
    10097        );
     98    }
    10199
    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}
    114114
    115115    public function render_setup_wizard_page() {
  • admin-safety-guard/tags/1.1.0/inc/functions.php

    r3370983 r3399014  
    477477        $site_url = get_site_url();
    478478
    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', [
    480480            'headers' => [
    481481                'X-Auth-Token' => 'c7fc312817194d30c79da538204eaec3',
  • admin-safety-guard/tags/1.1.0/readme.txt

    r3394970 r3399014  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 1.0.9
     7Stable tag: 1.1.0
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    150150== Changelog ==
    151151
     152= 1.1.0 =
     153* [fix] – Resolved several important WordPress admin warnings.
     154* [new] – Added an in-plugin support system.
     155
    152156= 1.0.9 =
    153157[new] Added deactivation email feature on plugin activation
  • admin-safety-guard/tags/1.1.0/views/settings/parts/topbar.php

    r3340906 r3399014  
    22<!-- Top bar wrapper for the Shipping Manager plugin -->
    33<div class="tpsa-plugin-topbar-wrapper">
    4    
     4
    55    <!-- Logo and title area -->
    66    <div class="tpsa-logo-title-area">
     
    88        <!-- Plugin icon -->
    99        <div class="tpsa-icons">
    10             <?php 
    11                 // Set the path for the top bar icon
    12                 $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';
    1313
    14                 // Output the icon with proper escaping
    15                 printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) );
    16             ?>
     14// Output the icon with proper escaping
     15printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) );
     16?>
    1717        </div>
    1818
     
    2020        <div class="tpsa-titles">
    2121            <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>
    2324        </div>
    2425    </div>
     
    2728    <div class="tpsa-topbar-info-area">
    2829        <!-- 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">
    3031            <?php esc_html_e( 'Documentation', 'tp-secure-plugin' ); ?>
    3132        </a>
  • admin-safety-guard/trunk/admin-safety-guard.php

    r3394970 r3399014  
    44Plugin URI: http://themepaste.com/product/themepaste-secure-admin-pro/
    55Description: 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.9
     6Version: 1.1.0
    77Author: Themepaste Team
    88Author URI: http://themepaste.com/
     
    3939        define( 'TPSA_PLUGIN_FILE', __FILE__ );
    4040        define( 'TPSA_PREFIX', 'tpsa' );
    41         define( 'TPSA_PLUGIN_VERSION', '1.0.9' );
     41        define( 'TPSA_PLUGIN_VERSION', '1.1.0' );
    4242        define( 'TPSA_PLUGIN_DIRNAME', dirname( TPSA_PLUGIN_FILE ) );
    4343        define( 'TPSA_PLUGIN_BASENAME', plugin_basename( TPSA_PLUGIN_FILE ) );
  • admin-safety-guard/trunk/app/Classes/Admin.php

    r3389497 r3399014  
    4949     */
    5050    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 ) {
    5252            $this->enqueue_style(
    5353                'tpsa-settings',
  • admin-safety-guard/trunk/app/Classes/Settings.php

    r3337798 r3399014  
    55defined( 'ABSPATH' ) || exit;
    66
     7use ThemePaste\SecureAdmin\Helpers\Utility;
     8use ThemePaste\SecureAdmin\Traits\Asset;
    79use ThemePaste\SecureAdmin\Traits\Hook;
    8 use ThemePaste\SecureAdmin\Traits\Asset;
    9 use ThemePaste\SecureAdmin\Helpers\Utility;
    1010
    1111/**
     
    1818class Settings {
    1919
    20     use Hook;
    21     use Asset;
     20    use Hook;
     21    use Asset;
    2222
    23     /**
    24     * Settings Page Slug.
    25     *
    26     * @var string
    27     */
    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';
    2929
    30     /**
    31     * Admin settings page URL.
    32     *
    33     * @var string
    34     */
    35     public $setting_page_url = '';
     30    /**
     31    * Admin settings page URL.
     32    *
     33    * @var string
     34    */
     35    public $setting_page_url = '';
    3636
    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        );
    4747
    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'] );
    5050
    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     }
     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    }
    5555
    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        );
    7271
    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() {
    7989        printf( '%s', Utility::get_template( 'settings/layout.php' ) );
    80     }
     90    }
    8191
    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    }
    10195
    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    }
    115115
    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        );
    117129
    118         return $links;
    119     }
     130        array_unshift( $links, $settings_link );
    120131
    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    }
    124138}
  • admin-safety-guard/trunk/app/Classes/Wizard.php

    r3340906 r3399014  
    1 <?php 
     1<?php
    22
    33namespace ThemePaste\SecureAdmin\Classes;
     
    55defined( 'ABSPATH' ) || exit;
    66
     7use ThemePaste\SecureAdmin\Helpers\Utility;
     8use ThemePaste\SecureAdmin\Traits\Asset;
    79use ThemePaste\SecureAdmin\Traits\Hook;
    8 use ThemePaste\SecureAdmin\Traits\Asset;
    9 use ThemePaste\SecureAdmin\Helpers\Utility;
    1010
    1111class Wizard {
     
    1919        $this->action( 'admin_enqueue_scripts', [$this, 'enqueue_assets'] );
    2020        $this->action( 'admin_init', [$this, 'setup_wizard_process'] );
     21        $this->action( 'admin_head', [$this, 'hide_setup_wizard_menu'] );
    2122    }
    2223
    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'] ) ) {
    2526            return;
    2627        }
    2728
    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' ) ) {
    2930            wp_die( esc_html__( 'Nonce verification failed.', 'shipping-manager' ) );
    3031        }
    3132
    32         // Check capabilities if needed
    33         if ( ! current_user_can( 'manage_options' ) ) {
     33        if ( !current_user_can( 'manage_options' ) ) {
    3434            wp_die( esc_html__( 'Unauthorized user', 'shipping-manager' ) );
    3535        }
    3636
    37         // Sanitize the choice
    3837        $choice = isset( $_POST['tpsm_optin_choice'] ) ? sanitize_text_field( $_POST['tpsm_optin_choice'] ) : '0';
    39 
    40         // Convert to int and sanitize
    4138        $value = (int) $choice === 1 ? 1 : 0;
    4239
    43         // Save the option
    4440        update_option( 'tpsm_is_setup_wizard', $value );
    4541
    46         // Save remote data if enabled
    47         if( $value === 1 ) {
     42        if ( $value === 1 ) {
    4843            tpsm_saved_remote_data();
    4944        }
    5045
    51         $redirect_url = add_query_arg( 
     46        $redirect_url = add_query_arg(
    5247            array(
    5348                'page'         => 'tp-admin-safety-guard',
     
    5752        );
    5853
    59         wp_redirect( $redirect_url );
     54        wp_safe_redirect( $redirect_url );
    6055        error_log( 'Redirecting to: ' . $redirect_url );
    6156        exit;
    62 
    6357    }
    6458
     
    6761            $this->enqueue_style(
    6862                'tpasg-setup-wizard',
    69                 TPSA_ASSETS_URL . '/admin/css/wizard.css',
     63                TPSA_ASSETS_URL . '/admin/css/wizard.css'
    7064            );
    7165        }
     
    7468    public function redirect_to_setup_wizard_page() {
    7569        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 ) ) {
    7973                return;
    8074            }
    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            );
    8784            exit;
    8885        }
     
    9188    public function add_setup_wizard_page() {
    9289        add_menu_page(
    93             'Shipping Manager',                     // Page title
    94             'Shipping Manager',                     // Menu title (temporarily)
    95             'manage_options',                       
    96             'tpasg_setup_wizard',                   
    97             [ $this, 'render_setup_wizard_page' ],  // Callback
    98             '',                                     
    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
    10097        );
     98    }
    10199
    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}
    114114
    115115    public function render_setup_wizard_page() {
  • admin-safety-guard/trunk/inc/functions.php

    r3370983 r3399014  
    477477        $site_url = get_site_url();
    478478
    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', [
    480480            'headers' => [
    481481                'X-Auth-Token' => 'c7fc312817194d30c79da538204eaec3',
  • admin-safety-guard/trunk/readme.txt

    r3394970 r3399014  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 1.0.9
     7Stable tag: 1.1.0
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    150150== Changelog ==
    151151
     152= 1.1.0 =
     153* [fix] – Resolved several important WordPress admin warnings.
     154* [new] – Added an in-plugin support system.
     155
    152156= 1.0.9 =
    153157[new] Added deactivation email feature on plugin activation
  • admin-safety-guard/trunk/views/settings/parts/topbar.php

    r3340906 r3399014  
    22<!-- Top bar wrapper for the Shipping Manager plugin -->
    33<div class="tpsa-plugin-topbar-wrapper">
    4    
     4
    55    <!-- Logo and title area -->
    66    <div class="tpsa-logo-title-area">
     
    88        <!-- Plugin icon -->
    99        <div class="tpsa-icons">
    10             <?php 
    11                 // Set the path for the top bar icon
    12                 $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';
    1313
    14                 // Output the icon with proper escaping
    15                 printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) );
    16             ?>
     14// Output the icon with proper escaping
     15printf( '<img src="%1$s" >', esc_url( $tpsm_icon ) );
     16?>
    1717        </div>
    1818
     
    2020        <div class="tpsa-titles">
    2121            <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>
    2324        </div>
    2425    </div>
     
    2728    <div class="tpsa-topbar-info-area">
    2829        <!-- 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">
    3031            <?php esc_html_e( 'Documentation', 'tp-secure-plugin' ); ?>
    3132        </a>
Note: See TracChangeset for help on using the changeset viewer.