WPFront Notification Bar - Version 1.1

Version Description

  • Filter pages option added.
  • Reopen button added.
  • Keep closed option added.
  • Position offset added.
  • WordPress 3.8 ready.
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.1

classes/class-wpfront-notification-bar-options.php CHANGED
@@ -61,6 +61,13 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
61
  $this->addOption('button_from_color', 'string', '#00b7ea', array($this, 'validate_color'))->__('From Color');
62
  $this->addOption('button_to_color', 'string', '#009ec3', array($this, 'validate_color'))->__('To Color');
63
  $this->addOption('button_text_color', 'string', '#ffffff', array($this, 'validate_color'))->__('Button Text Color');
 
 
 
 
 
 
 
64
  }
65
 
66
  //validation function
@@ -86,6 +93,18 @@ if (!class_exists('WPFront_Notification_Bar_Options')) {
86
 
87
  return $arg;
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  }
91
 
61
  $this->addOption('button_from_color', 'string', '#00b7ea', array($this, 'validate_color'))->__('From Color');
62
  $this->addOption('button_to_color', 'string', '#009ec3', array($this, 'validate_color'))->__('To Color');
63
  $this->addOption('button_text_color', 'string', '#ffffff', array($this, 'validate_color'))->__('Button Text Color');
64
+ $this->addOption('display_pages', 'int', '1', array($this, 'validate_display_pages'))->__('Display on Pages');
65
+ $this->addOption('include_pages', 'string', '');
66
+ $this->addOption('exclude_pages', 'string', '');
67
+ $this->addOption('display_open_button', 'bit', false)->__('Display Reopen Button');
68
+ $this->addOption('open_button_color', 'string', '#00b7ea')->__('Reopen Button Color');
69
+ $this->addOption('keep_closed', 'bit', FALSE)->__('Keep Closed');
70
+ $this->addOption('position_offset', 'int', 0)->__('Position Offset');
71
  }
72
 
73
  //validation function
93
 
94
  return $arg;
95
  }
96
+
97
+ protected function validate_display_pages($arg) {
98
+ if ($arg < 1) {
99
+ return 1;
100
+ }
101
+
102
+ if ($arg > 4) {
103
+ return 4;
104
+ }
105
+
106
+ return $arg;
107
+ }
108
 
109
  }
110
 
classes/class-wpfront-notification-bar.php CHANGED
@@ -35,10 +35,14 @@ if (!class_exists('WPFront_Notification_Bar')) {
35
  class WPFront_Notification_Bar {
36
 
37
  //Constants
 
38
  const OPTIONSPAGE_SLUG = 'wpfront-notification-bar';
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';
 
 
 
42
 
43
  //Variables
44
  private $pluginURLRoot;
@@ -54,6 +58,8 @@ if (!class_exists('WPFront_Notification_Bar')) {
54
  $this->pluginURLRoot = plugins_url() . '/wpfront-notification-bar/';
55
  $this->pluginDIRRoot = dirname(__FILE__) . '/../';
56
 
 
 
57
  //register actions
58
  if (is_admin()) {
59
  add_action('admin_init', array(&$this, 'admin_init'));
@@ -63,33 +69,41 @@ if (!class_exists('WPFront_Notification_Bar')) {
63
  add_action('wp_enqueue_scripts', array(&$this, 'enqueue_styles'));
64
  add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
65
  }
66
-
67
  add_action('wp_footer', array(&$this, 'write_markup'));
68
  add_action('shutdown', array(&$this, 'write_markup'));
69
  add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
70
  }
71
 
 
 
 
 
 
 
 
72
  //add scripts
73
  public function enqueue_scripts() {
74
- if ($this->options->enabled() == FALSE)
75
  return;
76
 
77
  $jsRoot = $this->pluginURLRoot . 'js/';
78
 
79
  wp_enqueue_script('jquery');
80
- wp_enqueue_script('wpfront-notification-bar', $jsRoot . 'wpfront-notification-bar.js', array('jquery'));
 
81
 
82
  $this->scriptLoaded = TRUE;
83
  }
84
-
85
  //add styles
86
  public function enqueue_styles() {
87
- if ($this->options->enabled() == FALSE)
88
  return;
89
 
90
  $cssRoot = $this->pluginURLRoot . 'css/';
91
 
92
- wp_enqueue_style('wpfront-notification-bar', $cssRoot . 'wpfront-notification-bar.css');
93
  }
94
 
95
  public function admin_init() {
@@ -109,21 +123,21 @@ if (!class_exists('WPFront_Notification_Bar')) {
109
  $this->enqueue_scripts();
110
 
111
  $jsRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/js/';
112
- wp_enqueue_script('jquery.eyecon.colorpicker', $jsRoot . 'colorpicker.js', array('jquery'));
113
 
114
  // $jsRoot = $this->pluginURLRoot . 'js/';
115
- // wp_enqueue_script('wpfront-notification-bar-options', $jsRoot . 'options.js');
116
  }
117
-
118
  //options page styles
119
  public function enqueue_options_styles() {
120
  $this->enqueue_styles();
121
-
122
  $styleRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/css/';
123
- wp_enqueue_style('jquery.eyecon.colorpicker.colorpicker', $styleRoot . 'colorpicker.css');
124
 
125
  $styleRoot = $this->pluginURLRoot . 'css/';
126
- wp_enqueue_style('wpfront-notification-bar-options', $styleRoot . 'options.css');
127
  }
128
 
129
  //creates options page
@@ -163,7 +177,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
163
  return;
164
  }
165
 
166
- if ($this->options->enabled()) {
167
  include($this->pluginDIRRoot . 'templates/notification-bar-template.php');
168
 
169
  echo '<script type="text/javascript">';
@@ -178,6 +192,9 @@ if (!class_exists('WPFront_Notification_Bar')) {
178
  'auto_close_after' => $this->options->auto_close_after(),
179
  'display_after' => $this->options->display_after(),
180
  'is_admin_bar_showing' => $this->is_admin_bar_showing(),
 
 
 
181
  )) . ');';
182
  echo '</script>';
183
  }
@@ -200,12 +217,94 @@ if (!class_exists('WPFront_Notification_Bar')) {
200
  }
201
 
202
  private function is_admin_bar_showing() {
203
- if(function_exists('is_admin_bar_showing')) {
204
  return is_admin_bar_showing();
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  return FALSE;
208
  }
 
209
  }
210
 
211
  }
35
  class WPFront_Notification_Bar {
36
 
37
  //Constants
38
+ const VERSION = '1.1';
39
  const OPTIONSPAGE_SLUG = 'wpfront-notification-bar';
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';
43
+
44
+ //cookie names
45
+ const COOKIE_LANDINGPAGE = 'wpfront-notification-bar-landingpage';
46
 
47
  //Variables
48
  private $pluginURLRoot;
58
  $this->pluginURLRoot = plugins_url() . '/wpfront-notification-bar/';
59
  $this->pluginDIRRoot = dirname(__FILE__) . '/../';
60
 
61
+ add_action('init', array(&$this, 'init'));
62
+
63
  //register actions
64
  if (is_admin()) {
65
  add_action('admin_init', array(&$this, 'admin_init'));
69
  add_action('wp_enqueue_scripts', array(&$this, 'enqueue_styles'));
70
  add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
71
  }
72
+
73
  add_action('wp_footer', array(&$this, 'write_markup'));
74
  add_action('shutdown', array(&$this, 'write_markup'));
75
  add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
76
  }
77
 
78
+ public function init() {
79
+ //for landing page tracking
80
+ if (!isset($_COOKIE[self::COOKIE_LANDINGPAGE])) {
81
+ setcookie(self::COOKIE_LANDINGPAGE, 1);
82
+ }
83
+ }
84
+
85
  //add scripts
86
  public function enqueue_scripts() {
87
+ if ($this->enabled() == FALSE)
88
  return;
89
 
90
  $jsRoot = $this->pluginURLRoot . 'js/';
91
 
92
  wp_enqueue_script('jquery');
93
+ wp_enqueue_script('jquery.cookie', $this->pluginURLRoot . 'jquery-plugins/jquery.cookie.js', array('jquery'), '1.4.0');
94
+ wp_enqueue_script('wpfront-notification-bar', $jsRoot . 'wpfront-notification-bar.js', array('jquery'), self::VERSION);
95
 
96
  $this->scriptLoaded = TRUE;
97
  }
98
+
99
  //add styles
100
  public function enqueue_styles() {
101
+ if ($this->enabled() == FALSE)
102
  return;
103
 
104
  $cssRoot = $this->pluginURLRoot . 'css/';
105
 
106
+ wp_enqueue_style('wpfront-notification-bar', $cssRoot . 'wpfront-notification-bar.css', array(), self::VERSION);
107
  }
108
 
109
  public function admin_init() {
123
  $this->enqueue_scripts();
124
 
125
  $jsRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/js/';
126
+ wp_enqueue_script('jquery.eyecon.colorpicker', $jsRoot . 'colorpicker.js', array('jquery'), self::VERSION);
127
 
128
  // $jsRoot = $this->pluginURLRoot . 'js/';
129
+ // wp_enqueue_script('wpfront-notification-bar-options', $jsRoot . 'options.js', array(), self::VERSION);
130
  }
131
+
132
  //options page styles
133
  public function enqueue_options_styles() {
134
  $this->enqueue_styles();
135
+
136
  $styleRoot = $this->pluginURLRoot . 'jquery-plugins/colorpicker/css/';
137
+ wp_enqueue_style('jquery.eyecon.colorpicker.colorpicker', $styleRoot . 'colorpicker.css', array(), self::VERSION);
138
 
139
  $styleRoot = $this->pluginURLRoot . 'css/';
140
+ wp_enqueue_style('wpfront-notification-bar-options', $styleRoot . 'options.css', array(), self::VERSION);
141
  }
142
 
143
  //creates options page
177
  return;
178
  }
179
 
180
+ if ($this->enabled()) {
181
  include($this->pluginDIRRoot . 'templates/notification-bar-template.php');
182
 
183
  echo '<script type="text/javascript">';
192
  'auto_close_after' => $this->options->auto_close_after(),
193
  'display_after' => $this->options->display_after(),
194
  'is_admin_bar_showing' => $this->is_admin_bar_showing(),
195
+ 'display_open_button' => $this->options->display_open_button(),
196
+ 'keep_closed' => $this->options->keep_closed(),
197
+ 'position_offset' => $this->options->position_offset(),
198
  )) . ');';
199
  echo '</script>';
200
  }
217
  }
218
 
219
  private function is_admin_bar_showing() {
220
+ if (function_exists('is_admin_bar_showing')) {
221
  return is_admin_bar_showing();
222
  }
223
+
224
+ return FALSE;
225
+ }
226
+
227
+ private function get_filter_objects() {
228
+ $objects = array();
229
+
230
+ $objects['1.home'] = $this->__('[Page]') . ' ' . $this->__('Home');
231
+
232
+ $pages = get_pages();
233
+ foreach ($pages as $page) {
234
+ $objects['1.' . $page->ID] = $this->__('[Page]') . ' ' . $page->post_title;
235
+ }
236
+
237
+ $posts = get_posts();
238
+ foreach ($posts as $post) {
239
+ $objects['2.' . $post->ID] = $this->__('[Post]') . ' ' . $post->post_title;
240
+ }
241
+
242
+ // $categories = get_categories();
243
+ // foreach ($categories as $category) {
244
+ // $objects['3.' . $category->cat_ID] = $this->__('[Category]') . ' ' . $category->cat_name;
245
+ // }
246
+
247
+ return $objects;
248
+ }
249
+
250
+ private function filter_page() {
251
+ if (is_admin())
252
+ return TRUE;
253
 
254
+ switch ($this->options->display_pages()) {
255
+ case 1:
256
+ return TRUE;
257
+ case 2:
258
+ return !isset($_COOKIE[self::COOKIE_LANDINGPAGE]);
259
+ case 3:
260
+ case 4:
261
+ global $post;
262
+ $ID = FALSE;
263
+ $type = FALSE;
264
+ if (is_home()) {
265
+ $ID = 'home';
266
+ $type = 1;
267
+ } elseif (is_singular()) {
268
+ $post_type = get_post_type();
269
+ if ($post_type == 'page') {
270
+ $ID = $post->ID;
271
+ $type = 1;
272
+ } elseif ($post_type == 'post') {
273
+ $ID = $post->ID;
274
+ $type = 2;
275
+ }
276
+ }
277
+ if ($this->options->display_pages() == 3) {
278
+ if ($ID !== FALSE && $type !== FALSE) {
279
+ if (strpos($this->options->include_pages(), $type . '.' . $ID) === FALSE)
280
+ return FALSE;
281
+ else
282
+ return TRUE;
283
+ }
284
+ return FALSE;
285
+ }
286
+ if ($this->options->display_pages() == 4) {
287
+ if ($ID !== FALSE && $type !== FALSE) {
288
+ if (strpos($this->options->exclude_pages(), $type . '.' . $ID) === FALSE)
289
+ return TRUE;
290
+ else
291
+ return FALSE;
292
+ }
293
+ return TRUE;
294
+ }
295
+ }
296
+
297
+ return TRUE;
298
+ }
299
+
300
+ private function enabled() {
301
+ if ($this->options->enabled()) {
302
+ return $this->filter_page();
303
+ }
304
+
305
  return FALSE;
306
  }
307
+
308
  }
309
 
310
  }
css/options.css CHANGED
@@ -9,7 +9,7 @@
9
 
10
  #wpfront-notification-bar-options input.seconds
11
  {
12
- width: 30px;
13
  }
14
 
15
  #wpfront-notification-bar-options textArea
@@ -22,12 +22,35 @@
22
  width: 50%;
23
  }
24
 
25
- table.form-table span
26
  {
27
- vertical-align: middle;
28
  }
29
 
30
- table.form-table .color-selector
31
  {
32
  vertical-align: middle;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
9
 
10
  #wpfront-notification-bar-options input.seconds
11
  {
12
+ width: 40px;
13
  }
14
 
15
  #wpfront-notification-bar-options textArea
22
  width: 50%;
23
  }
24
 
25
+ #wpfront-notification-bar-options table.form-table span
26
  {
27
+
28
  }
29
 
30
+ #wpfront-notification-bar-options table.form-table .color-selector
31
  {
32
  vertical-align: middle;
33
+ }
34
+
35
+ #wpfront-notification-bar-options table.form-table div.pages-selection
36
+ {
37
+ width: 70%;
38
+ height: 150px;
39
+ background-color: #fff;
40
+ overflow: auto;
41
+
42
+ border: 1px solid #dfdfdf;
43
+ -moz-border-radius: 4px;
44
+ -khtml-border-radius: 4px;
45
+ -webkit-border-radius: 4px;
46
+ border-radius: 4px;
47
+ }
48
+
49
+ #wpfront-notification-bar-options table.form-table div.page-div
50
+ {
51
+ float: left;
52
+ width: 250px;
53
+ padding: 2px;
54
+ white-space: nowrap;
55
+ overflow: hidden;
56
  }
css/wpfront-notification-bar.css CHANGED
@@ -3,20 +3,21 @@
3
  visibility: hidden;
4
  position: fixed;
5
  overflow: hidden;
6
- position: relative;
 
7
 
8
  color: #fff;
9
  background-color: #000;
10
  }
11
 
12
- #wpfront-notification-bar.wpfront-bottom-shadow
13
  {
14
  -webkit-box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
15
  -moz-box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
16
  box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
17
  }
18
 
19
- #wpfront-notification-bar.wpfront-top-shadow
20
  {
21
  -webkit-box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
22
  -moz-box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
@@ -107,3 +108,60 @@
107
  -moz-border-radius: 2px;
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  visibility: hidden;
4
  position: fixed;
5
  overflow: hidden;
6
+ left: 0px;
7
+ right: 0px;
8
 
9
  color: #fff;
10
  background-color: #000;
11
  }
12
 
13
+ .wpfront-bottom-shadow
14
  {
15
  -webkit-box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
16
  -moz-box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
17
  box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
18
  }
19
 
20
+ .wpfront-top-shadow
21
  {
22
  -webkit-box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
23
  -moz-box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
108
  -moz-border-radius: 2px;
109
  }
110
 
111
+ #wpfront-notification-bar-open-button
112
+ {
113
+ display: none;
114
+ position: absolute;
115
+ right: 10px;
116
+ z-index: 9999;
117
+ border: 3px solid white;
118
+ width: 23px;
119
+ height: 30px;
120
+ cursor: pointer;
121
+ background-repeat: no-repeat;
122
+
123
+ border-radius: 2px;
124
+ -webkit-border-radius: 2px;
125
+ -moz-border-radius: 2px;
126
+
127
+ -webkit-box-sizing: content-box;
128
+ -moz-box-sizing: content-box;
129
+ box-sizing: content-box;
130
+ }
131
+
132
+ #wpfront-notification-bar-open-button.top
133
+ {
134
+ top: 0px;
135
+ background-image: url(../images/arrow_down.png);
136
+ background-position: top center;
137
+ border-top: 0px;
138
+
139
+ -webkit-border-top-right-radius: 0px;
140
+ -webkit-border-top-left-radius: 0px;
141
+ -moz-border-radius-topright: 0px;
142
+ -moz-border-radius-topleft: 0px;
143
+ border-top-right-radius: 0px;
144
+ border-top-left-radius: 0px;
145
+ }
146
+
147
+ #wpfront-notification-bar-open-button.bottom
148
+ {
149
+ bottom: 0px;
150
+ background-image: url(../images/arrow_up.png);
151
+ background-position: bottom center;
152
+ border-bottom: 0px;
153
+
154
+ -webkit-border-bottom-right-radius: 0px;
155
+ -webkit-border-bottom-left-radius: 0px;
156
+ -moz-border-radius-bottomright: 0px;
157
+ -moz-border-radius-bottomleft: 0px;
158
+ border-bottom-right-radius: 0px;
159
+ border-bottom-left-radius: 0px;
160
+ }
161
+
162
+ #wpfront-notification-bar-spacer
163
+ {
164
+ display: none;
165
+ position: relative;
166
+ }
167
+
images/arrow_down.png ADDED
Binary file
images/arrow_up.png ADDED
Binary file
jquery-plugins/colorpicker/images/Thumbs.db DELETED
Binary file
jquery-plugins/jquery.cookie.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Cookie Plugin v1.4.0
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2013 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD. Register as anonymous module.
11
+ define(['jquery'], factory);
12
+ } else {
13
+ // Browser globals.
14
+ factory(jQuery);
15
+ }
16
+ }(function ($) {
17
+
18
+ var pluses = /\+/g;
19
+
20
+ function encode(s) {
21
+ return config.raw ? s : encodeURIComponent(s);
22
+ }
23
+
24
+ function decode(s) {
25
+ return config.raw ? s : decodeURIComponent(s);
26
+ }
27
+
28
+ function stringifyCookieValue(value) {
29
+ return encode(config.json ? JSON.stringify(value) : String(value));
30
+ }
31
+
32
+ function parseCookieValue(s) {
33
+ if (s.indexOf('"') === 0) {
34
+ // This is a quoted cookie as according to RFC2068, unescape...
35
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
36
+ }
37
+
38
+ try {
39
+ // Replace server-side written pluses with spaces.
40
+ // If we can't decode the cookie, ignore it, it's unusable.
41
+ s = decodeURIComponent(s.replace(pluses, ' '));
42
+ } catch(e) {
43
+ return;
44
+ }
45
+
46
+ try {
47
+ // If we can't parse the cookie, ignore it, it's unusable.
48
+ return config.json ? JSON.parse(s) : s;
49
+ } catch(e) {}
50
+ }
51
+
52
+ function read(s, converter) {
53
+ var value = config.raw ? s : parseCookieValue(s);
54
+ return $.isFunction(converter) ? converter(value) : value;
55
+ }
56
+
57
+ var config = $.cookie = function (key, value, options) {
58
+
59
+ // Write
60
+ if (value !== undefined && !$.isFunction(value)) {
61
+ options = $.extend({}, config.defaults, options);
62
+
63
+ if (typeof options.expires === 'number') {
64
+ var days = options.expires, t = options.expires = new Date();
65
+ t.setDate(t.getDate() + days);
66
+ }
67
+
68
+ return (document.cookie = [
69
+ encode(key), '=', stringifyCookieValue(value),
70
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
71
+ options.path ? '; path=' + options.path : '',
72
+ options.domain ? '; domain=' + options.domain : '',
73
+ options.secure ? '; secure' : ''
74
+ ].join(''));
75
+ }
76
+
77
+ // Read
78
+
79
+ var result = key ? undefined : {};
80
+
81
+ // To prevent the for loop in the first place assign an empty array
82
+ // in case there are no cookies at all. Also prevents odd result when
83
+ // calling $.cookie().
84
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
85
+
86
+ for (var i = 0, l = cookies.length; i < l; i++) {
87
+ var parts = cookies[i].split('=');
88
+ var name = decode(parts.shift());
89
+ var cookie = parts.join('=');
90
+
91
+ if (key && key === name) {
92
+ // If second argument (value) is a function it's a converter...
93
+ result = read(cookie, value);
94
+ break;
95
+ }
96
+
97
+ // Prevent storing a cookie that we couldn't decode.
98
+ if (!key && (cookie = read(cookie)) !== undefined) {
99
+ result[name] = cookie;
100
+ }
101
+ }
102
+
103
+ return result;
104
+ };
105
+
106
+ config.defaults = {};
107
+
108
+ $.removeCookie = function (key, options) {
109
+ if ($.cookie(key) !== undefined) {
110
+ // Must not alter options, thus extending a fresh object...
111
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
112
+ return true;
113
+ }
114
+ return false;
115
+ };
116
+
117
+ }));
js/wpfront-notification-bar.js CHANGED
@@ -1,33 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  (function() {
2
  var $ = jQuery;
3
 
4
  //displays the notification bar
5
  window.wpfront_notification_bar = function(data) {
 
 
 
6
  var bar = $("#wpfront-notification-bar");
 
7
 
8
  //set the position
9
  if (data.position == 1) {
10
- if (data.fixed_position && data.is_admin_bar_showing)
11
- bar.css("top", "28px");
12
- else
13
- bar.css("top", "0px");
14
- $("body").prepend(bar);
 
 
 
 
 
 
 
 
 
15
  }
16
  else {
17
- $("body").append(bar.css("bottom", "0px"));
 
18
  }
19
 
20
- //for static bar
21
- var spacer = bar.children(":first");
22
- spacer.insertBefore(bar);
23
-
24
  var height = bar.height();
25
  if (data.height > 0) {
26
  height = data.height;
27
  bar.find("table, tbody, tr").css("height", "100%");
28
  }
29
 
30
- bar.height(0).css({"display": "block", "position": (data.fixed_position ? "fixed" : "relative"), "visibility": "visible"});
 
31
 
32
  //function to set bar height based on options
33
  var closed = false;
@@ -39,15 +62,23 @@
39
  closed = true;
40
  }
41
 
42
- if (height > 0) {
43
- var fn = callback;
44
- callback = function() {
45
- fn();
46
  //set height to auto if in case content wraps on resize
47
  if (data.height == 0)
48
  bar.height("auto");
49
- };
50
- }
 
 
 
 
 
 
 
 
51
 
52
  //set animation
53
  if (data.animate_delay > 0) {
@@ -77,6 +108,19 @@
77
  });
78
  }
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  //set open after seconds and auto close seconds.
81
  setTimeout(function() {
82
  setHeight(height, function() {
1
+ /*
2
+ WPFront Notification Bar Plugin
3
+ Copyright (C) 2013, WPFront.com
4
+ Website: wpfront.com
5
+ Contact: syam@wpfront.com
6
+
7
+ WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
8
+ June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
9
+ St, Fifth Floor, Boston, MA 02110, USA
10
+
11
+ */
12
+
13
  (function() {
14
  var $ = jQuery;
15
 
16
  //displays the notification bar
17
  window.wpfront_notification_bar = function(data) {
18
+ var keep_closed_cookie = "wpfront-notification-bar-keep-closed";
19
+
20
+ var spacer = $("#wpfront-notification-bar-spacer").show();
21
  var bar = $("#wpfront-notification-bar");
22
+ var open_button = $("#wpfront-notification-bar-open-button");
23
 
24
  //set the position
25
  if (data.position == 1) {
26
+ var top = 0;
27
+ if (data.fixed_position && data.is_admin_bar_showing) {
28
+ top = $("html").css("margin-top");
29
+ if (top == "0px")
30
+ top = $("html").css("padding-top");
31
+ top = parseInt(top);
32
+ }
33
+ if (data.fixed_position) {
34
+ top += data.position_offset;
35
+ }
36
+ bar.css("top", top + "px");
37
+ open_button.css("top", top + "px");
38
+ $("body").prepend(spacer);
39
+ spacer.css("top", data.position_offset + "px");
40
  }
41
  else {
42
+ $("body").append(spacer);
43
+ bar.css("bottom", "0px");
44
  }
45
 
 
 
 
 
46
  var height = bar.height();
47
  if (data.height > 0) {
48
  height = data.height;
49
  bar.find("table, tbody, tr").css("height", "100%");
50
  }
51
 
52
+ bar.height(0).css({"position": (data.fixed_position ? "fixed" : "relative"), "visibility": "visible"});
53
+ open_button.css({"position": (data.fixed_position ? "fixed" : "absolute")});
54
 
55
  //function to set bar height based on options
56
  var closed = false;
62
  closed = true;
63
  }
64
 
65
+ var fn = callback;
66
+ callback = function() {
67
+ fn();
68
+ if (height > 0) {
69
  //set height to auto if in case content wraps on resize
70
  if (data.height == 0)
71
  bar.height("auto");
72
+ open_button.hide();
73
+ closed = false;
74
+ }
75
+ if (height == 0 && data.display_open_button) {
76
+ open_button.show();
77
+ }
78
+ if (height == 0) {
79
+ $.cookie(keep_closed_cookie, 1, {path: "/"});
80
+ }
81
+ };
82
 
83
  //set animation
84
  if (data.animate_delay > 0) {
108
  });
109
  }
110
 
111
+ if (data.display_open_button) {
112
+ open_button.click(function() {
113
+ setHeight(height);
114
+ });
115
+ }
116
+
117
+ if (data.keep_closed) {
118
+ if ($.cookie(keep_closed_cookie)) {
119
+ setHeight(0);
120
+ return;
121
+ }
122
+ }
123
+
124
  //set open after seconds and auto close seconds.
125
  setTimeout(function() {
126
  setHeight(height, function() {
languages/wpfront-notification-bar.mo CHANGED
Binary file
languages/wpfront-notification-bar.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WPFront Notification Bar\n"
4
- "POT-Creation-Date: 2013-12-09 21:03-0700\n"
5
- "PO-Revision-Date: 2013-12-09 21:04-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: WPFront <contact@wpfront.com>\n"
8
  "Language: en\n"
@@ -102,26 +102,59 @@ msgstr "To Color"
102
  msgid "Button Text Color"
103
  msgstr "Button Text Color"
104
 
105
- #: ../classes/class-wpfront-notification-bar.php:100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  msgid "WPFront Notification Bar"
107
  msgstr "WPFront Notification Bar"
108
 
109
- #: ../classes/class-wpfront-notification-bar.php:100
110
  msgid "Notification Bar"
111
  msgstr "Notification Bar"
112
 
113
- #: ../classes/class-wpfront-notification-bar.php:132
114
  msgid "You do not have sufficient permissions to access this page."
115
  msgstr "You do not have sufficient permissions to access this page."
116
 
117
- #: ../classes/class-wpfront-notification-bar.php:142
118
  msgid "Settings"
119
  msgstr "Settings"
120
 
121
- #: ../classes/class-wpfront-notification-bar.php:198
122
  msgid "Save Changes"
123
  msgstr "Save Changes"
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  #: ../templates/options-template.php:34
126
  msgid "WPFront Notification Bar Settings"
127
  msgstr "WPFront Notification Bar Settings"
@@ -150,7 +183,7 @@ msgstr "Bottom"
150
  msgid "[Sticky Bar, bar will stay at position regardless of scrolling.]"
151
  msgstr "[Sticky Bar, bar will stay at position regardless of scrolling.]"
152
 
153
- #: ../templates/options-template.php:83
154
  msgid "px"
155
  msgstr "px"
156
 
@@ -158,55 +191,123 @@ msgstr "px"
158
  msgid "Set 0px to auto fit contents."
159
  msgstr "Set 0px to auto fit contents."
160
 
161
- #: ../templates/options-template.php:91 ../templates/options-template.php:99
162
- #: ../templates/options-template.php:115
 
 
 
 
 
 
 
 
163
  msgid "second(s)"
164
  msgstr "second(s)"
165
 
166
- #: ../templates/options-template.php:91
167
  msgid "Set 0 second(s) to display immediately."
168
  msgstr "Set 0 second(s) to display immediately."
169
 
170
- #: ../templates/options-template.php:99
171
  msgid "Set 0 second(s) for no animation."
172
  msgstr "Set 0 second(s) for no animation."
173
 
174
- #: ../templates/options-template.php:107
175
  msgid "[Displays a close button at the top right corner of the bar.]"
176
  msgstr "[Displays a close button at the top right corner of the bar.]"
177
 
178
- #: ../templates/options-template.php:115
179
  msgid "Set 0 second(s) to disable auto close."
180
  msgstr "Set 0 second(s) to disable auto close."
181
 
182
- #: ../templates/options-template.php:128
 
 
 
 
 
 
 
 
183
  msgid "Content"
184
  msgstr "Content"
185
 
186
- #: ../templates/options-template.php:137
187
  msgid "[HTML tags are allowed. e.g. Add <br /> for break.]"
188
  msgstr "[HTML tags are allowed. e.g. Add <br /> for break.]"
189
 
190
- #: ../templates/options-template.php:145
191
  msgid "[Displays a button next to the message.]"
192
  msgstr "[Displays a button next to the message.]"
193
 
194
- #: ../templates/options-template.php:190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  msgid "Color"
196
  msgstr "Color"
197
 
198
- #: ../templates/options-template.php:194
199
  msgid "Bar Color"
200
  msgstr "Bar Color"
201
 
202
- #: ../templates/options-template.php:203 ../templates/options-template.php:226
203
  msgid "[Select two different colors to create a gradient.]"
204
  msgstr "[Select two different colors to create a gradient.]"
205
 
206
- #: ../templates/options-template.php:217
207
  msgid "Button Color"
208
  msgstr "Button Color"
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  #~ msgid "Animate Display"
211
  #~ msgstr "Animate Display"
212
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WPFront Notification Bar\n"
4
+ "POT-Creation-Date: 2013-12-16 22:09-0700\n"
5
+ "PO-Revision-Date: 2013-12-16 22:09-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: WPFront <contact@wpfront.com>\n"
8
  "Language: en\n"
102
  msgid "Button Text Color"
103
  msgstr "Button Text Color"
104
 
105
+ #: ../classes/class-wpfront-notification-bar-options.php:64
106
+ msgid "Display on Pages"
107
+ msgstr "Display on Pages"
108
+
109
+ #: ../classes/class-wpfront-notification-bar-options.php:67
110
+ msgid "Display Reopen Button"
111
+ msgstr "Display Reopen Button"
112
+
113
+ #: ../classes/class-wpfront-notification-bar-options.php:68
114
+ msgid "Reopen Button Color"
115
+ msgstr "Reopen Button Color"
116
+
117
+ #: ../classes/class-wpfront-notification-bar-options.php:69
118
+ msgid "Keep Closed"
119
+ msgstr "Keep Closed"
120
+
121
+ #: ../classes/class-wpfront-notification-bar-options.php:70
122
+ msgid "Position Offset"
123
+ msgstr "Position Offset"
124
+
125
+ #: ../classes/class-wpfront-notification-bar.php:114
126
  msgid "WPFront Notification Bar"
127
  msgstr "WPFront Notification Bar"
128
 
129
+ #: ../classes/class-wpfront-notification-bar.php:114
130
  msgid "Notification Bar"
131
  msgstr "Notification Bar"
132
 
133
+ #: ../classes/class-wpfront-notification-bar.php:146
134
  msgid "You do not have sufficient permissions to access this page."
135
  msgstr "You do not have sufficient permissions to access this page."
136
 
137
+ #: ../classes/class-wpfront-notification-bar.php:156
138
  msgid "Settings"
139
  msgstr "Settings"
140
 
141
+ #: ../classes/class-wpfront-notification-bar.php:215
142
  msgid "Save Changes"
143
  msgstr "Save Changes"
144
 
145
+ #: ../classes/class-wpfront-notification-bar.php:230
146
+ #: ../classes/class-wpfront-notification-bar.php:234
147
+ msgid "[Page]"
148
+ msgstr "[Page]"
149
+
150
+ #: ../classes/class-wpfront-notification-bar.php:230
151
+ msgid "Home"
152
+ msgstr "Home"
153
+
154
+ #: ../classes/class-wpfront-notification-bar.php:239
155
+ msgid "[Post]"
156
+ msgstr "[Post]"
157
+
158
  #: ../templates/options-template.php:34
159
  msgid "WPFront Notification Bar Settings"
160
  msgstr "WPFront Notification Bar Settings"
183
  msgid "[Sticky Bar, bar will stay at position regardless of scrolling.]"
184
  msgstr "[Sticky Bar, bar will stay at position regardless of scrolling.]"
185
 
186
+ #: ../templates/options-template.php:83 ../templates/options-template.php:91
187
  msgid "px"
188
  msgstr "px"
189
 
191
  msgid "Set 0px to auto fit contents."
192
  msgstr "Set 0px to auto fit contents."
193
 
194
+ #: ../templates/options-template.php:91
195
+ msgid ""
196
+ "(Top bar only) If you find the bar overlapping, try increasing this value. "
197
+ "(eg. WordPress 3.8 Twenty Fourteen theme, set 48px)"
198
+ msgstr ""
199
+ "(Top bar only) If you find the bar overlapping, try increasing this value. "
200
+ "(eg. WordPress 3.8 Twenty Fourteen theme, set 48px)"
201
+
202
+ #: ../templates/options-template.php:99 ../templates/options-template.php:107
203
+ #: ../templates/options-template.php:123
204
  msgid "second(s)"
205
  msgstr "second(s)"
206
 
207
+ #: ../templates/options-template.php:99
208
  msgid "Set 0 second(s) to display immediately."
209
  msgstr "Set 0 second(s) to display immediately."
210
 
211
+ #: ../templates/options-template.php:107
212
  msgid "Set 0 second(s) for no animation."
213
  msgstr "Set 0 second(s) for no animation."
214
 
215
+ #: ../templates/options-template.php:115
216
  msgid "[Displays a close button at the top right corner of the bar.]"
217
  msgstr "[Displays a close button at the top right corner of the bar.]"
218
 
219
+ #: ../templates/options-template.php:123
220
  msgid "Set 0 second(s) to disable auto close."
221
  msgstr "Set 0 second(s) to disable auto close."
222
 
223
+ #: ../templates/options-template.php:139
224
+ msgid "A reopen button will be displayed after the bar is closed."
225
+ msgstr "A reopen button will be displayed after the bar is closed."
226
+
227
+ #: ../templates/options-template.php:147
228
+ msgid "Once closed, bar will display closed on other pages."
229
+ msgstr "Once closed, bar will display closed on other pages."
230
+
231
+ #: ../templates/options-template.php:152
232
  msgid "Content"
233
  msgstr "Content"
234
 
235
+ #: ../templates/options-template.php:161
236
  msgid "[HTML tags are allowed. e.g. Add <br /> for break.]"
237
  msgstr "[HTML tags are allowed. e.g. Add <br /> for break.]"
238
 
239
+ #: ../templates/options-template.php:169
240
  msgid "[Displays a button next to the message.]"
241
  msgstr "[Displays a button next to the message.]"
242
 
243
+ #: ../templates/options-template.php:214
244
+ msgid "Filter"
245
+ msgstr "Filter"
246
+
247
+ #: ../templates/options-template.php:223
248
+ msgid "All pages."
249
+ msgstr "All pages."
250
+
251
+ #: ../templates/options-template.php:228
252
+ msgid "Only in landing page."
253
+ msgstr "Only in landing page."
254
+
255
+ #: ../templates/options-template.php:228
256
+ msgid "[The first page they visit on your website.]"
257
+ msgstr "[The first page they visit on your website.]"
258
+
259
+ #: ../templates/options-template.php:233
260
+ msgid "Include in following pages"
261
+ msgstr "Include in following pages"
262
+
263
+ #: ../templates/options-template.php:251
264
+ msgid "Exclude in following pages"
265
+ msgstr "Exclude in following pages"
266
+
267
+ #: ../templates/options-template.php:271
268
  msgid "Color"
269
  msgstr "Color"
270
 
271
+ #: ../templates/options-template.php:275
272
  msgid "Bar Color"
273
  msgstr "Bar Color"
274
 
275
+ #: ../templates/options-template.php:284 ../templates/options-template.php:307
276
  msgid "[Select two different colors to create a gradient.]"
277
  msgstr "[Select two different colors to create a gradient.]"
278
 
279
+ #: ../templates/options-template.php:298
280
  msgid "Button Color"
281
  msgstr "Button Color"
282
 
283
+ #: ../templates/options-template.php:332
284
+ msgid "Plugin Ideas"
285
+ msgstr "Plugin Ideas"
286
+
287
+ #: ../templates/options-template.php:334
288
+ msgid "Settings Description"
289
+ msgstr "Settings Description"
290
+
291
+ #: ../templates/options-template.php:336
292
+ msgid "Plugin FAQ"
293
+ msgstr "Plugin FAQ"
294
+
295
+ #: ../templates/options-template.php:338
296
+ msgid "Feature Request"
297
+ msgstr "Feature Request"
298
+
299
+ #: ../templates/options-template.php:340
300
+ msgid "Report Bug"
301
+ msgstr "Report Bug"
302
+
303
+ #: ../templates/options-template.php:342
304
+ msgid "Write Review"
305
+ msgstr "Write Review"
306
+
307
+ #: ../templates/options-template.php:344
308
+ msgid "Contact Me (syam@wpfront.com)"
309
+ msgstr "Contact Me (syam@wpfront.com)"
310
+
311
  #~ msgid "Animate Display"
312
  #~ msgstr "Animate Display"
313
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 3.7.1
7
- Stable tag: 1.0.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -14,7 +14,7 @@ Easily lets you create a bar on top or bottom to display a notification.
14
  Want to display a notification about a promotion or a news? WPFront Notification Bar plugin lets you do that easily.
15
 
16
  ### Features
17
- * Display a **message** with a **button**.
18
  * Button will **open a URL** or **execute JavaScript**.
19
  * **Position** the bar on **top** or **bottom**.
20
  * Can be **fixed at position** (Sticky Bar).
@@ -23,6 +23,8 @@ Want to display a notification about a promotion or a news? WPFront Notification
23
  * Display a **close button** for the visitor.
24
  * Set the number of **seconds before auto close**.
25
  * **Colors** are fully **customizable**.
 
 
26
 
27
  Visit [WPFront Notification Bar Ideas](http://wpfront.com/notification-bar-plugin-ideas/) page for some useful functionalities.
28
 
@@ -53,6 +55,13 @@ No one has asked anything yet.
53
 
54
  == Changelog ==
55
 
 
 
 
 
 
 
 
56
  = 1.0.1 =
57
  * A couple of bug fixes.
58
 
@@ -61,6 +70,11 @@ No one has asked anything yet.
61
 
62
  == Upgrade Notice ==
63
 
 
 
 
 
 
64
  = 1.0.1 =
65
  * Fixed an issue with CSS conflicting with some themes
66
 
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: 3.8
7
+ Stable tag: 1.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
14
  Want to display a notification about a promotion or a news? WPFront Notification Bar plugin lets you do that easily.
15
 
16
  ### Features
17
+ * Display a **message** with a **button** (optional).
18
  * Button will **open a URL** or **execute JavaScript**.
19
  * **Position** the bar on **top** or **bottom**.
20
  * Can be **fixed at position** (Sticky Bar).
23
  * Display a **close button** for the visitor.
24
  * Set the number of **seconds before auto close**.
25
  * **Colors** are fully **customizable**.
26
+ * Display a **Reopen Button**.
27
+ * **Select the pages/posts** you want to display the notification.
28
 
29
  Visit [WPFront Notification Bar Ideas](http://wpfront.com/notification-bar-plugin-ideas/) page for some useful functionalities.
30
 
55
 
56
  == Changelog ==
57
 
58
+ = 1.1 =
59
+ * Filter pages option added.
60
+ * Reopen button added.
61
+ * Keep closed option added.
62
+ * Position offset added.
63
+ * WordPress 3.8 ready.
64
+
65
  = 1.0.1 =
66
  * A couple of bug fixes.
67
 
70
 
71
  == Upgrade Notice ==
72
 
73
+ = 1.1 =
74
+ * This version is WordPress 3.8 ready.
75
+ * Now you can filter the pages.
76
+ * Option to keep the bar closed.
77
+
78
  = 1.0.1 =
79
  * Fixed an issue with CSS conflicting with some themes
80
 
templates/notification-bar-template.php CHANGED
@@ -60,6 +60,11 @@
60
 
61
  color: <?php echo $this->options->button_text_color(); ?>;
62
  }
 
 
 
 
 
63
  </style>
64
 
65
  <?php if ($this->options->display_button() && $this->options->button_action() == 2) { ?>
@@ -74,28 +79,30 @@
74
  </script>
75
  <?php } ?>
76
 
77
- <div id="wpfront-notification-bar" class="wpfront-fixed <?php if ($this->options->display_shadow()) echo $this->options->position() == 1 ? 'wpfront-bottom-shadow' : 'wpfront-top-shadow'; ?>" style="display: none;">
78
- <div></div>
79
- <?php if ($this->options->close_button()) { ?>
80
- <div class="wpfront-close">X</div>
81
- <?php } ?>
82
- <table border="0" cellspacing="0" cellpadding="0">
83
- <tr>
84
- <td>
85
- <div class="wpfront-message">
86
- <?php echo $this->options->message(); ?>
87
- </div>
88
- <div>
89
- <?php if ($this->options->display_button()) { ?>
90
- <?php if ($this->options->button_action() == 1) { ?>
91
- <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_text(); ?></a>
92
- <?php } ?>
93
- <?php if ($this->options->button_action() == 2) { ?>
94
- <a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo $this->options->button_text(); ?></a>
 
 
95
  <?php } ?>
96
- <?php } ?>
97
- </div>
98
- </td>
99
- </tr>
100
- </table>
101
  </div>
60
 
61
  color: <?php echo $this->options->button_text_color(); ?>;
62
  }
63
+
64
+ #wpfront-notification-bar-open-button
65
+ {
66
+ background-color: <?php echo $this->options->open_button_color(); ?>;
67
+ }
68
  </style>
69
 
70
  <?php if ($this->options->display_button() && $this->options->button_action() == 2) { ?>
79
  </script>
80
  <?php } ?>
81
 
82
+ <div id="wpfront-notification-bar-spacer" style="display: none;">
83
+ <div id="wpfront-notification-bar-open-button" class="<?php echo $this->options->position() == 1 ? 'top wpfront-bottom-shadow' : 'bottom wpfront-top-shadow'; ?>"></div>
84
+ <div id="wpfront-notification-bar" class="wpfront-fixed <?php if ($this->options->display_shadow()) echo $this->options->position() == 1 ? 'wpfront-bottom-shadow' : 'wpfront-top-shadow'; ?>">
85
+ <?php if ($this->options->close_button()) { ?>
86
+ <div class="wpfront-close">X</div>
87
+ <?php } ?>
88
+ <table border="0" cellspacing="0" cellpadding="0">
89
+ <tr>
90
+ <td>
91
+ <div class="wpfront-message">
92
+ <?php echo $this->options->message(); ?>
93
+ </div>
94
+ <div>
95
+ <?php if ($this->options->display_button()) { ?>
96
+ <?php if ($this->options->button_action() == 1) { ?>
97
+ <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_text(); ?></a>
98
+ <?php } ?>
99
+ <?php if ($this->options->button_action() == 2) { ?>
100
+ <a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo $this->options->button_text(); ?></a>
101
+ <?php } ?>
102
  <?php } ?>
103
+ </div>
104
+ </td>
105
+ </tr>
106
+ </table>
107
+ </div>
108
  </div>
templates/options-template.php CHANGED
@@ -83,6 +83,14 @@
83
  <input class="seconds" name="<?php echo $this->options->height_name(); ?>" value="<?php echo $this->options->height(); ?>" />&#160;<?php echo $this->__('px'); ?>&#160;<span class="description">[<?php echo $this->__('Set 0px to auto fit contents.'); ?>]</span>
84
  </td>
85
  </tr>
 
 
 
 
 
 
 
 
86
  <tr>
87
  <th scope="row">
88
  <?php echo $this->options->display_after_label(); ?>
@@ -123,6 +131,22 @@
123
  <input type="checkbox" name="<?php echo $this->options->display_shadow_name(); ?>" <?php echo $this->options->display_shadow() ? 'checked' : ''; ?> />
124
  </td>
125
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  </table>
127
 
128
  <h3><?php echo $this->__('Content'); ?></h3>
@@ -187,6 +211,63 @@
187
  </tr>
188
  </table>
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  <h3><?php echo $this->__('Color'); ?></h3>
191
  <table class="form-table">
192
  <tr>
@@ -235,9 +316,32 @@
235
  <input type="hidden" name="<?php echo $this->options->button_text_color_name(); ?>" value="<?php echo $this->options->button_text_color(); ?>" />
236
  </td>
237
  </tr>
 
 
 
 
 
 
 
 
 
238
  </table>
239
 
240
  <?php @$this->submit_button(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  </form>
242
  </div>
243
  </div>
@@ -264,5 +368,14 @@
264
  $('#wpfront-notification-bar-options').find(".color-selector").each(function(i, e) {
265
  setColorPicker($(e));
266
  });
 
 
 
 
 
 
 
 
 
267
  })(jQuery);
268
  </script>
83
  <input class="seconds" name="<?php echo $this->options->height_name(); ?>" value="<?php echo $this->options->height(); ?>" />&#160;<?php echo $this->__('px'); ?>&#160;<span class="description">[<?php echo $this->__('Set 0px to auto fit contents.'); ?>]</span>
84
  </td>
85
  </tr>
86
+ <tr>
87
+ <th scope="row">
88
+ <?php echo $this->options->position_offset_label(); ?>
89
+ </th>
90
+ <td>
91
+ <input class="seconds" name="<?php echo $this->options->position_offset_name(); ?>" value="<?php echo $this->options->position_offset(); ?>" />&#160;<?php echo $this->__('px'); ?>&#160;<span class="description">[<?php echo $this->__('(Top bar only) If you find the bar overlapping, try increasing this value. (eg. WordPress 3.8 Twenty Fourteen theme, set 48px)'); ?>]</span>
92
+ </td>
93
+ </tr>
94
  <tr>
95
  <th scope="row">
96
  <?php echo $this->options->display_after_label(); ?>
131
  <input type="checkbox" name="<?php echo $this->options->display_shadow_name(); ?>" <?php echo $this->options->display_shadow() ? 'checked' : ''; ?> />
132
  </td>
133
  </tr>
134
+ <tr>
135
+ <th scope="row">
136
+ <?php echo $this->options->display_open_button_label(); ?>
137
+ </th>
138
+ <td>
139
+ <input type="checkbox" name="<?php echo $this->options->display_open_button_name(); ?>" <?php echo $this->options->display_open_button() ? 'checked' : ''; ?> />&#160;<span class="description">[<?php echo $this->__('A reopen button will be displayed after the bar is closed.'); ?>]</span>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <th scope="row">
144
+ <?php echo $this->options->keep_closed_label(); ?>
145
+ </th>
146
+ <td>
147
+ <input type="checkbox" name="<?php echo $this->options->keep_closed_name(); ?>" <?php echo $this->options->keep_closed() ? 'checked' : ''; ?> />&#160;<span class="description">[<?php echo $this->__('Once closed, bar will display closed on other pages.'); ?>]</span>
148
+ </td>
149
+ </tr>
150
  </table>
151
 
152
  <h3><?php echo $this->__('Content'); ?></h3>
211
  </tr>
212
  </table>
213
 
214
+ <h3><?php echo $this->__('Filter'); ?></h3>
215
+ <table class="form-table">
216
+ <tr>
217
+ <th scope="row">
218
+ <?php echo $this->options->display_pages_label(); ?>
219
+ </th>
220
+ <td>
221
+ <label>
222
+ <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="1" <?php echo $this->options->display_pages() == 1 ? 'checked' : ''; ?> />
223
+ <span><?php echo $this->__('All pages.'); ?></span>
224
+ </label>
225
+ <br />
226
+ <label>
227
+ <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="2" <?php echo $this->options->display_pages() == 2 ? 'checked' : ''; ?> />
228
+ <span><?php echo $this->__('Only in landing page.'); ?></span>&#160;<span class="description"><?php echo $this->__('[The first page they visit on your website.]'); ?></span>
229
+ </label>
230
+ <br />
231
+ <label>
232
+ <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="3" <?php echo $this->options->display_pages() == 3 ? 'checked' : ''; ?> />
233
+ <span><?php echo $this->__('Include in following pages'); ?></span>
234
+ </label>
235
+ <div class="pages-selection">
236
+ <input type="hidden" name="<?php echo $this->options->include_pages_name(); ?>" value="<?php echo $this->options->include_pages(); ?>" />
237
+ <?php
238
+ $objects = $this->get_filter_objects();
239
+ foreach ($objects as $key => $value) {
240
+ ?>
241
+ <div class="page-div">
242
+ <input type="checkbox" value="<?php echo $key; ?>" <?php echo strpos($this->options->include_pages(), $key) === FALSE ? '' : 'checked'; ?> />
243
+ <span><?php echo $value; ?></span>
244
+ </div>
245
+ <?php
246
+ }
247
+ ?>
248
+ </div>
249
+ <label>
250
+ <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="4" <?php echo $this->options->display_pages() == 4 ? 'checked' : ''; ?> />
251
+ <span><?php echo $this->__('Exclude in following pages'); ?></span>
252
+ </label>
253
+ <div class="pages-selection">
254
+ <input type="hidden" name="<?php echo $this->options->exclude_pages_name(); ?>" value="<?php echo $this->options->exclude_pages(); ?>" />
255
+ <?php
256
+ $objects = $this->get_filter_objects();
257
+ foreach ($objects as $key => $value) {
258
+ ?>
259
+ <div class="page-div">
260
+ <input type="checkbox" value="<?php echo $key; ?>" <?php echo strpos($this->options->exclude_pages(), $key) === FALSE ? '' : 'checked'; ?> />
261
+ <span><?php echo $value; ?></span>
262
+ </div>
263
+ <?php
264
+ }
265
+ ?>
266
+ </div>
267
+ </td>
268
+ </tr>
269
+ </table>
270
+
271
  <h3><?php echo $this->__('Color'); ?></h3>
272
  <table class="form-table">
273
  <tr>
316
  <input type="hidden" name="<?php echo $this->options->button_text_color_name(); ?>" value="<?php echo $this->options->button_text_color(); ?>" />
317
  </td>
318
  </tr>
319
+ <tr>
320
+ <th scope="row">
321
+ <?php echo $this->options->open_button_color_label(); ?>
322
+ </th>
323
+ <td>
324
+ <div class="color-selector" color="<?php echo $this->options->open_button_color(); ?>"></div>&#160;<span><?php echo $this->options->open_button_color(); ?></span>
325
+ <input type="hidden" name="<?php echo $this->options->open_button_color_name(); ?>" value="<?php echo $this->options->open_button_color(); ?>" />
326
+ </td>
327
+ </tr>
328
  </table>
329
 
330
  <?php @$this->submit_button(); ?>
331
+
332
+ <a href="http://wpfront.com/notification-bar-plugin-ideas/" target="_blank"><?php echo $this->__('Plugin Ideas'); ?></a>
333
+ |
334
+ <a href="http://wpfront.com/notification-bar-plugin-settings/" target="_blank"><?php echo $this->__('Settings Description'); ?></a>
335
+ |
336
+ <a href="http://wpfront.com/notification-bar-plugin-faq/" target="_blank"><?php echo $this->__('Plugin FAQ'); ?></a>
337
+ |
338
+ <a href="http://wpfront.com/contact/" target="_blank"><?php echo $this->__('Feature Request'); ?></a>
339
+ |
340
+ <a href="http://wpfront.com/contact/" target="_blank"><?php echo $this->__('Report Bug'); ?></a>
341
+ |
342
+ <a href="http://wordpress.org/support/view/plugin-reviews/wpfront-notification-bar" target="_blank"><?php echo $this->__('Write Review'); ?></a>
343
+ |
344
+ <a href="mailto:syam@wpfront.com"><?php echo $this->__('Contact Me (syam@wpfront.com)'); ?></a>
345
  </form>
346
  </div>
347
  </div>
368
  $('#wpfront-notification-bar-options').find(".color-selector").each(function(i, e) {
369
  setColorPicker($(e));
370
  });
371
+
372
+ $('#wpfront-notification-bar-options .pages-selection input[type="checkbox"]').change(function() {
373
+ var values = [];
374
+ var div = $(this).parent().parent();
375
+ div.find('input:checked').each(function(i, e) {
376
+ values.push($(e).val());
377
+ });
378
+ div.children(":first").val(values.join());
379
+ });
380
  })(jQuery);
381
  </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.0.1
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.1
7
  * Author: Syam Mohan
8
  * Author URI: http://wpfront.com
9
  * License: GPL v3