aggregator_aggregator_parse
- Versions
- 7
aggregator_aggregator_parse($feed)
Implement hook_aggregator_parse().
Code
modules/aggregator/aggregator.parser.inc, line 21
<?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;
}
?>Login or register to post comments 