| | |
| | | |
| | | use JVBase\integrations\BlueSky; |
| | | use JVBase\managers\ErrorHandler; |
| | | use JVBase\managers\LoginManager; |
| | | use JVBase\managers\OperationQueue; |
| | | use JVBase\managers\DashboardManager; |
| | | use JVBase\managers\ReferralManager; |
| | |
| | | use JVBase\managers\UserTermsManager; |
| | | use JVBase\rest\routes\FeedRoutes; |
| | | use JVBase\rest\routes\FavouritesRoutes; |
| | | use JVBase\rest\routes\IntegrationsSquareRoutes; |
| | | use JVBase\rest\routes\NotificationsRoutes; |
| | | use JVBase\rest\routes\ContentRoutes; |
| | | use JVBase\rest\routes\TermRoutes; |
| | |
| | | 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\ResponseRoutes; |
| | | use JVBase\rest\routes\OptionsRoutes; |
| | | use JVBase\rest\routes\VoteRoutes; |
| | |
| | | 'gmb' => 'JVBase\integrations\GoogleMyBusiness', |
| | | 'cloudflare' => 'JVBase\integrations\Cloudflare', |
| | | 'umami' => 'JVBase\integrations\Umami', |
| | | 'postmark' => 'JVBase\integrations\PostMark', |
| | | ]; |
| | | |
| | | public static function getInstance():JVB |
| | |
| | | 'userTerms' => new UserTermsManager(), |
| | | ]; |
| | | |
| | | |
| | | if (Features::forSite()->has('magicLink')) { |
| | | $this->routes['magicLink'] = new MagicLinkRoutes(); |
| | | } |
| | | if (Features::forSite()->has('referrals')) { |
| | | $this->managers['referral'] = new ReferralManager(); |
| | | $this->routes['referral'] = new ReferralRoutes(); |
| | |
| | | $this->managers['dash'] = new DashboardManager(); |
| | | } |
| | | |
| | | if (Features::hasIntegration('square')){ |
| | | $this->routes['square'] = new IntegrationsSquareRoutes(); |
| | | } |
| | | |
| | | $this->routes = [ |
| | | 'login' => new LoginRoutes(), |
| | | 'integrations' => new IntegrationsRoutes(), |
| | | ]; |
| | | if (jvbSiteUsesFeedBlock()) { |
| | |
| | | $this->routes['term'] = new TermRoutes(); |
| | | } |
| | | |
| | | $this->routes['queue'] = new QueueRoutes(); |
| | | $this->routes['settings']= new SettingsRoutes(); |
| | | $this->routes['upload'] = new UploadRoutes(); |
| | | if (jvbSiteHasDashboard()) { |
| | | $this->routes['upload'] = new UploadRoutes(); |
| | | $this->routes['settings']= new SettingsRoutes(); |
| | | $this->routes['queue'] = new QueueRoutes(); |
| | | $this->routes['error'] = new ErrorRoutes(); |
| | | $this->routes['admin'] = new AdminRoutes(); |
| | | $this->routes['content']= new ContentRoutes(); |
| | |
| | | } |
| | | |
| | | $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']); |
| | |
| | | $this->routes[$slug] = $class; |
| | | } |
| | | |
| | | public function referrals():ReferralManager |
| | | { |
| | | return $this->managers['referral']; |
| | | } |
| | | |
| | | public function additionalActions():void |
| | | { |
| | | if (LoginManager::isLogin()) { |
| | | return; |
| | | } |
| | | $extras = apply_filters('jvbAdditionalActions', []); |
| | | $extras = array_filter($extras, function ($extra) { |
| | | return is_array($extra) && array_key_exists('button', $extra) && array_key_exists('content', $extra); |
| | | }); |
| | | if (empty ($extras)) { |
| | | return; |
| | | } |
| | | $buttons = array_map(function ($extra) { |
| | | return $extra['button']; |
| | | }, $extras); |
| | | $contents = array_map(function($extra) { |
| | | return $extra['content']; |
| | | }, $extras); |
| | | |
| | | if (!empty ($buttons)) { |
| | | ?> |
| | | <section class="additional-actions"> |
| | | <div class="buttons col"> |
| | | <?= implode($buttons); ?> |
| | | </div> |
| | | <div class="actions"> |
| | | <?= implode($contents); ?> |
| | | </div> |
| | | </section> |
| | | <?php |
| | | } |
| | | } |
| | | } |