css-sanitizer
Classes to parse and sanitize CSS
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. More...
 
 setKnownProperties (array $properties)
 Set the list of known properties. More...
 
 addKnownProperties ( $props)
 Merge a list of matchers into the list of known properties. More...
 
 getCssWideKeywordsMatcher ()
 Fetch the matcher for keywords that should be recognized for all properties. More...
 
 setCssWideKeywordsMatcher (Matcher $matcher)
 Set the matcher for keywords that should be recognized for all properties. 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...
 

Protected Member Functions

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

 $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-20180423/
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/2017/WD-css-animations-1-20171130/
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/2017/CR-css-break-3-20170209/
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/PR-css-color-3-20180315/
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/2018/WD-css-display-3-20180420/
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/2014/WD-filter-effects-1-20141125/
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/2017/CR-css-flexbox-1-20171019/
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/CR-css-fonts-3-20180315/
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 Image Values and Replaced Content Module Level 3.

See also
https://www.w3.org/TR/2012/CR-css3-images-20120417/
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/2017/WD-css-multicol-1-20171005/
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/2016/WD-css-overflow-3-20160531/
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/2018/WD-css-sizing-3-20180304/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssSpeech()

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

Properties for CSS Speech Module.

See also
https://www.w3.org/TR/2012/CR-css3-speech-20120320/
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/2017/WD-css-text-3-20170822/
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 ext Decoration Module Level 3.

See also
https://www.w3.org/TR/2013/CR-css-text-decor-3-20130801/
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 and CSS 3D Transforms Level 3.

Combined because they both define "transform"

See also
https://www.w3.org/TR/2017/WD-css-transforms-1-20171130/
https://www.w3.org/TR/2009/WD-css3-3d-transforms-20090320/
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/2017/WD-css-transitions-1-20171130/
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/2017/PR-css-ui-3-20171214/
https://www.w3.org/TR/2017/WD-css-ui-4-20171222/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array mapping declaration names (lowercase) to Matchers for the values

◆ cssWritingModes3()

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

Properties for CSS Writing Modes Level 3.

See also
https://www.w3.org/TR/2017/CR-css-writing-modes-3-20171207/
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/2018/WD-css-sizing-3-20180304/
Parameters
MatcherFactory$matcherFactoryFactory for Matchers
Returns
Matcher[] Array of matchers

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