From d7c8752b4d8f688a13645130d4c3237efd5ad1bf Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 27 Aug 2026 15:31:41 +0000
Subject: [PATCH] =class references fix in registrar/config/schema

---
 checks.php |   63 ++++++++++++++++---------------
 1 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/checks.php b/checks.php
index d968100..4339047 100644
--- a/checks.php
+++ b/checks.php
@@ -1,5 +1,6 @@
 <?php
 
+use JVBase\base\Options;
 use JVBase\base\Site;
 use JVBase\managers\Cache;
 use JVBase\registrar\Registrar;
@@ -18,46 +19,48 @@
 }
 
 
-//function jvbIsOpen():bool
-//{
-//
-//	if (!jvbCheck('limit_hours', JVB_SITE)) {
-//		return true;
-//	}
-//	if (get_option(BASE.'open_to_public') !== '1') {
-//		return false;
-//	}
-//	//Check if today_hours is set
-//	if (get_option(BASE.'today_hours')) {
-//		return jvbIsTimeBetween();
-//	}
-//	//Default to the stored settings
-//	return jvbIsCurrentlyOpen();
-//}
+
+function jvbIsOpen():bool
+{
+	if (!Site::has('limit_hours')) {
+		return true;
+	}
+	if (Options::get('open_to_public') !== '1') {
+		return false;
+	}
+	if (!empty(Options::get('today_hours'))) {
+		return jvbIsTimeBetween();
+	}
+	return jvbIsCurrentlyOpen();
+}
 
 
 function jvbTermHasPosts(int $termID, string $taxonomy):bool
 {
-	$cache = Cache::for('termUtility', 30*60)->connect('taxonomy');
+	$cache = Cache::for('termUtility', 'term', 30*60);
 	return $cache->remember(
 		$termID,
 		function() use($taxonomy, $termID) {
 			$taxonomy = jvbCheckBase($taxonomy);
 			$tax = get_taxonomy($taxonomy);
-			$query = new WP_Query([
-				'post_type'	=> $tax->object_type,
-				'posts_per_page' => 1,
-				'fields' => 'ids',
-				'tax_query'	=> [
-					[
-						'taxonomy' => $taxonomy,
-						'terms'	=> $termID
+			if ($tax) {
+				$query = new WP_Query([
+					'post_type'	=> $tax->object_type,
+					'posts_per_page' => 1,
+					'fields' => 'ids',
+					'tax_query'	=> [
+						[
+							'taxonomy' => $taxonomy,
+							'terms'	=> $termID
+						]
 					]
-				]
-			]);
-			$result = ($query->have_posts()) ? 'true' : 'false';
-			wp_reset_postdata();
-			return $result;
+				]);
+				$result = ($query->have_posts()) ? 'true' : 'false';
+				wp_reset_postdata();
+				return $result;
+
+			}
+			return 'false';
 		}
 	);
 }

--
Gitblit v1.10.0