You are here

function google_cse_sitesearch_default in Google Custom Search Engine 7

Same name and namespace in other branches
  1. 6 google_cse.module \google_cse_sitesearch_default()
  2. 7.2 google_cse.module \google_cse_sitesearch_default()

Returns SiteSearch default value.

2 calls to google_cse_sitesearch_default()
google_cse_build_query in ./google_cse.module
Builds a query array based on Google CSE settings.
google_cse_sitesearch_form in ./google_cse.module
Returns SiteSearch options form item.
2 string references to 'google_cse_sitesearch_default'
google_cse_admin_settings in ./google_cse.admin.inc
Admin settings page for the CSE.
google_cse_uninstall in ./google_cse.install
Implements hook_uninstall().

File

./google_cse.module, line 205
Display a Google Custom Search Engine (CSE) on your site.

Code

function google_cse_sitesearch_default() {
  $options = google_cse_sitesearch_options();
  if (isset($_GET['sitesearch']) && isset($options[$_GET['sitesearch']])) {
    return $_GET['sitesearch'];
  }
  elseif (variable_get('google_cse_sitesearch_default', 0)) {

    // Return the key of the second element in the array.
    return key(array_slice($options, 1, 1));
  }
  return '';
}