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

Sanitizes a Declaration representing a CSS style property. More...

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

Public Member Functions

 __construct (MatcherFactory $matcherFactory)
 
- Public Member Functions inherited from Wikimedia\CSS\Sanitizer\PropertySanitizer
 __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

 css2 (MatcherFactory $matcherFactory)
 Properties from CSS 2.1.
 
 cssDisplay3 (MatcherFactory $matcherFactory)
 Properties for CSS Display Module Level 3.
 
 cssPosition3 (MatcherFactory $matcherFactory)
 Properties for CSS Positioned Layout Module Level 3.
 
 cssColor3 (MatcherFactory $matcherFactory)
 Properties for CSS Color Module Level 3.
 
 backgroundTypes (MatcherFactory $matcherFactory)
 Data types for backgrounds.
 
 cssBorderBackground3 (MatcherFactory $matcherFactory)
 Properties for CSS Backgrounds and Borders Module Level 3.
 
 cssImages3 (MatcherFactory $matcherFactory)
 Properties for CSS Images Module Level 3.
 
 cssFonts3 (MatcherFactory $matcherFactory)
 Properties for CSS Fonts Module Level 3.
 
 cssMulticol (MatcherFactory $matcherFactory)
 Properties for CSS Multi-column Layout Module.
 
 cssOverflow3 (MatcherFactory $matcherFactory)
 Properties for CSS Overflow Module Level 3.
 
 cssUI4 (MatcherFactory $matcherFactory)
 Properties for CSS Basic User Interface Module Level 4.
 
 cssCompositing1 (MatcherFactory $matcherFactory)
 Properties for CSS Compositing and Blending Level 1.
 
 cssWritingModes4 (MatcherFactory $matcherFactory)
 Properties for CSS Writing Modes Level 4.
 
 cssTransitions (MatcherFactory $matcherFactory)
 Properties for CSS Transitions.
 
 cssAnimations (MatcherFactory $matcherFactory)
 Properties for CSS Animations.
 
 cssFlexbox3 (MatcherFactory $matcherFactory)
 Properties for CSS Flexible Box Layout Module Level 1.
 
 cssTransforms1 (MatcherFactory $matcherFactory)
 Properties for CSS Transforms Module Level 1.
 
 cssText3 (MatcherFactory $matcherFactory)
 Properties for CSS Text Module Level 3.
 
 cssTextDecor3 (MatcherFactory $matcherFactory)
 Properties for CSS Text Decoration Module Level 3.
 
 cssAlign3 (MatcherFactory $matcherFactory)
 Properties for CSS Box Alignment Module Level 3.
 
 cssBreak3 (MatcherFactory $matcherFactory)
 Properties for CSS Fragmentation Module Level 3.
 
 cssGrid1 (MatcherFactory $matcherFactory)
 Properties for CSS Grid Layout Module Level 1.
 
 cssFilter1 (MatcherFactory $matcherFactory)
 Properties for CSS Filter Effects Module Level 1.
 
 basicShapes (MatcherFactory $matcherFactory)
 Shapes and masking share these basic shapes.
 
 cssShapes1 (MatcherFactory $matcherFactory)
 Properties for CSS Shapes Module Level 1.
 
 cssMasking1 (MatcherFactory $matcherFactory)
 Properties for CSS Masking Module Level 1.
 
 getSizingAdditions (MatcherFactory $matcherFactory)
 Additional keywords and functions from CSS Intrinsic and Extrinsic Sizing Level 3.
 
 cssSizing3 (MatcherFactory $matcherFactory)
 Properties for CSS Intrinsic and Extrinsic Sizing Level 3.
 
 cssLogical1 (MatcherFactory $matcherFactory)
 Properties for CSS Logical 1.
 
- Protected Member Functions inherited from Wikimedia\CSS\Sanitizer\PropertySanitizer
 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.
 

Protected Attributes

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

Detailed Description

Sanitizes a Declaration representing a CSS style property.

Note
This intentionally doesn't support cascading variables since that seems impossible to securely sanitize.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::__construct ( MatcherFactory $matcherFactory)
Parameters
MatcherFactory$matcherFactoryFactory for Matchers

Member Function Documentation

◆ backgroundTypes()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::backgroundTypes ( MatcherFactory $matcherFactory)
protected

Data types for backgrounds.

Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
array

◆ basicShapes()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::basicShapes ( MatcherFactory $matcherFactory)
protected

Shapes and masking share these basic shapes.

See also
https://www.w3.org/TR/2014/CR-css-shapes-1-20140320/#basic-shape-functions
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher

◆ css2()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::css2 ( MatcherFactory $matcherFactory)
protected

Properties from CSS 2.1.

See also
https://www.w3.org/TR/2011/REC-CSS2-20110607/
Note
Omits properties that have been replaced by a CSS3 module
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssAlign3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssAlign3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Box Alignment Module Level 3.

See also
https://www.w3.org/TR/2018/WD-css-align-3-20181206/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssAnimations()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssAnimations ( MatcherFactory $matcherFactory)
protected

Properties for CSS Animations.

See also
https://www.w3.org/TR/2018/WD-css-animations-1-20181011/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssBorderBackground3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssBorderBackground3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Backgrounds and Borders Module Level 3.

See also
https://www.w3.org/TR/2017/CR-css-backgrounds-3-20171017/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssBreak3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssBreak3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Fragmentation Module Level 3.

See also
https://www.w3.org/TR/2018/CR-css-break-3-20181204/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssColor3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssColor3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Color Module Level 3.

See also
https://www.w3.org/TR/2018/REC-css-color-3-20180619/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssCompositing1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssCompositing1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Compositing and Blending Level 1.

See also
https://www.w3.org/TR/2015/CR-compositing-1-20150113/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssDisplay3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssDisplay3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Display Module Level 3.

See also
https://www.w3.org/TR/2019/CR-css-display-3-20190711/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssFilter1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssFilter1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Filter Effects Module Level 1.

See also
https://www.w3.org/TR/2018/WD-filter-effects-1-20181218/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssFlexbox3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssFlexbox3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Flexible Box Layout Module Level 1.

See also
https://www.w3.org/TR/2018/CR-css-flexbox-1-20181119/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssFonts3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssFonts3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Fonts Module Level 3.

See also
https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssGrid1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssGrid1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Grid Layout Module Level 1.

See also
https://www.w3.org/TR/2017/CR-css-grid-1-20171214/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssImages3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssImages3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Images Module Level 3.

See also
https://www.w3.org/TR/2019/CR-css-images-3-20191010/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssLogical1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssLogical1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Logical 1.

See also
https://www.w3.org/TR/2018/WD-css-logical-1-20180827/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssMasking1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssMasking1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Masking Module Level 1.

See also
https://www.w3.org/TR/2014/CR-css-masking-1-20140826/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssMulticol()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssMulticol ( MatcherFactory $matcherFactory)
protected

Properties for CSS Multi-column Layout Module.

See also
https://www.w3.org/TR/2019/WD-css-multicol-1-20191015/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssOverflow3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssOverflow3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Overflow Module Level 3.

See also
https://www.w3.org/TR/2018/WD-css-overflow-3-20180731/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssPosition3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssPosition3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Positioned Layout Module Level 3.

See also
https://www.w3.org/TR/2016/WD-css-position-3-20160517/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssShapes1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssShapes1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Shapes Module Level 1.

See also
https://www.w3.org/TR/2014/CR-css-shapes-1-20140320/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssSizing3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssSizing3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Intrinsic and Extrinsic Sizing Level 3.

See also
https://www.w3.org/TR/2019/WD-css-sizing-3-20190522/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssText3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssText3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Text Module Level 3.

See also
https://www.w3.org/TR/2019/WD-css-text-3-20191113/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssTextDecor3()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssTextDecor3 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Text Decoration Module Level 3.

See also
https://www.w3.org/TR/2019/CR-css-text-decor-3-20190813/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssTransforms1()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssTransforms1 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Transforms Module Level 1.

See also
https://www.w3.org/TR/2019/CR-css-transforms-1-20190214/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssTransitions()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssTransitions ( MatcherFactory $matcherFactory)
protected

Properties for CSS Transitions.

See also
https://www.w3.org/TR/2018/WD-css-transitions-1-20181011/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssUI4()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssUI4 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Basic User Interface Module Level 4.

See also
https://www.w3.org/TR/2018/REC-css-ui-3-20180621/
https://www.w3.org/TR/2020/WD-css-ui-4-20200102/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssWritingModes4()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::cssWritingModes4 ( MatcherFactory $matcherFactory)
protected

Properties for CSS Writing Modes Level 4.

See also
https://www.w3.org/TR/2019/CR-css-writing-modes-4-20190730/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ getSizingAdditions()

Wikimedia\CSS\Sanitizer\StylePropertySanitizer::getSizingAdditions ( MatcherFactory $matcherFactory)
protected

Additional keywords and functions from CSS Intrinsic and Extrinsic Sizing Level 3.

See also
https://www.w3.org/TR/2019/WD-css-sizing-3-20190522/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array of matchers

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