2016-09-21 17:47:47 +02:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\Import;
|
2016-09-21 17:47:47 +02:00
|
|
|
|
|
|
|
class ChromeImport extends BrowserImport
|
|
|
|
{
|
|
|
|
protected $filepath;
|
|
|
|
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return 'Chrome';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUrl()
|
|
|
|
{
|
|
|
|
return 'import_chrome';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription()
|
|
|
|
{
|
|
|
|
return 'import.chrome.description';
|
|
|
|
}
|
2016-09-26 07:30:02 +02:00
|
|
|
|
2018-12-18 13:14:42 +01:00
|
|
|
public function validateEntry(array $importedEntry)
|
|
|
|
{
|
|
|
|
if (empty($importedEntry['url'])) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-26 07:30:02 +02:00
|
|
|
protected function prepareEntry(array $entry = [])
|
|
|
|
{
|
|
|
|
$data = [
|
|
|
|
'title' => $entry['name'],
|
2016-12-02 22:42:36 -05:00
|
|
|
'html' => false,
|
2016-09-26 07:30:02 +02:00
|
|
|
'url' => $entry['url'],
|
2016-12-07 16:01:50 +01:00
|
|
|
'is_archived' => (int) $this->markAsRead,
|
|
|
|
'is_starred' => false,
|
2016-09-26 07:30:02 +02:00
|
|
|
'tags' => '',
|
|
|
|
'created_at' => substr($entry['date_added'], 0, 10),
|
|
|
|
];
|
|
|
|
|
2019-02-11 11:50:24 +01:00
|
|
|
if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) {
|
2016-09-26 07:30:02 +02:00
|
|
|
$data['tags'] = $entry['tags'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
2016-09-21 17:47:47 +02:00
|
|
|
}
|