You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 lines
1.6 KiB

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