From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan

---
 JVBase.php |  348 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 203 insertions(+), 145 deletions(-)

diff --git a/JVBase.php b/JVBase.php
index 8894d0c..a9519c0 100644
--- a/JVBase.php
+++ b/JVBase.php
@@ -1,14 +1,22 @@
 <?php
 namespace JVBase;
 
+use JVBase\blocks\CustomBlocks;
 use JVBase\integrations\BlueSky;
+use JVBase\managers\Cache;
+use JVBase\managers\EmailManager;
 use JVBase\managers\ErrorHandler;
+use JVBase\managers\InvitationsManager;
 use JVBase\managers\LoginManager;
-use JVBase\managers\OperationQueue;
+use JVBase\managers\MagicLinkManager;
+use JVBase\managers\queue\Queue;
 use JVBase\managers\DashboardManager;
+use JVBase\managers\DirectoryManager;
 use JVBase\managers\ReferralManager;
 use JVBase\managers\RoleManager;
-use JVBase\managers\SchemaManager;
+//use JVBase\managers\SchemaManager;
+use JVBase\managers\SEO\SchemaOutputManager;
+use JVBase\managers\SEO\SEOAdminPage;
 use JVBase\managers\AdminPages;
 use JVBase\managers\NotificationManager;
 use JVBase\managers\UserTermsManager;
@@ -19,22 +27,23 @@
 use JVBase\rest\routes\ContentRoutes;
 use JVBase\rest\routes\TermRoutes;
 use JVBase\rest\routes\UploadRoutes;
-use JVBase\rest\routes\BioRoutes;
+//use JVBase\rest\routes\BioRoutes;
 use JVBase\rest\routes\SettingsRoutes;
-use JVBase\rest\routes\ShopRoutes;
+//use JVBase\rest\routes\ShopRoutes;
+use JVBase\rest\routes\SEORoutes;
 use JVBase\rest\routes\QueueRoutes;
 use JVBase\rest\routes\ErrorRoutes;
 use JVBase\rest\routes\FormRoutes;
 use JVBase\rest\routes\LoginRoutes;
 use JVBase\rest\routes\NewsRoutes;
 use JVBase\rest\routes\ReferralRoutes;
-use JVBase\rest\routes\MagicLinkRoutes;
+//use JVBase\rest\routes\MagicLinkRoutes;
 use JVBase\rest\routes\ResponseRoutes;
 use JVBase\rest\routes\OptionsRoutes;
 use JVBase\rest\routes\VoteRoutes;
 use JVBase\rest\routes\Invitations;
 use JVBase\rest\routes\ApprovalRoutes;
-use JVBase\rest\routes\AdminRoutes;
+//use JVBase\rest\routes\AdminRoutes;
 use JVBase\rest\routes\IntegrationsRoutes;
 use JVBase\utility\Features;
 
@@ -44,13 +53,14 @@
 
 class JVB
 {
-    protected static JVB|null $instance = null;
-    protected array $managers = [];
-    protected array $content = [];
-    protected array $taxonomies = [];
+	protected static JVB|null $instance = null;
+	protected array $managers = [];
+	protected array $content = [];
+	protected array $taxonomies = [];
 	protected array $integrations = [];
-    protected array $blocks = [];
-    protected array $routes = [];
+	protected array $blocks = [];
+	protected array $routes = [];
+	protected CustomBlocks $customBlocks;
 
 	protected array $serviceMap = [
 		'maps' => 'JVBase\integrations\GoogleMaps',
@@ -65,32 +75,45 @@
 		'postmark' => 'JVBase\integrations\PostMark',
 	];
 
-    public static function getInstance():JVB
-    {
-        if (self::$instance === null) {
-            self::$instance = new self();
-        }
-        return self::$instance;
-    }
+	public static function getInstance(): JVB
+	{
+		if (self::$instance === null) {
+			self::$instance = new self();
+		}
+		return self::$instance;
+	}
 
 
-    public function __construct()
-    {
-        $this->managers = [
-            'errors'        => new ErrorHandler(),
-            'queue'         => new OperationQueue(),
+	public function __construct()
+	{
+		$this->customBlocks = new CustomBlocks();
+		$this->managers = [
+			'errors' => new ErrorHandler(),
+			'queue' => new Queue(),
 //            'dash'          => new DashboardManager(),
-            'roles'         => new RoleManager(),
+			'roles' => new RoleManager(),
 //            'forms'         => new FormManager(),
-            'schema'        => new SchemaManager(),
-            'admin'         => new AdminPages(),
+			'schema' => new SchemaOutputManager(),
+			'admin' => new AdminPages(),
+			'seoAdmin' => new SEOAdminPage(),
 //			'uploads'		=> new UploadManager(),
-			'userTerms'		=> new UserTermsManager(),
-        ];
+			'userTerms' => new UserTermsManager(),
+			'email' => new EmailManager(),
+		];
 
+		$this->routes = [
+			'login' => new LoginRoutes(),
+			'integrations' => new IntegrationsRoutes(),
+			'seo' => new SEORoutes(),
+			'queue' => new QueueRoutes(),
+			'settings' => new SettingsRoutes(),
+			'upload' => new UploadRoutes(),
+			'forms' => new FormRoutes()
+		];
 
 		if (Features::forSite()->has('magicLink')) {
-			$this->routes['magicLink'] = new MagicLinkRoutes();
+//			$this->routes['magicLink'] = new MagicLinkRoutes();
+			$this->managers['magicLink'] = new MagicLinkManager();
 		}
 		if (Features::forSite()->has('referrals')) {
 			$this->managers['referral'] = new ReferralManager();
@@ -101,73 +124,72 @@
 			$this->managers['dash'] = new DashboardManager();
 		}
 
-		if (Features::hasIntegration('square')){
+		if (Features::hasIntegration('square')) {
 			$this->routes['square'] = new IntegrationsSquareRoutes();
 		}
 
-        $this->routes = [
-			'login'			=> new LoginRoutes(),
-			'integrations'	=> new IntegrationsRoutes(),
-		];
-        if (jvbSiteUsesFeedBlock()) {
-            $this->routes['feed'] = new FeedRoutes();
-        }
-        if (jvbSiteHasNotifications()) {
+		if (Features::forSite()->has('feed_block')) {
+			$this->routes['feed'] = new FeedRoutes();
+		}
+		if (jvbSiteHasNotifications()) {
 			$this->managers['notifications'] = new NotificationManager();
-            $this->routes['notifications'] = new NotificationsRoutes();
-        }
-        if (jvbSiteUsesFeedBlock() || jvbSiteHasDashboard()) {
-            $this->routes['term'] = new TermRoutes();
-        }
+			$this->routes['notifications'] = new NotificationsRoutes();
+		}
+		if (Features::forSite()->has('feed_block') || jvbSiteHasDashboard()) {
+			$this->routes['term'] = new TermRoutes();
+		}
 
-		$this->routes['queue']  = new QueueRoutes();
-		$this->routes['settings']= new SettingsRoutes();
-		$this->routes['upload'] = new UploadRoutes();
-        if (jvbSiteHasDashboard()) {
-            $this->routes['error']  = new ErrorRoutes();
-            $this->routes['admin']  = new AdminRoutes();
-            $this->routes['content']= new ContentRoutes();
-            $this->routes['bio']    = new BioRoutes();
-            $this->routes['shop']   = new ShopRoutes();
-            $this->routes['options']= new OptionsRoutes();
-        }
-		$this->routes['forms']= new FormRoutes();
+		if (Features::forSite()->has('is_directory')) {
+			$this->managers['directory'] = new DirectoryManager();
+		}
 
-        if (jvbSiteHasFavourites()) {
-            $this->routes['favourites'] = new FavouritesRoutes();
-        }
+		if (jvbSiteHasDashboard()) {
+			$this->routes['error'] = new ErrorRoutes();
+//            $this->routes['admin']  = new AdminRoutes();
+			$this->routes['content'] = new ContentRoutes();
+//            $this->routes['bio']    = new BioRoutes();
+//			$this->routes['shop'] = new ShopRoutes();
+			$this->routes['options'] = new OptionsRoutes();
+		}
 
-        if (Features::forMembership()->has('forum')) {
-            $this->routes['news'] = new NewsRoutes();
-        }
-        if (Features::anyContentHas('response') || Features::anyTaxonomyHas('response') || Features::anyUserHas('response')) {
-            $this->routes['comments'] = new ResponseRoutes();
-        }
-        if (Features::anyContentHas('karma') || Features::anyTaxonomyHas('karma') || Features::anyUserHas('karma')) {
-            $this->routes['vote'] = new VoteRoutes();
-        }
-        if (Features::anyContentHas('karma') || Features::anyTaxonomyHas('karma') || Features::anyUserHas('karma')
+		if (jvbSiteHasFavourites()) {
+			$this->routes['favourites'] = new FavouritesRoutes();
+		}
+
+		if (Features::forMembership()->has('forum')) {
+			$this->routes['news'] = new NewsRoutes();
+		}
+		if (Features::forMembership()->has('invitable')) {
+			$this->managers['invitations'] = new InvitationsManager();
+		}
+		if (Features::anyContentHas('response') || Features::anyTaxonomyHas('response') || Features::anyUserHas('response')) {
+			$this->routes['comments'] = new ResponseRoutes();
+		}
+		if (Features::anyContentHas('karma') || Features::anyTaxonomyHas('karma') || Features::anyUserHas('karma')) {
+			$this->routes['vote'] = new VoteRoutes();
+		}
+		if (Features::anyContentHas('karma') || Features::anyTaxonomyHas('karma') || Features::anyUserHas('karma')
 			|| Features::forMembership()->has('member_verified') ||
 			Features::forMembership()->has('term_approval')) {
-            $this->routes['approvals'] = new ApprovalRoutes();
-        }
-        if (Features::forMembership()->has('can_invite')) {
-            $this->routes['invites'] = new Invitations();
-        }
+			$this->routes['approvals'] = new ApprovalRoutes();
+		}
+		if (Features::forMembership()->has('can_invite')) {
+			$this->routes['invites'] = new Invitations();
+		}
 
 		$this->setupIntegrations();
 
 		add_action('wp_footer', [$this, 'additionalActions']);
 //        $this->managers['notifications'] = new NotificationManager();
-        // Register activation hook
-        register_activation_hook(JVB_DIR . '/jvb.php', [$this, 'activate']);
-    }
+		// Register activation hook
+		register_activation_hook(JVB_DIR . '/jvb.php', [$this, 'activate']);
+	}
 
 
-	protected function setupIntegrations():void
+	protected function setupIntegrations(): void
 	{
-		if (array_key_exists('integrations', JVB_SITE)){
-			foreach (JVB_SITE['integrations'] as $service => $use){
+		if (array_key_exists('integrations', JVB_SITE)) {
+			foreach (JVB_SITE['integrations'] as $service => $use) {
 				if (!$use) {
 					continue;
 				}
@@ -179,68 +201,82 @@
 		}
 	}
 
-    public function registeredContent():array
-    {
-        return array_merge(array_keys($this->content), array_keys($this->taxonomies));
-    }
-    public function dashboard()
-    {
-        return $this->managers['dash'];
-    }
-    public function error()
-    {
-        return $this->managers['errors'];
-    }
-    public function file()
-    {
-        return $this->managers['file'];
-    }
-    public function cache()
-    {
-        return $this->managers['cache'];
-    }
-    public function queue()
-    {
-        return $this->managers['queue'];
-    }
+	public function registeredContent(): array
+	{
+		return array_merge(array_keys($this->content), array_keys($this->taxonomies));
+	}
+
+	public function dashboard(): DashboardManager|false
+	{
+		return $this->managers['dash'] ?? false;
+	}
+
+	public function directories(): DirectoryManager|false
+	{
+		return $this->managers['directory'] ?? false;
+	}
+
+	public function error(): ErrorHandler
+	{
+		return $this->managers['errors'];
+	}
+
+	public function file()
+	{
+		return $this->managers['file'];
+	}
+
+	public function queue(): Queue
+	{
+		return $this->managers['queue'];
+	}
 //    public function forms()
 //    {
 //        return $this->managers['forms'];
 //    }
-    public function notification()
-    {
-        return $this->managers['notifications'];
-    }
-    public function routes($route):mixed
-    {
-        if (array_key_exists($route, $this->routes)) {
-            return $this->routes[$route];
-        }
-        return false;
-    }
-    public function roles()
-    {
-        return $this->managers['roles'];
-    }
-    public function admin()
-    {
-        return $this->managers['admin'];
-    }
+	public function notification(): NotificationManager|false
+	{
+		return $this->managers['notifications'] ?? false;
+	}
 
-    public function getFields($type):array
-    {
-        $content = JVB_CONTENT[$type]??JVB_TAXONOMY[$type]??JVB_USER[$type]??null;
-        return $content['fields']??[];
-    }
-    public function getContent($type):mixed
-    {
-        return $this->content[$type]??$this->taxonomies[$type]??$this->blocks[$type]??null;
-    }
+	public function routes($route): mixed
+	{
+		if (array_key_exists($route, $this->routes)) {
+			return $this->routes[$route];
+		}
+		return false;
+	}
 
-	public function connect(string $service, ?int $userID = null):mixed
+	public function roles(): RoleManager
+	{
+		return $this->managers['roles'];
+	}
+
+	public function admin()
+	{
+		return $this->managers['admin'];
+	}
+
+	public function seoAdmin()
+	{
+		return $this->managers['seoAdmin'];
+	}
+
+	public function getFields($type): array
+	{
+		$content = JVB_CONTENT[$type] ?? JVB_TAXONOMY[$type] ?? JVB_USER[$type] ?? [];
+		return $content['fields'] ?? [];
+	}
+
+	public function getContent($type): mixed
+	{
+		return $this->content[$type] ?? $this->taxonomies[$type] ?? $this->blocks[$type] ?? null;
+	}
+
+	public function connect(string $service, ?int $userID = null): mixed
 	{
 		if ($userID) {
-			if (!$this->userCanConnect($service, $userID)){
+			if (!$this->userCanConnect($service, $userID)) {
 				return null;
 			}
 
@@ -251,31 +287,48 @@
 		}
 		return (array_key_exists($service, $this->integrations)) ? $this->integrations[$service] : null;
 	}
-	public function userCanConnect(string $service, int $userID):bool
+
+	public function userCanConnect(string $service, int $userID): bool
 	{
 		$allowed = JVB_USER[jvbUserRole($userID)]['integrations'] ?? [];
 		return user_can($userID, 'manage_options') || in_array($service, $allowed);
 	}
-	public function getAvailableServices(bool $keys = true):array {
+
+	public function getAvailableServices(bool $keys = true): array
+	{
 
 		return ($keys) ? array_keys($this->integrations) : $this->integrations;
 	}
 
-    public function activate():void
-    {
-        error_log('Activate!');
-        // Activate roles - will be properly initialized after post types are registered
-        $this->roles()->activate();
-    }
+	public function activate(): void
+	{
+		// Activate roles - will be properly initialized after post types are registered
+		$this->roles()->activate();
+	}
 
-	public function addRoute($slug, $class):void
+	public function addRoute($slug, $class): void
 	{
 		$this->routes[$slug] = $class;
 	}
 
-	public function referrals():ReferralManager
+	public function email(): EmailManager
 	{
-		return $this->managers['referral'];
+		return $this->managers['email'];
+	}
+
+	public function referrals(): ReferralManager|false
+	{
+		return $this->managers['referral'] ?? false;
+	}
+
+	public function magicLink(): MagicLinkManager|false
+	{
+		return $this->managers['magicLink'] ?? false;
+	}
+
+	public function invitations(): InvitationsManager|false
+	{
+		return $this->managers['invitations'] ?? false;
 	}
 
 	public function additionalActions():void
@@ -310,4 +363,9 @@
 			<?php
 		}
 	}
+
+	public function blocks():CustomBlocks|bool
+	{
+		return $this->customBlocks??false;
+	}
 }

--
Gitblit v1.10.0