From 98d9431a7b7f7b7f9bed755a4d49c86dbe29742f Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 15 Sep 2016 11:41:31 -0400 Subject: [PATCH] missed you --- .gitignore | 2 +- lib/vendor/Emogrifier.class.php | 1501 +++++++++++++++++++++++++++++++ 2 files changed, 1502 insertions(+), 1 deletion(-) create mode 100644 lib/vendor/Emogrifier.class.php diff --git a/.gitignore b/.gitignore index 37f23d04..10b9903f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ nbproject composer .ht* -vendor/ +/vendor/ diff --git a/lib/vendor/Emogrifier.class.php b/lib/vendor/Emogrifier.class.php new file mode 100644 index 00000000..f448fab2 --- /dev/null +++ b/lib/vendor/Emogrifier.class.php @@ -0,0 +1,1501 @@ + + * @author Roman Ožana + * @author Sander Kruger + */ +class Emogrifier +{ + /** + * @var int + */ + const CACHE_KEY_CSS = 0; + + /** + * @var int + */ + const CACHE_KEY_SELECTOR = 1; + + /** + * @var int + */ + const CACHE_KEY_XPATH = 2; + + /** + * @var int + */ + const CACHE_KEY_CSS_DECLARATIONS_BLOCK = 3; + + /** + * @var int + */ + const CACHE_KEY_COMBINED_STYLES = 4; + + /** + * for calculating nth-of-type and nth-child selectors + * + * @var int + */ + const INDEX = 0; + + /** + * for calculating nth-of-type and nth-child selectors + * + * @var int + */ + const MULTIPLIER = 1; + + /** + * @var string + */ + const ID_ATTRIBUTE_MATCHER = '/(\\w+)?\\#([\\w\\-]+)/'; + + /** + * @var string + */ + const CLASS_ATTRIBUTE_MATCHER = '/(\\w+|[\\*\\]])?((\\.[\\w\\-]+)+)/'; + + /** + * @var string + */ + const CONTENT_TYPE_META_TAG = ''; + + /** + * @var string + */ + const DEFAULT_DOCUMENT_TYPE = ''; + + /** + * @var string + */ + private $html = ''; + + /** + * @var string + */ + private $css = ''; + + /** + * @var bool[] + */ + private $excludedSelectors = []; + + /** + * @var string[] + */ + private $unprocessableHtmlTags = ['wbr']; + + /** + * @var bool[] + */ + private $allowedMediaTypes = ['all' => true, 'screen' => true, 'print' => true]; + + /** + * @var mixed[] + */ + private $caches = [ + self::CACHE_KEY_CSS => [], + self::CACHE_KEY_SELECTOR => [], + self::CACHE_KEY_XPATH => [], + self::CACHE_KEY_CSS_DECLARATIONS_BLOCK => [], + self::CACHE_KEY_COMBINED_STYLES => [], + ]; + + /** + * the visited nodes with the XPath paths as array keys + * + * @var \DOMElement[] + */ + private $visitedNodes = []; + + /** + * the styles to apply to the nodes with the XPath paths as array keys for the outer array + * and the attribute names/values as key/value pairs for the inner array + * + * @var string[][] + */ + private $styleAttributesForNodes = []; + + /** + * Determines whether the "style" attributes of tags in the the HTML passed to this class should be preserved. + * If set to false, the value of the style attributes will be discarded. + * + * @var bool + */ + private $isInlineStyleAttributesParsingEnabled = true; + + /** + * Determines whether the