2016-09-21 17:47:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Wallabag\ImportBundle\Import;
|
|
|
|
|
|
|
|
|
|
class FirefoxImport extends BrowserImport
|
|
|
|
|
{
|
|
|
|
|
protected $filepath;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getName()
|
|
|
|
|
{
|
|
|
|
|
return 'Firefox';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getUrl()
|
|
|
|
|
{
|
|
|
|
|
return 'import_firefox';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getDescription()
|
|
|
|
|
{
|
|
|
|
|
return 'import.firefox.description';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
protected function prepareEntry($entry = [])
|
|
|
|
|
{
|
2016-09-21 18:00:08 +02:00
|
|
|
$data = [
|
2016-09-21 17:47:47 +02:00
|
|
|
'title' => $entry['name'],
|
|
|
|
|
'html' => '',
|
|
|
|
|
'url' => $entry['url'],
|
|
|
|
|
'is_archived' => $this->markAsRead,
|
|
|
|
|
'tags' => '',
|
|
|
|
|
'created_at' => $entry['date_added'],
|
|
|
|
|
];
|
|
|
|
|
|
2016-09-21 18:00:08 +02:00
|
|
|
if (array_key_exists('tags', $entry) && $entry['tags'] != '') {
|
|
|
|
|
$data['tags'] = $entry['tags'];
|
|
|
|
|
}
|
2016-09-21 17:47:47 +02:00
|
|
|
|
2016-09-21 18:00:08 +02:00
|
|
|
return $data;
|
|
|
|
|
}
|
2016-09-21 17:47:47 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
protected function setEntryAsRead(array $importedEntry)
|
|
|
|
|
{
|
|
|
|
|
$importedEntry['is_archived'] = 1;
|
|
|
|
|
|
|
|
|
|
return $importedEntry;
|
|
|
|
|
}
|
|
|
|
|
}
|