/** * * @param type $aArray * @param type $sString * @return boolean */ public static function findExcludes($aArray, $sString, $bScript = FALSE) { foreach ($aArray as $sValue) { if ($bScript) { $sString = JS_Optimize::minify($sString); } if ($sValue && strpos($sString, $sValue) !== FALSE) { return TRUE; } } return FALSE; }
/** * * @param type $aArray * @param type $sString * @return boolean */ public static function findExcludes($aArray, $sString, $sType = '') { foreach ($aArray as $sValue) { if ($sType == 'js') { $sString = JS_Optimize::optimize($sString); } elseif ($sType == 'css') { $sString = CSS_Optimize::optimize($sString); } if ($sValue && strpos(htmlspecialchars_decode($sString), $sValue) !== FALSE) { return TRUE; } } return FALSE; }
/** * * @param type $sContent * @param type $sUrl */ protected function minifyContent($sContent, $sType, $aUrl) { if ($this->params->get($sType . '_minify', 0) && preg_match('#\\s++#', trim($sContent))) { $sUrl = isset($aUrl['url']) ? $aUrl['url'] : ($sType == 'css' ? 'Style' : 'Script') . ' Declaration'; JCH_DEBUG ? JchPlatformProfiler::mark('beforeMinifyContent - "' . $sUrl . '" plgSystem (JCH Optimize)') : null; $sMinifiedContent = trim($sType == 'css' ? CSS_Optimize::process($sContent) : JS_Optimize::minify($sContent)); if (is_null($sMinifiedContent) || $sMinifiedContent == '') { JchOptimizeLogger::log(sprintf(JchPlatformUtility::translate('Error occurred trying to minify: %s'), $aUrl['url']), $this->params); $sMinifiedContent = $sContent; } JCH_DEBUG ? JchPlatformProfiler::mark('afterMinifyContent - "' . $sUrl . '" plgSystem (JCH Optimize)') : null; return $sMinifiedContent; } return $sContent; }
/** * * @param type $sContent * @param type $sUrl */ protected function minifyContent($sContent, $sType, $aUrl) { if ($this->params->get($sType . '_minify', 0) && preg_match('#\\s++#', trim($sContent))) { $sUrl = $this->prepareFileUrl($aUrl, $sType); $sMinifiedContent = trim($sType == 'css' ? CSS_Optimize::optimize($sContent) : JS_Optimize::optimize($sContent)); if (is_null($sMinifiedContent) || $sMinifiedContent == '') { JchOptimizeLogger::log(sprintf(JchPlatformUtility::translate('Error occurred trying to minify: %s'), $aUrl['url']), $this->params); $sMinifiedContent = $sContent; } return $sMinifiedContent; } return $sContent; }
/** * * @param type $sContent * @param type $sUrl */ protected function minifyContent($sContent, $sType, $aUrl) { if ($this->params->get($sType . '_minify', 0)) { $sUrl = $this->prepareFileUrl($aUrl, $sType); $sMinifiedContent = trim($sType == 'css' ? CSS_Optimize::optimize($sContent) : JS_Optimize::optimize($sContent)); if (is_null($sMinifiedContent) || $sMinifiedContent == '') { JchOptimizeLogger::log(sprintf('Error occurred trying to minify: %s', $sUrl), $this->params); $sMinifiedContent = $sContent; } return $sMinifiedContent; } return $sContent; }