Source of file RemoveImageSourceAttribute.php
Size: 0,726 Bytes - Last Modified: 2021-12-23T10:59:03+00:00
/var/www/docs.ssmods.com/process/src/code/RemoveImageSourceAttribute.php
12345678910111213141516171819202122232425 | <?php class RemoveImageSourceAttribute extends Extension { /** * Remove src attributes from images, instead use foundations responsive image loader. * * @param string $html HTML content of the page */ public function ResponsiveTinyMCEImages($html) { $dom = Injector::inst()->create('HTMLValue', $html); if ($images = $dom->getElementsByTagName('img')) { foreach ($images as $img) { $cssclass = $img->getAttribute('class'); $pos = strpos($cssclass, 'tinymce'); if ($pos !== false) { $img->removeAttribute('src'); } } } return $dom->getContent(); } } |