mirror of https://github.com/joomla/joomla-cms.git
[4.4] Feed: Fixing link selection of AtomParser (#42706)
* Feed: Fixing link selection of AtomParser * Update libraries/src/Feed/Parser/AtomParser.php Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com> ---------
This commit is contained in:
parent
5d0163235d
commit
0a912a8d4f
|
@ -223,7 +223,7 @@ class AtomParser extends FeedParser
|
|||
if (filter_var($entry->uri, FILTER_VALIDATE_URL) === false && !\is_null($el->link) && $el->link) {
|
||||
$link = $el->link;
|
||||
|
||||
if (\is_array($link)) {
|
||||
if ($link->count()) {
|
||||
$link = $this->bestLinkForUri($link);
|
||||
}
|
||||
|
||||
|
@ -238,13 +238,13 @@ class AtomParser extends FeedParser
|
|||
/**
|
||||
* If there is more than one <link> in the feed entry, find the most appropriate one and return it.
|
||||
*
|
||||
* @param array $links Array of <link> elements from the feed entry.
|
||||
* @param \SimpleXMLElement $links XML node with links from the feed entry.
|
||||
*
|
||||
* @return \SimpleXMLElement
|
||||
*/
|
||||
private function bestLinkForUri(array $links)
|
||||
private function bestLinkForUri(\SimpleXMLElement $links)
|
||||
{
|
||||
$linkPrefs = ['', 'self', 'alternate'];
|
||||
$linkPrefs = ['alternate', 'self', ''];
|
||||
|
||||
foreach ($linkPrefs as $pref) {
|
||||
foreach ($links as $link) {
|
||||
|
|
Loading…
Reference in New Issue