diff options
author | adev <adev2000@gmail.com> | 2017-11-11 20:04:15 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-05-28 11:42:27 +0200 |
commit | 5f08426201c336f96d593954fb45b284d7e60f4a (patch) | |
tree | d4cf1267555aeeac5c457beefc15d40ba625726f /src/Wallabag | |
parent | bf9ace0643f654e7ccd9c020b8b501ad56cd19de (diff) | |
download | wallabag-5f08426201c336f96d593954fb45b284d7e60f4a.tar.gz wallabag-5f08426201c336f96d593954fb45b284d7e60f4a.tar.zst wallabag-5f08426201c336f96d593954fb45b284d7e60f4a.zip |
Fix because of some breaking changes of Graby 2.0
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 4 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/ContentProxy.php | 20 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Import/WallabagV2Import.php | 4 |
3 files changed, 13 insertions, 15 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index aff0534a..d9d99c85 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -369,9 +369,7 @@ class EntryRestController extends WallabagRestController | |||
369 | 'language' => !empty($data['language']) ? $data['language'] : $entry->getLanguage(), | 369 | 'language' => !empty($data['language']) ? $data['language'] : $entry->getLanguage(), |
370 | 'date' => !empty($data['publishedAt']) ? $data['publishedAt'] : $entry->getPublishedAt(), | 370 | 'date' => !empty($data['publishedAt']) ? $data['publishedAt'] : $entry->getPublishedAt(), |
371 | // faking the open graph preview picture | 371 | // faking the open graph preview picture |
372 | 'open_graph' => [ | 372 | 'image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(), |
373 | 'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(), | ||
374 | ], | ||
375 | 'authors' => \is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(), | 373 | 'authors' => \is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(), |
376 | ] | 374 | ] |
377 | ); | 375 | ); |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index ca01dec8..ac27e50a 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -253,16 +253,14 @@ class ContentProxy | |||
253 | 253 | ||
254 | if (!empty($content['title'])) { | 254 | if (!empty($content['title'])) { |
255 | $entry->setTitle($content['title']); | 255 | $entry->setTitle($content['title']); |
256 | } elseif (!empty($content['open_graph']['og_title'])) { | ||
257 | $entry->setTitle($content['open_graph']['og_title']); | ||
258 | } | 256 | } |
259 | 257 | ||
260 | if (empty($content['html'])) { | 258 | if (empty($content['html'])) { |
261 | $content['html'] = $this->fetchingErrorMessage; | 259 | $content['html'] = $this->fetchingErrorMessage; |
262 | 260 | ||
263 | if (!empty($content['open_graph']['og_description'])) { | 261 | if (!empty($content['description'])) { |
264 | $content['html'] .= '<p><i>But we found a short description: </i></p>'; | 262 | $content['html'] .= '<p><i>But we found a short description: </i></p>'; |
265 | $content['html'] .= $content['open_graph']['og_description']; | 263 | $content['html'] .= $content['description']; |
266 | } | 264 | } |
267 | } | 265 | } |
268 | 266 | ||
@@ -277,8 +275,8 @@ class ContentProxy | |||
277 | $entry->setPublishedBy($content['authors']); | 275 | $entry->setPublishedBy($content['authors']); |
278 | } | 276 | } |
279 | 277 | ||
280 | if (!empty($content['all_headers']) && $this->storeArticleHeaders) { | 278 | if (!empty($content['headers'])) { |
281 | $entry->setHeaders($content['all_headers']); | 279 | $entry->setHeaders($content['headers']); |
282 | } | 280 | } |
283 | 281 | ||
284 | if (!empty($content['date'])) { | 282 | if (!empty($content['date'])) { |
@@ -290,12 +288,12 @@ class ContentProxy | |||
290 | } | 288 | } |
291 | 289 | ||
292 | $previewPictureUrl = ''; | 290 | $previewPictureUrl = ''; |
293 | if (!empty($content['open_graph']['og_image'])) { | 291 | if (!empty($content['image'])) { |
294 | $previewPictureUrl = $content['open_graph']['og_image']; | 292 | $previewPictureUrl = $content['image']; |
295 | } | 293 | } |
296 | 294 | ||
297 | // if content is an image, define it as a preview too | 295 | // if content is an image, define it as a preview too |
298 | if (!empty($content['content_type']) && \in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) { | 296 | if (!empty($content['headers']['content_type']) && \in_array($this->mimeGuesser->guess($content['headers']['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) { |
299 | $previewPictureUrl = $content['url']; | 297 | $previewPictureUrl = $content['url']; |
300 | } elseif (empty($previewPictureUrl)) { | 298 | } elseif (empty($previewPictureUrl)) { |
301 | $this->logger->debug('Extracting images from content to provide a default preview picture'); | 299 | $this->logger->debug('Extracting images from content to provide a default preview picture'); |
@@ -310,8 +308,8 @@ class ContentProxy | |||
310 | $this->updatePreviewPicture($entry, $previewPictureUrl); | 308 | $this->updatePreviewPicture($entry, $previewPictureUrl); |
311 | } | 309 | } |
312 | 310 | ||
313 | if (!empty($content['content_type'])) { | 311 | if (!empty($content['headers']['content-type'])) { |
314 | $entry->setMimetype($content['content_type']); | 312 | $entry->setMimetype($content['headers']['content-type']); |
315 | } | 313 | } |
316 | 314 | ||
317 | try { | 315 | try { |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php index 3e085ecf..2ba26003 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php | |||
@@ -35,7 +35,9 @@ class WallabagV2Import extends WallabagImport | |||
35 | { | 35 | { |
36 | return [ | 36 | return [ |
37 | 'html' => $entry['content'], | 37 | 'html' => $entry['content'], |
38 | 'content_type' => $entry['mimetype'], | 38 | 'headers' => [ |
39 | 'content-type' => $entry['mimetype'], | ||
40 | ], | ||
39 | 'is_archived' => (bool) ($entry['is_archived'] || $this->markAsRead), | 41 | 'is_archived' => (bool) ($entry['is_archived'] || $this->markAsRead), |
40 | 'is_starred' => (bool) $entry['is_starred'], | 42 | 'is_starred' => (bool) $entry['is_starred'], |
41 | ] + $entry; | 43 | ] + $entry; |