diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml index 1c47ed2d2..719e51eab 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml @@ -22,3 +22,6 @@ export: "export" import: "import" misc: "misc" modify_settings: "apply" +piwik_host: Host of your website in Piwik +piwik_site_id: ID of your website in Piwik +piwik_enabled: Enable Piwik diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml index ddb78a13a..ab5dfc721 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml @@ -22,3 +22,6 @@ export: "export" import: "import" misc: "divers" modify_settings: "appliquer" +piwik_host: URL de votre site dans Piwik +piwik_site_id: ID de votre site dans Piwik +piwik_enabled: Activer Piwik diff --git a/app/config/services.yml b/app/config/services.yml index 80d6c1a1a..71862fd25 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -19,6 +19,14 @@ services: tags: - { name: twig.extension } + wallabag.twig_piwik_extension: + class: Wallabag\CoreBundle\Twig\WallabagPiwikExtension + public: false + arguments: + - "@craue_config" + tags: + - { name: twig.extension } + wallabag.locale_listener: class: Wallabag\CoreBundle\EventListener\LocaleListener arguments: ["%kernel.default_locale%"] diff --git a/composer.json b/composer.json index 497b80121..c65ebda1b 100644 --- a/composer.json +++ b/composer.json @@ -64,7 +64,8 @@ "guzzlehttp/guzzle": "^5.2.0", "doctrine/doctrine-migrations-bundle": "^1.0", "paragonie/random_compat": "~1.0", - "craue/config-bundle": "~1.4" + "craue/config-bundle": "~1.4", + "mnapoli/piwik-twig-extension": "^1.0" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "~2.2", diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index b3e20ceb0..93520f9a8 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -312,6 +312,21 @@ class InstallCommand extends ContainerAwareCommand 'value' => 'http://v2.wallabag.org', 'section' => 'misc', ], + [ + 'name' => 'piwik_enabled', + 'value' => '0', + 'section' => 'analytics', + ], + [ + 'name' => 'piwik_host', + 'value' => 'http://v2.wallabag.org', + 'section' => 'analytics', + ], + [ + 'name' => 'piwik_site_id', + 'value' => '1', + 'section' => 'analytics', + ], ]; foreach ($settings as $setting) { diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index 5e89c2a98..10b60f300 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 'value' => 'http://v2.wallabag.org', 'section' => 'misc', ], + [ + 'name' => 'piwik_enabled', + 'value' => '0', + 'section' => 'analytics', + ], + [ + 'name' => 'piwik_host', + 'value' => 'http://v2.wallabag.org', + 'section' => 'analytics', + ], + [ + 'name' => 'piwik_site_id', + 'value' => '1', + 'section' => 'analytics', + ], ]; 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 1742b4aa6..8ca217283 100644 --- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig @@ -71,5 +71,6 @@
You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to our issues list and open a new if necessary
+ {{ piwik() }} diff --git a/src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php new file mode 100644 index 000000000..7725cd809 --- /dev/null +++ b/src/Wallabag/CoreBundle/Twig/WallabagPiwikExtension.php @@ -0,0 +1,14 @@ +get('piwik_host'), $craueConfig->get('piwik_site_id'), $craueConfig->get('piwik_enabled')); + } +}