diff options
Diffstat (limited to 'application/feed/FeedBuilder.php')
-rw-r--r-- | application/feed/FeedBuilder.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/application/feed/FeedBuilder.php b/application/feed/FeedBuilder.php index f6def630..ed62af26 100644 --- a/application/feed/FeedBuilder.php +++ b/application/feed/FeedBuilder.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
2 | namespace Shaarli\Feed; | 3 | namespace Shaarli\Feed; |
3 | 4 | ||
4 | use DateTime; | 5 | use DateTime; |
@@ -102,19 +103,19 @@ class FeedBuilder | |||
102 | } | 103 | } |
103 | 104 | ||
104 | // Optionally filter the results: | 105 | // Optionally filter the results: |
105 | $linksToDisplay = $this->linkDB->search($userInput, null, false, false, true); | 106 | $linksToDisplay = $this->linkDB->search($userInput ?? [], null, false, false, true); |
106 | 107 | ||
107 | $nblinksToDisplay = $this->getNbLinks(count($linksToDisplay), $userInput); | 108 | $nblinksToDisplay = $this->getNbLinks(count($linksToDisplay), $userInput); |
108 | 109 | ||
109 | // Can't use array_keys() because $link is a LinkDB instance and not a real array. | 110 | // Can't use array_keys() because $link is a LinkDB instance and not a real array. |
110 | $keys = array(); | 111 | $keys = []; |
111 | foreach ($linksToDisplay as $key => $value) { | 112 | foreach ($linksToDisplay as $key => $value) { |
112 | $keys[] = $key; | 113 | $keys[] = $key; |
113 | } | 114 | } |
114 | 115 | ||
115 | $pageaddr = escape(index_url($this->serverInfo)); | 116 | $pageaddr = escape(index_url($this->serverInfo)); |
116 | $this->formatter->addContextData('index_url', $pageaddr); | 117 | $this->formatter->addContextData('index_url', $pageaddr); |
117 | $linkDisplayed = array(); | 118 | $linkDisplayed = []; |
118 | for ($i = 0; $i < $nblinksToDisplay && $i < count($keys); $i++) { | 119 | for ($i = 0; $i < $nblinksToDisplay && $i < count($keys); $i++) { |
119 | $linkDisplayed[$keys[$i]] = $this->buildItem($feedType, $linksToDisplay[$keys[$i]], $pageaddr); | 120 | $linkDisplayed[$keys[$i]] = $this->buildItem($feedType, $linksToDisplay[$keys[$i]], $pageaddr); |
120 | } | 121 | } |
@@ -176,9 +177,9 @@ class FeedBuilder | |||
176 | $data = $this->formatter->format($link); | 177 | $data = $this->formatter->format($link); |
177 | $data['guid'] = rtrim($pageaddr, '/') . '/shaare/' . $data['shorturl']; | 178 | $data['guid'] = rtrim($pageaddr, '/') . '/shaare/' . $data['shorturl']; |
178 | if ($this->usePermalinks === true) { | 179 | if ($this->usePermalinks === true) { |
179 | $permalink = '<a href="'. $data['url'] .'" title="'. t('Direct link') .'">'. t('Direct link') .'</a>'; | 180 | $permalink = '<a href="' . $data['url'] . '" title="' . t('Direct link') . '">' . t('Direct link') . '</a>'; |
180 | } else { | 181 | } else { |
181 | $permalink = '<a href="'. $data['guid'] .'" title="'. t('Permalink') .'">'. t('Permalink') .'</a>'; | 182 | $permalink = '<a href="' . $data['guid'] . '" title="' . t('Permalink') . '">' . t('Permalink') . '</a>'; |
182 | } | 183 | } |
183 | $data['description'] .= PHP_EOL . PHP_EOL . '<br>— ' . $permalink; | 184 | $data['description'] .= PHP_EOL . PHP_EOL . '<br>— ' . $permalink; |
184 | 185 | ||