New file |
0,0 → 1,39 |
<?php |
/** |
* @author Raphaël Droz <raphael@tela-botania.org> |
* @copyright 2013 Tela-Botanica |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
* |
* Intégration du moteur de recherche Google |
* Exemple de templates relatifs pour lesquels envisager un remplacement de PAPYRUS_MOTEUR_RECHERCHE: |
* - sites/botanique/fr/squelettes/botanique.html: PAPYRUS_GOOGLE (en-tête) |
* - sites/botanique/fr/squelettes/botanique.html: PAPYRUS_GOOGLE:results (corps de page) |
* |
**/ |
|
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherMoteurRechercheGoogle'; |
$GLOBALS['_GEN_commun']['info_applette_balise'] = '(?:<!-- '.$GLOBALS['_GEN_commun']['balise_prefixe'].'GOOGLE(?::(\w+))? -->|\{\{GoogleInput(?::(\w+))?\}\})'; |
|
function afficherMoteurRechercheGoogle($tab_applette_arguments, $_GEN_commun) { |
// boite de résultats |
// TODO: comment stopper le chargement de #zone_contenu_corps//PAPYRUS_CONTENU_CORPS ? |
// réponse: cf: papyrus/applications/afficheur/afficheur.php :: afficherContenuCorps() |
// TODO: link href dans <body> est non-standard |
if($tab_applette_arguments[1] == 'results') { |
return <<<EOF |
<link href="/papyrus/applettes/google/google.css" rel="stylesheet" type="text/css" /> |
<gcse:searchresults-only queryParameterName="r"></gcse:searchresults-only> |
EOF; |
} |
$url = $_SERVER['REDIRECT_URL']; |
/*$d = array(); |
parse_str($_SERVER['QUERY_STRING'], $d); |
var_dump(urldecode(http_build_query($d)));die;*/ |
$script = file_get_contents(dirname(__FILE__) . '/google.html'); |
return <<<EOF |
$script |
<!-- <gcse:search></gcse:search> --> |
<gcse:searchbox-only resultsUrl="http://papy$url" queryParameterName="r"></gcse:searchbox-only> |
EOF; |
} |