diff --git a/lib/inliner.php b/lib/inliner.php index efc401b..6beaf73 100644 --- a/lib/inliner.php +++ b/lib/inliner.php @@ -1,12 +1,13 @@ tags with href attribute for CSS files - $pattern = '//i'; + $pattern = '/]*?\srel=["\']?stylesheet["\'].*?\shref=["\']?\/(.*?)["\'][^>]*?>/i'; // Use preg_replace_callback to replace matched link tags with inline styles $outputString = preg_replace_callback($pattern, function($match) { // Extract the href attribute value - $href = isset($match[1]) ? $match[1] : $match[2]; + $href = $match[1]; $fname = $_SERVER['DOCUMENT_ROOT'] . '/' . $href; echo "from $fname";