Source of file InlineCSS.php
Size: 0,823 Bytes - Last Modified: 2021-12-23T10:03:15+00:00
/var/www/docs.ssmods.com/process/src/code/InlineCSS.php
123456789101112131415161718192021222324252627282930313233 | <?php use Pelago\Emogrifier; /** * Inline CSS */ class InlineCSS { /** * Inline both the embedded css, and css from an external file, into html * * @param HTML $htmlContent * @param string $cssFile path and filename * @return HTML with inlined CSS */ public static function convert($htmlContent, $cssfile) { $emog = new Emogrifier($htmlContent); // Apply the css file to Emogrifier if ($cssfile) { $cssFileLocation = join(DIRECTORY_SEPARATOR, array(Director::baseFolder(), $cssfile)); $cssFileHandler = fopen($cssFileLocation, 'r'); $css = fread($cssFileHandler, filesize($cssFileLocation)); fclose($cssFileHandler); $emog->setCss($css); } return $emog->emogrify(); } } |