WP Notification Bars - Version 1.0.8

Version Description

  • More security improvements
Download this release

Release Info

Developer pbalazs
Plugin Icon 128x128 WP Notification Bars
Version 1.0.8
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.8

admin/class-wp-notification-bars-admin.php CHANGED
@@ -726,10 +726,8 @@ if ( ! class_exists( 'MTSNBF_Admin' ) ) {
726
  return;
727
  }
728
 
729
- $my_data = $_POST['mtsnb_fields'];
730
-
731
  // Sanitize fields.
732
- $my_data = $this->sanitize_data( $my_data );
733
 
734
  // Update the meta field in the database.
735
  update_post_meta( $post_id, '_mtsnb_data', $my_data );
@@ -742,27 +740,15 @@ if ( ! class_exists( 'MTSNBF_Admin' ) ) {
742
  *
743
  * @return mixed Sanitized value.
744
  */
745
- public function sanitize_meta( $value ) {
746
- if ( defined( 'MTSNBF_UNFILTERED_HTML' ) && MTSNBF_UNFILTERED_HTML ) {
747
- return $value;
748
- }
749
-
750
- if ( is_string( $value ) ) {
751
- return wp_kses_post( $value );
752
- } elseif ( is_array( $value ) ) {
753
- return array_map( array( $this, 'sanitize_meta' ), $value );
754
- }
755
-
756
- return $value;
757
- }
758
-
759
  public function sanitize_data( $data ) {
760
  if ( defined( 'MTSNBF_UNFILTERED_HTML' ) && MTSNBF_UNFILTERED_HTML ) {
761
  return $data;
762
  }
763
 
764
  $sanitized_data = array();
765
- $sanitize_map = array(
 
 
766
  'active_tab' => 'sanitize_text_field',
767
  'button' => 'sanitize_text_field',
768
  'content_width' => 'absint',
@@ -784,7 +770,7 @@ if ( ! class_exists( 'MTSNBF_Admin' ) ) {
784
  } elseif ( isset( $sanitize_map[ $key ] ) ) {
785
  $sanitized_data[ $key ] = call_user_func( $sanitize_map[ $key ], $value );
786
  } else {
787
- $sanitized_data[ $key ] = $value;
788
  }
789
  }
790
 
726
  return;
727
  }
728
 
 
 
729
  // Sanitize fields.
730
+ $my_data = $this->sanitize_data( $_POST['mtsnb_fields'] );
731
 
732
  // Update the meta field in the database.
733
  update_post_meta( $post_id, '_mtsnb_data', $my_data );
740
  *
741
  * @return mixed Sanitized value.
742
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
  public function sanitize_data( $data ) {
744
  if ( defined( 'MTSNBF_UNFILTERED_HTML' ) && MTSNBF_UNFILTERED_HTML ) {
745
  return $data;
746
  }
747
 
748
  $sanitized_data = array();
749
+
750
+ $default_sanitize = 'sanitize_text_field';
751
+ $sanitize_map = array(
752
  'active_tab' => 'sanitize_text_field',
753
  'button' => 'sanitize_text_field',
754
  'content_width' => 'absint',
770
  } elseif ( isset( $sanitize_map[ $key ] ) ) {
771
  $sanitized_data[ $key ] = call_user_func( $sanitize_map[ $key ], $value );
772
  } else {
773
+ $sanitized_data[ $key ] = call_user_func( $default_sanitize, $value );
774
  }
775
  }
776
 
includes/class-wp-notification-bars-shared.php CHANGED
@@ -217,10 +217,10 @@ if ( ! class_exists( 'MTSNBF_Shared' ) ) {
217
  ?>
218
  <div class="mtsnb mtsnb-shown <?php echo esc_attr( $screen_position_class . ' ' . $css_position_class ); ?>" id="mtsnb-<?php echo esc_attr( $bar_id ); ?>" data-mtsnb-id="<?php echo esc_attr( $bar_id ); ?>" style="<?php echo esc_attr( $style ); ?>">
219
  <style type="text/css">
220
- .mtsnb { position: <?php echo sanitize_html_class( $meta_values['css_position'] ); ?>; <?php echo esc_html( $shadow ); ?>}
221
  .mtsnb .mtsnb-container { width: <?php echo esc_html( $width ); ?>px; font-size: <?php echo esc_html( $meta_values['font_size'] ); ?>px;}
222
- .mtsnb a { color: <?php echo sanitize_hex_color( $meta_values['link_color'] ); ?>;}
223
- .mtsnb .mtsnb-button { background-color: <?php echo sanitize_hex_color( $meta_values['link_color'] ); ?>;}
224
  </style>
225
  <div class="mtsnb-container-outer">
226
  <div class="mtsnb-container mtsnb-clearfix">
@@ -246,9 +246,10 @@ if ( ! class_exists( 'MTSNBF_Shared' ) ) {
246
  * @since 1.0
247
  */
248
  public function bar_content( $options ) {
 
249
 
250
  // Output
251
- echo '<div class="mtsnb-' . sanitize_html_class( $options['content_type'] ) . '-type mtsnb-content">';
252
 
253
  switch ( $options['content_type'] ) {
254
 
217
  ?>
218
  <div class="mtsnb mtsnb-shown <?php echo esc_attr( $screen_position_class . ' ' . $css_position_class ); ?>" id="mtsnb-<?php echo esc_attr( $bar_id ); ?>" data-mtsnb-id="<?php echo esc_attr( $bar_id ); ?>" style="<?php echo esc_attr( $style ); ?>">
219
  <style type="text/css">
220
+ .mtsnb { position: <?php echo esc_html( $meta_values['css_position'] ); ?>; <?php echo esc_html( $shadow ); ?>}
221
  .mtsnb .mtsnb-container { width: <?php echo esc_html( $width ); ?>px; font-size: <?php echo esc_html( $meta_values['font_size'] ); ?>px;}
222
+ .mtsnb a { color: <?php echo esc_html( $meta_values['link_color'] ); ?>;}
223
+ .mtsnb .mtsnb-button { background-color: <?php echo esc_html( $meta_values['link_color'] ); ?>;}
224
  </style>
225
  <div class="mtsnb-container-outer">
226
  <div class="mtsnb-container mtsnb-clearfix">
246
  * @since 1.0
247
  */
248
  public function bar_content( $options ) {
249
+ $class = 'mtsnb-' . sanitize_html_class( $options['content_type'] ) . '-type mtsnb-content';
250
 
251
  // Output
252
+ echo '<div class="' . esc_attr( $class ) . '">';
253
 
254
  switch ( $options['content_type'] ) {
255
 
includes/class-wp-notification-bars.php CHANGED
@@ -69,7 +69,7 @@ class MTSNBF {
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'wp-notification-bars';
72
- $this->version = '1.0.7';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'wp-notification-bars';
72
+ $this->version = '1.0.8';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-notification-bars/
4
  Tags: notification, alert, notification bar, welcome google visitor, welcome facebook visitor, attention bar, floating bar, message, notice, sticky header, offer bar, hello bar
5
  Requires at least: 3.0.1
6
  Tested up to: 5.8.2
7
- Stable tag: 1.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -74,6 +74,9 @@ Please disable all plugins and check if backup is working properly. Then you can
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.0.7 =
78
  * More security improvements
79
 
4
  Tags: notification, alert, notification bar, welcome google visitor, welcome facebook visitor, attention bar, floating bar, message, notice, sticky header, offer bar, hello bar
5
  Requires at least: 3.0.1
6
  Tested up to: 5.8.2
7
+ Stable tag: 1.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.0.8 =
78
+ * More security improvements
79
+
80
  = 1.0.7 =
81
  * More security improvements
82
 
wp-notification-bars.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: WP Notification Bars
5
  * Plugin URI: https://mythemeshop.com/plugins/wp-notification-bars/
6
  * Description: WP Notification Bars is a custom notification and alert bar plugin for WordPress which is perfect for marketing promotions, alerts, increasing click throughs to other pages and so much more.
7
- * Version: 1.0.7
8
  * Author: MyThemeShop
9
  * Author URI: https://mythemeshop.com/
10
  * Text Domain: wp-notification-bars
4
  * Plugin Name: WP Notification Bars
5
  * Plugin URI: https://mythemeshop.com/plugins/wp-notification-bars/
6
  * Description: WP Notification Bars is a custom notification and alert bar plugin for WordPress which is perfect for marketing promotions, alerts, increasing click throughs to other pages and so much more.
7
+ * Version: 1.0.8
8
  * Author: MyThemeShop
9
  * Author URI: https://mythemeshop.com/
10
  * Text Domain: wp-notification-bars