From 20d8f2513c1e0164df198d6bcddd3973a0007d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sun, 4 Feb 2024 10:24:52 +0100 Subject: [PATCH] test inlining --- lib/inliner.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/inliner.php b/lib/inliner.php index 5244b7d..629c1e7 100644 --- a/lib/inliner.php +++ b/lib/inliner.php @@ -1,17 +1,15 @@ tags with href attribute for CSS files - $pattern = '//i'; + $pattern = '//i'; // Use preg_replace_callback to replace matched link tags with inline styles - $outputString = preg_replace_callback($pattern, function($match) use ($basePath) { + $outputString = preg_replace_callback($pattern, function($match) { // Extract the href attribute value $href = $match[1]; // Get the content of the local CSS file - $cssContent = file_get_contents($basePath . '/assets/' . $href); + $cssContent = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $href); // Create an inline style tag with the CSS content return ""; @@ -21,18 +19,16 @@ function inlineLocalStylesFromHref($inputString) { } function inlineScriptFromSrc($inputString) { - $basePath = '/path/to/your/local/files'; // Hardcoded base path - // Define the regular expression pattern to match