Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2018-08-02 00:13:15 +0300
committerStefan Giehl <stefan@piwik.org>2018-08-02 00:13:15 +0300
commit3e6356d717d9dd59a9b73a39db3f08f4c721e255 (patch)
tree537dadde8aee0cf3ae16b5bf68deb9034499b00b /plugins/PrivacyManager/PrivacyManager.php
parent1aa34c3c73d367b586682d3f778967cd6b21cc70 (diff)
Add privacy policy/terms and conditions settings and display in bottom of certain pages. (#13219)
* Add privacy policy/terms and conditions settings and display in bottom of certain pages. * tweak * simplify PrivacyManager::shouldRenderFooterLinks(). * Update system test files * removes typo * do not render view if no links available * Remove footer margin in embedded widget. * ensure footer margin doesn't change (for UI tests) * update ui files
Diffstat (limited to 'plugins/PrivacyManager/PrivacyManager.php')
-rw-r--r--plugins/PrivacyManager/PrivacyManager.php40
1 files changed, 39 insertions, 1 deletions
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php
index 8eab5017b0..c289c5e0d8 100644
--- a/plugins/PrivacyManager/PrivacyManager.php
+++ b/plugins/PrivacyManager/PrivacyManager.php
@@ -26,6 +26,7 @@ use Piwik\Plugins\Goals\Archiver;
use Piwik\Plugins\Installation\FormDefaultSettings;
use Piwik\Site;
use Piwik\Tracker\GoalManager;
+use Piwik\View;
/**
* Specifically include this for Tracker API (which does not use autoloader)
@@ -177,7 +178,8 @@ class PrivacyManager extends Plugin
'Tracker.setVisitorIp' => array($this->ipAnonymizer, 'setVisitorIpAddress'),
'Installation.defaultSettingsForm.init' => 'installationFormInit',
'Installation.defaultSettingsForm.submit' => 'installationFormSubmit',
- 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys'
+ 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
+ 'Template.pageFooter' => 'renderPrivacyPolicyLinks',
);
}
@@ -222,6 +224,7 @@ class PrivacyManager extends Plugin
$stylesheets[] = "plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.directive.less";
$stylesheets[] = "plugins/PrivacyManager/stylesheets/gdprOverview.less";
$stylesheets[] = "plugins/PrivacyManager/angularjs/anonymize-log-data/anonymize-log-data.directive.less";
+ $stylesheets[] = "plugins/PrivacyManager/stylesheets/footerLinks.less";
}
/**
@@ -601,4 +604,39 @@ class PrivacyManager extends Plugin
}
return $salt;
}
+
+ public function renderPrivacyPolicyLinks(&$out)
+ {
+ $settings = new SystemSettings();
+
+ if (!$this->shouldRenderFooterLinks($settings)) {
+ return;
+ }
+
+ $privacyPolicyUrl = $settings->privacyPolicyUrl->getValue();
+ $termsAndConditionUrl = $settings->termsAndConditionUrl->getValue();
+
+ if (empty($privacyPolicyUrl) && empty($termsAndConditionUrl)) {
+ return;
+ }
+
+ $view = new View('@PrivacyManager/footerLinks.twig');
+ $view->privacyPolicyUrl = $privacyPolicyUrl;
+ $view->termsAndCondition = $termsAndConditionUrl;
+ $out .= $view->render();
+ }
+
+ private function shouldRenderFooterLinks(SystemSettings $settings)
+ {
+ if (Piwik::getCurrentUserLogin() == 'anonymous') {
+ return true;
+ }
+
+ $module = Common::getRequestVar('module', false);
+ if ($module == 'Widgetize') {
+ return (bool)$settings->showInEmbeddedWidgets->getValue();
+ }
+
+ return false;
+ }
}