芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/cms.mgaplay.com.br/vendor/mpdf/mpdf/src/CssManager.php
mpdf = $mpdf; $this->cache = $cache; $this->sizeConverter = $sizeConverter; $this->assetFetcher = $assetFetcher; $this->tablecascadeCSS = []; $this->CSS = []; $this->cascadeCSS = []; $this->tbCSSlvl = 0; $this->colorConverter = $colorConverter; } public function ReadCSS($html) { preg_match_all('/'; $html = str_replace('>'.$m[1][$i].'', $sub, $html); } } $html = preg_replace('//i', '', $html); $html = preg_replace('/<\!\-\-.*?\-\->/s', ' ', $html); $match = 0; // no match for instance $CSSext = []; // CSS inside external files $regexp = '/
]*rel=["\']stylesheet["\'][^>]*href=["\']([^>"\']*)["\'].*?>/si'; $x = preg_match_all($regexp, $html, $cxt); if ($x) { $match += $x; $CSSext = $cxt[1]; } $regexp = '/
]*href=["\']([^>"\']*)["\'][^>]*?rel=["\']stylesheet["\'].*?>/si'; $x = preg_match_all($regexp, $html, $cxt); if ($x) { $match += $x; $CSSext = array_merge($CSSext, $cxt[1]); } // look for @import stylesheets // $regexp = '/@import url\([\'\"]{0,1}([^\)]*?\.css)[\'\"]{0,1}\)/si'; // $regexp = '/@import url\([\'\"]{0,1}([^\)]*?\.css(\?\S+)?)[\'\"]{0,1}\)/si'; $regexp = '/@import url\([\'\"]{0,1}(\S*?\.css(\?[^\s\'\"]+)?)[\'\"]{0,1}\)\;?/si'; $x = preg_match_all($regexp, $html, $cxt); if ($x) { $match += $x; $CSSext = array_merge($CSSext, $cxt[1]); } // look for @import without the url() // $regexp = '/@import [\'\"]{0,1}([^;]*?\.css)[\'\"]{0,1}/si'; // $regexp = '/@import [\'\"]{0,1}([^;]*?\.css(\?\S+)?)[\'\"]{0,1}/si'; $regexp = '/@import (?!url)[\'\"]{0,1}(\S*?\.css(\?[^\s\'\"]+)?)[\'\"]{0,1}\;?/si'; $x = preg_match_all($regexp, $html, $cxt); if ($x) { $match += $x; $CSSext = array_merge($CSSext, $cxt[1]); } $ind = 0; $CSSstr = ''; if (!is_array($this->cascadeCSS)) { $this->cascadeCSS = []; } while ($match) { $path = $CSSext[$ind]; $path = htmlspecialchars_decode($path); // mPDF 6 $this->mpdf->GetFullPath($path); $path = $this->normalizePath($path); $CSSextblock = $this->assetFetcher->fetchDataFromPath($path); if ($CSSextblock) { // look for embedded @import stylesheets in other stylesheets // and fix url paths (including background-images) relative to stylesheet // $regexpem = '/@import url\([\'\"]{0,1}(.*?\.css)[\'\"]{0,1}\)/si'; $regexpem = '/@import url\([\'\"]{0,1}(.*?\.css(\?\S+)?)[\'\"]{0,1}\)/si'; $xem = preg_match_all($regexpem, $CSSextblock, $cxtem); $cssBasePath = preg_replace('/\/[^\/]*$/', '', $path) . '/'; if ($xem) { foreach ($cxtem[1] as $cxtembedded) { // path is relative to original stylesheet!! $this->mpdf->GetFullPath($cxtembedded, $cssBasePath); $match++; $CSSext[] = $cxtembedded; } } $regexpem = '/(background[^;]*url\s*\(\s*[\'\"]{0,1})([^\)\'\"]*)([\'\"]{0,1}\s*\))/si'; $xem = preg_match_all($regexpem, $CSSextblock, $cxtem); if ($xem) { $count_cxtem = count($cxtem[0]); for ($i = 0; $i < $count_cxtem; $i++) { // path is relative to original stylesheet!! $embedded = $cxtem[2][$i]; if (!preg_match('/^data:image/i', $embedded)) { // mPDF 5.5.13 $this->mpdf->GetFullPath($embedded, $cssBasePath); $CSSextblock = str_replace($cxtem[0][$i], ($cxtem[1][$i] . $embedded . $cxtem[3][$i]), $CSSextblock); } } } $CSSstr .= ' ' . $CSSextblock; } $match--; $ind++; } // CSS as