function _adsense_cse_results in Google AdSense integration 5.3
Same name and namespace in other branches
- 6 cse/adsense_cse.results.inc \_adsense_cse_results()
- 7 cse/adsense_cse.results.inc \_adsense_cse_results()
Creates the CSE search results page for site-embedded search results
Return value
JavaScript that embeds the Google results
1 string reference to '_adsense_cse_results'
- adsense_cse_menu in cse/
adsense_cse.module - Implementation of hook_menu().
File
- cse/
adsense_cse.results.inc, line 14 - Displays the page containing the results of the Adsense for Search box
Code
function _adsense_cse_results() {
// Log the search keys:
watchdog('AdSense search', 'Search keywords: ' . urldecode(check_plain($_GET['as_q'])));
// Output search results
$width = variable_get('adsense_cse_frame_width', ADSENSE_CSE_FRAME_WIDTH_DEFAULT);
$country = variable_get('adsense_cse_country', ADSENSE_CSE_COUNTRY_DEFAULT);
if (variable_get('adsense_test_mode', ADSENSE_TEST_MODE_DEFAULT)) {
$output = _adsense_format_box("Results<br />width = {$width}<br />country = {$country}", $width, 100);
}
else {
if (variable_get('adsense_secret_adtest', ADSENSE_SECRET_ADTEST_DEFAULT)) {
$secret = ' var googleAdtest = "on";';
}
$output = <<<CSE_RESULTS_TXT
<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = {<span class="php-variable">$width</span>};
var googleSearchDomain = "{<span class="php-variable">$country</span>}";
var googleSearchPath = "/cse";
var googleSearchQueryString = "as_q";
{<span class="php-variable">$secret</span>}
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
CSE_RESULTS_TXT;
// Remove empty lines
$output = str_replace("\n\n", "\n", $output);
}
return $output;
}