From d3dfe9fcbfbf0881fc82879838ef85c243c81b0b Mon Sep 17 00:00:00 2001 From: Szymon Kasprzyk Date: Tue, 1 Aug 2023 13:00:30 +0200 Subject: [PATCH] deprecated functions update 1 --- wp-content/plugins/vf-gutenberg/vf-gutenberg.php | 10 ++++++---- wp-content/plugins/vf-members-block/template.php | 2 ++ wp-content/plugins/vf-wp/vf-helpers.php | 2 ++ .../themes/vf-wp-groups/vf-wp-groups-header/index.php | 6 ++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/wp-content/plugins/vf-gutenberg/vf-gutenberg.php b/wp-content/plugins/vf-gutenberg/vf-gutenberg.php index fd8118d0c..cefd956eb 100644 --- a/wp-content/plugins/vf-gutenberg/vf-gutenberg.php +++ b/wp-content/plugins/vf-gutenberg/vf-gutenberg.php @@ -104,12 +104,14 @@ function add_compatible($keys, callable $callback) { * Render VF Nunjuck template blocks */ public function render_block_nunjucks($html, $block) { - if (preg_match('/^vf\//', $block['blockName'])) { - if (isset($block['attrs']['render'])) { - return $block['attrs']['render']; + if (!empty($block['blockName'])) { + if (preg_match('/^vf\//', $block['blockName'])) { + if (isset($block['attrs']['render'])) { + return $block['attrs']['render']; + } } } - return $html; + return $html; } /** diff --git a/wp-content/plugins/vf-members-block/template.php b/wp-content/plugins/vf-members-block/template.php index 7770baf6c..145f075a2 100644 --- a/wp-content/plugins/vf-members-block/template.php +++ b/wp-content/plugins/vf-members-block/template.php @@ -25,7 +25,9 @@ $leader = boolval($leader); +if (!empty($keyword)) { $keyword = trim($keyword); +} // Hide selected fields $hide_fields = get_field('hide_fields'); diff --git a/wp-content/plugins/vf-wp/vf-helpers.php b/wp-content/plugins/vf-wp/vf-helpers.php index 115eed32a..38526ebba 100644 --- a/wp-content/plugins/vf-wp/vf-helpers.php +++ b/wp-content/plugins/vf-wp/vf-helpers.php @@ -36,7 +36,9 @@ function vf_log($log) { * Return true if a string is empty (including empty HTML) */ function vf_html_empty($str) { + if (!empty($str)) { return preg_match('#\S#', strip_tags($str)) !== 1; + } } /** diff --git a/wp-content/themes/vf-wp-groups/vf-wp-groups-header/index.php b/wp-content/themes/vf-wp-groups/vf-wp-groups-header/index.php index 3a9ef547f..8b94e5d82 100644 --- a/wp-content/themes/vf-wp-groups/vf-wp-groups-header/index.php +++ b/wp-content/themes/vf-wp-groups/vf-wp-groups-header/index.php @@ -137,7 +137,9 @@ public function get_hero_heading() { 'vf_hero_heading', $this->post()->ID ); + if (!empty($heading)) { $heading = trim($heading); + } if (empty($heading)) { $heading = get_bloginfo('name'); } @@ -165,7 +167,9 @@ public function filter_hero_heading($heading) { */ public function get_hero_text() { $text = get_field('vf_hero_subheading', false, false, $this->post()->ID); + if (!empty($text)) { $text = trim($text); + } // If text is empty use the Content Hub description if (vf_html_empty($text) && class_exists('VF_Cache')) { // Get the global taxonomy term @@ -199,10 +203,12 @@ public function filter_hero_text_cleanup($text) { return $text; } // Cleanup Content Hub response + if (!empty($text)) { $text = preg_replace( '#<[^>]*?embl-conditional-edit[^>]*?>.*?]*?>#', '', $text ); + } // Filter allowed tags $text = wp_kses($text, array( 'a' => array(