You are here

function _qtip_filter in qTip (Stylish jQuery Tooltips) 7

Callback function for qtip_filter_info().

1 string reference to '_qtip_filter'
qtip_filter_info in ./qtip.module
Implements hook_filter_info().

File

./qtip.module, line 195

Code

function _qtip_filter($text, $format) {
  if (preg_match_all("/\\[qtip:([^\\|\\]]+)\\|?([^\\]]*)?\\]/i", $text, $match)) {

    // Set the default delta value to be used in the foreach statement below for <span> ids
    $delta = 0;
    foreach ($match[2] as $key => $value) {
      $link = $match[1][$key];
      $tip = $match[2][$key];
      $search[] = $match[0][$key];
      $replace[] = '<span id="qtip-link-' . $delta . '" class="qtip-link ' . ($delta % 2 ? 'qtip-link-even' : 'qtip-link-odd') . '" title="' . $tip . '">' . $link . '</span>';
      $delta++;
    }
    return str_replace($search, $replace, $text);
  }
  return $text;
}