Skip to content

Commit

Permalink
Merge pull request #10 from andrewlimaza/dev
Browse files Browse the repository at this point in the history
Update to V2.2
  • Loading branch information
andrewlimaza authored Mar 30, 2020
2 parents f17ade0 + a2c8484 commit 7606594
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 32 deletions.
4 changes: 2 additions & 2 deletions js/wp-color-picker-alpha.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://yoohooplugins.com
Tags: sitewide banner, site banner, banner, notice, sitewide notice, popup banner, simple banner, website banner, website notice, site notice, site message, website message bar, website bar message, message bar
Requires at least: 4.0
Tested up to: 5.3.2
Stable tag: 2.0.4
Stable tag: 2.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -71,6 +71,9 @@ Please feel free to contact us for any further questions.
2. Sitewide Notice WP - Sitewide Notice WP settings page.

== Upgrade Notice ==
= 2.2 =
* Please upgrade for new features and general improvements.

= 2.1 =
* Please upgrade to version 2.1 for security and UI improvements.

Expand Down Expand Up @@ -114,9 +117,15 @@ Please feel free to contact us for any further questions.
* Please update your Sitewide Notice WP to the latest version to ensure the plugin runs correctly.

== Changelog ==
= 2.2 =
* Bug Fix: Support TwentyTwenty theme. Fixed an issue where loading the wp-alpha-color.js was causing issues.
* Enhancement: Added option to hide close button.
* Enhancement: Added filter `swnza_show_banner` as an override to show/hide the bar.
* Enhancement: General styling improvements to the bar to fit things better.

= 2.1 =
* SECURITY: Added in nonces and escaped values when saving.
* ENHANCEMENT: Improved UI of text of banner on front-end.
* Security: Added in nonces and escaped values when saving.
* Enhancement: Improved UI of text of banner on front-end.

= 2.0.4 =
* Enhancement: Changed close button icon. Uses SVG and supports retina-devices.
Expand Down
23 changes: 18 additions & 5 deletions sitewide-notice-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ class SiteWide_Notice_WP_Settings{
public function __construct() {

add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );

// Only load this script on our page.
if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'sitewide-notice-settings' ) {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}

}

Expand Down Expand Up @@ -46,14 +50,14 @@ public function settings_page_content() {
$values['active'] = '1';
$values['background_color'] = 'rgba(255,255,255,1)';
$values['font_color'] = 'rgba(0,0,0,1)';
$values['message'] = '';
$values['message'] = '';
$values['show_on_mobile'] = true;
$values['hide_for_logged_in'] = false;
$values['show_on_top'] = false;
if( defined( 'PMPRO_VERSION' ) ){
$values['show_for_members'] = false;
}

$values['dismissible'] = '1';
}

//If they have submitted the form.
Expand Down Expand Up @@ -96,8 +100,10 @@ public function settings_page_content() {
$values['message'] = htmlspecialchars( $_POST['message'] );
}

if( isset( $_POST['custom_css'] ) ){
$values['custom_css'] = htmlspecialchars( $_POST['custom_css'] );
if( isset( $_POST['dismissible'] ) && $_POST['dismissible'] === 'on' ){
$values['dismissible'] = 1;
}else{
$values['dismissible'] = 0;
}

// Check if PMPro exists, and update settings.
Expand Down Expand Up @@ -143,6 +149,13 @@ public function settings_page_content() {
</td>
</tr>

<tr>
<th scope="row">
<label for="dismissible"><?php _e( 'Show Close Button For Banner', 'sitewide-notice-wp' ); ?></label>
</th>
<td><input type="checkbox" name="dismissible" <?php if( isset( $values['dismissible'] ) && ! empty( $values['dismissible'] ) ) { echo 'checked'; } ?>/></td>
</tr>

<tr>
<th scope="row">
<label for="hide_for_logged_in"><?php _e( 'Hide Banner For Logged-in Users', 'sitewide-notice-wp' ); ?></label>
Expand Down
Loading

0 comments on commit 7606594

Please sign in to comment.