filter_declaration example


    public function get_declarations_string( $should_prettify = false, $indent_count = 0 ) {
        $declarations_array  = $this->get_declarations();
        $declarations_output = '';
        $indent              = $should_prettify ? str_repeat( "\t", $indent_count ) : '';
        $suffix              = $should_prettify ? ' ' : '';
        $suffix              = $should_prettify && $indent_count > 0 ? "\n" : $suffix;
        $spacer              = $should_prettify ? ' ' : '';

        foreach ( $declarations_array as $property => $value ) {
            $filtered_declaration = static::filter_declaration( $property$value$spacer );
            if ( $filtered_declaration ) {
                $declarations_output .= "{$indent}{$filtered_declaration};$suffix";
            }
        }

        return rtrim( $declarations_output );
    }

    /** * Sanitizes property names. * * @since 6.1.0 * * @param string $property The CSS property. * @return string The sanitized property name. */
Home | Imprint | This part of the site doesn't use cookies.