diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-09-21 17:47:47 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-25 12:29:18 +0200 |
commit | 59201088b4fc13fd361238396f630dabd9bd1990 (patch) | |
tree | 2d4d5c2fbe7f007214c41f0c4ccba2f8d3d7ec8b /src/Wallabag/ImportBundle/Import/ChromeImport.php | |
parent | f7c55b38122cc593c2b58bb6425fca9d243b055e (diff) | |
download | wallabag-59201088b4fc13fd361238396f630dabd9bd1990.tar.gz wallabag-59201088b4fc13fd361238396f630dabd9bd1990.tar.zst wallabag-59201088b4fc13fd361238396f630dabd9bd1990.zip |
bring chrome and firefox as separate imports
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/ChromeImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/ChromeImport.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php new file mode 100644 index 00000000..7936ee2f --- /dev/null +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php | |||
@@ -0,0 +1,71 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\Import; | ||
4 | |||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Psr\Log\NullLogger; | ||
7 | use Doctrine\ORM\EntityManager; | ||
8 | use Wallabag\CoreBundle\Entity\Entry; | ||
9 | use Wallabag\UserBundle\Entity\User; | ||
10 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
11 | |||
12 | class ChromeImport extends BrowserImport | ||
13 | { | ||
14 | protected $filepath; | ||
15 | |||
16 | /** | ||
17 | * {@inheritdoc} | ||
18 | */ | ||
19 | public function getName() | ||
20 | { | ||
21 | return 'Chrome'; | ||
22 | } | ||
23 | |||
24 | /** | ||
25 | * {@inheritdoc} | ||
26 | */ | ||
27 | public function getUrl() | ||
28 | { | ||
29 | return 'import_chrome'; | ||
30 | } | ||
31 | |||
32 | /** | ||
33 | * {@inheritdoc} | ||
34 | */ | ||
35 | public function getDescription() | ||
36 | { | ||
37 | return 'import.chrome.description'; | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * {@inheritdoc} | ||
42 | */ | ||
43 | protected function prepareEntry($entry = []) | ||
44 | { | ||
45 | $data = [ | ||
46 | 'title' => $entry['name'], | ||
47 | 'html' => '', | ||
48 | 'url' => $entry['url'], | ||
49 | 'is_archived' => $this->markAsRead, | ||
50 | 'tags' => '', | ||
51 | 'created_at' => $entry['date_added'], | ||
52 | ]; | ||
53 | |||
54 | if (array_key_exists('tags', $entry) && $entry['tags'] != '') { | ||
55 | $data['tags'] = $entry['tags']; | ||
56 | } | ||
57 | |||
58 | return $data; | ||
59 | } | ||
60 | |||
61 | |||
62 | /** | ||
63 | * {@inheritdoc} | ||
64 | */ | ||
65 | protected function setEntryAsRead(array $importedEntry) | ||
66 | { | ||
67 | $importedEntry['is_archived'] = 1; | ||
68 | |||
69 | return $importedEntry; | ||
70 | } | ||
71 | } | ||