From d5b6270d113f137a85b3d99e59c55029858c871c Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Tue, 24 Jan 2023 11:39:14 +0100 Subject: [PATCH 1/7] fix: get_name --- templates/wp-editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/wp-editor.php b/templates/wp-editor.php index 4554274..90576aa 100644 --- a/templates/wp-editor.php +++ b/templates/wp-editor.php @@ -8,7 +8,7 @@ wp_print_styles( 'media-views' ); $default_settings = [ - 'textarea_name' => esc_attr( $name_prefix ) . '[' . esc_attr( $this->get_name() ) . ']', + 'textarea_name' => esc_attr( $name_prefix ) . '[' . esc_attr( $field->get_name() ) . ']', 'tinymce' => [ 'toolbar1' => 'bold,italic,underline,separator,alignleft,aligncenter,alignright,separator,link,unlink,undo,redo', 'toolbar2' => '', -- GitLab From 568fa8e5090d4b6817323ac611f049b9cc612735 Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Wed, 1 Feb 2023 13:46:06 +0100 Subject: [PATCH 2/7] fix: get_sublabel --- templates/input-text-multiple.php | 2 +- templates/input.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/input-text-multiple.php b/templates/input-text-multiple.php index 05e7d29..4f87610 100644 --- a/templates/input-text-multiple.php +++ b/templates/input-text-multiple.php @@ -57,7 +57,7 @@ if ( empty( $value ) || is_string( $value ) ) { </div> <?php if ( $field->get_type() === 'checkbox' && $field->has_sublabel() ) : ?> - <?php echo \esc_html( $field->get_sublabel() ); ?></label> + <?php echo $field->get_sublabel(); ?></label> <?php endif; ?> <?php endforeach; ?> </div> diff --git a/templates/input.php b/templates/input.php index 4b8eb6a..e5e950a 100644 --- a/templates/input.php +++ b/templates/input.php @@ -39,5 +39,5 @@ if ( $field->get_type() === 'checkbox' && $field->has_sublabel() ) : /> <?php if ( $field->get_type() === 'checkbox' && $field->has_sublabel() ) : ?> - <?php echo \esc_html( $field->get_sublabel() ); ?></label> + <?php echo $field->get_sublabel(); ?></label> <?php endif; ?> -- GitLab From 9041d8160ca75dc12cd32942c9dd0332d28bfa34 Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Thu, 2 Feb 2023 07:55:25 +0100 Subject: [PATCH 3/7] fix: wp_kses_post sublabel --- templates/input.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/input.php b/templates/input.php index e5e950a..29b1484 100644 --- a/templates/input.php +++ b/templates/input.php @@ -39,5 +39,5 @@ if ( $field->get_type() === 'checkbox' && $field->has_sublabel() ) : /> <?php if ( $field->get_type() === 'checkbox' && $field->has_sublabel() ) : ?> - <?php echo $field->get_sublabel(); ?></label> + <?php echo wp_kses_post( $field->get_sublabel() ); ?></label> <?php endif; ?> -- GitLab From b11868591633822ea4d2830c0ac34eeb7685f844 Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Thu, 2 Feb 2023 07:57:39 +0100 Subject: [PATCH 4/7] fix: wp_kses_post sublabel --- templates/input-text-multiple.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/input-text-multiple.php b/templates/input-text-multiple.php index 4f87610..4caa54e 100644 --- a/templates/input-text-multiple.php +++ b/templates/input-text-multiple.php @@ -57,7 +57,7 @@ if ( empty( $value ) || is_string( $value ) ) { </div> <?php if ( $field->get_type() === 'checkbox' && $field->has_sublabel() ) : ?> - <?php echo $field->get_sublabel(); ?></label> + <?php echo wp_kses_post( $field->get_sublabel() ); ?></label> <?php endif; ?> <?php endforeach; ?> </div> -- GitLab From aa248eb105b5a43a0b1f157942b0637dd68acf61 Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Thu, 2 Feb 2023 08:04:04 +0100 Subject: [PATCH 5/7] fix: unused const, type cast --- src/Field/CheckboxField.php | 3 --- src/Field/DateField.php | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Field/CheckboxField.php b/src/Field/CheckboxField.php index 1411029..101bc60 100644 --- a/src/Field/CheckboxField.php +++ b/src/Field/CheckboxField.php @@ -6,9 +6,6 @@ use WPDesk\Forms\Field; class CheckboxField extends BasicField { - const VALUE_TRUE = 'yes'; - const VALUE_FALSE = 'no'; - public function get_type(): string { return 'checkbox'; } diff --git a/src/Field/DateField.php b/src/Field/DateField.php index b5c11f7..58346da 100644 --- a/src/Field/DateField.php +++ b/src/Field/DateField.php @@ -7,15 +7,14 @@ use WPDesk\Forms\Sanitizer\TextFieldSanitizer; class DateField extends BasicField { public function __construct() { - parent::__construct(); $this->set_placeholder('YYYY-MM-DD'); } - public function get_type() { + public function get_type(): string { return 'date'; } - public function get_template_name() { + public function get_template_name(): string { return 'input-text'; } -- GitLab From 235665feb7c69de45fcb7692d87ec7f6f387079f Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Thu, 16 Mar 2023 10:05:43 +0100 Subject: [PATCH 6/7] fix: restore values --- changelog.txt | 7 +++++++ src/Field/CheckboxField.php | 3 +++ 2 files changed, 10 insertions(+) diff --git a/changelog.txt b/changelog.txt index 884d241..327a3dd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ # Changelog +## [3.1.1] - 2023-03-16 +### Added +- WPEditorField +### Deprecated +- WyswigField +### Fixed + ## [3.1.0] - 2022-08-30 ### Added - de_DE translations diff --git a/src/Field/CheckboxField.php b/src/Field/CheckboxField.php index 101bc60..1411029 100644 --- a/src/Field/CheckboxField.php +++ b/src/Field/CheckboxField.php @@ -6,6 +6,9 @@ use WPDesk\Forms\Field; class CheckboxField extends BasicField { + const VALUE_TRUE = 'yes'; + const VALUE_FALSE = 'no'; + public function get_type(): string { return 'checkbox'; } -- GitLab From 6af1f2dde9c602b9c12a4875ac4ed1f166da07e8 Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Thu, 16 Mar 2023 10:08:51 +0100 Subject: [PATCH 7/7] fix: restore values --- changelog.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 327a3dd..6d3569d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,11 +1,13 @@ # Changelog -## [3.1.1] - 2023-03-16 +## [3.2.0] - 2023-03-16 ### Added - WPEditorField +- DateField ### Deprecated - WyswigField ### Fixed +- Removed sanitizing from sublabel ## [3.1.0] - 2022-08-30 ### Added -- GitLab