Esempio n. 1
0
 /**
  * 
  * @param type $oObj
  * @param type $sCss
  * @return type
  */
 public function generateAdminLinks($oObj, $sCss)
 {
     JCH_DEBUG ? JchPlatformProfiler::start('GenerateAdminLinks') : null;
     $params = clone $this->params;
     $params->set('javascript', '1');
     $params->set('css', '1');
     $params->set('excludeAllExtensions', '0');
     $params->set('css_minify', '0');
     $params->set('debug', '0');
     $params->set('bottom_js', '2');
     ##<procode>##
     $params->set('pro_phpAndExternal', '1');
     $params->set('pro_inlineScripts', '1');
     $params->set('pro_lazyload', '0');
     ##</procode>##
     $sHtml = $oObj->getOriginalHtml();
     $oParser = new JchOptimizeParser($params, $sHtml, JchOptimizeFileRetriever::getInstance());
     $aLinks = $oParser->getReplacedFiles();
     if ($sCss == '' && !empty($aLinks['css'][0])) {
         $oCombiner = new JchOptimizeCombiner($params, $this->bBackend);
         $oCssParser = new JchOptimizeCssParser($params, $this->bBackend);
         $oCombiner->combineFiles($aLinks['css'][0], 'css', $oCssParser);
         $sCss = $oCombiner->css;
     }
     $oSpriteGenerator = new JchOptimizeSpriteGenerator($params);
     $aLinks['images'] = $oSpriteGenerator->processCssUrls($sCss, TRUE);
     ##<procode>##
     $sRegex = $oParser->getLazyLoadRegex();
     preg_match_all($sRegex, $oParser->getBodyHtml(), $aMatches);
     $aLinks['lazyload'] = $aMatches[1];
     ##</procode>##
     JCH_DEBUG ? JchPlatformProfiler::stop('GenerateAdminLinks', TRUE) : null;
     return $aLinks;
 }
Esempio n. 2
0
 /**
  * 
  * @return type
  */
 public function getLogParam()
 {
     if (self::$bLogErrors == '') {
         self::$bLogErrors = $this->params->get('log', 0);
     }
     return self::$bLogErrors;
 }
Esempio n. 3
0
 /**
  * 
  * @param type $oObj
  * @param type $sCss
  * @return type
  */
 public function generateAdminLinks($oObj, $sCss)
 {
     JCH_DEBUG ? JchPlatformProfiler::start('GenerateAdminLinks') : null;
     $params = clone $this->params;
     $params->set('javascript', '1');
     $params->set('css', '1');
     $params->set('excludeAllExtensions', '0');
     $params->set('css_minify', '0');
     $params->set('debug', '0');
     $params->set('bottom_js', '2');
     $sHtml = $oObj->getOriginalHtml();
     $oParser = new JchOptimizeParser($params, $sHtml, JchOptimizeFileRetriever::getInstance());
     $aLinks = $oParser->getReplacedFiles();
     if ($sCss == '' && !empty($aLinks['css'][0])) {
         $oCombiner = new JchOptimizeCombiner($params, $this->bBackend);
         $oCssParser = new JchOptimizeCssParser($params, $this->bBackend);
         $oCombiner->combineFiles($aLinks['css'][0], 'css', $oCssParser);
         $sCss = $oCombiner->css;
     }
     $oSpriteGenerator = new JchOptimizeSpriteGenerator($params);
     $aLinks['images'] = $oSpriteGenerator->processCssUrls($sCss, TRUE);
     JCH_DEBUG ? JchPlatformProfiler::stop('GenerateAdminLinks', TRUE) : null;
     return $aLinks;
 }
Esempio n. 4
0
 /**
  * 
  * @param type $aUrlArray
  * @param type $params
  * @return type
  */
 public static function getImages($aUrlArray, $params)
 {
     $oCombiner = new JchOptimizeCombiner($params, TRUE);
     $oCssParser = new JchOptimizeCssParser($oCombiner->sLnEnd, $oCombiner->bBackend);
     try {
         $sCss = $oCombiner->combineFiles($aUrlArray, 'css', $oCssParser);
         $oSpriteGenerator = new JchOptimizeSpriteGenerator($params);
         $aMatches = $oSpriteGenerator->processCssUrls($sCss, TRUE);
     } catch (Exception $Ex) {
         $GLOBALS['bTextArea'] = TRUE;
         if ($oCombiner->params->get('log', '0')) {
             JchOptimizeLogger::log($Ex->getMessage());
         }
         throw new Exception(JText::_('Failed fetching images for the multiselect exclude options in sprite generator. ' . 'Will render textareas instead.'));
     }
     return $aMatches;
 }