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:
Diffstat (limited to 'core/Theme.php')
-rw-r--r--core/Theme.php26
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