createThemeFromPlugin($plugin ? $plugin : Manager::getInstance()->getThemeEnabled()); } /** * @param Plugin $plugin */ private function createThemeFromPlugin($plugin) { $this->theme = $plugin; $this->themeName = $plugin->getPluginName(); } public function getStylesheet() { if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) { return false; } $info = $this->theme->getInformation(); if (!isset($info['stylesheet'])) { return false; } $themeStylesheet = 'plugins/' . $this->theme->getPluginName() . '/' . $info['stylesheet']; return $themeStylesheet; } public function getJavaScriptFiles() { if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) { return false; } $info = $this->theme->getInformation(); if (empty($info['javascript'])) { return false; } $jsFiles = $info['javascript']; if(!is_array($jsFiles)) { $jsFiles = array($jsFiles); } foreach($jsFiles as &$jsFile) { $jsFile = 'plugins/' . $this->theme->getPluginName() . '/' . $jsFile; } return $jsFiles; } public function rewriteAssetsPathToTheme($output) { if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) { return $output; } $pattern = array( // Rewriting scripts includes to overrides '~