find('.row.products-row .products-col');
foreach ($products as $product) {
$item = array();
$titleElement = $product->find('.product-title', 0);
$linkElement = $product->find('.fit-click', 0);
$imageElement = $product->find('.product-img img', 0);
if (!$titleElement || !$linkElement) continue;
$title = trim($titleElement->plaintext);
$link = $linkElement->href;
if (strpos($link, 'http') !== 0) {
$link = 'https://freebies.indiegala.com' . $link;
}
$item['title'] = $title;
$item['uri'] = $link;
$item['uid'] = md5($link);
if ($imageElement) {
$imageSrc = $imageElement->getAttribute('data-img-src');
if ($imageSrc) {
$item['enclosures'] = array($imageSrc);
$item['content'] = '
';
} else {
$item['content'] = '';
}
} else {
$item['content'] = '';
}
$item['content'] .= 'New free PC game available on Indiegala: ' . htmlspecialchars($title) . '';
$this->items[] = $item;
}
}
}