WPFront Notification Bar - Version 1.7.1

Version Description

  • Processes shortcode in button text.
  • Notification bar menu is now under 'Settings' menu.
  • PHP 7.2 compatibility fixes.
  • Bug fixes.
Download this release

Release Info

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

Code changes from version 1.7 to 1.7.1

classes/base/class-wpfront-base.php CHANGED
@@ -102,7 +102,7 @@ if (!class_exists('WPFront_Base')) {
102
 
103
  public function action_links($links, $file) {
104
  if ($file == $this->plugin_slug . '/' . $this->plugin_slug . '.php') {
105
- $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=' . $this->options_page_slug . '">' . $this->__('Settings') . '</a>';
106
  array_unshift($links, $settings_link);
107
  }
108
  return $links;
102
 
103
  public function action_links($links, $file) {
104
  if ($file == $this->plugin_slug . '/' . $this->plugin_slug . '.php') {
105
+ $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . $this->options_page_slug . '">' . $this->__('Settings') . '</a>';
106
  array_unshift($links, $settings_link);
107
  }
108
  return $links;
classes/base/class-wpfront-options-base.php CHANGED
@@ -65,25 +65,25 @@ if (!class_exists('WPFront_Options_Base')) {
65
  $this->__data[$name]['validate'] = isset($validate) ? $validate : array(&$this, 'validate_default');
66
 
67
  //dynamic function returning option value
68
- $this->__data[$name]['func'] = create_function('$self, $data', '
69
  $value = NULL;
70
  if(array_key_exists($data["name"], $self->__options))
71
  $value = $self->__options[$data["name"]];
72
  return $self->get_value($data["type"], $value, $data["default"], $data["validate"]);
73
- ');
74
 
75
  $this->__data[$name . '_name'] = $this->__data[$name];
76
  //dynamic function returning option name for settings page
77
- $this->__data[$name . '_name']['func'] = create_function('$self, $data', '
78
  return $self->__optionName . "[" . $data["name"] . "]";
79
- ');
80
 
81
  $this->__data[$name . '_label'] = $this->__data[$name];
82
 
83
  //dynamic function returning option label for settings page
84
- $this->__data[$name . '_label']['func'] = create_function('$self, $data', '
85
  return __($data["label"], $self->__localizeSlug);
86
- ');
87
 
88
  $this->lastOptionName = $name;
89
  array_push($this->optionNames, $name);
65
  $this->__data[$name]['validate'] = isset($validate) ? $validate : array(&$this, 'validate_default');
66
 
67
  //dynamic function returning option value
68
+ $this->__data[$name]['func'] = function($self, $data) {
69
  $value = NULL;
70
  if(array_key_exists($data["name"], $self->__options))
71
  $value = $self->__options[$data["name"]];
72
  return $self->get_value($data["type"], $value, $data["default"], $data["validate"]);
73
+ };
74
 
75
  $this->__data[$name . '_name'] = $this->__data[$name];
76
  //dynamic function returning option name for settings page
77
+ $this->__data[$name . '_name']['func'] = function($self, $data) {
78
  return $self->__optionName . "[" . $data["name"] . "]";
79
+ };
80
 
81
  $this->__data[$name . '_label'] = $this->__data[$name];
82
 
83
  //dynamic function returning option label for settings page
84
+ $this->__data[$name . '_label']['func'] = function($self, $data) {
85
  return __($data["label"], $self->__localizeSlug);
86
+ };
87
 
88
  $this->lastOptionName = $name;
89
  array_push($this->optionNames, $name);
classes/class-wpfront-notification-bar.php CHANGED
@@ -36,7 +36,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
36
  class WPFront_Notification_Bar extends WPFront_Base {
37
 
38
  //Constants
39
- const VERSION = '1.7';
40
  const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
41
  const OPTION_NAME = 'wpfront-notification-bar-options';
42
  const PLUGIN_SLUG = 'wpfront-notification-bar';
@@ -55,11 +55,6 @@ if (!class_exists('WPFront_Notification_Bar')) {
55
  parent::__construct(__FILE__, self::PLUGIN_SLUG);
56
 
57
  $this->markupLoaded = FALSE;
58
-
59
- add_action('wp_footer', array(&$this, 'write_markup'));
60
- add_action('shutdown', array(&$this, 'write_markup'));
61
-
62
- $this->add_menu($this->__('WPFront Notification Bar'), $this->__('Notification Bar'));
63
  }
64
 
65
  public function init() {
@@ -68,6 +63,13 @@ if (!class_exists('WPFront_Notification_Bar')) {
68
  setcookie(self::COOKIE_LANDINGPAGE, 1);
69
  }
70
  }
 
 
 
 
 
 
 
71
 
72
  //add scripts
73
  public function enqueue_scripts() {
@@ -81,6 +83,9 @@ if (!class_exists('WPFront_Notification_Bar')) {
81
  wp_enqueue_script('wpfront-notification-bar', $jsRoot . 'wpfront-notification-bar.js', array('jquery'), self::VERSION);
82
 
83
  $this->scriptLoaded = TRUE;
 
 
 
84
  }
85
 
86
  //add styles
@@ -142,10 +147,14 @@ if (!class_exists('WPFront_Notification_Bar')) {
142
  return;
143
  }
144
 
145
- if ($this->scriptLoaded != TRUE) {
146
  return;
147
  }
148
 
 
 
 
 
149
  if ($this->enabled()) {
150
  include($this->pluginDIRRoot . 'templates/notification-bar-template.php');
151
 
@@ -183,6 +192,16 @@ if (!class_exists('WPFront_Notification_Bar')) {
183
 
184
  return $message;
185
  }
 
 
 
 
 
 
 
 
 
 
186
 
187
  protected function get_filter_objects() {
188
  $objects = array();
36
  class WPFront_Notification_Bar extends WPFront_Base {
37
 
38
  //Constants
39
+ const VERSION = '1.7.1';
40
  const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
41
  const OPTION_NAME = 'wpfront-notification-bar-options';
42
  const PLUGIN_SLUG = 'wpfront-notification-bar';
55
  parent::__construct(__FILE__, self::PLUGIN_SLUG);
56
 
57
  $this->markupLoaded = FALSE;
 
 
 
 
 
58
  }
59
 
60
  public function init() {
63
  setcookie(self::COOKIE_LANDINGPAGE, 1);
64
  }
65
  }
66
+
67
+ public function admin_menu() {
68
+ $page_hook_suffix = add_options_page($this->__('WPFront Notification Bar'), $this->__('Notification Bar'), 'manage_options', self::PLUGIN_SLUG, array($this, 'options_page'));
69
+
70
+ add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_options_scripts'));
71
+ add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_options_styles'));
72
+ }
73
 
74
  //add scripts
75
  public function enqueue_scripts() {
83
  wp_enqueue_script('wpfront-notification-bar', $jsRoot . 'wpfront-notification-bar.js', array('jquery'), self::VERSION);
84
 
85
  $this->scriptLoaded = TRUE;
86
+
87
+ add_action('wp_footer', array(&$this, 'write_markup'));
88
+ add_action('shutdown', array(&$this, 'write_markup'));
89
  }
90
 
91
  //add styles
147
  return;
148
  }
149
 
150
+ if (!$this->scriptLoaded) {
151
  return;
152
  }
153
 
154
+ if(WPFront_Static::doing_ajax()) {
155
+ return;
156
+ }
157
+
158
  if ($this->enabled()) {
159
  include($this->pluginDIRRoot . 'templates/notification-bar-template.php');
160
 
192
 
193
  return $message;
194
  }
195
+
196
+ protected function get_button_text() {
197
+ $text = $this->options->button_text();
198
+
199
+ if ($this->options->message_process_shortcode()) {
200
+ $text = do_shortcode($text);
201
+ }
202
+
203
+ return $text;
204
+ }
205
 
206
  protected function get_filter_objects() {
207
  $objects = array();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpfront.com/donate/
4
  Tags: notification bar, wordpress notification bar, top bar, bottom bar, notification, bar, quick bar, fixed bar, sticky bar, message bar, message, floating bar, notice, sticky header, special offer, discount offer, offer, important, attention bar, highlight bar, popup bar, hellobar, heads up, heads up bar, headsup, headsupbar, popup, Toolbar
5
  Requires at least: 4.0
6
  Tested up to: 4.9
7
- Stable tag: 1.7
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -68,6 +68,12 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
71
  = 1.7 =
72
  * Start and End times.
73
 
@@ -118,6 +124,9 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
118
 
119
  == Upgrade Notice ==
120
 
 
 
 
121
  = 1.7 =
122
  * Start and End times.
123
 
4
  Tags: notification bar, wordpress notification bar, top bar, bottom bar, notification, bar, quick bar, fixed bar, sticky bar, message bar, message, floating bar, notice, sticky header, special offer, discount offer, offer, important, attention bar, highlight bar, popup bar, hellobar, heads up, heads up bar, headsup, headsupbar, popup, Toolbar
5
  Requires at least: 4.0
6
  Tested up to: 4.9
7
+ Stable tag: 1.7.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
68
 
69
  == Changelog ==
70
 
71
+ = 1.7.1 =
72
+ * Processes shortcode in button text.
73
+ * Notification bar menu is now under 'Settings' menu.
74
+ * PHP 7.2 compatibility fixes.
75
+ * Bug fixes.
76
+
77
  = 1.7 =
78
  * Start and End times.
79
 
124
 
125
  == Upgrade Notice ==
126
 
127
+ = 1.7.1 =
128
+ * Bug fixes.
129
+
130
  = 1.7 =
131
  * Start and End times.
132
 
templates/notification-bar-template.php CHANGED
@@ -105,13 +105,16 @@
105
  <?php echo $this->get_message_text(); ?>
106
  </div>
107
  <div>
108
- <?php if ($this->options->display_button()) { ?>
109
- <?php if ($this->options->button_action() == 1) { ?>
110
- <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 $this->options->button_action_url_nofollow() ? 'rel="nofollow"' : ''; ?>><?php echo $this->options->button_text(); ?></a>
111
- <?php } ?>
112
- <?php if ($this->options->button_action() == 2) { ?>
113
- <a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo $this->options->button_text(); ?></a>
114
- <?php } ?>
 
 
 
115
  <?php } ?>
116
  </div>
117
  </td>
105
  <?php echo $this->get_message_text(); ?>
106
  </div>
107
  <div>
108
+ <?php
109
+ if ($this->options->display_button()) {
110
+ $button_text = $this->get_button_text();
111
+ ?>
112
+ <?php if ($this->options->button_action() == 1) { ?>
113
+ <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 $this->options->button_action_url_nofollow() ? 'rel="nofollow"' : ''; ?>><?php echo $button_text; ?></a>
114
+ <?php } ?>
115
+ <?php if ($this->options->button_action() == 2) { ?>
116
+ <a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo $button_text; ?></a>
117
+ <?php } ?>
118
  <?php } ?>
119
  </div>
120
  </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: 1.7
7
  * Author: Syam Mohan
8
  * Author URI: http://wpfront.com
9
  * License: GPL v3
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: 1.7.1
7
  * Author: Syam Mohan
8
  * Author URI: http://wpfront.com
9
  * License: GPL v3