Example #1
0
 /**
  * 
  * @return type
  */
 public function lazyLoadImages()
 {
     if ($this->params->get('pro_lazyload', '0')) {
         JCH_DEBUG ? JchPlatformProfiler::start('LazyLoadImages') : null;
         $sLazyLoadBodyHtml = preg_replace($this->getLazyLoadRegex(), 'data-src="$1" src="' . JchOptimizeHelper::cookieLessDomain($this->params) . JchPlatformPaths::imageFolder() . 'placeholder.gif" data-jchll="true"', $this->getBodyHtml());
         if (is_null($sLazyLoadBodyHtml)) {
             JchOptimizeLogger::log(JchPlatformUtility::translate('Lazy load images function failed'), $this->params);
             return;
         }
         if (preg_match($this->getBodyRegex(), $sLazyLoadBodyHtml, $aBodyMatches) === FALSE || empty($aBodyMatches)) {
             JchOptimizeLogger::log(JchPlatformUtility::translate('Failed retrieving body in lazy load images function'), $this->params);
             return;
         }
         $this->sBodyHtml = $aBodyMatches[0];
         JCH_DEBUG ? JchPlatformProfiler::stop('LazyLoadImages', TRUE) : null;
     }
 }