Changes:
- added some nodes to OpenSearch descriptor - still no UTF-8 encoding! - added some type-hints
This commit is contained in:
parent
a49fb9cbf9
commit
5699b03e8d
|
@ -50,9 +50,12 @@ class OpenSearch extends BaseModule
|
||||||
'@attributes' => [
|
'@attributes' => [
|
||||||
'xmlns' => 'http://a9.com/-/spec/opensearch/1.1',
|
'xmlns' => 'http://a9.com/-/spec/opensearch/1.1',
|
||||||
],
|
],
|
||||||
'ShortName' => "Friendica $hostname",
|
'ShortName' => "Friendica $hostname",
|
||||||
'Description' => "Search in Friendica $hostname",
|
'Description' => "Search in Friendica $hostname",
|
||||||
'Contact' => 'https://github.com/friendica/friendica/issues',
|
'Contact' => 'https://github.com/friendica/friendica/issues',
|
||||||
|
'InputEncoding' => 'UTF-8',
|
||||||
|
'OutputEncoding' => 'UTF-8',
|
||||||
|
'Developer' => 'Friendica Developer Team',
|
||||||
],
|
],
|
||||||
], $xml);
|
], $xml);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class XML
|
||||||
* Creates an XML structure out of a given array
|
* Creates an XML structure out of a given array
|
||||||
*
|
*
|
||||||
* @param array $array The array of the XML structure that will be generated
|
* @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 bool $remove_header Should the XML header be removed or not?
|
||||||
* @param array $namespaces List of namespaces
|
* @param array $namespaces List of namespaces
|
||||||
* @param bool $root interally used parameter. Mustn't be used from outside.
|
* @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
|
* Create an XML and append it to the parent object
|
||||||
*
|
*
|
||||||
* @param DOMDocument $doc XML root
|
* @param DOMDocument $doc XML root
|
||||||
* @param object $parent parent object
|
* @param DOMElement $parent parent object
|
||||||
* @param string $element XML element name
|
* @param string $element XML element name
|
||||||
* @param string $value XML value
|
* @param string $value XML value
|
||||||
* @param array $attributes array containing the attributes
|
* @param array $attributes Array containing the attributes
|
||||||
* @return void
|
* @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);
|
$element = self::createElement($doc, $element, $value, $attributes);
|
||||||
$parent->appendChild($element);
|
$parent->appendChild($element);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an XML document to a normalised, case-corrected array
|
* Convert an XML document to a normalised, case-corrected array used by webfinger
|
||||||
* used by webfinger
|
|
||||||
*
|
*
|
||||||
* @param object $xml_element The XML document
|
* @param object $xml_element The XML document
|
||||||
* @param integer $recursion_depth recursion counter for internal use - default 0
|
* @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 we're getting too deep, bail out
|
||||||
if ($recursion_depth > 512) {
|
if ($recursion_depth > 512) {
|
||||||
return(null);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml_element_copy = '';
|
$xml_element_copy = '';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user