From 772462eeca3002a1d52508aeba485aab2b4742ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 03 Mar 2026 19:06:19 +0000
Subject: [PATCH] =MAJOR OVERHAUL. Likely should have made a new branch ages ago. Key changes: Registrar.php is the base for custom post types, taxonomies, and user roles. Replaces JVB_CONTENT, JVB_TAXONOMY, and JVB_USER constants, eliminates most of Features.php (except for JVB_SITE, JVB_MEMBERSHIP), and has built in sanitizing and validation via sub-classes. Also started a major overhaul of the Schema output. Created a shit ton of property traits and classes to help sanitize and ensure proper data for different schema types. Still a bunch to do, but better to be starting committing changes here on this other branch.

---
 inc/managers/queue/executors/UploadExecutor.php |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/inc/managers/queue/executors/UploadExecutor.php b/inc/managers/queue/executors/UploadExecutor.php
index cc828d5..91b4741 100644
--- a/inc/managers/queue/executors/UploadExecutor.php
+++ b/inc/managers/queue/executors/UploadExecutor.php
@@ -6,6 +6,7 @@
 use JVBase\managers\UploadManager;
 use JVBase\meta\Meta;
 use Exception;
+use JVBase\registrar\Registrar;
 use JVBase\utility\Features;
 
 if (!defined('ABSPATH')) {
@@ -384,7 +385,8 @@
 		}
 
 		$content = jvbCheckBase($data['content']);
-		if (Features::forContent($data['content'])->has('is_timeline')) {
+		$registrar = Registrar::getInstance($data['content']);
+		if ($registrar && $registrar->hasFeature('is_timeline')) {
 			return $this->processTimelineUploads($operation, $data, $progress, $all_uploads);
 		}
 
@@ -438,14 +440,11 @@
 
 	protected function createPostFromGroup(array $post, int $index, string $content, array $uploads, Operation $op):array|false
 	{
-		$config = JVB_CONTENT[jvbNoBase($content)]??false;
-		if (!$config) {
-			throw new Exception('No config found for content: '.$content.'.');
-		}
+		$registrar = Registrar::getInstance($content);
 
 		$post_title = array_key_exists('post_title', $post['fields'])
 			? sanitize_text_field($post['fields']['post_title'])
-			: 'New '. $config['singular'].' '.($index + 1);
+			: ($registrar ? 'New '. $registrar->getSingular().' '.($index + 1) : 'New Item '.($index + 1));
 
 		$post_excerpt = array_key_exists('post_excerpt', $post['fields'])
 			? sanitize_textarea_field($post['fields']['post_excerpt'])
@@ -489,7 +488,7 @@
 
 		if (!empty($gallery)) {
 			$meta = Meta::forPost($ID);
-			$fields = jvbGetFields($content, 'post');
+			$fields = Registrar::getFieldsFor($content);
 			//add images to first found gallery field
 			$found = false;
 			foreach ($fields as $name =>$config) {
@@ -521,9 +520,10 @@
 		$errors = [];
 
 		$content = jvbCheckBase($data['content']);
-		$config = Features::getConfig($content);
+		$registrar = Registrar::getInstance($data['content']);
 
-		$defaultTitle = 'New '.$config['singular']. ' ';
+
+		$defaultTitle = ($registrar) ? 'New '.$registrar->getSingular(). ' ' : 'New Item ';
 		foreach($data['posts'] as $index => $post) {
 			try {
 				$title = array_key_exists('post_title', $post['fields'])

--
Gitblit v1.10.0