| | |
| | | use JVBase\managers\ErrorHandler; |
| | | use JVBase\managers\OperationQueue; |
| | | use JVBase\managers\DashboardManager; |
| | | use JVBase\managers\ReferralManager; |
| | | use JVBase\managers\RoleManager; |
| | | use JVBase\managers\SchemaManager; |
| | | use JVBase\managers\AdminPages; |
| | |
| | | use JVBase\rest\routes\ErrorRoutes; |
| | | use JVBase\rest\routes\FormRoutes; |
| | | 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; |
| | |
| | | 'userTerms' => new UserTermsManager(), |
| | | ]; |
| | | |
| | | add_action('wp_footer', [$this, 'additionalActions']); |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | if (Features::forSite()->has('dashboard')) { |
| | | $this->managers['dash'] = new DashboardManager(); |
| | | } |
| | |
| | | $this->routes[$slug] = $class; |
| | | } |
| | | |
| | | public function referrals():ReferralManager |
| | | { |
| | | return $this->managers['referral']; |
| | | } |
| | | |
| | | public function additionalActions():void |
| | | { |
| | | $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 |
| | | } |
| | | } |
| | | } |