2019-05-25 15:46:47 +02:00
|
|
|
<?php
|
|
|
|
|
2020-10-02 17:50:59 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-05-25 15:46:47 +02:00
|
|
|
namespace Shaarli\Bookmark;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class BookmarkInitializer
|
|
|
|
*
|
|
|
|
* This class is used to initialized default bookmarks after a fresh install of Shaarli.
|
2020-08-01 11:10:57 +02:00
|
|
|
* It should be only called if the datastore file does not exist(users might want to delete the default bookmarks).
|
2019-05-25 15:46:47 +02:00
|
|
|
*
|
|
|
|
* To prevent data corruption, it does not overwrite existing bookmarks,
|
|
|
|
* even though there should not be any.
|
|
|
|
*
|
|
|
|
* @package Shaarli\Bookmark
|
|
|
|
*/
|
|
|
|
class BookmarkInitializer
|
|
|
|
{
|
|
|
|
/** @var BookmarkServiceInterface */
|
|
|
|
protected $bookmarkService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* BookmarkInitializer constructor.
|
|
|
|
*
|
|
|
|
* @param BookmarkServiceInterface $bookmarkService
|
|
|
|
*/
|
2020-10-02 17:50:59 +02:00
|
|
|
public function __construct(BookmarkServiceInterface $bookmarkService)
|
2019-05-25 15:46:47 +02:00
|
|
|
{
|
|
|
|
$this->bookmarkService = $bookmarkService;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the data store with default bookmarks
|
|
|
|
*/
|
2020-10-02 17:50:59 +02:00
|
|
|
public function initialize(): void
|
2019-05-25 15:46:47 +02:00
|
|
|
{
|
|
|
|
$bookmark = new Bookmark();
|
2020-11-08 11:58:17 +01:00
|
|
|
$bookmark->setTitle('Calm Jazz Music - YouTube ' . t('(private bookmark with thumbnail demo)'));
|
|
|
|
$bookmark->setUrl('https://www.youtube.com/watch?v=DVEUcbPkb-c');
|
2020-09-06 13:42:45 +02:00
|
|
|
$bookmark->setDescription(t(
|
|
|
|
'Shaarli will automatically pick up the thumbnail for links to a variety of websites.
|
|
|
|
|
|
|
|
Explore your new Shaarli instance by trying out controls and menus.
|
|
|
|
Visit the project on [Github](https://github.com/shaarli/Shaarli) or [the documentation](https://shaarli.readthedocs.io/en/master/) to learn more about Shaarli.
|
|
|
|
|
|
|
|
Now you can edit or delete the default shaares.
|
|
|
|
'
|
|
|
|
));
|
|
|
|
$bookmark->setTagsString('shaarli help thumbnail');
|
|
|
|
$bookmark->setPrivate(true);
|
|
|
|
$this->bookmarkService->add($bookmark, false);
|
|
|
|
|
|
|
|
$bookmark = new Bookmark();
|
|
|
|
$bookmark->setTitle(t('Note: Shaare descriptions'));
|
|
|
|
$bookmark->setDescription(t(
|
|
|
|
'Adding a shaare without entering a URL creates a text-only "note" post such as this one.
|
|
|
|
This note is private, so you are the only one able to see it while logged in.
|
|
|
|
|
|
|
|
You can use this to keep notes, post articles, code snippets, and much more.
|
|
|
|
|
|
|
|
The Markdown formatting setting allows you to format your notes and bookmark description:
|
|
|
|
|
|
|
|
### Title headings
|
|
|
|
|
|
|
|
#### Multiple headings levels
|
|
|
|
* bullet lists
|
|
|
|
* _italic_ text
|
|
|
|
* **bold** text
|
|
|
|
* ~~strike through~~ text
|
|
|
|
* `code` blocks
|
|
|
|
* images
|
|
|
|
* [links](https://en.wikipedia.org/wiki/Markdown)
|
|
|
|
|
|
|
|
Markdown also supports tables:
|
|
|
|
|
|
|
|
| Name | Type | Color | Qty |
|
|
|
|
| ------- | --------- | ------ | ----- |
|
|
|
|
| Orange | Fruit | Orange | 126 |
|
|
|
|
| Apple | Fruit | Any | 62 |
|
|
|
|
| Lemon | Fruit | Yellow | 30 |
|
|
|
|
| Carrot | Vegetable | Red | 14 |
|
|
|
|
'
|
|
|
|
));
|
|
|
|
$bookmark->setTagsString('shaarli help');
|
2019-05-25 15:46:47 +02:00
|
|
|
$bookmark->setPrivate(true);
|
2020-07-07 10:15:56 +02:00
|
|
|
$this->bookmarkService->add($bookmark, false);
|
2019-05-25 15:46:47 +02:00
|
|
|
|
|
|
|
$bookmark = new Bookmark();
|
2020-09-06 13:42:45 +02:00
|
|
|
$bookmark->setTitle(
|
|
|
|
'Shaarli - ' . t('The personal, minimalist, super-fast, database free, bookmarking service')
|
|
|
|
);
|
2019-05-25 15:46:47 +02:00
|
|
|
$bookmark->setDescription(t(
|
2020-09-06 13:42:45 +02:00
|
|
|
'Welcome to Shaarli!
|
|
|
|
|
|
|
|
Shaarli allows you to bookmark your favorite pages, and share them with others or store them privately.
|
|
|
|
You can add a description to your bookmarks, such as this one, and tag them.
|
|
|
|
|
|
|
|
Create a new shaare by clicking the `+Shaare` button, or using any of the recommended tools (browser extension, mobile app, bookmarklet, REST API, etc.).
|
2019-05-25 15:46:47 +02:00
|
|
|
|
2020-09-06 13:42:45 +02:00
|
|
|
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`).
|
|
|
|
Hashtags such as #shaarli #help are also supported.
|
|
|
|
You can also filter the available [RSS feed](/feed/atom) and picture wall by tag or plaintext search.
|
2019-05-25 15:46:47 +02:00
|
|
|
|
2020-09-06 13:42:45 +02:00
|
|
|
We hope that you will enjoy using Shaarli, maintained with ❤️ by the community!
|
|
|
|
Feel free to open [an issue](https://github.com/shaarli/Shaarli/issues) if you have a suggestion or encounter an issue.
|
|
|
|
'
|
2019-05-25 15:46:47 +02:00
|
|
|
));
|
2020-09-06 13:42:45 +02:00
|
|
|
$bookmark->setTagsString('shaarli help');
|
2020-07-07 10:15:56 +02:00
|
|
|
$this->bookmarkService->add($bookmark, false);
|
2019-05-25 15:46:47 +02:00
|
|
|
}
|
|
|
|
}
|