| @@ -4,12 +4,11 @@ | ||
| 4 | 4 | * Description: Manage your contact lists and send newsletters from your site. |
| 5 | 5 | * Author: AcyMailing Newsletter Team |
| 6 | 6 | * Author URI: https://www.acymailing.com |
| 7 | 7 | * License: GPLv3 |
| 8 | - * Version: 10.1.4 | |
| 8 | + * Version: 11.1.0 | |
| 9 | 9 | * Text Domain: acymailing |
| 10 | - * Domain Path: /language | |
| 11 | - * Requires at least: 5.0 | |
| 10 | + * Requires at least: 5.8 | |
| 12 | 11 | * Requires PHP: 7.4 |
| 13 | 12 | */ |
| 14 | 13 | |
| 15 | 14 | use AcyMailing\WpInit\Activation; |
| @@ -14,20 +13,20 @@ | ||
| 14 | 13 | |
| 15 | 14 | use AcyMailing\WpInit\Activation; |
| 16 | 15 | use AcyMailing\WpInit\Addons; |
| 17 | 16 | use AcyMailing\WpInit\Beaver; |
| 18 | -use AcyMailing\WpInit\Menu; | |
| 19 | 17 | use AcyMailing\WpInit\Cron; |
| 18 | +use AcyMailing\WpInit\Data; | |
| 20 | 19 | use AcyMailing\WpInit\Deactivate; |
| 21 | 20 | use AcyMailing\WpInit\Elementor; |
| 22 | 21 | use AcyMailing\WpInit\Forms; |
| 23 | 22 | use AcyMailing\WpInit\Gutenberg; |
| 23 | +use AcyMailing\WpInit\Menu; | |
| 24 | 24 | use AcyMailing\WpInit\Message; |
| 25 | 25 | use AcyMailing\WpInit\Oauth; |
| 26 | 26 | use AcyMailing\WpInit\OverrideEmail; |
| 27 | 27 | use AcyMailing\WpInit\Router; |
| 28 | 28 | use AcyMailing\WpInit\Security; |
| 29 | -use AcyMailing\WpInit\Update; | |
| 30 | 29 | use AcyMailing\WpInit\UserSync; |
| 31 | 30 | use AcyMailing\WpInit\WpRocket; |
| 32 | 31 | |
| 33 | 32 | defined('ABSPATH') || die('Restricted Access'); |
| @@ -36,9 +35,10 @@ | ||
| 36 | 35 | { |
| 37 | 36 | public function __construct() |
| 38 | 37 | { |
| 39 | 38 | // Install Acy DB and sample data on first activation (not on installation because of FTP install) |
| 40 | - register_activation_hook(__DIR__.'/index.php', [$this, 'activation']); | |
| 39 | + register_activation_hook(__DIR__.'/'.basename(__FILE__), [$this, 'activation']); | |
| 40 | + add_action('wp_initialize_site', [$this, 'subsiteCreation'], 101); | |
| 41 | 41 | |
| 42 | 42 | // Prevent bad plugins from loading on AcyMailing pages |
| 43 | 43 | add_action('plugins_loaded', [$this, 'protectAcyMailingPages'], 5); |
| 44 | 44 | |
| @@ -50,10 +50,17 @@ | ||
| 50 | 50 | |
| 51 | 51 | add_filter('wpml_show_admin_language_switcher', [$this, 'disableWpml']); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function activation() | |
| 54 | + public function subsiteCreation(): void | |
| 55 | 55 | { |
| 56 | + if (is_plugin_active_for_network(basename(__DIR__).'/'.basename(__FILE__))) { | |
| 57 | + $this->activation(); | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + public function activation(): void | |
| 62 | + { | |
| 56 | 63 | // Load Acy library |
| 57 | 64 | $helperFile = __DIR__.DIRECTORY_SEPARATOR.'back'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'init.php'; |
| 58 | 65 | if (file_exists($helperFile) && include_once $helperFile) { |
| 59 | 66 | $activation = new Activation(); |
| @@ -111,9 +118,9 @@ | ||
| 111 | 118 | return; |
| 112 | 119 | } |
| 113 | 120 | |
| 114 | 121 | |
| 115 | - new Update(); | |
| 122 | + | |
| 116 | 123 | $router = new Router(); |
| 117 | 124 | new Menu($router); |
| 118 | 125 | new UserSync(); |
| 119 | 126 | new Message(); |
| @@ -127,13 +134,15 @@ | ||
| 127 | 134 | new Gutenberg(); |
| 128 | 135 | new Security(); |
| 129 | 136 | new Deactivate(); |
| 130 | 137 | new Oauth(); |
| 138 | + new Data(); | |
| 131 | 139 | } |
| 132 | 140 | |
| 141 | + | |
| 133 | 142 | private function isCurrentlyOnAcyPage(): bool |
| 134 | 143 | { |
| 135 | - // Make sure we're on an AcyMailing page | |
| 144 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Make sure we're on an AcyMailing page. | |
| 136 | 145 | $page = isset($_REQUEST['page']) ? sanitize_text_field(wp_unslash($_REQUEST['page'])) : ''; |
| 137 | 146 | |
| 138 | 147 | return !empty($page) && strpos($page, 'acymailing_') !== false; |
| 139 | 148 | } |