You are here

function asset_search_element_start in Asset 6

Same name and namespace in other branches
  1. 5.2 contrib/asset_search/asset_search.parser.inc \asset_search_element_start()

Call-back function used by the XML parser.

1 string reference to 'asset_search_element_start'
asset_search_parse_feed in contrib/asset_search/asset_search.parser.inc
Parse an rss feed and return an array of items Taken from aggregator_parse_feed

File

contrib/asset_search/asset_search.parser.inc, line 168
Include file to parse RSS feeds into an array of items that will then be used as pseudo-assets.

Code

function asset_search_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 ($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;
}