On this page
function aggregator_element_start
aggregator_element_start($parser, $name, $attributes)
Performs an action when an opening tag is encountered.
Callback function used by xml_parse() within aggregator_parse_feed().
File
- modules/aggregator/aggregator.parser.inc, line 172
- Parser functions for the aggregator module.
Code
function aggregator_element_start($parser, $name, $attributes) {
global $item, $element, $tag, $items, $channel;
$name = strtolower($name);
switch ($name) {
case 'image':
case 'textinput':
case 'summary':
case 'tagline':
case 'subtitle':
case 'logo':
case 'info':
$element = $name;
break;
case 'id':
case 'content':
if ($element != 'item') {
$element = $name;
}
case 'link':
// According to RFC 4287, link elements in Atom feeds without a 'rel'
// attribute should be interpreted as though the relation type is
// "alternate".
if (!empty($attributes['HREF']) && (empty($attributes['REL']) || $attributes['REL'] == 'alternate')) {
if ($element == 'item') {
$items[$item]['link'] = $attributes['HREF'];
}
else {
$channel['link'] = $attributes['HREF'];
}
}
break;
case 'item':
$element = $name;
$item += 1;
break;
case 'entry':
$element = 'item';
$item += 1;
break;
}
$tag = $name;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!aggregator!aggregator.parser.inc/function/aggregator_element_start/7.x