diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/NetscapeBookmarkUtils.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index 8a296705..fdbb0ad7 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php | |||
@@ -13,17 +13,19 @@ class NetscapeBookmarkUtils | |||
13 | * - timestamp link addition date, using the Unix epoch format | 13 | * - timestamp link addition date, using the Unix epoch format |
14 | * - taglist comma-separated tag list | 14 | * - taglist comma-separated tag list |
15 | * | 15 | * |
16 | * @param LinkDB $linkDb The link datastore | 16 | * @param LinkDB $linkDb Link datastore |
17 | * @param string $selection Which links to export: (all|private|public) | 17 | * @param string $selection Which links to export: (all|private|public) |
18 | * @param bool $prependNoteUrl Prepend note permalinks with the server's URL | ||
19 | * @param string $indexUrl Absolute URL of the Shaarli index page | ||
18 | * | 20 | * |
19 | * @throws Exception Invalid export selection | 21 | * @throws Exception Invalid export selection |
20 | * | 22 | * |
21 | * @return array The links to be exported, with additional fields | 23 | * @return array The links to be exported, with additional fields |
22 | */ | 24 | */ |
23 | public static function filterAndFormat($linkDb, $selection) | 25 | public static function filterAndFormat($linkDb, $selection, $prependNoteUrl, $indexUrl) |
24 | { | 26 | { |
25 | // see tpl/export.html for possible values | 27 | // see tpl/export.html for possible values |
26 | if (! in_array($selection, array('all','public','private'))) { | 28 | if (! in_array($selection, array('all', 'public', 'private'))) { |
27 | throw new Exception('Invalid export selection: "'.$selection.'"'); | 29 | throw new Exception('Invalid export selection: "'.$selection.'"'); |
28 | } | 30 | } |
29 | 31 | ||
@@ -39,6 +41,11 @@ class NetscapeBookmarkUtils | |||
39 | $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); | 41 | $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); |
40 | $link['timestamp'] = $date->getTimestamp(); | 42 | $link['timestamp'] = $date->getTimestamp(); |
41 | $link['taglist'] = str_replace(' ', ',', $link['tags']); | 43 | $link['taglist'] = str_replace(' ', ',', $link['tags']); |
44 | |||
45 | if (startsWith($link['url'], '?') && $prependNoteUrl) { | ||
46 | $link['url'] = $indexUrl . $link['url']; | ||
47 | } | ||
48 | |||
42 | $bookmarkLinks[] = $link; | 49 | $bookmarkLinks[] = $link; |
43 | } | 50 | } |
44 | 51 | ||