1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
<?php
$block_name = _("Google Search");
/**
* $Horde: horde/lib/Block/google.php,v 1.10.10.2 2007/12/20 15:01:35 jan Exp $
*
* @package Horde_Block
*/
class Horde_Block_Horde_google extends Horde_Block {
var $_app = 'horde';
/**
* The title to go in this block.
*
* @return string The title text.
*/
function _title()
{
return _("Google Search");
}
/**
* The content to go in this block.
*
* @return string The content
*/
function _content()
{
if (empty($GLOBALS['conf']['api']['googlesearch'])) {
return '<p><em>' . _("Google search is not enabled.") . '</em></p>';
}
ob_start();
?>
<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
<div id="googlesearch">...</div>
<script type="text/javascript" src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=<?php echo htmlspecialchars($GLOBALS['conf']['api']['googlesearch']) ?>"></script>
<script type="text/javascript">
//<![CDATA[
function GoogleSearchSetup()
{
// Create a search control
var searchControl = new GSearchControl();
// Add in a full set of searchers
searchControl.addSearcher(new GwebSearch());
searchControl.addSearcher(new GvideoSearch());
searchControl.addSearcher(new GblogSearch());
searchControl.addSearcher(new GnewsSearch());
searchControl.addSearcher(new GbookSearch());
// create a drawOptions object
var drawOptions = new GdrawOptions();
// tell the searcher to draw itself in tabbed mode
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
searchControl.draw(document.getElementById('googlesearch'), drawOptions);
}
GSearch.setOnLoadCallback(GoogleSearchSetup);
//]]>
</script>
<?php
return ob_get_clean();
}
}
|