WP_Theme_JSON::remove_insecure_styles() – Processes a style node and returns the same node without the insecure styles.

You appear to be a bot. Output may be restricted

Description

Processes a style node and returns the same node without the insecure styles.

Usage

$array = WP_Theme_JSON::remove_insecure_styles( $input );

Parameters

$input
( array ) required – Node to process.

Returns

array

Source

File name: wordpress/wp-includes/class-wp-theme-json.php
Lines:

1 to 18 of 18
  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 );
        }
      }
    }
    return $output;
  }
 

 View on GitHub View on Trac