You are here

function _search_log_normalize_keys in Search Log 7

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

Internal function to normalize keys.

2 calls to _search_log_normalize_keys()
search_log in ./search_log.module
Store search keys, module, language and day.
search_log_preprocess_search_results in ./search_log.module
Process search results.

File

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

Code

function _search_log_normalize_keys($keys) {
  $keys = preg_replace('/\\s+/', ' ', trim($keys));
  switch (variable_get('search_log_terms', SEARCH_LOG_TERMS_LOWERCASE)) {
    case SEARCH_LOG_TERMS_LOWERCASE:
      $keys = str_replace(' or ', ' OR ', drupal_strtolower($keys));
      break;
    case SEARCH_LOG_TERMS_UPPERCASE_FIRST:
      $keys = str_replace(' or ', ' OR ', drupal_ucfirst($keys));
      break;
    case SEARCH_LOG_TERMS_UPPERCASE_WORDS:
      $keys = str_replace(' Or ', ' OR ', ucwords(drupal_strtolower($keys)));
      break;
  }
  return $keys;
}