Returns the plugin's base class name without the namespace,
e.g., "UserCountry" when the plugin class is "Piwik\Plugins\UserCountry\UserCountry".
final public getPluginName ( ) : string | ||
Результат | string |
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; }
/** * @param Plugin $plugin */ private function createThemeFromPlugin($plugin) { $this->theme = $plugin; $this->themeName = $plugin->getPluginName(); }
/** * Install a plugin, if necessary * * @param Plugin $plugin */ private function installPluginIfNecessary(Plugin $plugin) { $pluginName = $plugin->getPluginName(); $saveConfig = false; // is the plugin already installed or is it the first time we activate it? $pluginsInstalled = $this->getInstalledPluginsName(); if (!$this->isPluginInstalled($pluginName)) { $this->executePluginInstall($plugin); $pluginsInstalled[] = $pluginName; $this->updatePluginsInstalledConfig($pluginsInstalled); $updater = new Updater(); $updater->markComponentSuccessfullyUpdated($plugin->getPluginName(), $plugin->getVersion()); $saveConfig = true; } if ($saveConfig) { PiwikConfig::getInstance()->forceSave(); } }
public function getThemeName() { return $this->plugin->getPluginName(); }
public function isTrackerPlugin(Plugin $plugin) { if (!$this->isPluginInstalled($plugin->getPluginName())) { return false; } if ($plugin->isTrackerPlugin()) { return true; } $dimensions = VisitDimension::getDimensions($plugin); if (!empty($dimensions)) { return true; } $dimensions = ActionDimension::getDimensions($plugin); if (!empty($dimensions)) { return true; } $hooks = $plugin->getListHooksRegistered(); $hookNames = array_keys($hooks); foreach ($hookNames as $name) { if (strpos($name, self::TRACKER_EVENT_PREFIX) === 0) { return true; } if ($name === 'Request.initAuthenticationObject') { return true; } } $dimensions = ConversionDimension::getDimensions($plugin); if (!empty($dimensions)) { return true; } return false; }
/** * create template loader for a custom theme * @param \Piwik\Plugin $theme * @return \Twig_Loader_Filesystem */ protected function getCustomThemeLoader(Plugin $theme) { if (!file_exists(sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, $theme->getPluginName()))) { return false; } $themeLoader = new Twig_Loader_Filesystem(array(sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, $theme->getPluginName()))); return $themeLoader; }
/** * Install a plugin, if necessary * * @param Plugin $plugin */ private function installPluginIfNecessary(Plugin $plugin) { $pluginName = $plugin->getPluginName(); $saveConfig = false; // is the plugin already installed or is it the first time we activate it? $pluginsInstalled = $this->getInstalledPluginsName(); if (!$this->isPluginInstalled($pluginName)) { $this->executePluginInstall($plugin); $pluginsInstalled[] = $pluginName; $this->updatePluginsInstalledConfig($pluginsInstalled); Updater::recordComponentSuccessfullyUpdated($plugin->getPluginName(), $plugin->getVersion()); $saveConfig = true; } if ($this->isTrackerPlugin($plugin)) { $pluginsTracker = PiwikConfig::getInstance()->Plugins_Tracker['Plugins_Tracker']; if (is_null($pluginsTracker)) { $pluginsTracker = array(); } if (!in_array($pluginName, $pluginsTracker)) { $pluginsTracker[] = $pluginName; $this->updatePluginsTrackerConfig($pluginsTracker); $saveConfig = true; } } if ($saveConfig) { PiwikConfig::getInstance()->forceSave(); } }