From ef178c1b5d7d4fdfc02cf7a53622083d51d151f2 Mon Sep 17 00:00:00 2001 From: "Pet M." Date: Mon, 19 Oct 2026 12:03:25 +0200 Subject: [PATCH 1/2] fix: resolve psalm errors Signed-off-by: Pet M. --- archive.php | 5 +- blocks/benefits3.php | 1 - blocks/blog-list.php | 6 +- blocks/carousel_slider.php | 5 -- blocks/case-study.php | 8 +-- blocks/contact.php | 1 - blocks/data-sheet.php | 6 +- blocks/faq.php | 2 +- blocks/hosting.php | 1 - blocks/hosting2.php | 1 - blocks/img-cols.php | 4 +- blocks/industries.php | 1 - blocks/nc_videos_tabs.php | 12 +--- blocks/podcast.php | 1 - blocks/promo.php | 25 +++------ blocks/release-changelog.php | 1 - blocks/signup.php | 10 ++-- blocks/simple_slider.php | 2 +- blocks/squote2.php | 1 - blocks/testimonial.php | 1 - blocks/webinar_promo.php | 5 +- blocks/whitepaper-list.php | 2 - blocks/whitepaper.php | 6 +- footer.php | 5 +- functions.php | 105 ++++++++++++++++++++--------------- header.php | 2 - lib/signup.php | 12 ++-- plugins.stub.php | 26 +++++++++ psalm.xml | 19 +++++++ search.php | 7 +-- single.php | 4 +- 31 files changed, 146 insertions(+), 141 deletions(-) create mode 100644 plugins.stub.php diff --git a/archive.php b/archive.php index b0a3de2..7b2e8f7 100644 --- a/archive.php +++ b/archive.php @@ -42,7 +42,7 @@ $webinar = false; if (get_post_type() == 'event') { - $cat = wp_get_object_terms(get_the_ID(), 'event_categories', []); + $cat = wp_get_object_terms((int)get_the_ID(), 'event_categories', []); if ($cat) { foreach ($cat as $c) { if ($c->term_id == 250) { // event_categories Webinars @@ -73,7 +73,8 @@ } if (get_post_type() == 'event') { - $cat_id = get_queried_object()->term_id; + $queried_object = get_queried_object(); + $cat_id = $queried_object instanceof WP_Term ? $queried_object->term_id : null; } ?> diff --git a/blocks/benefits3.php b/blocks/benefits3.php index 1ca1534..010e1b4 100644 --- a/blocks/benefits3.php +++ b/blocks/benefits3.php @@ -5,7 +5,6 @@ $id = get_field('section_id'); $title = get_field('title'); $text = get_field('text'); -$link = get_field('link'); ?>
diff --git a/blocks/blog-list.php b/blocks/blog-list.php index 13c8110..f5da8f2 100644 --- a/blocks/blog-list.php +++ b/blocks/blog-list.php @@ -15,7 +15,7 @@ if (isset($_GET['webinars'])) { - if (strip_tags($_GET['webinars']) == 'upcoming') { + if (is_string($_GET['webinars']) && strip_tags($_GET['webinars']) == 'upcoming') { echo __('Upcoming webinars', 'nextcloud'); } else { echo __('Webinar recordings', 'nextcloud'); @@ -70,7 +70,7 @@ ] ]; - if (strip_tags($_GET['webinars']) == 'upcoming') { + if (is_string($_GET['webinars']) && strip_tags($_GET['webinars']) == 'upcoming') { $args['meta_query'] = [ [ @@ -82,7 +82,7 @@ ]; $args['order'] = 'DESC'; - } elseif (strip_tags($_GET['webinars']) == 'past') { + } elseif (is_string($_GET['webinars']) && strip_tags($_GET['webinars']) == 'past') { $args['meta_query'] = [ 'relation' => 'AND', diff --git a/blocks/carousel_slider.php b/blocks/carousel_slider.php index 7c1ca1b..c494c10 100644 --- a/blocks/carousel_slider.php +++ b/blocks/carousel_slider.php @@ -3,11 +3,6 @@ * Carousel Slider block template */ $id = get_field('id'); -$autoplay_options = get_field_object('autoplay'); -$autoplay = $autoplay_options['value']; -if (!$autoplay) { - $autoplay = 'false'; -} $boxed_layout_options = get_field_object('boxed_layout'); $boxed_layout = $boxed_layout_options['value']; diff --git a/blocks/case-study.php b/blocks/case-study.php index d66c91c..fc04641 100644 --- a/blocks/case-study.php +++ b/blocks/case-study.php @@ -39,16 +39,12 @@ foreach ($studies as $study) { $post_id = $study->ID; - $link = get_the_permalink($post_id); + $link = (string)get_the_permalink($post_id); $featured_image = get_the_post_thumbnail($post_id, 'large', [ 'class' => 'feat_img' ]); - $img = wp_get_attachment_url(get_post_thumbnail_id($post_id) ?: 0) ?: ''; $header = get_the_title($post_id); $ex = get_the_excerpt($post_id); - $custom_field = get_field('field_name', $post_id); - $att = get_field('attachment', $post_id); - $str = substr($att, 38); echo '
'; echo '
'; //echo '
'; @@ -63,7 +59,7 @@ } echo ''; echo '
'; diff --git a/blocks/contact.php b/blocks/contact.php index 4827aca..8e5494f 100644 --- a/blocks/contact.php +++ b/blocks/contact.php @@ -5,7 +5,6 @@ $id = get_field('section_id'); $title = get_field('title'); $text = get_field('text'); -$playground = str_contains(get_permalink() ?: '', 'playground'); ?>
diff --git a/blocks/data-sheet.php b/blocks/data-sheet.php index 880d7c5..a6e6689 100644 --- a/blocks/data-sheet.php +++ b/blocks/data-sheet.php @@ -31,13 +31,11 @@ echo '
'; foreach ($studies as $study) { $post_id = $study->ID; - $link = get_the_permalink($study->ID); + $link = (string)get_the_permalink($study->ID); $featured_image = get_the_post_thumbnail($post_id, 'large', [ 'class' => 'feat_img' ]); - $img = wp_get_attachment_url(get_post_thumbnail_id($study->ID) ?: 0) ?: ''; $header = get_the_title($study->ID); $ex = get_the_excerpt($study->ID); - $custom_field = get_field('field_name', $study->ID); $att = get_field('attachment', $study->ID); echo '
'; echo '
'; @@ -53,7 +51,7 @@ } echo ''; echo '
'; diff --git a/blocks/faq.php b/blocks/faq.php index a9cba04..fffea6e 100644 --- a/blocks/faq.php +++ b/blocks/faq.php @@ -19,7 +19,7 @@ echo '
'; echo '
'; $count = count(get_field('faq')); - $half = ceil($count / 2); + $half = (int)ceil($count / 2); $i = 0; while (have_rows('faq')) : the_row(); $q = get_sub_field('question'); diff --git a/blocks/hosting.php b/blocks/hosting.php index e39553f..27fe1b0 100644 --- a/blocks/hosting.php +++ b/blocks/hosting.php @@ -23,7 +23,6 @@ echo '
'; while (have_rows('columns')) { the_row(); - $header = get_sub_field('the_title'); $cont = get_sub_field('the_text'); $link = get_sub_field('link'); echo '
'; diff --git a/blocks/hosting2.php b/blocks/hosting2.php index 9f76dc7..325e530 100644 --- a/blocks/hosting2.php +++ b/blocks/hosting2.php @@ -23,7 +23,6 @@ echo '
'; while (have_rows('columns')) { the_row(); - $header = get_sub_field('the_title'); $cont = get_sub_field('the_text'); $link = get_sub_field('link'); echo '
'; diff --git a/blocks/img-cols.php b/blocks/img-cols.php index 50941c2..732beb5 100644 --- a/blocks/img-cols.php +++ b/blocks/img-cols.php @@ -35,8 +35,8 @@ while (have_rows('column')) { the_row(); $img_id = get_sub_field('column_image'); - $img2 = wp_get_attachment_image($img_id, 'full', '', [ 'class' => 'img-responsive' ]); - $img_url = wp_get_attachment_image_url($img_id, 'full'); + $img2 = wp_get_attachment_image($img_id, 'full', false, [ 'class' => 'img-responsive' ]); + $img_url = (string)wp_get_attachment_image_url($img_id, 'full'); $text = get_sub_field('column_text'); if ($count == '1') { echo '
'; diff --git a/blocks/industries.php b/blocks/industries.php index 049ab7f..8c4f377 100644 --- a/blocks/industries.php +++ b/blocks/industries.php @@ -10,7 +10,6 @@ $columns = get_field('no_of_columns'); $css = get_field('custom_css_classes'); -$col_class = ''; if ($columns == 4) { $col_class = 'col-lg-3'; } elseif ($columns == 3) { diff --git a/blocks/nc_videos_tabs.php b/blocks/nc_videos_tabs.php index 050f768..5e2747c 100644 --- a/blocks/nc_videos_tabs.php +++ b/blocks/nc_videos_tabs.php @@ -28,15 +28,11 @@ the_row(); $id = get_sub_field('id'); - $icon = get_sub_field('icon'); //$title = str_replace('
', '\n', get_sub_field( 'title' )); - $title = str_replace('\n', '
', get_sub_field('title')); + $title = str_replace('\n', '
', (string)get_sub_field('title')); $description = get_sub_field('description'); - $video_url = get_sub_field('video_url'); - $video_preview_image = get_sub_field('video_preview_image'); $link = get_sub_field('link'); - $custom_css = ''; ?> @@ -130,13 +126,9 @@ the_row(); $id = get_sub_field('id'); - $icon = get_sub_field('icon'); - $title = str_replace('\n', '', get_sub_field('title')); - $description = get_sub_field('description'); + $title = str_replace('\n', '', (string)get_sub_field('title')); $video_url = get_sub_field('video_url'); $video_preview_image = get_sub_field('video_preview_image'); - $link = get_sub_field('link'); - $custom_css = ''; echo ' diff --git a/blocks/squote2.php b/blocks/squote2.php index c948173..11f0a2b 100644 --- a/blocks/squote2.php +++ b/blocks/squote2.php @@ -6,7 +6,6 @@ $quote = get_field('quote'); $img = get_field('image'); $text = get_field('text'); -$pos = get_field('position'); $link = get_field('link'); ?>
diff --git a/blocks/testimonial.php b/blocks/testimonial.php index 4985694..81e81e8 100644 --- a/blocks/testimonial.php +++ b/blocks/testimonial.php @@ -4,7 +4,6 @@ */ $id = get_field('section_id'); $title = get_field('title'); -$link = get_field('link'); ?>
diff --git a/blocks/webinar_promo.php b/blocks/webinar_promo.php index 1cb2eed..b65f522 100644 --- a/blocks/webinar_promo.php +++ b/blocks/webinar_promo.php @@ -15,13 +15,10 @@ $popup_content = get_field('popup_content'); $custom_css_classes = get_field('custom_css_classes'); $expiration = get_field('expiration_date'); +$show_promo = true; if ($expiration) { $expiration_ts = strtotime($expiration); $now = time(); -} - -$show_promo = true; -if ($expiration) { if ($expiration_ts < $now) { $show_promo = false; } diff --git a/blocks/whitepaper-list.php b/blocks/whitepaper-list.php index 9c07515..a39727b 100644 --- a/blocks/whitepaper-list.php +++ b/blocks/whitepaper-list.php @@ -2,7 +2,6 @@ /* * Whitepaper Blog Posts Block Template. */ -$id = get_field('section_id'); $title = get_field('title'); $subtext = get_field('subtext'); ?> @@ -35,7 +34,6 @@ 'order' => 'DSC', ]); foreach ($onepost as $onepostsingle) { - $img = wp_get_attachment_url(get_post_thumbnail_id($onepostsingle->ID) ?: 0) ?: ''; $title = $onepostsingle->post_title; $date = (string)get_the_date('F d, Y', $onepostsingle->ID); $cat = get_the_category($onepostsingle->ID); diff --git a/blocks/whitepaper.php b/blocks/whitepaper.php index cc7674f..03eead0 100644 --- a/blocks/whitepaper.php +++ b/blocks/whitepaper.php @@ -31,14 +31,12 @@ echo '
'; foreach ($studies as $study) { $post_id = $study->ID; - $link = get_the_permalink($study->ID); + $link = (string)get_the_permalink($study->ID); //$img = wp_get_attachment_url(get_post_thumbnail_id($post_id) ?: 0) ?: ''; $featured_image = get_the_post_thumbnail($post_id, 'large', [ 'class' => 'feat_img' ]); - $img = wp_get_attachment_url(get_post_thumbnail_id($study->ID) ?: 0) ?: ''; $header = get_the_title($study->ID); $ex = get_the_excerpt($study->ID); - $custom_field = get_field('field_name', $study->ID); $att = get_field('attachment', $study->ID); echo '
'; echo '
'; @@ -55,7 +53,7 @@ } echo ''; echo '
'; diff --git a/footer.php b/footer.php index d3cd119..beea946 100644 --- a/footer.php +++ b/footer.php @@ -3,9 +3,6 @@ * The template for displaying the footer */ -if (function_exists('get_field')) { - $flogo = get_field('footer_logo', 'options'); -} ?>