Version Description
- You can now change the capability checked by Notification Bar.
- Use WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY constant to set your custom capability or use wpfront_notification_bar_edit_capability filter.
- You can now enable/disable notification bar based on any condition using wpfront_notification_bar_enabled filter.
Download this release
Release Info
Developer | syammohanm |
Plugin | WPFront Notification Bar |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.2.0
- classes/class-wpfront-notification-bar.php +17 -10
- readme.txt +9 -1
- wpfront-notification-bar.php +1 -1
classes/class-wpfront-notification-bar.php
CHANGED
@@ -35,7 +35,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
35 |
class WPFront_Notification_Bar {
|
36 |
|
37 |
//Constants
|
38 |
-
const VERSION = '2.
|
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';
|
@@ -46,6 +46,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
46 |
const ROLE_GUEST = 'wpfront-notification-bar-role-_guest_';
|
47 |
|
48 |
//Variables
|
|
|
49 |
private $plugin_file;
|
50 |
private $options;
|
51 |
private $markupLoaded;
|
@@ -74,6 +75,11 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
74 |
add_action('init', array($this, 'custom_css'));
|
75 |
|
76 |
if (is_admin()) {
|
|
|
|
|
|
|
|
|
|
|
77 |
add_action('admin_init', array($this, 'admin_init'));
|
78 |
add_action('admin_menu', array($this, 'admin_menu'));
|
79 |
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
@@ -158,7 +164,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
158 |
}
|
159 |
|
160 |
public function admin_menu() {
|
161 |
-
$page_hook_suffix = add_options_page(__('WPFront Notification Bar', 'wpfront-notification-bar'), __('Notification Bar', 'wpfront-notification-bar'),
|
162 |
|
163 |
add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_options_scripts'));
|
164 |
add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_options_styles'));
|
@@ -274,7 +280,7 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
274 |
|
275 |
//creates options page
|
276 |
public function options_page() {
|
277 |
-
if (!current_user_can(
|
278 |
wp_die(__('You do not have sufficient permissions to access this page.', 'wpfront-notification-bar'));
|
279 |
return;
|
280 |
}
|
@@ -628,19 +634,19 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
628 |
|
629 |
if ($this->options->enabled()) {
|
630 |
$this->log('Notification bar is enabled.');
|
631 |
-
$this->enabled = $this->filter();
|
632 |
return $this->enabled;
|
633 |
}
|
634 |
|
635 |
if ($this->is_preview_mode()) {
|
636 |
$this->log('Notification bar is running in preview mode.');
|
637 |
-
$this->enabled = $this->filter();
|
638 |
return $this->enabled;
|
639 |
}
|
640 |
|
641 |
$this->log('Notification bar is not enabled.');
|
642 |
-
$this->enabled = false;
|
643 |
-
return
|
644 |
}
|
645 |
|
646 |
public function admin_footer_text($text) {
|
@@ -747,14 +753,15 @@ if (!class_exists('WPFront_Notification_Bar')) {
|
|
747 |
|
748 |
return false;
|
749 |
}
|
750 |
-
|
751 |
protected function get_lang_domain() {
|
752 |
-
if(defined('WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN')) {
|
753 |
return WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN;
|
754 |
}
|
755 |
-
|
756 |
return 'wpfront-notification-bar';
|
757 |
}
|
|
|
758 |
}
|
759 |
|
760 |
}
|
35 |
class WPFront_Notification_Bar {
|
36 |
|
37 |
//Constants
|
38 |
+
const VERSION = '2.2.0.082910';
|
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';
|
46 |
const ROLE_GUEST = 'wpfront-notification-bar-role-_guest_';
|
47 |
|
48 |
//Variables
|
49 |
+
private $cap = 'manage_options';
|
50 |
private $plugin_file;
|
51 |
private $options;
|
52 |
private $markupLoaded;
|
75 |
add_action('init', array($this, 'custom_css'));
|
76 |
|
77 |
if (is_admin()) {
|
78 |
+
if (defined('WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY')) {
|
79 |
+
$this->cap = WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY;
|
80 |
+
}
|
81 |
+
$this->cap = apply_filters('wpfront_notification_bar_edit_capability', $this->cap);
|
82 |
+
|
83 |
add_action('admin_init', array($this, 'admin_init'));
|
84 |
add_action('admin_menu', array($this, 'admin_menu'));
|
85 |
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
164 |
}
|
165 |
|
166 |
public function admin_menu() {
|
167 |
+
$page_hook_suffix = add_options_page(__('WPFront Notification Bar', 'wpfront-notification-bar'), __('Notification Bar', 'wpfront-notification-bar'), $this->cap, self::PLUGIN_SLUG, array($this, 'options_page'));
|
168 |
|
169 |
add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_options_scripts'));
|
170 |
add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_options_styles'));
|
280 |
|
281 |
//creates options page
|
282 |
public function options_page() {
|
283 |
+
if (!current_user_can($this->cap)) {
|
284 |
wp_die(__('You do not have sufficient permissions to access this page.', 'wpfront-notification-bar'));
|
285 |
return;
|
286 |
}
|
634 |
|
635 |
if ($this->options->enabled()) {
|
636 |
$this->log('Notification bar is enabled.');
|
637 |
+
$this->enabled = apply_filters('wpfront_notification_bar_enabled', $this->filter(), $this->options);
|
638 |
return $this->enabled;
|
639 |
}
|
640 |
|
641 |
if ($this->is_preview_mode()) {
|
642 |
$this->log('Notification bar is running in preview mode.');
|
643 |
+
$this->enabled = apply_filters('wpfront_notification_bar_enabled', $this->filter(), $this->options);
|
644 |
return $this->enabled;
|
645 |
}
|
646 |
|
647 |
$this->log('Notification bar is not enabled.');
|
648 |
+
$this->enabled = apply_filters('wpfront_notification_bar_enabled', false, $this->options);
|
649 |
+
return $this->enabled;
|
650 |
}
|
651 |
|
652 |
public function admin_footer_text($text) {
|
753 |
|
754 |
return false;
|
755 |
}
|
756 |
+
|
757 |
protected function get_lang_domain() {
|
758 |
+
if (defined('WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN')) {
|
759 |
return WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN;
|
760 |
}
|
761 |
+
|
762 |
return 'wpfront-notification-bar';
|
763 |
}
|
764 |
+
|
765 |
}
|
766 |
|
767 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: notification bar, wordpress notification bar, top bar, bottom bar, notific
|
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 7.0
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -68,6 +68,11 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
= 2.1.0 =
|
72 |
* More XSS fixes. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
|
73 |
* Use **WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML** constant to get v1.x behavior on message & button text.
|
@@ -167,6 +172,9 @@ The new version(1.3) allows you to filter the bar based on user roles. In this c
|
|
167 |
|
168 |
== Upgrade Notice ==
|
169 |
|
|
|
|
|
|
|
170 |
= 2.1.0 =
|
171 |
* XSS and compatibility fixes.
|
172 |
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 7.0
|
8 |
+
Stable tag: 2.2.0
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 2.2.0 =
|
72 |
+
* You can now change the capability checked by Notification Bar.
|
73 |
+
* Use **WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY** constant to set your custom capability or use **wpfront_notification_bar_edit_capability** filter.
|
74 |
+
* You can now enable/disable notification bar based on any condition using **wpfront_notification_bar_enabled** filter.
|
75 |
+
|
76 |
= 2.1.0 =
|
77 |
* More XSS fixes. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
|
78 |
* Use **WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML** constant to get v1.x behavior on message & button text.
|
172 |
|
173 |
== Upgrade Notice ==
|
174 |
|
175 |
+
= 2.2.0 =
|
176 |
+
* New filters.
|
177 |
+
|
178 |
= 2.1.0 =
|
179 |
* XSS and compatibility fixes.
|
180 |
|
wpfront-notification-bar.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WPFront Notification Bar
|
4 |
* Plugin URI: http://wpfront.com/notification-bar-plugin/
|
5 |
* Description: Easily lets you create a bar on top or bottom to display a notification.
|
6 |
-
* Version: 2.
|
7 |
* Requires at least: 5.0
|
8 |
* Requires PHP: 7.0
|
9 |
* Author: Syam Mohan
|
3 |
* Plugin Name: WPFront Notification Bar
|
4 |
* Plugin URI: http://wpfront.com/notification-bar-plugin/
|
5 |
* Description: Easily lets you create a bar on top or bottom to display a notification.
|
6 |
+
* Version: 2.2.0.082910
|
7 |
* Requires at least: 5.0
|
8 |
* Requires PHP: 7.0
|
9 |
* Author: Syam Mohan
|