From f97634ef73fff132e3ad295af76c69b5462542ca Mon Sep 17 00:00:00 2001 From: Gregor Aisch Date: Mon, 6 May 2013 10:37:03 +0200 Subject: [PATCH 1/3] Custom styling for opt-out page --- plugins/CoreAdminHome/Controller.php | 5 +++++ plugins/CoreAdminHome/templates/optOut.twig | 3 +++ 2 files changed, 8 insertions(+) diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index cb914716cf3..2eff8d41857 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -174,6 +174,11 @@ public function optOut() $trackVisits = !$trackVisits; } + // $customStyle = Piwik_Common::getRequestVar('style', false); + // if (!empty($customStyle)) { + // $view->customStyle = str_replace(array('.', '/', ':'), '_', $customStyle); + // } + $view = new Piwik_View('@CoreAdminHome/optOut'); $view->trackVisits = $trackVisits; $view->nonce = Piwik_Nonce::getNonce('Piwik_OptOut', 3600); diff --git a/plugins/CoreAdminHome/templates/optOut.twig b/plugins/CoreAdminHome/templates/optOut.twig index c2a41f2fb75..c39a2b3db0f 100644 --- a/plugins/CoreAdminHome/templates/optOut.twig +++ b/plugins/CoreAdminHome/templates/optOut.twig @@ -3,6 +3,9 @@ + {% if customStyle %} + + {% endif %} {% if not trackVisits %} From b457188f329509d92c05656cc01fe863dd5c5a8a Mon Sep 17 00:00:00 2001 From: Gregor Aisch Date: Mon, 6 May 2013 10:41:28 +0200 Subject: [PATCH 2/3] custom styles for opt-out page --- plugins/CoreAdminHome/Controller.php | 11 +++++++---- plugins/CoreAdminHome/templates/optOut.twig | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 2eff8d41857..a12dfa4d78d 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -174,10 +174,13 @@ public function optOut() $trackVisits = !$trackVisits; } - // $customStyle = Piwik_Common::getRequestVar('style', false); - // if (!empty($customStyle)) { - // $view->customStyle = str_replace(array('.', '/', ':'), '_', $customStyle); - // } + $customStyle = Piwik_Common::getRequestVar('style', false); + if (!empty($customStyle)) { + $customStyle = 'optout_' . str_replace(array('.', '/', ':'), '_', $customStyle) . '.css'; + if (file_exists(PIWIK_DOCUMENT_ROOT . '/themes/' . $customStyle)) { + $view->customStyle = $customStyle; + } + } $view = new Piwik_View('@CoreAdminHome/optOut'); $view->trackVisits = $trackVisits; diff --git a/plugins/CoreAdminHome/templates/optOut.twig b/plugins/CoreAdminHome/templates/optOut.twig index c39a2b3db0f..ce32750dcfe 100644 --- a/plugins/CoreAdminHome/templates/optOut.twig +++ b/plugins/CoreAdminHome/templates/optOut.twig @@ -4,7 +4,7 @@ {% if customStyle %} - + {% endif %} From e8694b9f64138b6746d0af57ac741ea200155961 Mon Sep 17 00:00:00 2001 From: Gregor Aisch Date: Mon, 6 May 2013 10:50:22 +0200 Subject: [PATCH 3/3] custom style for opt-out page --- plugins/CoreAdminHome/Controller.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index a12dfa4d78d..eb1082baabb 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -174,6 +174,13 @@ public function optOut() $trackVisits = !$trackVisits; } + $view = new Piwik_View('@CoreAdminHome/optOut'); + $view->trackVisits = $trackVisits; + $view->nonce = Piwik_Nonce::getNonce('Piwik_OptOut', 3600); + $view->language = Piwik_LanguagesManager_API::getInstance()->isLanguageAvailable($language) + ? $language + : Piwik_LanguagesManager::getLanguageCodeForCurrentUser(); + $customStyle = Piwik_Common::getRequestVar('style', false); if (!empty($customStyle)) { $customStyle = 'optout_' . str_replace(array('.', '/', ':'), '_', $customStyle) . '.css'; @@ -182,12 +189,6 @@ public function optOut() } } - $view = new Piwik_View('@CoreAdminHome/optOut'); - $view->trackVisits = $trackVisits; - $view->nonce = Piwik_Nonce::getNonce('Piwik_OptOut', 3600); - $view->language = Piwik_LanguagesManager_API::getInstance()->isLanguageAvailable($language) - ? $language - : Piwik_LanguagesManager::getLanguageCodeForCurrentUser(); echo $view->render(); }