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/integrations/Integrations.php | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/inc/integrations/Integrations.php b/inc/integrations/Integrations.php
index f9a34ef..21cf95f 100644
--- a/inc/integrations/Integrations.php
+++ b/inc/integrations/Integrations.php
@@ -29,6 +29,9 @@
* These properties define how the integration connects to external services
*/
protected string|array $apiBase = ''; // Base URL(s) for API endpoints. Array format: ['base' => '', 'auth' => '']
+ /**
+ * @var array<APIEndpoint> An array of endpoints objects, with optional create, update, delete, batch<x>, and batchImport
+ */
protected array $apiEndpoints = []; // Valid endpoint paths for this service
protected int $refresh_interval = 0; //seconds before expiry to refresh tokens. 0 to disable
@@ -56,6 +59,7 @@
$this->userID = $userID;
$this->cache = Cache::for('integrations_' . $this->cacheName);
+
$this->getPostTypes();
$this->getTaxonomies();
$this->getUsers();
@@ -259,7 +263,7 @@
}
try {
- if ($this->isOAuthService && !$this->hasOAuthCredentials()){
+ if (!$this->hasOAuthCredentials()){
//If this is an OAuth service, we might only be saving the app credentials first
$result = true;
} else {
@@ -334,7 +338,7 @@
array $data,
array $options = []
):bool {
- $queue = JVB()->queue();
+ $queue = Queue::getInstance();
$queued = $queue->queueOperation(
$type,
@@ -397,8 +401,11 @@
if (!empty($this->syncPostTypes)) {
- $this->addSavePost();
- add_action('transition_post_status', [$this, 'handlePostStatusTransition'], 10, 3);
+ if (method_exists($this, 'addSavePost')) {
+ $this->addSavePost();
+ }
+
+// add_action('transition_post_status', [$this, 'handlePostStatusTransition'], 10, 3);
if ($this->canSync['delete']) {
add_action('before_delete_post', [$this, 'handleDeletePost'], 10, 1);
@@ -486,10 +493,7 @@
public function hasOAuthCredentials(?int $userID = null): bool
{
- if ($userID !== $this->userID) {
- $this->switchUser($userID);
- }
- return $this->hasOAuth && $this->hasValidOAuth();
+ return false;
}
@@ -543,7 +547,7 @@
public static function hasExtraOptions():bool
{
- return static::getInstance()::$hasExtraOptions;
+ return self::$hasExtraOptions;
}
/**
@@ -603,7 +607,7 @@
if ($jpegVersion !== '' && is_int($jpegVersion)) {
return $jpegVersion;
}
- $uploader = new UploadManager();
+ $uploader = UploadManager::getInstance();
$converted = $uploader->convertImageTo($imgID, 'jpeg', 80, false);
if ($converted && !is_wp_error($converted)) {
update_post_meta($imgID, BASE . 'jpeg_version', $converted['attachment_id']);
@@ -616,6 +620,7 @@
/**
* Used by JVBase\registrar\helpers\AddIntegrationFields.php
+ * @param string|null $content_type
* @return array
*/
public function getAdditionalFields(?string $content_type = null):array
--
Gitblit v1.10.0