当前位置: 首页>>代码示例>>PHP>>正文


PHP Gdn_ApplicationManager::EnableApplication方法代码示例

本文整理汇总了PHP中Gdn_ApplicationManager::EnableApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_ApplicationManager::EnableApplication方法的具体用法?PHP Gdn_ApplicationManager::EnableApplication怎么用?PHP Gdn_ApplicationManager::EnableApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdn_ApplicationManager的用法示例。


在下文中一共展示了Gdn_ApplicationManager::EnableApplication方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
 }
开发者ID:embo-hd,项目名称:vanilla,代码行数:61,代码来源:class.settingscontroller.php

示例2: index

 /**
  * The summary of all settings available.
  *
  * The menu items displayed here are collected from each application's
  * application controller and all plugin's definitions.
  *
  * @since 2.0.0
  * @access public
  */
 public function index()
 {
     $this->ApplicationFolder = 'dashboard';
     $this->MasterView = 'setup';
     // Fatal error if Garden has already been installed.
     $Installed = c('Garden.Installed');
     if ($Installed) {
         $this->View = "AlreadyInstalled";
         $this->render();
         return;
     }
     if (!$this->_CheckPrerequisites()) {
         $this->View = 'prerequisites';
     } else {
         $this->View = 'configure';
         // Make sure the user has copied the htaccess file over.
         if (!file_exists(PATH_ROOT . '/.htaccess') && !$this->Form->getFormValue('SkipHtaccess')) {
             $this->setData('NoHtaccess', true);
             $this->Form->addError(t('You are missing Vanilla\'s .htaccess file.', 'You are missing Vanilla\'s <b>.htaccess</b> file. Sometimes this file isn\'t copied if you are using ftp to upload your files because this file is hidden. Make sure you\'ve copied the <b>.htaccess</b> file before continuing.'));
         }
         $ApplicationManager = new Gdn_ApplicationManager();
         // Need to go through all of the setups for each application. Garden,
         if ($this->configure() && $this->Form->isPostBack()) {
             // Get list of applications to enable during install
             // Override by creating the config and adding this setting before install begins
             $AppNames = c('Garden.Install.Applications', array('Conversations', 'Vanilla'));
             try {
                 // Step through the available applications, enabling each of them.
                 foreach ($AppNames as $AppName) {
                     $Validation = new Gdn_Validation();
                     $ApplicationManager->RegisterPermissions($AppName, $Validation);
                     $ApplicationManager->EnableApplication($AppName, $Validation);
                 }
                 Gdn::pluginManager()->start(true);
             } catch (Exception $ex) {
                 $this->Form->addError($ex);
             }
             if ($this->Form->errorCount() == 0) {
                 // Save a variable so that the application knows it has been installed.
                 // Now that the application is installed, select a more user friendly error page.
                 $Config = array('Garden.Installed' => true);
                 saveToConfig($Config);
                 $this->fireAs('UpdateModel')->fireEvent('AfterStructure');
                 $this->fireEvent('Installed');
                 // Go to the dashboard
                 redirect('/settings/gettingstarted');
             }
         }
     }
     $this->render();
 }
开发者ID:dimassrio,项目名称:vanilla,代码行数:60,代码来源:class.setupcontroller.php

示例3: Index

 /**
  * The summary of all settings available. The menu items displayed here are
  * collected from each application's application controller and all plugin's
  * definitions.
  */
 public function Index()
 {
     $this->ApplicationFolder = 'dashboard';
     $this->MasterView = 'setup';
     // Fatal error if Garden has already been installed.
     $Installed = Gdn::Config('Garden.Installed') ? TRUE : FALSE;
     if ($Installed) {
         throw new Exception('Vanilla has already been installed.');
     }
     if (!$this->_CheckPrerequisites()) {
         $this->View = 'prerequisites';
     } else {
         $this->View = 'configure';
         // Make sure the user has copied the htaccess file over.
         if (!file_exists(PATH_ROOT . '/.htaccess') && !$this->Form->GetFormValue('SkipHtaccess')) {
             $this->SetData('NoHtaccess', TRUE);
             $this->Form->AddError(T('You are missing Vanilla\'s .htaccess file.', 'You are missing Vanilla\'s <b>.htaccess</b> file. Sometimes this file isn\'t copied if you are using ftp to upload your files because this file is hidden. Make sure you\'ve copied the <b>.htaccess</b> file before continuing.'));
         }
         $ApplicationManager = new Gdn_ApplicationManager();
         $AvailableApplications = $ApplicationManager->AvailableApplications();
         // Need to go through all of the setups for each application. Garden,
         if ($this->Configure() && $this->Form->IsPostBack()) {
             // Step through the available applications, enabling each of them
             $AppNames = array_keys($AvailableApplications);
             try {
                 foreach ($AvailableApplications as $AppName => $AppInfo) {
                     if (strtolower($AppName) != 'dashboard') {
                         $Validation = new Gdn_Validation();
                         $ApplicationManager->RegisterPermissions($AppName, $Validation);
                         $ApplicationManager->EnableApplication($AppName, $Validation);
                     }
                 }
             } catch (Exception $ex) {
                 $this->Form->AddError($ex);
             }
             if ($this->Form->ErrorCount() == 0) {
                 // Save a variable so that the application knows it has been installed.
                 // Now that the application is installed, select a more user friendly error page.
                 $Config = array('Garden.Installed' => TRUE);
                 if (!defined('DEBUG')) {
                     $Config['Garden.Errors.MasterView'] = 'error.master.php';
                 }
                 SaveToConfig($Config);
                 // Go to the dashboard
                 Redirect('/settings');
             }
         }
     }
     $this->Render();
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:55,代码来源:class.setupcontroller.php

示例4: Index

 /**
  * The summary of all settings available. The menu items displayed here are
  * collected from each application's application controller and all plugin's
  * definitions.
  */
 public function Index()
 {
     $this->ApplicationFolder = 'dashboard';
     $this->MasterView = 'setup';
     // Fatal error if Garden has already been installed.
     $Config = Gdn::Factory(Gdn::AliasConfig);
     $Installed = Gdn::Config('Garden.Installed') ? TRUE : FALSE;
     if ($Installed) {
         throw new Exception('Vanilla has already been installed.');
     }
     if (!$this->_CheckPrerequisites()) {
         $this->View = 'prerequisites';
     } else {
         $this->View = 'configure';
         $ApplicationManager = new Gdn_ApplicationManager();
         $AvailableApplications = $ApplicationManager->AvailableApplications();
         // Need to go through all of the setups for each application. Garden,
         if ($this->Configure() && $this->Form->IsPostBack()) {
             // Step through the available applications, enabling each of them
             $AppNames = array_keys($AvailableApplications);
             try {
                 foreach ($AvailableApplications as $AppName => $AppInfo) {
                     if (strtolower($AppName) != 'dashboard') {
                         $Validation = new Gdn_Validation();
                         $ApplicationManager->RegisterPermissions($AppName, $Validation);
                         $ApplicationManager->EnableApplication($AppName, $Validation);
                     }
                 }
             } catch (Exception $ex) {
                 $this->Form->AddError($ex);
             }
             if ($this->Form->ErrorCount() == 0) {
                 // Save a variable so that the application knows it has been installed.
                 // Now that the application is installed, select a more user friendly error page.
                 $Config = array('Garden.Installed' => TRUE);
                 if (!defined('DEBUG')) {
                     $Config['Garden.Errors.MasterView'] = 'error.master.php';
                 }
                 SaveToConfig($Config);
                 // Go to the dashboard
                 Redirect('/settings');
             }
         }
     }
     $this->Render();
 }
开发者ID:sipp11,项目名称:Garden,代码行数:51,代码来源:class.setupcontroller.php

示例5: Applications

 /**
  * Application management screen.
  */
 public function Applications($Filter = '', $ApplicationName = '', $TransientKey = '')
 {
     $this->AddJsFile('addons.js');
     $Session = Gdn::Session();
     $ApplicationName = $Session->ValidateTransientKey($TransientKey) ? $ApplicationName : '';
     if (!in_array($Filter, array('enabled', 'disabled'))) {
         $Filter = 'all';
     }
     $this->Filter = $Filter;
     $this->Permission('Garden.Applications.Manage');
     $this->AddSideMenu('dashboard/settings/applications');
     $this->AddJsFile('applications.js');
     $this->Title(T('Applications'));
     $AuthenticatedPostBack = $this->Form->AuthenticatedPostBack();
     $ApplicationManager = new Gdn_ApplicationManager();
     $this->AvailableApplications = $ApplicationManager->AvailableVisibleApplications();
     $this->EnabledApplications = $ApplicationManager->EnabledVisibleApplications();
     // Loop through all of the available visible apps and mark them if they have an update available
     // Retrieve the list of apps that require updates from the config file
     $RequiredUpdates = Gdn_Format::Unserialize(C('Garden.RequiredUpdates', ''));
     if (is_array($RequiredUpdates)) {
         foreach ($RequiredUpdates as $UpdateInfo) {
             if (is_object($UpdateInfo)) {
                 $UpdateInfo = Gdn_Format::ObjectAsArray($UpdateInfo);
             }
             $NewVersion = ArrayValue('Version', $UpdateInfo, '');
             $Name = ArrayValue('Name', $UpdateInfo, '');
             $Type = ArrayValue('Type', $UpdateInfo, '');
             foreach ($this->AvailableApplications as $App => $Info) {
                 $CurrentName = ArrayValue('Name', $Info, $App);
                 if ($CurrentName == $Name && $Type == 'Application') {
                     $Info['NewVersion'] = $NewVersion;
                     $this->AvailableApplications[$App] = $Info;
                 }
             }
         }
     }
     if ($ApplicationName != '') {
         $this->EventArguments['ApplicationName'] = $ApplicationName;
         if (array_key_exists($ApplicationName, $this->EnabledApplications) === TRUE) {
             try {
                 $ApplicationManager->DisableApplication($ApplicationName);
                 $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);
                 $this->Form->SetValidationResults($Validation->Results());
                 $this->EventArguments['Validation'] = $Validation;
                 $this->FireEvent('AfterEnableApplication');
             }
         }
         if ($this->Form->ErrorCount() == 0) {
             Redirect('settings/applications/' . $this->Filter);
         }
     }
     $this->Render();
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:70,代码来源:class.settingscontroller.php

示例6: Applications

 /**
  * Application management screen.
  */
 public function Applications($Filter = '', $TransientKey = '')
 {
     $Session = Gdn::Session();
     $ApplicationName = $Session->ValidateTransientKey($TransientKey) ? $Filter : '';
     if (!in_array($Filter, array('enabled', 'disabled'))) {
         $Filter = '';
     }
     $this->Filter = $Filter;
     $this->Permission('Garden.Applications.Manage');
     $this->AddSideMenu('dashboard/settings/applications');
     $this->AddJsFile('applications.js');
     $this->Title(T('Applications'));
     $AuthenticatedPostBack = $this->Form->AuthenticatedPostBack();
     $ApplicationManager = new Gdn_ApplicationManager();
     $this->AvailableApplications = $ApplicationManager->AvailableVisibleApplications();
     $this->EnabledApplications = $ApplicationManager->EnabledVisibleApplications();
     // Loop through all of the available visible apps and mark them if they have an update available
     // Retrieve the list of apps that require updates from the config file
     $RequiredUpdates = Gdn_Format::Unserialize(Gdn::Config('Garden.RequiredUpdates', ''));
     if (is_array($RequiredUpdates)) {
         foreach ($RequiredUpdates as $UpdateInfo) {
             if (is_object($UpdateInfo)) {
                 $UpdateInfo = Gdn_Format::ObjectAsArray($UpdateInfo);
             }
             $NewVersion = ArrayValue('Version', $UpdateInfo, '');
             $Name = ArrayValue('Name', $UpdateInfo, '');
             $Type = ArrayValue('Type', $UpdateInfo, '');
             foreach ($this->AvailableApplications as $App => $Info) {
                 $CurrentName = ArrayValue('Name', $Info, $App);
                 if ($CurrentName == $Name && $Type == 'Application') {
                     $Info['NewVersion'] = $NewVersion;
                     $this->AvailableApplications[$App] = $Info;
                 }
             }
         }
     }
     if ($ApplicationName != '') {
         if (array_key_exists($ApplicationName, $this->EnabledApplications) === TRUE) {
             try {
                 $ApplicationManager->DisableApplication($ApplicationName);
             } 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) {
                 $Test = ProxyRequest(Url('/dashboard/settings/testaddon/Application/' . $ApplicationName . '/' . $Session->TransientKey() . '?DeliveryType=JSON', TRUE));
                 if ($Test != 'Success') {
                     $this->Form->AddError(sprintf(T('The application could not be enabled because it generated a fatal error: <pre>%s</pre>'), strip_tags($Test)));
                 } else {
                     $Validation = new Gdn_Validation();
                     $ApplicationManager->RegisterPermissions($ApplicationName, $Validation);
                     $ApplicationManager->EnableApplication($ApplicationName, $Validation);
                     $this->Form->SetValidationResults($Validation->Results());
                 }
             }
         }
         if ($this->Form->ErrorCount() == 0) {
             Redirect('settings/applications');
         }
     }
     $this->Render();
 }
开发者ID:sheldon,项目名称:Garden,代码行数:70,代码来源:class.settingscontroller.php

示例7: enableApplications

 /**
  * Enable applications and create permisisions for roles.
  *
  * @return void
  */
 protected function enableApplications()
 {
     $ApplicationManager = new Gdn_ApplicationManager();
     $AppNames = c('Garden.Install.Applications', ['Conversations', 'Vanilla']);
     foreach ($AppNames as $AppName) {
         $Validation = new Gdn_Validation();
         $ApplicationManager->RegisterPermissions($AppName, $Validation);
         $ApplicationManager->EnableApplication($AppName, $Validation);
     }
     Gdn::pluginManager()->start(true);
     // Flag the application as installed
     saveToConfig('Garden.Installed', true);
     // Setup default permissions for all roles
     PermissionModel::ResetAllRoles();
 }
开发者ID:TFidryForks,项目名称:spira,代码行数:20,代码来源:VanillaConfigurator.php

示例8: Applications

 /**
  * Application management screen.
  */
 public function Applications($Filter = '', $TransientKey = '')
 {
     $Session = Gdn::Session();
     $ApplicationName = $Session->ValidateTransientKey($TransientKey) ? $Filter : '';
     if (!in_array($Filter, array('enabled', 'disabled'))) {
         $Filter = '';
     }
     $this->Filter = $Filter;
     $this->Permission('Garden.Applications.Manage');
     $this->AddSideMenu('garden/settings/applications');
     if ($this->Head) {
         $this->Head->AddScript('/applications/garden/js/applications.js');
         $this->Head->Title(Translate('Applications'));
     }
     $Session = Gdn::Session();
     $AuthenticatedPostBack = $this->Form->AuthenticatedPostBack();
     $ApplicationManager = new Gdn_ApplicationManager();
     $this->AvailableApplications = $ApplicationManager->AvailableVisibleApplications();
     $this->EnabledApplications = $ApplicationManager->EnabledVisibleApplications();
     // Loop through all of the available visible apps and mark them if they have an update available
     // Retrieve the list of apps that require updates from the config file
     $RequiredUpdates = Format::Unserialize(Gdn::Config('Garden.RequiredUpdates', ''));
     if (is_array($RequiredUpdates)) {
         foreach ($RequiredUpdates as $UpdateInfo) {
             if (is_object($UpdateInfo)) {
                 $UpdateInfo = Format::ObjectAsArray($UpdateInfo);
             }
             $NewVersion = ArrayValue('Version', $UpdateInfo, '');
             $Name = ArrayValue('Name', $UpdateInfo, '');
             $Type = ArrayValue('Type', $UpdateInfo, '');
             foreach ($this->AvailableApplications as $App => $Info) {
                 $CurrentName = ArrayValue('Name', $Info, $App);
                 if ($CurrentName == $Name && $Type == 'Application') {
                     $Info['NewVersion'] = $NewVersion;
                     $this->AvailableApplications[$App] = $Info;
                 }
             }
         }
     }
     // Check the update server for updates to these applications
     $this->UpdateManager = new Gdn_UpdateManager();
     // TODO: FIX UP THE PHONE-HOME CODE - AJAX, PERHAPS?
     // $this->CurrentVersions = $this->UpdateManager->Check(ADDON_TYPE_APPLICATION, array_keys($this->AvailableApplications));
     if ($ApplicationName != '') {
         if (array_key_exists($ApplicationName, $this->EnabledApplications) === TRUE) {
             try {
                 $ApplicationManager->DisableApplication($ApplicationName);
             } 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);
             }
             $this->Form->SetValidationResults($Validation->Results());
         }
         if ($this->Form->ErrorCount() == 0) {
             Redirect('settings/applications');
         }
     }
     $this->Render();
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:72,代码来源:settings.php


注:本文中的Gdn_ApplicationManager::EnableApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。