]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - application/bookmark/BookmarkInitializer.php
2240f58cd684e471b0ed832a58a4f45f3a2e47a3
[github/shaarli/Shaarli.git] / application / bookmark / BookmarkInitializer.php
1 <?php
2
3 declare(strict_types=1);
4
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.
11 * It should be only called if the datastore file does not exist(users might want to delete the default bookmarks).
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 */
28 public function __construct(BookmarkServiceInterface $bookmarkService)
29 {
30 $this->bookmarkService = $bookmarkService;
31 }
32
33 /**
34 * Initialize the data store with default bookmarks
35 */
36 public function initialize(): void
37 {
38 $bookmark = new Bookmark();
39 $bookmark->setTitle('Calm Jazz Music - YouTube ' . t('(private bookmark with thumbnail demo)'));
40 $bookmark->setUrl('https://www.youtube.com/watch?v=DVEUcbPkb-c');
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');
86 $bookmark->setPrivate(true);
87 $this->bookmarkService->add($bookmark, false);
88
89 $bookmark = new Bookmark();
90 $bookmark->setTitle(
91 'Shaarli - ' . t('The personal, minimalist, super-fast, database free, bookmarking service')
92 );
93 $bookmark->setDescription(t(
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.).
100
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.
104
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 '
108 ));
109 $bookmark->setTagsString('shaarli help');
110 $this->bookmarkService->add($bookmark, false);
111 }
112 }