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.'helpers'.DIRECTORY_SEPARATOR.'helper.php'; return file_exists($helperFile) && include_once $helperFile; } public function initAcyMailing() { if (!$this->loadAcyMailingLibrary()) { return; } include_once __DIR__.DS.'wpinit'.DS.'update.php'; include_once __DIR__.DS.'wpinit'.DS.'router.php'; include_once __DIR__.DS.'wpinit'.DS.'menu.php'; include_once __DIR__.DS.'wpinit'.DS.'usersynch.php'; include_once __DIR__.DS.'wpinit'.DS.'message.php'; include_once __DIR__.DS.'wpinit'.DS.'elementor.php'; include_once __DIR__.DS.'wpinit'.DS.'beaver.php'; include_once __DIR__.DS.'wpinit'.DS.'wprocket.php'; include_once __DIR__.DS.'wpinit'.DS.'addons.php'; include_once __DIR__.DS.'wpinit'.DS.'forms.php'; include_once __DIR__.DS.'wpinit'.DS.'override_email.php'; include_once __DIR__.DS.'wpinit'.DS.'cron.php'; include_once __DIR__.DS.'wpinit'.DS.'gutenberg.php'; include_once __DIR__.DS.'wpinit'.DS.'security.php'; include_once __DIR__.DS.'wpinit'.DS.'deactivate.php'; include_once __DIR__.DS.'wpinit'.DS.'Oauth.php'; } 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();