-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphp-outdated.php
28 lines (25 loc) · 1.44 KB
/
php-outdated.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
if (!defined('ABSPATH')) exit; // Exit if accessed directly
require_once SERVEBOLT_PLUGIN_PSR4_PATH . 'Helpers/Helpers.php';
use function Servebolt\Optimizer\Helpers\isHostedAtServebolt;
/**
* Display notice about PHP being too outdated.
*/
add_action('admin_notices', function() {
if (isHostedAtServebolt()) {
// Warning for Servebolt users, and help to upgrade the PHP version
?>
<div class="notice notice-error is-dismissable">
<p><?php printf(__('This site is running on a lower PHP version than required by the Servebolt Optimizer plugin. Please upgrade your site to run PHP %s or higher. We highly recommend upgrading to the highest available PHP version.', 'servebolt-wp'), SERVEBOLT_PLUGIN_MINIMUM_PHP_VERSION); ?></p>
<p><?php printf(__('%sGet in touch with our support%s if you need assistance upgrading your site to a newer PHP version.', 'servebolt-wp'), '<a href="https://admin.servebolt.com/" target="_blank">', '</a>'); ?></p>
</div>
<?php
} else {
// Warning for non-Servebolt users
?>
<div class="notice notice-error is-dismissable">
<p><?php printf(__('Servebolt Optimizer cannot run on PHP-versions older than PHP %s. You currently run PHP version %s. Please upgrade your PHP version to be able to run Servebolt Optimizer.', 'servebolt-wp'), SERVEBOLT_PLUGIN_MINIMUM_PHP_VERSION, phpversion()); ?></p>
</div>
<?php
}
});