- addHubLink()'s 2nd parameter is DOMElement
- added more type-hints
- converted double-quotes to single
This commit is contained in:
Roland Häder 2022-06-22 11:35:15 +02:00
parent 12add2fb64
commit 74ab7648c6
No known key found for this signature in database
GPG Key ID: C82EDE5DDFA0BA77
3 changed files with 500 additions and 480 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@
namespace Friendica\Protocol; namespace Friendica\Protocol;
use DOMAttr;
use DOMDocument; use DOMDocument;
use DOMElement; use DOMElement;
use DOMXPath; use DOMXPath;
@ -1253,10 +1252,10 @@ class OStatus
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param string $filter The related feed filter (activity, posts or comments) * @param string $filter The related feed filter (activity, posts or comments)
* *
* @return DOMAttr Header root element * @return DOMElement Header root element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function addHeader(DOMDocument $doc, array $owner, string $filter): DOMAttr private static function addHeader(DOMDocument $doc, array $owner, string $filter): DOMElement
{ {
$root = $doc->createElementNS(ActivityNamespace::ATOM1, 'feed'); $root = $doc->createElementNS(ActivityNamespace::ATOM1, 'feed');
$doc->appendChild($root); $doc->appendChild($root);
@ -1350,12 +1349,12 @@ class OStatus
* Add the link to the push hubs to the XML document * Add the link to the push hubs to the XML document
* *
* @param DOMDocument $doc XML document * @param DOMDocument $doc XML document
* @param addHubLink $root XML root element where the hub links are added * @param DOMElement $root XML root element where the hub links are added
* @param string $nick Nickname * @param string $nick Nickname
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function addHubLink(DOMDocument $doc, DOMAttr $root, string $nick) public static function addHubLink(DOMDocument $doc, DOMElement $root, string $nick)
{ {
$h = DI::baseUrl() . '/pubsubhubbub/' . $nick; $h = DI::baseUrl() . '/pubsubhubbub/' . $nick;
XML::addElement($doc, $root, 'link', '', ['href' => $h, 'rel' => 'hub']); XML::addElement($doc, $root, 'link', '', ['href' => $h, 'rel' => 'hub']);
@ -1365,12 +1364,12 @@ class OStatus
* Adds attachment data to the XML document * Adds attachment data to the XML document
* *
* @param DOMDocument $doc XML document * @param DOMDocument $doc XML document
* @param DOMAttr $root XML root element where the hub links are added * @param DOMElement $root XML root element where the hub links are added
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getAttachment(DOMDocument $doc, DOMAttr $root, array $item) public static function getAttachment(DOMDocument $doc, DOMElement $root, array $item)
{ {
$siteinfo = BBCode::getAttachedData($item['body']); $siteinfo = BBCode::getAttachedData($item['body']);

View File

@ -177,7 +177,7 @@ 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 object $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