Remove insecure element styles within a variation or block.
Parameters
$elementsarrayrequired- The elements to process.
Source
protected static function remove_insecure_element_styles( $elements ) {
$sanitized = array();
$valid_element_names = array_keys( static::ELEMENTS );
foreach ( $valid_element_names as $element_name ) {
$element_input = $elements[ $element_name ] ?? null;
if ( $element_input ) {
$element_output = static::remove_insecure_styles( $element_input );
if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) {
if ( isset( $element_input[ $pseudo_selector ] ) ) {
$element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] );
}
}
}
$sanitized[ $element_name ] = $element_output;
}
}
return $sanitized;
}
Changelog
| Version | Description |
|---|---|
| 6.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.