<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use DOMDocument;
use DOMElement;
use Friendica\BaseModule;
+use Friendica\Core\System;
use Friendica\DI;
use Friendica\Util\XML;
*/
protected function rawContent(array $request = [])
{
- header('Content-type: application/opensearchdescription+xml');
-
- $hostname = DI::baseUrl()->getHostname();
- $baseUrl = DI::baseUrl()->get();
+ $hostname = DI::baseUrl()->getHost();
+ $baseUrl = (string)DI::baseUrl();
/** @var DOMDocument $xml */
- $xml = null;
-
XML::fromArray([
'OpenSearchDescription' => [
'@attributes' => [
'xmlns' => 'http://a9.com/-/spec/opensearch/1.1',
],
- 'ShortName' => "Friendica $hostname",
- 'Description' => "Search in Friendica $hostname",
- 'Contact' => 'https://github.com/friendica/friendica/issues',
+ 'ShortName' => "Friendica $hostname",
+ 'Description' => "Search in Friendica $hostname",
+ 'Contact' => 'https://github.com/friendica/friendica/issues',
+ 'InputEncoding' => 'UTF-8',
+ 'OutputEncoding' => 'UTF-8',
+ 'Developer' => 'Friendica Developer Team',
],
], $xml);
'template' => "$baseUrl/opensearch",
]);
- echo $xml->saveXML();
-
- exit();
+ System::httpExit($xml->saveXML(), Response::TYPE_XML, 'application/opensearchdescription+xml');
}
}