HumHub Documentation (unofficial)

HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
in package

This filter extracts <style> blocks from input HTML, cleans them up using CSSTidy, and then places them in $purifier->context->get('StyleBlocks') so they can be used elsewhere in the document.

Tags
note

See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for sample usage.

note

This filter can also be used on stylesheets not included in the document--something purists would probably prefer. Just directly call HTMLPurifier_Filter_ExtractStyleBlocks->cleanCSS()

Table of Contents

Properties

$name  : mixed
Name of the filter for identification purposes.
$_class_attrdef  : mixed
$_enum_attrdef  : mixed
$_id_attrdef  : mixed
$_styleMatches  : mixed
$_tidy  : mixed

Methods

__construct()  : mixed
cleanCSS()  : string
Takes CSS (the stuff found in <style>) and cleans it.
postFilter()  : string
Post-processor function, handles HTML after HTML Purifier
preFilter()  : string
Removes inline <style> tags from HTML, saves them for later use
styleCallback()  : mixed
Save the contents of CSS blocks to style matches

Properties

$name

Name of the filter for identification purposes.

public mixed $name = 'ExtractStyleBlocks'
Tags
type

string

$_class_attrdef

private mixed $_class_attrdef
Tags
type

HTMLPurifier_AttrDef_CSS_Ident

Methods

styleCallback()

Save the contents of CSS blocks to style matches

protected styleCallback(array<string|int, mixed> $matches) : mixed
Parameters
$matches : array<string|int, mixed>

preg_replace style $matches array


        
On this page

Search results