diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-10-19 11:05:20 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-11-05 14:30:13 +0100 |
commit | fa020db2972e54dc7ce22521c197c536cec68841 (patch) | |
tree | d9722314ea9bd238bf9e76aeae98d2e6e2122fa0 | |
parent | 0d051da4a14b6325b4ab7d93ebcd63d4a8dc141c (diff) | |
download | Shaarli-fa020db2972e54dc7ce22521c197c536cec68841.tar.gz Shaarli-fa020db2972e54dc7ce22521c197c536cec68841.tar.zst Shaarli-fa020db2972e54dc7ce22521c197c536cec68841.zip |
Fix hashtags links in Feeds
Make the hashtag link absolute in feeds to work properly in RSS syndication tools.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | application/FeedBuilder.php | 3 | ||||
-rw-r--r-- | tests/FeedBuilderTest.php | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e32ef459..d42d6a75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
26 | - Plugins: | 26 | - Plugins: |
27 | - Tools: only display parameter description when it exists | 27 | - Tools: only display parameter description when it exists |
28 | - archive.org: do not propose archival of private notes | 28 | - archive.org: do not propose archival of private notes |
29 | - Use absolute URL for hashtags in RSS and ATOM feeds | ||
29 | 30 | ||
30 | ### Security | 31 | ### Security |
31 | - Allow whitelisting trusted IPs, else continue banning clients upon login failure | 32 | - Allow whitelisting trusted IPs, else continue banning clients upon login failure |
diff --git a/application/FeedBuilder.php b/application/FeedBuilder.php index c6657fbb..4036a7cc 100644 --- a/application/FeedBuilder.php +++ b/application/FeedBuilder.php | |||
@@ -153,7 +153,8 @@ class FeedBuilder | |||
153 | } else { | 153 | } else { |
154 | $permalink = '<a href="'. $link['guid'] .'" title="Permalink">Permalink</a>'; | 154 | $permalink = '<a href="'. $link['guid'] .'" title="Permalink">Permalink</a>'; |
155 | } | 155 | } |
156 | $link['description'] = format_description($link['description']) . PHP_EOL .'<br>— '. $permalink; | 156 | $link['description'] = format_description($link['description'], '', $pageaddr); |
157 | $link['description'] .= PHP_EOL .'<br>— '. $permalink; | ||
157 | 158 | ||
158 | $pubDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); | 159 | $pubDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); |
159 | $link['pub_iso_date'] = $this->getIsoDate($pubDate); | 160 | $link['pub_iso_date'] = $this->getIsoDate($pubDate); |
diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index aa57f44e..d7839402 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php | |||
@@ -249,5 +249,6 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
249 | $link = array_shift($data['links']); | 249 | $link = array_shift($data['links']); |
250 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); | 250 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); |
251 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); | 251 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); |
252 | $this->assertContains('http://host.tld:8080/~user/shaarli/?addtag=hashtag', $link['description']); | ||
252 | } | 253 | } |
253 | } | 254 | } |