From f94860aacd6200fb24c9e7431eb379a368cb392d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 10 Jul 2026 00:35:44 +0000
Subject: [PATCH] =Refactored CredentialsManager.php to utilize a CustomTable instance instead
---
JVBase.php | 49 ++++++++++++++++++++++++++++---------------------
1 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/JVBase.php b/JVBase.php
index bf0db8a..e771147 100644
--- a/JVBase.php
+++ b/JVBase.php
@@ -11,7 +11,7 @@
use JVBase\managers\LoginManager;
use JVBase\managers\MagicLinkManager;
use JVBase\managers\queue\Queue;
-use JVBase\managers\DashboardManager;
+use JVBase\managers\Dashboard\DashboardManager;
use JVBase\managers\DirectoryManager;
use JVBase\managers\ReferralManager;
use JVBase\managers\RoleManager;
@@ -47,6 +47,7 @@
use JVBase\rest\routes\AdminRoutes;
use JVBase\rest\routes\IntegrationsRoutes;
use JVBase\base\SchemaHelper;
+use UserRoutes;
if (!defined('ABSPATH')) {
exit;
@@ -85,7 +86,7 @@
}
- public function __construct()
+ private function __construct()
{
$this->customBlocks = new CustomBlocks();
$this->managers = [
@@ -120,10 +121,11 @@
'queue' => new QueueRoutes(),
'settings' => new SettingsRoutes(),
'upload' => new UploadRoutes(),
- 'forms' => new FormRoutes()
+ 'forms' => new FormRoutes(),
+ 'user' => new UserRoutes()
];
- if (Site::has('magicLink')) {
+ if (Site::has('magic_link')) {
// $this->routes['magicLink'] = new MagicLinkRoutes();
$this->managers['magicLink'] = new MagicLinkManager();
}
@@ -132,9 +134,6 @@
$this->routes['referral'] = new ReferralRoutes();
}
- if (Site::has('dashboard')) {
- $this->managers['dash'] = new DashboardManager();
- }
if (Site::hasIntegration('square')) {
$this->routes['square'] = new IntegrationsSquareRoutes();
@@ -198,6 +197,11 @@
$this->routes['invites'] = new Invitations();
}
+
+ if (Site::has('dashboard')) {
+ $this->managers['dash'] = new DashboardManager();
+ }
+
$this->setupIntegrations();
add_action('wp_footer', [$this, 'additionalActions']);
@@ -210,7 +214,7 @@
protected function setupIntegrations(): void
{
foreach(array_keys(Site::getIntegrations()) as $integration) {
- $this->integrations[$integration] = new $this->serviceMap[$integration]();
+ $this->integrations[$integration] = $this->serviceMap[$integration]::getInstance();
}
}
@@ -292,17 +296,20 @@
public function connect(string $service, ?int $userID = null): mixed
{
- if ($userID) {
- if (!$this->userCanConnect($service, $userID)) {
- return null;
- }
-
- if (!array_key_exists($service, $this->integrations)) {
- return null;
- }
- return new $this->serviceMap[$service]($userID);
- }
- return (array_key_exists($service, $this->integrations)) ? $this->integrations[$service] : null;
+// if ($userID) {
+// if (!$this->userCanConnect($service, $userID)) {
+// return null;
+// }
+//
+// if (!array_key_exists($service, $this->integrations)) {
+// return null;
+// }
+//
+// return $this->serviceMap[$service]::getInstance($userID);
+// }
+ return is_null($userID) ?
+ $this->integrations[$service]??null :
+ (array_key_exists($service, $this->integrations) ? $this->serviceMap[$service]::getInstance($userID) : null);
}
public function userCanConnect(string $service, int $userID): bool
@@ -372,10 +379,10 @@
?>
<section class="main-actions">
<div class="buttons col">
- <?= implode($buttons); ?>
+ <?= implode('', $buttons); ?>
</div>
<div class="actions">
- <?= implode($contents); ?>
+ <?= implode('', $contents); ?>
</div>
</section>
<?php
--
Gitblit v1.10.0