function google_cse_validate_request in Google Custom Search Engine 8.2
Same name and namespace in other branches
- 8.3 google_cse.theme.inc \google_cse_validate_request()
- 7.3 google_cse.theme.inc \google_cse_validate_request()
- 7 google_cse.theme.inc \google_cse_validate_request()
- 7.2 google_cse.theme.inc \google_cse_validate_request()
Validate GET parameters to avoid displaying inappropriate search results.
1 call to google_cse_validate_request()
- template_preprocess_google_cse_results in ./
google_cse.theme.inc - The search results page can be themed/customized.
File
- ./
google_cse.theme.inc, line 72 - Themeable functions for Google Custom Search Engine.
Code
function google_cse_validate_request() {
$request = \Drupal::request();
$config = \Drupal::config('search.page.google_cse_search');
return (empty($request->query
->get('cx')) || $request->query
->get('cx') == $config
->get('configuration')['cx']) && (empty($request->query
->get('safe')) || $request->query
->get('safe') == $config
->get('configuration')['safe']) && (empty($request->query
->get('sitesearch')) || ($options = \Drupal::service('google_cse.services')
->sitesearchOptions()) && isset($options[$request->query
->get('sitesearch')]));
}