Exemplo n.º 1
0
 protected function prepareDispatch($module, $action, $parameters)
 {
     if (is_null($module)) {
         $module = Common::getRequestVar('module', self::DEFAULT_MODULE, 'string');
     }
     if (is_null($action)) {
         $action = Common::getRequestVar('action', false);
     }
     if (SettingsPiwik::isPiwikInstalled() && ($module !== 'API' || $action && $action !== 'index')) {
         Session::start();
     }
     if (is_null($parameters)) {
         $parameters = array();
     }
     if (!ctype_alnum($module)) {
         throw new Exception("Invalid module name '{$module}'");
     }
     $module = Request::renameModule($module);
     if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated($module)) {
         throw new PluginDeactivatedException($module);
     }
     return array($module, $action, $parameters);
 }
Exemplo n.º 2
0
 protected function getPluginsInfo($themesOnly = false)
 {
     $pluginManager = \Piwik\Plugin\Manager::getInstance();
     $plugins = $pluginManager->returnLoadedPluginsInfo();
     foreach ($plugins as $pluginName => &$plugin) {
         $plugin['isCorePlugin'] = $pluginManager->isPluginBundledWithCore($pluginName);
         if (!isset($plugin['info'])) {
             $suffix = Piwik::translate('CorePluginsAdmin_PluginNotWorkingAlternative');
             // If the plugin has been renamed, we do not show message to ask user to update plugin
             if ($pluginName != Request::renameModule($pluginName)) {
                 $suffix = "You may uninstall the plugin or manually delete the files in piwik/plugins/{$pluginName}/";
             }
             $description = '<strong><em>' . Piwik::translate('CorePluginsAdmin_PluginNotCompatibleWith', array($pluginName, self::getPiwikVersion())) . '</strong><br/>' . $suffix . '</em>';
             $plugin['info'] = array('description' => $description, 'version' => Piwik::translate('General_Unknown'), 'theme' => false);
         }
     }
     $pluginsFiltered = $this->keepPluginsOrThemes($themesOnly, $plugins);
     return $pluginsFiltered;
 }