WPFront Notification Bar - Version 1.7

Version Description

  • Start and End times.
Download this release

Release Info

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

Code changes from version 1.6 to 1.7

classes/class-wpfront-notification-bar-options.php CHANGED
@@ -79,8 +79,10 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
79
  $this->addOption('include_roles', 'string', array(), array($this, 'validate_include_roles'));
80
  $this->addOption('display_scroll', 'bit', false)->__('Display on Scroll');
81
  $this->addOption('display_scroll_offset', 'int', '100', array($this, 'validate_zero_positive'))->__('Scroll Offset');
82
- $this->addOption('start_date', 'string', '', array($this, 'validate_date_range'))->__('Start Date');
83
- $this->addOption('end_date', 'string', '', array($this, 'validate_date_range'))->__('End Date');
 
 
84
  $this->addOption('wp_emember_integration', 'bit', FALSE);
85
  }
86
 
79
  $this->addOption('include_roles', 'string', array(), array($this, 'validate_include_roles'));
80
  $this->addOption('display_scroll', 'bit', false)->__('Display on Scroll');
81
  $this->addOption('display_scroll_offset', 'int', '100', array($this, 'validate_zero_positive'))->__('Scroll Offset');
82
+ $this->addOption('start_date', 'string', '', array($this, 'validate_date_range'))->__('Start Date & Time');
83
+ $this->addOption('end_date', 'string', '', array($this, 'validate_date_range'))->__('End Date & Time');
84
+ $this->addOption('start_time', 'string', '', array($this, 'validate_date_range'))->__('Start Time');
85
+ $this->addOption('end_time', 'string', '', array($this, 'validate_date_range'))->__('End Time');
86
  $this->addOption('wp_emember_integration', 'bit', FALSE);
87
  }
88
 
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.6';
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';
@@ -103,6 +103,8 @@ if (!class_exists('WPFront_Notification_Bar')) {
103
 
104
  wp_enqueue_script('jquery-ui-datepicker', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js', array('jquery'), '1.8.16');
105
 
 
 
106
  $jsRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/js/';
107
  wp_enqueue_script('jquery.eyecon.colorpicker', $jsRoot . 'colorpicker.js', array('jquery', 'jquery-ui-datepicker'), self::VERSION);
108
 
@@ -120,6 +122,8 @@ if (!class_exists('WPFront_Notification_Bar')) {
120
  $styleRoot = $this->pluginURLRoot . 'jquery-plugins/jquery-ui/smoothness/';
121
  wp_enqueue_style('jquery.ui.smoothness.datepicker', $styleRoot . 'jquery-ui-1.10.4.custom.min.css', array(), self::VERSION);
122
 
 
 
123
  $styleRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/css/';
124
  wp_enqueue_style('jquery.eyecon.colorpicker.colorpicker', $styleRoot . 'colorpicker.css', array(), self::VERSION);
125
 
@@ -169,14 +173,14 @@ if (!class_exists('WPFront_Notification_Bar')) {
169
 
170
  $this->markupLoaded = TRUE;
171
  }
172
-
173
  protected function get_message_text() {
174
  $message = $this->options->message();
175
-
176
- if($this->options->message_process_shortcode()) {
177
  $message = do_shortcode($message);
178
  }
179
-
180
  return $message;
181
  }
182
 
@@ -219,23 +223,44 @@ if (!class_exists('WPFront_Notification_Bar')) {
219
  if (is_admin())
220
  return TRUE;
221
 
222
- $today = current_time('mysql');
223
- $today = strtotime($today);
224
- $today = date('Y-m-d', $today);
225
- $today = strtotime($today);
226
 
227
  $start_date = $this->options->start_date();
228
  if ($start_date != NULL) {
229
- if ($start_date > $today)
 
 
 
 
 
 
 
 
 
 
230
  return FALSE;
231
  }
232
-
233
  $end_date = $this->options->end_date();
234
  if ($end_date != NULL) {
235
- if ($end_date < $today)
 
 
 
 
 
 
 
 
 
 
 
236
  return FALSE;
237
  }
238
-
239
  switch ($this->options->display_roles()) {
240
  case 1:
241
  break;
@@ -314,14 +339,14 @@ if (!class_exists('WPFront_Notification_Bar')) {
314
 
315
  return TRUE;
316
  }
317
-
318
  protected function is_user_logged_in() {
319
  $logged_in = is_user_logged_in();
320
-
321
- if($this->options->wp_emember_integration() && function_exists('wp_emember_is_member_logged_in')) {
322
  $logged_in = $logged_in || wp_emember_is_member_logged_in();
323
  }
324
-
325
  return $logged_in;
326
  }
327
 
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';
103
 
104
  wp_enqueue_script('jquery-ui-datepicker', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js', array('jquery'), '1.8.16');
105
 
106
+ wp_enqueue_script('jquery-ui-timepicker', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.8.8/jquery.timepicker.min.js', array('jquery'), '1.8.8');
107
+
108
  $jsRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/js/';
109
  wp_enqueue_script('jquery.eyecon.colorpicker', $jsRoot . 'colorpicker.js', array('jquery', 'jquery-ui-datepicker'), self::VERSION);
110
 
122
  $styleRoot = $this->pluginURLRoot . 'jquery-plugins/jquery-ui/smoothness/';
123
  wp_enqueue_style('jquery.ui.smoothness.datepicker', $styleRoot . 'jquery-ui-1.10.4.custom.min.css', array(), self::VERSION);
124
 
125
+ wp_enqueue_style('jquery.ui.timepicker', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.8.8/jquery.timepicker.min.css', array(), '1.8.8');
126
+
127
  $styleRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/css/';
128
  wp_enqueue_style('jquery.eyecon.colorpicker.colorpicker', $styleRoot . 'colorpicker.css', array(), self::VERSION);
129
 
173
 
174
  $this->markupLoaded = TRUE;
175
  }
176
+
177
  protected function get_message_text() {
178
  $message = $this->options->message();
179
+
180
+ if ($this->options->message_process_shortcode()) {
181
  $message = do_shortcode($message);
182
  }
183
+
184
  return $message;
185
  }
186
 
223
  if (is_admin())
224
  return TRUE;
225
 
226
+ $now = current_time('mysql');
227
+ $now = strtotime($now);
228
+ $now = date('Y-m-d h:i a', $now);
229
+ $now = strtotime($now);
230
 
231
  $start_date = $this->options->start_date();
232
  if ($start_date != NULL) {
233
+ $start_date = date('Y-m-d', $start_date);
234
+ $start_time = $this->options->start_time();
235
+ if($start_time == NULL) {
236
+ $start_time = '12:00 am';
237
+ } else {
238
+ $start_time = date('h:i a', $start_time);
239
+ }
240
+ $start_date = $start_date . ' ' . $start_time;
241
+ $start_date = strtotime($start_date);
242
+
243
+ if ($start_date > $now)
244
  return FALSE;
245
  }
246
+
247
  $end_date = $this->options->end_date();
248
  if ($end_date != NULL) {
249
+ $end_date = date('Y-m-d', $end_date);
250
+ $end_time = $this->options->end_time();
251
+ if($end_time == NULL) {
252
+ $end_time = '11:59 pm';
253
+ } else {
254
+ $end_time = date('h:i a', $end_time);
255
+ }
256
+
257
+ $end_date = $end_date . ' ' . $end_time;
258
+ $end_date = strtotime($end_date);
259
+
260
+ if ($end_date < $now)
261
  return FALSE;
262
  }
263
+
264
  switch ($this->options->display_roles()) {
265
  case 1:
266
  break;
339
 
340
  return TRUE;
341
  }
342
+
343
  protected function is_user_logged_in() {
344
  $logged_in = is_user_logged_in();
345
+
346
+ if ($this->options->wp_emember_integration() && function_exists('wp_emember_is_member_logged_in')) {
347
  $logged_in = $logged_in || wp_emember_is_member_logged_in();
348
  }
349
+
350
  return $logged_in;
351
  }
352
 
css/options.css CHANGED
@@ -12,7 +12,8 @@
12
  width: 40px;
13
  }
14
 
15
- #wpfront-notification-bar-options input.date
 
16
  {
17
  width: 100px;
18
  }
12
  width: 40px;
13
  }
14
 
15
+ #wpfront-notification-bar-options input.date,
16
+ #wpfront-notification-bar-options input.time
17
  {
18
  width: 100px;
19
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: syammohanm
3
  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: 3.0
6
- Tested up to: 4.4
7
- Stable tag: 1.6
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -34,11 +34,6 @@ Visit [WPFront Notification Bar Ideas](http://wpfront.com/notification-bar-plugi
34
 
35
  Visit [WPFront Notification Bar Settings](http://wpfront.com/notification-bar-plugin-settings/) page for detailed option descriptions.
36
 
37
- Localization Contributors:
38
- <li>[Anders Lind](http://erding-mallards.de) (German) </li>
39
- <li>[Botfai Tibor](http://gidano.hu) (Hungarian) </li>
40
- <li>[Borisa Djuraskovic](http://webhostinghub.com) (Serbo-Croatian) </li>
41
-
42
  == Installation ==
43
 
44
  1. Click Plugins/Add New from the WordPress admin panel
@@ -53,6 +48,10 @@ Localization Contributors:
53
 
54
  == Frequently Asked Questions ==
55
 
 
 
 
 
56
  = I don’t want the plugin to be displayed on “wp-admin”, what should I do? =
57
 
58
  Notification bar doesn’t display on the wp-admin pages, except on the notification bar settings page. On the settings page it acts as a preview so that you can see the changes you make.
@@ -69,6 +68,9 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
69
 
70
  == Changelog ==
71
 
 
 
 
72
  = 1.6 =
73
  * Processes shortcodes.
74
  * Nofollow link option.
@@ -116,6 +118,9 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
116
 
117
  == Upgrade Notice ==
118
 
 
 
 
119
  = 1.6 =
120
  * Processes shortcodes.
121
 
2
  Contributors: syammohanm
3
  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
 
34
 
35
  Visit [WPFront Notification Bar Settings](http://wpfront.com/notification-bar-plugin-settings/) page for detailed option descriptions.
36
 
 
 
 
 
 
37
  == Installation ==
38
 
39
  1. Click Plugins/Add New from the WordPress admin panel
48
 
49
  == Frequently Asked Questions ==
50
 
51
+ = WPFront Notification Bar and GDPR compliance? =
52
+
53
+ This plugin doesn’t collect any personal information. For more information please visit [GDPR compliance](https://wpfront.com/wpfront-and-gdpr-compliance/).
54
+
55
  = I don’t want the plugin to be displayed on “wp-admin”, what should I do? =
56
 
57
  Notification bar doesn’t display on the wp-admin pages, except on the notification bar settings page. On the settings page it acts as a preview so that you can see the changes you make.
68
 
69
  == Changelog ==
70
 
71
+ = 1.7 =
72
+ * Start and End times.
73
+
74
  = 1.6 =
75
  * Processes shortcodes.
76
  * Nofollow link option.
118
 
119
  == Upgrade Notice ==
120
 
121
+ = 1.7 =
122
+ * Start and End times.
123
+
124
  = 1.6 =
125
  * Processes shortcodes.
126
 
templates/options-template.php CHANGED
@@ -240,7 +240,10 @@
240
  <?php echo $this->options->start_date_label(); ?>
241
  </th>
242
  <td>
243
- <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()); ?>" />&#160;<span class="description"><?php echo $this->__('[YYYY-MM-DD]'); ?></span>
 
 
 
244
  </td>
245
  </tr>
246
  <tr>
@@ -248,7 +251,10 @@
248
  <?php echo $this->options->end_date_label(); ?>
249
  </th>
250
  <td>
251
- <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()); ?>" />&#160;<span class="description"><?php echo $this->__('[YYYY-MM-DD]'); ?></span>
 
 
 
252
  </td>
253
  </tr>
254
  <tr>
@@ -515,6 +521,10 @@
515
  $('#wpfront-notification-bar-options input.date').datepicker({
516
  'dateFormat' : 'yy-mm-dd'
517
  });
 
 
 
 
518
 
519
  })(jQuery);
520
  </script>
240
  <?php echo $this->options->start_date_label(); ?>
241
  </th>
242
  <td>
243
+ <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()); ?>" />
244
+ <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()); ?>" />
245
+ &#160;
246
+ <span class="description"><?php echo $this->__('[YYYY-MM-DD] [hh:mm ap]'); ?></span>
247
  </td>
248
  </tr>
249
  <tr>
251
  <?php echo $this->options->end_date_label(); ?>
252
  </th>
253
  <td>
254
+ <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()); ?>" />
255
+ <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()); ?>" />
256
+ &#160;
257
+ <span class="description"><?php echo $this->__('[YYYY-MM-DD] [hh:mm ap]'); ?></span>
258
  </td>
259
  </tr>
260
  <tr>
521
  $('#wpfront-notification-bar-options input.date').datepicker({
522
  'dateFormat' : 'yy-mm-dd'
523
  });
524
+
525
+ $('#wpfront-notification-bar-options input.time').timepicker({
526
+ 'timeFormat': 'h:i a'
527
+ });
528
 
529
  })(jQuery);
530
  </script>
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.6
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
7
  * Author: Syam Mohan
8
  * Author URI: http://wpfront.com
9
  * License: GPL v3