1: <?php
2: 3: 4:
5: class Horde_Block_Google extends Horde_Core_Block
6: {
7: 8:
9: public function __construct($app, $params = array())
10: {
11: parent::__construct($app, $params);
12:
13: $this->enabled = isset($GLOBALS['conf']['api']['googlesearch']);
14: $this->_name = _("Google Search");
15: }
16:
17: 18:
19: protected function _content()
20: {
21: Horde::startBuffer();
22: ?>
23: <link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
24: <div id="googlesearch">...</div>
25: <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>
26: <script type="text/javascript">
27:
28: function GoogleSearchSetup()
29: {
30:
31: var searchControl = new GSearchControl();
32:
33:
34: searchControl.addSearcher(new GwebSearch());
35: searchControl.addSearcher(new GvideoSearch());
36: searchControl.addSearcher(new GblogSearch());
37: searchControl.addSearcher(new GnewsSearch());
38: searchControl.addSearcher(new GbookSearch());
39:
40:
41: var drawOptions = new GdrawOptions();
42:
43:
44: drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
45: searchControl.draw(document.getElementById('googlesearch'), drawOptions);
46: }
47: GSearch.setOnLoadCallback(GoogleSearchSetup);
48:
49: </script>
50: <?php
51: return Horde::endBuffer();
52: }
53:
54: }
55: