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