You are here

function _qtip_filter_process in qTip (Stylish jQuery Tooltips) 7.2

Private callback function for qtip_filter_filter_info().

1 string reference to '_qtip_filter_process'
qtip_filter_filter_info in modules/qtip_filter/qtip_filter.module
Implements hook_filter_info().

File

modules/qtip_filter/qtip_filter.module, line 20

Code

function _qtip_filter_process($text, $filter) {
  if (preg_match_all("/\\[qtip\\-?([a-z0-9_]*)?:([^\\|\\]]+)\\|([^\\]]*)?\\]/i", $text, $match)) {
    foreach ($match[0] as $key => $value) {
      $search[] = $match[0][$key];
      $instance = $match[1][$key];
      if (empty($instance) || !qtip_load($instance)) {

        // Load the default instance
        $instance = $filter->settings['instance'];
      }
      $title = '';
      $tooltip = $match[3][$key];
      if (strpos($tooltip, '|') !== FALSE) {
        list($title, $tooltip) = explode('|', $match[3][$key]);
      }
      $theme_variables = array(
        'instance' => $instance,
        'content' => $match[2][$key],
        'title' => $title,
        'tooltip' => $tooltip,
      );
      $replace[] = theme('qtip', $theme_variables);
    }
    return str_replace($search, $replace, $text);
  }
  return $text;
}