public function activate($redirectAfter = true)
{
$pluginName = $this->initPluginModification(static::ACTIVATE_NONCE);
$this->dieIfPluginsAdminIsDisabled();
$this->pluginManager->activatePlugin($pluginName);
if ($redirectAfter) {
$message = $this->translator->translate('CorePluginsAdmin_SuccessfullyActicated', array($pluginName));
if ($this->settingsProvider->getSystemSettings($pluginName)) {
$target = sprintf('<a href="index.php%s#%s">', Url::getCurrentQueryStringWithParametersModified(array('module' => 'CoreAdminHome', 'action' => 'generalSettings')), $pluginName);
$message .= ' ' . $this->translator->translate('CorePluginsAdmin_ChangeSettingsPossible', array($target, '</a>'));
}
$notification = new Notification($message);
$notification->raw = true;
$notification->title = $this->translator->translate('General_WellDone');
$notification->context = Notification::CONTEXT_SUCCESS;
Notification\Manager::notify('CorePluginsAdmin_PluginActivated', $notification);
$redirectTo = Common::getRequestVar('redirectTo', '', 'string');
if (!empty($redirectTo) && $redirectTo === 'marketplace') {
$this->redirectToIndex('Marketplace', 'overview');
} elseif (!empty($redirectTo) && $redirectTo === 'referrer') {
$this->redirectAfterModification($redirectAfter);
} else {
$plugin = $this->pluginManager->loadPlugin($pluginName);
$actionToRedirect = 'plugins';
if ($plugin->isTheme()) {
$actionToRedirect = 'themes';
}
$this->redirectToIndex('CorePluginsAdmin', $actionToRedirect);
}
}
}