本文整理匯總了PHP中Gdn_ApplicationManager::enableApplication方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_ApplicationManager::enableApplication方法的具體用法?PHP Gdn_ApplicationManager::enableApplication怎麽用?PHP Gdn_ApplicationManager::enableApplication使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gdn_ApplicationManager
的用法示例。
在下文中一共展示了Gdn_ApplicationManager::enableApplication方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: applications
/**
* Application management screen.
*
* @since 2.0.0
* @access public
* @param string $Filter 'enabled', 'disabled', or 'all' (default)
* @param string $ApplicationName Unique ID of app to be modified.
* @param string $TransientKey Security token.
*/
public function applications($Filter = '', $ApplicationName = '', $TransientKey = '')
{
$this->permission('Garden.Settings.Manage');
// Page setup
$this->addJsFile('addons.js');
$this->addJsFile('applications.js');
$this->title(t('Applications'));
$this->addSideMenu('dashboard/settings/applications');
// Validate & set parameters
$Session = Gdn::session();
if ($ApplicationName && !$Session->validateTransientKey($TransientKey)) {
$ApplicationName = '';
}
if (!in_array($Filter, array('enabled', 'disabled'))) {
$Filter = 'all';
}
$this->Filter = $Filter;
$ApplicationManager = new Gdn_ApplicationManager();
$this->AvailableApplications = $ApplicationManager->availableVisibleApplications();
$this->EnabledApplications = $ApplicationManager->enabledVisibleApplications();
if ($ApplicationName != '') {
$this->EventArguments['ApplicationName'] = $ApplicationName;
if (array_key_exists($ApplicationName, $this->EnabledApplications) === true) {
try {
$ApplicationManager->disableApplication($ApplicationName);
Gdn_LibraryMap::clearCache();
$this->fireEvent('AfterDisableApplication');
} catch (Exception $e) {
$this->Form->addError(strip_tags($e->getMessage()));
}
} else {
try {
$ApplicationManager->checkRequirements($ApplicationName);
} catch (Exception $e) {
$this->Form->addError(strip_tags($e->getMessage()));
}
if ($this->Form->errorCount() == 0) {
$Validation = new Gdn_Validation();
$ApplicationManager->registerPermissions($ApplicationName, $Validation);
$ApplicationManager->enableApplication($ApplicationName, $Validation);
Gdn_LibraryMap::clearCache();
$this->Form->setValidationResults($Validation->results());
$this->EventArguments['Validation'] = $Validation;
$this->fireEvent('AfterEnableApplication');
}
}
if ($this->Form->errorCount() == 0) {
redirect('settings/applications/' . $this->Filter);
}
}
$this->render();
}