You are here

function _search_log_preprocess_search_form in Search Log 7

Same name and namespace in other branches
  1. 8 search_log.module \_search_log_preprocess_search_form()

Preprocess search form results before writing to DB.

4 calls to _search_log_preprocess_search_form()
search_log_custom_search_blocks_form_submit in ./search_log.module
Process custom search form to capture keys.
search_log_search_block_form_submit in ./search_log.module
Process block search form to capture keys.
search_log_search_form_submit in ./search_log.module
Process search form to capture keys.
search_log_search_theme_form_submit in ./search_log.module
Process theme search form to capture keys.

File

./search_log.module, line 186
Replaces default report of top search phrases.

Code

function _search_log_preprocess_search_form($submitted, $keys, $module = NULL) {
  global $language;
  if (!$module) {
    $info = search_get_default_module_info();
    $module = $info['module'];
  }
  $modules = variable_get('search_log_modules_enabled', array());
  if (!empty($modules) && !in_array($module, $modules, TRUE)) {
    return;
  }

  // Custom Search content filter integration.
  if (module_exists('custom_search')) {
    $types = isset($submitted['custom_search_types']) ? $submitted['custom_search_types'] : array();
    if (!is_array($types)) {
      $types = array(
        $types,
      );
    }
    $types = array_map('_custom_search_filter_keys', array_filter($types));
    if (in_array('all', $types)) {

      // do nothing to keys or module.
    }
    elseif (in_array('user', $types)) {
      $module = 'user';
    }
    else {
      $keys .= ' type:' . implode(',', $types);
    }
  }
  search_log($keys, $module, $language->language);
}