Ejemplo n.º 1
0
 /**
  * 
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * 
  * @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;
 }
Ejemplo n.º 3
0
        /**
         * 
         * @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;
        }