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/rest/routes/FormRoutes.php |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/inc/rest/routes/FormRoutes.php b/inc/rest/routes/FormRoutes.php
index 1cf8b23..f2bd9de 100644
--- a/inc/rest/routes/FormRoutes.php
+++ b/inc/rest/routes/FormRoutes.php
@@ -1,6 +1,9 @@
 <?php
 namespace JVBase\rest\routes;
 
+use JVBase\Instance;
+use JVBase\integrations\services\Cloudflare;
+use JVBase\managers\Emails;
 use JVBase\meta\Sanitizer;
 use JVBase\meta\Validator;
 use JVBase\rest\PermissionHandler;
@@ -25,6 +28,7 @@
  */
 class FormRoutes extends Rest
 {
+	use Instance;
 	protected FormBlock $form_block;
 
 	public function __construct()
@@ -121,15 +125,18 @@
 
 	protected function verifyTurnstile(string $token): bool
 	{
-		if (!Site::hasIntegration('cloudflare') || !JVB()->connect('cloudflare')->isSetUp()) {
+		if (!Site::hasIntegration('cloudflare') ) {
 			return true;
 		}
-
+		$cloudflare = Cloudflare::getInstance();
+		if (!$cloudflare->isSetUp()) {
+			return true;
+		}
 		if (empty($token)) {
 			return false;
 		}
 
-		return JVB()->connect('cloudflare')->verifyTurnstile($token);
+		return $cloudflare->verifyTurnstile($token);
 	}
 
 	/**
@@ -313,14 +320,14 @@
 		}
 
 		// Build email body
-		$body = JVB()->email()->h2($form_config['title']);
-		$body .= '<p style="font-size:13px;color:' . JVB()->email()->colours['dark-200'] . ';">
+		$body = Emails::getInstance()->h2($form_config['title']);
+		$body .= '<p style="font-size:13px;color:' . Emails::getInstance()->colours['dark-200'] . ';">
         Submitted: ' . current_time('F j, Y \a\t g:i A') . '
     </p>';
 
 		// Add thread notice if CC'd
 		if ($submitter_email) {
-			$body .= JVB()->email()->notice(
+			$body .= Emails::getInstance()->notice(
 				'<strong>Email Thread Created</strong><br>Reply to this email to continue the conversation with ' .
 				esc_html($submitter_name ?: 'the submitter') . '.'
 			);
@@ -360,21 +367,21 @@
 			];
 		}
 
-		$body .= JVB()->email()->spacer(20);
-		$body .= JVB()->email()->table($form);
+		$body .= Emails::getInstance()->spacer(20);
+		$body .= Emails::getInstance()->table($form);
 
 		// Show attachment info
 		$attachments = $this->processFileAttachments($files);
 		if (!empty($attachments)) {
-			$body .= JVB()->email()->spacer(10);
-			$body .= JVB()->email()->alert(
+			$body .= Emails::getInstance()->spacer(10);
+			$body .= Emails::getInstance()->alert(
 				sprintf('%d file(s) attached to this email', count($attachments)),
 				'info'
 			);
 		}
 
 		// Send the email
-		return JVB()->email()->sendEmail(
+		return Emails::getInstance()->sendEmail(
 			$to,
 			$subject,
 			$body,

--
Gitblit v1.10.0