本文整理汇总了PHP中Gdn_ApplicationManager::checkRequirements方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_ApplicationManager::checkRequirements方法的具体用法?PHP Gdn_ApplicationManager::checkRequirements怎么用?PHP Gdn_ApplicationManager::checkRequirements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_ApplicationManager
的用法示例。
在下文中一共展示了Gdn_ApplicationManager::checkRequirements方法的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();
}