PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.3.3
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.3.3
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | includes/library/Emogrifier.php +27 -10 1.6.131.3.3 View file →
@@ -3,13 +3,11 @@
3 3 /**
4 4 * This class provides functions for converting CSS styles into inline style attributes in your HTML code.
5 5 *
6 6 * For more information, please see the README.md file.
7 - *
8 - * @internal This class is deprecated as of v3.0.0 of emogrifier. Need to update to new CSSInliner class.
9 7 *
10 - * @link https://github.com/MyIntervals/emogrifier/blob/v1.2.x/Classes/Emogrifier.php
11 - *
8 + * @version 1.2.0
9 + *
12 10 * @author Cameron Brooks
13 11 * @author Jaime Prado
14 12 * @author Oliver Klee <typo3-coding@oliverklee.de>
15 13 * @author Roman Ožana <ozana@omdesign.cz>
@@ -175,19 +173,19 @@
175 173 '/(\\w)\\[(\\w+)\\]/' => '\\1[@\\2]',
176 174 // exact attribute
177 175 '/(\\w)\\[(\\w+)\\=[\'"]?([\\w\\s]+)[\'"]?\\]/' => '\\1[@\\2="\\3"]',
178 176 // element attribute~=
179 - '/([\\w\\*]+)\\[(\\w+)[\\s]*\\~\\=[\\s]*[\'"]?([\\w\\-_\\/]+)[\'"]?\\]/'
177 + '/([\\w\\*]+)\\[(\\w+)[\\s]*\\~\\=[\\s]*[\'"]?([\\w-_\\/]+)[\'"]?\\]/'
180 178 => '\\1[contains(concat(" ", @\\2, " "), concat(" ", "\\3", " "))]',
181 179 // element attribute^=
182 - '/([\\w\\*]+)\\[(\\w+)[\\s]*\\^\\=[\\s]*[\'"]?([\\w\\-_\\/]+)[\'"]?\\]/' => '\\1[starts-with(@\\2, "\\3")]',
180 + '/([\\w\\*]+)\\[(\\w+)[\\s]*\\^\\=[\\s]*[\'"]?([\\w-_\\/]+)[\'"]?\\]/' => '\\1[starts-with(@\\2, "\\3")]',
183 181 // element attribute*=
184 - '/([\\w\\*]+)\\[(\\w+)[\\s]*\\*\\=[\\s]*[\'"]?([\\w\\-_\\s\\/:;]+)[\'"]?\\]/' => '\\1[contains(@\\2, "\\3")]',
182 + '/([\\w\\*]+)\\[(\\w+)[\\s]*\\*\\=[\\s]*[\'"]?([\\w-_\\s\\/:;]+)[\'"]?\\]/' => '\\1[contains(@\\2, "\\3")]',
185 183 // element attribute$=
186 - '/([\\w\\*]+)\\[(\\w+)[\\s]*\\$\\=[\\s]*[\'"]?([\\w\\-_\\s\\/]+)[\'"]?\\]/'
184 + '/([\\w\\*]+)\\[(\\w+)[\\s]*\\$\\=[\\s]*[\'"]?([\\w-_\\s\\/]+)[\'"]?\\]/'
187 185 => '\\1[substring(@\\2, string-length(@\\2) - string-length("\\3") + 1) = "\\3"]',
188 186 // element attribute|=
189 - '/([\\w\\*]+)\\[(\\w+)[\\s]*\\|\\=[\\s]*[\'"]?([\\w\\-_\\s\\/]+)[\'"]?\\]/'
187 + '/([\\w\\*]+)\\[(\\w+)[\\s]*\\|\\=[\\s]*[\'"]?([\\w-_\\s\\/]+)[\'"]?\\]/'
190 188 => '\\1[@\\2="\\3" or starts-with(@\\2, concat("\\3", "-"))]',
191 189 ];
192 190
193 191 /**
@@ -226,8 +224,15 @@
226 224 ],
227 225 ];
228 226
229 227 /**
228 + * Emogrifier will throw Exceptions when it encounters an error instead of silently ignoring them.
229 + *
230 + * @var bool
231 + */
232 + private $debug = false;
233 +
234 + /**
230 235 * The constructor.
231 236 *
232 237 * @param string $html the HTML to emogrify, must be UTF-8-encoded
233 238 * @param string $css the CSS to merge, must be UTF-8-encoded
@@ -1528,9 +1533,9 @@
1528 1533 * @throws \InvalidArgumentException
1529 1534 */
1530 1535 public function handleXpathError($type, $message, $file, $line, array $context)
1531 1536 {
1532 - if ($type === E_WARNING && isset($context['cssRule']['selector'])) {
1537 + if ($this->debug && $type === E_WARNING && isset($context['cssRule']['selector'])) {
1533 1538 throw new \InvalidArgumentException(
1534 1539 sprintf(
1535 1540 '%s in selector >> %s << in %s on line %s',
1536 1541 $message,
@@ -1542,6 +1547,18 @@
1542 1547 }
1543 1548
1544 1549 // the normal error handling continues when handler return false
1545 1550 return false;
1551 + }
1552 +
1553 + /**
1554 + * Sets the debug mode.
1555 + *
1556 + * @param bool $debug set to true to enable debug mode
1557 + *
1558 + * @return void
1559 + */
1560 + public function setDebug($debug)
1561 + {
1562 + $this->debug = $debug;
1546 1563 }
1547 1564 }