Skip to content

A free, self-hostable news aggregator…

Fix lazyimg single quotes (#4330)

Alexandre Alapetite0b86e347ef51
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 677e4a413..ad7d9f523 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -458,11 +458,16 @@ function validateEmailAddress($email) {
* Add support of image lazy loading
* Move content from src attribute to data-original
* @param string $content is the text we want to parse
+ * @return string
*/
function lazyimg($content) {
- return preg_replace(
- '/<((?:img|iframe)[^>]+?)src=[\'"]([^"\']+)[\'"]([^>]*)>/i',
- '<$1src="' . Minz_Url::display('/themes/icons/grey.gif') . '" data-original="$2"$3>',
+ return preg_replace([
+ '/<((?:img|iframe)[^>]+?)src="([^"]+)"([^>]*)>/i',
+ "/<((?:img|iframe)[^>]+?)src='([^']+)'([^>]*)>/i",
+ ], [
+ '<$1src="' . Minz_Url::display('/themes/icons/grey.gif') . '" data-original="$2"$3>',
+ "<$1src='" . Minz_Url::display('/themes/icons/grey.gif') . "' data-original='$2'$3>",
+ ],
$content
);
}