forked from Adleraci/adlerka.top
		
	test inlining
This commit is contained in:
		@@ -1,12 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
function inlineLocalStylesFromHref($inputString) {
 | 
			
		||||
    // Define the regular expression pattern to match <link> tags with href attribute for CSS files
 | 
			
		||||
    $pattern = '/<link.*?(?:(?:rel=["\']stylesheet["\'].*?href=["\']\/(.*?)["\'])|(?:href=["\']\/(.*?)["\'].*?rel=["\']stylesheet["\'])).*?>/i';
 | 
			
		||||
    $pattern = '/<link[^>]*?\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";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user