1 | <?php
|
---|
2 | /**
|
---|
3 | * DokuWiki OpenSearch creator
|
---|
4 | *
|
---|
5 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
---|
6 | * @link http://www.opensearch.org/
|
---|
7 | * @author Mike Frysinger <[email protected]>
|
---|
8 | * @author Andreas Gohr <[email protected]>
|
---|
9 | */
|
---|
10 |
|
---|
11 | if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
|
---|
12 | if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching)
|
---|
13 | if(!defined('NL')) define('NL',"\n");
|
---|
14 | require_once(DOKU_INC.'inc/init.php');
|
---|
15 |
|
---|
16 | // try to be clever about the favicon location
|
---|
17 | if(file_exists(DOKU_INC.'favicon.ico')){
|
---|
18 | $ico = DOKU_URL.'favicon.ico';
|
---|
19 | }elseif(file_exists(DOKU_TPLINC.'images/favicon.ico')){
|
---|
20 | $ico = DOKU_URL.'lib/tpl/'.$conf['template'].'/images/favicon.ico';
|
---|
21 | }elseif(file_exists(DOKU_TPLINC.'favicon.ico')){
|
---|
22 | $ico = DOKU_URL.'lib/tpl/'.$conf['template'].'/favicon.ico';
|
---|
23 | }else{
|
---|
24 | $ico = DOKU_URL.'lib/tpl/default/images/favicon.ico';
|
---|
25 | }
|
---|
26 |
|
---|
27 | // output
|
---|
28 | header('Content-Type: application/opensearchdescription+xml; charset=utf-8');
|
---|
29 | echo '<?xml version="1.0"?>'.NL;
|
---|
30 | echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">'.NL;
|
---|
31 | echo ' <ShortName>'.htmlspecialchars($conf['title']).'</ShortName>'.NL;
|
---|
32 | echo ' <Image width="16" height="16" type="image/x-icon">'.$ico.'</Image>'.NL;
|
---|
33 | echo ' <Url type="text/html" template="'.DOKU_URL.DOKU_SCRIPT.'?do=search&id={searchTerms}" />'.NL;
|
---|
34 | echo ' <Url type="application/x-suggestions+json" template="'.
|
---|
35 | DOKU_URL.'lib/exe/ajax.php?call=suggestions&q={searchTerms}" />'.NL;
|
---|
36 | echo '</OpenSearchDescription>'.NL;
|
---|
37 |
|
---|
38 | //Setup VIM: ex: et ts=4 :
|
---|