Gdn_ApplicationManager::enabledApplications PHP Method

enabledApplications() public method

Gets an array of all of the enabled applications.
public enabledApplications ( ) : array
return array
    public function enabledApplications()
    {
        if (!is_array($this->enabledApplications)) {
            $EnabledApplications = Gdn::config('EnabledApplications', array('Dashboard' => 'dashboard'));
            // Add some information about the applications to the array.
            foreach ($EnabledApplications as $Name => $Folder) {
                $EnabledApplications[$Name] = array('Folder' => $Folder);
                //$EnabledApplications[$Name]['Version'] = Gdn::Config($Name.'.Version', '');
                $EnabledApplications[$Name]['Version'] = '';
                $EnabledApplications[$Name]['Index'] = $Name;
                // Get the application version from it's about file.
                $AboutPath = PATH_APPLICATIONS . '/' . strtolower($Name) . '/settings/about.php';
                if (file_exists($AboutPath)) {
                    $ApplicationInfo = array();
                    include $AboutPath;
                    $EnabledApplications[$Name]['Version'] = GetValueR("{$Name}.Version", $ApplicationInfo, '');
                }
            }
            $this->enabledApplications = $EnabledApplications;
        }
        return $this->enabledApplications;
    }

Usage Example

Exemplo n.º 1
0
 /**
  *
  *
  * @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');
 }
All Usage Examples Of Gdn_ApplicationManager::enabledApplications