Example #1
0
 public function pluginDetails()
 {
     $view = $this->configureViewAndCheckPermission('@Marketplace/plugin-details');
     $pluginName = new PluginName();
     $pluginName = $pluginName->getPluginName();
     $activeTab = Common::getRequestVar('activeTab', '', 'string');
     if ('changelog' !== $activeTab) {
         $activeTab = '';
     }
     try {
         $plugin = $this->plugins->getPluginInfo($pluginName);
         if (empty($plugin['name'])) {
             throw new Exception('Plugin does not exist');
         }
     } catch (Exception $e) {
         $plugin = null;
         $view->errorMessage = $e->getMessage();
     }
     $view->plugin = $plugin;
     $view->isSuperUser = Piwik::hasUserSuperUserAccess();
     $view->installNonce = Nonce::getNonce(static::INSTALL_NONCE);
     $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE);
     $view->activeTab = $activeTab;
     $view->isAutoUpdatePossible = SettingsPiwik::isAutoUpdatePossible();
     $view->isAutoUpdateEnabled = SettingsPiwik::isAutoUpdateEnabled();
     $view->numUsers = $this->environment->getNumUsers();
     return $view->render();
 }
Example #2
0
 /**
  * @param  $pluginOrThemeName
  * @throws Exception
  * @return string
  */
 public function getDownloadUrl($pluginOrThemeName)
 {
     $plugin = $this->getPluginInfo($pluginOrThemeName);
     if (empty($plugin['versions'])) {
         throw new Exception('Plugin has no versions.');
     }
     $latestVersion = array_pop($plugin['versions']);
     $downloadUrl = $latestVersion['download'];
     return $this->service->getDomain() . $downloadUrl . '?coreVersion=' . $this->environment->getPiwikVersion();
 }
Example #3
0
 public function setEnvironment(Environment $environment)
 {
     $this->setPiwikVersion($environment->getPiwikVersion());
     $this->setPhpVersion($environment->getPhpVersion());
 }