css-sanitizer
Classes to parse and sanitize CSS
Loading...
Searching...
No Matches
Wikimedia\CSS\Sanitizer\PropertySanitizer Class Reference

Sanitizes a Declaration. More...

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

Public Member Functions

 __construct (array $properties=[], Matcher $cssWideKeywordsMatcher=null)
 
 getKnownProperties ()
 Access the list of known properties.
 
 setKnownProperties (array $properties)
 Set the list of known properties.
 
 addKnownProperties ( $props)
 Merge a list of matchers into the list of known properties.
 
 getCssWideKeywordsMatcher ()
 Fetch the matcher for keywords that should be recognized for all properties.
 
 setCssWideKeywordsMatcher (Matcher $matcher)
 Set the matcher for keywords that should be recognized for all properties.
 
- Public Member Functions inherited from Wikimedia\CSS\Sanitizer\Sanitizer
 getSanitizationErrors ()
 Return all sanitization errors seen so far.
 
 stashSanitizationErrors ()
 Temporarily clear sanitization errors.
 
 clearSanitizationErrors ()
 Clear sanitization errors.
 
 sanitize (CSSObject $object)
 Sanitize a CSS object.
 

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.
 
 sanitizeObj (Sanitizer $sanitizer, CSSObject $object)
 Run another sanitizer over a CSSObject.
 
 sanitizeList (Sanitizer $sanitizer, CSSObjectList $list)
 Run a sanitizer over all CSSObjects in a CSSObjectList.
 
 sanitizeRules (array $ruleSanitizers, RuleList $list)
 Run a set of RuleSanitizers over all rules in a RuleList.
 

Additional Inherited Members

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

Detailed Description

Sanitizes a Declaration.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\CSS\Sanitizer\PropertySanitizer::__construct ( array $properties = [],
Matcher $cssWideKeywordsMatcher = null )
Parameters
Matcher[]$propertiesArray mapping declaration names (lowercase) to Matchers for the values
Matcher | null$cssWideKeywordsMatcherMatcher for keywords that should be recognized for all known properties.

Member Function Documentation

◆ addKnownProperties()

Wikimedia\CSS\Sanitizer\PropertySanitizer::addKnownProperties ( $props)

Merge a list of matchers into the list of known properties.

Parameters
Matcher[]$propsArray mapping declaration names (lowercase) to Matchers for the values
Exceptions
InvalidArgumentExceptionif some property is already defined

◆ doSanitize()

Wikimedia\CSS\Sanitizer\PropertySanitizer::doSanitize ( CSSObject $object)
protected

@inheritDoc

Reimplemented from Wikimedia\CSS\Sanitizer\Sanitizer.

◆ getCssWideKeywordsMatcher()

Wikimedia\CSS\Sanitizer\PropertySanitizer::getCssWideKeywordsMatcher ( )

Fetch the matcher for keywords that should be recognized for all properties.

Returns
Matcher

◆ getKnownProperties()

Wikimedia\CSS\Sanitizer\PropertySanitizer::getKnownProperties ( )

Access the list of known properties.

Returns
Matcher[]

◆ setCssWideKeywordsMatcher()

Wikimedia\CSS\Sanitizer\PropertySanitizer::setCssWideKeywordsMatcher ( Matcher $matcher)

Set the matcher for keywords that should be recognized for all properties.

Parameters
Matcher$matcher

◆ setKnownProperties()

Wikimedia\CSS\Sanitizer\PropertySanitizer::setKnownProperties ( array $properties)

Set the list of known properties.

Parameters
Matcher[]$propertiesArray mapping declaration names (lowercase) to Matchers for the values

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