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/blocks/GMBReviewBlock.php |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/inc/blocks/GMBReviewBlock.php b/inc/blocks/GMBReviewBlock.php
index c6255f3..a57c694 100644
--- a/inc/blocks/GMBReviewBlock.php
+++ b/inc/blocks/GMBReviewBlock.php
@@ -1,13 +1,20 @@
 <?php
 namespace JVBase\blocks;
 
-use JVBase\managers\Cache;
+use JVBase\base\Site;
+use JVBase\integrations\services\GoogleMyBusiness;
+//use JVBase\managers\Cache;
 use WP_Block;
-
+if (!defined('ABSPATH')) {
+	exit;
+}
 class GMBReviewBlock {
-	protected Cache $cache;
+//	protected Cache $cache;
 	public function __construct()
 	{
+		if (!Site::hasIntegration('gmb')){
+			return;
+		}
 		add_action('init', [ $this, 'registerBlock' ]);
 	}
 
@@ -34,6 +41,9 @@
 	 */
 	public function render(array $attributes, string $content, WP_Block $block):string
 	{
+		if (!Site::hasIntegration('gmb')) {
+			return '';
+		}
 		$count = $attributes['count'] ?? 5;
 		$showRating = $attributes['showRating'] ?? true;
 		$showDate = $attributes['showDate'] ?? true;
@@ -49,11 +59,16 @@
 			$inheritUser = null;
 		}
 		try {
-			$gmb = JVB()->connect('gmb', $inheritUser);
-			if (!$gmb->isSetUp()) {
+			$gmb = GoogleMyBusiness::getInstance();
+			$gmb->switchUser($inheritUser);
+			if (!$gmb->isSetUp()
+				|| !method_exists($gmb, 'getReviews')
+				|| !method_exists($gmb, 'getReviewsViewUrl')
+				|| !method_exists($gmb, 'getReviewUrl')) {
 				error_log('GMB Not set up for: '.(int)$inheritUser);
 				return '';
 			}
+
 			$gotReviews = $gmb->getReviews();
 			// Get all data
 			$allReviews = $gotReviews['reviews']??[];

--
Gitblit v1.10.0