X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FOpenSearch.php;h=f01baafada20beae1a87d42b8ea25e9de0c01efb;hb=41030f596bc9aa0859dbdf07bc65f8695eb4a249;hp=89cf53055d1d2f6b90efb99ec22d88950e2c48b5;hpb=abe6724629b851c6cce965a0aa03658b9dae8c62;p=friendica.git diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index 89cf53055d..f01baafada 100644 --- a/src/Module/OpenSearch.php +++ b/src/Module/OpenSearch.php @@ -1,10 +1,31 @@ . + * + */ namespace Friendica\Module; use DOMDocument; use DOMElement; use Friendica\BaseModule; +use Friendica\Core\System; +use Friendica\DI; use Friendica\Util\XML; /** @@ -16,24 +37,23 @@ class OpenSearch extends BaseModule /** * @throws \Exception */ - public static function rawContent($parameters) + protected function rawContent(array $request = []) { - header('Content-type: application/opensearchdescription+xml'); - - $hostname = self::getApp()->getHostName(); - $baseUrl = self::getApp()->getBaseURL(); + $hostname = DI::baseUrl()->getHost(); + $baseUrl = 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); @@ -65,8 +85,6 @@ class OpenSearch extends BaseModule 'template' => "$baseUrl/opensearch", ]); - echo $xml->saveXML(); - - exit(); + System::httpExit($xml->saveXML(), Response::TYPE_XML, 'application/opensearchdescription+xml'); } }