Subversion Repositories Applications.papyrus

Rev

Rev 2091 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2085 drzraf 1
<?php
2
/**
3
 * @author    Raphaël Droz <raphael@tela-botania.org>
4
 * @copyright 2013 Tela-Botanica
5
 * @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
6
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
7
 *
8
 * Intégration du moteur de recherche Google
9
 * Exemple de templates relatifs pour lesquels envisager un remplacement de PAPYRUS_MOTEUR_RECHERCHE:
10
 * - sites/botanique/fr/squelettes/botanique.html: PAPYRUS_GOOGLE (en-tête)
11
 * - sites/botanique/fr/squelettes/botanique.html: PAPYRUS_GOOGLE:results (corps de page)
12
 *
13
 **/
14
 
15
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherMoteurRechercheGoogle';
16
$GLOBALS['_GEN_commun']['info_applette_balise'] = 	'(?:<!-- '.$GLOBALS['_GEN_commun']['balise_prefixe'].'GOOGLE(?::(\w+))? -->|\{\{GoogleInput(?::(\w+))?\}\})';
17
 
18
function afficherMoteurRechercheGoogle($tab_applette_arguments, $_GEN_commun) {
19
	// boite de résultats
20
	// TODO: comment stopper le chargement de #zone_contenu_corps//PAPYRUS_CONTENU_CORPS ?
21
	// réponse: cf: papyrus/applications/afficheur/afficheur.php :: afficherContenuCorps()
22
	// TODO: link href dans <body> est non-standard
23
	if($tab_applette_arguments[1] == 'results') {
24
		return <<<EOF
25
<gcse:searchresults-only queryParameterName="r"></gcse:searchresults-only>
26
EOF;
27
	}
2102 drzraf 28
	$host = 'http://www.tela-botanica.org';
2085 drzraf 29
	$url = $_SERVER['REDIRECT_URL'];
30
	/*$d = array();
31
	parse_str($_SERVER['QUERY_STRING'], $d);
32
	var_dump(urldecode(http_build_query($d)));die;*/
33
	$script = file_get_contents(dirname(__FILE__) . '/google.html');
34
	return <<<EOF
2091 drzraf 35
<link href="/papyrus/applettes/google/google.css" rel="stylesheet" type="text/css" />
2085 drzraf 36
$script
37
<!-- <gcse:search></gcse:search> -->
2102 drzraf 38
<gcse:searchbox-only resultsUrl="$host$url" queryParameterName="r"></gcse:searchbox-only>
2085 drzraf 39
EOF;
40
}