register(); return $iwp; } /** * @return \ImportWP\ImportWP */ function iwp() { global $iwp; return $iwp; } function iwp_is_pro_disabled() { return defined('IWP_PRO_VERSION') && version_compare(IWP_PRO_VERSION, IWP_CORE_MIN_PRO_VERSION, '<'); } /** * When updating ImportWP errors can arrise if the pro version has a different codebase * * Disable PRO functionality and alert user to reason. * * @return void */ function iwp_has_required_version_of_pro() { if (iwp_is_pro_disabled()) { remove_action('plugins_loaded', 'iwp_pro_loaded'); // Display compatability message $message = 'Import WP v' . IWP_VERSION . ' requires Import WP PRO v' . IWP_CORE_MIN_PRO_VERSION . ' or greater, Download the lastest version of Import WP Pro or Rollback Import WP to a compatable version.'; add_action('admin_notices', function () use ($message) { global $pagenow; if (!in_array($pagenow, ['plugins.php', 'update-core.php', 'index.php'])) { return; } echo '

' . $message . '

'; }); // display error message after plugin row $upgrade_mesasge = function () use ($message) { ?> 'error', 'message' => strip_tags($message)]; return $notices; }); } } add_action('plugins_loaded', 'iwp_has_required_version_of_pro', 0); function iwp_check_installed_plugins() { // Check and disable loading of zip archive plugin if (function_exists('iwp_zip_archive_setup') && has_filter('plugins_loaded', 'iwp_zip_archive_setup')) { remove_action('plugins_loaded', 'iwp_zip_archive_setup', 9); $upgrade_mesasge = function () { ?> Import WP - Zip Archive Importer Addon is now included in ImportWP, please deactivate and remove this plugin.