function top_searches_process_keys in Top Searches 7        
                          
                  
                        Same name and namespace in other branches
- 6 top_searches.module \top_searches_process_keys()
 
 
1 call to top_searches_process_keys()
  - top_searches_top_searches in ./top_searches.module
 
  - Hook top_searches.
Modules may use this hook to add their search queries. 
They can later theme the results, to alter the url of the search phrases, to point elsewhere than "search/node/*"
 
 
File
 
   - ./top_searches.module, line 138
 
  
Code
function top_searches_process_keys($keys) {
  
  $keys = preg_replace("/[' ']{2,}/", ' ', ucwords(strtolower(trim($keys))));
  
  $results_qid = db_query("SELECT qid FROM {top_searches} WHERE q = :phrase", array(
    ':phrase' => $keys,
  ))
    ->fetchField();
  if ($results_qid) {
    db_query("UPDATE {top_searches} SET counter = (counter + 1) WHERE qid = {$results_qid}");
    
  }
  else {
    db_insert('top_searches')
      ->fields(array(
      'q' => $keys,
      'counter' => 1,
    ))
      ->execute();
  }
}