From 3d25ad7de4fdbb3eba2cde2a62422e6be5d79a0a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 25 Aug 2026 22:57:22 +0000
Subject: [PATCH] =It's been a minute. I went through the Routes and associated Managers and ensured they played together well. Reworked the Cache.php, and I think I caught all the references. Moving away from JVBase() root class, to individuall classes that are Instanced. Double checked for the ABSPATH check in every file, and added index.php to every directory that didn't already have it. Also still working on the MenuBlock to work with WooCommerce for now for Northeh
---
inc/rest/routes/ContentTermsRoutes.php | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/inc/rest/routes/ContentTermsRoutes.php b/inc/rest/routes/ContentTermsRoutes.php
index 08fda0d..8886996 100644
--- a/inc/rest/routes/ContentTermsRoutes.php
+++ b/inc/rest/routes/ContentTermsRoutes.php
@@ -1,8 +1,12 @@
<?php
namespace JVBase\rest\routes;
+use JVBase\Instance;
+use JVBase\managers\Cache;
use JVBase\managers\queue\executors\ContentTermExecutor;
+use JVBase\managers\queue\Queue;
use JVBase\managers\queue\TypeConfig;
+use JVBase\managers\Roles;
use JVBase\registrar\Registrar;
use JVBase\rest\Rest;
use JVBase\rest\Route;
@@ -31,12 +35,13 @@
*/
class ContentTermsRoutes extends Rest
{
+ use Instance;
protected string $taxonomy;
protected Registrar $registrar;
protected ?CustomTable $historyTable = null;
protected ?CustomTable $requestsTable = null;
-
- public function __construct(string $taxonomy = '')
+ //TODO: This needs some work. We need to move most logic into it's own manager class
+ protected function __construct(string $taxonomy = '')
{
$this->taxonomy = jvbNoBase($taxonomy);
@@ -44,6 +49,7 @@
$this->registrar = Registrar::getInstance($this->taxonomy);
$this->cacheName = $this->taxonomy;
parent::__construct();
+ $this->cache = Cache::for($this->taxonomy, 'term', DAY_IN_SECONDS);
$this->setupTables();
$this->setupCacheConnections();
}
@@ -53,7 +59,7 @@
public function registerContentTermsExecutors():void
{
- $registry = JVB()->queue()->registry();
+ $registry = Queue::getInstance()->registry();
$executor = new ContentTermExecutor();
$taxonomies = Registrar::withFeature('is_content', 'term');
@@ -205,7 +211,7 @@
}
return user_can($userID, 'manage_options') ||
- JVB()->roles()->isManager($userID, $termID);
+ Roles::getInstance()()->isManager($userID, $termID);
}
public function checkOwnerPermission(WP_REST_Request $request): bool
@@ -218,7 +224,7 @@
}
return user_can($userID, 'manage_options') ||
- JVB()->roles()->isOwner($userID, $termID);
+ Roles::getInstance()()->isOwner($userID, $termID);
}
/**
@@ -233,7 +239,7 @@
unset($data['user'], $data['term_id']);
// Queue the update
- $op = JVB()->queue()->add(
+ $op = Queue::getInstance()->add(
"{$this->taxonomy}_update",
$userID,
array_merge(['term_id' => $termID], $data),
@@ -306,7 +312,7 @@
$targetUserID = (int)$request->get_param('target_user');
// Queue the operation
- $op = JVB()->queue()->add(
+ $op = Queue::getInstance()->add(
"{$this->taxonomy}_member_{$action}",
$userID,
[
@@ -469,7 +475,7 @@
});
// Notify user
- JVB()->notification()->addNotification(
+ NotificationManager::getInstance()->addNotification(
$requestData['user_id'],
'request_' . $status,
[
@@ -508,7 +514,7 @@
return $this->error('Invalid target user');
}
- $roleManager = JVB()->roles();
+ $roleManager = Roles::getInstance()();
try {
$result = match($role) {
@@ -548,13 +554,13 @@
*/
protected function notifyTermManagers(int $termID, int $actingUserID, string $notificationType): void
{
- $roleManager = JVB()->roles();
+ $roleManager = Roles::getInstance()();
$managers = $roleManager->getManagedTerms($actingUserID, $this->taxonomy);
$term = get_term($termID, jvbCheckBase($this->taxonomy));
foreach ($managers as $managerID) {
- JVB()->notification()->addNotification(
+ NotificationManager::getInstance()->addNotification(
$managerID,
$notificationType,
[
--
Gitblit v1.10.0