PluginProbe
Media Cloud Sync / 1.3.11
Media Cloud Sync v1.3.11
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / notices.php

notices.php in Media Cloud Sync 1.3.11, at includes/notices.php

78 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS;
4
5 defined('ABSPATH') || exit;
6
7 /**
8 * Handles plugin bootstrap admin notices.
9 *
10 * @since 1.3.11
11 */
12 class Notices {
13 /**
14 * Instance.
15 *
16 * @var Notices|null
17 */
18 private static $instance = null;
19
20 /**
21 * Retrieves the singleton instance of the class.
22 *
23 * @return self
24 * @since 1.3.11
25 */
26 public static function instance() {
27 if (is_null(self::$instance)) {
28 self::$instance = new self();
29 }
30
31 return self::$instance;
32 }
33
34 /**
35 * Check minimum PHP/WP requirements and queue an admin notice if missing.
36 *
37 * @return bool
38 * @since 1.3.11
39 */
40 public function is_environment_compatible() {
41 if (!version_compare(PHP_VERSION, '8.1', '>=')) {
42 add_action('admin_notices', [$this, 'php_version_check_fail']);
43 return false;
44 }
45
46 if (!version_compare(get_bloginfo('version'), '5.9', '>=')) {
47 add_action('admin_notices', [$this, 'wp_version_check_fail']);
48 return false;
49 }
50
51 return true;
52 }
53
54 /**
55 * Plugin admin notice for minimum PHP version.
56 *
57 * @return void
58 * @since 1.3.11
59 */
60 public function php_version_check_fail() {
61 /* translators: 1: Plugin name, 2: PHP version. */
62 $message = sprintf(esc_html__('%1$s requires PHP version %2$s+, plugin is currently not running.', 'media-cloud-sync'), WPMCS_PLUGIN_NAME, '8.1');
63 echo wp_kses_post(sprintf('<div class="error">%s</div>', wpautop($message)));
64 }
65
66 /**
67 * Plugin admin notice for minimum WordPress version.
68 *
69 * @return void
70 * @since 1.3.11
71 */
72 public function wp_version_check_fail() {
73 /* translators: 1: Plugin name, 2: WordPress version. */
74 $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.9');
75 echo wp_kses_post(sprintf('<div class="error">%s</div>', wpautop($message)));
76 }
77 }
78