signUpGroups( 'org\wplake\acf_views\Groups', __DIR__ . '/src/Groups' ); $this->fieldIntegration = new FieldDataIntegration(); $cardDataIntegration = new CardDataIntegration($this->fieldIntegration); $itemIntegration = new ItemDataIntegration(); $metaFieldIntegration = new MetaFieldDataIntegration($this->fieldIntegration); $mountPointIntegration = new MountPointDataIntegration(); $taxFieldIntegration = new TaxFieldDataIntegration(); $toolsDataIntegration = new ToolsDataIntegration(); $this->fieldIntegration->setHooks($isAdmin); $cardDataIntegration->setHooks($isAdmin); $itemIntegration->setHooks($isAdmin); $metaFieldIntegration->setHooks($isAdmin); $mountPointIntegration->setHooks($isAdmin); $taxFieldIntegration->setHooks($isAdmin); $toolsDataIntegration->setHooks($isAdmin); } protected function primary(bool $isAdmin): void { $this->groupCreator = new Creator(); $this->viewData = $this->groupCreator->create(ViewData::class); $this->cardData = $this->groupCreator->create(CardData::class); $this->options = new Options(); $this->html = new Html(); $this->cardsDataStorage = new CardsDataStorage($this->cardData); $this->viewsDataStorage = new ViewsDataStorage($this->viewData); $this->settings = new Settings($this->options); $this->plugin = new Plugin($this->options); $this->twig = new Twig($this->settings, $this->plugin); $this->item = $this->groupCreator->create(ItemData::class); // load right here, as used everywhere $this->settings->load(); $this->plugin->setHooks($isAdmin); $this->twig->setHooks($isAdmin, __FILE__); } protected function acfViews(bool $isAdmin): void { $fields = new Fields(); $viewMarkup = new ViewMarkup($this->html, $fields); $this->viewFactory = new ViewFactory($this->viewsDataStorage, $viewMarkup, $this->twig, $fields); $acfViewMetaBoxes = new ViewsMetaBoxes($this->html, $this->viewsDataStorage); $this->viewsSaveActions = new ViewsSaveActions( $this->viewsDataStorage, $this->plugin, $this->viewData, $viewMarkup, $acfViewMetaBoxes, $this->html, $this->viewFactory ); $acfViewsCpt = new ViewsCpt($this->viewsDataStorage, $this->viewsSaveActions, $this->html, $acfViewMetaBoxes); $acfViewGroupIntegration = new ViewsGroupIntegration( $this->item, $this->viewsDataStorage, $this->fieldIntegration, $this->viewsSaveActions, $this->viewFactory ); $viewShortcode = new ViewShortcode($this->settings, $this->viewsDataStorage, $this->viewFactory); $acfViewMetaBoxes->setHooks($isAdmin); $acfViewsCpt->setHooks($isAdmin); $this->viewsSaveActions->setHooks($isAdmin); $acfViewGroupIntegration->setHooks($isAdmin); $viewShortcode->setHooks($isAdmin); } protected function acfCards(bool $isAdmin): void { $queryBuilder = new QueryBuilder(); $cardMarkup = new CardMarkup($queryBuilder); $this->cardFactory = new CardFactory($queryBuilder, $cardMarkup, $this->twig); $acfCardsMetaBoxes = new CardsMetaBoxes($this->html, $this->cardsDataStorage); $this->cardsSaveActions = new CardsSaveActions( $this->cardsDataStorage, $this->plugin, $this->cardData, $cardMarkup, $queryBuilder, $this->html, $acfCardsMetaBoxes, $this->cardFactory ); $acfCardsCpt = new CardsCpt($this->cardsDataStorage, $this->cardsSaveActions, $this->html, $acfCardsMetaBoxes); $acfCardsViewIntegration = new CardsViewIntegration( $this->cardsDataStorage, $this->viewsDataStorage, $this->cardsSaveActions ); $cardShortcode = new CardShortcode($this->settings, $this->cardsDataStorage, $this->cardFactory); $acfCardsCpt->setHooks($isAdmin); $acfCardsMetaBoxes->setHooks($isAdmin); $this->cardsSaveActions->setHooks($isAdmin); $acfCardsViewIntegration->setHooks($isAdmin); $cardShortcode->setHooks($isAdmin); } protected function others(bool $isAdmin): void { $demoImport = new DemoImport( $this->cardsSaveActions, $this->viewsSaveActions, $this->cardsDataStorage, $this->viewsDataStorage, $this->settings, $this->item ); $acfIntegration = new AcfIntegration(); $dashboard = new Dashboard($this->plugin, $this->html, $demoImport, $acfIntegration); $acfPro = new AcfPro($this->plugin); $upgrades = new Upgrades( $this->plugin, $this->settings, $this->viewsDataStorage, $this->cardsDataStorage, $this->viewsSaveActions, $this->cardsSaveActions, $this->twig ); $activeInstallations = new ActiveInstallations($this->plugin, $this->settings, $this->options); $tools = new Tools( new ToolsData($this->groupCreator), $this->cardsDataStorage, $this->viewsDataStorage, $this->plugin, $this->viewData, $this->cardData ); $settings = new SettingsPage(new SettingsData($this->groupCreator), $this->settings); $adminAssets = new AdminAssets( $this->plugin, $this->cardsDataStorage, $this->viewsDataStorage, $this->viewFactory, $this->cardFactory, $this->settings ); $frontAssets = new FrontAssets($this->plugin, $this->viewFactory, $this->cardFactory); $dashboard->setHooks($isAdmin); $demoImport->setHooks($isAdmin); $acfPro->setHooks($isAdmin); $upgrades->setHooks($isAdmin); $activeInstallations->setHooks($isAdmin); $tools->setHooks($isAdmin); $adminAssets->setHooks($isAdmin); $frontAssets->setHooks($isAdmin); $settings->setHooks($isAdmin); } public function init(): void { // skip initialization if PRO already active if (class_exists(Plugin::class)) { return; } require_once __DIR__ . '/prefixed_vendors/vendor/scoper-autoload.php'; $isAdmin = is_admin(); $this->acfGroups($isAdmin); $this->primary($isAdmin); $this->acfViews($isAdmin); $this->acfCards($isAdmin); $this->others($isAdmin); } }; $acfViews->init();