From 51180b343133f2730488c63c2e56fdbc0d9c4cdd Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Tue, 24 Sep 2024 11:59:19 +0200 Subject: [PATCH] Ignore some escaping errors --- includes/Component/Input/Checkbox.php | 4 ++-- includes/Component/Input/Group.php | 2 +- includes/Component/Input/Label.php | 6 +++--- includes/Component/Input/Select.php | 2 +- includes/Component/Input/Text.php | 4 ++-- includes/MslsAdmin.php | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/Component/Input/Checkbox.php b/includes/Component/Input/Checkbox.php index 9dfbb758..5a1072ac 100644 --- a/includes/Component/Input/Checkbox.php +++ b/includes/Component/Input/Checkbox.php @@ -36,8 +36,8 @@ public function __construct( string $key, ?string $value ) { public function render(): string { return sprintf( '', - $this->key, - $this->selected + esc_attr( $this->key ), + $this->selected // phpcs:ignore WordPress.Security.EscapeOutput ); } } diff --git a/includes/Component/Input/Group.php b/includes/Component/Input/Group.php index 7f201a3b..8f1a8841 100644 --- a/includes/Component/Input/Group.php +++ b/includes/Component/Input/Group.php @@ -48,7 +48,7 @@ public function add( InputInterface $input ): self { public function render(): string { $items = array_map( function ( InputInterface $input ) { - return $input->render(); + return $input->render(); // phpcs:ignore WordPress.Security.EscapeOutput }, $this->arr ); diff --git a/includes/Component/Input/Label.php b/includes/Component/Input/Label.php index 0a685755..a32d497f 100644 --- a/includes/Component/Input/Label.php +++ b/includes/Component/Input/Label.php @@ -6,6 +6,7 @@ /** * Class Label + * * @package lloc\Msls\Component\Input */ class Label implements InputInterface { @@ -33,7 +34,6 @@ public function __construct( string $key, string $text ) { * @return string */ public function render(): string { - return sprintf( '', $this->key, $this->text ); + return sprintf( '', esc_html( $this->key ), esc_html( $this->text ) ); } - -} \ No newline at end of file +} diff --git a/includes/Component/Input/Select.php b/includes/Component/Input/Select.php index 3ee7825f..eb4d465a 100644 --- a/includes/Component/Input/Select.php +++ b/includes/Component/Input/Select.php @@ -42,7 +42,7 @@ public function render(): string { '', esc_attr( $this->key ), esc_attr( $name ), - $this->options->render() + $this->options->render() // phpcs:ignore WordPress.Security.EscapeOutput ); } } diff --git a/includes/Component/Input/Text.php b/includes/Component/Input/Text.php index 50536247..363fbb3a 100644 --- a/includes/Component/Input/Text.php +++ b/includes/Component/Input/Text.php @@ -50,8 +50,8 @@ public function render(): string { '', esc_attr( $this->key ), esc_attr( $this->value ), - $this->size, - esc_attr( $this->readonly ) + esc_attr( $this->size ), + $this->readonly // phpcs:ignore WordPress.Security.EscapeOutput ); } } diff --git a/includes/MslsAdmin.php b/includes/MslsAdmin.php index 1375890b..826869c5 100644 --- a/includes/MslsAdmin.php +++ b/includes/MslsAdmin.php @@ -68,7 +68,7 @@ public function get_menu_slug(): string { } /** - * Get's the link for the switcher-settings in the wp-admin + * Gets the link for the switcher-settings in the wp-admin * * @return string */