3 namespace Friendica\Module;
7 use Friendica\BaseModule;
8 use Friendica\Util\XML;
11 * Prints the opensearch description document
12 * @see https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#opensearch-description-document
14 class OpenSearch extends BaseModule
19 public static function rawContent(array $parameters = [])
21 header('Content-type: application/opensearchdescription+xml');
23 $hostname = self::getApp()->getHostName();
24 $baseUrl = self::getApp()->getBaseURL();
26 /** @var DOMDocument $xml */
30 'OpenSearchDescription' => [
32 'xmlns' => 'http://a9.com/-/spec/opensearch/1.1',
34 'ShortName' => "Friendica $hostname",
35 'Description' => "Search in Friendica $hostname",
36 'Contact' => 'https://github.com/friendica/friendica/issues',
40 /** @var DOMElement $parent */
41 $parent = $xml->getElementsByTagName('OpenSearchDescription')[0];
43 XML::addElement($xml, $parent, 'Image',
44 "$baseUrl/images/friendica-16.png", [
47 'type' => 'image/png',
50 XML::addElement($xml, $parent, 'Image',
51 "$baseUrl/images/friendica-64.png", [
54 'type' => 'image/png',
57 XML::addElement($xml, $parent, 'Url', '', [
58 'type' => 'text/html',
59 'template' => "$baseUrl/search?search={searchTerms}",
62 XML::addElement($xml, $parent, 'Url', '', [
63 'type' => 'application/opensearchdescription+xml',
65 'template' => "$baseUrl/opensearch",