Jake Vanderwerf
2026-02-04 2127b1bdd73ecd2423e443992da4b442f5a3c1a3
JVBase.php
@@ -3,9 +3,10 @@
use JVBase\blocks\CustomBlocks;
use JVBase\integrations\BlueSky;
use JVBase\managers\cache\Cache;
use JVBase\managers\Cache;
use JVBase\managers\EmailManager;
use JVBase\managers\ErrorHandler;
use JVBase\managers\InvitationsManager;
use JVBase\managers\LoginManager;
use JVBase\managers\MagicLinkManager;
use JVBase\managers\queue\Queue;
@@ -26,9 +27,9 @@
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;
@@ -36,13 +37,13 @@
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;
@@ -111,7 +112,7 @@
      ];
      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')) {
@@ -144,10 +145,10 @@
        if (jvbSiteHasDashboard()) {
            $this->routes['error']  = new ErrorRoutes();
            $this->routes['admin']  = new AdminRoutes();
//            $this->routes['admin']  = new AdminRoutes();
            $this->routes['content']= new ContentRoutes();
            $this->routes['bio']    = new BioRoutes();
            $this->routes['shop']   = new ShopRoutes();
//            $this->routes['bio']    = new BioRoutes();
//       $this->routes['shop'] = new ShopRoutes();
            $this->routes['options']= new OptionsRoutes();
        }
@@ -158,6 +159,9 @@
        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();
        }
@@ -201,18 +205,22 @@
    {
        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'];
@@ -230,6 +238,7 @@
    {
        return $this->managers['notifications']??false;
    }
    public function routes($route):mixed
    {
        if (array_key_exists($route, $this->routes)) {
@@ -237,14 +246,17 @@
        }
        return false;
    }
    public function roles():RoleManager
    {
        return $this->managers['roles'];
    }
    public function admin()
    {
        return $this->managers['admin'];
    }
   public function seoAdmin()
   {
      return $this->managers['seoAdmin'];
@@ -255,6 +267,7 @@
        $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;
@@ -274,12 +287,15 @@
      }
      return (array_key_exists($service, $this->integrations)) ? $this->integrations[$service] : null;
   }
   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;
   }
@@ -310,6 +326,11 @@
      return $this->managers['magicLink']??false;
   }
   public function invitations(): InvitationsManager|false
   {
      return $this->managers['invitations'] ?? false;
   }
   public function additionalActions():void
   {
      if (LoginManager::isLogin()) {