From 5699b03e8dfc36936c539f32f8e68610ec6bc200 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 23 Jun 2022 14:50:19 +0200 Subject: [PATCH] Changes: - added some nodes to OpenSearch descriptor - still no UTF-8 encoding! - added some type-hints --- src/Module/OpenSearch.php | 9 ++++++--- src/Util/XML.php | 19 +++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index 35d6890ec6..9f89660eed 100644 --- a/src/Module/OpenSearch.php +++ b/src/Module/OpenSearch.php @@ -50,9 +50,12 @@ class OpenSearch extends BaseModule '@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); diff --git a/src/Util/XML.php b/src/Util/XML.php index 7d18277633..0424400a82 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -38,7 +38,7 @@ class XML * Creates an XML structure out of a given array * * @param array $array The array of the XML structure that will be generated - * @param object $xml The createdXML will be returned by reference + * @param object $xml The created XML will be returned by reference * @param bool $remove_header Should the XML header be removed or not? * @param array $namespaces List of namespaces * @param bool $root interally used parameter. Mustn't be used from outside. @@ -177,22 +177,21 @@ class XML /** * Create an XML and append it to the parent object * - * @param DOMDocument $doc XML root - * @param object $parent parent object - * @param string $element XML element name - * @param string $value XML value - * @param array $attributes array containing the attributes + * @param DOMDocument $doc XML root + * @param DOMElement $parent parent object + * @param string $element XML element name + * @param string $value XML value + * @param array $attributes Array containing the attributes * @return void */ - public static function addElement(DOMDocument $doc, $parent, string $element, string $value = '', array $attributes = []) + public static function addElement(DOMDocument $doc, DOMElement &$parent, string $element, string $value = '', array $attributes = []) { $element = self::createElement($doc, $element, $value, $attributes); $parent->appendChild($element); } /** - * Convert an XML document to a normalised, case-corrected array - * used by webfinger + * Convert an XML document to a normalised, case-corrected array used by webfinger * * @param object $xml_element The XML document * @param integer $recursion_depth recursion counter for internal use - default 0 @@ -204,7 +203,7 @@ class XML { // If we're getting too deep, bail out if ($recursion_depth > 512) { - return(null); + return null; } $xml_element_copy = ''; -- 2.39.5