You are here

function toc_filter_parse_tag_attributes in TOC filter 7

Same name and namespace in other branches
  1. 6 toc_filter.module \toc_filter_parse_tag_attributes()

Parses an xhtml tag's attributes into an associated array.

1 call to toc_filter_parse_tag_attributes()
_toc_filter_process_callback in ./toc_filter.module
TOC filter processor callback: Convert's <h2> to a linked table of contents.

File

./toc_filter.module, line 217
Converts header tags into a linked table of contents.

Code

function toc_filter_parse_tag_attributes($tag) {
  preg_match_all('/(\\w+)\\s*=\\s*"([^"]+)"/', $tag, $matches);
  $attributes = array();
  for ($i = 0, $len = count($matches[1]); $i < $len; $i++) {
    $attributes[$matches[1][$i]] = htmlspecialchars_decode($matches[2][$i], ENT_QUOTES);
  }
  return $attributes;
}