source: documentation/trunk/packages/dokuwiki-2011-05-25a/lib/exe/opensearch.php@ 30098

Last change on this file since 30098 was 25027, checked in by jmt12, 12 years ago

Adding the packages directory, and within it a configured version of dokuwiki all ready to run

File size: 1.6 KB
Line 
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
11if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
12if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching)
13if(!defined('NL')) define('NL',"\n");
14require_once(DOKU_INC.'inc/init.php');
15
16// try to be clever about the favicon location
17if(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
28header('Content-Type: application/opensearchdescription+xml; charset=utf-8');
29echo '<?xml version="1.0"?>'.NL;
30echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">'.NL;
31echo ' <ShortName>'.htmlspecialchars($conf['title']).'</ShortName>'.NL;
32echo ' <Image width="16" height="16" type="image/x-icon">'.$ico.'</Image>'.NL;
33echo ' <Url type="text/html" template="'.DOKU_URL.DOKU_SCRIPT.'?do=search&amp;id={searchTerms}" />'.NL;
34echo ' <Url type="application/x-suggestions+json" template="'.
35 DOKU_URL.'lib/exe/ajax.php?call=suggestions&amp;q={searchTerms}" />'.NL;
36echo '</OpenSearchDescription>'.NL;
37
38//Setup VIM: ex: et ts=4 :
Note: See TracBrowser for help on using the repository browser.