- added some nodes to OpenSearch descriptor
- still no UTF-8 encoding!
- added some type-hints
This commit is contained in:
Roland Häder 2022-06-23 14:50:19 +02:00
parent a49fb9cbf9
commit 5699b03e8d
No known key found for this signature in database
GPG key ID: C82EDE5DDFA0BA77
2 changed files with 15 additions and 13 deletions

View file

@ -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);

View file

@ -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 = '';