Changeset 2660479
- Timestamp:
- 01/20/2022 02:37:15 AM (3 years ago)
- Location:
- wp-notification-bars
- Files:
-
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
wp-notification-bars/tags/1.0.10/admin/class-wp-notification-bars-admin.php
r2658291 r2660479 728 728 729 729 // Sanitize fields. 730 $my_data = $this->sanitize_data( $_POST['mtsnb_fields'] );730 $my_data = sanitize_data( $_POST['mtsnb_fields'] ); 731 731 732 732 // Update the meta field in the database. 733 733 update_post_meta( $post_id, '_mtsnb_data', $my_data ); 734 }735 736 /**737 * Sanitize meta fields recursively.738 *739 * @param mixed $value Original value.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',755 'css_position' => 'sanitize_text_field',756 'content_type' => 'sanitize_text_field',757 'basic_link_style' => 'sanitize_text_field',758 'basic_text' => 'wp_kses_post',759 'basic_link_url' => 'esc_url',760 'custom_content' => 'wp_kses_post',761 'bg_color' => 'sanitize_hex_color',762 'txt_color' => 'sanitize_hex_color',763 'link_color' => 'sanitize_hex_color',764 'font_size' => 'absint',765 );766 767 foreach ( $data as $key => $value ) {768 if ( is_array( $value ) ) {769 $sanitized_data[ $key ] = $this->sanitize_data( $value );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 777 return $sanitized_data;778 734 } 779 735 -
wp-notification-bars/tags/1.0.10/includes/class-wp-notification-bars-shared.php
r2658291 r2660479 192 192 $this->bar_output( $this->bar_id, $this->bar_data ); 193 193 } 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 194 239 } 195 240 … … 293 338 } 294 339 295 // fix slashes 296 foreach ( $meta_values as $key => $value ) { 297 298 if ( is_string( $value ) ) { 299 300 $meta_values[ $key ] = stripslashes( $value ); 301 } 302 } 340 $meta_values = self::sanitize_data( $meta_values ); 303 341 304 342 $this->bar_output( $id, $meta_values ); … … 529 567 if ( isset( $_COOKIE['mtsnb_referrer'] ) ) { 530 568 531 // Store d referrer url532 $referer = esc_url ( $_COOKIE['mtsnb_referrer'] );569 // Store 570 $referer = esc_url( $_COOKIE['mtsnb_referrer'] ); 533 571 } 534 572 } -
wp-notification-bars/tags/1.0.10/includes/class-wp-notification-bars.php
r2658291 r2660479 70 70 71 71 $this->plugin_name = 'wp-notification-bars'; 72 $this->version = '1.0. 9';72 $this->version = '1.0.'; 73 73 74 74 $this->load_dependencies(); -
wp-notification-bars/tags/1.0.10/readme.txt
r2658291 r2660479 4 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 5 Requires at least: 3.0.1 6 Tested up to: 5.8. 27 Stable tag: 1.0. 96 Tested up to: 5.8. 7 Stable tag: 1.0. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 75 75 == Changelog == 76 76 77 78 79 77 80 = 1.0.9 = 78 81 * Security improvements -
wp-notification-bars/trunk/admin/class-wp-notification-bars-admin.php
r2658291 r2660479 728 728 729 729 // Sanitize fields. 730 $my_data = $this->sanitize_data( $_POST['mtsnb_fields'] );730 $my_data = sanitize_data( $_POST['mtsnb_fields'] ); 731 731 732 732 // Update the meta field in the database. 733 733 update_post_meta( $post_id, '_mtsnb_data', $my_data ); 734 }735 736 /**737 * Sanitize meta fields recursively.738 *739 * @param mixed $value Original value.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',755 'css_position' => 'sanitize_text_field',756 'content_type' => 'sanitize_text_field',757 'basic_link_style' => 'sanitize_text_field',758 'basic_text' => 'wp_kses_post',759 'basic_link_url' => 'esc_url',760 'custom_content' => 'wp_kses_post',761 'bg_color' => 'sanitize_hex_color',762 'txt_color' => 'sanitize_hex_color',763 'link_color' => 'sanitize_hex_color',764 'font_size' => 'absint',765 );766 767 foreach ( $data as $key => $value ) {768 if ( is_array( $value ) ) {769 $sanitized_data[ $key ] = $this->sanitize_data( $value );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 777 return $sanitized_data;778 734 } 779 735 -
wp-notification-bars/trunk/includes/class-wp-notification-bars-shared.php
r2658291 r2660479 192 192 $this->bar_output( $this->bar_id, $this->bar_data ); 193 193 } 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 194 239 } 195 240 … … 293 338 } 294 339 295 // fix slashes 296 foreach ( $meta_values as $key => $value ) { 297 298 if ( is_string( $value ) ) { 299 300 $meta_values[ $key ] = stripslashes( $value ); 301 } 302 } 340 $meta_values = self::sanitize_data( $meta_values ); 303 341 304 342 $this->bar_output( $id, $meta_values ); … … 529 567 if ( isset( $_COOKIE['mtsnb_referrer'] ) ) { 530 568 531 // Store d referrer url532 $referer = esc_url ( $_COOKIE['mtsnb_referrer'] );569 // Store 570 $referer = esc_url( $_COOKIE['mtsnb_referrer'] ); 533 571 } 534 572 } -
wp-notification-bars/trunk/includes/class-wp-notification-bars.php
r2658291 r2660479 70 70 71 71 $this->plugin_name = 'wp-notification-bars'; 72 $this->version = '1.0. 9';72 $this->version = '1.0.'; 73 73 74 74 $this->load_dependencies(); -
wp-notification-bars/trunk/readme.txt
r2658291 r2660479 4 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 5 Requires at least: 3.0.1 6 Tested up to: 5.8. 27 Stable tag: 1.0. 96 Tested up to: 5.8. 7 Stable tag: 1.0. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 75 75 == Changelog == 76 76 77 78 79 77 80 = 1.0.9 = 78 81 * Security improvements
Note: See TracChangeset
for help on using the changeset viewer.