css-sanitizer
Classes to parse and sanitize CSS
Wikimedia\CSS\Sanitizer\StylesheetSanitizer Class Reference

Sanitizes a CSS stylesheet or rule list. More...

+ Inheritance diagram for Wikimedia\CSS\Sanitizer\StylesheetSanitizer:
+ Collaboration diagram for Wikimedia\CSS\Sanitizer\StylesheetSanitizer:

Public Member Functions

 __construct (array $ruleSanitizers=[])
 
 getRuleSanitizers ()
 Access the list of rule sanitizers. More...
 
 setRuleSanitizers (array $ruleSanitizers)
 Set the list of rule sanitizers. More...
 
- Public Member Functions inherited from Wikimedia\CSS\Sanitizer\Sanitizer
 getSanitizationErrors ()
 Return all sanitization errors seen so far. More...
 
 clearSanitizationErrors ()
 Clear sanitization errors.
 
 sanitize (CSSObject $object)
 Sanitize a CSS object. More...
 

Static Public Member Functions

static newDefault ()
 Create and return a default StylesheetSanitizer. More...
 

Protected Member Functions

 doSanitize (CSSObject $object)
 @inheritDoc
 
- Protected Member Functions inherited from Wikimedia\CSS\Sanitizer\Sanitizer
 sanitizationError ( $tag, CSSObject $object, array $data=[])
 Record a sanitization error. More...
 
 sanitizeObj (Sanitizer $sanitizer, CSSObject $object)
 Run another sanitizer over a CSSObject. More...
 
 sanitizeList (Sanitizer $sanitizer, CSSObjectList $list)
 Run a sanitizer over all CSSObjects in a CSSObjectList. More...
 
 sanitizeRules (array $ruleSanitizers, RuleList $list)
 Run a set of RuleSanitizers over all rules in a RuleList. More...
 

Protected Attributes

 $ruleSanitizers
 
- Protected Attributes inherited from Wikimedia\CSS\Sanitizer\Sanitizer
 $sanitizationErrors = []
 

Detailed Description

Sanitizes a CSS stylesheet or rule list.

See also
https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/#css-stylesheets

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\CSS\Sanitizer\StylesheetSanitizer::__construct ( array  $ruleSanitizers = [])
Parameters
RuleSanitizer[]$ruleSanitizersSanitizers to test rules. For each rule in the sheet, the first sanitizer that handles that rule gets to sanitize it.

Member Function Documentation

◆ getRuleSanitizers()

Wikimedia\CSS\Sanitizer\StylesheetSanitizer::getRuleSanitizers ( )

Access the list of rule sanitizers.

Returns
RuleSanitizer[]

◆ newDefault()

static Wikimedia\CSS\Sanitizer\StylesheetSanitizer::newDefault ( )
static

Create and return a default StylesheetSanitizer.

Note
This method exists more to be an example of how to put everything together than to be used directly.
Returns
StylesheetSanitizer

◆ setRuleSanitizers()

Wikimedia\CSS\Sanitizer\StylesheetSanitizer::setRuleSanitizers ( array  $ruleSanitizers)

Set the list of rule sanitizers.

Parameters
RuleSanitizer[]$ruleSanitizers

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