X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FModule%2FOpenSearch.php;h=7c44bc510e48e8b7570b6ea4984b105944c8d66d;hb=706444bdb22b57f18c284044bdbdaeb7610990fe;hp=acab0f5ed4dedb5b7d45a3f5b503a813012daf3b;hpb=1de3f186d79f3703850524c1d58c237be3eb25f3;p=friendica.git diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index acab0f5ed4..7c44bc510e 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(); + System::httpExit($xml->saveXML(), Response::TYPE_XML, 'application/opensearchdescription+xml'); } }