xref: /dokuwiki/lib/exe/opensearch.php (revision d4f83172d9533c4d84f450fe22ef630816b21d75)
1da96af35SAndreas Gohr<?php
2*d4f83172SAndreas Gohr
3da96af35SAndreas Gohr/**
4da96af35SAndreas Gohr * DokuWiki OpenSearch creator
5da96af35SAndreas Gohr *
6da96af35SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
7da96af35SAndreas Gohr * @link       http://www.opensearch.org/
8da96af35SAndreas Gohr * @author     Mike Frysinger <vapier@gentoo.org>
9da96af35SAndreas Gohr * @author     Andreas Gohr <andi@splitbrain.org>
10da96af35SAndreas Gohr */
11da96af35SAndreas Gohr
12e3c3abf1SAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../');
13da96af35SAndreas Gohrif (!defined('NOSESSION')) define('NOSESSION', true); // we do not use a session or authentication here (better caching)
14da96af35SAndreas Gohrif (!defined('NL')) define('NL', "\n");
15da96af35SAndreas Gohrrequire_once(DOKU_INC . 'inc/init.php');
16da96af35SAndreas Gohr
17da96af35SAndreas Gohr// try to be clever about the favicon location
18da96af35SAndreas Gohrif (file_exists(DOKU_INC . 'favicon.ico')) {
19da96af35SAndreas Gohr    $ico = DOKU_URL . 'favicon.ico';
2081aca18eSAndreas Gohr} elseif (file_exists(tpl_incdir() . 'images/favicon.ico')) {
21da96af35SAndreas Gohr    $ico = DOKU_URL . 'lib/tpl/' . $conf['template'] . '/images/favicon.ico';
2281aca18eSAndreas Gohr} elseif (file_exists(tpl_incdir() . 'favicon.ico')) {
23da96af35SAndreas Gohr    $ico = DOKU_URL . 'lib/tpl/' . $conf['template'] . '/favicon.ico';
24da96af35SAndreas Gohr} else {
25654436fbSAnika Henke    $ico = DOKU_URL . 'lib/tpl/dokuwiki/images/favicon.ico';
26da96af35SAndreas Gohr}
27da96af35SAndreas Gohr
28da96af35SAndreas Gohr// output
29da96af35SAndreas Gohrheader('Content-Type: application/opensearchdescription+xml; charset=utf-8');
30da96af35SAndreas Gohrecho '<?xml version="1.0"?>' . NL;
31da96af35SAndreas Gohrecho '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">' . NL;
3265cc1598SPhyecho '  <ShortName>' . hsc($conf['title']) . '</ShortName>' . NL;
33b243dd27SMichael Klierecho '  <Image width="16" height="16" type="image/x-icon">' . $ico . '</Image>' . NL;
34da96af35SAndreas Gohrecho '  <Url type="text/html" template="' . DOKU_URL . DOKU_SCRIPT . '?do=search&amp;id={searchTerms}" />' . NL;
35da96af35SAndreas Gohrecho '  <Url type="application/x-suggestions+json" template="' .
36da96af35SAndreas Gohr    DOKU_URL . 'lib/exe/ajax.php?call=suggestions&amp;q={searchTerms}" />' . NL;
37da96af35SAndreas Gohrecho '</OpenSearchDescription>' . NL;
38