Ensure $atomns is always set in Protocol\Feed
- Address https://github.com/friendica/friendica/issues/13025#issuecomment-1537162173
This commit is contained in:
parent
527c17a8a7
commit
32688d34b6
1 changed files with 5 additions and 6 deletions
|
@ -103,7 +103,7 @@ class Feed
|
||||||
$xpath->registerNamespace('poco', ActivityNamespace::POCO);
|
$xpath->registerNamespace('poco', ActivityNamespace::POCO);
|
||||||
|
|
||||||
$author = [];
|
$author = [];
|
||||||
$atomns = '';
|
$atomns = 'atom';
|
||||||
$entries = null;
|
$entries = null;
|
||||||
$protocol = Conversation::PARCEL_UNKNOWN;
|
$protocol = Conversation::PARCEL_UNKNOWN;
|
||||||
|
|
||||||
|
@ -128,13 +128,12 @@ class Feed
|
||||||
// Is it Atom?
|
// Is it Atom?
|
||||||
if ($xpath->query('/atom:feed')->length > 0) {
|
if ($xpath->query('/atom:feed')->length > 0) {
|
||||||
$protocol = Conversation::PARCEL_ATOM;
|
$protocol = Conversation::PARCEL_ATOM;
|
||||||
$atomns = 'atom';
|
|
||||||
} elseif ($xpath->query('/atom03:feed')->length > 0) {
|
} elseif ($xpath->query('/atom03:feed')->length > 0) {
|
||||||
$protocol = Conversation::PARCEL_ATOM03;
|
$protocol = Conversation::PARCEL_ATOM03;
|
||||||
$atomns = 'atom03';
|
$atomns = 'atom03';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($atomns)) {
|
if (in_array($protocol, [Conversation::PARCEL_ATOM, Conversation::PARCEL_ATOM03])) {
|
||||||
$alternate = XML::getFirstAttributes($xpath, $atomns . ":link[@rel='alternate']");
|
$alternate = XML::getFirstAttributes($xpath, $atomns . ":link[@rel='alternate']");
|
||||||
if (is_object($alternate)) {
|
if (is_object($alternate)) {
|
||||||
foreach ($alternate as $attribute) {
|
foreach ($alternate as $attribute) {
|
||||||
|
@ -335,7 +334,7 @@ class Feed
|
||||||
case 'text':
|
case 'text':
|
||||||
$body = $attribute->nodeValue;
|
$body = $attribute->nodeValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'htmlUrl':
|
case 'htmlUrl':
|
||||||
$plink = $attribute->nodeValue;
|
$plink = $attribute->nodeValue;
|
||||||
break;
|
break;
|
||||||
|
@ -343,7 +342,7 @@ class Feed
|
||||||
case 'xmlUrl':
|
case 'xmlUrl':
|
||||||
$uri = $attribute->nodeValue;
|
$uri = $attribute->nodeValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'type':
|
case 'type':
|
||||||
$isrss = $attribute->nodeValue == 'rss';
|
$isrss = $attribute->nodeValue == 'rss';
|
||||||
break;
|
break;
|
||||||
|
@ -506,7 +505,7 @@ class Feed
|
||||||
$attachment['type'] = Post\Media::DOCUMENT;
|
$attachment['type'] = Post\Media::DOCUMENT;
|
||||||
}
|
}
|
||||||
$attachments[] = $attachment;
|
$attachments[] = $attachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue