]>
Commit | Line | Data |
---|---|---|
336a28fa A |
1 | <?php |
2 | ||
efb7d21b A |
3 | declare(strict_types=1); |
4 | ||
336a28fa A |
5 | namespace Shaarli\Bookmark; |
6 | ||
7 | /** | |
8 | * Class BookmarkInitializer | |
9 | * | |
10 | * This class is used to initialized default bookmarks after a fresh install of Shaarli. | |
d6e5f04d | 11 | * It should be only called if the datastore file does not exist(users might want to delete the default bookmarks). |
336a28fa A |
12 | * |
13 | * To prevent data corruption, it does not overwrite existing bookmarks, | |
14 | * even though there should not be any. | |
15 | * | |
16 | * @package Shaarli\Bookmark | |
17 | */ | |
18 | class BookmarkInitializer | |
19 | { | |
20 | /** @var BookmarkServiceInterface */ | |
21 | protected $bookmarkService; | |
22 | ||
23 | /** | |
24 | * BookmarkInitializer constructor. | |
25 | * | |
26 | * @param BookmarkServiceInterface $bookmarkService | |
27 | */ | |
efb7d21b | 28 | public function __construct(BookmarkServiceInterface $bookmarkService) |
336a28fa A |
29 | { |
30 | $this->bookmarkService = $bookmarkService; | |
31 | } | |
32 | ||
33 | /** | |
34 | * Initialize the data store with default bookmarks | |
35 | */ | |
efb7d21b | 36 | public function initialize(): void |
336a28fa A |
37 | { |
38 | $bookmark = new Bookmark(); | |
da7acb98 A |
39 | $bookmark->setTitle('quicksilver (loop) on Vimeo ' . t('(private bookmark with thumbnail demo)')); |
40 | $bookmark->setUrl('https://vimeo.com/153493904'); | |
41 | $bookmark->setDescription(t( | |
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'); | |
336a28fa | 86 | $bookmark->setPrivate(true); |
c4ad3d4f | 87 | $this->bookmarkService->add($bookmark, false); |
336a28fa A |
88 | |
89 | $bookmark = new Bookmark(); | |
da7acb98 A |
90 | $bookmark->setTitle( |
91 | 'Shaarli - ' . t('The personal, minimalist, super-fast, database free, bookmarking service') | |
92 | ); | |
336a28fa | 93 | $bookmark->setDescription(t( |
da7acb98 A |
94 | 'Welcome to Shaarli! |
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.). | |
336a28fa | 100 | |
da7acb98 A |
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. | |
336a28fa | 104 | |
da7acb98 A |
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 | ' | |
336a28fa | 108 | )); |
da7acb98 | 109 | $bookmark->setTagsString('shaarli help'); |
c4ad3d4f | 110 | $this->bookmarkService->add($bookmark, false); |
336a28fa A |
111 | } |
112 | } |