aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2016-02-19 15:27:57 +0100
committerNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2016-02-19 15:27:57 +0100
commit07643dde08a7cd3f5a556021643e64dd1d5e89f2 (patch)
treef8767b88b8913ad7464e6553d2a2e5c1a82c0146
parentfa64d861105bd0713acd7ac5d116353273524b4f (diff)
downloadwallabag-07643dde08a7cd3f5a556021643e64dd1d5e89f2.tar.gz
wallabag-07643dde08a7cd3f5a556021643e64dd1d5e89f2.tar.zst
wallabag-07643dde08a7cd3f5a556021643e64dd1d5e89f2.zip
Fix #1137: implemented Piwik
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml3
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml3
-rw-r--r--app/config/services.yml8
-rw-r--r--composer.json3
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php15
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php15
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/base.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php14
8 files changed, 61 insertions, 1 deletions
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
index 1c47ed2d..719e51ea 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
@@ -22,3 +22,6 @@ export: "export"
22import: "import" 22import: "import"
23misc: "misc" 23misc: "misc"
24modify_settings: "apply" 24modify_settings: "apply"
25piwik_host: Host of your website in Piwik
26piwik_site_id: ID of your website in Piwik
27piwik_enabled: Enable Piwik
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
index ddb78a13..ab5dfc72 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
@@ -22,3 +22,6 @@ export: "export"
22import: "import" 22import: "import"
23misc: "divers" 23misc: "divers"
24modify_settings: "appliquer" 24modify_settings: "appliquer"
25piwik_host: URL de votre site dans Piwik
26piwik_site_id: ID de votre site dans Piwik
27piwik_enabled: Activer Piwik
diff --git a/app/config/services.yml b/app/config/services.yml
index 80d6c1a1..71862fd2 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -19,6 +19,14 @@ services:
19 tags: 19 tags:
20 - { name: twig.extension } 20 - { name: twig.extension }
21 21
22 wallabag.twig_piwik_extension:
23 class: Wallabag\CoreBundle\Twig\WallabagPiwikExtension
24 public: false
25 arguments:
26 - "@craue_config"
27 tags:
28 - { name: twig.extension }
29
22 wallabag.locale_listener: 30 wallabag.locale_listener:
23 class: Wallabag\CoreBundle\EventListener\LocaleListener 31 class: Wallabag\CoreBundle\EventListener\LocaleListener
24 arguments: ["%kernel.default_locale%"] 32 arguments: ["%kernel.default_locale%"]
diff --git a/composer.json b/composer.json
index 497b8012..c65ebda1 100644
--- a/composer.json
+++ b/composer.json
@@ -64,7 +64,8 @@
64 "guzzlehttp/guzzle": "^5.2.0", 64 "guzzlehttp/guzzle": "^5.2.0",
65 "doctrine/doctrine-migrations-bundle": "^1.0", 65 "doctrine/doctrine-migrations-bundle": "^1.0",
66 "paragonie/random_compat": "~1.0", 66 "paragonie/random_compat": "~1.0",
67 "craue/config-bundle": "~1.4" 67 "craue/config-bundle": "~1.4",
68 "mnapoli/piwik-twig-extension": "^1.0"
68 }, 69 },
69 "require-dev": { 70 "require-dev": {
70 "doctrine/doctrine-fixtures-bundle": "~2.2", 71 "doctrine/doctrine-fixtures-bundle": "~2.2",
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index b3e20ceb..93520f9a 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -312,6 +312,21 @@ class InstallCommand extends ContainerAwareCommand
312 'value' => 'http://v2.wallabag.org', 312 'value' => 'http://v2.wallabag.org',
313 'section' => 'misc', 313 'section' => 'misc',
314 ], 314 ],
315 [
316 'name' => 'piwik_enabled',
317 'value' => '0',
318 'section' => 'analytics',
319 ],
320 [
321 'name' => 'piwik_host',
322 'value' => 'http://v2.wallabag.org',
323 'section' => 'analytics',
324 ],
325 [
326 'name' => 'piwik_site_id',
327 'value' => '1',
328 'section' => 'analytics',
329 ],
315 ]; 330 ];
316 331
317 foreach ($settings as $setting) { 332 foreach ($settings as $setting) {
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
index 5e89c2a9..10b60f30 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
@@ -110,6 +110,21 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
110 'value' => 'http://v2.wallabag.org', 110 'value' => 'http://v2.wallabag.org',
111 'section' => 'misc', 111 'section' => 'misc',
112 ], 112 ],
113 [
114 'name' => 'piwik_enabled',
115 'value' => '0',
116 'section' => 'analytics',
117 ],
118 [
119 'name' => 'piwik_host',
120 'value' => 'http://v2.wallabag.org',
121 'section' => 'analytics',
122 ],
123 [
124 'name' => 'piwik_site_id',
125 'value' => '1',
126 'section' => 'analytics',
127 ],
113 ]; 128 ];
114 129
115 foreach ($settings as $setting) { 130 foreach ($settings as $setting) {
diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
index 1742b4aa..8ca21728 100644
--- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
@@ -71,5 +71,6 @@
71 <div id="warning_message"> 71 <div id="warning_message">
72 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a> 72 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a>
73 </div> 73 </div>
74 {{ piwik() }}
74 </body> 75 </body>
75</html> 76</html>
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php
new file mode 100644
index 00000000..7725cd80
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php
@@ -0,0 +1,14 @@
1<?php
2
3namespace Wallabag\CoreBundle\Twig;
4
5use Craue\ConfigBundle\Util\Config;
6use PiwikTwigExtension\PiwikTwigExtension;
7
8class WallabagPiwikExtension extends PiwikTwigExtension
9{
10 public function __construct(Config $craueConfig)
11 {
12 parent::__construct($craueConfig->get('piwik_host'), $craueConfig->get('piwik_site_id'), $craueConfig->get('piwik_enabled'));
13 }
14}