diff options
Diffstat (limited to 'application/bookmark/BookmarkInitializer.php')
-rw-r--r-- | application/bookmark/BookmarkInitializer.php | 87 |
1 files changed, 70 insertions, 17 deletions
diff --git a/application/bookmark/BookmarkInitializer.php b/application/bookmark/BookmarkInitializer.php index 9eee9a35..04b996f3 100644 --- a/application/bookmark/BookmarkInitializer.php +++ b/application/bookmark/BookmarkInitializer.php | |||
@@ -1,13 +1,14 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | declare(strict_types=1); | ||
4 | |||
3 | namespace Shaarli\Bookmark; | 5 | namespace Shaarli\Bookmark; |
4 | 6 | ||
5 | /** | 7 | /** |
6 | * Class BookmarkInitializer | 8 | * Class BookmarkInitializer |
7 | * | 9 | * |
8 | * This class is used to initialized default bookmarks after a fresh install of Shaarli. | 10 | * This class is used to initialized default bookmarks after a fresh install of Shaarli. |
9 | * It is no longer call when the data store is empty, | 11 | * It should be only called if the datastore file does not exist(users might want to delete the default bookmarks). |
10 | * because user might want to delete default bookmarks after the install. | ||
11 | * | 12 | * |
12 | * To prevent data corruption, it does not overwrite existing bookmarks, | 13 | * To prevent data corruption, it does not overwrite existing bookmarks, |
13 | * even though there should not be any. | 14 | * even though there should not be any. |
@@ -24,7 +25,7 @@ class BookmarkInitializer | |||
24 | * | 25 | * |
25 | * @param BookmarkServiceInterface $bookmarkService | 26 | * @param BookmarkServiceInterface $bookmarkService |
26 | */ | 27 | */ |
27 | public function __construct($bookmarkService) | 28 | public function __construct(BookmarkServiceInterface $bookmarkService) |
28 | { | 29 | { |
29 | $this->bookmarkService = $bookmarkService; | 30 | $this->bookmarkService = $bookmarkService; |
30 | } | 31 | } |
@@ -32,28 +33,80 @@ class BookmarkInitializer | |||
32 | /** | 33 | /** |
33 | * Initialize the data store with default bookmarks | 34 | * Initialize the data store with default bookmarks |
34 | */ | 35 | */ |
35 | public function initialize() | 36 | public function initialize(): void |
36 | { | 37 | { |
37 | $bookmark = new Bookmark(); | 38 | $bookmark = new Bookmark(); |
38 | $bookmark->setTitle(t('My secret stuff... - Pastebin.com')); | 39 | $bookmark->setTitle('quicksilver (loop) on Vimeo ' . t('(private bookmark with thumbnail demo)')); |
39 | $bookmark->setUrl('http://sebsauvage.net/paste/?8434b27936c09649#bR7XsXhoTiLcqCpQbmOpBi3rq2zzQUC5hBI7ZT1O3x8=', []); | 40 | $bookmark->setUrl('https://vimeo.com/153493904'); |
40 | $bookmark->setDescription(t('Shhhh! I\'m a private link only YOU can see. You can delete me too.')); | 41 | $bookmark->setDescription(t( |
41 | $bookmark->setTagsString('secretstuff'); | 42 | 'Shaarli will automatically pick up the thumbnail for links to a variety of websites. |
43 | |||
44 | Explore your new Shaarli instance by trying out controls and menus. | ||
45 | Visit the project on [Github](https://github.com/shaarli/Shaarli) or [the documentation](https://shaarli.readthedocs.io/en/master/) to learn more about Shaarli. | ||
46 | |||
47 | Now you can edit or delete the default shaares. | ||
48 | ' | ||
49 | )); | ||
50 | $bookmark->setTagsString('shaarli help thumbnail'); | ||
51 | $bookmark->setPrivate(true); | ||
52 | $this->bookmarkService->add($bookmark, false); | ||
53 | |||
54 | $bookmark = new Bookmark(); | ||
55 | $bookmark->setTitle(t('Note: Shaare descriptions')); | ||
56 | $bookmark->setDescription(t( | ||
57 | 'Adding a shaare without entering a URL creates a text-only "note" post such as this one. | ||
58 | This note is private, so you are the only one able to see it while logged in. | ||
59 | |||
60 | You can use this to keep notes, post articles, code snippets, and much more. | ||
61 | |||
62 | The Markdown formatting setting allows you to format your notes and bookmark description: | ||
63 | |||
64 | ### Title headings | ||
65 | |||
66 | #### Multiple headings levels | ||
67 | * bullet lists | ||
68 | * _italic_ text | ||
69 | * **bold** text | ||
70 | * ~~strike through~~ text | ||
71 | * `code` blocks | ||
72 | * images | ||
73 | * [links](https://en.wikipedia.org/wiki/Markdown) | ||
74 | |||
75 | Markdown also supports tables: | ||
76 | |||
77 | | Name | Type | Color | Qty | | ||
78 | | ------- | --------- | ------ | ----- | | ||
79 | | Orange | Fruit | Orange | 126 | | ||
80 | | Apple | Fruit | Any | 62 | | ||
81 | | Lemon | Fruit | Yellow | 30 | | ||
82 | | Carrot | Vegetable | Red | 14 | | ||
83 | ' | ||
84 | )); | ||
85 | $bookmark->setTagsString('shaarli help'); | ||
42 | $bookmark->setPrivate(true); | 86 | $bookmark->setPrivate(true); |
43 | $this->bookmarkService->add($bookmark); | 87 | $this->bookmarkService->add($bookmark, false); |
44 | 88 | ||
45 | $bookmark = new Bookmark(); | 89 | $bookmark = new Bookmark(); |
46 | $bookmark->setTitle(t('The personal, minimalist, super-fast, database free, bookmarking service')); | 90 | $bookmark->setTitle( |
47 | $bookmark->setUrl('https://shaarli.readthedocs.io', []); | 91 | 'Shaarli - ' . t('The personal, minimalist, super-fast, database free, bookmarking service') |
92 | ); | ||
48 | $bookmark->setDescription(t( | 93 | $bookmark->setDescription(t( |
49 | 'Welcome to Shaarli! This is your first public bookmark. ' | 94 | 'Welcome to Shaarli! |
50 | . 'To edit or delete me, you must first login. | 95 | |
96 | Shaarli allows you to bookmark your favorite pages, and share them with others or store them privately. | ||
97 | You can add a description to your bookmarks, such as this one, and tag them. | ||
98 | |||
99 | Create a new shaare by clicking the `+Shaare` button, or using any of the recommended tools (browser extension, mobile app, bookmarklet, REST API, etc.). | ||
51 | 100 | ||
52 | To learn how to use Shaarli, consult the link "Documentation" at the bottom of this page. | 101 | You can easily retrieve your links, even with thousands of them, using the internal search engine, or search through tags (e.g. this Shaare is tagged with `shaarli` and `help`). |
102 | Hashtags such as #shaarli #help are also supported. | ||
103 | You can also filter the available [RSS feed](/feed/atom) and picture wall by tag or plaintext search. | ||
53 | 104 | ||
54 | You use the community supported version of the original Shaarli project, by Sebastien Sauvage.' | 105 | We hope that you will enjoy using Shaarli, maintained with ❤️ by the community! |
106 | Feel free to open [an issue](https://github.com/shaarli/Shaarli/issues) if you have a suggestion or encounter an issue. | ||
107 | ' | ||
55 | )); | 108 | )); |
56 | $bookmark->setTagsString('opensource software'); | 109 | $bookmark->setTagsString('shaarli help'); |
57 | $this->bookmarkService->add($bookmark); | 110 | $this->bookmarkService->add($bookmark, false); |
58 | } | 111 | } |
59 | } | 112 | } |