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