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


PHP Gdn_ApplicationManager::EnabledApplications方法代码示例

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


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

示例1: Structure

 public function Structure($AppName = 'all', $CaptureOnly = '1', $Drop = '0', $Explicit = '0')
 {
     $this->Permission('Garden.AdminUser.Only');
     $Files = array();
     $AppName = $AppName == '' ? 'all' : $AppName;
     if ($AppName == 'all') {
         // Load all application structure files.
         $ApplicationManager = new Gdn_ApplicationManager();
         $Apps = $ApplicationManager->EnabledApplications();
         $AppNames = ConsolidateArrayValuesByKey($Apps, 'Folder');
         foreach ($AppNames as $AppName) {
             $Files[] = CombinePaths(array(PATH_APPLICATIONS, $AppName, 'settings', 'structure.php'), DS);
         }
         $AppName = 'all';
     } else {
         // Load that specific application structure file.
         $Files[] = CombinePaths(array(PATH_APPLICATIONS, $AppName, 'settings', 'structure.php'), DS);
     }
     $Validation = new Gdn_Validation();
     $Database = Gdn::Database();
     $Drop = $Drop == '0' ? FALSE : TRUE;
     $Explicit = $Explicit == '0' ? FALSE : TRUE;
     $CaptureOnly = !($CaptureOnly == '0');
     $Structure = Gdn::Structure();
     $Structure->CaptureOnly = $CaptureOnly;
     $SQL = Gdn::SQL();
     $SQL->CaptureModifications = $CaptureOnly;
     $this->SetData('CaptureOnly', $Structure->CaptureOnly);
     $this->SetData('Drop', $Drop);
     $this->SetData('Explicit', $Explicit);
     $this->SetData('ApplicationName', $AppName);
     $this->SetData('Status', '');
     $FoundStructureFile = FALSE;
     foreach ($Files as $File) {
         if (file_exists($File)) {
             $FoundStructureFile = TRUE;
             try {
                 include $File;
             } catch (Exception $Ex) {
                 $this->Form->AddError($Ex);
             }
         }
         if (property_exists($Structure->Database, 'CapturedSql')) {
             $this->SetData('CapturedSql', (array) $Structure->Database->CapturedSql);
         } else {
             $this->SetData('CapturedSql', array());
         }
     }
     if ($this->Form->ErrorCount() == 0 && !$CaptureOnly && $FoundStructureFile) {
         $this->SetData('Status', 'The structure was successfully executed.');
     }
     $this->AddSideMenu('dashboard/settings/configure');
     $this->AddCssFile('admin.css');
     $this->SetData('Title', T('Database Structure Upgrades'));
     $this->Render();
 }
开发者ID:sipp11,项目名称:Garden,代码行数:56,代码来源:class.utilitycontroller.php

示例2: EnableTheme

 public function EnableTheme($ThemeName)
 {
     // 1. Make sure that the theme's requirements are met
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $AvailableThemes = $this->AvailableThemes();
     $NewThemeInfo = ArrayValue($ThemeName, $AvailableThemes, array());
     $RequiredApplications = ArrayValue('RequiredApplications', $NewThemeInfo, FALSE);
     CheckRequirements($ThemeName, $RequiredApplications, $EnabledApplications, 'application');
     // Applications
     // 5. Set the theme
     $ThemeFolder = ArrayValue('Folder', $NewThemeInfo, '');
     if ($ThemeFolder == '') {
         throw new Exception(Gdn::Translate('The theme folder was not properly defined.'));
     } else {
         SaveToConfig('Garden.Theme', $ThemeFolder);
     }
     return TRUE;
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:19,代码来源:class.thememanager.php

示例3: runStructure

 /**
  *
  *
  * @param null $AddonCode
  * @param bool $Explicit
  * @param bool $Drop
  * @throws Exception
  */
 public function runStructure($AddonCode = null, $Explicit = false, $Drop = false)
 {
     // Get the structure files for all of the enabled applications.
     $ApplicationManager = new Gdn_ApplicationManager();
     $Apps = $ApplicationManager->EnabledApplications();
     $AppNames = consolidateArrayValuesByKey($Apps, 'Folder');
     $Paths = array();
     foreach ($Apps as $Key => $AppInfo) {
         $Path = PATH_APPLICATIONS . "/{$AppInfo['Folder']}/settings/structure.php";
         if (file_exists($Path)) {
             $Paths[] = $Path;
         }
         Gdn::ApplicationManager()->RegisterPermissions($Key, $this->Validation);
     }
     // Execute the structures.
     $Database = Gdn::database();
     $SQL = Gdn::sql();
     $Structure = Gdn::structure();
     foreach ($Paths as $Path) {
         include $Path;
     }
     // Execute the structures for all of the plugins.
     $PluginManager = Gdn::pluginManager();
     $Registered = $PluginManager->RegisteredPlugins();
     foreach ($Registered as $ClassName => $Enabled) {
         if (!$Enabled) {
             continue;
         }
         try {
             $Plugin = $PluginManager->GetPluginInstance($ClassName, Gdn_PluginManager::ACCESS_CLASSNAME);
             if (method_exists($Plugin, 'Structure')) {
                 trace("{$ClassName}->Structure()");
                 $Plugin->Structure();
             }
         } catch (Exception $Ex) {
             // Do nothing, plugin wouldn't load/structure.
             if (Debug()) {
                 throw $Ex;
             }
         }
     }
     $this->fireEvent('AfterStructure');
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:51,代码来源:class.updatemodel.php

示例4: TestTheme

 public function TestTheme($ThemeName)
 {
     // Get some info about the currently enabled theme.
     $EnabledTheme = $this->EnabledThemeInfo();
     $EnabledThemeFolder = GetValue('Folder', $EnabledTheme, '');
     $OldClassName = $EnabledThemeFolder . 'ThemeHooks';
     // Make sure that the theme's requirements are met
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $NewThemeInfo = $this->GetThemeInfo($ThemeName);
     $ThemeName = GetValue('Index', $NewThemeInfo, $ThemeName);
     $RequiredApplications = ArrayValue('RequiredApplications', $NewThemeInfo, FALSE);
     $ThemeFolder = ArrayValue('Folder', $NewThemeInfo, '');
     CheckRequirements($ThemeName, $RequiredApplications, $EnabledApplications, 'application');
     // Applications
     // If there is a hooks file, include it and run the setup method.
     $ClassName = "{$ThemeFolder}ThemeHooks";
     $HooksFile = GetValue("HooksFile", $NewThemeInfo, NULL);
     if (!is_null($HooksFile) && file_exists($HooksFile)) {
         include_once $HooksFile;
         if (class_exists($ClassName)) {
             $ThemeHooks = new $ClassName();
             $ThemeHooks->Setup();
         }
     }
     // If there is a hooks in the old theme, include it and run the ondisable method.
     if (class_exists($OldClassName)) {
         $ThemeHooks = new $OldClassName();
         if (method_exists($ThemeHooks, 'OnDisable')) {
             $ThemeHooks->OnDisable();
         }
     }
     return TRUE;
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:34,代码来源:class.thememanager.php

示例5: RunStructure

 public function RunStructure($AddonCode = NULL, $Explicit = FALSE, $Drop = FALSE)
 {
     // Get the structure files for all of the enabled applications.
     $ApplicationManager = new Gdn_ApplicationManager();
     $Apps = $ApplicationManager->EnabledApplications();
     $AppNames = ConsolidateArrayValuesByKey($Apps, 'Folder');
     $Paths = array();
     foreach ($Apps as $AppInfo) {
         $Path = PATH_APPLICATIONS . "/{$AppInfo['Folder']}/settings/structure.php";
         if (file_exists($Path)) {
             $Paths[] = $Path;
         }
     }
     // Execute the structures.
     $Database = Gdn::Database();
     $SQL = Gdn::SQL();
     $Structure = Gdn::Structure();
     foreach ($Paths as $Path) {
         include $Path;
     }
     // Execute the structures for all of the plugins.
     $PluginManager = Gdn::PluginManager();
     $Registered = $PluginManager->RegisteredPlugins();
     foreach ($Registered as $ClassName => $Enabled) {
         if (!$Enabled) {
             continue;
         }
         try {
             $Plugin = $PluginManager->GetPluginInstance($ClassName, Gdn_PluginManager::ACCESS_CLASSNAME);
             if (method_exists($Plugin, 'Structure')) {
                 Trace("{$ClassName}->Structure()");
                 $Plugin->Structure();
             }
         } catch (Exception $Ex) {
             // Do nothing, plugin wouldn't load/structure.
         }
     }
 }
开发者ID:bishopb,项目名称:vanilla,代码行数:38,代码来源:class.updatemodel.php

示例6: RunStructure

 public function RunStructure($AddonCode = NULL, $Explicit = FALSE, $Drop = FALSE)
 {
     // Get the structure files for all of the enabled applications.
     $ApplicationManager = new Gdn_ApplicationManager();
     $Apps = $ApplicationManager->EnabledApplications();
     $AppNames = ConsolidateArrayValuesByKey($Apps, 'Folder');
     $Paths = array();
     foreach ($Apps as $AppInfo) {
         $Path = PATH_APPLICATIONS . "/{$AppInfo['Folder']}/settings/structure.php";
         if (file_exists($Path)) {
             $Paths[] = $Path;
         }
     }
     // Execute the structures.
     $Database = Gdn::Database();
     $SQL = Gdn::SQL();
     $Structure = Gdn::Structure();
     foreach ($Paths as $Path) {
         include $Path;
     }
     // Execute the structures for all of the plugins.
     $PluginManager = Gdn::PluginManager();
     $Plugins = $PluginManager->EnabledPlugins();
     foreach ($Plugins as $Key => $PluginInfo) {
         $PluginName = GetValue('Index', $PluginInfo);
         $Plugin = $PluginManager->GetPluginInstance($PluginName, Gdn_PluginManager::ACCESS_PLUGINNAME);
         if (method_exists($Plugin, 'Structure')) {
             $Plugin->Structure();
         }
     }
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:31,代码来源:class.updatemodel.php

示例7: GetAllowedPermissionNamespaces

 /**
  * Returns a complete list of all enabled applications & plugins. This list
  * can act as a namespace list for permissions.
  * @return array
  */
 public function GetAllowedPermissionNamespaces()
 {
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $PluginNamespaces = array();
     foreach (Gdn::PluginManager()->EnabledPlugins() as $Plugin) {
         if (!array_key_exists('RegisterPermissions', $Plugin) || !is_array($Plugin['RegisterPermissions'])) {
             continue;
         }
         foreach ($Plugin['RegisterPermissions'] as $Index => $PermissionName) {
             if (is_string($Index)) {
                 $PermissionName = $Index;
             }
             $Namespace = substr($PermissionName, 0, strrpos($PermissionName, '.'));
             $PluginNamespaces[$Namespace] = TRUE;
         }
     }
     $Result = array_merge(array_keys($EnabledApplications), array_keys($PluginNamespaces));
     if (in_array('Dashboard', $Result)) {
         $Result[] = 'Garden';
     }
     return $Result;
 }
开发者ID:rnovino,项目名称:Garden,代码行数:28,代码来源:class.permissionmodel.php

示例8: TestPlugin

 /**
  * Test to see if a plugin throws fatal errors.
  */
 public function TestPlugin($PluginName, &$Validation, $Setup = FALSE)
 {
     // Make sure that the plugin's requirements are met
     // Required Plugins
     $AvailablePlugins = $this->AvailablePlugins();
     $RequiredPlugins = ArrayValue('RequiredPlugins', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins, 'plugin');
     // Required Themes
     $ThemeManager = new Gdn_ThemeManager();
     $EnabledThemes = $ThemeManager->EnabledThemeInfo(TRUE);
     $RequiredThemes = ArrayValue('RequiredTheme', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // Include the plugin, instantiate it, and call its setup method
     $PluginInfo = ArrayValue($PluginName, $AvailablePlugins, FALSE);
     $PluginClassName = ArrayValue('ClassName', $PluginInfo, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(T('The plugin folder was not properly defined.'));
     }
     $this->_PluginHook($PluginName, self::ACTION_ENABLE, $Setup);
     // If setup succeeded, register any specified permissions
     $PermissionName = ArrayValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     return TRUE;
 }
开发者ID:nickhx,项目名称:Garden,代码行数:36,代码来源:class.pluginmanager.php

示例9: EnablePlugin

 public function EnablePlugin($PluginName, $Validation, $Setup = FALSE)
 {
     // 1. Make sure that the plugin's requirements are met
     // Required Plugins
     $AvailablePlugins = $this->AvailablePlugins();
     $RequiredPlugins = ArrayValue('RequiredPlugins', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins, 'plugin');
     // Required Themes
     $ThemeManager = new Gdn_ThemeManager();
     $EnabledThemes = $ThemeManager->EnabledThemeInfo();
     $RequiredThemes = ArrayValue('RequiredTheme', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // 2. Include the plugin, instantiate it, and call its setup method
     $PluginInfo = ArrayValue($PluginName, $AvailablePlugins, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(Gdn::Translate('The plugin folder was not properly defined.'));
     }
     $this->_PluginHook($PluginName, self::ACTION_ENABLE, $Setup);
     // 3. If setup succeeded, register any specified permissions
     $PermissionName = ArrayValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     if (is_object($Validation) && count($Validation->Results()) > 0) {
         return FALSE;
     }
     // 4. If everything succeeded, add the plugin to the
     // $EnabledPlugins array in conf/plugins.php
     // $EnabledPlugins['PluginClassName'] = 'Plugin Folder Name';
     SaveToConfig('EnabledPlugins' . '.' . $PluginName, $PluginFolder);
     $ApplicationManager = new Gdn_ApplicationManager();
     $Locale = Gdn::Locale();
     $Locale->Set($Locale->Current(), $ApplicationManager->EnabledApplicationFolders(), $this->EnabledPluginFolders(), TRUE);
     return TRUE;
 }
开发者ID:stinie,项目名称:Garden,代码行数:42,代码来源:class.pluginmanager.php

示例10: TestTheme

 public function TestTheme($ThemeName)
 {
     // Get some info about the currently enabled theme.
     $EnabledTheme = $this->EnabledThemeInfo();
     $EnabledThemeFolder = GetValue('Folder', $EnabledTheme, '');
     $OldClassName = $EnabledThemeFolder . 'ThemeHooks';
     // Make sure that the theme's requirements are met
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $AvailableThemes = $this->AvailableThemes();
     $NewThemeInfo = ArrayValue($ThemeName, $AvailableThemes, array());
     $RequiredApplications = ArrayValue('RequiredApplications', $NewThemeInfo, FALSE);
     $ThemeFolder = ArrayValue('Folder', $NewThemeInfo, '');
     CheckRequirements($ThemeName, $RequiredApplications, $EnabledApplications, 'application');
     // Applications
     // If there is a hooks file, include it and run the setup method.
     $ClassName = $ThemeFolder . 'ThemeHooks';
     $HooksFile = PATH_THEMES . DS . $ThemeFolder . DS . 'class.' . strtolower($ClassName) . '.php';
     if (file_exists($HooksFile)) {
         include $HooksFile;
         if (class_exists($ClassName)) {
             $ThemeHooks = new $ClassName();
             $ThemeHooks->Setup();
         }
     }
     // If there is a hooks in the old theme, include it and run the ondisable method.
     if (class_exists($OldClassName)) {
         $ThemeHooks = new $OldClassName();
         $ThemeHooks->OnDisable();
     }
     return TRUE;
 }
开发者ID:kerphi,项目名称:Garden,代码行数:32,代码来源:class.thememanager.php

示例11: GetApplicationMenus

 function GetApplicationMenus(&$Menu)
 {
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     // Get all settings pages from the specified applications:
     foreach ($EnabledApplications as $ApplicationName => $ApplicationFolder) {
         $AppController = $ApplicationName . 'Controller';
         // Attempt to include the app controller if it isn't already loaded
         $ControllerPath = PATH_APPLICATIONS . DS . $ApplicationFolder . DS . 'controllers' . DS . 'appcontroller.php';
         if (!class_exists($AppController) && file_exists($ControllerPath)) {
             include_once $ControllerPath;
         }
         // Attempt to instantiate the app controller to get the settings pages
         if (class_exists($AppController)) {
             $AppController = new $AppController();
             if (method_exists($AppController, 'GetSettingsPages')) {
                 $AppController->GetSettingsPages($Menu);
             }
         }
     }
     // Get all settings pages from plugins
     $Plugins = array();
     $PluginManager = Gdn::Factory('PluginManager');
     $PluginMenuAdded = FALSE;
     foreach ($PluginManager->EnabledPlugins as $PluginName => $PluginInfo) {
         if (array_key_exists('SettingsUrl', $PluginInfo)) {
             if (!$PluginMenuAdded) {
                 $Menu->AddItem('Plugins', 'Plugins');
                 $PluginMenuAdded = TRUE;
             }
             // TODO: DOES A PERMISSION NEED TO APPLY TO THE PLUGIN SETTINGS URL?
             $Menu->AddLink('Plugins', $PluginName, ArrayValue('SettingsUrl', $PluginInfo, ''));
         }
     }
 }
开发者ID:jhampha,项目名称:Garden,代码行数:35,代码来源:functions.general.php

示例12: GetAddons

 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' => GetValue('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' => GetValue('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' => GetValue('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' => GetValue('Version', $Info, '0.0'), 'Folder' => '/locales/' . GetValue('Folder', $Info, $Key));
         self::_AddAddon($Addon, $Addons);
     }
     return $Addons;
 }
开发者ID:kennyma,项目名称:Garden,代码行数:67,代码来源:class.updatemodel.php

示例13: GetAllowedPermissionNamespaces

 /**
  * Returns a complete list of all enabled applications & plugins. This list
  * can act as a namespace list for permissions.
  * @return array
  */
 public function GetAllowedPermissionNamespaces()
 {
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $PluginManager = Gdn::Factory('PluginManager');
     $PluginNamespaces = array();
     foreach ($PluginManager->EnabledPlugins as $Plugin) {
         if (!array_key_exists('RegisterPermissions', $Plugin) || !is_array($Plugin['RegisterPermissions'])) {
             continue;
         }
         foreach ($Plugin['RegisterPermissions'] as $PermissionName) {
             $Namespace = substr($PermissionName, 0, strrpos($PermissionName, '.'));
             $PluginNamespaces[$Namespace] = TRUE;
         }
     }
     return array_merge(array_keys($EnabledApplications), array_keys($PluginNamespaces));
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:22,代码来源:class.permissionmodel.php

示例14: EnablePlugin

 public function EnablePlugin($PluginName, $Validation, $Setup = FALSE)
 {
     // 1. Make sure that the plugin's requirements are met
     // Required Plugins
     $AvailablePlugins = $this->AvailablePlugins();
     $RequiredPlugins = ArrayValue('RequiredPlugins', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins, 'plugin');
     // Required Themes
     $ThemeManager = new Gdn_ThemeManager();
     $EnabledThemes = $ThemeManager->EnabledThemeInfo();
     $RequiredThemes = ArrayValue('RequiredTheme', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // 2. Include the plugin, instantiate it, and call it's setup method
     $PluginInfo = ArrayValue($PluginName, $AvailablePlugins, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(Gdn::Translate('The plugin folder was not properly defined.'));
     }
     $PluginClassName = ArrayValue('ClassName', $PluginInfo, FALSE);
     if ($PluginFolder !== FALSE && $PluginClassName !== FALSE && class_exists($PluginClassName) === FALSE) {
         $this->IncludePlugins(array($PluginName => $PluginFolder));
         if (class_exists($PluginClassName)) {
             $Plugin = new $PluginClassName();
             $Plugin->Setup();
         }
     } elseif (class_exists($PluginClassName, FALSE) !== FALSE && $Setup === TRUE) {
         $Plugin = new $PluginClassName();
         $Plugin->Setup();
     }
     // 3. If setup succeeded, register any specified permissions
     $PermissionName = ArrayValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     if (is_object($Validation) && count($Validation->Results()) > 0) {
         return FALSE;
     }
     // 4. If everything succeeded, add the plugin to the
     // $EnabledPlugins array in conf/plugins.php
     // $EnabledPlugins['PluginClassName'] = 'Plugin Folder Name';
     $Config = Gdn::Factory(Gdn::AliasConfig);
     $Config->Load(PATH_CONF . DS . 'config.php', 'Save');
     $Config->Set('EnabledPlugins' . '.' . $PluginName, $PluginFolder);
     $Config->Save();
     $ApplicationManager = new Gdn_ApplicationManager();
     $Locale = Gdn::Locale();
     $Locale->Set($Locale->Current(), $ApplicationManager->EnabledApplicationFolders(), $this->EnabledPluginFolders(), TRUE);
     return TRUE;
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:55,代码来源:class.pluginmanager.php


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