setTitle('Hackaday IO - ' . $term); $feed->setLink(APPLICATION_URL); $feed->setChannelElement('updated', date(\DATE_ATOM , time())); $feed->setChannelElement('author', ['name' => 'Adafruit Industries Feed Mangler']); $feed->setSelfLink(APPLICATION_URL); foreach ($results as $result) { // print_r($result); $item = $feed->createNewItem(); $item->setAuthor('foo'); if (isset($result['url'])) { $item->setLink($result['url']); } else { // skip because why don't you have a url argh continue; } if (isset($result['updated'])) $item->setDate( date('r', $result['updated']) ); $content_html = ''; if (isset($result['summary'])) $content_html .= '
' . $result['summary'] . '
'; if (isset($result['description'])) $content_html .= '' . nl2br($result['description']) . '
'; if (isset($result['skulls'])) { $s = $result['skulls']; if ($s > 100) $content_html .= "☠ x {$s}
"; elseif ($s > 0) $content_html .= "" . str_repeat('☠', $s); } if (strlen($content_html)) $item->setContent($content_html); if (isset($result['name'])) $item->setTitle($result['name']); $feed->addItem($item); } return $feed->generateFeed(); } }