Version Description
- Bug fixes and added close button color setting.
Download this release
Release Info
Developer | rpetersen29 |
Plugin | Simple Banner |
Version | 2.9.2 |
Comparing to | |
See all releases |
Code changes from version 2.9.1 to 2.9.2
- readme.txt +7 -1
- simple-banner.php +66 -14
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 |
|
@@ -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.1 =
|
122 |
* Bug fixes and additional variables added to debug mode.
|
123 |
|
@@ -253,6 +256,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
|
|
253 |
|
254 |
== Upgrade Notice ==
|
255 |
|
|
|
|
|
|
|
256 |
= 2.9.1 =
|
257 |
* Bug fixes and additional variables added to debug mode.
|
258 |
|
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.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 2.9.2 =
|
122 |
+
* Bug fixes and added close button color setting.
|
123 |
+
|
124 |
= 2.9.1 =
|
125 |
* Bug fixes and additional variables added to debug mode.
|
126 |
|
256 |
|
257 |
== Upgrade Notice ==
|
258 |
|
259 |
+
= 2.9.2 =
|
260 |
+
* Bug fixes and added close button color setting.
|
261 |
+
|
262 |
= 2.9.1 =
|
263 |
* Bug fixes and additional variables added to debug mode.
|
264 |
|
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() {
|
@@ -45,6 +45,7 @@ function simple_banner() {
|
|
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'),
|
@@ -139,6 +140,10 @@ function simple_banner_custom_color()
|
|
139 |
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text a{color:#f16521;}</style>';
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
142 |
if (get_option('simple_banner_custom_css') != ""){
|
143 |
echo '<style type="text/css" media="screen">.simple-banner{'. get_option('simple_banner_custom_css') . '}</style>';
|
144 |
}
|
@@ -158,11 +163,17 @@ function simple_banner_custom_color()
|
|
158 |
$remove_site_custom_css = ($banner_is_disabled || $closed_cookie) && get_option('keep_site_custom_css') == "";
|
159 |
if (!$remove_site_custom_css && get_option('site_custom_css') != "" && get_option('pro_version_enabled')) {
|
160 |
echo '<style id="simple-banner-site-custom-css" type="text/css" media="screen">'. get_option('site_custom_css') . '</style>';
|
|
|
|
|
|
|
161 |
}
|
162 |
|
163 |
$remove_site_custom_js = ($banner_is_disabled || $closed_cookie) && get_option('keep_site_custom_js') == "";
|
164 |
if (!$remove_site_custom_js && get_option('site_custom_js') != "" && get_option('pro_version_enabled')) {
|
165 |
echo '<script id="simple-banner-site-custom-js" type="text/javascript">'. get_option('site_custom_js') . '</script>';
|
|
|
|
|
|
|
166 |
}
|
167 |
}
|
168 |
|
@@ -206,6 +217,7 @@ function simple_banner_settings() {
|
|
206 |
register_setting( 'simple-banner-settings-group', 'simple_banner_color' );
|
207 |
register_setting( 'simple-banner-settings-group', 'simple_banner_text_color' );
|
208 |
register_setting( 'simple-banner-settings-group', 'simple_banner_link_color' );
|
|
|
209 |
register_setting( 'simple-banner-settings-group', 'simple_banner_text' );
|
210 |
register_setting( 'simple-banner-settings-group', 'simple_banner_custom_css' );
|
211 |
register_setting( 'simple-banner-settings-group', 'simple_banner_scrolling_custom_css' );
|
@@ -254,10 +266,12 @@ function simple_banner_settings_page() {
|
|
254 |
<br />e.g. <code>This is a <a href="http://www.wordpress.com">Link to Wordpress</a></code>.</p>
|
255 |
|
256 |
<!-- Preview Banner -->
|
257 |
-
<div id="
|
258 |
-
<div id="
|
259 |
-
<div id="
|
260 |
-
<
|
|
|
|
|
261 |
</div>
|
262 |
</div>
|
263 |
</div>
|
@@ -367,6 +381,19 @@ function simple_banner_settings_page() {
|
|
367 |
value="<?php echo ((get_option('simple_banner_link_color') == '') ? '#f16521' : esc_attr( get_option('simple_banner_link_color') )); ?>">
|
368 |
</td>
|
369 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
<!-- Text Contents -->
|
371 |
<tr valign="top">
|
372 |
<th scope="row">
|
@@ -420,9 +447,9 @@ function simple_banner_settings_page() {
|
|
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 |
-
<!--
|
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
|
426 |
<!-- -->
|
427 |
<input type="radio" id="static" name="simple_banner_position" value="static" <?php echo ((get_option('simple_banner_position') == 'static') ? 'checked' : '' ); ?>>
|
428 |
<label for="static"><strong>static:</strong> <span>Default value. Elements render in order, as they appear in the document flow</span></label><br>
|
@@ -434,7 +461,7 @@ function simple_banner_settings_page() {
|
|
434 |
<label for="fixed"><strong>fixed:</strong> <span>The element is positioned relative to the browser window</span></label><br>
|
435 |
<!-- -->
|
436 |
<input type="radio" id="relative" name="simple_banner_position" value="relative" <?php echo ((get_option('simple_banner_position') == 'relative') ? 'checked' : '' ); ?>>
|
437 |
-
<label for="relative"><strong>relative:</strong> <span>The element is positioned relative to its normal position, so
|
438 |
<!-- -->
|
439 |
<input type="radio" id="sticky" name="simple_banner_position" value="sticky" <?php echo ((get_option('simple_banner_position') == 'sticky') ? 'checked' : '' ); ?>>
|
440 |
<label for="sticky"><strong>sticky:</strong> <span>The element is positioned based on the user's scroll position</span></label><br>
|
@@ -708,8 +735,8 @@ function simple_banner_settings_page() {
|
|
708 |
// Fixed Preview Banner on scroll
|
709 |
window.onscroll = function() {fixedBanner()};
|
710 |
function fixedBanner() {
|
711 |
-
var elementContainer = document.getElementById('
|
712 |
-
var elementTarget = document.getElementById('
|
713 |
if (window.scrollY > (elementContainer.offsetTop)) {
|
714 |
elementTarget.style.position = 'fixed';
|
715 |
elementTarget.style.width = '83.671%';
|
@@ -725,8 +752,7 @@ function simple_banner_settings_page() {
|
|
725 |
var style_background_color = document.createElement('style');
|
726 |
var style_link_color = document.createElement('style');
|
727 |
var style_text_color = document.createElement('style');
|
728 |
-
|
729 |
-
// var style_close_color = document.createElement('style');
|
730 |
var style_custom_css = document.createElement('style');
|
731 |
var style_custom_text_css = document.createElement('style');
|
732 |
var style_custom_button_css = document.createElement('style');
|
@@ -853,6 +879,32 @@ function simple_banner_settings_page() {
|
|
853 |
document.getElementById('simple_banner_link_color').dispatchEvent(new Event('change'));
|
854 |
};
|
855 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
// Custom CSS
|
857 |
style_custom_css.type = 'text/css';
|
858 |
style_custom_css.id = 'preview_banner_custom_stylesheet'
|
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.2
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
+
* @version 2.9.2
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
+
define ('VERSION', '2.9.2');
|
16 |
|
17 |
register_activation_hook( __FILE__, 'simple_banner_activate' );
|
18 |
function simple_banner_activate() {
|
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_close_color' => get_option('simple_banner_close_color'),
|
49 |
'simple_banner_text' => $disabled_on_current_page ? '' : get_option('simple_banner_text'),
|
50 |
'simple_banner_custom_css' => get_option('simple_banner_custom_css'),
|
51 |
'simple_banner_scrolling_custom_css' => get_option('simple_banner_scrolling_custom_css'),
|
140 |
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text a{color:#f16521;}</style>';
|
141 |
}
|
142 |
|
143 |
+
if (get_option('simple_banner_close_color') != ""){
|
144 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-button{color:' . get_option('simple_banner_close_color') . ';}</style>';
|
145 |
+
}
|
146 |
+
|
147 |
if (get_option('simple_banner_custom_css') != ""){
|
148 |
echo '<style type="text/css" media="screen">.simple-banner{'. get_option('simple_banner_custom_css') . '}</style>';
|
149 |
}
|
163 |
$remove_site_custom_css = ($banner_is_disabled || $closed_cookie) && get_option('keep_site_custom_css') == "";
|
164 |
if (!$remove_site_custom_css && get_option('site_custom_css') != "" && get_option('pro_version_enabled')) {
|
165 |
echo '<style id="simple-banner-site-custom-css" type="text/css" media="screen">'. get_option('site_custom_css') . '</style>';
|
166 |
+
} else {
|
167 |
+
// put a dummy element to see if css is being bundled
|
168 |
+
echo '<style id="simple-banner-site-custom-css-dummy" type="text/css" media="screen"></style>';
|
169 |
}
|
170 |
|
171 |
$remove_site_custom_js = ($banner_is_disabled || $closed_cookie) && get_option('keep_site_custom_js') == "";
|
172 |
if (!$remove_site_custom_js && get_option('site_custom_js') != "" && get_option('pro_version_enabled')) {
|
173 |
echo '<script id="simple-banner-site-custom-js" type="text/javascript">'. get_option('site_custom_js') . '</script>';
|
174 |
+
} else {
|
175 |
+
// put a dummy element to see if scripts are being bundled
|
176 |
+
echo '<script id="simple-banner-site-custom-js-dummy" type="text/javascript"></script>';
|
177 |
}
|
178 |
}
|
179 |
|
217 |
register_setting( 'simple-banner-settings-group', 'simple_banner_color' );
|
218 |
register_setting( 'simple-banner-settings-group', 'simple_banner_text_color' );
|
219 |
register_setting( 'simple-banner-settings-group', 'simple_banner_link_color' );
|
220 |
+
register_setting( 'simple-banner-settings-group', 'simple_banner_close_color' );
|
221 |
register_setting( 'simple-banner-settings-group', 'simple_banner_text' );
|
222 |
register_setting( 'simple-banner-settings-group', 'simple_banner_custom_css' );
|
223 |
register_setting( 'simple-banner-settings-group', 'simple_banner_scrolling_custom_css' );
|
266 |
<br />e.g. <code>This is a <a href="http://www.wordpress.com">Link to Wordpress</a></code>.</p>
|
267 |
|
268 |
<!-- Preview Banner -->
|
269 |
+
<div id="preview_banner_outer_container" style="min-height: 40px;">
|
270 |
+
<div id="preview_banner_inner_container">
|
271 |
+
<div id="preview_banner" class="simple-banner" style="width: 100%;text-align: center;">
|
272 |
+
<div id="preview_banner_text" class="simple-banner-text" style="font-weight: 700;padding: 10px;">
|
273 |
+
<span>This is what your banner will look like with a <a href="/">link</a>.</span>
|
274 |
+
</div>
|
275 |
</div>
|
276 |
</div>
|
277 |
</div>
|
381 |
value="<?php echo ((get_option('simple_banner_link_color') == '') ? '#f16521' : esc_attr( get_option('simple_banner_link_color') )); ?>">
|
382 |
</td>
|
383 |
</tr>
|
384 |
+
<!-- Close Color-->
|
385 |
+
<tr valign="top">
|
386 |
+
<th scope="row">
|
387 |
+
Simple Banner Close Button Color
|
388 |
+
<br><span style="font-weight:400;">Leaving this blank sets the color to the default value black</span>
|
389 |
+
</th>
|
390 |
+
<td style="vertical-align:top;">
|
391 |
+
<input type="text" id="simple_banner_close_color" name="simple_banner_close_color" placeholder="Hex value"
|
392 |
+
value="<?php echo esc_attr( get_option('simple_banner_close_color') ); ?>" />
|
393 |
+
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_close_color_show"
|
394 |
+
value="<?php echo ((get_option('simple_banner_close_color') == '') ? 'black' : esc_attr( get_option('simple_banner_close_color') )); ?>">
|
395 |
+
</td>
|
396 |
+
</tr>
|
397 |
<!-- Text Contents -->
|
398 |
<tr valign="top">
|
399 |
<th scope="row">
|
447 |
<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>
|
448 |
</th>
|
449 |
<td style="vertical-align:top;">
|
450 |
+
<!-- -->
|
451 |
<input type="radio" id="footer" name="simple_banner_position" value="footer" <?php echo ((get_option('simple_banner_position') == 'footer') ? 'checked' : '' ); ?>>
|
452 |
+
<label for="footer"><strong>footer:</strong> <span>The banner is fixed on the bottom of the window. Updates the banner position with the following css attributes <code>position: fixed;bottom: 0;</code></span></label><br>
|
453 |
<!-- -->
|
454 |
<input type="radio" id="static" name="simple_banner_position" value="static" <?php echo ((get_option('simple_banner_position') == 'static') ? 'checked' : '' ); ?>>
|
455 |
<label for="static"><strong>static:</strong> <span>Default value. Elements render in order, as they appear in the document flow</span></label><br>
|
461 |
<label for="fixed"><strong>fixed:</strong> <span>The element is positioned relative to the browser window</span></label><br>
|
462 |
<!-- -->
|
463 |
<input type="radio" id="relative" name="simple_banner_position" value="relative" <?php echo ((get_option('simple_banner_position') == 'relative') ? 'checked' : '' ); ?>>
|
464 |
+
<label for="relative"><strong>relative:</strong> <span>The element is positioned relative to its normal position, so <code>left:20px</code> adds 20 pixels to the element's LEFT position</span></label><br>
|
465 |
<!-- -->
|
466 |
<input type="radio" id="sticky" name="simple_banner_position" value="sticky" <?php echo ((get_option('simple_banner_position') == 'sticky') ? 'checked' : '' ); ?>>
|
467 |
<label for="sticky"><strong>sticky:</strong> <span>The element is positioned based on the user's scroll position</span></label><br>
|
735 |
// Fixed Preview Banner on scroll
|
736 |
window.onscroll = function() {fixedBanner()};
|
737 |
function fixedBanner() {
|
738 |
+
var elementContainer = document.getElementById('preview_banner_outer_container');
|
739 |
+
var elementTarget = document.getElementById('preview_banner_inner_container');
|
740 |
if (window.scrollY > (elementContainer.offsetTop)) {
|
741 |
elementTarget.style.position = 'fixed';
|
742 |
elementTarget.style.width = '83.671%';
|
752 |
var style_background_color = document.createElement('style');
|
753 |
var style_link_color = document.createElement('style');
|
754 |
var style_text_color = document.createElement('style');
|
755 |
+
var style_close_color = document.createElement('style');
|
|
|
756 |
var style_custom_css = document.createElement('style');
|
757 |
var style_custom_text_css = document.createElement('style');
|
758 |
var style_custom_button_css = document.createElement('style');
|
879 |
document.getElementById('simple_banner_link_color').dispatchEvent(new Event('change'));
|
880 |
};
|
881 |
|
882 |
+
// Close Color
|
883 |
+
style_close_color.type = 'text/css';
|
884 |
+
style_close_color.id = 'preview_banner_close_color'
|
885 |
+
style_close_color.appendChild(document.createTextNode('.simple-banner .simple-banner-button{color:' + (document.getElementById('simple_banner_close_color').value || 'black') + '}'));
|
886 |
+
document.getElementsByTagName('head')[0].appendChild(style_close_color);
|
887 |
+
|
888 |
+
document.getElementById('simple_banner_close_color').onchange=function(e){
|
889 |
+
document.getElementById('simple_banner_close_color_show').value = e.target.value || 'black';
|
890 |
+
var child = document.getElementById('preview_banner_close_color');
|
891 |
+
if (child){child.innerText = "";child.id='';}
|
892 |
+
|
893 |
+
var style_dynamic = document.createElement('style');
|
894 |
+
style_dynamic.type = 'text/css';
|
895 |
+
style_dynamic.id = 'preview_banner_close_color';
|
896 |
+
style_dynamic.appendChild(
|
897 |
+
document.createTextNode(
|
898 |
+
'.simple-banner .simple-banner-button{color:' + (document.getElementById('simple_banner_close_color').value || 'black') + '}'
|
899 |
+
)
|
900 |
+
);
|
901 |
+
document.getElementsByTagName('head')[0].appendChild(style_dynamic);
|
902 |
+
};
|
903 |
+
document.getElementById('simple_banner_close_color_show').onchange=function(e){
|
904 |
+
document.getElementById('simple_banner_close_color').value = e.target.value;
|
905 |
+
document.getElementById('simple_banner_close_color').dispatchEvent(new Event('change'));
|
906 |
+
};
|
907 |
+
|
908 |
// Custom CSS
|
909 |
style_custom_css.type = 'text/css';
|
910 |
style_custom_css.id = 'preview_banner_custom_stylesheet'
|