public function format() { $this->sentHeaders(); $this->removeConditionals('link'); $this->removeConditionals('style'); $this->removeConditionals('script'); LazyLoad::imgLazyLoad($this->config); $this->organizeHeaderOrder(); $this->cssIntegrate(); $this->javascriptIntegrate(); $this->returnConditionals('link'); $this->returnConditionals('style'); $this->returnConditionals('script'); $this->removeHttpProtocol(); }
public static function imgLazyLoad($config) { self::init($config); $htmlContent = self::$DOMHtml->getContent(); if (self::$config['LazyLoadImages'] && !self::ignoreLazyLoad($htmlContent)) { self::removeImagesFromScripts(); $regex = '/<img((?:.)*?)>/smix'; $content = preg_replace_callback($regex, function ($script) { return LazyLoad::prepareImg($script); }, $htmlContent); self::$DOMHtml->setContent($content ?: $htmlContent); self::returnImagesFromScripts(); self::lazyLoadHead(); } }