/** * Prepare links for the combined files and insert them in the processed HTML * */ public function insertJchLinks() { if (JchPlatformUtility::isMsieLT10()) { return; } $aLinks = $this->oParser->getReplacedFiles(); if ($this->params->get('htaccess', 2) == 2) { JchOptimizeHelper::checkModRewriteEnabled($this->params); } $replace_css_links = FALSE; if ($this->params->get('css', '1') && !empty($aLinks['css'])) { $sCssCacheId = $this->getCacheId($aLinks['css']); $sCssCache = $this->combineFiles($aLinks['css'], $sCssCacheId, 'css'); if ($this->params->get('pro_optimizeCssDelivery', '0')) { $sCriticalCss = '<style type="text/css">' . $this->sLnEnd . $sCssCache['criticalcss'] . $this->sLnEnd . '</style>' . $this->sLnEnd . '</head>'; $sHeadHtml = str_replace('</head>', $sCriticalCss, $this->oParser->getHeadHtml()); $this->oParser->setSearchArea($sHeadHtml, 'head'); $sUrl = $this->buildUrl($sCssCacheId, 'css'); $sUrl = str_replace('JCHI', '0', $sUrl); $this->loadCssAsync($sUrl); } else { $replace_css_links = TRUE; } } if ($this->params->get('javascript', '1') && !empty($aLinks['js'])) { $sJsCacheId = $this->getCacheId($aLinks['js']); $this->combineFiles($aLinks['js'], $sJsCacheId, 'js'); $this->replaceLinks($sJsCacheId, 'js'); } if ($replace_css_links) { $this->replaceLinks($sCssCacheId, 'css'); } }
/** * * @param type $sType */ protected function initSearch($aCBArgs) { JCH_DEBUG ? JchPlatformProfiler::start('InitSearch') : null; if (JchPlatformUtility::isMsieLT10()) { return; } $aJsRegex = $this->getJsRegex(); $j = implode('', $aJsRegex); $aCssRegex = $this->getCssRegex(); $c = implode('', $aCssRegex); $i = $this->ifRegex(); $sRegex = "#(?><?[^<]*+(?:{$i})?)*?\\K(?:{$j}|{$c}|\\K\$)#six"; $this->iIndex_js = -1; $this->iIndex_css = -1; $this->bExclude_js = TRUE; $this->bExclude_css = TRUE; JCH_DEBUG ? JchPlatformProfiler::stop('InitSearch', TRUE) : null; $this->searchArea($sRegex, 'head', $aCBArgs); ##<procode>## if ($this->params->get('pro_searchBody', '0')) { $aCBArgs['excludes']['script'] = array_merge($aCBArgs['excludes']['script'], array('document.write'), JchPlatformExcludes::body('js', 'script')); $aCBArgs['excludes']['js'] = array_merge($aCBArgs['excludes']['js'], array('.com/recaptcha/api'), JchPlatformExcludes::body('js')); $this->searchArea($sRegex, 'body', $aCBArgs); } ##</procode>## }
/** * * @param type $sType */ protected function initSearch($aCBArgs) { if (JchPlatformUtility::isMsieLT10()) { return; } $aJsRegex = $this->getJsRegex(); $j = implode('', $aJsRegex); $aCssRegex = $this->getCssRegex(); $c = implode('', $aCssRegex); $i = $this->ifRegex(); $sRegex = "#(?><?[^<]*+(?:{$i})?)*?\\K(?:{$j}|{$c}|\\K\$)#six"; $this->iIndex_js = -1; $this->iIndex_css = -1; $this->bExclude_js = TRUE; $this->bExclude_css = TRUE; $this->searchArea($sRegex, 'head', $aCBArgs); }
/** * * @return type */ public function enableCssCompression() { if (JchPlatformUtility::isMsieLT10()) { return FALSE; } else { return $this->params->get('css', 1) || $this->params->get('csg_enable', 0); } }