From d89c27d1dcf6b245ff6fd982ebccdacc1a7a4527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20G=C3=A5rdenberg?= Date: Tue, 9 Apr 2024 07:16:31 +0200 Subject: [PATCH] fix: Some null handling that is deprecated in newer versions of PHP --- PLUGIN-CHECKSUM | 2 +- .../listTemplate/blocks/course-block-a.php | 10 ++++++---- .../listTemplate/blocks/course-block-b.php | 16 +++++++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/PLUGIN-CHECKSUM b/PLUGIN-CHECKSUM index 347fcbd2..f30ddd2f 100644 --- a/PLUGIN-CHECKSUM +++ b/PLUGIN-CHECKSUM @@ -1 +1 @@ -a8eda52c319500fecae0731cee509ae8 +19e1da41df793f66c4cb9a74dcbb9581 diff --git a/content/template/listTemplate/blocks/course-block-a.php b/content/template/listTemplate/blocks/course-block-a.php index a1776e0c..4f575825 100644 --- a/content/template/listTemplate/blocks/course-block-a.php +++ b/content/template/listTemplate/blocks/course-block-a.php @@ -24,10 +24,12 @@ } if ( $show_descr ) { - echo '
' . wp_kses( $descr, array( - 'br' => array(), - 'p' => array(), - ) ) . '
'; + if ( $descr != null ) { + echo '
' . wp_kses( $descr, array( + 'br' => array(), + 'p' => array(), + ) ) . '
'; + } } if ( $show_course_locations && ! empty( $event_cities ) && $show_city ) { diff --git a/content/template/listTemplate/blocks/course-block-b.php b/content/template/listTemplate/blocks/course-block-b.php index 2bd97cbe..95805b1b 100644 --- a/content/template/listTemplate/blocks/course-block-b.php +++ b/content/template/listTemplate/blocks/course-block-b.php @@ -18,14 +18,20 @@ } } } else { - $descr = strip_tags( $object[ $descr_field ] ); + if ( $object[ $descr_field ] != null ) { + $descr = strip_tags( $object[ $descr_field ] ); + } else { + $descr = null; + } } if ( $show_descr ) { - echo '
' . wp_kses( $descr, array( - 'br' => array(), - 'p' => array(), - ) ) . '
'; + if ( $descr != null ) { + echo '
' . wp_kses( $descr, array( + 'br' => array(), + 'p' => array(), + ) ) . '
'; + } } if ( $show_course_locations && ! empty( $event_cities ) && $show_city ) {