[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/exe/ -> opensearch.php (source)

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