source: spip-zone/_plugins_/google_ajax_search/googleajaxsearch_pipeline.php @ 59799

Last change on this file since 59799 was 33444, checked in by real3t@…, 11 years ago

8 résultats par page (et non pas 4)

File size: 1.4 KB
Line 
1<?php
2// --------------------------------
3// partie publique
4// --------------------------------
5function googleajaxsearch_insert_head($flux){
6
7    $langue_site = $GLOBALS['meta']['langue_site'];
8    $nom_site = $GLOBALS['meta']['nom_site'];
9    $adresse_site = $GLOBALS['meta']['adresse_site'];
10       
11               
12                $flux.='
13    <!-- google ajax api search -->
14    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
15    <script type="text/javascript">
16    google.load("search", "1", {"language" : "'.$langue_site.'"});
17    function OnLoadGoogle() {
18      var recherche = $(\'#searchcontrol span\').text();
19      var searchControl = new google.search.SearchControl();     
20      var siteSearch = new google.search.WebSearch();
21      siteSearch.setUserDefinedLabel("'.supprimer_tags($nom_site).'");
22      siteSearch.setUserDefinedClassSuffix("siteSearch");
23      siteSearch.setSiteRestriction("'.$adresse_site.'");
24          searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET)
25      options = new google.search.SearcherOptions();
26      options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
27      searchControl.addSearcher(siteSearch,options);
28      searchControl.draw(document.getElementById("searchcontrol"));
29      searchControl.execute(recherche);
30    }     
31    google.setOnLoadCallback(OnLoadGoogle);
32    </script>';
33       
34        return $flux;
35}
36       
37?>
Note: See TracBrowser for help on using the repository browser.