diff options
author | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-05 09:43:33 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-05 09:43:33 +0200 |
commit | a62788c61ef80e6b0f1cf0b6304b2dfd2223aa38 (patch) | |
tree | 9fae636bd0d7006e8adcf16783e69130cd6b03d9 /inc/poche/Poche.class.php | |
parent | 3208d538a750866221fa231d4230082eef90ca69 (diff) | |
download | wallabag-a62788c61ef80e6b0f1cf0b6304b2dfd2223aa38.tar.gz wallabag-a62788c61ef80e6b0f1cf0b6304b2dfd2223aa38.tar.zst wallabag-a62788c61ef80e6b0f1cf0b6304b2dfd2223aa38.zip |
#100: welcome to you, instapaper users
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r-- | inc/poche/Poche.class.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 5c3eda80..0d37e3c2 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -212,6 +212,28 @@ class Poche | |||
212 | 212 | ||
213 | private function importFromInstapaper() | 213 | private function importFromInstapaper() |
214 | { | 214 | { |
215 | $html = new simple_html_dom(); | ||
216 | $html->load_file('./instapaper-export.html'); | ||
217 | |||
218 | $read = 0; | ||
219 | $errors = array(); | ||
220 | foreach($html->find('ol') as $ul) | ||
221 | { | ||
222 | foreach($ul->find('li') as $li) | ||
223 | { | ||
224 | $a = $li->find('a'); | ||
225 | $url = new Url(base64_encode($a[0]->href)); | ||
226 | $this->action('add', $url); | ||
227 | if ($read == '1') { | ||
228 | $last_id = $this->store->getLastId(); | ||
229 | $this->store->archiveById($last_id); | ||
230 | } | ||
231 | } | ||
232 | # Instapaper génère un fichier HTML avec deux <ol> | ||
233 | # Le premier concerne les éléments non lus | ||
234 | # Le second concerne les éléments archivés | ||
235 | $read = 1; | ||
236 | } | ||
215 | Tools::logm('import from instapaper completed'); | 237 | Tools::logm('import from instapaper completed'); |
216 | Tools::redirect(); | 238 | Tools::redirect(); |
217 | } | 239 | } |