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/admin/ContentTaxonomy.php |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/inc/admin/ContentTaxonomy.php b/inc/admin/ContentTaxonomy.php
index 5064df1..fcbca46 100644
--- a/inc/admin/ContentTaxonomy.php
+++ b/inc/admin/ContentTaxonomy.php
@@ -5,6 +5,7 @@
 	exit;
 }
 
+use JVBase\registrar\Registrar;
 use JVBase\registry\TaxonomyRegistrar;
 use WP_Error;
 use Exception;
@@ -17,7 +18,7 @@
 {
     public function __construct()
     {
-		if (!jvbSiteHasTermContent()){
+		if (empty(Registrar::getFeatured('is_content', 'term'))){
 			return;
 		}
         add_filter(BASE.'handle_bulk_operation', [ $this, 'processOperation' ], 10, 3);
@@ -50,8 +51,8 @@
         // Handle individual taxonomy rebuild
         if (isset($_POST['rebuild_taxonomy']) && wp_verify_nonce($_POST['_wpnonce'], 'rebuild_taxonomy')) {
             $taxonomy = sanitize_text_field($_POST['taxonomy']);
-
-            if (isset(JVB_TAXONOMY[$taxonomy]) && (JVB_TAXONOMY[$taxonomy]['is_content'] ?? false)) {
+			$registrar = Registrar::getInstance($taxonomy));
+            if ($registrar && $registrar->hasFeature('is_content')) {
                 $results = $this->rebuildCustomTable($taxonomy);
                 // Store results in transient to display after redirect
                 set_transient('jvb_rebuild_results_' . $taxonomy, $results, 300); // 5 minutes
@@ -123,16 +124,17 @@
                     </tr>
                     </thead>
                     <tbody>
-                    <?php foreach (JVB_TAXONOMY as $slug => $config): ?>
-                        <?php if (!($config['is_content'] ?? false)) continue; ?>
-                        <?php
+                    <?php
+					$taxonomies = Registrar::getFeatured('is_content', 'term');
+					foreach ($taxonomies as $slug):
+						$registrar = Registrar::getInstance($slug);
                         $taxonomy = BASE . $slug;
                         $table_info = $this->getTableInfo($slug);
                         $term_count = wp_count_terms($taxonomy, ['hide_empty' => false]);
                         ?>
                         <tr>
                             <td>
-                                <strong><?= esc_html($config['plural'] ?? ucfirst($slug)) ?></strong><br>
+                                <strong><?= esc_html($registrar->getPlural()) ?></strong><br>
                                 <code><?= esc_html($taxonomy) ?></code>
                             </td>
                             <td>
@@ -314,8 +316,6 @@
      */
     public function rebuildCustomTable(string $taxonomy):array
     {
-        global $wpdb;
-
         $results = [
             'success' => 0,
             'errors' => 0,
@@ -324,11 +324,13 @@
         ];
 
         // Check if this is a content taxonomy
-        if (!(JVB_TAXONOMY[$taxonomy]['is_content'] ?? false)) {
+		$registrar = Registrar::getInstance($taxonomy));
+		if (!$registrar->hasFeature('is_content')) {
             $results['messages'][] = "Taxonomy {$taxonomy} is not a content taxonomy";
             return $results;
         }
 
+		global $wpdb;
         $table = $wpdb->prefix . BASE . 'content_' . $taxonomy;
 
         // Check if table exists

--
Gitblit v1.10.0