| @@ -1,5 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | + | |
| 2 | 6 | /** |
| 3 | 7 | * This class provides functions for converting CSS styles into inline style attributes in your HTML code. |
| 4 | 8 | * |
| 5 | 9 | * For more information, please see the README.md file. |
| @@ -10,9 +14,10 @@ | ||
| 10 | 14 | * @author Jaime Prado |
| 11 | 15 | * @author Oliver Klee <typo3-coding@oliverklee.de> |
| 12 | 16 | * @author Roman Ožana <ozana@omdesign.cz> |
| 13 | 17 | */ |
| 14 | -class Emogrifier | |
| 18 | +// Locally prefixed to avoid collisions with other plugins bundling this library. | |
| 19 | +class PropertyHive_Emogrifier | |
| 15 | 20 | { |
| 16 | 21 | /** |
| 17 | 22 | * @var int |
| 18 | 23 | */ |
| @@ -431,8 +436,9 @@ | ||
| 431 | 436 | self::CACHE_KEY_CSS_DECLARATIONS_BLOCK, |
| 432 | 437 | self::CACHE_KEY_COMBINED_STYLES, |
| 433 | 438 | ); |
| 434 | 439 | if ( ! in_array($key, $allowedCacheKeys, true) ) { |
| 440 | + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Internal diagnostic; PH_Emails::style_inline() escapes caught exception messages before displaying them. | |
| 435 | 441 | throw new InvalidArgumentException('Invalid cache key: ' . $key, 1391822035); |
| 436 | 442 | } |
| 437 | 443 | |
| 438 | 444 | $this->caches[ $key ] = array(); |
| @@ -1226,5 +1232,9 @@ | ||
| 1226 | 1232 | } |
| 1227 | 1233 | |
| 1228 | 1234 | return $excludedNodes; |
| 1229 | 1235 | } |
| 1230 | -} | |
| 1236 | +} | |
| 1237 | +// Keep direct consumers of the bundled library compatible without using another plugin's implementation. | |
| 1238 | +if ( ! class_exists( 'Emogrifier', false ) ) { | |
| 1239 | + class_alias( 'PropertyHive_Emogrifier', 'Emogrifier' ); | |
| 1240 | +} | |