Bladeren bron

changed homepage settings function to dynamic
added trait file for html homepage and misc homepage

CauseFX 5 jaren geleden
bovenliggende
commit
da6080b8d8
3 gewijzigde bestanden met toevoegingen van 188 en 607 verwijderingen
  1. 11 607
      api/classes/organizr.class.php
  2. 145 0
      api/homepage/html.php
  3. 32 0
      api/homepage/misc.php

+ 11 - 607
api/classes/organizr.class.php

@@ -30,11 +30,13 @@ class Organizr
 	use DelugeHomepageItem;
 	use EmbyHomepageItem;
 	use HealthChecksHomepageItem;
+	use HTMLHomepageItem;
 	use ICalHomepageItem;
 	use JackettHomepageItem;
 	use JDownloaderHomepageItem;
 	use JellyfinHomepageItem;
 	use LidarrHomepageItem;
+	use MiscHomepageItem;
 	use MonitorrHomepageItem;
 	use NetDataHomepageItem;
 	use NZBGetHomepageItem;
@@ -3561,489 +3563,18 @@ class Organizr
 		$homepageOrder = $this->homepageOrderList();
 		$homepageBuilt = '';
 		foreach ($homepageOrder as $key => $value) {
-			$homepageBuilt .= $this->buildHomepageItem($key);
+			//new way
+			if (method_exists($this, $key)) {
+				$homepageBuilt .= $this->$key();
+			} else {
+				$homepageBuilt .= '<div id="' . $key . '"></div>';
+			}
+			//old way
+			//$homepageBuilt .= $this->buildHomepageItem($key);
 		}
 		return $homepageBuilt;
 	}
 	
-	public function buildHomepageItem($homepageItem)
-	{
-		$item = '<div id="' . $homepageItem . '">';
-		switch ($homepageItem) {
-			case 'homepageOrdercustomhtml':
-				if ($this->config['homepageCustomHTMLoneEnabled'] && $this->qualifyRequest($this->config['homepageCustomHTMLoneAuth'])) {
-					$item .= ($this->config['customHTMLone'] !== '') ? $this->config['customHTMLone'] : '';
-				}
-				break;
-			case 'homepageOrdercustomhtmlTwo':
-				if ($this->config['homepageCustomHTMLtwoEnabled'] && $this->qualifyRequest($this->config['homepageCustomHTMLtwoAuth'])) {
-					$item .= ($this->config['customHTMLtwo'] !== '') ? $this->config['customHTMLtwo'] : '';
-				}
-				break;
-			case 'homepageOrdernotice':
-				break;
-			case 'homepageOrdernoticeguest':
-				break;
-			case 'homepageOrderqBittorrent':
-				if ($this->config['homepageqBittorrentEnabled'] && $this->qualifyRequest($this->config['homepageqBittorrentAuth'])) {
-					if ($this->config['qBittorrentCombine']) {
-						$item .= '
-	                <script>
-	                // homepageOrderqBittorrent
-	                buildDownloaderCombined(\'qBittorrent\');
-	                homepageDownloader("qBittorrent", "' . $this->config['homepageDownloadRefresh'] . '");
-	                // End homepageOrderqBittorrent
-	                </script>
-	                ';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-	                <script>
-	                // homepageOrderqBittorrent
-	                $("#' . $homepageItem . '").html(buildDownloader("qBittorrent"));
-	                homepageDownloader("qBittorrent", "' . $this->config['homepageDownloadRefresh'] . '");
-	                // End homepageOrderqBittorrent
-	                </script>
-	                ';
-					}
-				}
-				break;
-			case 'homepageOrderrTorrent':
-				if ($this->config['homepagerTorrentEnabled'] && $this->qualifyRequest($this->config['homepagerTorrentAuth'])) {
-					if ($this->config['rTorrentCombine']) {
-						$item .= '
-	                <script>
-	                // homepageOrderrTorrent
-	                buildDownloaderCombined(\'rTorrent\');
-	                homepageDownloader("rTorrent", "' . $this->config['homepageDownloadRefresh'] . '");
-	                // End homepageOrderrTorrent
-	                </script>
-	                ';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-	                <script>
-	                // homepageOrderrTorrent
-	                $("#' . $homepageItem . '").html(buildDownloader("rTorrent"));
-	                homepageDownloader("rTorrent", "' . $this->config['homepageDownloadRefresh'] . '");
-	                // End homepageOrderrTorrent
-	                </script>
-	                ';
-					}
-				}
-				break;
-			case 'homepageOrderdeluge':
-				if ($this->config['homepageDelugeEnabled'] && $this->qualifyRequest($this->config['homepageDelugeAuth'])) {
-					if ($this->config['delugeCombine']) {
-						$item .= '
-					<script>
-					// Deluge
-					buildDownloaderCombined(\'deluge\');
-					homepageDownloader("deluge", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End Deluge
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// Deluge
-					$("#' . $homepageItem . '").html(buildDownloader("deluge"));
-					homepageDownloader("deluge", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End Deluge
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrdertransmission':
-				if ($this->config['homepageTransmissionEnabled'] && $this->qualifyRequest($this->config['homepageTransmissionAuth'])) {
-					if ($this->config['transmissionCombine']) {
-						$item .= '
-					<script>
-					// Transmission
-					buildDownloaderCombined(\'transmission\');
-					homepageDownloader("transmission", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End Transmission
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// Transmission
-					$("#' . $homepageItem . '").html(buildDownloader("transmission"));
-					homepageDownloader("transmission", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End Transmission
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrdernzbget':
-				if ($this->config['homepageNzbgetEnabled'] && $this->qualifyRequest($this->config['homepageNzbgetAuth'])) {
-					if ($this->config['nzbgetCombine']) {
-						$item .= '
-					<script>
-					// NZBGet
-					buildDownloaderCombined(\'nzbget\');
-					homepageDownloader("nzbget", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End NZBGet
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// NZBGet
-					$("#' . $homepageItem . '").html(buildDownloader("nzbget"));
-					homepageDownloader("nzbget", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End NZBGet
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrderjdownloader':
-				if ($this->config['homepageJdownloaderEnabled'] && $this->qualifyRequest($this->config['homepageJdownloaderAuth'])) {
-					if ($this->config['jdownloaderCombine']) {
-						$item .= '
-					<script>
-					// JDownloader
-					buildDownloaderCombined(\'jdownloader\');
-					homepageDownloader("jdownloader", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End JDownloader
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// JDownloader
-					$("#' . $homepageItem . '").html(buildDownloader("jdownloader"));
-					homepageDownloader("jdownloader", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End JDownloader
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrdersabnzbd':
-				if ($this->config['homepageSabnzbdEnabled'] && $this->qualifyRequest($this->config['homepageSabnzbdAuth'])) {
-					if ($this->config['sabnzbdCombine']) {
-						$item .= '
-					<script>
-					// SabNZBd
-					buildDownloaderCombined(\'sabnzbd\');
-					homepageDownloader("sabnzbd", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End SabNZBd
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// SabNZBd
-					$("#' . $homepageItem . '").html(buildDownloader("sabnzbd"));
-					homepageDownloader("sabnzbd", "' . $this->config['homepageDownloadRefresh'] . '");
-					// End SabNZBd
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrderplexnowplaying':
-				if ($this->config['homepagePlexStreams']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Now Playing...</h2></div>';
-					$item .= '
-				<script>
-				// Plex Stream
-				homepageStream("plex", "' . $this->config['homepageStreamRefresh'] . '");
-				// End Plex Stream
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderplexrecent':
-				if ($this->config['homepagePlexRecent']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Recent...</h2></div>';
-					$item .= '
-				<script>
-				// Plex Recent
-				homepageRecent("plex", "' . $this->config['homepageRecentRefresh'] . '");
-				// End Plex Recent
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderplexplaylist':
-				if ($this->config['homepagePlexPlaylist']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Playlists...</h2></div>';
-					$item .= '
-				<script>
-				// Plex Playlist
-				homepagePlaylist("plex");
-				// End Plex Playlist
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderembynowplaying':
-				if ($this->config['homepageEmbyStreams'] && $this->config['homepageEmbyEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Now Playing...</h2></div>';
-					$item .= '
-				<script>
-				// Emby Stream
-				homepageStream("emby", "' . $this->config['homepageStreamRefresh'] . '");
-				// End Emby Stream
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderembyrecent':
-				if ($this->config['homepageEmbyRecent'] && $this->config['homepageEmbyEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Recent...</h2></div>';
-					$item .= '
-				<script>
-				// Emby Recent
-				homepageRecent("emby", "' . $this->config['homepageRecentRefresh'] . '");
-				// End Emby Recent
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderjellyfinnowplaying':
-				if ($this->config['homepageJellyfinStreams'] && $this->config['homepageJellyfinEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Now Playing...</h2></div>';
-					$item .= '
-				<script>
-				// Jellyfin Stream
-				homepageStream("jellyfin", "' . $this->config['homepageStreamRefresh'] . '");
-				// End Jellyfin Stream
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderjellyfinrecent':
-				if ($this->config['homepageJellyfinRecent'] && $this->config['homepageJellyfinEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Recent...</h2></div>';
-					$item .= '
-				<script>
-				// Jellyfin Recent
-				homepageRecent("jellyfin", "' . $this->config['homepageRecentRefresh'] . '");
-				// End Jellyfin Recent
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderombi':
-				if ($this->config['homepageOmbiEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Requests...</h2></div>';
-					$item .= '
-				<script>
-				// Ombi Requests
-				homepageRequests("' . $this->config['ombiRefresh'] . '");
-				// End Ombi Requests
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrdercalendar':
-				if (
-					($this->config['homepageLidarrEnabled'] && $this->qualifyRequest($this->config['homepageLidarrAuth'])) ||
-					($this->config['homepageSonarrEnabled'] && $this->qualifyRequest($this->config['homepageSonarrAuth'])) ||
-					($this->config['homepageRadarrEnabled'] && $this->qualifyRequest($this->config['homepageRadarrAuth'])) ||
-					($this->config['homepageSickrageEnabled'] && $this->qualifyRequest($this->config['homepageSickrageAuth'])) ||
-					($this->config['homepageCouchpotatoEnabled'] && $this->qualifyRequest($this->config['homepageCouchpotatoAuth'])) ||
-					($this->config['homepageCalendarEnabled'] && $this->qualifyRequest($this->config['homepageCalendarAuth']) && $this->config['calendariCal'] !== '')
-				) {
-					$item .= '
-				<div id="calendar" class="fc fc-ltr m-b-30"></div>
-				<script>
-				// Calendar
-				homepageCalendar("' . $this->config['calendarRefresh'] . '");
-				// End Calendar
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderhealthchecks':
-				if ($this->config['homepageHealthChecksEnabled'] && $this->qualifyRequest($this->config['homepageHealthChecksAuth'])) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Health Checks...</h2></div>';
-					$item .= '
-				<script>
-				// Health Checks
-				homepageHealthChecks("' . $this->config['healthChecksTags'] . '","' . $this->config['homepageHealthChecksRefresh'] . '");
-				// End Health Checks
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderunifi':
-				if ($this->config['homepageUnifiEnabled'] && $this->qualifyRequest($this->config['homepageUnifiAuth'])) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Unifi...</h2></div>';
-					$item .= '
-				<script>
-				// Unifi
-				homepageUnifi("' . $this->config['homepageHealthChecksRefresh'] . '");
-				// End Unifi
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrdertautulli':
-				if ($this->config['homepageTautulliEnabled'] && $this->qualifyRequest($this->config['homepageTautulliAuth'])) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Tautulli...</h2></div>';
-					$item .= '
-				<script>
-				// Tautulli
-				homepageTautulli("' . $this->config['homepageTautulliRefresh'] . '");
-				// End Tautulli
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderPihole':
-				if ($this->config['homepagePiholeEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Pi-hole Stats...</h2></div>';
-					$item .= '
-				<script>
-				// Pi-hole Stats
-				homepagePihole("' . $this->config['homepagePiholeRefresh'] . '");
-				// End Pi-hole Stats
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderMonitorr':
-				if ($this->config['homepageMonitorrEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Monitorr...</h2></div>';
-					$item .= '
-				<script>
-				// Monitorr
-				homepageMonitorr("' . $this->config['homepageMonitorrRefresh'] . '");
-				// End Monitorr
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderWeatherAndAir':
-				if ($this->config['homepageWeatherAndAirEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Weather And Air...</h2></div>';
-					$item .= '
-				<script>
-				// Weather And Air
-				homepageWeatherAndAir("' . $this->config['homepageWeatherAndAirRefresh'] . '");
-				// End Weather And Air
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderSpeedtest':
-				if ($this->config['homepageSpeedtestEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Speedtest...</h2></div>';
-					$item .= '
-				<script>
-				// Speedtest
-				homepageSpeedtest("' . $this->config['homepageSpeedtestRefresh'] . '");
-				// End Speedtest
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderNetdata':
-				if ($this->config['homepageNetdataEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Netdata...</h2></div>';
-					$item .= '
-				<script>
-				// Netdata
-				homepageNetdata("' . $this->config['homepageNetdataRefresh'] . '");
-				// End Netdata
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderOctoprint':
-				if ($this->config['homepageOctoprintEnabled']) {
-					$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Octoprint...</h2></div>';
-					$item .= '
-				<script>
-				// Octoprint
-				homepageOctoprint("' . $this->config['homepageOctoprintRefresh'] . '");
-				// End Octoprint
-				</script>
-				';
-				}
-				break;
-			case 'homepageOrderSonarrQueue':
-				if ($this->config['homepageSonarrQueueEnabled'] && $this->qualifyRequest($this->config['homepageSonarrQueueAuth'])) {
-					if ($this->config['homepageSonarrQueueCombine']) {
-						$item .= '
-					<script>
-					// Sonarr Queue
-					buildDownloaderCombined(\'sonarr\');
-					homepageDownloader("sonarr", "' . $this->config['homepageSonarrQueueRefresh'] . '");
-					// End Sonarr Queue
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// Sonarr Queue
-					$("#' . $homepageItem . '").html(buildDownloader("sonarr"));
-					homepageDownloader("sonarr", "' . $this->config['homepageSonarrQueueRefresh'] . '");
-					// End Sonarr Queue
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrderRadarrQueue':
-				if ($this->config['homepageRadarrQueueEnabled'] && $this->qualifyRequest($this->config['homepageRadarrQueueAuth'])) {
-					if ($this->config['homepageRadarrQueueCombine']) {
-						$item .= '
-					<script>
-					// Radarr Queue
-					buildDownloaderCombined(\'radarr\');
-					homepageDownloader("radarr", "' . $this->config['homepageRadarrQueueRefresh'] . '");
-					// End Radarr Queue
-					</script>
-					';
-					} else {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
-						$item .= '
-					<script>
-					// Radarr Queue
-					$("#' . $homepageItem . '").html(buildDownloader("radarr"));
-					homepageDownloader("radarr", "' . $this->config['homepageRadarrQueueRefresh'] . '");
-					// End Radarr Queue
-					</script>
-					';
-					}
-				}
-				break;
-			case 'homepageOrderJackett':
-				if ($this->config['jackettURL'] && $this->config['jackettToken'] && $this->qualifyRequest($this->config['homepageJackettAuth'])) {
-					if ($this->config['homepageJackettEnabled']) {
-						$item .= '<div class="white-box homepage-loading-box"><h2 class="text-center" lang="en">Loading Jackett...</h2></div>';
-						$item .= '
-					<script>
-					// Jackett
-					homepageJackett();
-					// End Jackett
-					</script>
-					';
-					}
-				}
-				break;
-			default:
-				# code...
-				break;
-		}
-		return $item . '</div>';
-	}
-	
 	public function buildHomepageSettings()
 	{
 		$homepageOrder = $this->homepageOrderList();
@@ -4285,134 +3816,7 @@ class Organizr
 	public function getSettingsHomepage()
 	{
 		$this->setGroupOptionsVariable();
-		return array(
-			$this->calendarSettingsArray(),
-			$this->plexSettingsArray(),
-			$this->embySettingsArray(),
-			$this->jellyfinSettingsArray(),
-			$this->jDownloaderSettingsArray(),
-			$this->sabNZBdSettingsArray(),
-			$this->nzbgetSettingsArray(),
-			$this->transmissionSettingsArray(),
-			$this->qBittorrentSettingsArray(),
-			$this->rTorrentSettingsArray(),
-			$this->delugeSettingsArray(),
-			$this->sonarrSettingsArray(),
-			$this->lidarrSettingsArray(),
-			$this->radarrSettingsArray(),
-			$this->couchPotatoSettingsArray(),
-			$this->sickrageSettingsArray(),
-			$this->ombiSettingsArray(),
-			$this->unifiSettingsArray(),
-			$this->healthChecksSettingsArray(),
-			$this->jackettSettingsArray(),
-			$this->piholeSettingsArray(),
-			$this->tautulliSettingsArray(),
-			$this->monitorrSettingsArray(),
-			$this->weatherSettingsArray(),
-			$this->speedTestSettingsArray(),
-			$this->netdataSettingsArray(),
-			$this->octoprintSettingsArray(),
-			array(
-				'name' => 'CustomHTML-1',
-				'enabled' => strpos('personal,business', $this->config['license']) !== false,
-				'image' => 'plugins/images/tabs/custom1.png',
-				'category' => 'Custom',
-				'settings' => array(
-					'Enable' => array(
-						array(
-							'type' => 'switch',
-							'name' => 'homepageCustomHTMLoneEnabled',
-							'label' => 'Enable',
-							'value' => $this->config['homepageCustomHTMLoneEnabled']
-						),
-						array(
-							'type' => 'select',
-							'name' => 'homepageCustomHTMLoneAuth',
-							'label' => 'Minimum Authentication',
-							'value' => $this->config['homepageCustomHTMLoneAuth'],
-							'options' => $this->groupOptions
-						)
-					),
-					'Code' => array(
-						array(
-							'type' => 'textbox',
-							'name' => 'customHTMLone',
-							'class' => 'hidden customHTMLoneTextarea',
-							'label' => '',
-							'value' => $this->config['customHTMLone'],
-						),
-						array(
-							'type' => 'html',
-							'override' => 12,
-							'label' => 'Custom HTML/JavaScript',
-							'html' => '<button type="button" class="hidden savecustomHTMLoneTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLoneEditor" style="height:300px">' . htmlentities($this->config['customHTMLone']) . '</div>'
-						),
-					)
-				)
-			),
-			array(
-				'name' => 'CustomHTML-2',
-				'enabled' => strpos('personal,business', $this->config['license']) !== false,
-				'image' => 'plugins/images/tabs/custom2.png',
-				'category' => 'Custom',
-				'settings' => array(
-					'Enable' => array(
-						array(
-							'type' => 'switch',
-							'name' => 'homepageCustomHTMLtwoEnabled',
-							'label' => 'Enable',
-							'value' => $this->config['homepageCustomHTMLtwoEnabled']
-						),
-						array(
-							'type' => 'select',
-							'name' => 'homepageCustomHTMLtwoAuth',
-							'label' => 'Minimum Authentication',
-							'value' => $this->config['homepageCustomHTMLtwoAuth'],
-							'options' => $this->groupOptions
-						)
-					),
-					'Code' => array(
-						array(
-							'type' => 'textbox',
-							'name' => 'customHTMLtwo',
-							'class' => 'hidden customHTMLtwoTextarea',
-							'label' => '',
-							'value' => $this->config['customHTMLtwo'],
-						),
-						array(
-							'type' => 'html',
-							'override' => 12,
-							'label' => 'Custom HTML/JavaScript',
-							'html' => '<button type="button" class="hidden savecustomHTMLtwoTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLtwoEditor" style="height:300px">' . htmlentities($this->config['customHTMLtwo']) . '</div>'
-						),
-					)
-				)
-			),
-			array(
-				'name' => 'Misc',
-				'enabled' => true,
-				'image' => 'plugins/images/organizr/logo-no-border.png',
-				'category' => 'Custom',
-				'settings' => array(
-					'YouTube' => array(
-						array(
-							'type' => 'input',
-							'name' => 'youtubeAPI',
-							'label' => 'Youtube API Key',
-							'value' => $this->config['youtubeAPI'],
-							'help' => 'Please make sure to input this API key as the organizr one gets limited'
-						),
-						array(
-							'type' => 'html',
-							'override' => 6,
-							'label' => 'Instructions',
-							'html' => '<a href="https://www.slickremix.com/docs/get-api-key-for-youtube/" target="_blank">Click here for instructions</a>'
-						),
-					)
-				)
-			),
-		);
+		return $this->getHomepageSettingsCombined();
 	}
 	
 	public function isTabNameTaken($name, $id = null)

+ 145 - 0
api/homepage/html.php

@@ -0,0 +1,145 @@
+<?php
+
+trait HTMLHomepageItem
+{
+	public function htmlOneSettingsArray()
+	{
+		return array(
+			'name' => 'CustomHTML-1',
+			'enabled' => strpos('personal,business', $this->config['license']) !== false,
+			'image' => 'plugins/images/tabs/custom1.png',
+			'category' => 'Custom',
+			'settings' => array(
+				'Enable' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'homepageCustomHTMLoneEnabled',
+						'label' => 'Enable',
+						'value' => $this->config['homepageCustomHTMLoneEnabled']
+					),
+					array(
+						'type' => 'select',
+						'name' => 'homepageCustomHTMLoneAuth',
+						'label' => 'Minimum Authentication',
+						'value' => $this->config['homepageCustomHTMLoneAuth'],
+						'options' => $this->groupOptions
+					)
+				),
+				'Code' => array(
+					array(
+						'type' => 'textbox',
+						'name' => 'customHTMLone',
+						'class' => 'hidden customHTMLoneTextarea',
+						'label' => '',
+						'value' => $this->config['customHTMLone'],
+					),
+					array(
+						'type' => 'html',
+						'override' => 12,
+						'label' => 'Custom HTML/JavaScript',
+						'html' => '<button type="button" class="hidden savecustomHTMLoneTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLoneEditor" style="height:300px">' . htmlentities($this->config['customHTMLone']) . '</div>'
+					),
+				)
+			)
+		);
+	}
+	
+	public function htmlTwoSettingsArray()
+	{
+		return array(
+			'name' => 'CustomHTML-2',
+			'enabled' => strpos('personal,business', $this->config['license']) !== false,
+			'image' => 'plugins/images/tabs/custom2.png',
+			'category' => 'Custom',
+			'settings' => array(
+				'Enable' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'homepageCustomHTMLtwoEnabled',
+						'label' => 'Enable',
+						'value' => $this->config['homepageCustomHTMLtwoEnabled']
+					),
+					array(
+						'type' => 'select',
+						'name' => 'homepageCustomHTMLtwoAuth',
+						'label' => 'Minimum Authentication',
+						'value' => $this->config['homepageCustomHTMLtwoAuth'],
+						'options' => $this->groupOptions
+					)
+				),
+				'Code' => array(
+					array(
+						'type' => 'textbox',
+						'name' => 'customHTMLtwo',
+						'class' => 'hidden customHTMLtwoTextarea',
+						'label' => '',
+						'value' => $this->config['customHTMLtwo'],
+					),
+					array(
+						'type' => 'html',
+						'override' => 12,
+						'label' => 'Custom HTML/JavaScript',
+						'html' => '<button type="button" class="hidden savecustomHTMLtwoTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLtwoEditor" style="height:300px">' . htmlentities($this->config['customHTMLtwo']) . '</div>'
+					),
+				)
+			)
+		);
+	}
+	
+	public function htmlHomepagePermissions($key = null)
+	{
+		$permissions = [
+			'one' => [
+				'enabled' => [
+					'homepageCustomHTMLoneEnabled'
+				],
+				'auth' => [
+					'homepageCustomHTMLoneAuth'
+				],
+				'not_empty' => [
+					'customHTMLone'
+				]
+			],
+			'two' => [
+				'enabled' => [
+					'homepageCustomHTMLtwoEnabled'
+				],
+				'auth' => [
+					'homepageCustomHTMLtwoAuth'
+				],
+				'not_empty' => [
+					'customHTMLtwo'
+				]
+			]
+		];
+		if (array_key_exists($key, $permissions)) {
+			return $permissions[$key];
+		} elseif ($key == 'all') {
+			return $permissions;
+		} else {
+			return [];
+		}
+	}
+	
+	public function homepageOrdercustomhtml()
+	{
+		if ($this->homepageItemPermissions($this->htmlHomepagePermissions('one'))) {
+			return '
+				<div id="' . __FUNCTION__ . '">
+					' . $this->config['customHTMLone'] . '
+				</div>
+				';
+		}
+	}
+	
+	public function homepageOrdercustomhtmlTwo()
+	{
+		if ($this->homepageItemPermissions($this->htmlHomepagePermissions('two'))) {
+			return '
+				<div id="' . __FUNCTION__ . '">
+					' . $this->config['customHTMLtwo'] . '
+				</div>
+				';
+		}
+	}
+}

+ 32 - 0
api/homepage/misc.php

@@ -0,0 +1,32 @@
+<?php
+
+trait MiscHomepageItem
+{
+	public function miscSettingsArray()
+	{
+		return array(
+			'name' => 'Misc',
+			'enabled' => true,
+			'image' => 'plugins/images/organizr/logo-no-border.png',
+			'category' => 'Custom',
+			'settings' => array(
+				'YouTube' => array(
+					array(
+						'type' => 'input',
+						'name' => 'youtubeAPI',
+						'label' => 'Youtube API Key',
+						'value' => $this->config['youtubeAPI'],
+						'help' => 'Please make sure to input this API key as the organizr one gets limited'
+					),
+					array(
+						'type' => 'html',
+						'override' => 6,
+						'label' => 'Instructions',
+						'html' => '<a href="https://www.slickremix.com/docs/get-api-key-for-youtube/" target="_blank">Click here for instructions</a>'
+					),
+				)
+			)
+		);
+	}
+	
+}