From 61d9aadcb87e4464d4c45411d0d5508ef8586e2e Mon Sep 17 00:00:00 2001 From: Everaldo Matias Date: Sun, 9 Apr 2023 13:44:49 -0300 Subject: [PATCH] Fix PHP error when exceptions is not an array on admin --- README.md | 3 +++ includes/class-open-whatsapp-chat.php | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e69d676..1f012dc 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ With this, I keep the plugin here on Github and will continue to improve it acco ## Changelog ## +#### 3.3.1 - 2023-04-09 #### +- Fix PHP error when exceptions is not an array on admin + #### 3.3.0 - 2023-04-09 #### - Fix button CSS - Fix PHP error when numbers is empty on admin diff --git a/includes/class-open-whatsapp-chat.php b/includes/class-open-whatsapp-chat.php index 7a10c86..fd71730 100644 --- a/includes/class-open-whatsapp-chat.php +++ b/includes/class-open-whatsapp-chat.php @@ -132,16 +132,16 @@ public function owc_print_button() { $is_show = true; $owc_exceptions = $owc_option['owc_exceptions']; - foreach ( $owc_exceptions as $owc_exception ) { - - if (substr( $owc_exception, -1) === '/' ) { - $owc_exception = substr( $owc_exception, 0, -1 ); - } - - if ( trim( $owc_exception ) == $this->owc_get_url() ) { - $is_show = false; + if ( is_array( $owc_exceptions ) ) { + foreach ( $owc_exceptions as $owc_exception ) { + if ( substr( $owc_exception, -1) === '/' ) { + $owc_exception = substr( $owc_exception, 0, -1 ); + } + + if ( trim( $owc_exception ) == $this->owc_get_url() ) { + $is_show = false; + } } - } if ( $is_show && $owc_option['owc_number'] && $owc_option['owc_message'] ) {