public static function imgLazyLoad($htmlContent, $config) { self::setContent($htmlContent); self::$config = $config; 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::setContent($content ?: $htmlContent); self::returnImagesFromScripts(); } return self::getContent(); }