Skip to content

Commit

Permalink
Media Class - Fix warning (#790)
Browse files Browse the repository at this point in the history
* Media Class - Fix warning

Fix PHP 8.1, 8.2  warnings. Ticket #878893

* Fix coding
  • Loading branch information
timotei-litespeed authored Jan 14, 2025
1 parent 741a661 commit b9ce534
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/media.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,15 @@ private function _parse_img_for_preload()
if (!$vpi_files) {
return;
}
if(!$this->content) {
return;
}

$content = preg_replace(array('#<!--.*-->#sU', '#<noscript([^>]*)>.*</noscript>#isU'), '', $this->content);
if(!$content) {
return;
}

preg_match_all('#<img\s+([^>]+)/?>#isU', $content, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$attrs = Utility::parse_attr($match[1]);
Expand Down

0 comments on commit b9ce534

Please sign in to comment.