WPFront Notification Bar - Version 2.1.0

Version Description

  • More XSS fixes. Please read this link before upgrading.
  • Use WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML constant to get v1.x behavior on message & button text.
  • Add define('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML', true); to your wp-config.php to disable message sanitization.
  • Another way is to use wpfront_notification_bar_message_allow_unfiltered_html and wpfront_notification_bar_button_text_allow_unfiltered_html filters.
  • WPML compatibility fix. Use WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN constant to change language domain.
Download this release

Release Info

Developer syammohanm
Plugin Icon 128x128 WPFront Notification Bar
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.0 to 2.1.0

classes/class-wpfront-notification-bar-options.php CHANGED
@@ -52,7 +52,7 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
52
  $this->addOption('display_button', 'bool', false)->label(__('Display Button', 'wpfront-notification-bar'));
53
  $this->addOption('button_text', 'string', '')->label(__('Button Text', 'wpfront-notification-bar'));
54
  $this->addOption('button_action', 'int', 1, array($this, 'validate_1or2'))->label(__('Button Action', 'wpfront-notification-bar'));
55
- $this->addOption('button_action_url', 'string', '')->label(__('Open URL:', 'wpfront-notification-bar'));
56
  $this->addOption('button_action_new_tab', 'bool', false)->label(__('Open URL in new tab/window', 'wpfront-notification-bar'));
57
  $this->addOption('button_action_url_nofollow', 'bool', false)->label(__('No follow link', 'wpfront-notification-bar'));
58
  $this->addOption('button_action_url_noreferrer', 'bool', false)->label(__('No referrer link', 'wpfront-notification-bar'));
@@ -115,12 +115,11 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
115
 
116
  //validation function
117
  protected function validate_color($arg) {
118
- if (strlen($arg) != 7)
119
- return '#ffffff';
120
 
121
- if (strpos($arg, '#') != 0)
122
  return '#ffffff';
123
-
124
  return $arg;
125
  }
126
 
@@ -167,6 +166,8 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
167
  }
168
 
169
  protected function validate_landingpage_cookie_name($arg) {
 
 
170
  if (trim($arg) == '') {
171
  return 'wpfront-notification-bar-landingpage';
172
  }
@@ -175,6 +176,8 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
175
  }
176
 
177
  protected function validate_keep_closed_cookie_name($arg) {
 
 
178
  if (trim($arg) == '') {
179
  return 'wpfront-notification-bar-keep-closed';
180
  }
@@ -202,7 +205,11 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
202
  }
203
 
204
  protected function validate_reopen_button_image_url($arg) {
205
- return trim($arg);
 
 
 
 
206
  }
207
 
208
  }
52
  $this->addOption('display_button', 'bool', false)->label(__('Display Button', 'wpfront-notification-bar'));
53
  $this->addOption('button_text', 'string', '')->label(__('Button Text', 'wpfront-notification-bar'));
54
  $this->addOption('button_action', 'int', 1, array($this, 'validate_1or2'))->label(__('Button Action', 'wpfront-notification-bar'));
55
+ $this->addOption('button_action_url', 'string', '', array($this, 'validate_button_action_url'))->label(__('Open URL:', 'wpfront-notification-bar'));
56
  $this->addOption('button_action_new_tab', 'bool', false)->label(__('Open URL in new tab/window', 'wpfront-notification-bar'));
57
  $this->addOption('button_action_url_nofollow', 'bool', false)->label(__('No follow link', 'wpfront-notification-bar'));
58
  $this->addOption('button_action_url_noreferrer', 'bool', false)->label(__('No referrer link', 'wpfront-notification-bar'));
115
 
116
  //validation function
117
  protected function validate_color($arg) {
118
+ $arg = sanitize_hex_color($arg);
 
119
 
120
+ if (empty($arg)) {
121
  return '#ffffff';
122
+ }
123
  return $arg;
124
  }
125
 
166
  }
167
 
168
  protected function validate_landingpage_cookie_name($arg) {
169
+ $arg = sanitize_key($arg);
170
+
171
  if (trim($arg) == '') {
172
  return 'wpfront-notification-bar-landingpage';
173
  }
176
  }
177
 
178
  protected function validate_keep_closed_cookie_name($arg) {
179
+ $arg = sanitize_key($arg);
180
+
181
  if (trim($arg) == '') {
182
  return 'wpfront-notification-bar-keep-closed';
183
  }
205
  }
206
 
207
  protected function validate_reopen_button_image_url($arg) {
208
+ return esc_url_raw($arg);
209
+ }
210
+
211
+ protected function validate_button_action_url($arg) {
212
+ return esc_url_raw($arg);
213
  }
214
 
215
  }
classes/class-wpfront-notification-bar.php CHANGED
@@ -35,7 +35,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
35
  class WPFront_Notification_Bar {
36
 
37
  //Constants
38
- const VERSION = '2.0.0.07176';
39
  const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
40
  const OPTION_NAME = 'wpfront-notification-bar-options';
41
  const PLUGIN_SLUG = 'wpfront-notification-bar';
@@ -228,7 +228,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
228
 
229
  if ($this->options->position() == 1) {
230
  add_action('wp_body_open', array($this, 'write_markup'));
231
- add_action('wp_footer', array($this, 'write_markup'));//Callback hook 'wp_body_open' only works from WordPress 5.2
232
  add_action('admin_head', array($this, 'write_markup'));
233
  } else {
234
  add_action('wp_footer', array($this, 'write_markup'));
@@ -381,7 +381,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
381
  echo '<script type="text/javascript">';
382
  echo "console.log('[WPFront Notification Bar] Page generated at $now_str.');";
383
  foreach ($this->logs as $message => $args) {
384
- if(empty($args)) {
385
  printf("console.log('$message');");
386
  } else {
387
  vprintf("console.log('$message');", $args);
@@ -395,8 +395,15 @@ if (!class_exists('WPFront_Notification_Bar')) {
395
  protected function get_message_text() {
396
  $message = $this->options->message();
397
 
398
- $message = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script\b[^>]*>/i', '', $message);
399
-
 
 
 
 
 
 
 
400
  $message = apply_filters('wpfront_notification_bar_message', $message);
401
 
402
  if ($this->options->message_process_shortcode()) {
@@ -409,8 +416,15 @@ if (!class_exists('WPFront_Notification_Bar')) {
409
  protected function get_button_text() {
410
  $text = $this->options->button_text();
411
 
412
- $text = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script\b[^>]*>/i', '', $text);
413
-
 
 
 
 
 
 
 
414
  $text = apply_filters('wpfront_notification_bar_button_text', $text);
415
 
416
  if ($this->options->message_process_shortcode()) {
@@ -730,10 +744,17 @@ if (!class_exists('WPFront_Notification_Bar')) {
730
  if (!$this->options->display_scroll() && $this->options->display_after() == 0 && $this->options->animate_delay() == 0) {
731
  return true;
732
  }
733
-
734
  return false;
735
  }
736
-
 
 
 
 
 
 
 
737
  }
738
 
739
  }
35
  class WPFront_Notification_Bar {
36
 
37
  //Constants
38
+ const VERSION = '2.1.0.08087';
39
  const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
40
  const OPTION_NAME = 'wpfront-notification-bar-options';
41
  const PLUGIN_SLUG = 'wpfront-notification-bar';
228
 
229
  if ($this->options->position() == 1) {
230
  add_action('wp_body_open', array($this, 'write_markup'));
231
+ add_action('wp_footer', array($this, 'write_markup')); //Callback hook 'wp_body_open' only works from WordPress 5.2
232
  add_action('admin_head', array($this, 'write_markup'));
233
  } else {
234
  add_action('wp_footer', array($this, 'write_markup'));
381
  echo '<script type="text/javascript">';
382
  echo "console.log('[WPFront Notification Bar] Page generated at $now_str.');";
383
  foreach ($this->logs as $message => $args) {
384
+ if (empty($args)) {
385
  printf("console.log('$message');");
386
  } else {
387
  vprintf("console.log('$message');", $args);
395
  protected function get_message_text() {
396
  $message = $this->options->message();
397
 
398
+ //$message = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script\b[^>]*>/i', '', $message);
399
+
400
+ $unfilter_html = defined('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML') && WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML;
401
+ $unfilter_html = apply_filters('wpfront_notification_bar_message_allow_unfiltered_html', $unfilter_html);
402
+
403
+ if (!$unfilter_html) {
404
+ $message = wp_kses($message, wp_kses_allowed_html('post'));
405
+ }
406
+
407
  $message = apply_filters('wpfront_notification_bar_message', $message);
408
 
409
  if ($this->options->message_process_shortcode()) {
416
  protected function get_button_text() {
417
  $text = $this->options->button_text();
418
 
419
+ //$text = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script\b[^>]*>/i', '', $text);
420
+
421
+ $unfilter_html = defined('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML') && WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML;
422
+ $unfilter_html = apply_filters('wpfront_notification_bar_button_text_allow_unfiltered_html', $unfilter_html);
423
+
424
+ if (!$unfilter_html) {
425
+ $text = wp_kses($text, wp_kses_allowed_html('post'));
426
+ }
427
+
428
  $text = apply_filters('wpfront_notification_bar_button_text', $text);
429
 
430
  if ($this->options->message_process_shortcode()) {
744
  if (!$this->options->display_scroll() && $this->options->display_after() == 0 && $this->options->animate_delay() == 0) {
745
  return true;
746
  }
747
+
748
  return false;
749
  }
750
+
751
+ protected function get_lang_domain() {
752
+ if(defined('WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN')) {
753
+ return WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN;
754
+ }
755
+
756
+ return 'wpfront-notification-bar';
757
+ }
758
  }
759
 
760
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: notification bar, wordpress notification bar, top bar, bottom bar, notific
5
  Requires at least: 5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.0
8
- Stable tag: 2.0.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -68,6 +68,13 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
71
  = 2.0.0 =
72
  * Breaking change added. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
73
  * Breaking change: Message text no longer allow script tags.
@@ -160,6 +167,9 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
160
 
161
  == Upgrade Notice ==
162
 
 
 
 
163
  = 2.0.0 =
164
  * Please read change log before upgrading.
165
 
5
  Requires at least: 5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.0
8
+ Stable tag: 2.1.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
68
 
69
  == Changelog ==
70
 
71
+ = 2.1.0 =
72
+ * More XSS fixes. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
73
+ * Use **WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML** constant to get v1.x behavior on message & button text.
74
+ * Add **define('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML', true);** to your wp-config.php to disable message sanitization.
75
+ * Another way is to use **wpfront_notification_bar_message_allow_unfiltered_html** and **wpfront_notification_bar_button_text_allow_unfiltered_html** filters.
76
+ * WPML compatibility fix. Use **WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN** constant to change language domain.
77
+
78
  = 2.0.0 =
79
  * Breaking change added. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
80
  * Breaking change: Message text no longer allow script tags.
167
 
168
  == Upgrade Notice ==
169
 
170
+ = 2.1.0 =
171
+ * XSS and compatibility fixes.
172
+
173
  = 2.0.0 =
174
  * Please read change log before upgrading.
175
 
templates/notification-bar-template.php CHANGED
@@ -67,7 +67,7 @@ if (!$this->options->dynamic_css_use_url()) {
67
  <tr>
68
  <td>
69
  <div class="wpfront-message">
70
- <?php echo $this->get_message_text(); ?>
71
  </div>
72
  <div>
73
  <?php
@@ -92,12 +92,12 @@ if (!$this->options->dynamic_css_use_url()) {
92
 
93
  $rel = implode(' ', $rel);
94
  ?>
95
- <a class="wpfront-button" href="<?php echo $this->options->button_action_url(); ?>" target="<?php echo $this->options->button_action_new_tab() ? '_blank' : '_self'; ?>" <?php echo empty($rel) ? '' : "rel=\"$rel\""; ?>><?php echo $button_text; ?></a>
96
  <?php
97
  }
98
  ?>
99
  <?php if ($this->options->button_action() == 2) { ?>
100
- <a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo $button_text; ?></a>
101
  <?php } ?>
102
  <?php } ?>
103
  </div>
67
  <tr>
68
  <td>
69
  <div class="wpfront-message">
70
+ <?php echo __($this->get_message_text(), $this->get_lang_domain()); ?>
71
  </div>
72
  <div>
73
  <?php
92
 
93
  $rel = implode(' ', $rel);
94
  ?>
95
+ <a class="wpfront-button" href="<?php echo __($this->options->button_action_url(), $this->get_lang_domain()); ?>" target="<?php echo $this->options->button_action_new_tab() ? '_blank' : '_self'; ?>" <?php echo empty($rel) ? '' : "rel=\"$rel\""; ?>><?php echo __($button_text, $this->get_lang_domain()); ?></a>
96
  <?php
97
  }
98
  ?>
99
  <?php if ($this->options->button_action() == 2) { ?>
100
+ <a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo __($button_text, $this->get_lang_domain()); ?></a>
101
  <?php } ?>
102
  <?php } ?>
103
  </div>
templates/options-template.php CHANGED
@@ -121,7 +121,7 @@
121
  <?php echo $this->options->display_scroll_offset_label(); ?>
122
  </th>
123
  <td>
124
- <input class="seconds" name="<?php echo $this->options->display_scroll_offset_name(); ?>" value="<?php echo $this->options->display_scroll_offset(); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Number of pixels to be scrolled before the bar appears.', 'wpfront-notification-bar'); ?>]</span>
125
  </td>
126
  </tr>
127
  <tr>
@@ -129,7 +129,7 @@
129
  <?php echo $this->options->height_label(); ?>
130
  </th>
131
  <td>
132
- <input class="seconds" name="<?php echo $this->options->height_name(); ?>" value="<?php echo $this->options->height(); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0px to auto fit contents.', 'wpfront-notification-bar'); ?>]</span>
133
  </td>
134
  </tr>
135
  <tr>
@@ -137,7 +137,7 @@
137
  <?php echo $this->options->position_offset_label(); ?>
138
  </th>
139
  <td>
140
- <input class="seconds" name="<?php echo $this->options->position_offset_name(); ?>" value="<?php echo $this->options->position_offset(); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('(Top bar only) If you find the bar overlapping, try increasing this value. (eg. WordPress 3.8 Twenty Fourteen theme, set 48px)', 'wpfront-notification-bar'); ?>]</span>
141
  </td>
142
  </tr>
143
  <tr>
@@ -145,7 +145,7 @@
145
  <?php echo $this->options->display_after_label(); ?>
146
  </th>
147
  <td>
148
- <input class="seconds" name="<?php echo $this->options->display_after_name(); ?>" value="<?php echo $this->options->display_after(); ?>" />&#160;<?php echo __('second(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0 second(s) to display immediately. Does not work in "Display on Scroll" mode.', 'wpfront-notification-bar'); ?>]</span>
149
  </td>
150
  </tr>
151
  <tr>
@@ -153,7 +153,7 @@
153
  <?php echo $this->options->animate_delay_label(); ?>
154
  </th>
155
  <td>
156
- <input class="seconds" name="<?php echo $this->options->animate_delay_name(); ?>" value="<?php echo $this->options->animate_delay(); ?>" />&#160;<?php echo __('second(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0 second(s) for no animation.', 'wpfront-notification-bar'); ?>]</span>
157
  </td>
158
  </tr>
159
  <tr>
@@ -169,7 +169,7 @@
169
  <?php echo $this->options->auto_close_after_label(); ?>
170
  </th>
171
  <td>
172
- <input class="seconds" name="<?php echo $this->options->auto_close_after_name(); ?>" value="<?php echo $this->options->auto_close_after(); ?>" />&#160;<?php echo __('second(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0 second(s) to disable auto close. Do not work in "Display on Scroll" mode.', 'wpfront-notification-bar'); ?>]</span>
173
  </td>
174
  </tr>
175
  <tr>
@@ -193,7 +193,7 @@
193
  <?php echo $this->options->reopen_button_image_url_label(); ?>
194
  </th>
195
  <td>
196
- <input id="reopen-button-image-url" class="url" name="<?php echo $this->options->reopen_button_image_url_name(); ?>" value="<?php echo $this->options->reopen_button_image_url(); ?>"/>
197
  <input type="button" id="media-library-button" class="button" value="<?php echo __('Media Library', 'wpfront-notification-bar'); ?>" />
198
  <br />
199
  <span class="description"><?php echo esc_html(__('[Set empty value to use default images.]')); ?></span>
@@ -212,7 +212,7 @@
212
  <?php echo $this->options->keep_closed_for_label(); ?>
213
  </th>
214
  <td>
215
- <input class="seconds" name="<?php echo $this->options->keep_closed_for_name(); ?>" value="<?php echo $this->options->keep_closed_for(); ?>" />&#160;<?php echo __('day(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Bar will be kept closed for the number of days specified from last closed date.', 'wpfront-notification-bar'); ?>]</span>
216
  </td>
217
  </tr>
218
  <tr>
@@ -220,7 +220,7 @@
220
  <?php echo $this->options->keep_closed_cookie_name_label(); ?>
221
  </th>
222
  <td>
223
- <input class="cookie-name" name="<?php echo $this->options->keep_closed_cookie_name_name(); ?>" value="<?php echo $this->options->keep_closed_cookie_name(); ?>" />
224
  <span><?php echo __('Cookie name used to mark keep closed days. Changing this value will allow you to bypass "Keep Closed For" days and show the notification again.', 'wpfront-notification-bar'); ?></span>
225
  </td>
226
  </tr>
@@ -238,7 +238,7 @@
238
  <?php echo $this->options->small_device_width_label(); ?>
239
  </th>
240
  <td>
241
- <input class="pixels" name="<?php echo $this->options->small_device_width_name(); ?>" value="<?php echo $this->options->small_device_width(); ?>" />px
242
  <span class="description"><?php echo __('[Notification bar will be hidden on devices with lesser or equal width.]', 'wpfront-notification-bar'); ?></span>
243
  </td>
244
  </tr>
@@ -256,7 +256,7 @@
256
  <?php echo $this->options->small_window_width_label(); ?>
257
  </th>
258
  <td>
259
- <input class="pixels" name="<?php echo $this->options->small_window_width_name(); ?>" value="<?php echo $this->options->small_window_width(); ?>" />px
260
  <span class="description"><?php echo __('[Notification bar will be hidden on browser window with lesser or equal width.]', 'wpfront-notification-bar'); ?></span>
261
  </td>
262
  </tr>
@@ -280,7 +280,15 @@
280
  <td>
281
  <textarea rows="5" cols="75" name="<?php echo $this->options->message_name(); ?>"><?php echo esc_textarea($this->options->message()); ?></textarea>
282
  <br />
283
- <span class="description"><?php echo esc_html(__('[HTML tags are allowed, except "<script>" tags. e.g. Add <br /> for break.]')); ?></span>
 
 
 
 
 
 
 
 
284
  </td>
285
  </tr>
286
  <tr>
@@ -304,7 +312,15 @@
304
  <?php echo $this->options->button_text_label(); ?>
305
  </th>
306
  <td>
307
- <input name="<?php echo $this->options->button_text_name(); ?>" value="<?php echo $this->options->button_text(); ?>" />
 
 
 
 
 
 
 
 
308
  </td>
309
  </tr>
310
  <tr>
@@ -316,7 +332,7 @@
316
  <input type="radio" name="<?php echo $this->options->button_action_name(); ?>" value="1" <?php echo $this->options->button_action() == 1 ? 'checked' : ''; ?> />
317
  <span><?php echo $this->options->button_action_url_label(); ?></span>
318
  </label>
319
- <input class="URL" name="<?php echo $this->options->button_action_url_name(); ?>" value="<?php echo $this->options->button_action_url(); ?>" />
320
  <br />
321
  <label>
322
  <input type="checkbox" name="<?php echo $this->options->button_action_new_tab_name(); ?>" <?php echo $this->options->button_action_new_tab() ? 'checked' : ''; ?> />
@@ -367,8 +383,8 @@
367
  <?php echo $this->options->start_date_label(); ?>
368
  </th>
369
  <td>
370
- <input class="date" name="<?php echo $this->options->start_date_name(); ?>" value="<?php echo $this->options->start_date() == NULL ? '' : date('Y-m-d', $this->options->start_date()); ?>" />
371
- <input class="time" name="<?php echo $this->options->start_time_name(); ?>" value="<?php echo $this->options->start_time() == NULL ? '' : date('h:i a', $this->options->start_time()); ?>" />
372
  &#160;
373
  <span class="description"><?php echo __('[YYYY-MM-DD] [hh:mm ap]', 'wpfront-notification-bar'); ?></span>
374
  </td>
@@ -378,8 +394,8 @@
378
  <?php echo $this->options->end_date_label(); ?>
379
  </th>
380
  <td>
381
- <input class="date" name="<?php echo $this->options->end_date_name(); ?>" value="<?php echo $this->options->end_date() == NULL ? '' : date('Y-m-d', $this->options->end_date()); ?>" />
382
- <input class="time" name="<?php echo $this->options->end_time_name(); ?>" value="<?php echo $this->options->end_time() == NULL ? '' : date('h:i a', $this->options->end_time()); ?>" />
383
  &#160;
384
  <span class="description"><?php echo __('[YYYY-MM-DD] [hh:mm ap]', 'wpfront-notification-bar'); ?></span>
385
  </td>
@@ -403,7 +419,7 @@
403
  <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="3" <?php echo $this->options->display_pages() == 3 ? 'checked' : ''; ?> />
404
  <span><?php echo __('Include in following pages [Use the textbox below to specify the post IDs as a comma separated list.]', 'wpfront-notification-bar'); ?></span>
405
  </label>
406
- <input class="post-id-list" name="<?php echo $this->options->include_pages_name(); ?>" value="<?php echo $this->options->include_pages(); ?>" />
407
  <div class="pages-selection">
408
  <?php
409
  $objects = $this->get_filter_objects();
@@ -423,7 +439,7 @@
423
  <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="4" <?php echo $this->options->display_pages() == 4 ? 'checked' : ''; ?> />
424
  <span><?php echo __('Exclude in following pages [Use the textbox below to specify the post IDs as a comma separated list.]', 'wpfront-notification-bar'); ?></span>
425
  </label>
426
- <input class="post-id-list" name="<?php echo $this->options->exclude_pages_name(); ?>" value="<?php echo $this->options->exclude_pages(); ?>" />
427
  <div class="pages-selection">
428
  <?php
429
  $objects = $this->get_filter_objects();
@@ -447,7 +463,7 @@
447
  <?php echo $this->options->landingpage_cookie_name_label(); ?>
448
  </th>
449
  <td>
450
- <input class="cookie-name" name="<?php echo $this->options->landingpage_cookie_name_name(); ?>" value="<?php echo $this->options->landingpage_cookie_name(); ?>" />
451
  <span><?php echo __('Cookie name used to mark landing page. Useful when you have multiple WordPress installs under same domain.', 'wpfront-notification-bar'); ?></span>
452
  </td>
453
  </tr>
@@ -520,11 +536,11 @@
520
  <td>
521
  <div class="color-selector-div">
522
  <div class="color-selector" color="<?php echo $this->options->bar_from_color(); ?>"></div>
523
- <input type="text" class="color-value" name="<?php echo $this->options->bar_from_color_name(); ?>" value="<?php echo $this->options->bar_from_color(); ?>" />
524
  </div>
525
  <div class="color-selector-div">
526
  <div class="color-selector" color="<?php echo $this->options->bar_to_color(); ?>"></div>
527
- <input type="text" class="color-value" name="<?php echo $this->options->bar_to_color_name(); ?>" value="<?php echo $this->options->bar_to_color(); ?>" />
528
  </div>
529
  <span class="description"><?php echo __('[Select two different colors to create a gradient.]', 'wpfront-notification-bar'); ?></span>
530
  </td>
@@ -535,7 +551,7 @@
535
  </th>
536
  <td>
537
  <div class="color-selector" color="<?php echo $this->options->message_color(); ?>"></div>
538
- <input type="text" class="color-value" name="<?php echo $this->options->message_color_name(); ?>" value="<?php echo $this->options->message_color(); ?>" />
539
  </td>
540
  </tr>
541
  <tr>
@@ -545,11 +561,11 @@
545
  <td>
546
  <div class="color-selector-div">
547
  <div class="color-selector" color="<?php echo $this->options->button_from_color(); ?>"></div>
548
- <input type="text" class="color-value" name="<?php echo $this->options->button_from_color_name(); ?>" value="<?php echo $this->options->button_from_color(); ?>" />
549
  </div>
550
  <div class="color-selector-div">
551
  <div class="color-selector" color="<?php echo $this->options->button_to_color(); ?>"></div>
552
- <input type="text" class="color-value" name="<?php echo $this->options->button_to_color_name(); ?>" value="<?php echo $this->options->button_to_color(); ?>" />
553
  </div>
554
  <span class="description"><?php echo __('[Select two different colors to create a gradient.]', 'wpfront-notification-bar'); ?></span>
555
  </td>
@@ -560,7 +576,7 @@
560
  </th>
561
  <td>
562
  <div class="color-selector" color="<?php echo $this->options->button_text_color(); ?>"></div>
563
- <input type="text" class="color-value" name="<?php echo $this->options->button_text_color_name(); ?>" value="<?php echo $this->options->button_text_color(); ?>" />
564
  </td>
565
  </tr>
566
  <tr>
@@ -569,7 +585,7 @@
569
  </th>
570
  <td>
571
  <div class="color-selector" color="<?php echo $this->options->open_button_color(); ?>"></div>
572
- <input type="text" class="color-value" name="<?php echo $this->options->open_button_color_name(); ?>" value="<?php echo $this->options->open_button_color(); ?>" />
573
  </td>
574
  </tr>
575
  <tr>
@@ -579,15 +595,15 @@
579
  <td>
580
  <div class="color-selector-div">
581
  <div class="color-selector" color="<?php echo $this->options->close_button_color(); ?>"></div>
582
- <input type="text" class="color-value" name="<?php echo $this->options->close_button_color_name(); ?>" value="<?php echo $this->options->close_button_color(); ?>" />
583
  </div>
584
  <div class="color-selector-div">
585
  <div class="color-selector" color="<?php echo $this->options->close_button_color_hover(); ?>"></div>
586
- <input type="text" class="color-value" name="<?php echo $this->options->close_button_color_hover_name(); ?>" value="<?php echo $this->options->close_button_color_hover(); ?>" />
587
  </div>
588
  <div class="color-selector-div">
589
  <div class="color-selector" color="<?php echo $this->options->close_button_color_x(); ?>"></div>
590
- <input type="text" class="color-value" name="<?php echo $this->options->close_button_color_x_name(); ?>" value="<?php echo $this->options->close_button_color_x(); ?>" />
591
  </div>
592
  <span class="description"><?php echo __('[Normal, Hover, X]', 'wpfront-notification-bar'); ?></span>
593
  </td>
121
  <?php echo $this->options->display_scroll_offset_label(); ?>
122
  </th>
123
  <td>
124
+ <input class="seconds" name="<?php echo $this->options->display_scroll_offset_name(); ?>" value="<?php echo esc_attr($this->options->display_scroll_offset()); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Number of pixels to be scrolled before the bar appears.', 'wpfront-notification-bar'); ?>]</span>
125
  </td>
126
  </tr>
127
  <tr>
129
  <?php echo $this->options->height_label(); ?>
130
  </th>
131
  <td>
132
+ <input class="seconds" name="<?php echo $this->options->height_name(); ?>" value="<?php echo esc_attr($this->options->height()); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0px to auto fit contents.', 'wpfront-notification-bar'); ?>]</span>
133
  </td>
134
  </tr>
135
  <tr>
137
  <?php echo $this->options->position_offset_label(); ?>
138
  </th>
139
  <td>
140
+ <input class="seconds" name="<?php echo $this->options->position_offset_name(); ?>" value="<?php echo esc_attr($this->options->position_offset()); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('(Top bar only) If you find the bar overlapping, try increasing this value. (eg. WordPress 3.8 Twenty Fourteen theme, set 48px)', 'wpfront-notification-bar'); ?>]</span>
141
  </td>
142
  </tr>
143
  <tr>
145
  <?php echo $this->options->display_after_label(); ?>
146
  </th>
147
  <td>
148
+ <input class="seconds" name="<?php echo $this->options->display_after_name(); ?>" value="<?php echo esc_attr($this->options->display_after()); ?>" />&#160;<?php echo __('second(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0 second(s) to display immediately. Does not work in "Display on Scroll" mode.', 'wpfront-notification-bar'); ?>]</span>
149
  </td>
150
  </tr>
151
  <tr>
153
  <?php echo $this->options->animate_delay_label(); ?>
154
  </th>
155
  <td>
156
+ <input class="seconds" name="<?php echo $this->options->animate_delay_name(); ?>" value="<?php echo esc_attr($this->options->animate_delay()); ?>" />&#160;<?php echo __('second(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0 second(s) for no animation.', 'wpfront-notification-bar'); ?>]</span>
157
  </td>
158
  </tr>
159
  <tr>
169
  <?php echo $this->options->auto_close_after_label(); ?>
170
  </th>
171
  <td>
172
+ <input class="seconds" name="<?php echo $this->options->auto_close_after_name(); ?>" value="<?php echo esc_attr($this->options->auto_close_after()); ?>" />&#160;<?php echo __('second(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Set 0 second(s) to disable auto close. Do not work in "Display on Scroll" mode.', 'wpfront-notification-bar'); ?>]</span>
173
  </td>
174
  </tr>
175
  <tr>
193
  <?php echo $this->options->reopen_button_image_url_label(); ?>
194
  </th>
195
  <td>
196
+ <input id="reopen-button-image-url" class="url" name="<?php echo $this->options->reopen_button_image_url_name(); ?>" value="<?php echo esc_attr($this->options->reopen_button_image_url()); ?>"/>
197
  <input type="button" id="media-library-button" class="button" value="<?php echo __('Media Library', 'wpfront-notification-bar'); ?>" />
198
  <br />
199
  <span class="description"><?php echo esc_html(__('[Set empty value to use default images.]')); ?></span>
212
  <?php echo $this->options->keep_closed_for_label(); ?>
213
  </th>
214
  <td>
215
+ <input class="seconds" name="<?php echo $this->options->keep_closed_for_name(); ?>" value="<?php echo esc_attr($this->options->keep_closed_for()); ?>" />&#160;<?php echo __('day(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Bar will be kept closed for the number of days specified from last closed date.', 'wpfront-notification-bar'); ?>]</span>
216
  </td>
217
  </tr>
218
  <tr>
220
  <?php echo $this->options->keep_closed_cookie_name_label(); ?>
221
  </th>
222
  <td>
223
+ <input class="cookie-name" name="<?php echo $this->options->keep_closed_cookie_name_name(); ?>" value="<?php echo esc_attr($this->options->keep_closed_cookie_name()); ?>" />
224
  <span><?php echo __('Cookie name used to mark keep closed days. Changing this value will allow you to bypass "Keep Closed For" days and show the notification again.', 'wpfront-notification-bar'); ?></span>
225
  </td>
226
  </tr>
238
  <?php echo $this->options->small_device_width_label(); ?>
239
  </th>
240
  <td>
241
+ <input class="pixels" name="<?php echo $this->options->small_device_width_name(); ?>" value="<?php echo esc_attr($this->options->small_device_width()); ?>" />px
242
  <span class="description"><?php echo __('[Notification bar will be hidden on devices with lesser or equal width.]', 'wpfront-notification-bar'); ?></span>
243
  </td>
244
  </tr>
256
  <?php echo $this->options->small_window_width_label(); ?>
257
  </th>
258
  <td>
259
+ <input class="pixels" name="<?php echo $this->options->small_window_width_name(); ?>" value="<?php echo esc_attr($this->options->small_window_width()); ?>" />px
260
  <span class="description"><?php echo __('[Notification bar will be hidden on browser window with lesser or equal width.]', 'wpfront-notification-bar'); ?></span>
261
  </td>
262
  </tr>
280
  <td>
281
  <textarea rows="5" cols="75" name="<?php echo $this->options->message_name(); ?>"><?php echo esc_textarea($this->options->message()); ?></textarea>
282
  <br />
283
+ <span class="description">[<?php echo esc_html(__('Some HTML tags are allowed. Use the "Preview" fields to see the output text.')); ?> <a href="https://wordpress.org/support/topic/v2-contain-breaking-changes/" target="_blank"><?php echo __('More Info', 'wpfront-notification-bar'); ?></a>]</span>
284
+ </td>
285
+ </tr>
286
+ <tr>
287
+ <th scope="row">
288
+ <?php echo __('Message Text Preview', 'wpfront-notification-bar'); ?>
289
+ </th>
290
+ <td>
291
+ <textarea rows="5" cols="75" readonly="true"><?php echo esc_textarea($this->get_message_text()); ?></textarea>
292
  </td>
293
  </tr>
294
  <tr>
312
  <?php echo $this->options->button_text_label(); ?>
313
  </th>
314
  <td>
315
+ <input name="<?php echo $this->options->button_text_name(); ?>" value="<?php echo esc_attr($this->options->button_text()); ?>" />
316
+ </td>
317
+ </tr>
318
+ <tr>
319
+ <th scope="row">
320
+ <?php echo __('Button Text Preview', 'wpfront-notification-bar'); ?>
321
+ </th>
322
+ <td>
323
+ <input readonly="true" value="<?php echo esc_attr($this->get_button_text()); ?>" />
324
  </td>
325
  </tr>
326
  <tr>
332
  <input type="radio" name="<?php echo $this->options->button_action_name(); ?>" value="1" <?php echo $this->options->button_action() == 1 ? 'checked' : ''; ?> />
333
  <span><?php echo $this->options->button_action_url_label(); ?></span>
334
  </label>
335
+ <input class="URL" name="<?php echo $this->options->button_action_url_name(); ?>" value="<?php echo esc_attr($this->options->button_action_url()); ?>" />
336
  <br />
337
  <label>
338
  <input type="checkbox" name="<?php echo $this->options->button_action_new_tab_name(); ?>" <?php echo $this->options->button_action_new_tab() ? 'checked' : ''; ?> />
383
  <?php echo $this->options->start_date_label(); ?>
384
  </th>
385
  <td>
386
+ <input class="date" name="<?php echo $this->options->start_date_name(); ?>" value="<?php echo esc_attr($this->options->start_date() == NULL ? '' : date('Y-m-d', $this->options->start_date())); ?>" />
387
+ <input class="time" name="<?php echo $this->options->start_time_name(); ?>" value="<?php echo esc_attr($this->options->start_time() == NULL ? '' : date('h:i a', $this->options->start_time())); ?>" />
388
  &#160;
389
  <span class="description"><?php echo __('[YYYY-MM-DD] [hh:mm ap]', 'wpfront-notification-bar'); ?></span>
390
  </td>
394
  <?php echo $this->options->end_date_label(); ?>
395
  </th>
396
  <td>
397
+ <input class="date" name="<?php echo $this->options->end_date_name(); ?>" value="<?php echo esc_attr($this->options->end_date() == NULL ? '' : date('Y-m-d', $this->options->end_date())); ?>" />
398
+ <input class="time" name="<?php echo $this->options->end_time_name(); ?>" value="<?php echo esc_attr($this->options->end_time() == NULL ? '' : date('h:i a', $this->options->end_time())); ?>" />
399
  &#160;
400
  <span class="description"><?php echo __('[YYYY-MM-DD] [hh:mm ap]', 'wpfront-notification-bar'); ?></span>
401
  </td>
419
  <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="3" <?php echo $this->options->display_pages() == 3 ? 'checked' : ''; ?> />
420
  <span><?php echo __('Include in following pages [Use the textbox below to specify the post IDs as a comma separated list.]', 'wpfront-notification-bar'); ?></span>
421
  </label>
422
+ <input class="post-id-list" name="<?php echo $this->options->include_pages_name(); ?>" value="<?php echo esc_attr($this->options->include_pages()); ?>" />
423
  <div class="pages-selection">
424
  <?php
425
  $objects = $this->get_filter_objects();
439
  <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="4" <?php echo $this->options->display_pages() == 4 ? 'checked' : ''; ?> />
440
  <span><?php echo __('Exclude in following pages [Use the textbox below to specify the post IDs as a comma separated list.]', 'wpfront-notification-bar'); ?></span>
441
  </label>
442
+ <input class="post-id-list" name="<?php echo $this->options->exclude_pages_name(); ?>" value="<?php echo esc_attr($this->options->exclude_pages()); ?>" />
443
  <div class="pages-selection">
444
  <?php
445
  $objects = $this->get_filter_objects();
463
  <?php echo $this->options->landingpage_cookie_name_label(); ?>
464
  </th>
465
  <td>
466
+ <input class="cookie-name" name="<?php echo $this->options->landingpage_cookie_name_name(); ?>" value="<?php echo esc_attr($this->options->landingpage_cookie_name()); ?>" />
467
  <span><?php echo __('Cookie name used to mark landing page. Useful when you have multiple WordPress installs under same domain.', 'wpfront-notification-bar'); ?></span>
468
  </td>
469
  </tr>
536
  <td>
537
  <div class="color-selector-div">
538
  <div class="color-selector" color="<?php echo $this->options->bar_from_color(); ?>"></div>
539
+ <input type="text" class="color-value" name="<?php echo $this->options->bar_from_color_name(); ?>" value="<?php echo esc_attr($this->options->bar_from_color()); ?>" />
540
  </div>
541
  <div class="color-selector-div">
542
  <div class="color-selector" color="<?php echo $this->options->bar_to_color(); ?>"></div>
543
+ <input type="text" class="color-value" name="<?php echo $this->options->bar_to_color_name(); ?>" value="<?php echo esc_attr($this->options->bar_to_color()); ?>" />
544
  </div>
545
  <span class="description"><?php echo __('[Select two different colors to create a gradient.]', 'wpfront-notification-bar'); ?></span>
546
  </td>
551
  </th>
552
  <td>
553
  <div class="color-selector" color="<?php echo $this->options->message_color(); ?>"></div>
554
+ <input type="text" class="color-value" name="<?php echo $this->options->message_color_name(); ?>" value="<?php echo esc_attr($this->options->message_color()); ?>" />
555
  </td>
556
  </tr>
557
  <tr>
561
  <td>
562
  <div class="color-selector-div">
563
  <div class="color-selector" color="<?php echo $this->options->button_from_color(); ?>"></div>
564
+ <input type="text" class="color-value" name="<?php echo $this->options->button_from_color_name(); ?>" value="<?php echo esc_attr($this->options->button_from_color()); ?>" />
565
  </div>
566
  <div class="color-selector-div">
567
  <div class="color-selector" color="<?php echo $this->options->button_to_color(); ?>"></div>
568
+ <input type="text" class="color-value" name="<?php echo $this->options->button_to_color_name(); ?>" value="<?php echo esc_attr($this->options->button_to_color()); ?>" />
569
  </div>
570
  <span class="description"><?php echo __('[Select two different colors to create a gradient.]', 'wpfront-notification-bar'); ?></span>
571
  </td>
576
  </th>
577
  <td>
578
  <div class="color-selector" color="<?php echo $this->options->button_text_color(); ?>"></div>
579
+ <input type="text" class="color-value" name="<?php echo $this->options->button_text_color_name(); ?>" value="<?php echo esc_attr($this->options->button_text_color()); ?>" />
580
  </td>
581
  </tr>
582
  <tr>
585
  </th>
586
  <td>
587
  <div class="color-selector" color="<?php echo $this->options->open_button_color(); ?>"></div>
588
+ <input type="text" class="color-value" name="<?php echo $this->options->open_button_color_name(); ?>" value="<?php echo esc_attr($this->options->open_button_color()); ?>" />
589
  </td>
590
  </tr>
591
  <tr>
595
  <td>
596
  <div class="color-selector-div">
597
  <div class="color-selector" color="<?php echo $this->options->close_button_color(); ?>"></div>
598
+ <input type="text" class="color-value" name="<?php echo $this->options->close_button_color_name(); ?>" value="<?php echo esc_attr($this->options->close_button_color()); ?>" />
599
  </div>
600
  <div class="color-selector-div">
601
  <div class="color-selector" color="<?php echo $this->options->close_button_color_hover(); ?>"></div>
602
+ <input type="text" class="color-value" name="<?php echo $this->options->close_button_color_hover_name(); ?>" value="<?php echo esc_attr($this->options->close_button_color_hover()); ?>" />
603
  </div>
604
  <div class="color-selector-div">
605
  <div class="color-selector" color="<?php echo $this->options->close_button_color_x(); ?>"></div>
606
+ <input type="text" class="color-value" name="<?php echo $this->options->close_button_color_x_name(); ?>" value="<?php echo esc_attr($this->options->close_button_color_x()); ?>" />
607
  </div>
608
  <span class="description"><?php echo __('[Normal, Hover, X]', 'wpfront-notification-bar'); ?></span>
609
  </td>
wpfront-notification-bar.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WPFront Notification Bar
4
  * Plugin URI: http://wpfront.com/notification-bar-plugin/
5
  * Description: Easily lets you create a bar on top or bottom to display a notification.
6
- * Version: 2.0.0.07176
7
  * Requires at least: 5.0
8
  * Requires PHP: 7.0
9
  * Author: Syam Mohan
3
  * Plugin Name: WPFront Notification Bar
4
  * Plugin URI: http://wpfront.com/notification-bar-plugin/
5
  * Description: Easily lets you create a bar on top or bottom to display a notification.
6
+ * Version: 2.1.0.08087
7
  * Requires at least: 5.0
8
  * Requires PHP: 7.0
9
  * Author: Syam Mohan