Same name and namespace in other branches
  1. 4.6.x modules/aggregator.module \aggregator_element_start()
  2. 4.7.x modules/aggregator.module \aggregator_element_start()
  3. 5.x modules/aggregator/aggregator.module \aggregator_element_start()
  4. 7.x modules/aggregator/aggregator.parser.inc \aggregator_element_start()

Call-back function used by the XML parser.

1 string reference to 'aggregator_element_start'
aggregator_parse_feed in modules/aggregator/aggregator.module
Parse a feed and store its items.

File

modules/aggregator/aggregator.module, line 467
Used to aggregate syndicated content (RSS, RDF, and Atom).

Code

function aggregator_element_start($parser, $name, $attributes) {
  global $item, $element, $tag, $items, $channel;
  switch ($name) {
    case 'IMAGE':
    case 'TEXTINPUT':
    case 'CONTENT':
    case 'SUMMARY':
    case 'TAGLINE':
    case 'SUBTITLE':
    case 'LOGO':
    case 'INFO':
      $element = $name;
      break;
    case 'ID':
      if ($element != 'ITEM') {
        $element = $name;
      }
    case 'LINK':
      if (!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;
}