diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 12:05:08 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 12:05:08 +0200 |
commit | b6f678a5a1d15acf284ebcec16c905e976671ce1 (patch) | |
tree | 33c7da831482ed79c44896ef19c73c72ada84f2e /application/bookmark/BookmarkInitializer.php | |
parent | b14687036b9b800681197f51fdc47e62f0c88e2e (diff) | |
parent | 1c1520b6b98ab20201bfe15577782a52320339df (diff) | |
download | Shaarli-b6f678a5a1d15acf284ebcec16c905e976671ce1.tar.gz Shaarli-b6f678a5a1d15acf284ebcec16c905e976671ce1.tar.zst Shaarli-b6f678a5a1d15acf284ebcec16c905e976671ce1.zip |
Merge branch 'v0.12' into latest
Diffstat (limited to 'application/bookmark/BookmarkInitializer.php')
-rw-r--r-- | application/bookmark/BookmarkInitializer.php | 110 |
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 | |||
3 | namespace 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 | */ | ||
16 | class 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 | |||
42 | Explore your new Shaarli instance by trying out controls and menus. | ||
43 | Visit the project on [Github](https://github.com/shaarli/Shaarli) or [the documentation](https://shaarli.readthedocs.io/en/master/) to learn more about Shaarli. | ||
44 | |||
45 | Now 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. | ||
56 | This note is private, so you are the only one able to see it while logged in. | ||
57 | |||
58 | You can use this to keep notes, post articles, code snippets, and much more. | ||
59 | |||
60 | The 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 | |||
73 | Markdown 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 | |||
94 | Shaarli allows you to bookmark your favorite pages, and share them with others or store them privately. | ||
95 | You can add a description to your bookmarks, such as this one, and tag them. | ||
96 | |||
97 | Create a new shaare by clicking the `+Shaare` button, or using any of the recommended tools (browser extension, mobile app, bookmarklet, REST API, etc.). | ||
98 | |||
99 | 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`). | ||
100 | Hashtags such as #shaarli #help are also supported. | ||
101 | You can also filter the available [RSS feed](/feed/atom) and picture wall by tag or plaintext search. | ||
102 | |||
103 | We hope that you will enjoy using Shaarli, maintained with ❤️ by the community! | ||
104 | Feel 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 | } | ||