| @@ -1,10 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | + | |
| 3 | 5 | use AcyMailing\Classes\PluginClass; |
| 4 | 6 | |
| 5 | 7 | function acym_isExtensionActive(string $extension): bool |
| 6 | 8 | { |
| 9 | + // Test first as mu-plugins don't have an active status for WP | |
| 7 | 10 | if (acym_isMuPlugin($extension)) return true; |
| 8 | 11 | |
| 9 | 12 | if (function_exists('is_plugin_active')) return is_plugin_active($extension); |
| 10 | 13 | |
| @@ -29,39 +32,39 @@ | ||
| 29 | 32 | return [ |
| 30 | 33 | (object)[ |
| 31 | 34 | 'title' => acym_translation('ACYM_ARTICLE'), |
| 32 | 35 | 'folder_name' => 'post', |
| 33 | - 'version' => '10.11.1', | |
| 36 | + 'version' => '11.1.0', | |
| 34 | 37 | 'active' => '1', |
| 35 | 38 | 'category' => 'Content management', |
| 36 | 39 | 'level' => 'starter', |
| 37 | 40 | 'uptodate' => '1', |
| 38 | 41 | 'description' => '- Insert WordPress posts in your emails<br/>- Insert the latest posts of a category in an automatic email', |
| 39 | - 'latest_version' => '10.11.1', | |
| 42 | + 'latest_version' => '11.1.0', | |
| 40 | 43 | 'type' => 'CORE', |
| 41 | 44 | ], |
| 42 | 45 | (object)[ |
| 43 | 46 | 'title' => acym_translation('ACYM_PAGE'), |
| 44 | 47 | 'folder_name' => 'page', |
| 45 | - 'version' => '10.11.1', | |
| 48 | + 'version' => '11.1.0', | |
| 46 | 49 | 'active' => '1', |
| 47 | 50 | 'category' => 'Content management', |
| 48 | 51 | 'level' => 'starter', |
| 49 | 52 | 'uptodate' => '1', |
| 50 | 53 | 'description' => '- Insert pages in your emails', |
| 51 | - 'latest_version' => '10.11.1', | |
| 54 | + 'latest_version' => '11.1.0', | |
| 52 | 55 | 'type' => 'CORE', |
| 53 | 56 | ], |
| 54 | 57 | (object)[ |
| 55 | 58 | 'title' => acym_translation('ACYM_CREATE_USER'), |
| 56 | 59 | 'folder_name' => 'createuser', |
| 57 | - 'version' => '10.11.1', | |
| 60 | + 'version' => '11.1.0', | |
| 58 | 61 | 'active' => '1', |
| 59 | 62 | 'category' => 'User management', |
| 60 | 63 | 'level' => 'starter', |
| 61 | 64 | 'uptodate' => '1', |
| 62 | 65 | 'description' => '- Automatically creates a site user when an AcyMailing subscriber is created', |
| 63 | - 'latest_version' => '10.11.1', | |
| 66 | + 'latest_version' => '11.1.0', | |
| 64 | 67 | 'type' => 'CORE', |
| 65 | 68 | ], |
| 66 | 69 | ]; |
| 67 | 70 | } |
| @@ -104,13 +107,15 @@ | ||
| 104 | 107 | $dynamics[] = $pluginFolder; |
| 105 | 108 | } |
| 106 | 109 | } |
| 107 | 110 | |
| 111 | + // Some plugins need to be called last | |
| 108 | 112 | $dynamics = array_merge($dynamics, $dynamicsLoadedLast); |
| 109 | 113 | |
| 110 | 114 | global $acymPlugins; |
| 111 | 115 | global $acymAddonsForSettings; |
| 112 | 116 | |
| 117 | + // Load the installed integrations | |
| 113 | 118 | $integrationsRaw = []; |
| 114 | 119 | $acyVersion = acym_config()->get('version'); |
| 115 | 120 | do_action_ref_array('acym_load_installed_integrations', [&$integrationsRaw, $acyVersion]); |
| 116 | 121 | |
| @@ -132,8 +137,9 @@ | ||
| 132 | 137 | $dynamicFile = acym_getPluginPath($oneDynamic); |
| 133 | 138 | } |
| 134 | 139 | $className = 'plgAcym'.ucfirst($oneDynamic); |
| 135 | 140 | |
| 141 | + // Load the plugin | |
| 136 | 142 | if (isset($acymPlugins[$className]) || !file_exists($dynamicFile) || (!class_exists($className) && !include_once $dynamicFile)) { |
| 137 | 143 | continue; |
| 138 | 144 | } |
| 139 | 145 | |
| @@ -146,8 +152,9 @@ | ||
| 146 | 152 | if (in_array($oneDynamic, $integrationsClasses)) { |
| 147 | 153 | $pluginClass->addIntegrationIfMissing($plugin); |
| 148 | 154 | } |
| 149 | 155 | |
| 156 | + // If it's for another CMS or if the related extension isn't installed, skip it | |
| 150 | 157 | if (in_array($plugin->cms, ['all', 'WordPress'])) { |
| 151 | 158 | $acymAddonsForSettings[$className] = $plugin; |
| 152 | 159 | } |
| 153 | 160 | |