WP_Theme_JSON::remove_insecure_element_styles
Remove insecure element styles within a variation or block.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Массив. The sanitized elements styles.
Использование
$result = WP_Theme_JSON::remove_insecure_element_styles( $elements );
- $elements(массив) (обязательный)
- The elements to process.
Список изменений
| С версии 6.8.0 | Введена. |
Код WP_Theme_JSON::remove_insecure_element_styles() WP Theme JSON::remove insecure element styles WP 7.0
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;
}