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


PHP Gdn_ApplicationManager::AvailableApplications方法代码示例

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


在下文中一共展示了Gdn_ApplicationManager::AvailableApplications方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例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.
  */
 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

示例3: getAddons

 /**
  *
  *
  * @param bool $Enabled
  * @return array
  */
 public function getAddons($Enabled = false)
 {
     $Addons = array();
     // Get the core.
     self::_AddAddon(array('AddonKey' => 'vanilla', 'AddonType' => 'core', 'Version' => APPLICATION_VERSION, 'Folder' => '/'), $Addons);
     // Get a list of all of the applications.
     $ApplicationManager = new Gdn_ApplicationManager();
     if ($Enabled) {
         $Applications = $ApplicationManager->AvailableApplications();
     } else {
         $Applications = $ApplicationManager->EnabledApplications();
     }
     foreach ($Applications as $Key => $Info) {
         // Exclude core applications.
         if (in_array(strtolower($Key), array('conversations', 'dashboard', 'skeleton', 'vanilla'))) {
             continue;
         }
         $Addon = array('AddonKey' => $Key, 'AddonType' => 'application', 'Version' => val('Version', $Info, '0.0'), 'Folder' => '/applications/' . GetValue('Folder', $Info, strtolower($Key)));
         self::_AddAddon($Addon, $Addons);
     }
     // Get a list of all of the plugins.
     $PluginManager = Gdn::pluginManager();
     if ($Enabled) {
         $Plugins = $PluginManager->EnabledPlugins();
     } else {
         $Plugins = $PluginManager->AvailablePlugins();
     }
     foreach ($Plugins as $Key => $Info) {
         // Exclude core plugins.
         if (in_array(strtolower($Key), array())) {
             continue;
         }
         $Addon = array('AddonKey' => $Key, 'AddonType' => 'plugin', 'Version' => val('Version', $Info, '0.0'), 'Folder' => '/applications/' . GetValue('Folder', $Info, $Key));
         self::_AddAddon($Addon, $Addons);
     }
     // Get a list of all the themes.
     $ThemeManager = new Gdn_ThemeManager();
     if ($Enabled) {
         $Themes = $ThemeManager->EnabledThemeInfo(true);
     } else {
         $Themes = $ThemeManager->AvailableThemes();
     }
     foreach ($Themes as $Key => $Info) {
         // Exclude core themes.
         if (in_array(strtolower($Key), array('default'))) {
             continue;
         }
         $Addon = array('AddonKey' => $Key, 'AddonType' => 'theme', 'Version' => val('Version', $Info, '0.0'), 'Folder' => '/themes/' . GetValue('Folder', $Info, $Key));
         self::_AddAddon($Addon, $Addons);
     }
     // Get a list of all locales.
     $LocaleModel = new LocaleModel();
     if ($Enabled) {
         $Locales = $LocaleModel->EnabledLocalePacks(true);
     } else {
         $Locales = $LocaleModel->AvailableLocalePacks();
     }
     foreach ($Locales as $Key => $Info) {
         // Exclude core themes.
         if (in_array(strtolower($Key), array('skeleton'))) {
             continue;
         }
         $Addon = array('AddonKey' => $Key, 'AddonType' => 'locale', 'Version' => val('Version', $Info, '0.0'), 'Folder' => '/locales/' . GetValue('Folder', $Info, $Key));
         self::_AddAddon($Addon, $Addons);
     }
     return $Addons;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:73,代码来源:class.updatemodel.php

示例4: Applications

 /**
  * Application management screen.
  */
 public function Applications($Action = '', $ApplicationName = '', $TransientKey = '')
 {
     $this->Permission('Garden.Applications.Manage');
     $this->AddSideMenu('garden/settings/applications');
     if ($this->Head) {
         $this->Head->AddScript('/applications/garden/js/applications.js');
     }
     $Session = Gdn::Session();
     $AuthenticatedPostBack = $this->Form->AuthenticatedPostBack();
     // Todd: Is this part necessary?
     if (!$Session->ValidateTransientKey($TransientKey)) {
         // if(!$AuthenticatedPostBack) {
         $Action = '';
         $ApplicationName = '';
     } else {
         $AuthenticatedPostBack = TRUE;
     }
     $FinalRedirect = FALSE;
     $SetupRender = FALSE;
     $ApplicationManager = new Gdn_ApplicationManager();
     $this->AvailableApplications = $ApplicationManager->AvailableApplications();
     // 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 ($AuthenticatedPostBack) {
         $ApplicationName = $this->Form->GetValue('ApplicationName', $ApplicationName);
         if ($ApplicationName != '') {
             if (array_key_exists($ApplicationName, $this->EnabledApplications) === TRUE) {
                 try {
                     $ApplicationManager->DisableApplication($ApplicationName);
                 } catch (Exception $e) {
                     $this->Form->AddError(strip_tags($e->getMessage()));
                 }
                 $FinalRedirect = TRUE;
             } else {
                 if ($Action == '') {
                     // 1. Make sure that the application's requirements are met
                     try {
                         $ApplicationManager->CheckRequirements($ApplicationName);
                     } catch (Exception $e) {
                         $this->Form->AddError(strip_tags($e->getMessage()));
                     }
                     if ($this->Form->ErrorCount() == 0) {
                         // 2. Register any specified permissions
                         $Validation = new Gdn_Validation();
                         $ApplicationManager->RegisterPermissions($ApplicationName, $Validation);
                         if (count($Validation->Results()) == 0) {
                             if (!$ApplicationManager->ApplicationSetup($ApplicationName, $this, $Validation, TRUE)) {
                                 $SetupUrl = '/garden/settings/applications/setup/' . $ApplicationName . '/' . $Session->TransientKey();
                                 if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
                                     Redirect($SetupUrl);
                                 } else {
                                     $this->SetJson('Go', Url($SetupUrl));
                                     // <---- THIS IS WHAT MAKES IT GET PICKED UP BY THE POPUP
                                     $this->Database->CloseConnection();
                                     exit(json_encode($this->GetJson()));
                                 }
                             } else {
                                 $FinalRedirect = TRUE;
                             }
                         }
                     }
                     $this->Form->SetValidationResults($Validation->Results());
                 } elseif ($Action == 'setup') {
                     // 3. Run the setup method of the application
                     $SetupRender = TRUE;
                     $Validation = new Gdn_Validation();
                     if ($ApplicationManager->ApplicationSetup($ApplicationName, $this, $Validation)) {
                         $SetupRender = FALSE;
                         $FinalRedirect = TRUE;
                     }
                 }
             }
             if ($FinalRedirect && $this->Form->ErrorCount() == 0) {
                 $this->StatusMessage = Gdn::Translate('Finalizing changes...');
                 $this->RedirectUrl = Url('/garden/settings/applications/');
             }
         }
     }
     if (!$SetupRender) {
         $this->Render();
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:87,代码来源:settings.php


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