You are here

function google_init in Google Custom Search Engine 6

Implementation of hook_init().

File

./google.module, line 33
Integrates Google Custom Search Engine with the Drupal core search API.

Code

function google_init() {
  if (arg(0) == 'search' && arg(1) == 'google' && (is_null(arg(2)) || !isset($_GET['query']))) {
    if ($_SERVER['REQUEST_METHOD'] != 'POST' && ($keys = isset($_GET['query']) ? $_GET['query'] : arg(2))) {
      drupal_goto('search/google/' . $keys, google_build_query($keys));
    }
  }
}