/**
  * Looks through the root Garden directory for valid applications and
  * returns them as an associative array of "Application Name" =>
  * "Application Info Array". It also adds a "Folder" definition to the
  * Application Info Array for each application.
  */
 public function AvailableApplications()
 {
     if (!is_array($this->_AvailableApplications)) {
         $ApplicationInfo = array();
         $AppFolders = Gdn_FileSystem::Folders(PATH_APPLICATIONS);
         // Get an array of all application folders
         $ApplicationAboutFiles = Gdn_FileSystem::FindAll(PATH_APPLICATIONS, 'settings' . DS . 'about.php', $AppFolders);
         // Now look for about files within them.
         // Include them all right here and fill the application info array
         $ApplicationCount = count($ApplicationAboutFiles);
         for ($i = 0; $i < $ApplicationCount; ++$i) {
             include $ApplicationAboutFiles[$i];
             // Define the folder name for the newly added item
             foreach ($ApplicationInfo as $ApplicationName => $Info) {
                 if (array_key_exists('Folder', $ApplicationInfo[$ApplicationName]) === FALSE) {
                     $Folder = substr($ApplicationAboutFiles[$i], strlen(PATH_APPLICATIONS));
                     if (substr($Folder, 0, 1) == DS) {
                         $Folder = substr($Folder, 1);
                     }
                     $Folder = substr($Folder, 0, strpos($Folder, DS));
                     $ApplicationInfo[$ApplicationName]['Folder'] = $Folder;
                 }
             }
         }
         $this->_AvailableApplications = $ApplicationInfo;
     }
     return $this->_AvailableApplications;
 }
Exemple #2
0
 /**
  * Looks through the themes directory for valid themes and returns them as
  * an associative array of "Theme Name" => "Theme Info Array". It also adds
  * a "Folder" definition to the Theme Info Array for each.
  */
 public function AvailableThemes()
 {
     if (!is_array($this->_AvailableThemes)) {
         $ThemeInfo = array();
         $ThemeFolders = Gdn_FileSystem::Folders(PATH_THEMES);
         $ThemeAboutFiles = Gdn_FileSystem::FindAll(PATH_THEMES, 'about.php', $ThemeFolders);
         // Include them all right here and fill the theme info array
         $ThemeCount = is_array($ThemeAboutFiles) ? count($ThemeAboutFiles) : 0;
         for ($i = 0; $i < $ThemeCount; ++$i) {
             include $ThemeAboutFiles[$i];
             // Define the folder name for the newly added item
             foreach ($ThemeInfo as $ThemeName => $Info) {
                 if (array_key_exists('Folder', $ThemeInfo[$ThemeName]) === FALSE) {
                     $Folder = substr($ThemeAboutFiles[$i], strlen(PATH_THEMES));
                     if (substr($Folder, 0, 1) == DS) {
                         $Folder = substr($Folder, 1);
                     }
                     $Folder = substr($Folder, 0, strpos($Folder, DS));
                     $ThemeInfo[$ThemeName]['Folder'] = $Folder;
                 }
             }
         }
         $this->_AvailableThemes = $ThemeInfo;
     }
     return $this->_AvailableThemes;
 }
 /**
  * Looks through the themes directory for valid themes and returns them as
  * an associative array of "Theme Name" => "Theme Info Array". It also adds
  * a "Folder" definition to the Theme Info Array for each.
  */
 public function AvailableThemes()
 {
     if (!is_array($this->_AvailableThemes)) {
         $ThemeInfo = array();
         $ThemeFolders = Gdn_FileSystem::Folders(PATH_THEMES);
         $ThemeAboutFiles = Gdn_FileSystem::FindAll(PATH_THEMES, 'about.php', $ThemeFolders);
         // Include them all right here and fill the theme info array
         $ThemeCount = is_array($ThemeAboutFiles) ? count($ThemeAboutFiles) : 0;
         for ($i = 0; $i < $ThemeCount; ++$i) {
             include $ThemeAboutFiles[$i];
             // Define the folder name for the newly added item
             foreach ($ThemeInfo as $ThemeName => $Info) {
                 if (array_key_exists('Folder', $ThemeInfo[$ThemeName]) === FALSE) {
                     $Folder = substr($ThemeAboutFiles[$i], strlen(PATH_THEMES));
                     if (substr($Folder, 0, 1) == DS) {
                         $Folder = substr($Folder, 1);
                     }
                     $Folder = substr($Folder, 0, strpos($Folder, DS));
                     $ThemeInfo[$ThemeName]['Folder'] = $Folder;
                     // Add the screenshot.
                     $ScreenshotPath = SafeGlob(PATH_THEMES . "/{$Folder}/screenshot.*", array('gif', 'jpg', 'png'));
                     if (count($ScreenshotPath) > 0) {
                         $ScreenshotPath = $ScreenshotPath[0];
                         $ThemeInfo[$ThemeName]['ScreenshotUrl'] = Asset(str_replace(PATH_ROOT, '', $ScreenshotPath));
                     }
                 }
             }
         }
         $this->_AvailableThemes = $ThemeInfo;
     }
     return $this->_AvailableThemes;
 }
 /**
  * Search the garden/locale folder for other locale sources that are
  * available. Returns an array of locale names.
  *
  * @return array
  */
 public function getAvailableLocaleSources()
 {
     return Gdn_FileSystem::Folders(PATH_APPLICATIONS . '/dashboard/locale');
 }
Exemple #5
0
 /**
  * Search the garden/locale folder for other locale sources that are
  * available. Returns an array of locale names.
  *
  * @return array
  */
 public function GetAvailableLocaleSources()
 {
     return Gdn_FileSystem::Folders(PATH_APPLICATIONS . DS . 'garden' . DS . 'locale');
 }