From 235ce5716edc2f7cbe80fdccf26eac7269587839 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 08 Jun 2026 04:38:18 +0000
Subject: [PATCH] =FavouritesManager.php and FavouritesRoutes.php fixes. Moving all logic to FavouritesManager.php. Still some left to do

---
 inc/integrations/GoogleMyBusiness.php |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/inc/integrations/GoogleMyBusiness.php b/inc/integrations/GoogleMyBusiness.php
index 6e823b2..5893851 100644
--- a/inc/integrations/GoogleMyBusiness.php
+++ b/inc/integrations/GoogleMyBusiness.php
@@ -1,8 +1,7 @@
 <?php
 namespace JVBase\integrations;
 
-use JVBase\meta\MetaManager;
-use JVBase\managers\CacheManager;
+use JVBase\meta\Meta;
 use WP_Error;
 if (!defined('ABSPATH')) {
 	exit;
@@ -10,6 +9,11 @@
 
 class GoogleMyBusiness extends Integrations
 {
+	protected array $allowedContent = [
+		'menu_item',
+		'post',
+		'event',
+	];
 	private ?string $access_token = null;
 	protected string $readMask = 'name,title,storefrontAddress,metadata,openInfo,storeCode,categories,phoneNumbers,labels,specialHours';
 	private ?string $location = null;
@@ -130,7 +134,7 @@
 		);
 
 		if (JVB_TESTING) {
-			$this->cache->clear();
+			$this->cache->flush();
 		}
 	}
 
@@ -283,7 +287,7 @@
 		}
 
 		$postID = $data['post_id'];
-		$meta = new MetaManager($postID, 'post');
+		$meta = Meta::forPost($postID);
 		$fields = [
 			'start_date',
 			'end_date',
@@ -319,7 +323,7 @@
 			$result =  $this->updatePost($fields["_{$this->service_name}_item_id"], $data);
 		} else {
 			$result = $this->createPost($data);
-			$meta->updateValue("_{$this->service_name}_item_id", $result['name']);
+			$meta->set("_{$this->service_name}_item_id", $result['name']);
 		}
 
 		return [
@@ -340,7 +344,7 @@
 		}
 
 		$postID = $data['post_id'];
-		$meta = new MetaManager($postID, 'post');
+		$meta = Meta::forPost($postID);
 		$fields = [
 			'post_excerpt',
 			'post_title',
@@ -372,7 +376,7 @@
 			$result =  $this->updatePost($fields["_{$this->service_name}_item_id"], $data);
 		} else {
 			$result = $this->createPost($data);
-			$meta->updateValue("_{$this->service_name}_item_id", $result['name']);
+			$meta->set("_{$this->service_name}_item_id", $result['name']);
 		}
 
 		return [
@@ -394,7 +398,7 @@
 		}
 
 		$postID = $data['post_id'];
-		$meta = new MetaManager($postID, 'post');
+		$meta = Meta::forPost($postID);
 		$fields = [
 			'post_excerpt',
 			'post_title',
@@ -423,7 +427,7 @@
 			$result =  $this->updatePost($fields["_{$this->service_name}_item_id"], $data);
 		} else {
 			$result = $this->createPost($data);
-			$meta->updateValue("_{$this->service_name}_item_id", $result['name']);
+			$meta->set("_{$this->service_name}_item_id", $result['name']);
 		}
 
 		return [
@@ -2276,7 +2280,7 @@
 	{
 		try {
 			// Use the static method to clear the entire cache group
-			$this->cache->clear();
+			$this->cache->flush();
 			return true;
 
 		} catch (\Exception $e) {
@@ -2471,7 +2475,7 @@
 	protected function collectMenu(array $menu_items): array
 	{
 
-		$defaultMeta = new MetaManager($this->userID, 'integrations');
+		$defaultMeta = Meta::forOptions($this->userID.'_integrations');
 		$defaults = ['menu_name', 'menu_description', 'default_section', 'cuisines', 'source_url', 'language', 'default_currency'];
 		$defaults = $defaultMeta->getAll($defaults);
 
@@ -2532,7 +2536,7 @@
 
 	protected function buildMenuItem(\WP_Post $item, array $defaults):array
 	{
-		$meta = new MetaManager($item->ID, 'post');
+		$meta = Meta::forPost($item->ID);
 		$fields = $this->mappedMenuFields($item->post_type);
 		$values = $meta->getAll(array_values($fields));
 
@@ -2661,8 +2665,8 @@
 
 	protected function getMenuSectionsOrder(array $sections_map):array
 	{
-		$optionsMeta = new MetaManager(null, 'options');
-		$sectionOrder = $optionsMeta->getValue('menu_section_order');
+		$optionsMeta = Meta::forOptions('options');
+		$sectionOrder = $optionsMeta->get('menu_section_order');
 
 		// Build final GMB menu structure
 		$ordered = [];
@@ -2698,8 +2702,8 @@
 
 		// Collect cuisines from individual items if specified
 		foreach ($menu_items as $item) {
-			$meta = new MetaManager($item->ID, 'post');
-			$item_cuisines = $meta->getValue('cuisines');
+			$meta = Meta::forPost($item->ID);
+			$item_cuisines = $meta->get('cuisines');
 
 			if (!empty($item_cuisines)) {
 				$item_cuisines = is_array($item_cuisines) ?

--
Gitblit v1.10.0