Changeset 3321920
- Timestamp:
- 07/03/2025 04:57:50 PM (8 months ago)
- Location:
- alertwise/trunk
- Files:
-
- 1 added
- 16 edited
-
app/Admin.php (modified) (1 diff)
-
app/Includes/handlers/SettingsHandler.php (modified) (3 diffs)
-
app/Installer.php (modified) (2 diffs)
-
app/SendManager.php (modified) (13 diffs)
-
app/ServiceWorker.php (modified) (2 diffs)
-
app/Utils/Helpers.php (modified) (2 diffs)
-
app/Utils/TokenManager.php (modified) (1 diff)
-
languages (added)
-
main.php (modified) (1 diff)
-
readme.txt (modified) (6 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
-
views/about-us.php (modified) (2 diffs)
-
views/dashboard-site-not-connected.php (modified) (6 diffs)
-
views/header.php (modified) (1 diff)
-
views/settings.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alertwise/trunk/app/Admin.php
r3315545 r3321920 8 8 // Exit if accessed directly. 9 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit;10 exit; 11 11 } 12 12 13 13 class Admin { 14 /**15 * Constructor function to register hooks16 *17 * @since 4.0.018 */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 } 27 27 28 /**29 * Redirect to onboarding screen after activation30 *31 * @since 4.0.032 */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 } 37 37 38 delete_transient( 'alertwise_activation_redirect' );38 delete_transient( 'alertwise_activation_redirect' ); 39 39 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 } 44 44 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 } 50 49 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 } 54 55 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 } 68 59 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 } 91 73 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 } 94 96 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 } 99 104 } -
alertwise/trunk/app/Includes/handlers/SettingsHandler.php
r3315384 r3321920 25 25 } 26 26 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'])) : ''; 29 29 30 30 $params = [ … … 83 83 $settings['alertwise_setting_language'] = $current_app['language']; 84 84 $settings['alertwise_setting_icon_url'] = $current_app['iconUrl']; 85 $settings['alertwise_setting_icon_url'] = $current_app['iconUrl'];86 85 $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'); 88 87 } else { 89 88 AdminNotice::add_notice('No matching app found for this domain.', 'error'); … … 106 105 107 106 // 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'))); 109 108 exit; 110 109 } -
alertwise/trunk/app/Installer.php
r3315384 r3321920 2 2 namespace Alertwise; 3 3 4 //use Alertwise\Upgrade;5 4 use Alertwise\Utils\Options; 6 5 7 6 // Exit if accessed directly. 8 7 if ( ! defined( 'ABSPATH' ) ) { 9 exit;8 exit; 10 9 } 11 10 12 11 class Installer { 13 /**14 * Trigger immediately after installing plugin15 *16 * @since 4.0.017 *18 * @return void19 */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(); 22 21 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' => '', 34 33 'alertwise_setting_app_name' => '', 35 34 'alertwise_setting_app_server_public_key' => '', … … 38 37 'alertwise_setting_badge_icon_url' => '', 39 38 '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 ); 45 44 46 add_option( 'alertwise_settings', $alertwise_settings );47 }45 add_option( 'alertwise_settings', $alertwise_settings ); 46 } 48 47 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 ); 55 54 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 } 59 58 } -
alertwise/trunk/app/SendManager.php
r3315384 r3321920 23 23 24 24 // Always add the "site not connected" metabox action 25 // It will only show if credentials are missing.26 25 add_action('add_meta_boxes', array($this, 'add_alertwise_site_not_connected_metabox')); 27 26 28 29 27 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']) 32 30 ) { 33 31 add_action('add_meta_boxes', [$this, 'add_notification_metabox']); … … 69 67 $already_sent = get_post_meta($post->ID, '_alertwise_sent', true); 70 68 71 // Prepare data for view72 69 $data = [ 73 70 'post' => $post, … … 78 75 ]; 79 76 80 // Use the view loader81 77 Alertwise::output_view('post-editor-metabox.php', $data); 82 78 } … … 93 89 } 94 90 95 // Only validate nonce if it's a real form submission (to avoid failing on cron or API saves)96 91 if (isset($_POST['alertwise_meta_box_nonce'])) { 97 92 if (!wp_verify_nonce($_POST['alertwise_meta_box_nonce'], 'alertwise_meta_box')) { … … 105 100 106 101 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 ); 108 107 error_log("[Alertwise] Saved custom title for post ID: $post_id"); 109 108 } 110 109 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 ); 112 115 error_log("[Alertwise] Saved custom message for post ID: $post_id"); 113 116 } 114 117 115 // --- NEW: Handle scheduling of resend if post is scheduled ---116 118 $force_resend = isset($_POST['alertwise_force_resend']) && $_POST['alertwise_force_resend'] === '1'; 117 119 $post = get_post($post_id); … … 119 121 if ($force_resend) { 120 122 if ($post && $post->post_status === 'future') { 121 // Mark to resend on next publish122 123 update_post_meta($post_id, '_alertwise_resend_on_future_publish', '1'); 123 124 error_log("[Alertwise] Will resend notification on future publish for post ID: $post_id"); 124 125 } else { 125 // If not scheduled, send now126 126 $this->auto_send_notification($post_id, $post, true); 127 127 } 128 128 } else { 129 // If user did not check force_resend, clear the meta130 129 delete_post_meta($post_id, '_alertwise_resend_on_future_publish'); 131 130 } 132 131 } else { 133 // Not a UI update (e.g. cron), so handle scheduled-resend logic134 132 $post = get_post($post_id); 135 133 $resend_on_future_publish = get_post_meta($post_id, '_alertwise_resend_on_future_publish', true); 136 134 137 // If we're being published (by cron) and resend is requested, do it138 135 if ($post && $post->post_status === 'publish' && $resend_on_future_publish === '1') { 139 136 error_log("[Alertwise] Scheduled resend on publish for post ID: $post_id"); … … 143 140 } 144 141 145 // --- Normal auto-send logic if not already sent and not force-resend ---146 142 $post = get_post($post_id); 147 143 if (!$post) { … … 159 155 } 160 156 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 162 158 { 163 159 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; … … 180 176 } 181 177 182 // Optionally, clear sent meta if force_resend183 178 if ($force_resend) { 184 179 update_post_meta($post_id, '_alertwise_sent', false); … … 193 188 194 189 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); 196 191 } 197 192 … … 238 233 ]; 239 234 240 // Get a valid (non-expired) token241 235 $token = TokenManager::get_token(); 242 236 if ($token) { … … 246 240 ); 247 241 } else { 248 249 // Remove the credentials keys if they are not empty250 242 if ( 251 243 !empty($alertwise_settings['alertwise_setting_username']) && … … 259 251 } 260 252 261 262 /**263 * Add Meta box when AlertWise site is not connected.264 */265 253 public function add_alertwise_site_not_connected_metabox() 266 254 { -
alertwise/trunk/app/ServiceWorker.php
r3315384 r3321920 42 42 // Only output the script if both values are present. 43 43 if (!empty($app_id) && !empty($public_key)) { 44 ?>44 ?> 45 45 <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> 47 47 <script type="text/javascript"> 48 48 alertwise = window.alertwise || []; … … 50 50 appId: "<?php echo esc_js($app_id); ?>", 51 51 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); ?>" 55 55 }]); 56 56 </script> 57 <?php57 <?php 58 58 } else { 59 59 error_log('app id not found in service worker intialization'); -
alertwise/trunk/app/Utils/Helpers.php
r3315384 r3321920 7 7 // Exit if accessed directly. 8 8 if (! defined('ABSPATH')) { 9 exit;9 exit; 10 10 } 11 11 12 12 class Helpers 13 13 { 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(''', ''', ''', '"'), '\'', $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(''', ''', ''', '"'), '\'', $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); 306 216 307 217 foreach ($apps as $app) { 308 218 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); 310 220 if ($app_domain === $current_domain) { 311 221 return $app; … … 316 226 } 317 227 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 } 325 235 } -
alertwise/trunk/app/Utils/TokenManager.php
r3315384 r3321920 59 59 $settings['alertwise_setting_token_type'] = $response['token_type'] ?? 'Bearer'; 60 60 $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'); 62 62 $settings['alertwise_setting_owner_id'] = (Helpers::decode($response['access_token'])['id'] ?? ''); 63 63 -
alertwise/trunk/main.php
r3315384 r3321920 8 8 * Author URI: https://www.wordpress.org/alertwise 9 9 * 10 * Version: 1.0 10 * Version: 1.0.0 11 11 * Requires at least: 4.5.0 12 12 * Requires PHP: 5.6 -
alertwise/trunk/readme.txt
r3318479 r3321920 1 === AlertWise: The BestMobile & Web Push Notification Service ===1 === AlertWise: Mobile & Web Push Notification Service === 2 2 Contributors: alertwise 3 3 Tags: push notifications, web push notifications, desktop notifications, web push, marketing automation … … 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 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. 12 12 13 13 == Description == 14 14 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. 15 AlertWise 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. 20 16 21 17 With 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. … … 39 35 40 36 #### 👥 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 PushNotification Delivery44 AlertWise uses **Amazon AWS cloud infrastructure** for **ultra-fast, reliable delivery** across the globe. No delays, no failures — just instant engagement.37 you can create **unlimited audience groups** to deliver more relevant and personalized push notifications. 38 39 #### ⚡ High-Speed Notification Delivery 40 AlertWise is built on **Amazon AWS cloud infrastructure** to ensure fast and reliable delivery of your push notifications across the globe. 45 41 46 42 #### 🔔 Offline Notification Support … … 56 52 - **Geolocation Targeting** – Reach users based on country, region, or city for geo-personalized offers. 57 53 - **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 easyto manage.54 - **Advanced Filters** – Use **unlimited AND/OR conditions** to create complex targeting logic that’s straightforward to manage. 59 55 60 56 --- … … 198 194 199 195 = 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.196 Yes! 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. 201 197 202 198 = How do I install the plugin? = … … 238 234 == Screenshots == 239 235 240 1. Real-time analytics dashboard with campaign and subscriber stats241 2. Create personalized campaigns using advanced segmentation242 3. Customizable popup modal for collecting subscribers243 4. Push notifications with CTA buttons for higher engagement244 5. Notification previews on desktop and mobile browsers245 6. Audience grouping by behavior, device, and location236 1. The real-time analytics dashboard showing campaign and subscriber statistics. 237 2. The campaign creation screen with advanced segmentation options. 238 3. An example of a customizable popup modal for collecting subscribers. 239 4. A push notification with CTA buttons designed for higher engagement. 240 5. Previews of how notifications appear on desktop and mobile browsers. 241 6. The audience grouping interface, allowing segmentation by behavior, device, and location. 246 242 7. Subscriber details with browser, device, and activity data 247 243 8. 24/7 live support access from the plugin dashboard -
alertwise/trunk/vendor/autoload.php
r3315384 r3321920 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 -
alertwise/trunk/vendor/composer/InstalledVersions.php
r3315384 r3321920 28 28 { 29 29 /** 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 /** 30 36 * @var mixed[]|null 31 37 * @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 32 38 */ 33 39 private static $installed; 40 41 /** 42 * @var bool 43 */ 44 private static $installedIsLocalDir; 34 45 35 46 /** … … 310 321 self::$installed = $data; 311 322 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; 312 341 } 313 342 … … 323 352 324 353 $installed = array(); 354 $copiedLocalDir = false; 325 355 326 356 if (self::$canGetVendors) { 357 $selfDir = self::getSelfDir(); 327 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 359 $vendorDir = strtr($vendorDir, '\\', '/'); 328 360 if (isset(self::$installedByVendor[$vendorDir])) { 329 361 $installed[] = self::$installedByVendor[$vendorDir]; … … 331 363 /** @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 */ 332 364 $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; 336 370 } 371 } 372 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 373 $copiedLocalDir = true; 337 374 } 338 375 } … … 351 388 } 352 389 353 if (self::$installed !== array() ) {390 if (self::$installed !== array() && !$copiedLocalDir) { 354 391 $installed[] = self::$installed; 355 392 } -
alertwise/trunk/vendor/composer/installed.php
r3315384 r3321920 1 1 <?php return array( 2 2 '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', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 11 11 ), 12 12 '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', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
alertwise/trunk/views/about-us.php
r3317167 r3321920 13 13 <div class="alertwise-about-container"> 14 14 <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> 16 16 <p> 17 17 <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. … … 26 26 <table> 27 27 <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> 33 33 </thead> 34 34 <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> 47 47 </tbody> 48 48 </table> -
alertwise/trunk/views/dashboard-site-not-connected.php
r3315384 r3321920 13 13 <img class="alertwise-landing-logo" src="https://cdn.alertwise.net/alertwise/img/alertwise-logo.svg" alt="Alertwise Logo"> 14 14 <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); ?> 16 16 </span> 17 17 </div> … … 54 54 </div> 55 55 <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"> 57 57 <?php esc_html_e('Connect Your Site Now', 'alertwise'); ?> 58 58 </a> … … 66 66 <div class="alertwise-cards-section"> 67 67 <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> 70 71 </div> 71 </div>72 72 <div class="alertwise-cards"> 73 73 <div class="alertwise-card"> 74 74 <span class="alertwise-card-icon">📚</span> 75 75 <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 Documentation78 </a>76 <a class="alertwise-card-btn" href="https://documentation.alertwise.net" target="_blank" rel="noopener"> 77 Alertwise Documentation 78 </a> 79 79 <div class="alertwise-card-desc"> 80 80 <?php esc_html_e('Comprehensive guides and API references for all features.', 'alertwise'); ?> … … 94 94 <span class="alertwise-card-icon">💬</span> 95 95 <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"> 97 97 Alertwise Community 98 98 </a> … … 104 104 <span class="alertwise-card-icon">📰</span> 105 105 <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"> 107 107 Alertwise Blog 108 108 </a> … … 115 115 <!-- Footer --> 116 116 <div class="alertwise-footer"> 117 © <?php echo date('Y'); ?> Alertwise.117 © <?php echo esc_html(gmdate('Y')); ?> Alertwise. 118 118 <?php esc_html_e('All rights reserved.', 'alertwise'); ?> 119 119 | -
alertwise/trunk/views/header.php
r3315384 r3321920 24 24 <a href="javascript:void(0);" id="alertwise-helpdocs-link" 25 25 style="color: #2271b1; text-decoration: underline; font-size: 1rem; cursor:pointer;"> 26 Help Docs26 Help Docs 27 27 </a> 28 28 </div> 29 29 <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> 31 31 </div> 32 32 </div> -
alertwise/trunk/views/settings.php
r3315384 r3321920 10 10 // Exit if accessed directly. 11 11 if ( ! defined( 'ABSPATH' ) ) { 12 exit;12 exit; 13 13 } 14 14 … … 17 17 // Get existing settings 18 18 $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'] : ''; 21 21 22 22 $post_page_settings = Options::get_post_page_settings(); … … 26 26 27 27 <div id="pe-main-wrapper" style="max-width: 600px; margin-top: 30px;"> 28 <h1>AlertWise Settings</h1>28 <h1>AlertWise Settings</h1> 29 29 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'); ?> 33 33 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> 40 40 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> 47 47 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> 55 55 56 </div>56 </div> 57 57 58 <button type="submit"59 style="background-color: #0073aa; color: #fff; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer;">60 Verify & Save Settings61 </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> 63 63 </div>
Note: See TracChangeset
for help on using the changeset viewer.