Browse Source

Make tests pass

euromark 11 years ago
parent
commit
4dc77789f6
2 changed files with 10 additions and 6 deletions
  1. 1 3
      Lib/InlineCssLib.php
  2. 9 3
      Vendor/CssToInlineStyles/CssToInlineStyles.php

+ 1 - 3
Lib/InlineCssLib.php

@@ -24,7 +24,7 @@ class InlineCssLib {
 		'xhtmlOutput' => false,
 		'removeCss' => true,
 		'debug' => false,
-		'correctUtf8' => false
+		'correctUtf8' => false // Mainly necessary for OS Win
 	);
 
 	public $settings = array();
@@ -33,8 +33,6 @@ class InlineCssLib {
 	 * startup
 	 */
 	public function __construct($settings = array()) {
-		$this->_defaults['correctUtf8'] = version_compare(PHP_VERSION, '5.4.0') >= 0;
-
 		$defaults = am($this->_defaults, (array) Configure::read('InlineCss'));
 		$this->settings = array_merge($defaults, $settings);
 		if (!method_exists($this, '_process' . ucfirst($this->settings['engine']))) {

+ 9 - 3
Vendor/CssToInlineStyles/CssToInlineStyles.php

@@ -67,6 +67,12 @@ class CssToInlineStyles
      */
     private $excludeMediaQueries = false;
 
+		/**
+		 * Necessary for OS Win to output in the correct encoding.
+		 * Only applicable for PHP5.4 and above.
+		 *
+		 * @var bool
+		 */
     private $correctUtf8 = false;
 
     /**
@@ -81,6 +87,8 @@ class CssToInlineStyles
     {
         if($html !== null) $this->setHTML($html);
         if($css !== null) $this->setCSS($css);
+
+        $this->correctUtf8 = version_compare(PHP_VERSION, '5.4.0') >= 0;
     }
 
     /**
@@ -464,9 +472,7 @@ class CssToInlineStyles
             // Only for >PHP5.4
             // Correct scrambled UTF8 chars (ãƒ...) back to their correct representation.
             $html = html_entity_decode($html, ENT_XHTML, 'UTF-8');
-            if (DS === '\\') {
-            	$html = utf8_decode($html);
-            }
+    				$html = utf8_decode($html);
         }
 
         // cleanup the HTML if we need to