From 86c6cd3cc099d2480932ede03c12cea01e625c94 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 26 Apr 2026 21:56:28 +0000
Subject: [PATCH] =Requiring files based on Site class settings
---
JVBase.php | 68 +++++++++++++++------------------
1 files changed, 31 insertions(+), 37 deletions(-)
diff --git a/JVBase.php b/JVBase.php
index a4efe54..cf531ec 100644
--- a/JVBase.php
+++ b/JVBase.php
@@ -2,8 +2,7 @@
namespace JVBase;
use JVBase\blocks\CustomBlocks;
-use JVBase\integrations\BlueSky;
-use JVBase\managers\Cache;
+use JVBase\base\Site;
use JVBase\managers\EmailManager;
use JVBase\managers\ErrorHandler;
use JVBase\managers\InvitationsManager;
@@ -14,9 +13,7 @@
use JVBase\managers\DirectoryManager;
use JVBase\managers\ReferralManager;
use JVBase\managers\RoleManager;
-//use JVBase\managers\SchemaManager;
use JVBase\managers\SEO\render\SchemaOutput;
-use JVBase\managers\SEO\SchemaOutputManager;
use JVBase\admin\SEOAdmin;
use JVBase\managers\AdminPages;
use JVBase\managers\NotificationManager;
@@ -31,9 +28,7 @@
use JVBase\rest\routes\ContentRoutes;
use JVBase\rest\routes\TermRoutes;
use JVBase\rest\routes\UploadRoutes;
-//use JVBase\rest\routes\BioRoutes;
use JVBase\rest\routes\SettingsRoutes;
-//use JVBase\rest\routes\ShopRoutes;
use JVBase\rest\routes\ContentTermsRoutes;
use JVBase\rest\routes\SEORoutes;
use JVBase\rest\routes\QueueRoutes;
@@ -42,7 +37,6 @@
use JVBase\rest\routes\LoginRoutes;
use JVBase\rest\routes\NewsRoutes;
use JVBase\rest\routes\ReferralRoutes;
-//use JVBase\rest\routes\MagicLinkRoutes;
use JVBase\rest\routes\ResponseRoutes;
use JVBase\rest\routes\OptionsRoutes;
use JVBase\rest\routes\VoteRoutes;
@@ -50,7 +44,6 @@
use JVBase\rest\routes\ApprovalRoutes;
use JVBase\rest\routes\AdminRoutes;
use JVBase\rest\routes\IntegrationsRoutes;
-use JVBase\utility\Features;
use JVBase\base\SchemaHelper;
if (!defined('ABSPATH')) {
@@ -105,11 +98,19 @@
'seo' => new SchemaOutput(),
'schemaHelper' => new SchemaHelper(),
// 'uploads' => new UploadManager(),
- 'userTerms' => new UserTermsManager(),
+// 'userTerms' => new UserTermsManager(),
'email' => new EmailManager(),
- 'terms' => new TaxonomyRelationships(),
+// 'terms' => new TaxonomyRelationships(),
];
+ if (Site::has('feed_block')) {
+ $this->managers['terms'] = new TaxonomyRelationships();
+ }
+
+ if (Site::hasAll(['dashboard', 'membership', 'feed_block'])) {
+ $this->managers['userTerms'] = new UserTermsManager();
+ }
+
$this->routes = [
'login' => new LoginRoutes(),
'integrations' => new IntegrationsRoutes(),
@@ -120,42 +121,43 @@
'forms' => new FormRoutes()
];
- if (Features::forSite()->has('magicLink')) {
+ if (Site::has('magicLink')) {
// $this->routes['magicLink'] = new MagicLinkRoutes();
$this->managers['magicLink'] = new MagicLinkManager();
}
- if (Features::forSite()->has('referrals')) {
+ if (Site::has('referrals')) {
$this->managers['referral'] = new ReferralManager();
$this->routes['referral'] = new ReferralRoutes();
}
- if (Features::forSite()->has('dashboard')) {
+ if (Site::has('dashboard')) {
$this->managers['dash'] = new DashboardManager();
}
- if (Features::hasIntegration('square')) {
+ if (Site::hasIntegration('square')) {
$this->routes['square'] = new IntegrationsSquareRoutes();
}
- if (Features::hasIntegration('helcim')) {
+ if (Site::hasIntegration('helcim')) {
$this->routes['helcim'] = new IntegrationsHelcimRoutes();
}
- if (Features::forSite()->has('feed_block')) {
+ if (Site::has('feed_block')) {
$this->routes['feed'] = new FeedRoutes();
}
- if (Features::forMembership()->has('notifications')) {
+ $membership = Site::membership();
+ if ($membership && $membership->has('notifications')) {
$this->managers['notifications'] = new NotificationManager();
$this->routes['notifications'] = new NotificationsRoutes();
}
- if (Features::forSite()->has('feed_block') || Features::forSite()->has('dashboard')) {
+ if (Site::has('feed_block') || Site::has('dashboard')) {
$this->routes['term'] = new TermRoutes();
}
- if (Features::forSite()->has('is_directory')) {
+ if (Site::has('is_directory')) {
$this->managers['directory'] = new DirectoryManager();
}
- if (Features::forSite()->has('dashboard')) {
+ if (Site::has('dashboard')) {
$this->routes['error'] = new ErrorRoutes();
$this->routes['admin'] = new AdminRoutes();
$this->routes['content'] = new ContentRoutes();
@@ -165,14 +167,14 @@
$this->routes['options'] = new OptionsRoutes();
}
- if (Features::forSite()->has('favourites')) {
+ if (Site::has('favourites')) {
$this->routes['favourites'] = new FavouritesRoutes();
}
- if (Features::forMembership()->has('forum')) {
+ if ($membership && $membership->has('forum')) {
$this->routes['news'] = new NewsRoutes();
}
- if (Features::forMembership()->has('invitable')) {
+ if ($membership && $membership->has('invitable')) {
$this->managers['invitations'] = new InvitationsManager();
}
if (!empty(Registrar::getFeatured('has_responses'))) {
@@ -182,11 +184,11 @@
$this->routes['vote'] = new VoteRoutes();
}
if (!empty(Registrar::getFeatured('karma'))
- || Features::forMembership()->has('member_verified') ||
- Features::forMembership()->has('term_approval')) {
+ || ($membership && $membership->has('member_verified')) ||
+ ($membership && $membership->has('term_approval'))) {
$this->routes['approvals'] = new ApprovalRoutes();
}
- if (Features::forMembership()->has('can_invite')) {
+ if ($membership && $membership->has('can_invite')) {
$this->routes['invites'] = new Invitations();
}
@@ -201,17 +203,9 @@
protected function setupIntegrations(): void
{
- if (array_key_exists('integrations', JVB_SITE)) {
- foreach (JVB_SITE['integrations'] as $service => $use) {
- if (!$use) {
- continue;
- }
- if (array_key_exists($service, $this->serviceMap)) {
- $this->integrations[$service] = new $this->serviceMap[$service]();
- }
-
- }
- }
+ foreach(array_keys(Site::getIntegrations()) as $integration) {
+ $this->integrations[$integration] = new $this->serviceMap[$integration]();
+ }
}
public function registeredContent(): array
--
Gitblit v1.10.0