Plugin Directory

Changeset 3321920


Ignore:
Timestamp:
07/03/2025 04:57:50 PM (8 months ago)
Author:
alertwise
Message:

Addressed the Violation raised from WordPress.org Plugin Directory

Location:
alertwise/trunk
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • alertwise/trunk/app/Admin.php

    r3315545 r3321920  
    88// Exit if accessed directly.
    99if ( ! defined( 'ABSPATH' ) ) {
    10     exit;
     10    exit;
    1111}
    1212
    1313class Admin {
    14     /**
    15     * Constructor function to register hooks
    16     *
    17     * @since 4.0.0
    18     */
    19     public function __construct() {
    20         if ( is_admin() && current_user_can( 'manage_options' ) ) {
    21             add_action( 'admin_init', array( $this, 'alertwise_plugin_redirect' ), 9999 );
    22             add_action( 'admin_enqueue_scripts', array( $this, 'alertwise_hide_admin_notices' ) );
    23             add_action( 'admin_notices', array( $this, 'alertwise_display_admin_notices' ) );
    24             SettingsHandler::register();
    25         }
    26     }
     14    /**
     15    * Constructor function to register hooks
     16    *
     17    * @since 4.0.0
     18    */
     19    public function __construct() {
     20        if ( is_admin() && current_user_can( 'manage_options' ) ) {
     21            add_action( 'admin_init', array( $this, 'alertwise_plugin_redirect' ), 9999 );
     22            add_action( 'admin_enqueue_scripts', array( $this, 'alertwise_hide_admin_notices' ) );
     23            add_action( 'admin_notices', array( $this, 'alertwise_display_admin_notices' ) );
     24            SettingsHandler::register();
     25        }
     26    }
    2727
    28     /**
    29     * Redirect to onboarding screen after activation
    30     *
    31     * @since 4.0.0
    32     */
    33     public function alertwise_plugin_redirect() {
    34         if ( ! get_transient( 'alertwise_activation_redirect' ) ) {
    35             return;
    36         }
     28    /**
     29    * Redirect to onboarding screen after activation
     30    *
     31    * @since 4.0.0
     32    */
     33    public function alertwise_plugin_redirect() {
     34        if ( ! get_transient( 'alertwise_activation_redirect' ) ) {
     35            return;
     36        }
    3737
    38         delete_transient( 'alertwise_activation_redirect' );
     38        delete_transient( 'alertwise_activation_redirect' );
    3939
    40         // Only do this for single site installs.
    41         if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
    42             return;
    43         }
     40        // Only do this for single site installs.
     41        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
     42            return;
     43        }
    4444
    45         $url      = 'admin.php?page=';
    46         $settings = Options::get_site_settings();
    47         if ( ! isset( $settings['alertwise_setting_password'] ) || empty( $settings['alertwise_setting_password'] ) ) {
    48             $url .= 'settings.php';
    49         }
     45        // Nonce verification for redirect (recommended)
     46        if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'alertwise_plugin_redirect' ) ) {
     47            return;
     48        }
    5049
    51         wp_safe_redirect( admin_url( $url ) );
    52         exit;
    53     }
     50        $url      = 'admin.php?page=';
     51        $settings = Options::get_site_settings();
     52        if ( ! isset( $settings['alertwise_setting_password'] ) || empty( $settings['alertwise_setting_password'] ) ) {
     53            $url .= 'settings.php';
     54        }
    5455
    55     /**
    56      * Remove all admin notices in alertwise plugin page
    57      *
    58      * @since 4.0.0
    59      *
    60      * @return void
    61      */
    62     public function alertwise_hide_admin_notices() {
    63         $screen = get_current_screen();
    64         if ( 'toplevel_page_alertwise' === $screen->base ) {
    65             echo '<style>.update-nag, .updated, .error, .notice, .is-dismissible { display: none !important; }</style>';
    66         }
    67     }
     56        wp_safe_redirect( admin_url( $url ) );
     57        exit;
     58    }
    6859
    69     /**
    70      * Display admin notices if site not connected
    71      *
    72      * @since 4.0.0
    73      *
    74      * @return void
    75      */
    76     public function alertwise_display_admin_notices() {
    77         $screen = get_current_screen();
    78         // Added filter for site connection notice allowed screens.
    79         $allowed_screens = apply_filters(
    80             'palertwise_connection_notice_allowed_screens',
    81             array(
    82                 'dashboard',
    83                 'plugins',
    84             )
    85         );
    86         // Do not display admin notice on AlertWise Plugin page as we hide
    87         // the admin notice inside AlertWise Plugin
    88         if ( 'toplevel_page_alertwise' === $screen->base || ! in_array( $screen->id, $allowed_screens, true ) ) {
    89             return;
    90         }
     60    /**
     61     * Remove all admin notices in alertwise plugin page
     62     *
     63     * @since 4.0.0
     64     *
     65     * @return void
     66     */
     67    public function alertwise_hide_admin_notices() {
     68        $screen = get_current_screen();
     69        if ( 'toplevel_page_alertwise' === $screen->base ) {
     70            echo '<style>.update-nag, .updated, .error, .notice, .is-dismissible { display: none !important; }</style>';
     71        }
     72    }
    9173
    92         $settings = Options::get_site_settings();
    93         $api_key  = ArrayHelper::get( $settings, 'alertwise_setting_password', null );
     74    /**
     75     * Display admin notices if site not connected
     76     *
     77     * @since 4.0.0
     78     *
     79     * @return void
     80     */
     81    public function alertwise_display_admin_notices() {
     82        $screen = get_current_screen();
     83        // Added filter for site connection notice allowed screens.
     84        $allowed_screens = apply_filters(
     85            'alertwise_connection_notice_allowed_screens',
     86            array(
     87                'dashboard',
     88                'plugins',
     89            )
     90        );
     91        // Do not display admin notice on AlertWise Plugin page as we hide
     92        // the admin notice inside AlertWise Plugin
     93        if ( 'toplevel_page_alertwise' === $screen->base || ! in_array( $screen->id, $allowed_screens, true ) ) {
     94            return;
     95        }
    9496
    95         if ( ! $api_key ) {
    96             Alertwise::output_view( 'site-not-connected.php' );
    97         }
    98     }
     97        $settings = Options::get_site_settings();
     98        $api_key  = ArrayHelper::get( $settings, 'alertwise_setting_password', null );
     99
     100        if ( ! $api_key ) {
     101            Alertwise::output_view( 'site-not-connected.php' );
     102        }
     103    }
    99104}
  • alertwise/trunk/app/Includes/handlers/SettingsHandler.php

    r3315384 r3321920  
    2525        }
    2626
    27         $username = sanitize_text_field($_POST['pe_username']);
    28         $api_key = sanitize_text_field($_POST['pe_api_key']);
     27        $username = isset($_POST['pe_username']) ? sanitize_text_field(wp_unslash($_POST['pe_username'])) : '';
     28        $api_key = isset($_POST['pe_api_key']) ? sanitize_text_field(wp_unslash($_POST['pe_api_key'])) : '';
    2929
    3030        $params = [
     
    8383                    $settings['alertwise_setting_language'] = $current_app['language'];
    8484                    $settings['alertwise_setting_icon_url'] = $current_app['iconUrl'];
    85                     $settings['alertwise_setting_icon_url'] = $current_app['iconUrl'];
    8685                    $settings['alertwise_setting_badge_icon_url'] = $current_app['badgeIconUrl'];
    87                     $settings['alertwise_setting_created_at'] = date('Y-m-d H:i:s');
     86                    $settings['alertwise_setting_created_at'] = gmdate('Y-m-d H:i:s');
    8887                } else {
    8988                    AdminNotice::add_notice('No matching app found for this domain.', 'error');
     
    106105
    107106        // Redirect back to the settings page
    108         wp_redirect(admin_url('admin.php?page=settings.php&updated=true'));
     107        wp_redirect(esc_url_raw(admin_url('admin.php?page=settings.php&updated=true')));
    109108        exit;
    110109    }
  • alertwise/trunk/app/Installer.php

    r3315384 r3321920  
    22namespace Alertwise;
    33
    4 //use Alertwise\Upgrade;
    54use Alertwise\Utils\Options;
    65
    76// Exit if accessed directly.
    87if ( ! defined( 'ABSPATH' ) ) {
    9     exit;
     8    exit;
    109}
    1110
    1211class Installer {
    13     /**
    14     * Trigger immediately after installing plugin
    15     *
    16     * @since 4.0.0
    17     *
    18     * @return void
    19     */
    20     public static function plugin_install() {
    21         $alertwise_settings = Options::get_site_settings();
     12    /**
     13    * Trigger immediately after installing plugin
     14    *
     15    * @since 4.0.0
     16    *
     17    * @return void
     18    */
     19    public static function plugin_install() {
     20        $alertwise_settings = Options::get_site_settings();
    2221
    23         if ( empty( $alertwise_settings ) ) {
    24             $alertwise_settings = array(
    25                 'alertwise_setting_access_token'                        => '',
    26                 'alertwise_setting_expires_in'                          => '',
    27                 'alertwise_setting_token_type'                          => '',
    28                 'alertwise_setting_username'                            => '',
    29                 'version'                                               => ALERTWISE_VERSION,
    30                 'alertwise_setting_password'                            => '',
    31                 'alertwise_setting_owner_id'                            => '',
    32                 'alertwise_setting_app_id'                              => '',
    33                 'alertwise_setting_app_url'                             => '',
     22        if ( empty( $alertwise_settings ) ) {
     23            $alertwise_settings = array(
     24                'alertwise_setting_access_token'                        => '',
     25                'alertwise_setting_expires_in'                          => '',
     26                'alertwise_setting_token_type'                          => '',
     27                'alertwise_setting_username'                            => '',
     28                'version'                                               => ALERTWISE_VERSION,
     29                'alertwise_setting_password'                            => '',
     30                'alertwise_setting_owner_id'                            => '',
     31                'alertwise_setting_app_id'                              => '',
     32                'alertwise_setting_app_url'                             => '',
    3433                'alertwise_setting_app_name'                            => '',
    3534                'alertwise_setting_app_server_public_key'               => '',
     
    3837                'alertwise_setting_badge_icon_url'                      => '',
    3938                'alertwise_setting_created_at'                          => '',
    40                 'misc' => array(
    41                     'hideAdminBarMenu'                                  => false,
    42                     'hideDashboardWidget'                               => false,
    43                 ),
    44             );
     39                'misc' => array(
     40                    'hideAdminBarMenu'                                  => false,
     41                    'hideDashboardWidget'                               => false,
     42                ),
     43            );
    4544
    46             add_option( 'alertwise_settings', $alertwise_settings );
    47         }
     45            add_option( 'alertwise_settings', $alertwise_settings );
     46        }
    4847
    49         if ( empty( $alertwise_post_page_settings ) ) {
    50             $alertwise_post_page_settings = array(
    51                 'post_notifications'                                    => true,
    52                 'page_notifications'                                    => true,
    53                 'created_at'                                            => date('Y-m-d H:i:s'),
    54             );
     48        if ( empty( $alertwise_post_page_settings ) ) {
     49            $alertwise_post_page_settings = array(
     50                'post_notifications'                                    => true,
     51                'page_notifications'                                    => true,
     52                'created_at'                                            => gmdate('Y-m-d H:i:s'),
     53            );
    5554
    56             add_option( 'alertwise_post_page_settings', $alertwise_post_page_settings );
    57         }
    58     }
     55            add_option( 'alertwise_post_page_settings', $alertwise_post_page_settings );
     56        }
     57    }
    5958}
  • alertwise/trunk/app/SendManager.php

    r3315384 r3321920  
    2323
    2424        // Always add the "site not connected" metabox action
    25         // It will only show if credentials are missing.
    2625        add_action('add_meta_boxes', array($this, 'add_alertwise_site_not_connected_metabox'));
    2726
    28 
    2927        if (
    30             ! empty($alertwise_settings['alertwise_setting_username'])
    31             && ! empty($alertwise_settings['alertwise_setting_password'])
     28            !empty($alertwise_settings['alertwise_setting_username'])
     29            && !empty($alertwise_settings['alertwise_setting_password'])
    3230        ) {
    3331            add_action('add_meta_boxes', [$this, 'add_notification_metabox']);
     
    6967        $already_sent = get_post_meta($post->ID, '_alertwise_sent', true);
    7068
    71         // Prepare data for view
    7269        $data = [
    7370            'post' => $post,
     
    7875        ];
    7976
    80         // Use the view loader
    8177        Alertwise::output_view('post-editor-metabox.php', $data);
    8278    }
     
    9389        }
    9490
    95         // Only validate nonce if it's a real form submission (to avoid failing on cron or API saves)
    9691        if (isset($_POST['alertwise_meta_box_nonce'])) {
    9792            if (!wp_verify_nonce($_POST['alertwise_meta_box_nonce'], 'alertwise_meta_box')) {
     
    105100
    106101            if (isset($_POST['alertwise_custom_title'])) {
    107                 update_post_meta($post_id, '_alertwise_custom_title', sanitize_text_field($_POST['alertwise_custom_title']));
     102                update_post_meta(
     103                    $post_id,
     104                    '_alertwise_custom_title',
     105                    sanitize_text_field(wp_unslash($_POST['alertwise_custom_title']))
     106                );
    108107                error_log("[Alertwise] Saved custom title for post ID: $post_id");
    109108            }
    110109            if (isset($_POST['alertwise_custom_msg'])) {
    111                 update_post_meta($post_id, '_alertwise_custom_msg', sanitize_textarea_field($_POST['alertwise_custom_msg']));
     110                update_post_meta(
     111                    $post_id,
     112                    '_alertwise_custom_msg',
     113                    sanitize_textarea_field(wp_unslash($_POST['alertwise_custom_msg']))
     114                );
    112115                error_log("[Alertwise] Saved custom message for post ID: $post_id");
    113116            }
    114117
    115             // --- NEW: Handle scheduling of resend if post is scheduled ---
    116118            $force_resend = isset($_POST['alertwise_force_resend']) && $_POST['alertwise_force_resend'] === '1';
    117119            $post = get_post($post_id);
     
    119121            if ($force_resend) {
    120122                if ($post && $post->post_status === 'future') {
    121                     // Mark to resend on next publish
    122123                    update_post_meta($post_id, '_alertwise_resend_on_future_publish', '1');
    123124                    error_log("[Alertwise] Will resend notification on future publish for post ID: $post_id");
    124125                } else {
    125                     // If not scheduled, send now
    126126                    $this->auto_send_notification($post_id, $post, true);
    127127                }
    128128            } else {
    129                 // If user did not check force_resend, clear the meta
    130129                delete_post_meta($post_id, '_alertwise_resend_on_future_publish');
    131130            }
    132131        } else {
    133             // Not a UI update (e.g. cron), so handle scheduled-resend logic
    134132            $post = get_post($post_id);
    135133            $resend_on_future_publish = get_post_meta($post_id, '_alertwise_resend_on_future_publish', true);
    136134
    137             // If we're being published (by cron) and resend is requested, do it
    138135            if ($post && $post->post_status === 'publish' && $resend_on_future_publish === '1') {
    139136                error_log("[Alertwise] Scheduled resend on publish for post ID: $post_id");
     
    143140        }
    144141
    145         // --- Normal auto-send logic if not already sent and not force-resend ---
    146142        $post = get_post($post_id);
    147143        if (!$post) {
     
    159155    }
    160156
    161     public function auto_send_notification($post_id, $post = null, $force_resend = false)
     157    public function auto_send_notification($post_id, $post = null, $force_resend = false): void
    162158    {
    163159        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
     
    180176        }
    181177
    182         // Optionally, clear sent meta if force_resend
    183178        if ($force_resend) {
    184179            update_post_meta($post_id, '_alertwise_sent', false);
     
    193188
    194189        if (empty($message)) {
    195             $message = wp_trim_words(strip_tags($post->post_content), 20);
     190            $message = wp_trim_words(wp_strip_all_tags($post->post_content), 20);
    196191        }
    197192
     
    238233        ];
    239234
    240         // Get a valid (non-expired) token
    241235        $token = TokenManager::get_token();
    242236        if ($token) {
     
    246240            );
    247241        } else {
    248 
    249             // Remove the credentials keys if they are not empty
    250242            if (
    251243                !empty($alertwise_settings['alertwise_setting_username']) &&
     
    259251    }
    260252
    261 
    262     /**
    263      * Add Meta box when AlertWise site is not connected.
    264      */
    265253    public function add_alertwise_site_not_connected_metabox()
    266254    {
  • alertwise/trunk/app/ServiceWorker.php

    r3315384 r3321920  
    4242        // Only output the script if both values are present.
    4343        if (!empty($app_id) && !empty($public_key)) {
    44 ?>
     44            ?>
    4545            <script
    46                 src="<?php echo ALERTWISE_CDN_URL ?><?php echo esc_js($app_id); ?>/integrate/alert-wise.js"></script>
     46                    src="<?php echo esc_url(ALERTWISE_CDN_URL . $app_id . '/integrate/alert-wise.js'); ?>"></script>
    4747            <script type="text/javascript">
    4848                alertwise = window.alertwise || [];
     
    5050                    appId: "<?php echo esc_js($app_id); ?>",
    5151                    applicationServerPublicKey: "<?php echo esc_js($public_key); ?>",
    52                     scope: "<?php echo ALERTWISE_PLUGIN_URL ?>",
    53                     alertwiseApiUrl: "<?php echo ALERTWISE_WITHOUT_SLASH_URL ?>",
    54                     serviceWorkerUrl: "<?php echo ALERTWISE_SERVICE_WORKER_URL ?>"
     52                    scope: "<?php echo esc_js(ALERTWISE_PLUGIN_URL); ?>",
     53                    alertwiseApiUrl: "<?php echo esc_js(ALERTWISE_WITHOUT_SLASH_URL); ?>",
     54                    serviceWorkerUrl: "<?php echo esc_js(ALERTWISE_SERVICE_WORKER_URL); ?>"
    5555                }]);
    5656            </script>
    57 <?php
     57            <?php
    5858        } else {
    5959            error_log('app id not found in service worker intialization');
  • alertwise/trunk/app/Utils/Helpers.php

    r3315384 r3321920  
    77// Exit if accessed directly.
    88if (! defined('ABSPATH')) {
    9     exit;
     9    exit;
    1010}
    1111
    1212class Helpers
    1313{
    14     /**
    15      * Returns Jed-formatted localization data. Added for backwards-compatibility.
    16      *
    17      * @since 4.0.0
    18      *
    19      * @param  string $domain Translation domain.
    20      * @return array          The information of the locale.
    21      */
    22     public static function get_jed_locale_data($domain)
    23     {
    24         $translations = get_translations_for_domain($domain);
    25         $translations2 = get_translations_for_domain('default');
    26 
    27         $locale = array(
    28             '' => array(
    29                 'domain' => $domain,
    30                 'lang'   => is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(),
    31             ),
    32         );
    33 
    34         if (! empty($translations->headers['Plural-Forms'])) {
    35             $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
    36         }
    37 
    38         foreach ($translations->entries as $msgid => $entry) {
    39             $locale[$msgid] = $entry->translations;
    40         }
    41 
    42         // If any of the translated strings incorrectly contains HTML line breaks, we need to return or else the admin is no longer accessible.
    43         $json = wp_json_encode($locale);
    44         if (preg_match('/<br[\s\/\\\\]*>/', $json)) {
    45             return array();
    46         }
    47 
    48         return $locale;
    49     }
    50 
    51     /**
    52      * Checks if a plugin is active
    53      *
    54      * @since 4.0.0
    55      *
    56      * @param  string  $basename The plugin basename.
    57      * @return boolean Whether or not the plugin is active.
    58      */
    59     public static function is_plugin_active($basename)
    60     {
    61         $active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
    62         return in_array($basename, $active_plugins);
    63     }
    64 
    65     /**
    66      * Get the active caching plugin details
    67      *
    68      * @since 4.0.0
    69      *
    70      * @return array|null   The active active caching plugin details returns null if no caching is active
    71      */
    72     public static function get_active_caching_plugin()
    73     {
    74         // Array of popular caching plugin slugs
    75         $caching_plugins = array(
    76             array(
    77                 'title' => 'WP Rocket',
    78                 'basename' => 'wp-rocket/wp-rocket.php',
    79             ),
    80             array(
    81                 'title' => 'W3 Super Cache',
    82                 'basename' => 'wp-super-cache/wp-cache.php',
    83             ),
    84             array(
    85                 'title' => 'W3 Total Cache',
    86                 'basename' => 'w3-total-cache/w3-total-cache.php',
    87             ),
    88             array(
    89                 'title' => 'Comet Cache',
    90                 'basename' => 'comet-cache/comet-cache.php',
    91             ),
    92             array(
    93                 'title' => 'WP fastest Cache',
    94                 'basename' => 'wp-fastest-cache/wpFastestCache.php',
    95             ),
    96             array(
    97                 'title' => 'Cache Enabler',
    98                 'basename' => 'cache-enabler/cache-enabler.php',
    99             ),
    100             array(
    101                 'title' => 'Hyper Cache',
    102                 'basename' => 'hyper-cache/plugin.php',
    103             ),
    104             array(
    105                 'title' => 'SiteGround Optimizer',
    106                 'basename' => 'sg-cachepress/sg-cachepress.php',
    107             ),
    108         );
    109 
    110         // Loop through each plugin and check if it's active
    111         $active_caching_plugin = null;
    112         foreach ($caching_plugins as $plugin) {
    113             if (self::is_plugin_active($plugin['basename'])) {
    114                 $active_caching_plugin = $plugin;
    115                 break;
    116             }
    117         }
    118         return $active_caching_plugin;
    119     }
    120 
    121     /**
    122      * Checks if the website is using SSl or not.
    123      *
    124      * @since 4.0.4.1
    125      *
    126      * @return boolean
    127      */
    128     public static function is_ssl()
    129     {
    130         // cloudflare
    131         if (! empty($_SERVER['HTTP_CF_VISITOR'])) {
    132             $cfo = json_decode($_SERVER['HTTP_CF_VISITOR']);
    133             if (isset($cfo->scheme) && 'https' === $cfo->scheme) {
    134                 return true;
    135             }
    136         }
    137 
    138         // other proxy
    139         if (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO']) {
    140             return true;
    141         }
    142 
    143         return function_exists('is_ssl') ? is_ssl() : false;
    144     }
    145 
    146     /**
    147      * Returns whether the block editor is loading on the current screen.
    148      *
    149      * @since 4.0.5.1
    150      *
    151      * @return boolean|null True if the block editor is being loaded, false if
    152      *                      not loading and null if can not determine.
    153      */
    154     public static function is_block_editor()
    155     {
    156         $curr_screen = get_current_screen();
    157         if (! empty($curr_screen) && method_exists($curr_screen, 'is_block_editor')) {
    158             return $curr_screen->is_block_editor();
    159         }
    160         return null;
    161     }
    162 
    163     /**
    164      * Determines if given URL is a valid HTTP or HTTPS URLs and length is
    165      * less than or equal to max_len.
    166      *
    167      * @since 4.0.5.1
    168      *
    169      * @param string $url URL to check.
    170      * @param number $max_len Maximum allowed length of the URL.
    171      *
    172      * @return bool false on failure.
    173      */
    174     public static function is_http_or_https_url($url, $max_len = 0)
    175     {
    176         if (empty($url)) {
    177             return false;
    178         }
    179 
    180         if ('http' === substr($url, 0, 4) || 'https' === substr($url, 0, 5)) {
    181             if ($max_len && strlen($url) > $max_len) {
    182                 return false;
    183             }
    184             return true;
    185         }
    186 
    187         return false;
    188     }
    189 
    190 
    191 
    192     /**
    193      * Decodes JSON string as associative array.
    194      *
    195      * @param string $data
    196      * @return mixed|null
    197      */
    198     public static function json_decode($data)
    199     {
    200         $flag = 0;
    201         if (defined('JSON_INVALID_UTF8_IGNORE')) {
    202             $flag = JSON_INVALID_UTF8_IGNORE | $flag;
    203         }
    204         return json_decode($data, true, 512, $flag);
    205     }
    206 
    207     /**
    208      * Convert HTML entities to their corresponding characters
    209      *
    210      * @since 4.0.6
    211      * @param string The input string
    212      * @return string The decoded string
    213      */
    214     public static function decode_entities($string)
    215     {
    216         $flag = ENT_QUOTES;
    217         if (defined('ENT_HTML401')) {
    218             $flag = ENT_HTML401 | $flag;
    219         }
    220         return html_entity_decode(str_replace(array('&apos;', '&#x27;', '&#39;', '&quot;'), '\'', $string), $flag, 'UTF-8');
    221     }
    222 
    223 
    224     /**
    225      * Get image from post
    226      *
    227      * @since 4.0.8
    228      *
    229      * @param string|int[] $size
    230      * @param number $post_id
    231      *
    232      * @return string
    233      */
    234     public static function get_post_image($size, $post_id)
    235     {
    236         $image_url = '';
    237 
    238         if (has_post_thumbnail($post_id)) {
    239             $raw_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
    240             if (! empty($raw_image)) {
    241                 $image_url = ! empty($raw_image[0]) ? $raw_image[0] : '';
    242             }
    243         }
    244 
    245         return $image_url;
    246     }
    247 
    248     /**
    249      * Decode a JWT token and return the payload as an array.
    250      *
    251      * @param string $jwt The JWT token
    252      * @return array|null Returns the payload as array or null on error
    253      */
    254     public static function decode($jwt)
    255     {
    256         if (!is_string($jwt) || empty($jwt)) {
    257             return null;
    258         }
    259 
    260         $parts = explode('.', $jwt);
    261         if (count($parts) !== 3) {
    262             return null;
    263         }
    264 
    265         list($header, $payload, $signature) = $parts;
    266 
    267         // Decode payload (base64url)
    268         $payload = self::base64url_decode($payload);
    269 
    270         if ($payload === false) {
    271             return null;
    272         }
    273 
    274         $data = json_decode($payload, true);
    275 
    276         return is_array($data) ? $data : null;
    277     }
    278 
    279     /**
    280      * Base64 URL decode.
    281      *
    282      * @param string $input
    283      * @return string|false
    284      */
    285     private static function base64url_decode($input)
    286     {
    287         $remainder = strlen($input) % 4;
    288         if ($remainder) {
    289             $padlen = 4 - $remainder;
    290             $input .= str_repeat('=', $padlen);
    291         }
    292         $input = strtr($input, '-_', '+/');
    293         return base64_decode($input);
    294     }
    295 
    296     /**
    297      * Get the current app based on the domain from a list of apps.
    298      *
    299      * @param array $apps List of apps from API response.
    300      * @return array|null The app matching the current domain, or null if not found.
    301      */
    302     public static function get_current_app_from_apps($apps)
    303     {
    304         $current_url = home_url();
    305         $current_domain = parse_url($current_url, PHP_URL_HOST);
     14    /**
     15     * Returns Jed-formatted localization data. Added for backwards-compatibility.
     16     *
     17     * @since 4.0.0
     18     *
     19     * @param  string $domain Translation domain.
     20     * @return array          The information of the locale.
     21     */
     22    public static function get_jed_locale_data($domain)
     23    {
     24        $translations = get_translations_for_domain($domain);
     25        $translations2 = get_translations_for_domain('default');
     26
     27        $locale = array(
     28            '' => array(
     29                'domain' => $domain,
     30                'lang'   => is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(),
     31            ),
     32        );
     33
     34        if (! empty($translations->headers['Plural-Forms'])) {
     35            $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
     36        }
     37
     38        foreach ($translations->entries as $msgid => $entry) {
     39            $locale[$msgid] = $entry->translations;
     40        }
     41
     42        // If any of the translated strings incorrectly contains HTML line breaks, we need to return or else the admin is no longer accessible.
     43        $json = wp_json_encode($locale);
     44        if (preg_match('/<br[\s\/\\\\]*>/', $json)) {
     45            return array();
     46        }
     47
     48        return $locale;
     49    }
     50
     51    public static function is_plugin_active($basename)
     52    {
     53        $active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
     54        return in_array($basename, $active_plugins);
     55    }
     56
     57    public static function get_active_caching_plugin()
     58    {
     59        $caching_plugins = array(
     60            array(
     61                'title' => 'WP Rocket',
     62                'basename' => 'wp-rocket/wp-rocket.php',
     63            ),
     64            array(
     65                'title' => 'W3 Super Cache',
     66                'basename' => 'wp-super-cache/wp-cache.php',
     67            ),
     68            array(
     69                'title' => 'W3 Total Cache',
     70                'basename' => 'w3-total-cache/w3-total-cache.php',
     71            ),
     72            array(
     73                'title' => 'Comet Cache',
     74                'basename' => 'comet-cache/comet-cache.php',
     75            ),
     76            array(
     77                'title' => 'WP fastest Cache',
     78                'basename' => 'wp-fastest-cache/wpFastestCache.php',
     79            ),
     80            array(
     81                'title' => 'Cache Enabler',
     82                'basename' => 'cache-enabler/cache-enabler.php',
     83            ),
     84            array(
     85                'title' => 'Hyper Cache',
     86                'basename' => 'hyper-cache/plugin.php',
     87            ),
     88            array(
     89                'title' => 'SiteGround Optimizer',
     90                'basename' => 'sg-cachepress/sg-cachepress.php',
     91            ),
     92        );
     93
     94        $active_caching_plugin = null;
     95        foreach ($caching_plugins as $plugin) {
     96            if (self::is_plugin_active($plugin['basename'])) {
     97                $active_caching_plugin = $plugin;
     98                break;
     99            }
     100        }
     101        return $active_caching_plugin;
     102    }
     103
     104    public static function is_ssl()
     105    {
     106        if (! empty($_SERVER['HTTP_CF_VISITOR'])) {
     107            $cfo = json_decode($_SERVER['HTTP_CF_VISITOR']);
     108            if (isset($cfo->scheme) && 'https' === $cfo->scheme) {
     109                return true;
     110            }
     111        }
     112
     113        if (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO']) {
     114            return true;
     115        }
     116
     117        return function_exists('is_ssl') ? is_ssl() : false;
     118    }
     119
     120    public static function is_block_editor()
     121    {
     122        $curr_screen = get_current_screen();
     123        if (! empty($curr_screen) && method_exists($curr_screen, 'is_block_editor')) {
     124            return $curr_screen->is_block_editor();
     125        }
     126        return null;
     127    }
     128
     129    public static function is_http_or_https_url($url, $max_len = 0)
     130    {
     131        if (empty($url)) {
     132            return false;
     133        }
     134
     135        if ('http' === substr($url, 0, 4) || 'https' === substr($url, 0, 5)) {
     136            if ($max_len && strlen($url) > $max_len) {
     137                return false;
     138            }
     139            return true;
     140        }
     141
     142        return false;
     143    }
     144
     145    public static function json_decode($data)
     146    {
     147        $flag = 0;
     148        if (defined('JSON_INVALID_UTF8_IGNORE')) {
     149            $flag = JSON_INVALID_UTF8_IGNORE | $flag;
     150        }
     151        return json_decode($data, true, 512, $flag);
     152    }
     153
     154    public static function decode_entities($string)
     155    {
     156        $flag = ENT_QUOTES;
     157        if (defined('ENT_HTML401')) {
     158            $flag = ENT_HTML401 | $flag;
     159        }
     160        return html_entity_decode(str_replace(array('&apos;', '&#x27;', '&#39;', '&quot;'), '\'', $string), $flag, 'UTF-8');
     161    }
     162
     163    public static function get_post_image($size, $post_id)
     164    {
     165        $image_url = '';
     166
     167        if (has_post_thumbnail($post_id)) {
     168            $raw_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
     169            if (! empty($raw_image)) {
     170                $image_url = ! empty($raw_image[0]) ? $raw_image[0] : '';
     171            }
     172        }
     173
     174        return $image_url;
     175    }
     176
     177    public static function decode($jwt)
     178    {
     179        if (!is_string($jwt) || empty($jwt)) {
     180            return null;
     181        }
     182
     183        $parts = explode('.', $jwt);
     184        if (count($parts) !== 3) {
     185            return null;
     186        }
     187
     188        list($header, $payload, $signature) = $parts;
     189
     190        $payload = self::base64url_decode($payload);
     191
     192        if ($payload === false) {
     193            return null;
     194        }
     195
     196        $data = json_decode($payload, true);
     197
     198        return is_array($data) ? $data : null;
     199    }
     200
     201    private static function base64url_decode($input)
     202    {
     203        $remainder = strlen($input) % 4;
     204        if ($remainder) {
     205            $padlen = 4 - $remainder;
     206            $input .= str_repeat('=', $padlen);
     207        }
     208        $input = strtr($input, '-_', '+/');
     209        return base64_decode($input);
     210    }
     211
     212    public static function get_current_app_from_apps($apps)
     213    {
     214        $current_url = home_url();
     215        $current_domain = wp_parse_url($current_url, PHP_URL_HOST);
    306216
    307217        foreach ($apps as $app) {
    308218            if (!empty($app['appUrl'])) {
    309                 $app_domain = parse_url($app['appUrl'], PHP_URL_HOST);
     219                $app_domain = wp_parse_url($app['appUrl'], PHP_URL_HOST);
    310220                if ($app_domain === $current_domain) {
    311221                    return $app;
     
    316226    }
    317227
    318     public static function render_header(){
    319         Alertwise::output_view('header.php');
    320     }
    321 
    322     public static function alertwise_render_not_connected_notice(){
    323         Alertwise::output_view('site-not-connected.php');
    324     }
     228    public static function render_header(){
     229        Alertwise::output_view('header.php');
     230    }
     231
     232    public static function alertwise_render_not_connected_notice(){
     233        Alertwise::output_view('site-not-connected.php');
     234    }
    325235}
  • alertwise/trunk/app/Utils/TokenManager.php

    r3315384 r3321920  
    5959            $settings['alertwise_setting_token_type']       = $response['token_type'] ?? 'Bearer';
    6060            $settings['alertwise_setting_expires_in']       = $response['expires_in'] ?? 3600;
    61             $settings['alertwise_setting_created_at']       = date('Y-m-d H:i:s');
     61            $settings['alertwise_setting_created_at']       = gmdate('Y-m-d H:i:s');
    6262            $settings['alertwise_setting_owner_id']         = (Helpers::decode($response['access_token'])['id'] ?? '');
    6363
  • alertwise/trunk/main.php

    r3315384 r3321920  
    88 * Author URI: https://www.wordpress.org/alertwise
    99 *
    10  * Version: 1.0
     10 * Version: 1.0.0
    1111 * Requires at least: 4.5.0
    1212 * Requires PHP: 5.6
  • alertwise/trunk/readme.txt

    r3318479 r3321920  
    1 === AlertWise: The Best Mobile & Web Push Notification Service ===
     1=== AlertWise: Mobile & Web Push Notification Service ===
    22Contributors: alertwise
    33Tags: push notifications, web push notifications, desktop notifications, web push, marketing automation
     
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Send smart, targeted push notifications that drive 10x more repeat traffic and skyrocket conversions. Turn visitors into loyal customers with automated, high-converting campaigns.
     11[AlertWise](https://alertwise.net) is a powerful push notification plugin; that helps you engage users in real time.
    1212
    1313== Description ==
    1414
    15 ===  ===
    16 
    17 [AlertWise](https://alertwise.net) is a powerful push notification plugin; that helps you engage users in real time.
    18 
    19 [AlertWise](https://alertwise.net) is a powerful push notification service that helps you grow your website traffic, boost conversions, and re-engage visitors — all without needing an app. Designed for bloggers, affiliate marketers, eCommerce sellers, and businesses of all sizes, AlertWise offers unlimited campaigns, unlimited websites, advanced segmentation, and real-time delivery on both desktop and mobile.
     15AlertWise is a powerful push notification service that helps you grow your website traffic, boost conversions, and re-engage visitors — all without needing an app. Designed for bloggers, affiliate marketers, eCommerce sellers, and businesses of all sizes, AlertWise offers unlimited campaigns, unlimited websites, advanced segmentation, and real-time delivery on both desktop and mobile.
    2016
    2117With features like automated drip campaigns, offline notifications, geolocation targeting, customizable prompts, and advanced analytics, AlertWise is your complete marketing automation toolkit — right from your WordPress dashboard.
     
    3935
    4036#### 👥 Unlimited Audience Groups
    41 From free to premium, you can create **unlimited audience groups** to deliver more relevant and personalized push notifications.
    42 
    43 #### ⚡ Fastest Push Notification Delivery
    44 AlertWise uses **Amazon AWS cloud infrastructure** for **ultra-fast, reliable delivery** across the globe. No delays, no failures — just instant engagement.
     37you can create **unlimited audience groups** to deliver more relevant and personalized push notifications.
     38
     39#### ⚡ High-Speed Notification Delivery
     40AlertWise is built on **Amazon AWS cloud infrastructure** to ensure fast and reliable delivery of your push notifications across the globe.
    4541
    4642#### 🔔 Offline Notification Support
     
    5652- **Geolocation Targeting** – Reach users based on country, region, or city for geo-personalized offers.
    5753- **Action-Based Grouping** – Group users by subscription date, last sent date, or last click date to personalize your messaging lifecycle.
    58 - **Advanced Filters** – Use **unlimited AND/OR conditions** to create complex targeting logic that’s easy to manage.
     54- **Advanced Filters** – Use **unlimited AND/OR conditions** to create complex targeting logic that’s straightforward to manage.
    5955
    6056---
     
    198194
    199195= Is the AlertWise plugin free to use? =
    200 Yes! The plugin is free and works with both free and premium plans from AlertWise. You can use it to add unlimited websites, send unlimited campaigns, and access most features even without upgrading.
     196Yes! The plugin is free to download and use. It connects your site to your AlertWise account. The alertWise service offers a generous free plan that includes unlimited websites and campaigns, with additional features available in other plans.
    201197
    202198= How do I install the plugin? =
     
    238234== Screenshots ==
    239235
    240 1. Real-time analytics dashboard with campaign and subscriber stats
    241 2. Create personalized campaigns using advanced segmentation
    242 3. Customizable popup modal for collecting subscribers
    243 4. Push notifications with CTA buttons for higher engagement
    244 5. Notification previews on desktop and mobile browsers
    245 6. Audience grouping by behavior, device, and location
     2361. The real-time analytics dashboard showing campaign and subscriber statistics.
     2372. The campaign creation screen with advanced segmentation options.
     2383. An example of a customizable popup modal for collecting subscribers.
     2394. A push notification with CTA buttons designed for higher engagement.
     2405. Previews of how notifications appear on desktop and mobile browsers.
     2416. The audience grouping interface, allowing segmentation by behavior, device, and location.
    2462427. Subscriber details with browser, device, and activity data
    2472438. 24/7 live support access from the plugin dashboard
  • alertwise/trunk/vendor/autoload.php

    r3315384 r3321920  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • alertwise/trunk/vendor/composer/InstalledVersions.php

    r3315384 r3321920  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • alertwise/trunk/vendor/composer/installed.php

    r3315384 r3321920  
    11<?php return array(
    22    'root' => array(
    3         'name' => 'shail/alertwise',
    4         'pretty_version' => '1.0.0+no-version-set',
    5         'version' => '1.0.0.0',
    6         'reference' => null,
     3        'name' => 'alertwise/alertwise',
     4        'pretty_version' => 'dev-develop',
     5        'version' => 'dev-develop',
     6        'reference' => '625138d10e8eb52eb6c7616281d8d04df9fb013e',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1111    ),
    1212    'versions' => array(
    13         'shail/alertwise' => array(
    14             'pretty_version' => '1.0.0+no-version-set',
    15             'version' => '1.0.0.0',
    16             'reference' => null,
     13        'alertwise/alertwise' => array(
     14            'pretty_version' => 'dev-develop',
     15            'version' => 'dev-develop',
     16            'reference' => '625138d10e8eb52eb6c7616281d8d04df9fb013e',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • alertwise/trunk/views/about-us.php

    r3317167 r3321920  
    1313<div class="alertwise-about-container">
    1414    <img src="https://cdn.alertwise.net/alertwise/img/alertwise-logo.svg" alt="Alertwise" class="aboutwise-logo">
    15     <span><?php esc_html_e( 'V.'.ALERTWISE_VERSION, 'alertwise' ); ?></span>
     15    <span><?php esc_html_e( 'V.', 'alertwise' ); ?><?php echo esc_html( ALERTWISE_VERSION ); ?></span>
    1616    <p>
    1717        <strong>Alertwise</strong> is a push notification service that helps you take your business to the next level and keep your customers engaged. Whether you're a blogger, affiliate marketer, or digital product seller, Alertwise empowers you to grow your audience and connect with new customers. Enjoy real-time engagement, advanced segmentation, and a suite of robust features to enhance your website’s profitability.
     
    2626        <table>
    2727            <thead>
    28                 <tr>
    29                     <th>Features</th>
    30                     <th>Alertwise All Plans</th>
    31                     <th>Other Providers</th>
    32                 </tr>
     28            <tr>
     29                <th>Features</th>
     30                <th>Alertwise All Plans</th>
     31                <th>Other Providers</th>
     32            </tr>
    3333            </thead>
    3434            <tbody>
    35                 <tr><td>Number Of Sites/Apps</td><td >✔️ Unlimited</td><td >❌ Not included unless you pay more</td></tr>
    36                 <tr><td>Campaigns</td><td >✔️ Unlimited</td><td >❌ Limited in basic plans</td></tr>
    37                 <tr><td>Segmentation</td><td >✔️ Unlimited</td><td >❌ Limited in basic plans</td></tr>
    38                 <tr><td>Audience Group</td><td >✔️ Unlimited</td><td >❌ Excluded from free/entry plans</td></tr>
    39                 <tr><td>Advanced Analytics</td><td >✔️ Available</td><td >❌ Limited in basic plans</td></tr>
    40                 <tr><td>WordPress Plugin</td><td >✔️ Available</td><td >❌ Not in all plans</td></tr>
    41                 <tr><td>Customer Support</td><td >✔️ 24x7 Available</td><td >❌ Requires upgrade</td></tr>
    42                 <tr><td>Web SDK</td><td >✔️ Available</td><td >❌ Not in free/basic plans</td></tr>
    43                 <tr><td>Notification Data Exports (CSV)</td><td >✔️ Available</td><td >❌ Not in free/basic plans</td></tr>
    44                 <tr><td>Customizable Prompt</td><td >✔️ Available</td><td >❌ Only in premium</td></tr>
    45                 <tr><td>Campaign Report</td><td >✔️ Available</td><td >❌ Only in premium</td></tr>
    46                 <tr><td>Schedule Campaign/Notifications</td><td >✔️ Available</td><td >❌ Only in premium</td></tr>
     35            <tr><td>Number Of Sites/Apps</td><td >✔️ Unlimited</td><td >❌ Not included unless you pay more</td></tr>
     36            <tr><td>Campaigns</td><td >✔️ Unlimited</td><td >❌ Limited in basic plans</td></tr>
     37            <tr><td>Segmentation</td><td >✔️ Unlimited</td><td >❌ Limited in basic plans</td></tr>
     38            <tr><td>Audience Group</td><td >✔️ Unlimited</td><td >❌ Excluded from free/entry plans</td></tr>
     39            <tr><td>Advanced Analytics</td><td >✔️ Available</td><td >❌ Limited in basic plans</td></tr>
     40            <tr><td>WordPress Plugin</td><td >✔️ Available</td><td >❌ Not in all plans</td></tr>
     41            <tr><td>Customer Support</td><td >✔️ 24x7 Available</td><td >❌ Requires upgrade</td></tr>
     42            <tr><td>Web SDK</td><td >✔️ Available</td><td >❌ Not in free/basic plans</td></tr>
     43            <tr><td>Notification Data Exports (CSV)</td><td >✔️ Available</td><td >❌ Not in free/basic plans</td></tr>
     44            <tr><td>Customizable Prompt</td><td >✔️ Available</td><td >❌ Only in premium</td></tr>
     45            <tr><td>Campaign Report</td><td >✔️ Available</td><td >❌ Only in premium</td></tr>
     46            <tr><td>Schedule Campaign/Notifications</td><td >✔️ Available</td><td >❌ Only in premium</td></tr>
    4747            </tbody>
    4848        </table>
  • alertwise/trunk/views/dashboard-site-not-connected.php

    r3315384 r3321920  
    1313        <img class="alertwise-landing-logo" src="https://cdn.alertwise.net/alertwise/img/alertwise-logo.svg" alt="Alertwise Logo">
    1414        <span class="alertwise-landing-version">
    15             V.<?php echo esc_html(ALERTWISE_VERSION); ?>
     15            <?php esc_html_e('V.', 'alertwise'); ?><?php echo esc_html(ALERTWISE_VERSION); ?>
    1616        </span>
    1717    </div>
     
    5454    </div>
    5555    <div class="alertwise-landing-cta">
    56         <a href="<?php echo admin_url('admin.php?page=settings.php'); ?>" class="button-main-cta">
     56        <a href="<?php echo esc_url(admin_url('admin.php?page=settings.php')); ?>" class="button-main-cta">
    5757            <?php esc_html_e('Connect Your Site Now', 'alertwise'); ?>
    5858        </a>
     
    6666    <div class="alertwise-cards-section">
    6767        <div class="alertwise-support-section">
    68         <div class="alertwise-support-title">
    69             <?php esc_html_e('Support & Resources', 'alertwise'); ?>
     68            <div class="alertwise-support-title">
     69                <?php esc_html_e('Support & Resources', 'alertwise'); ?>
     70            </div>
    7071        </div>
    71     </div>
    7272        <div class="alertwise-cards">
    7373            <div class="alertwise-card">
    7474                <span class="alertwise-card-icon">&#128218;</span>
    7575                <div class="alertwise-card-title"><?php esc_html_e('Documentation', 'alertwise'); ?></div>
    76                     <a class="alertwise-card-btn" href="https://documentation.alertwise.net" target="_blank" rel="noopener">
    77                         Alertwise Documentation
    78                     </a>
     76                <a class="alertwise-card-btn" href="https://documentation.alertwise.net" target="_blank" rel="noopener">
     77                    Alertwise Documentation
     78                </a>
    7979                <div class="alertwise-card-desc">
    8080                    <?php esc_html_e('Comprehensive guides and API references for all features.', 'alertwise'); ?>
     
    9494                <span class="alertwise-card-icon">&#128172;</span>
    9595                <div class="alertwise-card-title"><?php esc_html_e('Community', 'alertwise'); ?></div>
    96                                 <a class="alertwise-card-btn" href="https://community.alertwise.net" target="_blank" rel="noopener">
     96                <a class="alertwise-card-btn" href="https://community.alertwise.net" target="_blank" rel="noopener">
    9797                    Alertwise Community
    9898                </a>
     
    104104                <span class="alertwise-card-icon">&#128240;</span>
    105105                <div class="alertwise-card-title"><?php esc_html_e('Blog', 'alertwise'); ?></div>
    106                                 <a class="alertwise-card-btn" href="https://blog.alertwise.net" target="_blank" rel="noopener">
     106                <a class="alertwise-card-btn" href="https://blog.alertwise.net" target="_blank" rel="noopener">
    107107                    Alertwise Blog
    108108                </a>
     
    115115    <!-- Footer -->
    116116    <div class="alertwise-footer">
    117         &copy; <?php echo date('Y'); ?> Alertwise.
     117        &copy; <?php echo esc_html(gmdate('Y')); ?> Alertwise.
    118118        <?php esc_html_e('All rights reserved.', 'alertwise'); ?>
    119119        &nbsp;|&nbsp;
  • alertwise/trunk/views/header.php

    r3315384 r3321920  
    2424        <a href="javascript:void(0);" id="alertwise-helpdocs-link"
    2525           style="color: #2271b1; text-decoration: underline; font-size: 1rem; cursor:pointer;">
    26            Help Docs
     26            Help Docs
    2727        </a>
    2828    </div>
    2929    <div>
    30         <p style="font-size: 1rem;">V.<?php esc_html_e(ALERTWISE_VERSION); ?></p>
     30        <p style="font-size: 1rem;"><?php esc_html_e('V.', 'alertwise'); ?><?php echo esc_html(ALERTWISE_VERSION); ?></p>
    3131    </div>
    3232</div>
  • alertwise/trunk/views/settings.php

    r3315384 r3321920  
    1010// Exit if accessed directly.
    1111if ( ! defined( 'ABSPATH' ) ) {
    12     exit;
     12    exit;
    1313}
    1414
     
    1717// Get existing settings
    1818$settings = Options::get_site_settings();
    19 $stored_email = isset($settings['alertwise_setting_username']) ? esc_attr($settings['alertwise_setting_username']) : '';
    20 $stored_api_key = isset($settings['alertwise_setting_password']) ? esc_attr($settings['alertwise_setting_password']) : '';
     19$stored_email = isset($settings['alertwise_setting_username']) ? $settings['alertwise_setting_username'] : '';
     20$stored_api_key = isset($settings['alertwise_setting_password']) ? $settings['alertwise_setting_password'] : '';
    2121
    2222$post_page_settings = Options::get_post_page_settings();
     
    2626
    2727<div id="pe-main-wrapper" style="max-width: 600px; margin-top: 30px;">
    28   <h1>AlertWise Settings</h1>
     28    <h1>AlertWise Settings</h1>
    2929
    30   <form id="alertwise-settings-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
    31     <input type="hidden" name="action" value="alertwise_save_settings">
    32     <?php wp_nonce_field('alertwise_save_settings_nonce', 'alertwise_nonce'); ?>
     30    <form id="alertwise-settings-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
     31        <input type="hidden" name="action" value="alertwise_save_settings">
     32        <?php wp_nonce_field('alertwise_save_settings_nonce', 'alertwise_nonce'); ?>
    3333
    34     <div style="margin-bottom: 20px;">
    35       <label for="pe-username" style="display: block; font-weight: bold; margin-bottom: 5px;">Username / Email</label>
    36       <input type="text" id="pe-username" name="pe_username" placeholder="Enter your username or email"
    37         value="<?php echo $stored_email; ?>"
    38         style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;" />
    39     </div>
     34        <div style="margin-bottom: 20px;">
     35            <label for="pe-username" style="display: block; font-weight: bold; margin-bottom: 5px;">Username / Email</label>
     36            <input type="text" id="pe-username" name="pe_username" placeholder="Enter your username or email"
     37                   value="<?php echo esc_attr($stored_email); ?>"
     38                   style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;" />
     39        </div>
    4040
    41     <div style="margin-bottom: 20px;">
    42       <label for="pe-api-key" style="display: block; font-weight: bold; margin-bottom: 5px;">API Key</label>
    43       <input type="text" id="pe-api-key" name="pe_api_key" placeholder="Enter your API key"
    44         value="<?php echo $stored_api_key; ?>"
    45         style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;" />
    46     </div>
     41        <div style="margin-bottom: 20px;">
     42            <label for="pe-api-key" style="display: block; font-weight: bold; margin-bottom: 5px;">API Key</label>
     43            <input type="text" id="pe-api-key" name="pe_api_key" placeholder="Enter your API key"
     44                   value="<?php echo esc_attr($stored_api_key); ?>"
     45                   style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;" />
     46        </div>
    4747
    48     <div style="margin-bottom: 20px;">
    49       <label style="font-weight: bold; display: block; margin-bottom: 5px;">Send Auto Notifications on:</label>
    50       <input type="checkbox" id="post-notifications" name="post_notifications" value="1" <?php checked($post_notifications); ?> />
    51       <label for="post-notifications" style="margin-right: 15px;">Enable notification on post publish/update</label>
    52       <input type="checkbox" id="page-notifications" name="page_notifications" value="1" <?php checked($page_notifications); ?> />
    53       <label for="page-notifications">Enable notification on page publish/update</label>
    54       <p><em>You can change this setting any time.</em></p>
     48        <div style="margin-bottom: 20px;">
     49            <label style="font-weight: bold; display: block; margin-bottom: 5px;">Send Auto Notifications on:</label>
     50            <input type="checkbox" id="post-notifications" name="post_notifications" value="1" <?php checked($post_notifications); ?> />
     51            <label for="post-notifications" style="margin-right: 15px;">Enable notification on post publish/update</label>
     52            <input type="checkbox" id="page-notifications" name="page_notifications" value="1" <?php checked($page_notifications); ?> />
     53            <label for="page-notifications">Enable notification on page publish/update</label>
     54            <p><em>You can change this setting any time.</em></p>
    5555
    56   </div>
     56        </div>
    5757
    58     <button type="submit"
    59       style="background-color: #0073aa; color: #fff; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer;">
    60       Verify & Save Settings
    61     </button>
    62   </form>
     58        <button type="submit"
     59                style="background-color: #0073aa; color: #fff; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer;">
     60            Verify & Save Settings
     61        </button>
     62    </form>
    6363</div>
Note: See TracChangeset for help on using the changeset viewer.