diff --git a/blocks/donation-form-grid/class-give-donation-form-grid-block.php b/blocks/donation-form-grid/class-give-donation-form-grid-block.php index 7b772dd66f3..19f6337452b 100644 --- a/blocks/donation-form-grid/class-give-donation-form-grid-block.php +++ b/blocks/donation-form-grid/class-give-donation-form-grid-block.php @@ -198,6 +198,8 @@ public function register_block() { /** * Block render callback + * + * @unreleased Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus * * @param array $attributes Block parameters. * @@ -208,7 +210,14 @@ public function render_block( $attributes ) { $parameters = array( 'forms_per_page' => absint( $attributes['formsPerPage'] ), 'ids' => implode(',', - array_map('_give_redirect_form_id', $this->getAsArray($attributes['formIDs'])) + array_map( + static function ($id) { + _give_redirect_form_id($id); + + return $id; + }, + $this->getAsArray($attributes['formIDs']) + ) ), 'exclude' => implode(',', $this->getAsArray($attributes['excludedFormIDs'] ) ), 'orderby' => $attributes['orderBy'], diff --git a/blocks/donor-wall/class-give-donor-wall.php b/blocks/donor-wall/class-give-donor-wall.php index cf2748e52bb..e9ca5fad75f 100644 --- a/blocks/donor-wall/class-give-donor-wall.php +++ b/blocks/donor-wall/class-give-donor-wall.php @@ -198,6 +198,8 @@ public function register_block() { /** * Block render callback + * + * @unreleased Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus * * @param array $attributes Block parameters. * @@ -210,7 +212,14 @@ public function render_block( $attributes ) { $parameters = [ 'donors_per_page' => absint( $attributes['donorsPerPage'] ), 'form_id' => implode(',', - array_map('_give_redirect_form_id', $this->getAsArray($attributes['formID'])) + array_map( + static function ($id) { + _give_redirect_form_id($id); + + return $id; + }, + $this->getAsArray($attributes['formID']) + ) ), 'ids' => implode(',', $this->getAsArray($attributes['ids'] ) ), 'cats' => implode(',', $this->getAsArray($attributes['categories'] ) ), diff --git a/includes/shortcodes.php b/includes/shortcodes.php index d707c0a83fe..996641e8e72 100644 --- a/includes/shortcodes.php +++ b/includes/shortcodes.php @@ -785,6 +785,17 @@ function give_totals_shortcode( $atts ) { * * @since 2.1.0 * + * @unreleased Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus + * @since 2.23.1 Updated the default text color for the donate button, see #6591. + * @since 2.21.2 change tag_background_color, progress_bar_color to official green color #69b868. + * change tag_text_color color to #333333. + * @since 2.20.0 $show_donate_button Option to show donate button + * @since 2.20.0 $donate_button_text Default Donate + * @since 2.20.0 $donate_button_background_color Default #66bb6a + * @since 2.20.0 $donate_button_text_color Default #fff + * @since 2.20.0 $show_bar Default false + * @since 2.22.2 remove $show_bar attribute in favor of show_goal + * * @param array $atts { * Optional. Attributes of the form grid shortcode. * @@ -800,22 +811,12 @@ function give_totals_shortcode( $atts ) { * @type bool $show_goal Whether to display form goal. Default 'true'. * @type bool $show_excerpt Whether to display form excerpt. Default 'true'. * @type bool $show_featured_image Whether to display featured image. Default 'true'. - * @type string $image_size Featured image size. Default 'medium'. Accepts WordPress image sizes. + * @type string $image_size Featured image size. Default 'medium'. Accepts WordPress image sizes. * @type string $image_height Featured image height. Default 'auto'. Accepts valid CSS heights. * @type int $excerpt_length Number of words before excerpt is truncated. Default '16'. * @type string $display_style How the form is displayed, either in new page or modal popup. * Default 'redirect'. Accepts 'redirect', 'modal'. * - * @since 2.23.1 Updated the default text color for the donate button, see #6591. - * @since 2.21.2 change tag_background_color, progress_bar_color to official green color #69b868. - * change tag_text_color color to #333333. - * @since 2.20.0 $show_donate_button Option to show donate button - * @since 2.20.0 $donate_button_text Default Donate - * @since 2.20.0 $donate_button_background_color Default #66bb6a - * @since 2.20.0 $donate_button_text_color Default #fff - * @since 2.20.0 $show_bar Default false - * @since 2.22.2 remove $show_bar attribute in favor of show_goal - * * @return string|bool The markup of the form grid or false. */ function give_form_grid_shortcode( $atts ) { @@ -901,7 +902,13 @@ function give_form_grid_shortcode( $atts ) { // Maybe filter forms by IDs. if ( ! empty( $atts['ids'] ) ) { - $form_args['post__in'] = array_map('_give_redirect_form_id', array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) ) ); + $form_args['post__in'] = array_map( + static function ($id) { + _give_redirect_form_id($id); + + return $id; + }, array_filter(array_map('trim', explode(',', $atts['ids']))) + ); } // Convert comma-separated form IDs into array.