array('plugins_loaded', 'wu_wc_init', 10, true), '\WU_Multiple_Logins' => false, '\WP_Ultimo_Blocks' => array('plugins_loaded', 'wp_ultimo_blocks_init', 20, false), '\WU_Ultimo_Domain_Seller' => array('plugins_loaded', 'wu_domain_seller_init', 1, false), '\WP_Ultimo_PS_Migrator' => array('plugins_loaded', 'wu_ps_migrator_init', 1, false), ); /** * List of supported add-ons with upgrades available. * * @since 2.0.5 */ $supported_but_upgradable = array( '\WP_Ultimo_PTM', ); foreach ($unsupported_v1_addons as $base_class => $init_info) { if (class_exists($base_class)) { list($hook, $function, $priority, $upgradeable) = $init_info; self::$unloaded[] = $base_class; if ($hook) { remove_action($hook, $function, $priority); } // end if; if ($upgradeable) { self::$to_upgrade[] = $base_class; } // end if; } // end if; } // end foreach; foreach ($supported_but_upgradable as $base_class) { if (class_exists($base_class)) { self::$upgradeable[] = $base_class; self::$to_upgrade[] = $base_class; } // end if; } // end foreach; } // end unload_unsupported_addons; /** * Install the newer version of the plugin updater for add-ons that can already be updated. * * @since 2.0.5 * @return void */ public static function force_updater() { global $pagenow; if ($pagenow !== 'plugins.php') { return; } if (WP_Ultimo()->is_loaded() === false || !is_network_admin()) { return; } // end if; $license_key = \WP_Ultimo\License::get_instance()->get_license_key(); if (!$license_key) { return; } // end if; foreach (self::$to_upgrade as $addon_to_upgrade) { $info = self::replace_with($addon_to_upgrade); if ($info && wu_get_isset($info, 'slug', false)) { try { $url = add_query_arg(array( 'action' => 'get_metadata', 'slug' => $info['slug'], 'beta_program' => 2, ), 'https://versions.nextpress.co/updates/'); $url = wu_with_license_key($url); $guess_plugin_path = WP_PLUGIN_DIR . '/' . $info['slug'] . '/' . $info['slug'] . '.php'; if (file_exists($guess_plugin_path)) { $checker = \Puc_v4_Factory::buildUpdateChecker($url, $guess_plugin_path, $info['slug']); } // end if; } catch (\Throwable $exception) { // Nothing to do. } // end try; } // end if; } // end foreach; } // end force_updater; /** * Maybe add necessary admin notices about installing WP Ultimo version 2. * * @since 2.0.5 * @return void */ public static function maybe_add_notices() { if (wu_request('page') === 'wp-ultimo-setup') { return; } // end if; $message = array(); $plugins_page_a = sprintf('%s', network_admin_url('plugins.php'), __('plugins', 'wp-ultimo')); /** * Firstly, lets check if we already run the migration. * We found some cases that the migration not worked as expected and the option checked in Migrator::is_migration_done() * is not added. So for this verification we also need to see if we already run the setup. */ if (Migrator::is_migration_done() === false && Requirements::run_setup() === false) { $message[] = '
' . __('It seems that you have not run the WP Ultimo upgrader yet. That is the first thing we need to do.', 'wp-ultimo') . '
'; $message[] = sprintf('%s', network_admin_url('admin.php?page=wp-ultimo-setup'), __('Visit the Installer to finish the upgrade →', 'wp-ultimo')); } // end if; if (count(self::$unloaded) > 0) { if ($message) { $message[] = '' . __('To make sure you do not experience any crashes on your network, we checked the add-ons installed and deactivated the ones that could cause problems in their currently installed version - or that are no longer supported.', 'wp-ultimo') . '
' . __('These add-ons include:', 'wp-ultimo') . '
' . __('Other add-ons that you have installed at the moment are still supported, but have new versions with full compatibility with version 2.0:', 'wp-ultimo') . '
' . __('Thanks for updating to WP Ultimo version 2.0!', 'wp-ultimo') . '
'), $message); $message = implode('', $message); if (WP_Ultimo()->is_loaded()) { WP_Ultimo()->notices->add($message, 'warning', 'network-admin'); } else { self::fallback_admin_notice_display($message, 'warning'); } // end if; } // end maybe_add_notices; /** * A fallback way to display admin notices when WP Ultimo is not fully loaded yet. * * @since 2.0.5 * * @param string $message The message to display. * @param string $type The type of notice. Defaults to warning. * @return void */ public static function fallback_admin_notice_display($message, $type = 'warning') { printf('