You are here

function template_preprocess_google_appliance_result in Google Search Appliance 7

Preprocess a single search result.

File

theme/google_appliance.theme.inc, line 341
theme registry and preprocess functions for the default templates

Code

function template_preprocess_google_appliance_result(&$vars) {

  // Sanatize urls.
  $vars['short_url'] = check_url($vars['short_url']);
  $vars['enc_url'] = check_url($vars['enc_url']);
  $vars['abs_url'] = check_url($vars['abs_url']);

  // if the result has a mime type value, generate file icon image
  // that themes can optionally display
  if ($vars['mime']['type'] != '') {
    $file = new stdClass();
    $file->filemime = $vars['mime']['type'];
    $vars['mime']['icon'] = theme('file_icon', array(
      'file' => $file,
      'icon_directory' => variable_get('file_icon_directory', drupal_get_path('module', 'file') . '/icons'),
      'alt' => $vars['mime']['type'],
    ));
  }

  // Sanatize snippet and title ...
  // Allow boldface through for keywork highlighting.
  $vars['snippet'] = filter_xss($vars['snippet'], array(
    'b',
    'strong',
  ));
  $vars['title'] = filter_xss($vars['title'], array(
    'b',
    'strong',
  ));

  // Sanitize crawl date.
  $vars['crawl_date'] = check_plain($vars['crawl_date']);

  // Add a google-appliance-levelx class if we're sub-levels
  if ((int) $vars['level'] > 1) {
    $vars['classes_array'][] = 'google-appliance-level' . $vars['level'];
  }

  // render template
}