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