| @@ -41,9 +41,9 @@ | ||
| 41 | 41 | // Admin (and therefore does not attach any of its admin-side hooks). |
| 42 | 42 | register_activation_hook(WPMCS_FILE, [Admin::class, 'install']); |
| 43 | 43 | register_deactivation_hook(WPMCS_FILE, [Admin::class, 'deactivation']); |
| 44 | 44 | |
| 45 | - if (!$this->is_environment_compatible()) { | |
| 45 | + if (!Notices::instance()->is_environment_compatible()) { | |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | add_action('init', [$this, 'init'], 0); |
| @@ -49,49 +49,8 @@ | ||
| 49 | 49 | add_action('init', [$this, 'init'], 0); |
| 50 | 50 | add_action('rest_api_init', [$this, 'on_rest_api_init'], 9); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - /** | |
| 54 | - * Check minimum PHP/WP requirements and queue an admin notice if missing. | |
| 55 | - * | |
| 56 | - * @return bool | |
| 57 | - * @since 1.3.10 | |
| 58 | - */ | |
| 59 | - private function is_environment_compatible(){ | |
| 60 | - if (!version_compare(PHP_VERSION, '8.1', '>=')) { | |
| 61 | - add_action('admin_notices', [$this, 'php_version_check_fail']); | |
| 62 | - return false; | |
| 63 | - } | |
| 64 | - if (!version_compare(get_bloginfo('version'), '5.2', '>=')) { | |
| 65 | - add_action('admin_notices', [$this, 'wp_version_check_fail']); | |
| 66 | - return false; | |
| 67 | - } | |
| 68 | - return true; | |
| 69 | - } | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * Plugin admin notice for minimum PHP version. | |
| 73 | - * | |
| 74 | - * @return void | |
| 75 | - * @since 1.3.10 | |
| 76 | - */ | |
| 77 | - public function php_version_check_fail(){ | |
| 78 | - /* translators: 1: Plugin name, 2: PHP version. */ | |
| 79 | - $message = sprintf(esc_html__('%1$s requires PHP version %2$s+, plugin is currently not running.', 'media-cloud-sync'), WPMCS_PLUGIN_NAME, '8.1'); | |
| 80 | - echo wp_kses_post(sprintf('<div class="error">%s</div>', wpautop($message))); | |
| 81 | - } | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * Plugin admin notice for minimum WordPress version. | |
| 85 | - * | |
| 86 | - * @return void | |
| 87 | - * @since 1.3.10 | |
| 88 | - */ | |
| 89 | - public function wp_version_check_fail(){ | |
| 90 | - /* translators: 1: Plugin name, 2: WordPress version. */ | |
| 91 | - $message = sprintf(esc_html__('%1$s requires WordPress version %2$s+. Because you are using an earlier version, the plugin is currently not running.', 'media-cloud-sync'), WPMCS_PLUGIN_NAME, '5.2'); | |
| 92 | - echo wp_kses_post(sprintf('<div class="error">%s</div>', wpautop($message))); | |
| 93 | - } | |
| 94 | 53 | |
| 95 | 54 | /** |
| 96 | 55 | * Register autoloader. |
| 97 | 56 | * |