Skip to content

Commit

Permalink
Merge pull request #11 from mosne/ver/0.1.3
Browse files Browse the repository at this point in the history
fix escaping with wp_kses_data
  • Loading branch information
ptesei authored Jun 9, 2024
2 parents 59e8b8c + 153bcb8 commit add3f99
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .plugin-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.1.2",
"version": "0.1.3",
"slug": "mosne-dark-palette"
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ You can change the icons using CSS in your theme or in the customizer.
![screenshot-3](https://github.com/mosne/mosne-dark-palette/blob/main/_wordpress-org/screenshot-3.gif)

## Changelog
### 0.1.3 - 2023-06-09

* Fix escaping via wp_kses_data and changelogs

### 0.1.2 - 2023-06-01

Expand Down
1 change: 1 addition & 0 deletions build/index.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/index.js.map

Large diffs are not rendered by default.

76 changes: 39 additions & 37 deletions build/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@

$unique_id = wp_unique_id( 'p-' );
$class_options = $attributes['classOptions'] ?? '';
$additional_classes = $class_options . ' wp-block-navigation-item open-on-hover-click wp-block-navigation-submenu';
$additional_classes = $class_options . ' wp-block-navigation-item open-on-hover-click toto wp-block-navigation-submenu';

sprintf(
'<li %s><div class="navigaiton-item__wrapper has-child"
?>
<li <?php echo wp_kses_data( get_block_wrapper_attributes( [ 'class' => $additional_classes ] ) ); ?>>
<div class="navigaiton-item__wrapper has-child"
tabindex="-1"
data-wp-interactive="mosne/dark-palette"
data-wp-init="callbacks.colorInit"
Expand All @@ -65,50 +66,51 @@
data-wp-on--keydown="actions.showSubmenu"
data-wp-on--focusin="actions.showSubmenu"
data-wp-on--focusout="actions.hideSubmenu"
%s>',
get_block_wrapper_attributes( [ 'class' => $additional_classes ] ),
wp_interactivity_data_wp_context(
[
'mode' => 'auto',
'current' => 'has-icon--auto wp-block-navigation-submenu__toggle',
'submenu' => false,
]
)
);
?>
<button
type="button"
aria-haspopup="menu"
data-wp-bind--class="context.current"
data-wp-bind--aria-expanded="context.submenu"
class="wp-block-navigation-submenu__toggle">
<?php
echo wp_kses_data(
wp_interactivity_data_wp_context(
[
'mode' => 'auto',
'current' => 'has-icon--auto wp-block-navigation-submenu__toggle',
'submenu' => false,
]
)
);
?>
>
<button
type="button"
aria-haspopup="menu"
data-wp-bind--class="context.current"
data-wp-bind--aria-expanded="context.submenu"
class="wp-block-navigation-submenu__toggle">
<span data-wp-bind--aria-label="context.mode">
<?php echo esc_html( $attributes['defaultLabel'] ); ?>
</span>
</button>
<ul aria-labelledby="themes-menu-button"
class="wp-block-navigation__submenu-container wp-block-navigation-submenu">
<li class="wp-block-navigation-item">
<button type="button" data-wp-on--click="actions.makeAuto">
</button>
<ul aria-labelledby="themes-menu-button"
class="wp-block-navigation__submenu-container wp-block-navigation-submenu">
<li class="wp-block-navigation-item">
<button type="button" data-wp-on--click="actions.makeAuto">
<span>
<?php echo esc_html( $attributes['autoLabel'] ); ?>
</span>
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--light" data-wp-on--click="actions.makeLight">
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--light" data-wp-on--click="actions.makeLight">
<span>
<?php echo esc_html( $attributes['lightLabel'] ); ?>
</span>
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--dark" data-wp-on--click="actions.makeDark">
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--dark" data-wp-on--click="actions.makeDark">
<span>
<?php echo esc_html( $attributes['darkLabel'] ); ?>
</span>
</button>
</li>
</ul>
</div>
</button>
</li>
</ul>
</div>
</li>
1 change: 1 addition & 0 deletions build/style-index.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/view.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mosne-dark-palette.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: Create and apply your dark palette in an accessibility-friendly manner using the new Interactivity API.
* Requires at least: 6.5
* Requires PHP: 7.4
* Version: 0.1.2
* Version: 0.1.3
* Author: Mosne
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mosne-dark-palette",
"version": "0.1.2",
"version": "0.1.3",
"description": "Create and apply your dark palette in an a11y friendly way using the new Interactivity API.",
"author": "mosne",
"license": "GPL-2s.0-or-later",
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: block, palette, dark, color, accessibility
Requires at least: 6.5
Requires PHP: 7.4
Tested up to: 6.5
Stable tag: 0.1.2
Stable tag: 0.1.3
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -77,6 +77,10 @@ You can change the icons using CSS in your theme or in the customizer.
3. Edit the dark palette

== Changelog ==
= 0.1.2 - 2023-06-09 =

* Fix escaping via wp_kses_data and changelogs

= 0.1.2 - 2023-06-01 =

* Fix escaping and changelogs
Expand Down
74 changes: 38 additions & 36 deletions src/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
$class_options = $attributes['classOptions'] ?? '';
$additional_classes = $class_options . ' wp-block-navigation-item open-on-hover-click wp-block-navigation-submenu';

sprintf(
'<li %s><div class="navigaiton-item__wrapper has-child"
?>
<li <?php echo wp_kses_data( get_block_wrapper_attributes( [ 'class' => $additional_classes ] ) ); ?>>
<div class="navigaiton-item__wrapper has-child"
tabindex="-1"
data-wp-interactive="mosne/dark-palette"
data-wp-init="callbacks.colorInit"
Expand All @@ -65,50 +66,51 @@
data-wp-on--keydown="actions.showSubmenu"
data-wp-on--focusin="actions.showSubmenu"
data-wp-on--focusout="actions.hideSubmenu"
%s>',
get_block_wrapper_attributes( [ 'class' => $additional_classes ] ),
wp_interactivity_data_wp_context(
[
'mode' => 'auto',
'current' => 'has-icon--auto wp-block-navigation-submenu__toggle',
'submenu' => false,
]
)
);
?>
<button
type="button"
aria-haspopup="menu"
data-wp-bind--class="context.current"
data-wp-bind--aria-expanded="context.submenu"
class="wp-block-navigation-submenu__toggle">
<?php
echo wp_kses_data(
wp_interactivity_data_wp_context(
[
'mode' => 'auto',
'current' => 'has-icon--auto wp-block-navigation-submenu__toggle',
'submenu' => false,
]
)
);
?>
>
<button
type="button"
aria-haspopup="menu"
data-wp-bind--class="context.current"
data-wp-bind--aria-expanded="context.submenu"
class="wp-block-navigation-submenu__toggle">
<span data-wp-bind--aria-label="context.mode">
<?php echo esc_html( $attributes['defaultLabel'] ); ?>
</span>
</button>
<ul aria-labelledby="themes-menu-button"
class="wp-block-navigation__submenu-container wp-block-navigation-submenu">
<li class="wp-block-navigation-item">
<button type="button" data-wp-on--click="actions.makeAuto">
</button>
<ul aria-labelledby="themes-menu-button"
class="wp-block-navigation__submenu-container wp-block-navigation-submenu">
<li class="wp-block-navigation-item">
<button type="button" data-wp-on--click="actions.makeAuto">
<span>
<?php echo esc_html( $attributes['autoLabel'] ); ?>
</span>
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--light" data-wp-on--click="actions.makeLight">
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--light" data-wp-on--click="actions.makeLight">
<span>
<?php echo esc_html( $attributes['lightLabel'] ); ?>
</span>
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--dark" data-wp-on--click="actions.makeDark">
</button>
</li>
<li class="wp-block-navigation-item">
<button type="button" class="has-icon--dark" data-wp-on--click="actions.makeDark">
<span>
<?php echo esc_html( $attributes['darkLabel'] ); ?>
</span>
</button>
</li>
</ul>
</div>
</button>
</li>
</ul>
</div>
</li>

0 comments on commit add3f99

Please sign in to comment.