Version Description
- Change to stop scam security sites from emailing me.
Download this release
Release Info
Developer | rpetersen29 |
Plugin | Simple Banner |
Version | 2.10.3 |
Comparing to | |
See all releases |
Code changes from version 2.10.2 to 2.10.3
- readme.txt +8 -2
- simple-banner.php +129 -122
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.7
|
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.2 =
|
122 |
* Bug fixes for sites with no `administrator` role.
|
123 |
|
@@ -271,6 +274,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
|
|
271 |
|
272 |
== Upgrade Notice ==
|
273 |
|
|
|
|
|
|
|
274 |
= 2.10.2 =
|
275 |
* Bug fixes for sites with no `administrator` role.
|
276 |
|
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.7.3
|
7 |
+
Stable tag: 2.10.3
|
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.3 =
|
122 |
+
* Change to stop scam security sites from emailing me.
|
123 |
+
|
124 |
= 2.10.2 =
|
125 |
* Bug fixes for sites with no `administrator` role.
|
126 |
|
274 |
|
275 |
== Upgrade Notice ==
|
276 |
|
277 |
+
= 2.10.3 =
|
278 |
+
* Change to stop scam security sites from emailing me.
|
279 |
+
|
280 |
= 2.10.2 =
|
281 |
* Bug fixes for sites with no `administrator` role.
|
282 |
|
simple-banner.php
CHANGED
@@ -3,25 +3,32 @@
|
|
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() {
|
19 |
add_action('admin_menu', 'simple_banner_menu');
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
// Disabled Pages/Posts functionns
|
23 |
function get_disabled_pages_array() {
|
24 |
-
return array_filter(explode(',',
|
25 |
}
|
26 |
function get_post_object() {
|
27 |
return get_posts(array('include' => array(get_the_ID())));
|
@@ -30,7 +37,7 @@ function get_is_current_page_a_post() {
|
|
30 |
return !empty(get_post_object());
|
31 |
}
|
32 |
function get_disabled_on_posts() {
|
33 |
-
return
|
34 |
}
|
35 |
function get_disabled_on_current_page() {
|
36 |
$disabled_on_current_page = (!empty(get_disabled_pages_array()) && in_array(get_the_ID(), get_disabled_pages_array()))
|
@@ -49,38 +56,38 @@ function simple_banner() {
|
|
49 |
$script_params = array(
|
50 |
// script specific parameters
|
51 |
'version' => VERSION,
|
52 |
-
'hide_simple_banner' =>
|
53 |
-
'simple_banner_position' =>
|
54 |
-
'header_margin' =>
|
55 |
-
'header_padding' =>
|
56 |
-
'simple_banner_text' =>
|
57 |
-
'pro_version_enabled' =>
|
58 |
'disabled_on_current_page' => $disabled_on_current_page,
|
59 |
// debug specific parameters
|
60 |
-
'debug_mode' =>
|
61 |
'id' => get_the_ID(),
|
62 |
'disabled_pages_array' => get_disabled_pages_array(),
|
63 |
// 'post_object' => get_post_object(),
|
64 |
'is_current_page_a_post' => get_is_current_page_a_post(),
|
65 |
'disabled_on_posts' => get_disabled_on_posts(),
|
66 |
-
'simple_banner_font_size' =>
|
67 |
-
'simple_banner_color' =>
|
68 |
-
'simple_banner_text_color' =>
|
69 |
-
'simple_banner_link_color' =>
|
70 |
-
'simple_banner_close_color' =>
|
71 |
-
'simple_banner_text' => $disabled_on_current_page ? '' :
|
72 |
-
'simple_banner_custom_css' =>
|
73 |
-
'simple_banner_scrolling_custom_css' =>
|
74 |
-
'simple_banner_text_custom_css' =>
|
75 |
-
'simple_banner_button_css' =>
|
76 |
-
'site_custom_css' =>
|
77 |
-
'keep_site_custom_css' =>
|
78 |
-
'site_custom_js' =>
|
79 |
-
'keep_site_custom_js' =>
|
80 |
-
'wp_body_open_enabled' =>
|
81 |
'wp_body_open' => function_exists('wp_body_open'),
|
82 |
-
'close_button_enabled' =>
|
83 |
-
'close_button_expiration' =>
|
84 |
'close_button_cookie_set' => isset($_COOKIE['simplebannerclosed']),
|
85 |
);
|
86 |
// Enqueue the script
|
@@ -90,19 +97,19 @@ function simple_banner() {
|
|
90 |
}
|
91 |
|
92 |
// Use `wp_body_open` action
|
93 |
-
if ( function_exists( 'wp_body_open' ) &&
|
94 |
add_action( 'wp_body_open', 'simple_banner_body_open' );
|
95 |
}
|
96 |
function simple_banner_body_open() {
|
97 |
// if not disabled use wp_body_open
|
98 |
$disabled_on_current_page = get_disabled_on_current_page();
|
99 |
-
$close_button_enabled =
|
100 |
$closed_cookie = $close_button_enabled && isset($_COOKIE['simplebannerclosed']);
|
101 |
-
$closed_button =
|
102 |
|
103 |
if (!$disabled_on_current_page && !$closed_cookie) {
|
104 |
echo '<div id="simple-banner" class="simple-banner"><div class="simple-banner-text"><span>'
|
105 |
-
.
|
106 |
. '</span></div>'
|
107 |
. $closed_button
|
108 |
. '</div>';
|
@@ -113,84 +120,84 @@ function simple_banner_body_open() {
|
|
113 |
add_action( 'wp_head', 'simple_banner_custom_color');
|
114 |
function simple_banner_custom_color()
|
115 |
{
|
116 |
-
$closed_cookie =
|
117 |
|
118 |
$disabled_on_current_page = get_disabled_on_current_page();
|
119 |
-
$banner_is_disabled = $disabled_on_current_page ||
|
120 |
|
121 |
if ($banner_is_disabled || $closed_cookie){
|
122 |
echo '<style type="text/css" media="screen">.simple-banner{display:none;}</style>';
|
123 |
}
|
124 |
|
125 |
-
if (!$banner_is_disabled && !$closed_cookie &&
|
126 |
-
echo '<style id="simple-banner-header-margin" type="text/css" media="screen">header{margin-top:' .
|
127 |
}
|
128 |
|
129 |
-
if (!$banner_is_disabled && !$closed_cookie &&
|
130 |
-
echo '<style id="simple-banner-header-padding" type="text/css" media="screen">header{padding-top:' .
|
131 |
}
|
132 |
|
133 |
-
if (
|
134 |
-
if (
|
135 |
echo '<style type="text/css" media="screen">.simple-banner{position:fixed;bottom:0;}</style>';
|
136 |
} else {
|
137 |
-
echo '<style type="text/css" media="screen">.simple-banner{position:' .
|
138 |
}
|
139 |
}
|
140 |
|
141 |
-
if (
|
142 |
-
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{font-size:' .
|
143 |
}
|
144 |
|
145 |
-
if (
|
146 |
-
echo '<style type="text/css" media="screen">.simple-banner{background:' .
|
147 |
} else {
|
148 |
echo '<style type="text/css" media="screen">.simple-banner{background: #024985;}</style>';
|
149 |
}
|
150 |
|
151 |
-
if (
|
152 |
-
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{color:' .
|
153 |
} else {
|
154 |
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{color: #ffffff;}</style>';
|
155 |
}
|
156 |
|
157 |
-
if (
|
158 |
-
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text a{color:' .
|
159 |
} else {
|
160 |
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text a{color:#f16521;}</style>';
|
161 |
}
|
162 |
|
163 |
-
if (
|
164 |
-
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-button{color:' .
|
165 |
}
|
166 |
|
167 |
-
if (
|
168 |
-
echo '<style type="text/css" media="screen">.simple-banner{'.
|
169 |
}
|
170 |
|
171 |
-
if (
|
172 |
-
echo '<style type="text/css" media="screen">.simple-banner.simple-banner-scrolling{'.
|
173 |
}
|
174 |
|
175 |
-
if (
|
176 |
-
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{'.
|
177 |
}
|
178 |
|
179 |
-
if (
|
180 |
-
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-button{'.
|
181 |
}
|
182 |
|
183 |
-
$remove_site_custom_css = ($banner_is_disabled || $closed_cookie) &&
|
184 |
-
if (!$remove_site_custom_css &&
|
185 |
-
echo '<style id="simple-banner-site-custom-css" type="text/css" media="screen">'.
|
186 |
} else {
|
187 |
// put a dummy element to see if css is being bundled
|
188 |
echo '<style id="simple-banner-site-custom-css-dummy" type="text/css" media="screen"></style>';
|
189 |
}
|
190 |
|
191 |
-
$remove_site_custom_js = ($banner_is_disabled || $closed_cookie) &&
|
192 |
-
if (!$remove_site_custom_js &&
|
193 |
-
echo '<script id="simple-banner-site-custom-js" type="text/javascript">'.
|
194 |
} else {
|
195 |
// put a dummy element to see if scripts are being bundled
|
196 |
echo '<script id="simple-banner-site-custom-js-dummy" type="text/javascript"></script>';
|
@@ -207,7 +214,7 @@ function simple_banner_menu() {
|
|
207 |
$admin->add_cap( $manage_simple_banner );
|
208 |
}
|
209 |
|
210 |
-
$permissions_array =
|
211 |
|
212 |
// Add permissions for other roles
|
213 |
foreach (get_editable_roles() as $role_name => $role_info) {
|
@@ -266,7 +273,7 @@ function simple_banner_settings() {
|
|
266 |
function simple_banner_settings_page() {
|
267 |
?>
|
268 |
<?php
|
269 |
-
if (esc_attr(
|
270 |
update_option('pro_version_enabled', true);
|
271 |
} else {
|
272 |
update_option('pro_version_enabled', false);
|
@@ -315,10 +322,10 @@ function simple_banner_settings_page() {
|
|
315 |
</th>
|
316 |
<td style="vertical-align:top;">
|
317 |
<!-- -->
|
318 |
-
<input type="radio" id="yes" name="hide_simple_banner" value="yes" <?php echo ((
|
319 |
<label for="yes">yes</label>
|
320 |
<!-- -->
|
321 |
-
<input type="radio" id="no" name="hide_simple_banner" value="no" <?php echo ((
|
322 |
<label for="no">no</label>
|
323 |
<!-- -->
|
324 |
</td>
|
@@ -334,7 +341,7 @@ function simple_banner_settings_page() {
|
|
334 |
</th>
|
335 |
<td>
|
336 |
<?php
|
337 |
-
$checked =
|
338 |
echo '<input type="checkbox" id="close_button_enabled" '. $checked . ' name="close_button_enabled" />';
|
339 |
?>
|
340 |
</td>
|
@@ -350,7 +357,7 @@ function simple_banner_settings_page() {
|
|
350 |
</th>
|
351 |
<td>
|
352 |
<input type="number" min="1" max="30" id="close_button_expiration" name="close_button_expiration"
|
353 |
-
value="<?php echo esc_attr(
|
354 |
</td>
|
355 |
</tr>
|
356 |
<!-- Font Size -->
|
@@ -361,7 +368,7 @@ function simple_banner_settings_page() {
|
|
361 |
</th>
|
362 |
<td style="vertical-align:top;">
|
363 |
<input type="text" id="simple_banner_font_size" name="simple_banner_font_size" placeholder="font-size"
|
364 |
-
value="<?php echo esc_attr(
|
365 |
<span>e.g. 16px</span>
|
366 |
</td>
|
367 |
</tr>
|
@@ -373,9 +380,9 @@ function simple_banner_settings_page() {
|
|
373 |
</th>
|
374 |
<td style="vertical-align:top;">
|
375 |
<input type="text" id="simple_banner_color" name="simple_banner_color" placeholder="Hex value"
|
376 |
-
value="<?php echo esc_attr(
|
377 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_color_show"
|
378 |
-
value="<?php echo ((
|
379 |
</td>
|
380 |
</tr>
|
381 |
<!-- Text Color -->
|
@@ -386,9 +393,9 @@ function simple_banner_settings_page() {
|
|
386 |
</th>
|
387 |
<td style="vertical-align:top;">
|
388 |
<input type="text" id="simple_banner_text_color" name="simple_banner_text_color" placeholder="Hex value"
|
389 |
-
value="<?php echo esc_attr(
|
390 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_text_color_show"
|
391 |
-
value="<?php echo ((
|
392 |
</td>
|
393 |
</tr>
|
394 |
<!-- Link Color-->
|
@@ -399,9 +406,9 @@ function simple_banner_settings_page() {
|
|
399 |
</th>
|
400 |
<td style="vertical-align:top;">
|
401 |
<input type="text" id="simple_banner_link_color" name="simple_banner_link_color" placeholder="Hex value"
|
402 |
-
value="<?php echo esc_attr(
|
403 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_link_color_show"
|
404 |
-
value="<?php echo ((
|
405 |
</td>
|
406 |
</tr>
|
407 |
<!-- Close Color-->
|
@@ -412,9 +419,9 @@ function simple_banner_settings_page() {
|
|
412 |
</th>
|
413 |
<td style="vertical-align:top;">
|
414 |
<input type="text" id="simple_banner_close_color" name="simple_banner_close_color" placeholder="Hex value"
|
415 |
-
value="<?php echo esc_attr(
|
416 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_close_color_show"
|
417 |
-
value="<?php echo ((
|
418 |
</td>
|
419 |
</tr>
|
420 |
<!-- Text Contents -->
|
@@ -424,7 +431,7 @@ function simple_banner_settings_page() {
|
|
424 |
<br><span style="font-weight:400;">Leaving this blank removes the banner</span>
|
425 |
</th>
|
426 |
<td>
|
427 |
-
<textarea id="simple_banner_text" class="large-text code" style="height: 150px;width: 97%;" name="simple_banner_text"><?php echo
|
428 |
</td>
|
429 |
</tr>
|
430 |
<!-- Custom CSS -->
|
@@ -440,24 +447,24 @@ function simple_banner_settings_page() {
|
|
440 |
<tr valign="top">
|
441 |
<th scope="row" style="font-weight:400;">
|
442 |
<div>.simple-banner {</div>
|
443 |
-
<textarea id="simple_banner_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_custom_css"><?php echo
|
444 |
<div>}</div>
|
445 |
</th>
|
446 |
<td>
|
447 |
<div style="display:flex">
|
448 |
<div style="flex-grow:1;">
|
449 |
<div>.simple-banner-scrolling {</div>
|
450 |
-
<textarea id="simple_banner_scrolling_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_scrolling_custom_css"><?php echo
|
451 |
<div>}</div>
|
452 |
</div>
|
453 |
<div style="flex-grow:1;">
|
454 |
<div>.simple-banner-text {</div>
|
455 |
-
<textarea id="simple_banner_text_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_text_custom_css"><?php echo
|
456 |
<div>}</div>
|
457 |
</div>
|
458 |
<div style="flex-grow:1;">
|
459 |
<div>.simple-banner-button {</div>
|
460 |
-
<textarea id="simple_banner_button_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_button_css"><?php echo
|
461 |
<div>}</div>
|
462 |
</div>
|
463 |
</div>
|
@@ -471,32 +478,32 @@ function simple_banner_settings_page() {
|
|
471 |
</th>
|
472 |
<td style="vertical-align:top;">
|
473 |
<!-- -->
|
474 |
-
<input type="radio" id="footer" name="simple_banner_position" value="footer" <?php echo ((
|
475 |
<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>
|
476 |
<!-- -->
|
477 |
-
<input type="radio" id="static" name="simple_banner_position" value="static" <?php echo ((
|
478 |
<label for="static"><strong>static:</strong> <span>Default value. Elements render in order, as they appear in the document flow</span></label><br>
|
479 |
<!-- -->
|
480 |
-
<input type="radio" id="absolute" name="simple_banner_position" value="absolute" <?php echo ((
|
481 |
<label for="absolute"><strong>absolute:</strong> <span>The element is positioned relative to its first positioned (not static) ancestor element</span></label><br>
|
482 |
<!-- -->
|
483 |
-
<input type="radio" id="fixed" name="simple_banner_position" value="fixed" <?php echo ((
|
484 |
<label for="fixed"><strong>fixed:</strong> <span>The element is positioned relative to the browser window</span></label><br>
|
485 |
<!-- -->
|
486 |
-
<input type="radio" id="relative" name="simple_banner_position" value="relative" <?php echo ((
|
487 |
<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>
|
488 |
<!-- -->
|
489 |
-
<input type="radio" id="sticky" name="simple_banner_position" value="sticky" <?php echo ((
|
490 |
<label for="sticky"><strong>sticky:</strong> <span>The element is positioned based on the user's scroll position</span></label><br>
|
491 |
<div style="padding-left: 10px;">
|
492 |
A sticky element toggles between relative and fixed, depending on the scroll position.
|
493 |
It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).<br>
|
494 |
<strong>Note:</strong> Not supported in IE/Edge 15 or earlier. Supported in Safari from version 6.1 with a -webkit- prefix.</div>
|
495 |
<!-- -->
|
496 |
-
<input type="radio" id="initial" name="simple_banner_position" value="initial" <?php echo ((
|
497 |
<label for="initial"><strong>initial:</strong> <span>Sets this property to its default value.</span></label><br>
|
498 |
<!-- -->
|
499 |
-
<input type="radio" id="inherit" name="simple_banner_position" value="inherit" <?php echo ((
|
500 |
<label for="inherit"><strong>inherit:</strong> <span>Inherits this property from its parent element.</span></label><br>
|
501 |
</td>
|
502 |
</tr>
|
@@ -509,7 +516,7 @@ function simple_banner_settings_page() {
|
|
509 |
</th>
|
510 |
<td style="vertical-align:top;">
|
511 |
<input type="text" id="header_margin" name="header_margin" placeholder="margin-top"
|
512 |
-
value="<?php echo esc_attr(
|
513 |
<span>e.g. 40px</span>
|
514 |
</td>
|
515 |
</tr>
|
@@ -522,7 +529,7 @@ function simple_banner_settings_page() {
|
|
522 |
</th>
|
523 |
<td style="vertical-align:top;">
|
524 |
<input type="text" id="header_padding" name="header_padding" placeholder="padding-top"
|
525 |
-
value="<?php echo esc_attr(
|
526 |
<span>e.g. 40px</span>
|
527 |
</td>
|
528 |
</tr>
|
@@ -540,7 +547,7 @@ function simple_banner_settings_page() {
|
|
540 |
</th>
|
541 |
<td>
|
542 |
<?php
|
543 |
-
$checked =
|
544 |
echo '<input type="checkbox" id="wp_body_open_enabled" '. $checked . ' name="wp_body_open_enabled" />';
|
545 |
?>
|
546 |
</td>
|
@@ -565,7 +572,7 @@ function simple_banner_settings_page() {
|
|
565 |
|
566 |
<h2>Pro Features
|
567 |
<?php
|
568 |
-
if (!
|
569 |
echo '<a class="button-primary" href="https://simple-banner.square.site/" target="_blank">Purchase Pro Version</a>';
|
570 |
}
|
571 |
?>
|
@@ -573,12 +580,12 @@ function simple_banner_settings_page() {
|
|
573 |
|
574 |
<table class="form-table">
|
575 |
<!-- Activation Code -->
|
576 |
-
<tr valign="top" style="<?php if (
|
577 |
<th scope="row">
|
578 |
Activation Code
|
579 |
</th>
|
580 |
<td>
|
581 |
-
<input type="text" style="border: 2px solid gold;border-radius: 5px;" id="pro_version_activation_code" name="pro_version_activation_code" value="<?php echo
|
582 |
</td>
|
583 |
</tr>
|
584 |
<!-- Permissions -->
|
@@ -592,8 +599,8 @@ function simple_banner_settings_page() {
|
|
592 |
<div id="simple_banner_pro_permissions">
|
593 |
<?php
|
594 |
$roles = get_editable_roles();
|
595 |
-
$disabled = !
|
596 |
-
$permissions_array =
|
597 |
foreach (get_editable_roles() as $role_name => $role_info) {
|
598 |
if ($role_name == 'administrator') {
|
599 |
continue;
|
@@ -614,8 +621,8 @@ function simple_banner_settings_page() {
|
|
614 |
</tr>
|
615 |
<?php endif; ?>
|
616 |
<?php
|
617 |
-
if (
|
618 |
-
echo '<input type="text" hidden id="permissions_array" name="permissions_array" value="'.
|
619 |
}
|
620 |
?>
|
621 |
<!-- Disabled on Psts -->
|
@@ -630,8 +637,8 @@ function simple_banner_settings_page() {
|
|
630 |
</th>
|
631 |
<td style="padding-top:0;">
|
632 |
<?php
|
633 |
-
if (
|
634 |
-
$checked =
|
635 |
echo '<input type="checkbox" id="disabled_on_posts" '. $checked . ' name="disabled_on_posts" />';
|
636 |
} else {
|
637 |
echo '<input type="checkbox" disabled />';
|
@@ -648,9 +655,9 @@ function simple_banner_settings_page() {
|
|
648 |
<td>
|
649 |
<div id="simple_banner_pro_disabled_pages">
|
650 |
<?php
|
651 |
-
$disabled = !
|
652 |
-
$disabled_pages_array = array_filter(explode(',',
|
653 |
-
$frontpage_id =
|
654 |
if ($frontpage_id == 0) {
|
655 |
$frontpage_id = 1;
|
656 |
}
|
@@ -658,7 +665,7 @@ function simple_banner_settings_page() {
|
|
658 |
$parent_checkbox .= $disabled ? 'disabled ' : '';
|
659 |
$parent_checkbox .= (!$disabled && in_array($frontpage_id, $disabled_pages_array)) ? 'checked ' : '';
|
660 |
$parent_checkbox .= 'value="' . $frontpage_id . '">';
|
661 |
-
$parent_checkbox .=
|
662 |
$parent_checkbox .= '</input><br>';
|
663 |
echo $parent_checkbox;
|
664 |
|
@@ -677,8 +684,8 @@ function simple_banner_settings_page() {
|
|
677 |
?>
|
678 |
</div>
|
679 |
<?php
|
680 |
-
if (
|
681 |
-
echo '<input type="text" hidden id="disabled_pages_array" name="disabled_pages_array" value="'.
|
682 |
}
|
683 |
?>
|
684 |
</td>
|
@@ -691,8 +698,8 @@ function simple_banner_settings_page() {
|
|
691 |
</th>
|
692 |
<td>
|
693 |
<?php
|
694 |
-
if (
|
695 |
-
echo '<textarea id="site_custom_css" style="height: 150px;width: 75%;" name="site_custom_css">'.
|
696 |
} else {
|
697 |
echo '<textarea style="height: 150px;width: 75%;" disabled></textarea>';
|
698 |
}
|
@@ -705,8 +712,8 @@ function simple_banner_settings_page() {
|
|
705 |
</th>
|
706 |
<td style="padding-top:0;">
|
707 |
<?php
|
708 |
-
if (
|
709 |
-
$checked =
|
710 |
echo '<input type="checkbox" id="keep_site_custom_css" '. $checked . ' name="keep_site_custom_css" />';
|
711 |
} else {
|
712 |
echo '<input type="checkbox" disabled />';
|
@@ -722,8 +729,8 @@ function simple_banner_settings_page() {
|
|
722 |
</th>
|
723 |
<td>
|
724 |
<?php
|
725 |
-
if (
|
726 |
-
echo '<textarea id="site_custom_js" style="height: 150px;width: 75%;" name="site_custom_js">'.
|
727 |
} else {
|
728 |
echo '<textarea style="height: 150px;width: 75%;" disabled></textarea>';
|
729 |
}
|
@@ -736,8 +743,8 @@ function simple_banner_settings_page() {
|
|
736 |
</th>
|
737 |
<td style="padding-top:0;">
|
738 |
<?php
|
739 |
-
if (
|
740 |
-
$checked =
|
741 |
echo '<input type="checkbox" id="keep_site_custom_js" '. $checked . ' name="keep_site_custom_js" />';
|
742 |
} else {
|
743 |
echo '<input type="checkbox" disabled />';
|
@@ -753,8 +760,8 @@ function simple_banner_settings_page() {
|
|
753 |
</th>
|
754 |
<td>
|
755 |
<?php
|
756 |
-
if (
|
757 |
-
$checked =
|
758 |
echo '<input type="checkbox" id="debug_mode" '. $checked . ' name="debug_mode" />';
|
759 |
} else {
|
760 |
echo '<input type="checkbox" disabled />';
|
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.3
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
+
* @version 2.10.3
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
+
define ('VERSION', '2.10.3');
|
16 |
|
17 |
register_activation_hook( __FILE__, 'simple_banner_activate' );
|
18 |
function simple_banner_activate() {
|
19 |
add_action('admin_menu', 'simple_banner_menu');
|
20 |
}
|
21 |
|
22 |
+
function get_stripped_option($string) {
|
23 |
+
$string_value = get_option( $string );
|
24 |
+
$stripped_string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string_value );
|
25 |
+
|
26 |
+
return $stripped_string;
|
27 |
+
}
|
28 |
+
|
29 |
// Disabled Pages/Posts functionns
|
30 |
function get_disabled_pages_array() {
|
31 |
+
return array_filter(explode(',', get_stripped_option('disabled_pages_array')));
|
32 |
}
|
33 |
function get_post_object() {
|
34 |
return get_posts(array('include' => array(get_the_ID())));
|
37 |
return !empty(get_post_object());
|
38 |
}
|
39 |
function get_disabled_on_posts() {
|
40 |
+
return get_stripped_option('disabled_on_posts');
|
41 |
}
|
42 |
function get_disabled_on_current_page() {
|
43 |
$disabled_on_current_page = (!empty(get_disabled_pages_array()) && in_array(get_the_ID(), get_disabled_pages_array()))
|
56 |
$script_params = array(
|
57 |
// script specific parameters
|
58 |
'version' => VERSION,
|
59 |
+
'hide_simple_banner' => get_stripped_option('hide_simple_banner'),
|
60 |
+
'simple_banner_position' => get_stripped_option('simple_banner_position'),
|
61 |
+
'header_margin' => get_stripped_option('header_margin'),
|
62 |
+
'header_padding' => get_stripped_option('header_padding'),
|
63 |
+
'simple_banner_text' => get_stripped_option('simple_banner_text'),
|
64 |
+
'pro_version_enabled' => get_stripped_option('pro_version_enabled'),
|
65 |
'disabled_on_current_page' => $disabled_on_current_page,
|
66 |
// debug specific parameters
|
67 |
+
'debug_mode' => get_stripped_option('debug_mode'),
|
68 |
'id' => get_the_ID(),
|
69 |
'disabled_pages_array' => get_disabled_pages_array(),
|
70 |
// 'post_object' => get_post_object(),
|
71 |
'is_current_page_a_post' => get_is_current_page_a_post(),
|
72 |
'disabled_on_posts' => get_disabled_on_posts(),
|
73 |
+
'simple_banner_font_size' => get_stripped_option('simple_banner_font_size'),
|
74 |
+
'simple_banner_color' => get_stripped_option('simple_banner_color'),
|
75 |
+
'simple_banner_text_color' => get_stripped_option('simple_banner_text_color'),
|
76 |
+
'simple_banner_link_color' => get_stripped_option('simple_banner_link_color'),
|
77 |
+
'simple_banner_close_color' => get_stripped_option('simple_banner_close_color'),
|
78 |
+
'simple_banner_text' => $disabled_on_current_page ? '' : get_stripped_option('simple_banner_text'),
|
79 |
+
'simple_banner_custom_css' => get_stripped_option('simple_banner_custom_css'),
|
80 |
+
'simple_banner_scrolling_custom_css' => get_stripped_option('simple_banner_scrolling_custom_css'),
|
81 |
+
'simple_banner_text_custom_css' => get_stripped_option('simple_banner_text_custom_css'),
|
82 |
+
'simple_banner_button_css' => get_stripped_option('simple_banner_button_css'),
|
83 |
+
'site_custom_css' => get_stripped_option('site_custom_css'),
|
84 |
+
'keep_site_custom_css' => get_stripped_option('keep_site_custom_css'),
|
85 |
+
'site_custom_js' => get_stripped_option('site_custom_js'),
|
86 |
+
'keep_site_custom_js' => get_stripped_option('keep_site_custom_js'),
|
87 |
+
'wp_body_open_enabled' => get_stripped_option('wp_body_open_enabled'),
|
88 |
'wp_body_open' => function_exists('wp_body_open'),
|
89 |
+
'close_button_enabled' => get_stripped_option('close_button_enabled'),
|
90 |
+
'close_button_expiration' => get_stripped_option('close_button_expiration'),
|
91 |
'close_button_cookie_set' => isset($_COOKIE['simplebannerclosed']),
|
92 |
);
|
93 |
// Enqueue the script
|
97 |
}
|
98 |
|
99 |
// Use `wp_body_open` action
|
100 |
+
if ( function_exists( 'wp_body_open' ) && get_stripped_option('wp_body_open_enabled') ) {
|
101 |
add_action( 'wp_body_open', 'simple_banner_body_open' );
|
102 |
}
|
103 |
function simple_banner_body_open() {
|
104 |
// if not disabled use wp_body_open
|
105 |
$disabled_on_current_page = get_disabled_on_current_page();
|
106 |
+
$close_button_enabled = get_stripped_option('close_button_enabled');
|
107 |
$closed_cookie = $close_button_enabled && isset($_COOKIE['simplebannerclosed']);
|
108 |
+
$closed_button = get_stripped_option('close_button_enabled') ? '<button id="simple-banner-close-button" class="simple-banner-button">✕</button>' : '';
|
109 |
|
110 |
if (!$disabled_on_current_page && !$closed_cookie) {
|
111 |
echo '<div id="simple-banner" class="simple-banner"><div class="simple-banner-text"><span>'
|
112 |
+
. get_stripped_option('simple_banner_text')
|
113 |
. '</span></div>'
|
114 |
. $closed_button
|
115 |
. '</div>';
|
120 |
add_action( 'wp_head', 'simple_banner_custom_color');
|
121 |
function simple_banner_custom_color()
|
122 |
{
|
123 |
+
$closed_cookie = get_stripped_option('close_button_enabled') && isset($_COOKIE["simplebannerclosed"]);
|
124 |
|
125 |
$disabled_on_current_page = get_disabled_on_current_page();
|
126 |
+
$banner_is_disabled = $disabled_on_current_page || get_stripped_option('hide_simple_banner') == "yes";
|
127 |
|
128 |
if ($banner_is_disabled || $closed_cookie){
|
129 |
echo '<style type="text/css" media="screen">.simple-banner{display:none;}</style>';
|
130 |
}
|
131 |
|
132 |
+
if (!$banner_is_disabled && !$closed_cookie && get_stripped_option('header_margin') != ""){
|
133 |
+
echo '<style id="simple-banner-header-margin" type="text/css" media="screen">header{margin-top:' . get_stripped_option('header_margin') . ';}</style>';
|
134 |
}
|
135 |
|
136 |
+
if (!$banner_is_disabled && !$closed_cookie && get_stripped_option('header_padding') != ""){
|
137 |
+
echo '<style id="simple-banner-header-padding" type="text/css" media="screen">header{padding-top:' . get_stripped_option('header_padding') . ';}</style>';
|
138 |
}
|
139 |
|
140 |
+
if (get_stripped_option('simple_banner_position') != ""){
|
141 |
+
if (get_stripped_option('simple_banner_position') == 'footer'){
|
142 |
echo '<style type="text/css" media="screen">.simple-banner{position:fixed;bottom:0;}</style>';
|
143 |
} else {
|
144 |
+
echo '<style type="text/css" media="screen">.simple-banner{position:' . get_stripped_option('simple_banner_position') . ';}</style>';
|
145 |
}
|
146 |
}
|
147 |
|
148 |
+
if (get_stripped_option('simple_banner_font_size') != ""){
|
149 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{font-size:' . get_stripped_option('simple_banner_font_size') . ';}</style>';
|
150 |
}
|
151 |
|
152 |
+
if (get_stripped_option('simple_banner_color') != ""){
|
153 |
+
echo '<style type="text/css" media="screen">.simple-banner{background:' . get_stripped_option('simple_banner_color') . ';}</style>';
|
154 |
} else {
|
155 |
echo '<style type="text/css" media="screen">.simple-banner{background: #024985;}</style>';
|
156 |
}
|
157 |
|
158 |
+
if (get_stripped_option('simple_banner_text_color') != ""){
|
159 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{color:' . get_stripped_option('simple_banner_text_color') . ';}</style>';
|
160 |
} else {
|
161 |
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{color: #ffffff;}</style>';
|
162 |
}
|
163 |
|
164 |
+
if (get_stripped_option('simple_banner_link_color') != ""){
|
165 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text a{color:' . get_stripped_option('simple_banner_link_color') . ';}</style>';
|
166 |
} else {
|
167 |
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text a{color:#f16521;}</style>';
|
168 |
}
|
169 |
|
170 |
+
if (get_stripped_option('simple_banner_close_color') != ""){
|
171 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-button{color:' . get_stripped_option('simple_banner_close_color') . ';}</style>';
|
172 |
}
|
173 |
|
174 |
+
if (get_stripped_option('simple_banner_custom_css') != ""){
|
175 |
+
echo '<style type="text/css" media="screen">.simple-banner{'. get_stripped_option('simple_banner_custom_css') . '}</style>';
|
176 |
}
|
177 |
|
178 |
+
if (get_stripped_option('simple_banner_scrolling_custom_css') != ""){
|
179 |
+
echo '<style type="text/css" media="screen">.simple-banner.simple-banner-scrolling{'. get_stripped_option('simple_banner_scrolling_custom_css') . '}</style>';
|
180 |
}
|
181 |
|
182 |
+
if (get_stripped_option('simple_banner_text_custom_css') != ""){
|
183 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-text{'. get_stripped_option('simple_banner_text_custom_css') . '}</style>';
|
184 |
}
|
185 |
|
186 |
+
if (get_stripped_option('simple_banner_button_css') != ""){
|
187 |
+
echo '<style type="text/css" media="screen">.simple-banner .simple-banner-button{'. get_stripped_option('simple_banner_button_css') . '}</style>';
|
188 |
}
|
189 |
|
190 |
+
$remove_site_custom_css = ($banner_is_disabled || $closed_cookie) && get_stripped_option('keep_site_custom_css') == "";
|
191 |
+
if (!$remove_site_custom_css && get_stripped_option('site_custom_css') != "" && get_stripped_option('pro_version_enabled')) {
|
192 |
+
echo '<style id="simple-banner-site-custom-css" type="text/css" media="screen">'. get_stripped_option('site_custom_css') . '</style>';
|
193 |
} else {
|
194 |
// put a dummy element to see if css is being bundled
|
195 |
echo '<style id="simple-banner-site-custom-css-dummy" type="text/css" media="screen"></style>';
|
196 |
}
|
197 |
|
198 |
+
$remove_site_custom_js = ($banner_is_disabled || $closed_cookie) && get_stripped_option('keep_site_custom_js') == "";
|
199 |
+
if (!$remove_site_custom_js && get_stripped_option('site_custom_js') != "" && get_stripped_option('pro_version_enabled')) {
|
200 |
+
echo '<script id="simple-banner-site-custom-js" type="text/javascript">'. get_stripped_option('site_custom_js') . '</script>';
|
201 |
} else {
|
202 |
// put a dummy element to see if scripts are being bundled
|
203 |
echo '<script id="simple-banner-site-custom-js-dummy" type="text/javascript"></script>';
|
214 |
$admin->add_cap( $manage_simple_banner );
|
215 |
}
|
216 |
|
217 |
+
$permissions_array = get_stripped_option('permissions_array');
|
218 |
|
219 |
// Add permissions for other roles
|
220 |
foreach (get_editable_roles() as $role_name => $role_info) {
|
273 |
function simple_banner_settings_page() {
|
274 |
?>
|
275 |
<?php
|
276 |
+
if (esc_attr( get_stripped_option('pro_version_activation_code') ) == "SBPROv1-14315") {
|
277 |
update_option('pro_version_enabled', true);
|
278 |
} else {
|
279 |
update_option('pro_version_enabled', false);
|
322 |
</th>
|
323 |
<td style="vertical-align:top;">
|
324 |
<!-- -->
|
325 |
+
<input type="radio" id="yes" name="hide_simple_banner" value="yes" <?php echo ((get_stripped_option('hide_simple_banner') == 'yes') ? 'checked' : '' ); ?>>
|
326 |
<label for="yes">yes</label>
|
327 |
<!-- -->
|
328 |
+
<input type="radio" id="no" name="hide_simple_banner" value="no" <?php echo ((get_stripped_option('hide_simple_banner') == 'yes') ? '' : 'checked' ); ?>>
|
329 |
<label for="no">no</label>
|
330 |
<!-- -->
|
331 |
</td>
|
341 |
</th>
|
342 |
<td>
|
343 |
<?php
|
344 |
+
$checked = get_stripped_option('close_button_enabled') ? 'checked ' : '';
|
345 |
echo '<input type="checkbox" id="close_button_enabled" '. $checked . ' name="close_button_enabled" />';
|
346 |
?>
|
347 |
</td>
|
357 |
</th>
|
358 |
<td>
|
359 |
<input type="number" min="1" max="30" id="close_button_expiration" name="close_button_expiration"
|
360 |
+
value="<?php echo esc_attr( get_stripped_option('close_button_expiration') ); ?>" />
|
361 |
</td>
|
362 |
</tr>
|
363 |
<!-- Font Size -->
|
368 |
</th>
|
369 |
<td style="vertical-align:top;">
|
370 |
<input type="text" id="simple_banner_font_size" name="simple_banner_font_size" placeholder="font-size"
|
371 |
+
value="<?php echo esc_attr( get_stripped_option('simple_banner_font_size') ); ?>" />
|
372 |
<span>e.g. 16px</span>
|
373 |
</td>
|
374 |
</tr>
|
380 |
</th>
|
381 |
<td style="vertical-align:top;">
|
382 |
<input type="text" id="simple_banner_color" name="simple_banner_color" placeholder="Hex value"
|
383 |
+
value="<?php echo esc_attr( get_stripped_option('simple_banner_color') ); ?>" />
|
384 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_color_show"
|
385 |
+
value="<?php echo ((get_stripped_option('simple_banner_color') == '') ? '#024985' : esc_attr( get_stripped_option('simple_banner_color') )); ?>">
|
386 |
</td>
|
387 |
</tr>
|
388 |
<!-- Text Color -->
|
393 |
</th>
|
394 |
<td style="vertical-align:top;">
|
395 |
<input type="text" id="simple_banner_text_color" name="simple_banner_text_color" placeholder="Hex value"
|
396 |
+
value="<?php echo esc_attr( get_stripped_option('simple_banner_text_color') ); ?>" />
|
397 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_text_color_show"
|
398 |
+
value="<?php echo ((get_stripped_option('simple_banner_text_color') == '') ? '#ffffff' : esc_attr( get_stripped_option('simple_banner_text_color') )); ?>">
|
399 |
</td>
|
400 |
</tr>
|
401 |
<!-- Link Color-->
|
406 |
</th>
|
407 |
<td style="vertical-align:top;">
|
408 |
<input type="text" id="simple_banner_link_color" name="simple_banner_link_color" placeholder="Hex value"
|
409 |
+
value="<?php echo esc_attr( get_stripped_option('simple_banner_link_color') ); ?>" />
|
410 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_link_color_show"
|
411 |
+
value="<?php echo ((get_stripped_option('simple_banner_link_color') == '') ? '#f16521' : esc_attr( get_stripped_option('simple_banner_link_color') )); ?>">
|
412 |
</td>
|
413 |
</tr>
|
414 |
<!-- Close Color-->
|
419 |
</th>
|
420 |
<td style="vertical-align:top;">
|
421 |
<input type="text" id="simple_banner_close_color" name="simple_banner_close_color" placeholder="Hex value"
|
422 |
+
value="<?php echo esc_attr( get_stripped_option('simple_banner_close_color') ); ?>" />
|
423 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_close_color_show"
|
424 |
+
value="<?php echo ((get_stripped_option('simple_banner_close_color') == '') ? 'black' : esc_attr( get_stripped_option('simple_banner_close_color') )); ?>">
|
425 |
</td>
|
426 |
</tr>
|
427 |
<!-- Text Contents -->
|
431 |
<br><span style="font-weight:400;">Leaving this blank removes the banner</span>
|
432 |
</th>
|
433 |
<td>
|
434 |
+
<textarea id="simple_banner_text" class="large-text code" style="height: 150px;width: 97%;" name="simple_banner_text"><?php echo get_stripped_option('simple_banner_text'); ?></textarea>
|
435 |
</td>
|
436 |
</tr>
|
437 |
<!-- Custom CSS -->
|
447 |
<tr valign="top">
|
448 |
<th scope="row" style="font-weight:400;">
|
449 |
<div>.simple-banner {</div>
|
450 |
+
<textarea id="simple_banner_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_custom_css"><?php echo get_stripped_option('simple_banner_custom_css'); ?></textarea>
|
451 |
<div>}</div>
|
452 |
</th>
|
453 |
<td>
|
454 |
<div style="display:flex">
|
455 |
<div style="flex-grow:1;">
|
456 |
<div>.simple-banner-scrolling {</div>
|
457 |
+
<textarea id="simple_banner_scrolling_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_scrolling_custom_css"><?php echo get_stripped_option('simple_banner_scrolling_custom_css'); ?></textarea>
|
458 |
<div>}</div>
|
459 |
</div>
|
460 |
<div style="flex-grow:1;">
|
461 |
<div>.simple-banner-text {</div>
|
462 |
+
<textarea id="simple_banner_text_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_text_custom_css"><?php echo get_stripped_option('simple_banner_text_custom_css'); ?></textarea>
|
463 |
<div>}</div>
|
464 |
</div>
|
465 |
<div style="flex-grow:1;">
|
466 |
<div>.simple-banner-button {</div>
|
467 |
+
<textarea id="simple_banner_button_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_button_css"><?php echo get_stripped_option('simple_banner_button_css'); ?></textarea>
|
468 |
<div>}</div>
|
469 |
</div>
|
470 |
</div>
|
478 |
</th>
|
479 |
<td style="vertical-align:top;">
|
480 |
<!-- -->
|
481 |
+
<input type="radio" id="footer" name="simple_banner_position" value="footer" <?php echo ((get_stripped_option('simple_banner_position') == 'footer') ? 'checked' : '' ); ?>>
|
482 |
<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>
|
483 |
<!-- -->
|
484 |
+
<input type="radio" id="static" name="simple_banner_position" value="static" <?php echo ((get_stripped_option('simple_banner_position') == 'static') ? 'checked' : '' ); ?>>
|
485 |
<label for="static"><strong>static:</strong> <span>Default value. Elements render in order, as they appear in the document flow</span></label><br>
|
486 |
<!-- -->
|
487 |
+
<input type="radio" id="absolute" name="simple_banner_position" value="absolute" <?php echo ((get_stripped_option('simple_banner_position') == 'absolute') ? 'checked' : '' ); ?>>
|
488 |
<label for="absolute"><strong>absolute:</strong> <span>The element is positioned relative to its first positioned (not static) ancestor element</span></label><br>
|
489 |
<!-- -->
|
490 |
+
<input type="radio" id="fixed" name="simple_banner_position" value="fixed" <?php echo ((get_stripped_option('simple_banner_position') == 'fixed') ? 'checked' : '' ); ?>>
|
491 |
<label for="fixed"><strong>fixed:</strong> <span>The element is positioned relative to the browser window</span></label><br>
|
492 |
<!-- -->
|
493 |
+
<input type="radio" id="relative" name="simple_banner_position" value="relative" <?php echo ((get_stripped_option('simple_banner_position') == 'relative') ? 'checked' : '' ); ?>>
|
494 |
<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>
|
495 |
<!-- -->
|
496 |
+
<input type="radio" id="sticky" name="simple_banner_position" value="sticky" <?php echo ((get_stripped_option('simple_banner_position') == 'sticky') ? 'checked' : '' ); ?>>
|
497 |
<label for="sticky"><strong>sticky:</strong> <span>The element is positioned based on the user's scroll position</span></label><br>
|
498 |
<div style="padding-left: 10px;">
|
499 |
A sticky element toggles between relative and fixed, depending on the scroll position.
|
500 |
It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).<br>
|
501 |
<strong>Note:</strong> Not supported in IE/Edge 15 or earlier. Supported in Safari from version 6.1 with a -webkit- prefix.</div>
|
502 |
<!-- -->
|
503 |
+
<input type="radio" id="initial" name="simple_banner_position" value="initial" <?php echo ((get_stripped_option('simple_banner_position') == 'initial') ? 'checked' : '' ); ?>>
|
504 |
<label for="initial"><strong>initial:</strong> <span>Sets this property to its default value.</span></label><br>
|
505 |
<!-- -->
|
506 |
+
<input type="radio" id="inherit" name="simple_banner_position" value="inherit" <?php echo ((get_stripped_option('simple_banner_position') == 'inherit') ? 'checked' : '' ); ?>>
|
507 |
<label for="inherit"><strong>inherit:</strong> <span>Inherits this property from its parent element.</span></label><br>
|
508 |
</td>
|
509 |
</tr>
|
516 |
</th>
|
517 |
<td style="vertical-align:top;">
|
518 |
<input type="text" id="header_margin" name="header_margin" placeholder="margin-top"
|
519 |
+
value="<?php echo esc_attr( get_stripped_option('header_margin') ); ?>" />
|
520 |
<span>e.g. 40px</span>
|
521 |
</td>
|
522 |
</tr>
|
529 |
</th>
|
530 |
<td style="vertical-align:top;">
|
531 |
<input type="text" id="header_padding" name="header_padding" placeholder="padding-top"
|
532 |
+
value="<?php echo esc_attr( get_stripped_option('header_padding') ); ?>" />
|
533 |
<span>e.g. 40px</span>
|
534 |
</td>
|
535 |
</tr>
|
547 |
</th>
|
548 |
<td>
|
549 |
<?php
|
550 |
+
$checked = get_stripped_option('wp_body_open_enabled') ? 'checked ' : '';
|
551 |
echo '<input type="checkbox" id="wp_body_open_enabled" '. $checked . ' name="wp_body_open_enabled" />';
|
552 |
?>
|
553 |
</td>
|
572 |
|
573 |
<h2>Pro Features
|
574 |
<?php
|
575 |
+
if (!get_stripped_option('pro_version_enabled')) {
|
576 |
echo '<a class="button-primary" href="https://simple-banner.square.site/" target="_blank">Purchase Pro Version</a>';
|
577 |
}
|
578 |
?>
|
580 |
|
581 |
<table class="form-table">
|
582 |
<!-- Activation Code -->
|
583 |
+
<tr valign="top" style="<?php if (get_stripped_option('pro_version_enabled')) { echo 'display: none;'; } ?>">
|
584 |
<th scope="row">
|
585 |
Activation Code
|
586 |
</th>
|
587 |
<td>
|
588 |
+
<input type="text" style="border: 2px solid gold;border-radius: 5px;" id="pro_version_activation_code" name="pro_version_activation_code" value="<?php echo get_stripped_option('pro_version_activation_code'); ?>" />
|
589 |
</td>
|
590 |
</tr>
|
591 |
<!-- Permissions -->
|
599 |
<div id="simple_banner_pro_permissions">
|
600 |
<?php
|
601 |
$roles = get_editable_roles();
|
602 |
+
$disabled = !get_stripped_option('pro_version_enabled');
|
603 |
+
$permissions_array = get_stripped_option('permissions_array');
|
604 |
foreach (get_editable_roles() as $role_name => $role_info) {
|
605 |
if ($role_name == 'administrator') {
|
606 |
continue;
|
621 |
</tr>
|
622 |
<?php endif; ?>
|
623 |
<?php
|
624 |
+
if (get_stripped_option('pro_version_enabled')) {
|
625 |
+
echo '<input type="text" hidden id="permissions_array" name="permissions_array" value="'. get_stripped_option('permissions_array') . '" />';
|
626 |
}
|
627 |
?>
|
628 |
<!-- Disabled on Psts -->
|
637 |
</th>
|
638 |
<td style="padding-top:0;">
|
639 |
<?php
|
640 |
+
if (get_stripped_option('pro_version_enabled')) {
|
641 |
+
$checked = get_stripped_option('disabled_on_posts') ? 'checked ' : '';
|
642 |
echo '<input type="checkbox" id="disabled_on_posts" '. $checked . ' name="disabled_on_posts" />';
|
643 |
} else {
|
644 |
echo '<input type="checkbox" disabled />';
|
655 |
<td>
|
656 |
<div id="simple_banner_pro_disabled_pages">
|
657 |
<?php
|
658 |
+
$disabled = !get_stripped_option('pro_version_enabled');
|
659 |
+
$disabled_pages_array = array_filter(explode(',', get_stripped_option('disabled_pages_array')));
|
660 |
+
$frontpage_id = get_stripped_option( 'page_on_front' ); // page_on_front returns 0 if value hasn't been set
|
661 |
if ($frontpage_id == 0) {
|
662 |
$frontpage_id = 1;
|
663 |
}
|
665 |
$parent_checkbox .= $disabled ? 'disabled ' : '';
|
666 |
$parent_checkbox .= (!$disabled && in_array($frontpage_id, $disabled_pages_array)) ? 'checked ' : '';
|
667 |
$parent_checkbox .= 'value="' . $frontpage_id . '">';
|
668 |
+
$parent_checkbox .= get_stripped_option( 'blogname' ) . ' | ' . get_site_url() . ' ';
|
669 |
$parent_checkbox .= '</input><br>';
|
670 |
echo $parent_checkbox;
|
671 |
|
684 |
?>
|
685 |
</div>
|
686 |
<?php
|
687 |
+
if (get_stripped_option('pro_version_enabled')) {
|
688 |
+
echo '<input type="text" hidden id="disabled_pages_array" name="disabled_pages_array" value="'. get_stripped_option('disabled_pages_array') . '" />';
|
689 |
}
|
690 |
?>
|
691 |
</td>
|
698 |
</th>
|
699 |
<td>
|
700 |
<?php
|
701 |
+
if (get_stripped_option('pro_version_enabled')) {
|
702 |
+
echo '<textarea id="site_custom_css" style="height: 150px;width: 75%;" name="site_custom_css">'. get_stripped_option('site_custom_css') . '</textarea>';
|
703 |
} else {
|
704 |
echo '<textarea style="height: 150px;width: 75%;" disabled></textarea>';
|
705 |
}
|
712 |
</th>
|
713 |
<td style="padding-top:0;">
|
714 |
<?php
|
715 |
+
if (get_stripped_option('pro_version_enabled')) {
|
716 |
+
$checked = get_stripped_option('keep_site_custom_css') ? 'checked ' : '';
|
717 |
echo '<input type="checkbox" id="keep_site_custom_css" '. $checked . ' name="keep_site_custom_css" />';
|
718 |
} else {
|
719 |
echo '<input type="checkbox" disabled />';
|
729 |
</th>
|
730 |
<td>
|
731 |
<?php
|
732 |
+
if (get_stripped_option('pro_version_enabled')) {
|
733 |
+
echo '<textarea id="site_custom_js" style="height: 150px;width: 75%;" name="site_custom_js">'. get_stripped_option('site_custom_js') . '</textarea>';
|
734 |
} else {
|
735 |
echo '<textarea style="height: 150px;width: 75%;" disabled></textarea>';
|
736 |
}
|
743 |
</th>
|
744 |
<td style="padding-top:0;">
|
745 |
<?php
|
746 |
+
if (get_stripped_option('pro_version_enabled')) {
|
747 |
+
$checked = get_stripped_option('keep_site_custom_js') ? 'checked ' : '';
|
748 |
echo '<input type="checkbox" id="keep_site_custom_js" '. $checked . ' name="keep_site_custom_js" />';
|
749 |
} else {
|
750 |
echo '<input type="checkbox" disabled />';
|
760 |
</th>
|
761 |
<td>
|
762 |
<?php
|
763 |
+
if (get_stripped_option('pro_version_enabled')) {
|
764 |
+
$checked = get_stripped_option('debug_mode') ? 'checked ' : '';
|
765 |
echo '<input type="checkbox" id="debug_mode" '. $checked . ' name="debug_mode" />';
|
766 |
} else {
|
767 |
echo '<input type="checkbox" disabled />';
|