From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan
---
inc/integrations/Integrations.php | 31 +++++++++++--------------------
1 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/inc/integrations/Integrations.php b/inc/integrations/Integrations.php
index 08c375f..e059b5e 100644
--- a/inc/integrations/Integrations.php
+++ b/inc/integrations/Integrations.php
@@ -3,8 +3,8 @@
use Exception;
use JVBase\managers\Cache;
-use JVBase\managers\UploadManager;
-use JVBase\meta\MetaManager;
+use JVBase\meta\Form;
+use JVBase\meta\Meta;
use JVBase\managers\ErrorHandler;
use WP_Error;
use WP_Post;
@@ -2081,20 +2081,11 @@
*/
protected function mapFieldsToService(int $postID, array $mapping): array
{
- $meta_manager = new MetaManager($postID, 'post');
- $post = get_post($postID);
+ $meta_manager = Meta::forPost($postID);
$service_data = [];
foreach ($mapping as $wp_field => $service_field) {
- $value = null;
-
- // Check if it's a post field
- if (property_exists($post, $wp_field)) {
- $value = $post->$wp_field;
- } else {
- // It's a meta field
- $value = $meta_manager->getValue($wp_field);
- }
+ $value = $meta_manager->get($wp_field);
if ($value !== null && $value !== '') {
$this->setNestedValue($service_data, $service_field, $value);
@@ -2169,7 +2160,7 @@
protected function getSyncFields(int $postID, string $type, array $additional = []):array
{
- $meta = new MetaManager($postID, $type);
+ $meta = new Meta($postID, $type);
$fieldsToCheck = [
'share_to_' . $this->service_name,
'_keep_synced_' . $this->service_name,
@@ -2930,7 +2921,7 @@
return '';
}
- $meta = new MetaManager($this->userID, 'integrations');
+ $meta = Meta::forOptions($this->userID.'_integrations');
$is_connected = $this->isSetUp();
$credentials = $this->getCredentials();
@@ -3007,7 +2998,7 @@
$config['value'] = $credentials[$name]??'';
$config['autocomplete'] = 'off';
$config['base'] = $this->service_name.'_';
- $meta->render('form', $name, $config);
+ Form::render($name, null, $config);
}
}
if ($this->handleWebhooks) {
@@ -3038,7 +3029,7 @@
$config['value'] = $credentials[$name]??'';
$config['base'] = $this->service_name.'_';
$config['autocomplete'] = 'off';
- $meta->render('form', $name, $config);
+ Form::render($name,null, $config);
}
?>
</details>
@@ -3277,7 +3268,7 @@
if (empty($types)) {
return;
}
- $meta = new MetaManager($this->userID, 'integrations');
+ $meta = Meta::forOptions($this->userID.'_integrations');
?>
<form>
<h1><?= $this->title?> Defaults:</h1>
@@ -3289,7 +3280,7 @@
$config['base'] = $this->service_name.'_';
$config['autocomplete'] = 'off';
- $meta->render('form', $name, $config);
+ echo Form::render($name, null, $config);
}
foreach ($this->syncPostTypes as $type) {
$config = JVB_CONTENT[$type];
@@ -3309,7 +3300,7 @@
$c['hint'] = $c['description'];
unset($c['description']);
}
- $meta->render('form', $name, $c);
+ echo Form::render($name, null, $c);
}
?>
</details>
--
Gitblit v1.10.0