X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FFirefoxImport.php;h=8999e3f3932240accb4096b519af13a31230bdbc;hb=9f8f188d928b47503d39348c5990379a572b570a;hp=351cbef12683545b47404fbad95c36a2ce19f6ad;hpb=2c61db30b737685ae9102ec10f2371778fb13f1a;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index 351cbef1..8999e3f3 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -33,31 +33,34 @@ class FirefoxImport extends BrowserImport /** * {@inheritdoc} */ - protected function prepareEntry($entry = []) + public function validateEntry(array $importedEntry) { - $data = [ - 'title' => $entry['name'], - 'html' => '', - 'url' => $entry['url'], - 'is_archived' => $this->markAsRead, - 'tags' => '', - 'created_at' => $entry['date_added'], - ]; - - if (array_key_exists('tags', $entry) && $entry['tags'] != '') { - $data['tags'] = $entry['tags']; + if (empty($importedEntry['uri'])) { + return false; } - return $data; + return true; } /** * {@inheritdoc} */ - protected function setEntryAsRead(array $importedEntry) + protected function prepareEntry(array $entry = []) { - $importedEntry['is_archived'] = 1; + $data = [ + 'title' => $entry['title'], + 'html' => false, + 'url' => $entry['uri'], + 'is_archived' => (int) $this->markAsRead, + 'is_starred' => false, + 'tags' => '', + 'created_at' => substr($entry['dateAdded'], 0, 10), + ]; - return $importedEntry; + if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + $data['tags'] = $entry['tags']; + } + + return $data; } }