function google_cse_sitesearch_options in Google Custom Search Engine 7.2
Same name and namespace in other branches
- 7 google_cse.module \google_cse_sitesearch_options()
Returns SiteSearch options.
3 calls to google_cse_sitesearch_options()
- google_cse_sitesearch_default in ./
google_cse.module - Returns SiteSearch default value.
- google_cse_sitesearch_form in ./
google_cse.module - Returns SiteSearch options form item.
- google_cse_validate_request in ./
google_cse.theme.inc - Validate GET parameters to avoid displaying inappropriate search results.
File
- ./
google_cse.module, line 281 - Display a Google Custom Search Engine (CSE) on your site.
Code
function google_cse_sitesearch_options() {
static $options;
if (!isset($options)) {
$options = array();
if ($sites = preg_split('/[\\n\\r]+/', variable_get('google_cse_sitesearch', ''), -1, PREG_SPLIT_NO_EMPTY)) {
$options[''] = ($var = variable_get('google_cse_sitesearch_option', '')) ? $var : t('Search the web');
foreach ($sites as $site) {
$site = preg_split('/[\\s]+/', trim($site), 2, PREG_SPLIT_NO_EMPTY);
// Select options will be HTML-escaped.
// Radio options will be XSS-filtered.
$options[$site[0]] = isset($site[1]) ? $site[1] : t('Search "@sitesearch"', array(
'@sitesearch' => $site[0],
));
}
}
}
return $options;
}