$data = json_decode(file_get_contents($this->filepath), true);
if (empty($data)) {
+ $this->logger->error('Wallabag Browser: no entries in imported file');
+
return false;
}
public function parseEntry(array $importedEntry)
{
if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) {
+ if ($this->producer) {
+ $this->parseEntriesForProducer($importedEntry);
+
+ return;
+ }
+
$this->parseEntries($importedEntry);
return;
}
if (array_key_exists('children', $importedEntry)) {
+ if ($this->producer) {
+ $this->parseEntriesForProducer($importedEntry['children']);
+
+ return;
+ }
+
$this->parseEntries($importedEntry['children']);
return;
return $entry;
}
- /**
- * {@inheritdoc}
- */
- protected function prepareEntry(array $entry = [])
- {
- $url = array_key_exists('uri', $entry) ? $entry['uri'] : $entry['url'];
- $date = array_key_exists('date_added', $entry) ? $entry['date_added'] : $entry['dateAdded'];
- $title = array_key_exists('name', $entry) ? $entry['name'] : $entry['title'];
-
- if (16 === strlen($date)) {
- // firefox ...
- $date = (int) ceil($date / 1000000);
- } else if (17 === strlen($date)) {
- // chrome ...
- $date = (int) ceil($date / 10000000);
- } else {
- $date = '';
- }
-
- $data = [
- 'title' => $title,
- 'html' => '',
- 'url' => $url,
- 'is_archived' => $this->markAsRead,
- 'tags' => '',
- 'created_at' => $date,
- ];
-
- if (array_key_exists('tags', $entry) && $entry['tags'] != '') {
- $data['tags'] = $entry['tags'];
- }
-
- return $data;
- }
-
/**
* {@inheritdoc}
*/