Skip to content

Commit

Permalink
Merge pull request #387 from lloc/raise-coverage
Browse files Browse the repository at this point in the history
Ignore some escaping errors
  • Loading branch information
lloc authored Sep 24, 2024
2 parents 6509fa4 + 51180b3 commit 7d34be3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions includes/Component/Input/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function __construct( string $key, ?string $value ) {
public function render(): string {
return sprintf(
'<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>',
$this->key,
$this->selected
esc_attr( $this->key ),
$this->selected // phpcs:ignore WordPress.Security.EscapeOutput
);
}
}
2 changes: 1 addition & 1 deletion includes/Component/Input/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
6 changes: 3 additions & 3 deletions includes/Component/Input/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* Class Label
*
* @package lloc\Msls\Component\Input
*/
class Label implements InputInterface {
Expand Down Expand Up @@ -33,7 +34,6 @@ public function __construct( string $key, string $text ) {
* @return string
*/
public function render(): string {
return sprintf( '<label for="%1$s">%2$s</label>', $this->key, $this->text );
return sprintf( '<label for="%1$s">%2$s</label>', esc_html( $this->key ), esc_html( $this->text ) );
}

}
}
2 changes: 1 addition & 1 deletion includes/Component/Input/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function render(): string {
'<select id="%1$s" name="%2$s">%3$s</select>',
esc_attr( $this->key ),
esc_attr( $name ),
$this->options->render()
$this->options->render() // phpcs:ignore WordPress.Security.EscapeOutput
);
}
}
4 changes: 2 additions & 2 deletions includes/Component/Input/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function render(): string {
'<input type="text" class="regular-text" id="%1$s" name="msls[%1$s]" value="%2$s" size="%3$d"%4$s/>',
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
);
}
}
2 changes: 1 addition & 1 deletion includes/MslsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 7d34be3

Please sign in to comment.