Made the regexp for image alt extraction more generic
This commit is contained in:
parent
924faff128
commit
a944c076d7
1 changed files with 1 additions and 1 deletions
2
gancioff
2
gancioff
|
@ -358,7 +358,7 @@ foreach ($feed->channel->item as $item) {
|
|||
$hash=$item->title.$item->pubDate;
|
||||
if (isset($item->enclosure[0]['url']) && isset($item->enclosure[0]['type']) && isset($item->enclosure[0]['length'])) {
|
||||
$file=['url'=>$item->enclosure[0]['url']->__toString(), 'type'=>$item->enclosure[0]['type']->__toString(), 'length'=>$item->enclosure[0]['length']->__toString()];
|
||||
if (preg_match('#<img alt="([^"]+)"#',$item->description->__toString(),$matches)===1) $imgalt=trim($matches[1]);
|
||||
if (preg_match('#<img [^>]*alt="([^"]+)"#',$item->description->__toString(),$matches)===1) $imgalt=trim($matches[1]);
|
||||
$hash.=$item->enclosure[0]['url'].$item->enclosure[0]['type'].$item->enclosure[0]['length'].$imgalt;
|
||||
}
|
||||
if ($imgalt=='') $imgalt='Flyer dell’evento';
|
||||
|
|
Loading…
Reference in a new issue