]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/OpenSearch.php
Merge pull request #13599 from Raroun/Fix_for_Pull_Request_#13596_missing_a_hidden...
[friendica.git] / src / Module / OpenSearch.php
index 94215aaa7ae77d9a22da4bf5b78488fbf72da220..1a4303a683c694cb39931657446f038066d5a059 100644 (file)
@@ -1,6 +1,6 @@
 <?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
  *
@@ -24,6 +24,7 @@ namespace Friendica\Module;
 use DOMDocument;
 use DOMElement;
 use Friendica\BaseModule;
+use Friendica\Core\System;
 use Friendica\DI;
 use Friendica\Util\XML;
 
@@ -38,22 +39,21 @@ class OpenSearch extends BaseModule
         */
        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);
 
@@ -85,8 +85,6 @@ class OpenSearch extends BaseModule
                        'template' => "$baseUrl/opensearch",
                ]);
 
-               echo $xml->saveXML();
-
-               exit();
+               $this->httpExit($xml->saveXML(), Response::TYPE_XML, 'application/opensearchdescription+xml');
        }
 }