X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FInstapaperImport.php;h=5a18c7c0c6c82c0426ba8d2b436f6beed79b55bc;hb=9f8f188d928b47503d39348c5990379a572b570a;hp=7d70154a66bf63b32e3f6e5f1574b134c002b628;hpb=71e1cbc8eb5928d393b0772055d6b711e90a09b3;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 7d70154a..5a18c7c0 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -62,8 +62,8 @@ class InstapaperImport extends AbstractImport } $entries = []; - $handle = fopen($this->filepath, 'r'); - while (($data = fgetcsv($handle, 10240)) !== false) { + $handle = fopen($this->filepath, 'rb'); + while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { continue; } @@ -72,7 +72,7 @@ class InstapaperImport extends AbstractImport // BUT it can also be the status (since status = folder in Instapaper) // and we don't want archive, unread & starred to become a tag $tags = null; - if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) { + if (false === \in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) { $tags = [$data[3]]; } @@ -80,8 +80,8 @@ class InstapaperImport extends AbstractImport 'url' => $data[0], 'title' => $data[1], 'status' => $data[3], - 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', - 'is_starred' => $data[3] === 'Starred', + 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3], + 'is_starred' => 'Starred' === $data[3], 'html' => false, 'tags' => $tags, ]; @@ -105,6 +105,18 @@ class InstapaperImport extends AbstractImport return true; } + /** + * {@inheritdoc} + */ + public function validateEntry(array $importedEntry) + { + if (empty($importedEntry['url'])) { + return false; + } + + return true; + } + /** * {@inheritdoc} */