Skip to content

Commit

Permalink
Components fixed (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc authored Nov 21, 2024
1 parent 5a75a19 commit 16e55ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions includes/Component/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ abstract class Component {

const ALLOWED_HTML = array(
'form' => array(
'action' => array(),
'method' => array(),
'action' => true,
'method' => true,
),
'label' => array(
'for' => array(),
'for' => true,
),
'option' => array(
'value' => array(),
'selected' => array(),
'value' => true,
'selected' => true,
),
'select' => array(
'id' => array(),
'name' => array(),
'id' => true,
'name' => true,
),
'input' => array(
'type' => array(),
'class' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'size' => array(),
'readonly' => array(),
'type' => true,
'class' => true,
'id' => true,
'name' => true,
'value' => true,
'size' => true,
'readonly' => true,
),
);

Expand All @@ -45,6 +45,8 @@ abstract public function render(): string;

/**
* Adds our input elements to the allowed HTML elements of a post
*
* @return array<string, array<string, bool>>
*/
public static function get_allowed_html(): array {
$my_allowed = wp_kses_allowed_html( 'post' );
Expand Down
2 changes: 1 addition & 1 deletion includes/Component/Input/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ 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 ),
esc_attr( $this->size ),
$this->size,
$this->readonly // phpcs:ignore WordPress.Security.EscapeOutput
);
}
Expand Down

0 comments on commit 16e55ec

Please sign in to comment.