From 46d681c6b825d21b3f698d793c4e630c687d90ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 21 May 2026 21:41:53 +0000
Subject: [PATCH] =Major CustomBlocks.php overhaul, expanding block support and customization from the editor. theme.json should now be updated on new themes to set brand colours, etc. Also note: major change to .col vs .row alignment: simplifying it to .top .bottom vs the confusion of the differences for .col/.row .start and .a-start
---
JVBase.php | 91 ++++++++++++++++++++++++++-------------------
1 files changed, 52 insertions(+), 39 deletions(-)
diff --git a/JVBase.php b/JVBase.php
index 255ff5f..f0b0c3d 100644
--- a/JVBase.php
+++ b/JVBase.php
@@ -2,10 +2,11 @@
namespace JVBase;
use JVBase\blocks\CustomBlocks;
-use JVBase\integrations\BlueSky;
-use JVBase\managers\Cache;
+use JVBase\base\Site;
+use JVBase\managers\ApprovalManager;
use JVBase\managers\EmailManager;
use JVBase\managers\ErrorHandler;
+use JVBase\managers\FavouritesManager;
use JVBase\managers\InvitationsManager;
use JVBase\managers\LoginManager;
use JVBase\managers\MagicLinkManager;
@@ -14,12 +15,11 @@
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;
+use JVBase\managers\TaxonomyRelationships;
use JVBase\managers\UserTermsManager;
use JVBase\registrar\Registrar;
use JVBase\rest\routes\FeedRoutes;
@@ -30,9 +30,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;
@@ -41,7 +39,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;
@@ -49,7 +46,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')) {
@@ -104,10 +100,19 @@
'seo' => new SchemaOutput(),
'schemaHelper' => new SchemaHelper(),
// 'uploads' => new UploadManager(),
- 'userTerms' => new UserTermsManager(),
+// 'userTerms' => new UserTermsManager(),
'email' => new EmailManager(),
+// '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(),
@@ -118,42 +123,46 @@
'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 (!empty(Registrar::getFeatured('approve_new'))) {
+ $this->managers['approvals'] = new ApprovalManager();
+ }
+ 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();
@@ -163,14 +172,15 @@
$this->routes['options'] = new OptionsRoutes();
}
- if (Features::forSite()->has('favourites')) {
+ if (Site::has('favourites')) {
+ $this->managers['favourites'] = new FavouritesManager();
$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'))) {
@@ -180,11 +190,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();
}
@@ -199,17 +209,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
@@ -300,8 +302,9 @@
public function userCanConnect(string $service, int $userID): bool
{
- $allowed = JVB_USER[jvbUserRole($userID)]['integrations'] ?? [];
- return user_can($userID, 'manage_options') || in_array($service, $allowed);
+ $role = jvbUserRole($userID);
+ $registrar = Registrar::getInstance($role);
+ return user_can($userID, 'manage_options') || $registrar->hasIntegration($service);
}
public function getAvailableServices(bool $keys = true): array
@@ -362,7 +365,7 @@
if (!empty ($buttons)) {
?>
- <section class="additional-actions">
+ <section class="main-actions">
<div class="buttons col">
<?= implode($buttons); ?>
</div>
@@ -387,4 +390,14 @@
{
return $this->managers['schemaHelper'];
}
+
+ public function termRelationships():TaxonomyRelationships
+ {
+ return $this->managers['terms'];
+ }
+
+ public function approvals ():ApprovalManager|false
+ {
+ return $this->managers['approvals']??false;
+ }
}
--
Gitblit v1.10.0