]>
Commit | Line | Data |
---|---|---|
59201088 TC |
1 | <?php |
2 | ||
3 | namespace Wallabag\ImportBundle\Import; | |
4 | ||
59201088 TC |
5 | class FirefoxImport extends BrowserImport |
6 | { | |
7 | protected $filepath; | |
8 | ||
9 | /** | |
10 | * {@inheritdoc} | |
11 | */ | |
12 | public function getName() | |
13 | { | |
14 | return 'Firefox'; | |
15 | } | |
16 | ||
17 | /** | |
18 | * {@inheritdoc} | |
19 | */ | |
20 | public function getUrl() | |
21 | { | |
22 | return 'import_firefox'; | |
23 | } | |
24 | ||
25 | /** | |
26 | * {@inheritdoc} | |
27 | */ | |
28 | public function getDescription() | |
29 | { | |
30 | return 'import.firefox.description'; | |
31 | } | |
990adfb3 | 32 | |
9f8f188d JB |
33 | /** |
34 | * {@inheritdoc} | |
35 | */ | |
36 | public function validateEntry(array $importedEntry) | |
37 | { | |
38 | if (empty($importedEntry['uri'])) { | |
39 | return false; | |
40 | } | |
41 | ||
42 | return true; | |
43 | } | |
44 | ||
990adfb3 JB |
45 | /** |
46 | * {@inheritdoc} | |
47 | */ | |
48 | protected function prepareEntry(array $entry = []) | |
49 | { | |
50 | $data = [ | |
51 | 'title' => $entry['title'], | |
36e6ef52 | 52 | 'html' => false, |
990adfb3 | 53 | 'url' => $entry['uri'], |
bb98fede NL |
54 | 'is_archived' => (int) $this->markAsRead, |
55 | 'is_starred' => false, | |
990adfb3 JB |
56 | 'tags' => '', |
57 | 'created_at' => substr($entry['dateAdded'], 0, 10), | |
58 | ]; | |
59 | ||
3ef055ce | 60 | if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { |
990adfb3 JB |
61 | $data['tags'] = $entry['tags']; |
62 | } | |
63 | ||
64 | return $data; | |
65 | } | |
59201088 | 66 | } |