aboutsummaryrefslogtreecommitdiffstats
path: root/library/HTMLPurifier/AttrTransform/EnumToCSS.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-03-18 17:50:05 +0100
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-03-26 00:41:27 +0100
commitf718e2b0db0fe3477212a8dd6c3ec067f4432862 (patch)
tree8dfbd3b3d4bdcd967b50f1ee4655440bcdef5bb8 /library/HTMLPurifier/AttrTransform/EnumToCSS.php
parent2115eb26a7fd2ca937286bd4e98ab74c7d6e9525 (diff)
downloadvolse-hubzilla-f718e2b0db0fe3477212a8dd6c3ec067f4432862.tar.gz
volse-hubzilla-f718e2b0db0fe3477212a8dd6c3ec067f4432862.tar.bz2
volse-hubzilla-f718e2b0db0fe3477212a8dd6c3ec067f4432862.zip
:arrow_up: Update HTML Purifier library.
Updated HTML Purifier from 4.6.0 to 4.9.2 with better PHP7 compatibility. Used composer to manage this library.
Diffstat (limited to 'library/HTMLPurifier/AttrTransform/EnumToCSS.php')
-rw-r--r--library/HTMLPurifier/AttrTransform/EnumToCSS.php68
1 files changed, 0 insertions, 68 deletions
diff --git a/library/HTMLPurifier/AttrTransform/EnumToCSS.php b/library/HTMLPurifier/AttrTransform/EnumToCSS.php
deleted file mode 100644
index 7ccd0e3fb..000000000
--- a/library/HTMLPurifier/AttrTransform/EnumToCSS.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Generic pre-transform that converts an attribute with a fixed number of
- * values (enumerated) to CSS.
- */
-class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform
-{
- /**
- * Name of attribute to transform from.
- * @type string
- */
- protected $attr;
-
- /**
- * Lookup array of attribute values to CSS.
- * @type array
- */
- protected $enumToCSS = array();
-
- /**
- * Case sensitivity of the matching.
- * @type bool
- * @warning Currently can only be guaranteed to work with ASCII
- * values.
- */
- protected $caseSensitive = false;
-
- /**
- * @param string $attr Attribute name to transform from
- * @param array $enum_to_css Lookup array of attribute values to CSS
- * @param bool $case_sensitive Case sensitivity indicator, default false
- */
- public function __construct($attr, $enum_to_css, $case_sensitive = false)
- {
- $this->attr = $attr;
- $this->enumToCSS = $enum_to_css;
- $this->caseSensitive = (bool)$case_sensitive;
- }
-
- /**
- * @param array $attr
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return array
- */
- public function transform($attr, $config, $context)
- {
- if (!isset($attr[$this->attr])) {
- return $attr;
- }
-
- $value = trim($attr[$this->attr]);
- unset($attr[$this->attr]);
-
- if (!$this->caseSensitive) {
- $value = strtolower($value);
- }
-
- if (!isset($this->enumToCSS[$value])) {
- return $attr;
- }
- $this->prependCSS($attr, $this->enumToCSS[$value]);
- return $attr;
- }
-}
-
-// vim: et sw=4 sts=4