API - XOOPS 2.5.11 Beta 2
By monxoops.fr
HTMLPurifier_Filter_ExtractStyleBlocks Class Reference
Inheritance diagram for HTMLPurifier_Filter_ExtractStyleBlocks:
Collaboration diagram for HTMLPurifier_Filter_ExtractStyleBlocks:

Public Member Functions

 __construct ()
 
 preFilter ($html, $config, $context)
 
 cleanCSS ($css, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_Filter
 preFilter ($html, $config, $context)
 
 postFilter ($html, $config, $context)
 

Data Fields

 $name = 'ExtractStyleBlocks'
 
- Data Fields inherited from HTMLPurifier_Filter
 $name
 

Protected Member Functions

 styleCallback ($matches)
 

Detailed Description

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.

Note
See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for sample usage.
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()

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Member Function Documentation

◆ cleanCSS()

cleanCSS (   $css,
  $config,
  $context 
)

Takes CSS (the stuff found in <style>) and cleans it.

Warning
Requires CSSTidy http://csstidy.sourceforge.net/
Parameters
string$cssCSS styling to clean
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Exceptions
HTMLPurifier_Exception
Returns
string Cleaned CSS
Here is the caller graph for this function:

◆ preFilter()

preFilter (   $html,
  $config,
  $context 
)

Removes inline <style> tags from HTML, saves them for later use

Parameters
string$html
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
string
Todo:
Extend to indicate non-text/css style blocks

Reimplemented from HTMLPurifier_Filter.

Here is the call graph for this function:

◆ styleCallback()

styleCallback (   $matches)
protected

Save the contents of CSS blocks to style matches

Parameters
array$matchespreg_replace style $matches array

Field Documentation

◆ $name

$name = 'ExtractStyleBlocks'

@type string


The documentation for this class was generated from the following file: