Ejemplo n.º 1
0
 static function InlineCSS(&$body, &$type, array &$headers, MiMeil $email)
 {
     if ($type === 'html' and $email->inlineCSS !== false) {
         $lib = __DIR__ . '/vendor/autoload.php';
         if (!is_file($lib)) {
             if ($email->inlineCSS === true) {
                 throw new MiMeilError('MiMeil requires inlinestyle/inlinestyle for inline' . ' CSS. Install it via Composer (getcomposer.org).');
             } else {
                 return;
             }
         }
         require_once $lib;
         $body = '<?xml encoding="UTF-8"> ' . static::cutXmlDecl($body);
         $inline = new InlineStyle\InlineStyle($body);
         $inline->applyStylesheet($inline->extractStylesheets());
         // Removing XML declaration because target encoding might be different from
         // UTF-8 (see $this->bodyCharsets). Plus I don't think XHTML in use these days.
         $body = static::cutXmlDecl($inline->getHTML());
         $body = html_entity_decode($body, ENT_QUOTES, 'utf-8');
     }
 }