Version Description
- Bug fixes and additional variables added to debug mode.
Download this release
Release Info
Developer | rpetersen29 |
Plugin | Simple Banner |
Version | 2.9.1 |
Comparing to | |
See all releases |
Code changes from version 2.9.0 to 2.9.1
- readme.txt +8 -2
- simple-banner.js +9 -7
- simple-banner.php +11 -10
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/rpetersenDev
|
|
4 |
Tags: banner, banners, simple, announcement, announcements, cta, notification, bar, bars, free, hello bar, hellobar, pro
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.6.0
|
7 |
-
Stable tag: 2.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -85,7 +85,7 @@ If cookies are disabled on the user's browser, the banners close button expirati
|
|
85 |
|
86 |
You can clear your browser's cookies or in the browser's console you can execute:
|
87 |
|
88 |
-
`document.cookie = "simplebannerclosed=; expires=Thu,
|
89 |
`
|
90 |
|
91 |
= How do I disable the banner in my posts? =
|
@@ -118,6 +118,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
121 |
= 2.9.0 =
|
122 |
* Added close button and settings.
|
123 |
* Add `.simple-banner-button` class to allow custom close button styles.
|
@@ -250,6 +253,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
|
|
250 |
|
251 |
== Upgrade Notice ==
|
252 |
|
|
|
|
|
|
|
253 |
= 2.9.0 =
|
254 |
* Added close button and settings.
|
255 |
* Add `.simple-banner-button` class to allow custom close button styles.
|
4 |
Tags: banner, banners, simple, announcement, announcements, cta, notification, bar, bars, free, hello bar, hellobar, pro
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.6.0
|
7 |
+
Stable tag: 2.9.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
85 |
|
86 |
You can clear your browser's cookies or in the browser's console you can execute:
|
87 |
|
88 |
+
`document.cookie = "simplebannerclosed=; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/";
|
89 |
`
|
90 |
|
91 |
= How do I disable the banner in my posts? =
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 2.9.1 =
|
122 |
+
* Bug fixes and additional variables added to debug mode.
|
123 |
+
|
124 |
= 2.9.0 =
|
125 |
* Added close button and settings.
|
126 |
* Add `.simple-banner-button` class to allow custom close button styles.
|
253 |
|
254 |
== Upgrade Notice ==
|
255 |
|
256 |
+
= 2.9.1 =
|
257 |
+
* Bug fixes and additional variables added to debug mode.
|
258 |
+
|
259 |
= 2.9.0 =
|
260 |
* Added close button and settings.
|
261 |
* Add `.simple-banner-button` class to allow custom close button styles.
|
simple-banner.js
CHANGED
@@ -38,6 +38,14 @@ jQuery(document).ready(function ($) {
|
|
38 |
|
39 |
|
40 |
// Add close button function to close button and close if cookie found
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
if (simpleBannerVisible) {
|
42 |
var sbCookie = "simplebannerclosed";
|
43 |
if (scriptParams.close_button_enabled){
|
@@ -51,13 +59,7 @@ jQuery(document).ready(function ($) {
|
|
51 |
};
|
52 |
}
|
53 |
|
54 |
-
|
55 |
-
if (!scriptParams.keep_site_custom_css && document.getElementById('simple-banner-site-custom-css')) document.getElementById('simple-banner-site-custom-css').remove();
|
56 |
-
if (!scriptParams.keep_site_custom_js && document.getElementById('simple-banner-site-custom-js')) document.getElementById('simple-banner-site-custom-js').remove();
|
57 |
-
if (document.getElementById('simple-banner-header-margin')) document.getElementById('simple-banner-header-margin').remove();
|
58 |
-
if (document.getElementById('simple-banner-header-padding')) document.getElementById('simple-banner-header-padding').remove();
|
59 |
-
if (document.getElementById('simple-banner')) document.getElementById('simple-banner').remove();
|
60 |
-
}
|
61 |
} else {
|
62 |
// disable cookie if it exists
|
63 |
if (getCookie(sbCookie) === "true") {
|
38 |
|
39 |
|
40 |
// Add close button function to close button and close if cookie found
|
41 |
+
function closeBanner() {
|
42 |
+
if (!scriptParams.keep_site_custom_css && document.getElementById('simple-banner-site-custom-css')) document.getElementById('simple-banner-site-custom-css').remove();
|
43 |
+
if (!scriptParams.keep_site_custom_js && document.getElementById('simple-banner-site-custom-js')) document.getElementById('simple-banner-site-custom-js').remove();
|
44 |
+
if (document.getElementById('simple-banner-header-margin')) document.getElementById('simple-banner-header-margin').remove();
|
45 |
+
if (document.getElementById('simple-banner-header-padding')) document.getElementById('simple-banner-header-padding').remove();
|
46 |
+
if (document.getElementById('simple-banner')) document.getElementById('simple-banner').remove();
|
47 |
+
}
|
48 |
+
|
49 |
if (simpleBannerVisible) {
|
50 |
var sbCookie = "simplebannerclosed";
|
51 |
if (scriptParams.close_button_enabled){
|
59 |
};
|
60 |
}
|
61 |
|
62 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
} else {
|
64 |
// disable cookie if it exists
|
65 |
if (getCookie(sbCookie) === "true") {
|
simple-banner.php
CHANGED
@@ -3,16 +3,16 @@
|
|
3 |
* Plugin Name: Simple Banner
|
4 |
* Plugin URI: https://github.com/rpetersen29/simple-banner
|
5 |
* Description: Display a simple banner at the top of your website.
|
6 |
-
* Version: 2.9.
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
-
* @version 2.9.
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
-
define ('VERSION', '2.9.
|
16 |
|
17 |
register_activation_hook( __FILE__, 'simple_banner_activate' );
|
18 |
function simple_banner_activate() {
|
@@ -25,8 +25,8 @@ function simple_banner() {
|
|
25 |
wp_register_style('simple-banner-style', plugin_dir_url( __FILE__ ) .'simple-banner.css', '', VERSION);
|
26 |
wp_enqueue_style('simple-banner-style');
|
27 |
// Set Script parameters
|
28 |
-
$
|
29 |
-
$disabled_on_current_page = !empty($disabled_pages) && in_array(get_the_ID(),
|
30 |
$script_params = array(
|
31 |
// script specific parameters
|
32 |
'version' => VERSION,
|
@@ -40,12 +40,12 @@ function simple_banner() {
|
|
40 |
// debug specific parameters
|
41 |
'debug_mode' => get_option('debug_mode'),
|
42 |
'id' => get_the_ID(),
|
43 |
-
'disabled_pages_array' =>
|
44 |
'simple_banner_font_size' => get_option('simple_banner_font_size'),
|
45 |
'simple_banner_color' => get_option('simple_banner_color'),
|
46 |
'simple_banner_text_color' => get_option('simple_banner_text_color'),
|
47 |
'simple_banner_link_color' => get_option('simple_banner_link_color'),
|
48 |
-
'simple_banner_text' => $disabled_on_current_page ?
|
49 |
'simple_banner_custom_css' => get_option('simple_banner_custom_css'),
|
50 |
'simple_banner_scrolling_custom_css' => get_option('simple_banner_scrolling_custom_css'),
|
51 |
'simple_banner_text_custom_css' => get_option('simple_banner_text_custom_css'),
|
@@ -58,6 +58,7 @@ function simple_banner() {
|
|
58 |
'wp_body_open' => function_exists('wp_body_open'),
|
59 |
'close_button_enabled' => get_option('close_button_enabled'),
|
60 |
'close_button_expiration' => get_option('close_button_expiration'),
|
|
|
61 |
);
|
62 |
// Enqueue the script
|
63 |
wp_register_script('simple-banner-script', plugin_dir_url( __FILE__ ) . 'simple-banner.js', array( 'jquery' ), VERSION);
|
@@ -74,7 +75,7 @@ function simple_banner_body_open() {
|
|
74 |
$disabled_pages = get_option('disabled_pages_array');
|
75 |
$close_button_enabled = get_option('close_button_enabled');
|
76 |
$disabled_on_current_page = !empty($disabled_pages) && in_array(get_the_ID(), explode(',', $disabled_pages));
|
77 |
-
$closed_cookie = $close_button_enabled && isset($_COOKIE[
|
78 |
$closed_button = get_option('close_button_enabled') ? '<button id="simple-banner-close-button" class="simple-banner-button">✕</button>' : '';
|
79 |
|
80 |
if (!$disabled_on_current_page && !$closed_cookie) {
|
@@ -307,7 +308,7 @@ function simple_banner_settings_page() {
|
|
307 |
Close button expiration
|
308 |
<br>
|
309 |
<span style="font-weight:400;">
|
310 |
-
The amount of days until the close button action will
|
311 |
</span>
|
312 |
</th>
|
313 |
<td>
|
@@ -419,7 +420,7 @@ function simple_banner_settings_page() {
|
|
419 |
<br><span style="font-weight:400;">Change the <code>position</code> value of your banner. More information <a target="_blank" href="https://www.w3schools.com/cssref/pr_class_position.asp">here</a></span>
|
420 |
</th>
|
421 |
<td style="vertical-align:top;">
|
422 |
-
<!-- -->
|
423 |
<input type="radio" id="footer" name="simple_banner_position" value="footer" <?php echo ((get_option('simple_banner_position') == 'footer') ? 'checked' : '' ); ?>>
|
424 |
<label for="footer"><strong>footer:</strong> <span>The banner is fixed on the bottom of the window</span></label><br>
|
425 |
<!-- -->
|
3 |
* Plugin Name: Simple Banner
|
4 |
* Plugin URI: https://github.com/rpetersen29/simple-banner
|
5 |
* Description: Display a simple banner at the top of your website.
|
6 |
+
* Version: 2.9.1
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
+
* @version 2.9.1
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
+
define ('VERSION', '2.9.1');
|
16 |
|
17 |
register_activation_hook( __FILE__, 'simple_banner_activate' );
|
18 |
function simple_banner_activate() {
|
25 |
wp_register_style('simple-banner-style', plugin_dir_url( __FILE__ ) .'simple-banner.css', '', VERSION);
|
26 |
wp_enqueue_style('simple-banner-style');
|
27 |
// Set Script parameters
|
28 |
+
$disabled_pages_array = explode(',', get_option('disabled_pages_array'));
|
29 |
+
$disabled_on_current_page = !empty($disabled_pages) && in_array(get_the_ID(), $disabled_pages_array);
|
30 |
$script_params = array(
|
31 |
// script specific parameters
|
32 |
'version' => VERSION,
|
40 |
// debug specific parameters
|
41 |
'debug_mode' => get_option('debug_mode'),
|
42 |
'id' => get_the_ID(),
|
43 |
+
'disabled_pages_array' => $disabled_pages_array,
|
44 |
'simple_banner_font_size' => get_option('simple_banner_font_size'),
|
45 |
'simple_banner_color' => get_option('simple_banner_color'),
|
46 |
'simple_banner_text_color' => get_option('simple_banner_text_color'),
|
47 |
'simple_banner_link_color' => get_option('simple_banner_link_color'),
|
48 |
+
'simple_banner_text' => $disabled_on_current_page ? '' : get_option('simple_banner_text'),
|
49 |
'simple_banner_custom_css' => get_option('simple_banner_custom_css'),
|
50 |
'simple_banner_scrolling_custom_css' => get_option('simple_banner_scrolling_custom_css'),
|
51 |
'simple_banner_text_custom_css' => get_option('simple_banner_text_custom_css'),
|
58 |
'wp_body_open' => function_exists('wp_body_open'),
|
59 |
'close_button_enabled' => get_option('close_button_enabled'),
|
60 |
'close_button_expiration' => get_option('close_button_expiration'),
|
61 |
+
'close_button_cookie_set' => isset($_COOKIE['simplebannerclosed']),
|
62 |
);
|
63 |
// Enqueue the script
|
64 |
wp_register_script('simple-banner-script', plugin_dir_url( __FILE__ ) . 'simple-banner.js', array( 'jquery' ), VERSION);
|
75 |
$disabled_pages = get_option('disabled_pages_array');
|
76 |
$close_button_enabled = get_option('close_button_enabled');
|
77 |
$disabled_on_current_page = !empty($disabled_pages) && in_array(get_the_ID(), explode(',', $disabled_pages));
|
78 |
+
$closed_cookie = $close_button_enabled && isset($_COOKIE['simplebannerclosed']);
|
79 |
$closed_button = get_option('close_button_enabled') ? '<button id="simple-banner-close-button" class="simple-banner-button">✕</button>' : '';
|
80 |
|
81 |
if (!$disabled_on_current_page && !$closed_cookie) {
|
308 |
Close button expiration
|
309 |
<br>
|
310 |
<span style="font-weight:400;">
|
311 |
+
The amount of days until the close button action will expire. Default is 30.
|
312 |
</span>
|
313 |
</th>
|
314 |
<td>
|
420 |
<br><span style="font-weight:400;">Change the <code>position</code> value of your banner. More information <a target="_blank" href="https://www.w3schools.com/cssref/pr_class_position.asp">here</a></span>
|
421 |
</th>
|
422 |
<td style="vertical-align:top;">
|
423 |
+
<!-- TODO: Update label definition of footer -->
|
424 |
<input type="radio" id="footer" name="simple_banner_position" value="footer" <?php echo ((get_option('simple_banner_position') == 'footer') ? 'checked' : '' ); ?>>
|
425 |
<label for="footer"><strong>footer:</strong> <span>The banner is fixed on the bottom of the window</span></label><br>
|
426 |
<!-- -->
|