WPFront Notification Bar - Version 3.1.0

Version Description

  • Max views configuration.
  • Enqueue CSS in footer.
  • Reopen button offset.
  • Bug fixes.
Download this release

Release Info

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

Code changes from version 3.0.0 to 3.1.0

classes/class-wpfront-notification-bar-controller.php CHANGED
@@ -72,7 +72,11 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller
72
  } else {
73
  add_action('template_redirect', array($this, 'set_landingpage_cookie'));
74
 
75
- add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
 
 
 
 
76
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
77
  }
78
  }
@@ -149,7 +153,7 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller
149
 
150
  wp_enqueue_script('jquery');
151
 
152
- if ($this->options->keep_closed()) {
153
  wp_enqueue_script('js-cookie', plugins_url('jquery-plugins/js-cookie.min.js', $this->plugin_file), array(), '2.2.1');
154
  }
155
 
@@ -186,7 +190,7 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller
186
  $view->view();
187
  }
188
 
189
- private function custom_css_url() {
190
  return $this->main->custom_css_url();
191
  }
192
 
@@ -239,7 +243,11 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller
239
  'log' => $this->options->debug_mode(),
240
  'id_suffix' => $this->get_html_id_suffix(),
241
  'log_prefix' => $this->get_log_prefix(),
242
- 'theme_sticky_selector' => $this->options->theme_sticky_selector()
 
 
 
 
243
  ));
244
 
245
  $this->write_load_script($json);
@@ -335,7 +343,7 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller
335
 
336
  return $message;
337
  }
338
-
339
  public function message_allowed_html($allowedposttags) {
340
  $allowedposttags['source'] = array('src' => true, 'type' => true);
341
  return $allowedposttags;
@@ -747,16 +755,6 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller
747
  }
748
  }
749
 
750
- public function get_tinymce_css() {
751
- $id = $this->get_entity_id();
752
- $tinymce_css = array();
753
- $tinymce_css[0] = plugins_url("css/wpfront-notification-bar.css", $this->plugin_file) . '?ver=' . WPFront_Notification_Bar::VERSION;
754
- if (!empty($id)) {
755
- $tinymce_css[1] = $this->custom_css_url() . '?ver=' . WPFront_Notification_Bar::VERSION . '.' . $this->options->last_saved() . '&id=' . $id;
756
- }
757
- return implode(',', $tinymce_css);
758
- }
759
-
760
  }
761
 
762
  }
72
  } else {
73
  add_action('template_redirect', array($this, 'set_landingpage_cookie'));
74
 
75
+ if ($this->options->css_enqueue_footer()) {
76
+ add_action('get_footer', array($this, 'enqueue_styles'));
77
+ } else {
78
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
79
+ }
80
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
81
  }
82
  }
153
 
154
  wp_enqueue_script('jquery');
155
 
156
+ if ($this->options->keep_closed() || $this->options->set_max_views()) {
157
  wp_enqueue_script('js-cookie', plugins_url('jquery-plugins/js-cookie.min.js', $this->plugin_file), array(), '2.2.1');
158
  }
159
 
190
  $view->view();
191
  }
192
 
193
+ protected function custom_css_url() {
194
  return $this->main->custom_css_url();
195
  }
196
 
243
  'log' => $this->options->debug_mode(),
244
  'id_suffix' => $this->get_html_id_suffix(),
245
  'log_prefix' => $this->get_log_prefix(),
246
+ 'theme_sticky_selector' => $this->options->theme_sticky_selector(),
247
+ 'set_max_views' => $this->options->set_max_views(),
248
+ 'max_views' => $this->options->max_views(),
249
+ 'max_views_for' => $this->options->max_views_for(),
250
+ 'max_views_cookie' => $this->options->max_views_cookie_name()
251
  ));
252
 
253
  $this->write_load_script($json);
343
 
344
  return $message;
345
  }
346
+
347
  public function message_allowed_html($allowedposttags) {
348
  $allowedposttags['source'] = array('src' => true, 'type' => true);
349
  return $allowedposttags;
755
  }
756
  }
757
 
 
 
 
 
 
 
 
 
 
 
758
  }
759
 
760
  }
classes/class-wpfront-notification-bar-options.php CHANGED
@@ -99,10 +99,17 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Options'))
99
  $this->addOption('small_device_width', 'int', 640, array($this, 'validate_zero_positive'))->label(__('Small Device Max Width', 'wpfront-notification-bar'));
100
  $this->addOption('hide_small_window', 'bit', false)->label(__('Hide on Small Window', 'wpfront-notification-bar'));
101
  $this->addOption('small_window_width', 'int', 640, array($this, 'validate_zero_positive'))->label(__('Small Window Max Width', 'wpfront-notification-bar'));
102
- $this->addOption('attach_on_shutdown', 'bit', false)->label(__('Attach on Shutdown', 'wpfront-notification-bar'));
103
  $this->addOption('last_saved', 'string', '0');
104
  $this->addOption('custom_class', 'string', '')->label(__('Custom CSS Class', 'wpfront-notification-bar'));
105
  $this->addOption('theme_sticky_selector', 'string', '')->label(__('Theme Sticky Selector', 'wpfront-notification-bar'));
 
 
 
 
 
 
 
106
  }
107
 
108
  //validation function
@@ -199,6 +206,16 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Options'))
199
 
200
  return $arg;
201
  }
 
 
 
 
 
 
 
 
 
 
202
 
203
  protected function validate_include_exclude_pages($pages) {
204
  if (strpos($pages, '.') === false) {
99
  $this->addOption('small_device_width', 'int', 640, array($this, 'validate_zero_positive'))->label(__('Small Device Max Width', 'wpfront-notification-bar'));
100
  $this->addOption('hide_small_window', 'bit', false)->label(__('Hide on Small Window', 'wpfront-notification-bar'));
101
  $this->addOption('small_window_width', 'int', 640, array($this, 'validate_zero_positive'))->label(__('Small Window Max Width', 'wpfront-notification-bar'));
102
+ $this->addOption('attach_on_shutdown', 'bit', false)->label(__('Attach on Shutdown', 'wpfront-notification-bar'));
103
  $this->addOption('last_saved', 'string', '0');
104
  $this->addOption('custom_class', 'string', '')->label(__('Custom CSS Class', 'wpfront-notification-bar'));
105
  $this->addOption('theme_sticky_selector', 'string', '')->label(__('Theme Sticky Selector', 'wpfront-notification-bar'));
106
+ $this->addOption('reopen_button_offset', 'int', 0, array($this, 'validate_zero_positive'))->label(__('Reopen Button Offset', 'wpfront-notification-bar'));
107
+ $this->addOption('set_max_views', 'bit', false)->label(__('Set Max Views', 'wpfront-notification-bar'));
108
+ $this->addOption('max_views', 'int', 0, array($this, 'validate_zero_positive'))->label(__('Max Views', 'wpfront-notification-bar'));
109
+ $this->addOption('max_views_for', 'int', 0, array($this, 'validate_zero_positive'))->label(__('Max Views For', 'wpfront-notification-bar'));
110
+ $this->addOption('max_views_cookie_name', 'string', 'wpfront-notification-bar-max-views' . $this->get_time(), array($this, 'validate_max_views_cookie_name'))->label(__('Max Views Cookie Name', 'wpfront-notification-bar'));
111
+ $this->addOption('css_enqueue_footer', 'bit', false)->label(__('Enqueue in Footer', 'wpfront-notification-bar'));
112
+
113
  }
114
 
115
  //validation function
206
 
207
  return $arg;
208
  }
209
+
210
+ protected function validate_max_views_cookie_name($arg) {
211
+ $arg = sanitize_key($arg);
212
+
213
+ if (trim($arg) == '') {
214
+ return 'wpfront-notification-bar-max-views';
215
+ }
216
+
217
+ return $arg;
218
+ }
219
 
220
  protected function validate_include_exclude_pages($pages) {
221
  if (strpos($pages, '.') === false) {
classes/class-wpfront-notification-bar.php CHANGED
@@ -41,7 +41,7 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar')) {
41
  class WPFront_Notification_Bar {
42
 
43
  //Constants
44
- const VERSION = '3.0.0.112112';
45
  const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
46
  const OPTION_NAME = 'wpfront-notification-bar-options';
47
  const PLUGIN_SLUG = 'wpfront-notification-bar';
@@ -219,7 +219,7 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar')) {
219
  $template->write($controller);
220
  }
221
  }
222
-
223
  exit();
224
  }
225
 
41
  class WPFront_Notification_Bar {
42
 
43
  //Constants
44
+ const VERSION = '3.1.0.120613';
45
  const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
46
  const OPTION_NAME = 'wpfront-notification-bar-options';
47
  const PLUGIN_SLUG = 'wpfront-notification-bar';
219
  $template->write($controller);
220
  }
221
  }
222
+
223
  exit();
224
  }
225
 
js/wpfront-notification-bar.js CHANGED
@@ -13,14 +13,13 @@
13
  (function () {
14
  //displays the notification bar
15
  window.wpfront_notification_bar = function (data, process) {
16
-
17
  var log = function (msg) {
18
  if (data.log) {
19
  console.log(data.log_prefix + msg);
20
  }
21
  };
22
 
23
- if (typeof jQuery !== "function" || (data.keep_closed && typeof Cookies !== "function")) {
24
  log('Waiting for ' + (typeof jQuery !== "function" ? 'jQuery.' : 'Cookies.'));
25
  setTimeout(function () {
26
  wpfront_notification_bar(data, process);
@@ -43,6 +42,9 @@
43
 
44
  var keep_closed_cookie = data.keep_closed_cookie;
45
 
 
 
 
46
  var spacer = $(get_element_id("#wpfront-notification-bar-spacer")).removeClass('hidden');
47
  var bar = $(get_element_id("#wpfront-notification-bar"));
48
  var open_button = $(get_element_id("#wpfront-notification-bar-open-button"));
@@ -137,6 +139,21 @@
137
  Cookies.set(keep_closed_cookie, 1, {path: "/"});
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  var fn = callback;
141
  callback = function () {
142
  fn();
@@ -193,9 +210,9 @@
193
  }
194
  }
195
 
196
- var theme_sticky_selector_top = null;
197
  var theme_sticky_interval_id = 0;
198
- var handle_theme_sticky_needed = data.fixed_position && data.position == 1 && data.theme_sticky_selector != "";
199
  function handle_theme_sticky(recursive) {
200
  if (!handle_theme_sticky_needed) {
201
  return 0;
@@ -221,16 +238,28 @@
221
  return 0;
222
  }
223
 
224
- if (theme_sticky_selector_top === null) {
225
- theme_sticky_selector_top = $(data.theme_sticky_selector).position().top;
 
 
 
 
 
 
 
226
  }
227
-
228
- if (bar.is(":visible")) {
229
- $(data.theme_sticky_selector).css("top", (bar.height() + bar.position().top) + "px");
230
- } else {
231
- $(data.theme_sticky_selector).css("top", theme_sticky_selector_top + "px");
 
 
 
 
 
232
  }
233
-
234
  }
235
 
236
  if (handle_theme_sticky_needed) {
@@ -258,6 +287,7 @@
258
  });
259
  }
260
 
 
261
  if (data.keep_closed) {
262
  if (Cookies.get(keep_closed_cookie)) {
263
  log('Keep closed enabled and keep closed cookie exists. Hiding notification bar.');
@@ -266,6 +296,18 @@
266
  }
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  closed = true;
270
 
271
  if (data.display_scroll) {
13
  (function () {
14
  //displays the notification bar
15
  window.wpfront_notification_bar = function (data, process) {
 
16
  var log = function (msg) {
17
  if (data.log) {
18
  console.log(data.log_prefix + msg);
19
  }
20
  };
21
 
22
+ if (typeof jQuery !== "function" || (data.keep_closed && typeof Cookies !== "function") || (data.set_max_views && typeof Cookies !== "function")) {
23
  log('Waiting for ' + (typeof jQuery !== "function" ? 'jQuery.' : 'Cookies.'));
24
  setTimeout(function () {
25
  wpfront_notification_bar(data, process);
42
 
43
  var keep_closed_cookie = data.keep_closed_cookie;
44
 
45
+ var bar_views = 0;
46
+ var max_views_cookie = data.max_views_cookie;
47
+
48
  var spacer = $(get_element_id("#wpfront-notification-bar-spacer")).removeClass('hidden');
49
  var bar = $(get_element_id("#wpfront-notification-bar"));
50
  var open_button = $(get_element_id("#wpfront-notification-bar-open-button"));
139
  Cookies.set(keep_closed_cookie, 1, {path: "/"});
140
  }
141
 
142
+ if (height !== 0 && data.set_max_views) {
143
+ bar_views = Cookies.get(max_views_cookie);
144
+ if (typeof bar_views === "undefined") {
145
+ bar_views = 0;
146
+ } else {
147
+ bar_views = parseInt(bar_views);
148
+ }
149
+ if (data.max_views_for > 0) {
150
+ Cookies.set(max_views_cookie, bar_views + 1, {path: "/", expires: data.max_views_for});
151
+ } else {
152
+ Cookies.set(max_views_cookie, bar_views + 1, {path: "/"});
153
+ }
154
+ log('Setting view count to ' + (bar_views + 1) + '.');
155
+ }
156
+
157
  var fn = callback;
158
  callback = function () {
159
  fn();
210
  }
211
  }
212
 
213
+ var theme_sticky_selector_position = null;
214
  var theme_sticky_interval_id = 0;
215
+ var handle_theme_sticky_needed = data.fixed_position && data.theme_sticky_selector != "";
216
  function handle_theme_sticky(recursive) {
217
  if (!handle_theme_sticky_needed) {
218
  return 0;
238
  return 0;
239
  }
240
 
241
+ if (data.position == 1) {
242
+ if (theme_sticky_selector_position === null) {
243
+ theme_sticky_selector_position = $(data.theme_sticky_selector).position().top;
244
+ }
245
+ if (bar.is(":visible")) {
246
+ $(data.theme_sticky_selector).css("top", (bar.height() + bar.position().top) + "px");
247
+ } else {
248
+ $(data.theme_sticky_selector).css("top", theme_sticky_selector_position + "px");
249
+ }
250
  }
251
+
252
+ if (data.position == 2) {
253
+ if (theme_sticky_selector_position === null) {
254
+ theme_sticky_selector_position = $(data.theme_sticky_selector).height() + parseFloat($(data.theme_sticky_selector).css("bottom"));
255
+ }
256
+ if (bar.is(":visible")) {
257
+ $(data.theme_sticky_selector).css("bottom", (bar.height() + parseFloat(bar.css("bottom"))) + "px");
258
+ } else {
259
+ $(data.theme_sticky_selector).css("bottom", theme_sticky_selector_position + "px");
260
+ }
261
  }
262
+
263
  }
264
 
265
  if (handle_theme_sticky_needed) {
287
  });
288
  }
289
 
290
+
291
  if (data.keep_closed) {
292
  if (Cookies.get(keep_closed_cookie)) {
293
  log('Keep closed enabled and keep closed cookie exists. Hiding notification bar.');
296
  }
297
  }
298
 
299
+ if (data.set_max_views) {
300
+ bar_views = Cookies.get(max_views_cookie);
301
+ if (typeof bar_views === "undefined") {
302
+ bar_views = 0;
303
+ }
304
+ if (bar_views >= data.max_views) {
305
+ log('Reached max views, hiding notification bar.');
306
+ setHeight(0);
307
+ return;
308
+ }
309
+ }
310
+
311
  closed = true;
312
 
313
  if (data.display_scroll) {
js/wpfront-notification-bar.min.js CHANGED
@@ -1,8 +1,9 @@
1
- (function(){window.wpfront_notification_bar=function(a,u){function f(g,b,e){b=b||d.noop;e&&(v=!0);if(0==g){if(l)return;l=!0}else{if(!l)return;l=!1}0==g&&a.keep_closed&&e&&(0<a.keep_closed_for?Cookies.set(q,1,{path:"/",expires:a.keep_closed_for}):Cookies.set(q,1,{path:"/"}));var f=b;b=function(){f();0<g&&(0==a.height&&k.height("auto"),a.display_open_button&&(h("Setting reopen button state to hidden."),n.addClass("hidden")),l=!1);0==g&&a.display_open_button&&(h("Setting reopen button state to visible."),
2
- n.removeClass("hidden"))};0<g?h("Setting notification bar state to visible."):h("Setting notification bar state to hidden.");0<a.animate_delay?k.stop().animate({height:g+"px"},{duration:1E3*a.animate_delay,easing:"swing",complete:function(){a.fixed_position&&c.height(g);m(g);b()},step:function(b){a.fixed_position&&c.height(b);m(b)}}):(k.height(g),a.fixed_position&&c.height(g),m(g),b())}function m(b){if(!w)return 0;if(!0!==b){clearInterval(r);var c=0;r=setInterval(function(){m(!0);c++;100<c&&clearInterval(r)},
3
- 10)}if(0==d(a.theme_sticky_selector).length)return 0;null===t&&(t=d(a.theme_sticky_selector).position().top);k.is(":visible")?d(a.theme_sticky_selector).css("top",k.height()+k.position().top+"px"):d(a.theme_sticky_selector).css("top",t+"px")}var h=function(b){a.log&&console.log(a.log_prefix+b)};if("function"!==typeof jQuery||a.keep_closed&&"function"!==typeof Cookies)h("Waiting for "+("function"!==typeof jQuery?"jQuery.":"Cookies.")),setTimeout(function(){wpfront_notification_bar(a,u)},100);else if(2==
4
- a.position&&!0!==u)jQuery(function(){wpfront_notification_bar(a,!0)});else{var d=jQuery,q=a.keep_closed_cookie,c=d("#wpfront-notification-bar-spacer"+a.id_suffix).removeClass("hidden"),k=d("#wpfront-notification-bar"+a.id_suffix),n=d("#wpfront-notification-bar-open-button"+a.id_suffix);if(1==a.position){h("Setting notification bar at top.");var b=0;a.fixed_position&&a.is_admin_bar_showing&&(b=d("html").css("margin-top"),"0px"==b&&(b=d("html").css("padding-top")),b=parseInt(b));a.fixed_position&&(b+=
5
- a.position_offset);k.css("top",b+"px");n.css("top",b+"px");c.css("top",a.position_offset+"px");var e=d("body");b=e.children().first();if(b.hasClass("wpfront-notification-bar-spacer"))for(;;){var x=b.next();if(x.hasClass("wpfront-notification-bar-spacer"))b=x;else{b.after(c);break}}else e.prepend(c);d(function(){e.children().first().hasClass("wpfront-notification-bar-spacer")||a.fixed_position&&!e.children().first().is(c)&&e.prepend(c)})}else h("Setting notification bar at bottom."),e=d("body"),e.children().last().is(c)||
6
- e.append(c),d(function(){e.children().last().is(c)||e.append(c)});var p=k.height();0<a.height&&(p=a.height,k.find("table, tbody, tr").css("height","100%"));k.height(0).css({position:a.fixed_position?"fixed":"relative",visibility:"visible"});n.css({position:a.fixed_position?"fixed":"absolute"});var l=!1,v=!1,t=null,r=0,w=a.fixed_position&&1==a.position&&""!=a.theme_sticky_selector;if(w)d(window).on("scroll resize",function(){m()});if(a.close_button)c.on("click",".wpfront-close",function(){f(0,null,
7
- !0)});if(a.button_action_close_bar)c.on("click",".wpfront-button",function(){f(0,null,!0)});if(a.display_open_button)c.on("click","#wpfront-notification-bar-open-button"+a.id_suffix,function(){f(p)});a.keep_closed&&Cookies.get(q)?(h("Keep closed enabled and keep closed cookie exists. Hiding notification bar."),f(0)):(l=!0,a.display_scroll?(h("Display on scroll enabled. Hiding notification bar."),f(0),d(window).on("scroll",function(){v||(d(this).scrollTop()>a.display_scroll_offset?f(p):f(0))})):(h("Setting notification bar open event after "+
8
- a.display_after+" second(s)."),setTimeout(function(){f(p,function(){0<a.auto_close_after&&(h("Setting notification bar auto close event after "+a.auto_close_after+" second(s)."),setTimeout(function(){f(0,null,!0)},1E3*a.auto_close_after))})},1E3*a.display_after)))}}})();
 
1
+ 'use strict';(function(){window.wpfront_notification_bar=function(a,x){function k(c,m,y){m=m||b.noop;y&&(z=!0);if(0==c){if(n)return;n=!0}else{if(!n)return;n=!1}0==c&&a.keep_closed&&y&&(0<a.keep_closed_for?Cookies.set(v,1,{path:"/",expires:a.keep_closed_for}):Cookies.set(v,1,{path:"/"}));0!==c&&a.set_max_views&&(h=Cookies.get(r),h="undefined"===typeof h?0:parseInt(h),0<a.max_views_for?Cookies.set(r,h+1,{path:"/",expires:a.max_views_for}):Cookies.set(r,h+1,{path:"/"}),e("Setting view count to "+(h+
2
+ 1)+"."));var D=m;m=function(){D();0<c&&(0==a.height&&f.height("auto"),a.display_open_button&&(e("Setting reopen button state to hidden."),t.addClass("hidden")),n=!1);0==c&&a.display_open_button&&(e("Setting reopen button state to visible."),t.removeClass("hidden"))};0<c?e("Setting notification bar state to visible."):e("Setting notification bar state to hidden.");0<a.animate_delay?f.stop().animate({height:c+"px"},{duration:1E3*a.animate_delay,easing:"swing",complete:function(){a.fixed_position&&d.height(c);
3
+ q(c);m()},step:function(A){a.fixed_position&&d.height(A);q(A)}}):(f.height(c),a.fixed_position&&d.height(c),q(c),m())}function q(c){if(!B)return 0;if(!0!==c){clearInterval(w);var m=0;w=setInterval(function(){q(!0);m++;100<m&&clearInterval(w)},10)}if(0==b(a.theme_sticky_selector).length)return 0;1==a.position&&(null===p&&(p=b(a.theme_sticky_selector).position().top),f.is(":visible")?b(a.theme_sticky_selector).css("top",f.height()+f.position().top+"px"):b(a.theme_sticky_selector).css("top",p+"px"));
4
+ 2==a.position&&(null===p&&(p=b(a.theme_sticky_selector).height()+parseFloat(b(a.theme_sticky_selector).css("bottom"))),f.is(":visible")?b(a.theme_sticky_selector).css("bottom",f.height()+parseFloat(f.css("bottom"))+"px"):b(a.theme_sticky_selector).css("bottom",p+"px"))}var e=function(c){a.log&&console.log(a.log_prefix+c)};if("function"!==typeof jQuery||a.keep_closed&&"function"!==typeof Cookies||a.set_max_views&&"function"!==typeof Cookies)e("Waiting for "+("function"!==typeof jQuery?"jQuery.":"Cookies.")),
5
+ setTimeout(function(){wpfront_notification_bar(a,x)},100);else if(2==a.position&&!0!==x)jQuery(function(){wpfront_notification_bar(a,!0)});else{var b=jQuery,v=a.keep_closed_cookie,h=0,r=a.max_views_cookie,d=b("#wpfront-notification-bar-spacer"+a.id_suffix).removeClass("hidden"),f=b("#wpfront-notification-bar"+a.id_suffix),t=b("#wpfront-notification-bar-open-button"+a.id_suffix);if(1==a.position){e("Setting notification bar at top.");var g=0;a.fixed_position&&a.is_admin_bar_showing&&(g=b("html").css("margin-top"),
6
+ "0px"==g&&(g=b("html").css("padding-top")),g=parseInt(g));a.fixed_position&&(g+=a.position_offset);f.css("top",g+"px");t.css("top",g+"px");d.css("top",a.position_offset+"px");var l=b("body");g=l.children().first();if(g.hasClass("wpfront-notification-bar-spacer"))for(;;){var C=g.next();if(C.hasClass("wpfront-notification-bar-spacer"))g=C;else{g.after(d);break}}else l.prepend(d);b(function(){l.children().first().hasClass("wpfront-notification-bar-spacer")||a.fixed_position&&!l.children().first().is(d)&&
7
+ l.prepend(d)})}else e("Setting notification bar at bottom."),l=b("body"),l.children().last().is(d)||l.append(d),b(function(){l.children().last().is(d)||l.append(d)});var u=f.height();0<a.height&&(u=a.height,f.find("table, tbody, tr").css("height","100%"));f.height(0).css({position:a.fixed_position?"fixed":"relative",visibility:"visible"});t.css({position:a.fixed_position?"fixed":"absolute"});var n=!1,z=!1,p=null,w=0,B=a.fixed_position&&""!=a.theme_sticky_selector;if(B)b(window).on("scroll resize",
8
+ function(){q()});if(a.close_button)d.on("click",".wpfront-close",function(){k(0,null,!0)});if(a.button_action_close_bar)d.on("click",".wpfront-button",function(){k(0,null,!0)});if(a.display_open_button)d.on("click","#wpfront-notification-bar-open-button"+a.id_suffix,function(){k(u)});if(a.keep_closed&&Cookies.get(v))e("Keep closed enabled and keep closed cookie exists. Hiding notification bar."),k(0);else{if(a.set_max_views&&(h=Cookies.get(r),"undefined"===typeof h&&(h=0),h>=a.max_views)){e("Reached max views, hiding notification bar.");
9
+ k(0);return}n=!0;a.display_scroll?(e("Display on scroll enabled. Hiding notification bar."),k(0),b(window).on("scroll",function(){z||(b(this).scrollTop()>a.display_scroll_offset?k(u):k(0))})):(e("Setting notification bar open event after "+a.display_after+" second(s)."),setTimeout(function(){k(u,function(){0<a.auto_close_after&&(e("Setting notification bar auto close event after "+a.auto_close_after+" second(s)."),setTimeout(function(){k(0,null,!0)},1E3*a.auto_close_after))})},1E3*a.display_after))}}}})();
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.2
7
  Requires PHP: 7.0
8
- Stable tag: 3.0.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -70,6 +70,12 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
 
73
  = 3.0.0 =
74
  * [Create multiple bars](http://wpfront.com/notification-bar-pro/)(PRO).
75
  * TinyMCE editor.
@@ -183,6 +189,9 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
183
 
184
  == Upgrade Notice ==
185
 
 
 
 
186
  = 3.0.0 =
187
  * TinyMCE editor.
188
 
5
  Requires at least: 5.0
6
  Tested up to: 5.8.2
7
  Requires PHP: 7.0
8
+ Stable tag: 3.1.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
70
 
71
  == Changelog ==
72
 
73
+ = 3.1.0 =
74
+ * Max views configuration.
75
+ * Enqueue CSS in footer.
76
+ * Reopen button offset.
77
+ * Bug fixes.
78
+
79
  = 3.0.0 =
80
  * [Create multiple bars](http://wpfront.com/notification-bar-pro/)(PRO).
81
  * TinyMCE editor.
189
 
190
  == Upgrade Notice ==
191
 
192
+ = 3.1.0 =
193
+ * Bug fixes.
194
+
195
  = 3.0.0 =
196
  * TinyMCE editor.
197
 
templates/template-wpfront-notification-bar-add-edit.php CHANGED
@@ -271,6 +271,14 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Add_Edit_V
271
  <span class="description"><?php echo esc_html(__('[Set empty value to use default images.]')); ?></span>
272
  </td>
273
  </tr>
 
 
 
 
 
 
 
 
274
  <tr>
275
  <th scope="row">
276
  <?php echo $this->options->keep_closed_label(); ?>
@@ -296,6 +304,39 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Add_Edit_V
296
  <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>
297
  </td>
298
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  <tr>
300
  <th scope="row">
301
  <?php echo $this->options->hide_small_device_label(); ?>
@@ -731,6 +772,14 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Add_Edit_V
731
  <textarea name="<?php echo $this->options->custom_css_name(); ?>" rows="10" cols="75"><?php echo esc_textarea($this->options->custom_css()); ?></textarea>
732
  </td>
733
  </tr>
 
 
 
 
 
 
 
 
734
  </table>
735
  <?php
736
  }
271
  <span class="description"><?php echo esc_html(__('[Set empty value to use default images.]')); ?></span>
272
  </td>
273
  </tr>
274
+ <tr>
275
+ <th scope="row">
276
+ <?php echo $this->options->reopen_button_offset_label(); ?>
277
+ </th>
278
+ <td>
279
+ <input class="seconds" name="<?php echo $this->options->reopen_button_offset_name(); ?>" value="<?php echo esc_attr($this->options->reopen_button_offset()); ?>" />&#160;<?php echo __('px', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Moves the button more to the left.', 'wpfront-notification-bar'); ?>]</span>
280
+ </td>
281
+ </tr>
282
  <tr>
283
  <th scope="row">
284
  <?php echo $this->options->keep_closed_label(); ?>
304
  <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>
305
  </td>
306
  </tr>
307
+ <tr>
308
+ <th scope="row">
309
+ <?php echo $this->options->set_max_views_label(); ?>
310
+ </th>
311
+ <td>
312
+ <input type="checkbox" name="<?php echo $this->options->set_max_views_name(); ?>" <?php echo $this->options->set_max_views() ? 'checked' : ''; ?> />&#160;<span class="description">[<?php echo __('Bar will be hidden after a certain number of views.', 'wpfront-notification-bar'); ?>]</span>
313
+ </td>
314
+ </tr>
315
+ <tr>
316
+ <th scope="row">
317
+ <?php echo $this->options->max_views_label(); ?>
318
+ </th>
319
+ <td>
320
+ <input class="seconds" name="<?php echo $this->options->max_views_name(); ?>" value="<?php echo esc_attr($this->options->max_views()); ?>" />&#160;<?php echo __('times(s)', 'wpfront-notification-bar'); ?>&#160;<span class="description">[<?php echo __('Maximum number of views.', 'wpfront-notification-bar'); ?>]</span>
321
+ </td>
322
+ </tr>
323
+ <tr>
324
+ <th scope="row">
325
+ <?php echo $this->options->max_views_for_label(); ?>
326
+ </th>
327
+ <td>
328
+ <input class="seconds" name="<?php echo $this->options->max_views_for_name(); ?>" value="<?php echo esc_attr($this->options->max_views_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. Zero means current session.', 'wpfront-notification-bar'); ?>]</span>
329
+ </td>
330
+ </tr>
331
+ <tr>
332
+ <th scope="row">
333
+ <?php echo $this->options->max_views_cookie_name_label(); ?>
334
+ </th>
335
+ <td>
336
+ <input class="cookie-name" name="<?php echo $this->options->max_views_cookie_name_name(); ?>" value="<?php echo esc_attr($this->options->max_views_cookie_name()); ?>" />
337
+ <span><?php echo __('Cookie name used to store view count.', 'wpfront-notification-bar'); ?></span>
338
+ </td>
339
+ </tr>
340
  <tr>
341
  <th scope="row">
342
  <?php echo $this->options->hide_small_device_label(); ?>
772
  <textarea name="<?php echo $this->options->custom_css_name(); ?>" rows="10" cols="75"><?php echo esc_textarea($this->options->custom_css()); ?></textarea>
773
  </td>
774
  </tr>
775
+ <tr>
776
+ <th scope="row">
777
+ <?php echo $this->options->css_enqueue_footer_label(); ?>
778
+ </th>
779
+ <td>
780
+ <input type="checkbox" name="<?php echo $this->options->css_enqueue_footer_name(); ?>" <?php echo $this->options->css_enqueue_footer() ? 'checked' : ''; ?> />&#160;<span class="description">[<?php echo __('Enqueue CSS in footer.', 'wpfront-notification-bar'); ?>]</span>
781
+ </td>
782
+ </tr>
783
  </table>
784
  <?php
785
  }
templates/template-wpfront-notification-bar-custom-css.php CHANGED
@@ -130,6 +130,7 @@ if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Custom_Css
130
  ?>
131
  {
132
  background-color: <?php echo $this->options->open_button_color(); ?>;
 
133
  <?php
134
  if (!empty($this->options->reopen_button_image_url())) {
135
  echo "background-image: url({$this->options->reopen_button_image_url()});";
130
  ?>
131
  {
132
  background-color: <?php echo $this->options->open_button_color(); ?>;
133
+ right: <?php echo 10 + $this->options->reopen_button_offset(); ?>px;
134
  <?php
135
  if (!empty($this->options->reopen_button_image_url())) {
136
  echo "background-image: url({$this->options->reopen_button_image_url()});";
wpfront-notification-bar.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WPFront Notification Bar
4
  * Plugin URI: http://wpfront.com/notification-bar-pro/
5
  * Description: Easily lets you create a bar on top or bottom to display a notification.
6
- * Version: 3.0.0.112112
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-pro/
5
  * Description: Easily lets you create a bar on top or bottom to display a notification.
6
+ * Version: 3.1.0.120613
7
  * Requires at least: 5.0
8
  * Requires PHP: 7.0
9
  * Author: Syam Mohan