diff options
| author | 2022-09-05 09:15:20 +0200 | |
|---|---|---|
| committer | 2022-09-05 09:15:20 +0200 | |
| commit | 442019a0548d3f1d888419930d38f1986e5cd773 (patch) | |
| tree | a6b7966119a65533b08dc22a69579baadb9e5dad | |
| parent | e2867cfe1453f06d6bfab769552d39ba8b30df24 (diff) | |
SimplePie fix base (#4565)
* SimplePie fix base
#fix https://github.com/FreshRSS/FreshRSS/issues/4562
See `<xml:base>` example in https://datatracker.ietf.org/doc/html/rfc4287#section-1.1
First uses item `<xml:base>` if it exists, or the item own link, or the feed's base URL rules (feed URL, or Web site URL)
* Minor formatting
| -rw-r--r-- | lib/SimplePie/SimplePie/Item.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/SimplePie/SimplePie/Item.php b/lib/SimplePie/SimplePie/Item.php index 3ac4fa882..2fb1d3284 100644 --- a/lib/SimplePie/SimplePie/Item.php +++ b/lib/SimplePie/SimplePie/Item.php @@ -152,15 +152,21 @@ class SimplePie_Item } /** - * Get the base URL value from the parent feed - * - * Uses `<xml:base>` + * Get the base URL value. + * Uses `<xml:base>`, or item link, or feed base URL. * * @param array $element * @return string */ public function get_base($element = array()) { + if (!empty($element['xml_base_explicit']) && isset($element['xml_base'])) { + return $element['xml_base']; + } + $link = $this->get_permalink(); + if ($link != null) { + return $link; + } return $this->feed->get_base($element); } |
