function _adsense_get_searchbox in Google AdSense integration 5
Same name and namespace in other branches
- 5.2 adsense.module \_adsense_get_searchbox()
1 call to _adsense_get_searchbox()
File
- ./
adsense.module, line 1747
Code
function _adsense_get_searchbox($group = 1, $channel = 1) {
$group = _adsense_validate_group($group);
$client = adsense_get_client_id();
$border = variable_get(ADSENSE_SEARCH_COLOR_BORDER, '336699');
$title = variable_get(ADSENSE_SEARCH_COLOR_TITLE, '0000FF');
$bg = variable_get(ADSENSE_SEARCH_COLOR_BG, 'FFFFFF');
$text = variable_get(ADSENSE_SEARCH_COLOR_TEXT, '000000');
$url = variable_get(ADSENSE_SEARCH_COLOR_URL, '008000');
$visited = variable_get(ADSENSE_SEARCH_COLOR_VISITED_URL, '663399');
$light = variable_get(ADSENSE_SEARCH_COLOR_LIGHT_URL, '0000FF');
$logo = variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE);
$search_button = variable_get(ADSENSE_SEARCH_BUTTON, 0);
$box_text_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT, ADSENSE_SEARCH_COLOR_BLACK);
$box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
$encoding = variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8');
$channel = variable_get(ADSENSE_AD_CHANNEL . _adsense_validate_channel($channel), '');
global $base_url;
$domain_0 = variable_get(ADSENSE_SEARCH_DOMAIN . '_0', $base_url);
$domain_1 = variable_get(ADSENSE_SEARCH_DOMAIN . '_1', '');
$domain_2 = variable_get(ADSENSE_SEARCH_DOMAIN . '_2', '');
$domain = $domain_1 ? "{$domain_0};{$domain_1}" : $domain_0;
$domain = $domain_2 ? "{$domain_0};{$domain_2}" : $domain_0;
$language = variable_get(ADSENSE_SEARCH_LANGUAGE, 'en');
$textbox_length = variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
$output .= _adsense_add_nl('<div class="adsense adsense_search">');
$output .= _adsense_add_nl(ADSENSE_SITE_SEARCH);
$output .= _adsense_add_nl('<form method="get" action="http://' . $domain . '/' . ADSENSE_SEARCH_PATH . '" target="_top">');
$output .= _adsense_add_nl('<table border="0" bgcolor="' . $box_background_color . '">');
$output .= _adsense_add_nl('<tr><td nowrap="nowrap" valign="top" align="left" height="32">');
if ($logo != ADSENSE_SEARCH_LOGO_ON_BUTTON) {
$output .= _adsense_add_nl('<a href="http://www.google.com/">');
if ($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
$logo_color = 'wht';
}
elseif ($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
$logo_color = 'blk';
}
elseif ($box_background_color == ADSENSE_SEARCH_COLOR_GRAY) {
$logo_color = 'gry';
}
$output .= _adsense_add_nl('<img src="http://www.google.com/logos/Logo_25' . $logo_color . '.gif" border="0" alt="Google" align="middle" /></a>');
}
if ($logo == ADSENSE_SEARCH_LOGO_GOOGLE) {
$output .= _adsense_add_nl('</td>');
$output .= _adsense_add_nl('<td nowrap="nowrap">');
}
elseif ($logo == ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX) {
$output .= _adsense_add_nl('<br/>');
}
$output .= _adsense_add_nl('<input type="hidden" name="domains" value="' . $domain . '" />');
$output .= _adsense_add_nl('<label for="sbi" style="display: none">' . t('Enter your search terms') . '</label>');
$output .= _adsense_add_nl('<input type="text" name="as_q" size="' . $textbox_length . '" maxlength="255" value="" id="sbi"></input>');
if (!$search_button) {
$output .= _adsense_add_nl('<label for="sbb" style="display: none">' . t('Submit search form') . '</label>');
if ($logo != ADSENSE_SEARCH_LOGO_ON_BUTTON) {
$output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Search') . '" id="sbb"></input>');
}
else {
$output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Google Search') . '" id="sbb"></input>');
}
}
$output .= _adsense_add_nl('</td></tr>');
$output .= _adsense_add_nl('<tr>');
if ($logo == ADSENSE_SEARCH_LOGO_GOOGLE) {
$output .= _adsense_add_nl('<td> </td>');
}
$output .= _adsense_add_nl('<td nowrap="nowrap">');
$output .= _adsense_add_nl('<table>');
$output .= _adsense_add_nl('<tr>');
$output .= _adsense_add_nl('<td>');
$output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="" id="ss0"></input>');
$output .= _adsense_add_nl('<label for="ss0" title="' . t('Search the Web') . '"><font size="-1" color="' . $box_text_color . '">Web</font></label></td>');
$output .= _adsense_add_nl('<td>');
$output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="' . $domain_0 . '" checked id="ss1"></input>');
$output .= _adsense_add_nl('<label for="ss1" title="' . t('Search') . ' ' . $domain_0 . '"><font size="-1" color="' . $box_text_color . '">' . $domain_0 . '</font></label></td>');
$output .= _adsense_add_nl('</tr>');
if ($domain_1) {
$output .= _adsense_add_nl('<tr>');
$output .= _adsense_add_nl('<td>');
$output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="' . $domain_1 . '" id="ss2"></input>');
$output .= _adsense_add_nl('<label for="ss2" title="Search ' . $domain_1 . '"><font size="-1" color="' . $box_text_color . '">' . $domain_1 . '</font></label></td>');
if ($domain_2) {
$output .= _adsense_add_nl('<td>');
$output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="' . $domain_2 . '" id="ss3"></input>');
$output .= _adsense_add_nl('<label for="ss3" title="Search ' . $domain_2 . '"><font size="-1" color="' . $box_text_color . '">' . $domain_2 . '</font></label></td>');
}
else {
$output .= _adsense_add_nl('<td></td>');
}
$output .= _adsense_add_nl('</tr>');
}
$output .= _adsense_add_nl('</table>');
if ($search_button) {
$output .= _adsense_add_nl('<label for="sbb" style="display: none">' . t('Submit search form') . '</label>');
if ($logo != ADSENSE_SEARCH_LOGO_ON_BUTTON) {
$output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Search') . '" id="sbb"></input>');
}
else {
$output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Google Search') . '" id="sbb"></input>');
}
}
$output .= _adsense_add_nl('<input type="hidden" name="client" value="' . $client . '"></input>');
$output .= _adsense_add_nl('<input type="hidden" name="forid" value="1"></input>');
$output .= _adsense_add_nl('<input type="hidden" name="channel" value="' . $channel . '"></input>');
$output .= _adsense_add_nl('<input type="hidden" name="ie" value="' . $encoding . '"></input>');
$output .= _adsense_add_nl('<input type="hidden" name="oe" value="' . $encoding . '"></input>');
$output .= _adsense_add_nl('<input type="hidden" name="cof" value="GALT:#' . $url . ';GL:1;DIV:#' . $border . ';VLC:#' . $visited . ';AH:center;BGC:#' . $bg . ';LBGC:#' . $bg . ';ALC:#' . $title . ';LC:#' . $title . ';T:#' . $text . ';GFNT:#' . $light . ';GIMP:#' . $light . ';FORID:11"></input>');
$output .= _adsense_add_nl('<input type="hidden" name="hl" value="' . $language . '"></input>');
$output .= _adsense_add_nl('</td></tr></table>');
$output .= _adsense_add_nl('</form>');
$output .= _adsense_add_nl(ADSENSE_SITE_SEARCH);
$output .= _adsense_add_nl('</div>');
return $output;
}