From 6624e27e575d6056da7881bc05e9972c50ec1128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Moumn=C3=A9?= Date: Tue, 17 Dec 2013 17:52:36 +0100 Subject: fixes #4373, #1640 --- core/Theme.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'core/Theme.php') diff --git a/core/Theme.php b/core/Theme.php index 699783ae46..785d37382f 100644 --- a/core/Theme.php +++ b/core/Theme.php @@ -10,6 +10,8 @@ */ namespace Piwik; +use Piwik\Plugin\Manager; + /** * This class contains logic to make Themes work beautifully. * @@ -23,10 +25,21 @@ class Theme /** @var \Piwik\Plugin */ private $theme; - public function __construct() + /** + * @var Plugin $plugin + */ + public function __construct($plugin = false) + { + $this->createThemeFromPlugin($plugin ? $plugin : Manager::getInstance()->getThemeEnabled()); + } + + /** + * @param Plugin $plugin + */ + private function createThemeFromPlugin($plugin) { - $this->theme = \Piwik\Plugin\Manager::getInstance()->getThemeEnabled(); - $this->themeName = $this->theme->getPluginName(); + $this->theme = $plugin; + $this->themeName = $plugin->getPluginName(); } public function getStylesheet() @@ -123,4 +136,11 @@ class Theme return $source; } + /** + * @return string + */ + public function getThemeName() + { + return $this->themeName; + } } \ No newline at end of file -- cgit v1.2.3