Pelzini

This is the code documentation for the Pelzini project

source of /viewer/controllers/opensearch.php

Output OpenSearch XML
  1. <?php
  2. /*
  3. Copyright 2015 Josh Heidenreich
  4.  
  5. This file is part of Pelzini.
  6.  
  7. Pelzini is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. Pelzini is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Pelzini. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21. /**
  22.  * Output OpenSearch XML
  23.  *
  24.  * @package Viewer
  25.  * @author Josh Heidenreich
  26.  * @since 0.9
  27.  **/
  28.  
  29. $base = 'http://' . $_SERVER['HTTP_HOST'] . $base_path;
  30. $search = 'search?advanced=1&q={searchTerms}&classes=y&functions=y&constants=y&source=y&path=';
  31.  
  32. header('Content-type: text/xml; charset="UTF-8"');
  33. echo '<?xml version="1.0"?>';
  34. echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">';
  35. echo '<ShortName>', htmlspecialchars($project['name']), '</ShortName>';
  36. echo '<Description>Documentation for ', htmlspecialchars($project['name']), ' in Pelzini</Description>';
  37. echo '<Image height="32" width="32" type="image/x-icon">', htmlspecialchars($base . '../assets/favicon.ico'), '</Image>';
  38. echo '<Url type="text/html" method="get" template="', htmlspecialchars($base . $search) . '"/>';
  39. echo '<moz:SearchForm>', htmlspecialchars($base), '</moz:SearchForm>';
  40. echo '</OpenSearchDescription>';
  41.