| Versions | |
|---|---|
| 7 | aggregator_aggregator_parse($feed) |
Implements hook_aggregator_parse().
drupal/
<?php
function aggregator_aggregator_parse($feed) {
global $channel, $image;
// Filter the input data.
if (aggregator_parse_feed($feed->source_string, $feed)) {
$modified = empty($feed->http_headers['last-modified']) ? 0 : strtotime($feed->http_headers['last-modified']);
// Prepare the channel data.
foreach ($channel as $key => $value) {
$channel[$key] = trim($value);
}
// Prepare the image data (if any).
foreach ($image as $key => $value) {
$image[$key] = trim($value);
}
if (!empty($image['link']) && !empty($image['url']) && !empty($image['title'])) {
$image = l(theme('image', array('path' => $image['url'], 'alt' => $image['title'])), $image['link'], array('html' => TRUE));
}
else {
$image = '';
}
$etag = empty($feed->http_headers['etag']) ? '' : $feed->http_headers['etag'];
// Add parsed data to the feed object.
$feed->link = !empty($channel['LINK']) ? $channel['LINK'] : '';
$feed->description = !empty($channel['DESCRIPTION']) ? $channel['DESCRIPTION'] : '';
$feed->image = $image;
$feed->etag = $etag;
$feed->modified = $modified;
// Clear the cache.
cache_clear_all();
return TRUE;
}
return FALSE;
}
?>