From d55ed208941d1ad92790f96fd455d357bb313d9f Mon Sep 17 00:00:00 2001 From: JiveDig Date: Wed, 10 Jan 2024 12:20:33 -0500 Subject: [PATCH] 1.6.1 fix PHP warning when during sanitization when label/hide/show text fields are empty. --- CHANGES.md | 3 +++ classes/class-table-of-contents.php | 6 +++--- mai-table-of-contents.php | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 939528a..318d10a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,8 @@ # Changelog +## 1.6.1 (1/10/24) +* Fixed: PHP warning when during sanitization when label/hide/show text fields are empty. + ## 1.6.0 (1/4/24) * Added: New settings for TOC label and hide/show text. * Fixed: Wrong font-weight name for the TOC toggle (now using normal instead of regular). diff --git a/classes/class-table-of-contents.php b/classes/class-table-of-contents.php index d8d72b8..327dc29 100644 --- a/classes/class-table-of-contents.php +++ b/classes/class-table-of-contents.php @@ -41,9 +41,9 @@ function __construct( $args, $post_id = 0, $content = null ) { 'open' => rest_sanitize_boolean( $args['open'] ), 'headings' => absint( $args['headings'] ), 'style' => sanitize_html_class( $args['style'] ), - 'label' => wp_kses_post( $args['label'] ), - 'hide' => wp_kses_post( $args['hide'] ), - 'show' => wp_kses_post( $args['show'] ), + 'label' => wp_kses_post( (string) $args['label'] ), // Can't pass null. + 'hide' => wp_kses_post( (string) $args['hide'] ), // Can't pass null. + 'show' => wp_kses_post( (string) $args['show'] ), // Can't pass null. 'class' => esc_attr( $args['class'] ), 'align' => esc_attr( $args['align'] ), ]; diff --git a/mai-table-of-contents.php b/mai-table-of-contents.php index 453e342..978f063 100644 --- a/mai-table-of-contents.php +++ b/mai-table-of-contents.php @@ -4,7 +4,7 @@ * Plugin Name: Mai Table of Contents * Plugin URI: https://bizbudding.com/mai-design-pack/ * Description: Automatically create a table of contents from headings in your posts. - * Version: 1.6.0 + * Version: 1.6.1 * * Author: BizBudding * Author URI: https://bizbudding.com @@ -92,7 +92,7 @@ public function __wakeup() { private function setup_constants() { // Plugin version. if ( ! defined( 'MAI_TABLE_OF_CONTENTS_VERSION' ) ) { - define( 'MAI_TABLE_OF_CONTENTS_VERSION', '1.6.0' ); + define( 'MAI_TABLE_OF_CONTENTS_VERSION', '1.6.1' ); } // Plugin Folder Path.