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