install(); } } public function protectAcyMailingPages() { if (!$this->isCurrentlyOnAcyPage()) { return; } // Prevent plugins from breaking AcyMailing pages (mainly JS scripts loaded without the WP way) remove_action('plugins_loaded', 'mailchimp_on_all_plugins_loaded', 12); remove_action('plugins_loaded', '_imagify_init'); remove_action('plugins_loaded', 'plugins_loaded_wps_hide_login_plugin'); remove_action('plugins_loaded', ['WPAS_Gas', 'get_instance'], 11); remove_action('plugins_loaded', 'woosb_init', 12); } public function disableWpml(): bool { if (!$this->isCurrentlyOnAcyPage() || !$this->loadAcyMailingLibrary()) { return true; } $config = acym_config(); return intval($config->get('multilingual')) !== 1; } public function initWidgets() { $ds = DIRECTORY_SEPARATOR; include_once __DIR__.$ds.'widgets'.$ds.'archive'.$ds.'widget.php'; include_once __DIR__.$ds.'widgets'.$ds.'profile'.$ds.'widget.php'; include_once __DIR__.$ds.'widgets'.$ds.'subscriptionform'.$ds.'widget.php'; register_widget('acym_archive_widget'); register_widget('acym_profile_widget'); register_widget('acym_subscriptionform_widget'); } private function loadAcyMailingLibrary() { $helperFile = __DIR__.DIRECTORY_SEPARATOR.'back'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'init.php'; return file_exists($helperFile) && include_once $helperFile; } public function initAcyMailing() { if (!$this->loadAcyMailingLibrary()) { return; } new Update(); $router = new Router(); new Menu($router); new UserSync(); new Message(); new Elementor(); new Beaver(); new WpRocket(); new Addons(); new Forms(); new OverrideEmail(); new Cron(); new Gutenberg(); new Security(); new Deactivate(); new Oauth(); } private function isCurrentlyOnAcyPage(): bool { // Make sure we're on an AcyMailing page $page = isset($_REQUEST['page']) ? sanitize_text_field(wp_unslash($_REQUEST['page'])) : ''; return !empty($page) && strpos($page, 'acymailing_') !== false; } } new acymailingLoader();