mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-20 10:14:33 -04:00
Fix lazyimg single quotes (#4330)
Little bug for cases with single quote in URL such as ```html <img src="123?format='jpg'" /> ``` Could probably be replaced by `loading="lazy"` in the future, and with a better DOM-aware method, for instance during SimplePie `add_attributes()`
This commit is contained in:
1 parent
046598e743
commit
0b86e347ef
1 file changed
+8
-3
+8
-3
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user