Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add additional sanitization to fonts.
  • Loading branch information
jffng committed Nov 16, 2023
commit 56b55dbb9ef7d979603343f475faaba652b8a638
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,17 @@ private function sanitize() {
'version' => '2',
'settings' => array(
'typography' => array(
'fontFamilies' => array( $this->data ),
'fontFamilies' => array(
'custom' => array(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom key is necessary to accommodate the input expected by remove_insecure_properties.

$this->data,
),
),
),
),
);
// Creates a new WP_Theme_JSON object with the new fonts to
// leverage sanitization and validation.
$fonts_json = WP_Theme_JSON_Gutenberg::remove_insecure_properties( $fonts_json );
$theme_json = new WP_Theme_JSON_Gutenberg( $fonts_json );
$theme_data = $theme_json->get_data();
$sanitized_font = ! empty( $theme_data['settings']['typography']['fontFamilies'] )
Expand Down