WP_Theme_JSON::remove_insecure_styles()
Processes a style node and returns the same node without the insecure styles.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Массив
.
Использование
$result = WP_Theme_JSON::remove_insecure_styles( $input );
- $input(массив) (обязательный)
- Node to process.
Список изменений
С версии 5.9.0 | Введена. |
Код WP_Theme_JSON::remove_insecure_styles() WP Theme JSON::remove insecure styles WP 6.5.2
protected static function remove_insecure_styles( $input ) { $output = array(); $declarations = static::compute_style_properties( $input ); foreach ( $declarations as $declaration ) { if ( static::is_safe_css_declaration( $declaration['name'], $declaration['value'] ) ) { $path = static::PROPERTIES_METADATA[ $declaration['name'] ]; /* * Check the value isn't an array before adding so as to not * double up shorthand and longhand styles. */ $value = _wp_array_get( $input, $path, array() ); if ( ! is_array( $value ) ) { _wp_array_set( $output, $path, $value ); } } } // Ensure indirect properties not handled by `compute_style_properties` are allowed. static::remove_indirect_properties( $input, $output ); return $output; }