diff options
author | Julien Moumné <julien@piwik.org> | 2013-12-17 20:52:36 +0400 |
---|---|---|
committer | Julien Moumné <julien@piwik.org> | 2013-12-17 20:52:36 +0400 |
commit | 6624e27e575d6056da7881bc05e9972c50ec1128 (patch) | |
tree | 06bec63f550d16ccc8a428d40a79604496ce0985 /core/Theme.php | |
parent | 5d44202fb79a9b2aa70b00ec88fd316f83a440b0 (diff) |
fixes #4373, #1640
Diffstat (limited to 'core/Theme.php')
-rw-r--r-- | core/Theme.php | 26 |
1 files changed, 23 insertions, 3 deletions
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 |