Version Description
- Bug fixes & improvements.
Download this release
Release Info
Developer | rpetersen29 |
Plugin | Simple Banner |
Version | 2.10.5 |
Comparing to | |
See all releases |
Code changes from version 2.10.4 to 2.10.5
- readme.txt +8 -2
- simple-banner.js +12 -12
- simple-banner.php +32 -25
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: rpetersen29
|
|
3 |
Donate link: https://www.paypal.me/rpetersenDev
|
4 |
Tags: banner, simple, top, bar, announcement, top bar, topbar, bulletin, notification, notice, cta, free
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 5.8
|
7 |
-
Stable tag: 2.10.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -118,6 +118,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
121 |
= 2.10.4 =
|
122 |
* More changes to stop scammers.
|
123 |
|
@@ -277,6 +280,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
|
|
277 |
|
278 |
== Upgrade Notice ==
|
279 |
|
|
|
|
|
|
|
280 |
= 2.10.4 =
|
281 |
* More changes to stop scammers.
|
282 |
|
3 |
Donate link: https://www.paypal.me/rpetersenDev
|
4 |
Tags: banner, simple, top, bar, announcement, top bar, topbar, bulletin, notification, notice, cta, free
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 5.8.1
|
7 |
+
Stable tag: 2.10.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 2.10.5 =
|
122 |
+
* Bug fixes & improvements.
|
123 |
+
|
124 |
= 2.10.4 =
|
125 |
* More changes to stop scammers.
|
126 |
|
280 |
|
281 |
== Upgrade Notice ==
|
282 |
|
283 |
+
= 2.10.5 =
|
284 |
+
* Bug fixes & improvements.
|
285 |
+
|
286 |
= 2.10.4 =
|
287 |
* More changes to stop scammers.
|
288 |
|
simple-banner.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
-
// Banner text is set to "" if disabled so this extra `!
|
3 |
// Leaving in for potential backwards compatibility issues, revisit when testing is done.
|
4 |
-
var simpleBannerVisible = !
|
5 |
-
if (
|
6 |
if (simpleBannerVisible) {
|
7 |
-
if (!
|
8 |
-
var closeButton =
|
9 |
$('<div id="simple-banner" class="simple-banner"><div class="simple-banner-text"><span>'
|
10 |
-
+
|
11 |
+ '</span></div>' + closeButton + '</div>')
|
12 |
.prependTo('body');
|
13 |
}
|
@@ -39,8 +39,8 @@ jQuery(document).ready(function ($) {
|
|
39 |
|
40 |
// Add close button function to close button and close if cookie found
|
41 |
function closeBanner() {
|
42 |
-
if (!
|
43 |
-
if (!
|
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();
|
@@ -48,11 +48,11 @@ jQuery(document).ready(function ($) {
|
|
48 |
|
49 |
if (simpleBannerVisible) {
|
50 |
var sbCookie = "simplebannerclosed";
|
51 |
-
if (
|
52 |
if (getCookie(sbCookie) === "true") {
|
53 |
closeBanner();
|
54 |
} else {
|
55 |
-
var expiration = parseInt(
|
56 |
document.getElementById("simple-banner-close-button").onclick = function() {
|
57 |
closeBanner();
|
58 |
setCookie(sbCookie, "true", expiration);
|
@@ -93,7 +93,7 @@ jQuery(document).ready(function ($) {
|
|
93 |
|
94 |
// Debug Mode
|
95 |
// Console log all variables
|
96 |
-
if (
|
97 |
-
console.log(
|
98 |
}
|
99 |
});
|
1 |
jQuery(document).ready(function ($) {
|
2 |
+
// Banner text is set to "" if disabled so this extra `!simpleBannerScriptParams.disabled_on_current_page` is unnecessary,
|
3 |
// Leaving in for potential backwards compatibility issues, revisit when testing is done.
|
4 |
+
var simpleBannerVisible = !simpleBannerScriptParams.pro_version_enabled || (simpleBannerScriptParams.pro_version_enabled && !simpleBannerScriptParams.disabled_on_current_page);
|
5 |
+
if (simpleBannerScriptParams.simple_banner_text != "") {
|
6 |
if (simpleBannerVisible) {
|
7 |
+
if (!simpleBannerScriptParams.wp_body_open || !simpleBannerScriptParams.wp_body_open_enabled) {
|
8 |
+
var closeButton = simpleBannerScriptParams.close_button_enabled ? '<button id="simple-banner-close-button" class="simple-banner-button">✕</button>' : '';
|
9 |
$('<div id="simple-banner" class="simple-banner"><div class="simple-banner-text"><span>'
|
10 |
+
+ simpleBannerScriptParams.simple_banner_text
|
11 |
+ '</span></div>' + closeButton + '</div>')
|
12 |
.prependTo('body');
|
13 |
}
|
39 |
|
40 |
// Add close button function to close button and close if cookie found
|
41 |
function closeBanner() {
|
42 |
+
if (!simpleBannerScriptParams.keep_site_custom_css && document.getElementById('simple-banner-site-custom-css')) document.getElementById('simple-banner-site-custom-css').remove();
|
43 |
+
if (!simpleBannerScriptParams.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();
|
48 |
|
49 |
if (simpleBannerVisible) {
|
50 |
var sbCookie = "simplebannerclosed";
|
51 |
+
if (simpleBannerScriptParams.close_button_enabled){
|
52 |
if (getCookie(sbCookie) === "true") {
|
53 |
closeBanner();
|
54 |
} else {
|
55 |
+
var expiration = parseInt(simpleBannerScriptParams.close_button_expiration) || 30;
|
56 |
document.getElementById("simple-banner-close-button").onclick = function() {
|
57 |
closeBanner();
|
58 |
setCookie(sbCookie, "true", expiration);
|
93 |
|
94 |
// Debug Mode
|
95 |
// Console log all variables
|
96 |
+
if (simpleBannerScriptParams.pro_version_enabled && simpleBannerScriptParams.debug_mode) {
|
97 |
+
console.log(simpleBannerScriptParams);
|
98 |
}
|
99 |
});
|
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.10.
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
-
* @version 2.10.
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
-
define ('VERSION', '2.10.
|
16 |
|
17 |
register_activation_hook( __FILE__, 'simple_banner_activate' );
|
18 |
function simple_banner_activate() {
|
@@ -93,7 +93,7 @@ function simple_banner() {
|
|
93 |
);
|
94 |
// Enqueue the script
|
95 |
wp_register_script('simple-banner-script', plugin_dir_url( __FILE__ ) . 'simple-banner.js', array( 'jquery' ), VERSION);
|
96 |
-
wp_localize_script('simple-banner-script', '
|
97 |
wp_enqueue_script('simple-banner-script');
|
98 |
}
|
99 |
|
@@ -117,9 +117,16 @@ function simple_banner_body_open() {
|
|
117 |
}
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
// Add custom CSS/JS
|
121 |
-
add_action( 'wp_head', '
|
122 |
-
function
|
123 |
{
|
124 |
$closed_cookie = get_stripped_option('close_button_enabled') && isset($_COOKIE["simplebannerclosed"]);
|
125 |
|
@@ -127,73 +134,73 @@ function simple_banner_custom_color()
|
|
127 |
$banner_is_disabled = $disabled_on_current_page || get_stripped_option('hide_simple_banner') == "yes";
|
128 |
|
129 |
if ($banner_is_disabled || $closed_cookie){
|
130 |
-
echo '<style type="text/css"
|
131 |
}
|
132 |
|
133 |
if (!$banner_is_disabled && !$closed_cookie && get_stripped_option('header_margin') != ""){
|
134 |
-
echo '<style id="simple-banner-header-margin" type="text/css"
|
135 |
}
|
136 |
|
137 |
if (!$banner_is_disabled && !$closed_cookie && get_stripped_option('header_padding') != ""){
|
138 |
-
echo '<style id="simple-banner-header-padding" type="text/css"
|
139 |
}
|
140 |
|
141 |
if (get_stripped_option('simple_banner_position') != ""){
|
142 |
if (get_stripped_option('simple_banner_position') == 'footer'){
|
143 |
-
echo '<style type="text/css"
|
144 |
} else {
|
145 |
-
echo '<style type="text/css"
|
146 |
}
|
147 |
}
|
148 |
|
149 |
if (get_stripped_option('simple_banner_font_size') != ""){
|
150 |
-
echo '<style type="text/css"
|
151 |
}
|
152 |
|
153 |
if (get_stripped_option('simple_banner_color') != ""){
|
154 |
-
echo '<style type="text/css"
|
155 |
} else {
|
156 |
-
echo '<style type="text/css"
|
157 |
}
|
158 |
|
159 |
if (get_stripped_option('simple_banner_text_color') != ""){
|
160 |
-
echo '<style type="text/css"
|
161 |
} else {
|
162 |
-
echo '<style type="text/css"
|
163 |
}
|
164 |
|
165 |
if (get_stripped_option('simple_banner_link_color') != ""){
|
166 |
-
echo '<style type="text/css"
|
167 |
} else {
|
168 |
-
echo '<style type="text/css"
|
169 |
}
|
170 |
|
171 |
if (get_stripped_option('simple_banner_close_color') != ""){
|
172 |
-
echo '<style type="text/css"
|
173 |
}
|
174 |
|
175 |
if (get_stripped_option('simple_banner_custom_css') != ""){
|
176 |
-
echo '<style type="text/css"
|
177 |
}
|
178 |
|
179 |
if (get_stripped_option('simple_banner_scrolling_custom_css') != ""){
|
180 |
-
echo '<style type="text/css"
|
181 |
}
|
182 |
|
183 |
if (get_stripped_option('simple_banner_text_custom_css') != ""){
|
184 |
-
echo '<style type="text/css"
|
185 |
}
|
186 |
|
187 |
if (get_stripped_option('simple_banner_button_css') != ""){
|
188 |
-
echo '<style type="text/css"
|
189 |
}
|
190 |
|
191 |
$remove_site_custom_css = ($banner_is_disabled || $closed_cookie) && get_stripped_option('keep_site_custom_css') == "";
|
192 |
if (!$remove_site_custom_css && get_stripped_option('site_custom_css') != "" && get_stripped_option('pro_version_enabled')) {
|
193 |
-
echo '<style id="simple-banner-site-custom-css" type="text/css"
|
194 |
} else {
|
195 |
// put a dummy element to see if css is being bundled
|
196 |
-
echo '<style id="simple-banner-site-custom-css-dummy" type="text/css"
|
197 |
}
|
198 |
|
199 |
$remove_site_custom_js = ($banner_is_disabled || $closed_cookie) && get_stripped_option('keep_site_custom_js') == "";
|
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.10.5
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
+
* @version 2.10.5
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
+
define ('VERSION', '2.10.5');
|
16 |
|
17 |
register_activation_hook( __FILE__, 'simple_banner_activate' );
|
18 |
function simple_banner_activate() {
|
93 |
);
|
94 |
// Enqueue the script
|
95 |
wp_register_script('simple-banner-script', plugin_dir_url( __FILE__ ) . 'simple-banner.js', array( 'jquery' ), VERSION);
|
96 |
+
wp_localize_script('simple-banner-script', 'simpleBannerScriptParams', $script_params);
|
97 |
wp_enqueue_script('simple-banner-script');
|
98 |
}
|
99 |
|
117 |
}
|
118 |
}
|
119 |
|
120 |
+
// Prevent CSS removal from optimizer plugins by putting a dummy item in the
|
121 |
+
add_action( 'wp_footer', 'prevent_css_removal');
|
122 |
+
function prevent_css_removal()
|
123 |
+
{
|
124 |
+
echo '<div class="simple-banner simple-banner-text" style="display:none !important"></div>';
|
125 |
+
}
|
126 |
+
|
127 |
// Add custom CSS/JS
|
128 |
+
add_action( 'wp_head', 'simple_banner_custom_options');
|
129 |
+
function simple_banner_custom_options()
|
130 |
{
|
131 |
$closed_cookie = get_stripped_option('close_button_enabled') && isset($_COOKIE["simplebannerclosed"]);
|
132 |
|
134 |
$banner_is_disabled = $disabled_on_current_page || get_stripped_option('hide_simple_banner') == "yes";
|
135 |
|
136 |
if ($banner_is_disabled || $closed_cookie){
|
137 |
+
echo '<style type="text/css">.simple-banner{display:none;}</style>';
|
138 |
}
|
139 |
|
140 |
if (!$banner_is_disabled && !$closed_cookie && get_stripped_option('header_margin') != ""){
|
141 |
+
echo '<style id="simple-banner-header-margin" type="text/css">header{margin-top:' . get_stripped_option('header_margin') . ';}</style>';
|
142 |
}
|
143 |
|
144 |
if (!$banner_is_disabled && !$closed_cookie && get_stripped_option('header_padding') != ""){
|
145 |
+
echo '<style id="simple-banner-header-padding" type="text/css" >header{padding-top:' . get_stripped_option('header_padding') . ';}</style>';
|
146 |
}
|
147 |
|
148 |
if (get_stripped_option('simple_banner_position') != ""){
|
149 |
if (get_stripped_option('simple_banner_position') == 'footer'){
|
150 |
+
echo '<style type="text/css">.simple-banner{position:fixed;bottom:0;}</style>';
|
151 |
} else {
|
152 |
+
echo '<style type="text/css">.simple-banner{position:' . get_stripped_option('simple_banner_position') . ';}</style>';
|
153 |
}
|
154 |
}
|
155 |
|
156 |
if (get_stripped_option('simple_banner_font_size') != ""){
|
157 |
+
echo '<style type="text/css">.simple-banner .simple-banner-text{font-size:' . get_stripped_option('simple_banner_font_size') . ';}</style>';
|
158 |
}
|
159 |
|
160 |
if (get_stripped_option('simple_banner_color') != ""){
|
161 |
+
echo '<style type="text/css">.simple-banner{background:' . get_stripped_option('simple_banner_color') . ';}</style>';
|
162 |
} else {
|
163 |
+
echo '<style type="text/css">.simple-banner{background: #024985;}</style>';
|
164 |
}
|
165 |
|
166 |
if (get_stripped_option('simple_banner_text_color') != ""){
|
167 |
+
echo '<style type="text/css">.simple-banner .simple-banner-text{color:' . get_stripped_option('simple_banner_text_color') . ';}</style>';
|
168 |
} else {
|
169 |
+
echo '<style type="text/css">.simple-banner .simple-banner-text{color: #ffffff;}</style>';
|
170 |
}
|
171 |
|
172 |
if (get_stripped_option('simple_banner_link_color') != ""){
|
173 |
+
echo '<style type="text/css">.simple-banner .simple-banner-text a{color:' . get_stripped_option('simple_banner_link_color') . ';}</style>';
|
174 |
} else {
|
175 |
+
echo '<style type="text/css">.simple-banner .simple-banner-text a{color:#f16521;}</style>';
|
176 |
}
|
177 |
|
178 |
if (get_stripped_option('simple_banner_close_color') != ""){
|
179 |
+
echo '<style type="text/css">.simple-banner .simple-banner-button{color:' . get_stripped_option('simple_banner_close_color') . ';}</style>';
|
180 |
}
|
181 |
|
182 |
if (get_stripped_option('simple_banner_custom_css') != ""){
|
183 |
+
echo '<style type="text/css">.simple-banner{'. get_stripped_option('simple_banner_custom_css') . '}</style>';
|
184 |
}
|
185 |
|
186 |
if (get_stripped_option('simple_banner_scrolling_custom_css') != ""){
|
187 |
+
echo '<style type="text/css">.simple-banner.simple-banner-scrolling{'. get_stripped_option('simple_banner_scrolling_custom_css') . '}</style>';
|
188 |
}
|
189 |
|
190 |
if (get_stripped_option('simple_banner_text_custom_css') != ""){
|
191 |
+
echo '<style type="text/css">.simple-banner .simple-banner-text{'. get_stripped_option('simple_banner_text_custom_css') . '}</style>';
|
192 |
}
|
193 |
|
194 |
if (get_stripped_option('simple_banner_button_css') != ""){
|
195 |
+
echo '<style type="text/css">.simple-banner .simple-banner-button{'. get_stripped_option('simple_banner_button_css') . '}</style>';
|
196 |
}
|
197 |
|
198 |
$remove_site_custom_css = ($banner_is_disabled || $closed_cookie) && get_stripped_option('keep_site_custom_css') == "";
|
199 |
if (!$remove_site_custom_css && get_stripped_option('site_custom_css') != "" && get_stripped_option('pro_version_enabled')) {
|
200 |
+
echo '<style id="simple-banner-site-custom-css" type="text/css">'. get_stripped_option('site_custom_css') . '</style>';
|
201 |
} else {
|
202 |
// put a dummy element to see if css is being bundled
|
203 |
+
echo '<style id="simple-banner-site-custom-css-dummy" type="text/css"></style>';
|
204 |
}
|
205 |
|
206 |
$remove_site_custom_js = ($banner_is_disabled || $closed_cookie) && get_stripped_option('keep_site_custom_js') == "";
|