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
|
<?php
/**
* @package Horde
*/
class Horde_Block_Google extends Horde_Core_Block
{
/**
*/
public function __construct($app, $params = array())
{
parent::__construct($app, $params);
$this->enabled = isset($GLOBALS['conf']['api']['googlesearch']);
$this->_name = _("Google Search");
}
/**
*/
protected function _content()
{
Horde::startBuffer();
?>
<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 Horde::endBuffer();
}
}
|