availableThemes() public method

The themes are returned as an associative array of "Theme Name" => "Theme Info Array".
public availableThemes ( boolean $force = false ) : array
$force boolean Deprecated.
return array Returns the available themes in an array.
 /**
  * Adds information to the definition list that causes the app to "phone
  * home" and see if there are upgrades available.
  *
  * Currently added to the dashboard only. Nothing renders with this method.
  * It is public so it can be added by plugins.
  */
 public function addUpdateCheck()
 {
     if (c('Garden.NoUpdateCheck')) {
         return;
     }
     // Check to see if the application needs to phone-home for updates. Doing
     // this here because this method is always called when admin pages are
     // loaded regardless of the application loading them.
     $UpdateCheckDate = Gdn::config('Garden.UpdateCheckDate', '');
     if ($UpdateCheckDate == '' || !IsTimestamp($UpdateCheckDate) || $UpdateCheckDate < strtotime("-1 day")) {
         $UpdateData = array();
         // Grab all of the plugins & versions
         $Plugins = Gdn::pluginManager()->availablePlugins();
         foreach ($Plugins as $Plugin => $Info) {
             $Name = val('Name', $Info, $Plugin);
             $Version = val('Version', $Info, '');
             if ($Version != '') {
                 $UpdateData[] = array('Name' => $Name, 'Version' => $Version, 'Type' => 'Plugin');
             }
         }
         // Grab all of the applications & versions
         $ApplicationManager = Gdn::factory('ApplicationManager');
         $Applications = $ApplicationManager->availableApplications();
         foreach ($Applications as $Application => $Info) {
             $Name = val('Name', $Info, $Application);
             $Version = val('Version', $Info, '');
             if ($Version != '') {
                 $UpdateData[] = array('Name' => $Name, 'Version' => $Version, 'Type' => 'Application');
             }
         }
         // Grab all of the themes & versions
         $ThemeManager = new Gdn_ThemeManager();
         $Themes = $ThemeManager->availableThemes();
         foreach ($Themes as $Theme => $Info) {
             $Name = val('Name', $Info, $Theme);
             $Version = val('Version', $Info, '');
             if ($Version != '') {
                 $UpdateData[] = array('Name' => $Name, 'Version' => $Version, 'Type' => 'Theme');
             }
         }
         // Dump the entire set of information into the definition list (jQuery
         // will pick it up and ping the VanillaForums.org server with this info).
         $this->addDefinition('UpdateChecks', Gdn_Format::serialize($UpdateData));
     }
 }
Esempio n. 2
0
 /**
  *
  *
  * @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;
 }