From ba1e1ccf869b818f7a7a897264dfea05563a7796 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 07 Jun 2026 20:10:20 +0000
Subject: [PATCH] =Major overhaul of Integrations. Playing around with adding fields to post types through Registrar from an integrations' class file.

---
 inc/managers/DashboardManager.php |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/inc/managers/DashboardManager.php b/inc/managers/DashboardManager.php
index 26b724f..bb671e8 100644
--- a/inc/managers/DashboardManager.php
+++ b/inc/managers/DashboardManager.php
@@ -25,11 +25,11 @@
 
     public function __construct()
     {
-        $this->cache = Cache::for('dashboard', WEEK_IN_SECONDS)->connect('user');
+        $this->cache = Cache::for('dashboard', WEEK_IN_SECONDS)->connect('user')->user();
 		if (JVB_TESTING) {
 			$this->cache->flush();
 		}
-		$this->cache->flush();
+
         add_action('init', [$this, 'registerDashboard']);
 
         $this->user = wp_get_current_user();
@@ -45,11 +45,12 @@
 
 		jvb_register_do_once('buildDashboard', [$this, 'activate']);
 
-		add_filter('the_seo_framework_sitemap_exclude_ids', [$this, 'excludeDashboard'], 10, 1);
+		add_filter('the_seo_framework_sitemap_exclude_ids', [$this, 'excludeDashboard'], 8, 1);
     }
 
-	public function excludeDashboard(array $ids):array {
-		$cached = $this->cache->remember(
+	public function excludeDashboard(array $IDs):array {
+		$this->cache->flush();
+		$exclude = $this->cache->remember(
 			'dashboardIDs',
 			function() {
 				return get_posts([
@@ -58,7 +59,11 @@
 					'fields' => 'ids',
 				]);
 			});
-		return array_merge($ids, $cached);
+		if (!empty($exclude)) {
+			$IDs = array_merge($IDs, $exclude);
+		}
+
+		return $IDs;
 	}
 
     /**
@@ -636,7 +641,10 @@
 				}
 
 			}
-			return $icon;
+			return match($icon) {
+				'favourites'	=> 'heart',
+				default => $icon
+			};
 		});
 	}
 	protected function getSlug(string $slug, string $page):string
@@ -739,7 +747,7 @@
 			//content types
 		$all = array_merge(
 			Registrar::getRegistered('post'),
-			Registrar::getFeatured('is_content', 'term')
+			Registrar::withFeature('is_content', 'term')
 		);
 		$availableContent = array_filter($pages, function($page, $key) use($all) {
 			return !is_numeric($key) && in_array($key, $all) && JVB()->roles()->checkRole($this->user, $key);
@@ -1086,7 +1094,7 @@
         <?php
         $i=1;
         $content = Registrar::getRegistered('post');
-        $contentTax = Registrar::getFeatured('is_content', 'term');
+        $contentTax = Registrar::withFeature('is_content', 'term');
         $taxonomies = Registrar::getRegistered('term');
         foreach($contentTax as $index => $tax) {
             unset($taxonomies[$index]);
@@ -1279,7 +1287,7 @@
 				$pages[] = 'Favourites';
 			}
 
-			if (!empty(Registrar::getFeatured('karma'))) {
+			if (!empty(Registrar::withFeature('karma'))) {
 				$pages[] = 'Karmic Score';
 			}
 
@@ -1446,7 +1454,7 @@
 							foreach ($roles as $role) {
 								$contents = Registrar::getInstance($role)?->getCreatable();
 								if (!empty($contents)) {
-									$hasKarma = Registrar::getFeatured('karma');
+									$hasKarma = Registrar::withFeature('karma');
 									$remove = empty(array_intersect($contents, $hasKarma));
 								}
 							}
@@ -1507,7 +1515,7 @@
 	 */
 	protected function getRolesWithDashboard():array
 	{
-		return Registrar::getFeatured('has_dashboard', 'user');
+		return Registrar::withFeature('has_dashboard', 'user');
 	}
 
 	/**

--
Gitblit v1.10.0