aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/RssController.php1
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php49
-rw-r--r--src/Wallabag/CoreBundle/Helper/DownloadImages.php36
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml8
-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
7 files changed, 92 insertions, 14 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php
index e84044b1..848bb814 100644
--- a/src/Wallabag/CoreBundle/Controller/RssController.php
+++ b/src/Wallabag/CoreBundle/Controller/RssController.php
@@ -12,7 +12,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12use Symfony\Component\HttpFoundation\Request; 12use Symfony\Component\HttpFoundation\Request;
13use Symfony\Component\HttpFoundation\Response; 13use Symfony\Component\HttpFoundation\Response;
14use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 14use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
15use Wallabag\CoreBundle\Entity\Entry;
16use Wallabag\CoreBundle\Entity\Tag; 15use Wallabag\CoreBundle\Entity\Tag;
17use Wallabag\UserBundle\Entity\User; 16use Wallabag\UserBundle\Entity\User;
18 17
diff --git a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
new file mode 100644
index 00000000..7aa2409a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
@@ -0,0 +1,49 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface
11{
12 const UN_ESCAPED_TABLE = true;
13
14 /**
15 * @var ContainerInterface
16 */
17 protected $container;
18
19 // because there are declared as abstract in `AbstractMigration` we need to delarer here too
20 public function up(Schema $schema)
21 {
22 }
23
24 public function down(Schema $schema)
25 {
26 }
27
28 public function setContainer(ContainerInterface $container = null)
29 {
30 $this->container = $container;
31 }
32
33 protected function getTable($tableName, $unEscaped = false)
34 {
35 $table = $this->container->getParameter('database_table_prefix') . $tableName;
36
37 if (self::UN_ESCAPED_TABLE === $unEscaped) {
38 return $table;
39 }
40
41 // escape table name is handled using " on postgresql
42 if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
43 return '"' . $table . '"';
44 }
45
46 // return escaped table
47 return '`' . $table . '`';
48 }
49}
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.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 0a65ce9f..88517c82 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -265,7 +265,7 @@ about:
265 who_behind_wallabag: 265 who_behind_wallabag:
266 developped_by: 'Developed by' 266 developped_by: 'Developed by'
267 website: 'website' 267 website: 'website'
268 many_contributors: 'And many others contributors ♥ <a href="https://github.com/wallabag/wallabag/graphs/contributors">on Github</a>' 268 many_contributors: 'And many others contributors ♥ <a href="https://github.com/wallabag/wallabag/graphs/contributors">on GitHub</a>'
269 project_website: 'Project website' 269 project_website: 'Project website'
270 license: 'License' 270 license: 'License'
271 version: 'Version' 271 version: 'Version'
@@ -323,7 +323,7 @@ howto:
323 go_import: Go to import 323 go_import: Go to import
324 go_developers: Go to developers 324 go_developers: Go to developers
325 go_howto: Go to howto (this page!) 325 go_howto: Go to howto (this page!)
326 go_logout: Logout 326 go_logout: Log out
327 list_title: Shortcuts available in listing pages 327 list_title: Shortcuts available in listing pages
328 search: Display the search form 328 search: Display the search form
329 article_title: Shortcuts available in entry view 329 article_title: Shortcuts available in entry view
@@ -373,7 +373,7 @@ quickstart:
373 instapaper: 'Migrate from Instapaper' 373 instapaper: 'Migrate from Instapaper'
374 developer: 374 developer:
375 title: 'Developers' 375 title: 'Developers'
376 description: 'We also thought to the developers: Docker, API, translations, etc.' 376 description: 'We also thought of the developers: Docker, API, translations, etc.'
377 create_application: 'Create your third-party application' 377 create_application: 'Create your third-party application'
378 use_docker: 'Use Docker to install wallabag' 378 use_docker: 'Use Docker to install wallabag'
379 docs: 379 docs:
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/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"