You are here

function _popup_tag_attributes in Popup 6.x

Same name and namespace in other branches
  1. 8 modules/popup_filter/includes/popup_filter.processing.inc \_popup_tag_attributes()
  2. 7 modules/popup_filter/includes/popup_filter.processing.inc \_popup_tag_attributes()
  3. 7.x modules/popup_filter/includes/popup_filter.processing.inc \_popup_tag_attributes()
1 call to _popup_tag_attributes()
popup_filter_process_tag in modules/popup_filter/includes/popup_filter.processing.inc
Processes a popup tag

File

modules/popup_filter/includes/popup_filter.processing.inc, line 38

Code

function _popup_tag_attributes($tag) {
  $attributes = array();
  $inner = ereg_replace('\\ ?\\=\\ ?', '=', trim(substr($tag, 6, strlen($tag) - 7))) . ' ';
  $attribPattern = '/' . '(?:\\s?[^\\s=]+\\s)|' . '(?:[^\\s]*="[^"]+")|' . '(?:[^\\s]*=[\'][^\']+[\'])|' . '(?:[^\\s]*=[^\\s]*)' . '/';
  $found = array();
  preg_match_all($attribPattern, $inner, $found);
  foreach ($found[0] as $attribute) {
    $parts = split('=', $attribute);
    $value = preg_replace('/(^[\'\\"]{1})|([\'\\"]{1}$)/', '', trim($parts[1]));
    $attributes[trim($parts[0])] = strlen($value) ? $value : TRUE;
  }
  return $attributes;
}