safecss_filter_attr() – Filters an inline style attribute and removes disallowed rules.

You appear to be a bot. Output may be restricted

Description

Filters an inline style attribute and removes disallowed rules.

Usage

$string = safecss_filter_attr( $css, $deprecated );

Parameters

$css
( string ) required – A string of CSS rules.
$deprecated
( string ) optional – Not used.

Returns

string Filtered string of CSS rules.

Source

File name: wordpress/wp-includes/kses.php
Lines:

1 to 100 of 270
function safecss_filter_attr( $css, $deprecated = '' ) {
  if ( ! empty( $deprecated ) ) {
    _deprecated_argument( safecss_filter_attr, '2.8.1' ); // Never implemented.
  }

  $css = wp_kses_no_null( $css );
  $css = str_replace( array( "\n", "\r", "\t" ), '', $css );

  $allowed_protocols = wp_allowed_protocols();

  $css_array = explode( ';', trim( $css ) );

  
/**
 * Filters the list of allowed CSS attributes.
 *
 * @since 2.8.1
 *
 * @param string[] $attr Array of allowed CSS attributes.
 */
  $allowed_attr = apply_filters(
    'safe_style_css',
    array(
      'background',
      'background-color',
      'background-image',
      'background-position',
      'background-size',
      'background-attachment',
      'background-blend-mode',

      'border',
      'border-radius',
      'border-width',
      'border-color',
      'border-style',
      'border-right',
      'border-right-color',
      'border-right-style',
      'border-right-width',
      'border-bottom',
      'border-bottom-color',
      'border-bottom-left-radius',
      'border-bottom-right-radius',
      'border-bottom-style',
      'border-bottom-width',
      'border-bottom-right-radius',
      'border-bottom-left-radius',
      'border-left',
      'border-left-color',
      'border-left-style',
      'border-left-width',
      'border-top',
      'border-top-color',
      'border-top-left-radius',
      'border-top-right-radius',
      'border-top-style',
      'border-top-width',
      'border-top-left-radius',
      'border-top-right-radius',

      'border-spacing',
      'border-collapse',
      'caption-side',

      'columns',
      'column-count',
      'column-fill',
      'column-gap',
      'column-rule',
      'column-span',
      'column-width',

      'color',
      'filter',
      'font',
      'font-family',
      'font-size',
      'font-style',
      'font-variant',
      'font-weight',
      'letter-spacing',
      'line-height',
      'text-align',
      'text-decoration',
      'text-indent',
      'text-transform',

      'height',
      'min-height',
      'max-height',

      'width',
      'min-width',
      'max-width',

      'margin',
      'margin-right',
      'margin-bottom',
      'margin-left',
      'margin-top',
 

 View on GitHub View on Trac