From dc6a52771b56f46600b3387207578d35c55dbbf3 Mon Sep 17 00:00:00 2001 From: cbacchini Date: Sat, 8 Nov 2025 05:26:04 +0100 Subject: [PATCH 1/6] update for php 8.4 --- Fieldtypes/CheckBoxGroup.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Fieldtypes/CheckBoxGroup.php b/Fieldtypes/CheckBoxGroup.php index c877f16..70fdca4 100644 --- a/Fieldtypes/CheckBoxGroup.php +++ b/Fieldtypes/CheckBoxGroup.php @@ -51,15 +51,16 @@ protected function render_additional_settings() { } public static function register() { - $types = array( - 'checkboxgroup' => __('Check Box Group', 'cforms2'), - 'radiobuttons' => __('Radio Buttons', 'cforms2') - ); - foreach ($types as $id => $label) { - $t = new CheckBoxGroup($id, $label); - $t->register_at_filter(); - } - + add_action('init', function() { + $types = array( + 'checkboxgroup' => __('Check Box Group', 'cforms2'), + 'radiobuttons' => __('Radio Buttons', 'cforms2') + ); + foreach ($types as $id => $label) { + $t = new CheckBoxGroup($id, $label); + $t->register_at_filter(); + } + }); } } From 25bc6905b52e0c057bf163dabcd155f2027aa710 Mon Sep 17 00:00:00 2001 From: cbacchini Date: Sat, 8 Nov 2025 05:57:54 +0100 Subject: [PATCH 2/6] Update CheckBox.php --- Fieldtypes/CheckBox.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Fieldtypes/CheckBox.php b/Fieldtypes/CheckBox.php index c1c731d..0176872 100644 --- a/Fieldtypes/CheckBox.php +++ b/Fieldtypes/CheckBox.php @@ -42,15 +42,16 @@ protected function render_additional_settings() { } public static function register() { - $types = array( - 'ccbox' => array(__('CC: option for user', 'cforms2'), true), - 'checkbox' => array(__('Check Box', 'cforms2'), false) - ); - foreach ($types as $id => $label) { - $t = new CheckBox($id, $label[0], $label[1]); - $t->register_at_filter(); - } - + add_action('init', function() { + $types = array( + 'ccbox' => array(__('CC: option for user', 'cforms2'), true), + 'checkbox' => array(__('Check Box', 'cforms2'), false) + ); + foreach ($types as $id => $label) { + $t = new CheckBox($id, $label[0], $label[1]); + $t->register_at_filter(); + } + }); } } From 1d2f71232965d6ed08c779139d4d34bb14a9d2f7 Mon Sep 17 00:00:00 2001 From: cbacchini Date: Sat, 8 Nov 2025 06:01:32 +0100 Subject: [PATCH 3/6] Update Text.php --- Fieldtypes/Text.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Fieldtypes/Text.php b/Fieldtypes/Text.php index b95db56..b428754 100644 --- a/Fieldtypes/Text.php +++ b/Fieldtypes/Text.php @@ -37,18 +37,19 @@ protected function get_text_inputs() { } public static function register() { - $types = array( - 'textfield' => array(__('Single line of text', 'cforms2'), false), - 'upload' => array(__('File Upload Box', 'cforms2'), false), - 'textarea' => array(__('Multiple lines of text', 'cforms2'), false), - 'pwfield' => array(__('Password Field', 'cforms2'), false), - 'hidden' => array(__('Hidden Field', 'cforms2'), false) - ); - foreach ($types as $id => $label) { - $t = new Text($id, $label[0], $label[1]); - $t->register_at_filter(); - } - + add_action('init', function() { + $types = array( + 'textfield' => array(__('Single line of text', 'cforms2'), false), + 'upload' => array(__('File Upload Box', 'cforms2'), false), + 'textarea' => array(__('Multiple lines of text', 'cforms2'), false), + 'pwfield' => array(__('Password Field', 'cforms2'), false), + 'hidden' => array(__('Hidden Field', 'cforms2'), false) + ); + foreach ($types as $id => $label) { + $t = new Text($id, $label[0], $label[1]); + $t->register_at_filter(); + } + }); } } From d5ce4409dc83f533d73ceac8c225cda252dbd880 Mon Sep 17 00:00:00 2001 From: cbacchini Date: Sat, 8 Nov 2025 06:02:48 +0100 Subject: [PATCH 4/6] Update SelectBox.php --- Fieldtypes/SelectBox.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Fieldtypes/SelectBox.php b/Fieldtypes/SelectBox.php index 17cc596..d418b92 100644 --- a/Fieldtypes/SelectBox.php +++ b/Fieldtypes/SelectBox.php @@ -46,16 +46,17 @@ protected function render_additional_settings() { } public static function register() { - $types = array( - 'emailtobox' => array(__('Multiple Recipients', 'cforms2'), true), - 'selectbox' => array(__('Select Box', 'cforms2'), false), - 'multiselectbox' => array(__('Multi Select Box', 'cforms2'), false) - ); - foreach ($types as $id => $label) { - $t = new SelectBox($id, $label[0], $label[1]); - $t->register_at_filter(); - } - + add_action('init', function() { + $types = array( + 'emailtobox' => array(__('Multiple Recipients', 'cforms2'), true), + 'selectbox' => array(__('Select Box', 'cforms2'), false), + 'multiselectbox' => array(__('Multi Select Box', 'cforms2'), false) + ); + foreach ($types as $id => $label) { + $t = new SelectBox($id, $label[0], $label[1]); + $t->register_at_filter(); + } + }); } } From e4919fee55da3ad77e0d77cfb3df85e986822927 Mon Sep 17 00:00:00 2001 From: cbacchini Date: Sat, 8 Nov 2025 06:04:26 +0100 Subject: [PATCH 5/6] Update Html5.php --- Fieldtypes/Html5.php | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Fieldtypes/Html5.php b/Fieldtypes/Html5.php index 1332b1e..d9dafdb 100644 --- a/Fieldtypes/Html5.php +++ b/Fieldtypes/Html5.php @@ -74,25 +74,26 @@ protected function render_additional_settings() { } public static function register() { - $types = array( - 'html5color' => 'HTML5 ' . __('Color Field', 'cforms2'), - 'html5date' => 'HTML5 ' . __('Date Field', 'cforms2'), - 'html5datetime-local' => 'HTML5 ' . __('Date/Time (local) Field', 'cforms2'), - 'html5email' => 'HTML5 ' . __('Email Field', 'cforms2'), - 'html5month' => 'HTML5 ' . __('Month Field', 'cforms2'), - 'html5number' => 'HTML5 ' . __('Number Field', 'cforms2'), - 'html5range' => 'HTML5 ' . __('Range Field', 'cforms2'), - 'html5search' => 'HTML5 ' . __('Search Field', 'cforms2'), - 'html5time' => 'HTML5 ' . __('Time Field', 'cforms2'), - 'html5url' => 'HTML5 ' . __('URL Field', 'cforms2'), - 'html5week' => 'HTML5 ' . __('Week Field', 'cforms2'), - 'html5tel' => 'HTML5 ' . __('Telephone Number Field', 'cforms2') - ); - foreach ($types as $id => $label) { - $t = new Html5($id, $label); - $t->register_at_filter(); - } - + add_action('init', function() { + $types = array( + 'html5color' => 'HTML5 ' . __('Color Field', 'cforms2'), + 'html5date' => 'HTML5 ' . __('Date Field', 'cforms2'), + 'html5datetime-local' => 'HTML5 ' . __('Date/Time (local) Field', 'cforms2'), + 'html5email' => 'HTML5 ' . __('Email Field', 'cforms2'), + 'html5month' => 'HTML5 ' . __('Month Field', 'cforms2'), + 'html5number' => 'HTML5 ' . __('Number Field', 'cforms2'), + 'html5range' => 'HTML5 ' . __('Range Field', 'cforms2'), + 'html5search' => 'HTML5 ' . __('Search Field', 'cforms2'), + 'html5time' => 'HTML5 ' . __('Time Field', 'cforms2'), + 'html5url' => 'HTML5 ' . __('URL Field', 'cforms2'), + 'html5week' => 'HTML5 ' . __('Week Field', 'cforms2'), + 'html5tel' => 'HTML5 ' . __('Telephone Number Field', 'cforms2') + ); + foreach ($types as $id => $label) { + $t = new Html5($id, $label); + $t->register_at_filter(); + } + }); } } From 6a27075ef4bb4b3f866a63d9ef14581c089ea45a Mon Sep 17 00:00:00 2001 From: cbacchini Date: Sat, 8 Nov 2025 06:06:40 +0100 Subject: [PATCH 6/6] Update MultiId.php --- Fieldtypes/MultiId.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Fieldtypes/MultiId.php b/Fieldtypes/MultiId.php index b928362..26de08c 100644 --- a/Fieldtypes/MultiId.php +++ b/Fieldtypes/MultiId.php @@ -46,9 +46,9 @@ public function is_special() { } public static function register() { - $t = new MultiId('fieldsetend', __('End Fieldset', 'cforms2'), false); - $t->register_at_filter(); - + add_action('init', function() { + $t = new MultiId('fieldsetend', __('End Fieldset', 'cforms2'), false); + $t->register_at_filter(); + }); } - }