diff options
Diffstat (limited to 'lib/exe/opensearch.php')
-rw-r--r-- | lib/exe/opensearch.php | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/lib/exe/opensearch.php b/lib/exe/opensearch.php index b00b2b771..766bdb2e6 100644 --- a/lib/exe/opensearch.php +++ b/lib/exe/opensearch.php @@ -1,4 +1,5 @@ <?php + /** * DokuWiki OpenSearch creator * @@ -8,31 +9,29 @@ * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); -if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) -if(!defined('NL')) define('NL',"\n"); -require_once(DOKU_INC.'inc/init.php'); +if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../'); +if (!defined('NOSESSION')) define('NOSESSION', true); // we do not use a session or authentication here (better caching) +if (!defined('NL')) define('NL', "\n"); +require_once(DOKU_INC . 'inc/init.php'); // try to be clever about the favicon location -if(file_exists(DOKU_INC.'favicon.ico')){ - $ico = DOKU_URL.'favicon.ico'; -}elseif(file_exists(tpl_incdir().'images/favicon.ico')){ - $ico = DOKU_URL.'lib/tpl/'.$conf['template'].'/images/favicon.ico'; -}elseif(file_exists(tpl_incdir().'favicon.ico')){ - $ico = DOKU_URL.'lib/tpl/'.$conf['template'].'/favicon.ico'; -}else{ - $ico = DOKU_URL.'lib/tpl/dokuwiki/images/favicon.ico'; +if (file_exists(DOKU_INC . 'favicon.ico')) { + $ico = DOKU_URL . 'favicon.ico'; +} elseif (file_exists(tpl_incdir() . 'images/favicon.ico')) { + $ico = DOKU_URL . 'lib/tpl/' . $conf['template'] . '/images/favicon.ico'; +} elseif (file_exists(tpl_incdir() . 'favicon.ico')) { + $ico = DOKU_URL . 'lib/tpl/' . $conf['template'] . '/favicon.ico'; +} else { + $ico = DOKU_URL . 'lib/tpl/dokuwiki/images/favicon.ico'; } // output header('Content-Type: application/opensearchdescription+xml; charset=utf-8'); -echo '<?xml version="1.0"?>'.NL; -echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">'.NL; -echo ' <ShortName>'.hsc($conf['title']).'</ShortName>'.NL; -echo ' <Image width="16" height="16" type="image/x-icon">'.$ico.'</Image>'.NL; -echo ' <Url type="text/html" template="'.DOKU_URL.DOKU_SCRIPT.'?do=search&id={searchTerms}" />'.NL; -echo ' <Url type="application/x-suggestions+json" template="'. - DOKU_URL.'lib/exe/ajax.php?call=suggestions&q={searchTerms}" />'.NL; -echo '</OpenSearchDescription>'.NL; - -//Setup VIM: ex: et ts=4 : +echo '<?xml version="1.0"?>' . NL; +echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">' . NL; +echo ' <ShortName>' . hsc($conf['title']) . '</ShortName>' . NL; +echo ' <Image width="16" height="16" type="image/x-icon">' . $ico . '</Image>' . NL; +echo ' <Url type="text/html" template="' . DOKU_URL . DOKU_SCRIPT . '?do=search&id={searchTerms}" />' . NL; +echo ' <Url type="application/x-suggestions+json" template="' . + DOKU_URL . 'lib/exe/ajax.php?call=suggestions&q={searchTerms}" />' . NL; +echo '</OpenSearchDescription>' . NL; |