aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Helper/DownloadImages.php36
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Static/_bookmarklet.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig4
-rw-r--r--src/Wallabag/UserBundle/Resources/translations/wallabag_user.oc.yml2
5 files changed, 41 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php
index 252ba57c..9c9452dd 100644
--- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php
+++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php
@@ -42,14 +42,17 @@ class DownloadImages
42 public function processHtml($entryId, $html, $url) 42 public function processHtml($entryId, $html, $url)
43 { 43 {
44 $crawler = new Crawler($html); 44 $crawler = new Crawler($html);
45 $result = $crawler 45 $imagesCrawler = $crawler
46 ->filterXpath('//img') 46 ->filterXpath('//img');
47 $imagesUrls = $imagesCrawler
47 ->extract(['src']); 48 ->extract(['src']);
49 $imagesSrcsetUrls = $this->getSrcsetUrls($imagesCrawler);
50 $imagesUrls = array_unique(array_merge($imagesUrls, $imagesSrcsetUrls));
48 51
49 $relativePath = $this->getRelativePath($entryId); 52 $relativePath = $this->getRelativePath($entryId);
50 53
51 // download and save the image to the folder 54 // download and save the image to the folder
52 foreach ($result as $image) { 55 foreach ($imagesUrls as $image) {
53 $imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath); 56 $imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath);
54 57
55 if (false === $imagePath) { 58 if (false === $imagePath) {
@@ -172,6 +175,33 @@ class DownloadImages
172 } 175 }
173 176
174 /** 177 /**
178 * Get images urls from the srcset image attribute.
179 *
180 * @param Crawler $imagesCrawler
181 *
182 * @return array An array of urls
183 */
184 protected function getSrcsetUrls(Crawler $imagesCrawler)
185 {
186 $urls = [];
187 $iterator = $imagesCrawler
188 ->getIterator();
189 while ($iterator->valid()) {
190 $srcsetAttribute = $iterator->current()->getAttribute('srcset');
191 if ('' !== $srcsetAttribute) {
192 $srcset = array_map('trim', explode(',', $srcsetAttribute));
193 $srcsetUrls = array_map(function ($src) {
194 return explode(' ', $src)[0];
195 }, $srcset);
196 $urls = array_merge($srcsetUrls, $urls);
197 }
198 $iterator->next();
199 }
200
201 return $urls;
202 }
203
204 /**
175 * Setup base folder where all images are going to be saved. 205 * Setup base folder where all images are going to be saved.
176 */ 206 */
177 private function setFolder() 207 private function setFolder()
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 6130eee2..95bc9560 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -234,7 +234,7 @@ entry:
234 created_at: 'Data de creacion' 234 created_at: 'Data de creacion'
235 published_at: 'Data de publicacion' 235 published_at: 'Data de publicacion'
236 published_by: 'Publicat per' 236 published_by: 'Publicat per'
237 # provided_by: 'Provided by' 237 provided_by: 'Provesit per'
238 new: 238 new:
239 page_title: 'Enregistrar un novèl article' 239 page_title: 'Enregistrar un novèl article'
240 placeholder: 'http://website.com' 240 placeholder: 'http://website.com'
@@ -246,7 +246,7 @@ entry:
246 page_title: 'Modificar un article' 246 page_title: 'Modificar un article'
247 title_label: 'Títol' 247 title_label: 'Títol'
248 url_label: 'Url' 248 url_label: 'Url'
249 # origin_url_label: 'Origin url (from where you found that entry)' 249 origin_url_label: 'Url d’origina (ont avètz trobat aqueste article)'
250 save_label: 'Enregistrar' 250 save_label: 'Enregistrar'
251 public: 251 public:
252 shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>" 252 shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>"
@@ -400,8 +400,8 @@ tag:
400 add: 'Ajustar' 400 add: 'Ajustar'
401 placeholder: "Podètz ajustar mai qu'una etiqueta, separadas per de virgula." 401 placeholder: "Podètz ajustar mai qu'una etiqueta, separadas per de virgula."
402 402
403# export: 403export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 404 footer_template: '<div style="text-align:center;"><p>Produch per wallabag amb %method%</p><p>Mercés de dobrir <a href="https://github.com/wallabag/wallabag/issues">una sollicitacion</a> s’avètz de problèmas amb l’afichatge d’aqueste E-Book sus vòstre periferic.</p></div>'
405 405
406import: 406import:
407 page_title: 'Importar' 407 page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/_bookmarklet.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/_bookmarklet.html.twig
index 3385cd53..9ebf1bed 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/_bookmarklet.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/_bookmarklet.html.twig
@@ -1 +1 @@
<a id="bookmarklet" ondragend="this.click();" href="javascript:(function(){var url=location.href||url;var wllbg=window.open('{{ url('bookmarklet') }}?url=' + encodeURI(url),'_blank');})();">bag it!</a> <a id="bookmarklet" ondragend="this.click();" href="javascript:(function(){var url=location.href||url;var wllbg=window.open('{{ url('bookmarklet') }}?url=' + encodeURIComponent(url),'_blank');})();">bag it!</a>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
index 0d05f4d5..7484d53b 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
@@ -245,7 +245,7 @@
245 <li> 245 <li>
246 <i class="material-icons" title="{{ 'entry.view.published_by'|trans }}">person</i> 246 <i class="material-icons" title="{{ 'entry.view.published_by'|trans }}">person</i>
247 {% for author in entry.publishedBy %} 247 {% for author in entry.publishedBy %}
248 {{ author }}{% if not loop.last %}, {% endif %} 248 {{ author|raw }}{% if not loop.last %}, {% endif %}
249 {% endfor %} 249 {% endfor %}
250 </li> 250 </li>
251 {% endif %} 251 {% endif %}
@@ -276,7 +276,7 @@
276 </div> 276 </div>
277 277
278 {% if entry.previewPicture is not null %} 278 {% if entry.previewPicture is not null %}
279 <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|striptags|e('html_attr') }}" /></div> 279 <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|striptags|default('entry.default_title'|trans)|raw }}" /></div>
280 {% endif %} 280 {% endif %}
281 281
282 </aside> 282 </aside>
diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.oc.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.oc.yml
index e62ea2bc..6277dc73 100644
--- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.oc.yml
+++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.oc.yml
@@ -5,7 +5,7 @@ auth_code:
5 subject: "Còdi d'autentificacion wallabag" 5 subject: "Còdi d'autentificacion wallabag"
6 body: 6 body:
7 hello: "Bonjorn %user%," 7 hello: "Bonjorn %user%,"
8 first_para: "Estant qu'avètz activat l'autentificacion en dos temps sus vòstre compte wallabag e que venètz de vos connectar dempuèi un novèl periferic (ordinador, mobil, etc.) vos mandem un còdi per validar la connexion." 8 first_para: "Estant qu'avètz activat l'autentificacion en dos temps sus vòstre compte wallabag e que venètz de vos connectar d'un novèl periferic (ordinador, mobil, etc.) vos mandem un còdi per validar la connexion."
9 second_para: "Vaquí lo còdi per dintrar : " 9 second_para: "Vaquí lo còdi per dintrar : "
10 support: "S'avètz un problèma de connexion, dobtetz pas a contactar l'assisténcia : " 10 support: "S'avètz un problèma de connexion, dobtetz pas a contactar l'assisténcia : "
11 signature: "La còla de wallabag" 11 signature: "La còla de wallabag"