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

Base class for CSS rule sanitizers. More...

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

Public Member Functions

 getIndex ()
 Return an integer indicating ordering constraints.
 
 handlesRule (Rule $rule)
 Indicate whether this rule is handled by this sanitizer.
 
- 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

 sanitizeDeclarationBlock (SimpleBlock $block, PropertySanitizer $sanitizer)
 Sanitize a block's contents as a DeclarationList, in place.
 
 sanitizeRuleBlock (SimpleBlock $block, array $sanitizers)
 Sanitize a block's contents as a RuleList, in place.
 
 fixPreludeWhitespace (AtRule $rule, $cloneIfNecessary)
 For the whitespace at the start of the prelude.
 
- 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.
 
 doSanitize (CSSObject $object)
 Sanitize a CSS object.
 

Additional Inherited Members

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

Detailed Description

Base class for CSS rule sanitizers.

Member Function Documentation

◆ fixPreludeWhitespace()

Wikimedia\CSS\Sanitizer\RuleSanitizer::fixPreludeWhitespace ( AtRule $rule,
$cloneIfNecessary )
protected

For the whitespace at the start of the prelude.

The matcher probably marked it insignificant, but it's actually significant if it's needed to separate the at-keyword and the first thing in the prelude. And if there isn't a whitespace there, add one if it would be significant.

Parameters
AtRule$rule
bool$cloneIfNecessary
Returns
AtRule

◆ getIndex()

Wikimedia\CSS\Sanitizer\RuleSanitizer::getIndex ( )

Return an integer indicating ordering constraints.

Lower numbers must come earlier in the document.

Returns
int|int[] If two numbers are returned, these are the test and the newly-set indexes, respectively.

Reimplemented in Wikimedia\CSS\Sanitizer\ImportAtRuleSanitizer, and Wikimedia\CSS\Sanitizer\NamespaceAtRuleSanitizer.

◆ handlesRule()

◆ sanitizeDeclarationBlock()

Wikimedia\CSS\Sanitizer\RuleSanitizer::sanitizeDeclarationBlock ( SimpleBlock $block,
PropertySanitizer $sanitizer )
protected

Sanitize a block's contents as a DeclarationList, in place.

Parameters
SimpleBlock$block
PropertySanitizer$sanitizer

◆ sanitizeRuleBlock()

Wikimedia\CSS\Sanitizer\RuleSanitizer::sanitizeRuleBlock ( SimpleBlock $block,
array $sanitizers )
protected

Sanitize a block's contents as a RuleList, in place.

Parameters
SimpleBlock$block
RuleSanitizer[]$sanitizers

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