3 namespace Friendica\Module;
7 use Friendica\BaseModule;
9 use Friendica\Util\XML;
12 * Prints the opensearch description document
13 * @see https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#opensearch-description-document
15 class OpenSearch extends BaseModule
20 public static function rawContent(array $parameters = [])
22 header('Content-type: application/opensearchdescription+xml');
24 $hostname = DI::baseUrl()->getHostname();
25 $baseUrl = DI::baseUrl()->get();
27 /** @var DOMDocument $xml */
31 'OpenSearchDescription' => [
33 'xmlns' => 'http://a9.com/-/spec/opensearch/1.1',
35 'ShortName' => "Friendica $hostname",
36 'Description' => "Search in Friendica $hostname",
37 'Contact' => 'https://github.com/friendica/friendica/issues',
41 /** @var DOMElement $parent */
42 $parent = $xml->getElementsByTagName('OpenSearchDescription')[0];
44 XML::addElement($xml, $parent, 'Image',
45 "$baseUrl/images/friendica-16.png", [
48 'type' => 'image/png',
51 XML::addElement($xml, $parent, 'Image',
52 "$baseUrl/images/friendica-64.png", [
55 'type' => 'image/png',
58 XML::addElement($xml, $parent, 'Url', '', [
59 'type' => 'text/html',
60 'template' => "$baseUrl/search?search={searchTerms}",
63 XML::addElement($xml, $parent, 'Url', '', [
64 'type' => 'application/opensearchdescription+xml',
66 'template' => "$baseUrl/opensearch",