forked from yellowtree/geoip-detect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_requirements.php
48 lines (40 loc) · 1.68 KB
/
check_requirements.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
function geoip_detect_version_check() {
if (empty($GLOBALS['wp_version']))
require(ABSPATH . '/wp-includes/version.php');
else
$wp_version = $GLOBALS['wp_version'];
if (version_compare ( PHP_VERSION, GEOIP_REQUIRED_PHP_VERSION, '<' )) {
$flag = 'PHP';
$min = GEOIP_REQUIRED_PHP_VERSION;
$yours = PHP_VERSION;
$message = 'Plugin GeoIP Detection is disabled. Requires ' . $flag . ' ' .$min ." (you're using " . $flag . " " . $yours . ") ";
} elseif (version_compare ( $wp_version, GEOIP_REQUIRED_WP_VERSION, '<' )) {
$flag = 'WordPress';
$min = GEOIP_REQUIRED_WP_VERSION;
$yours = $wp_version;
$message = 'Plugin GeoIP Detection is disabled. Requires ' . $flag . ' ' .$min ." (you're using " . $flag . " " . $yours . ") ";
} else {
return true;
}
if (WP_DEBUG)
trigger_error($message);
add_action ( 'all_admin_notices', 'geoip_detect_version_minimum_requirements_notice' );
return false;
}
function geoip_detect_version_minimum_requirements_notice() {
if (empty($GLOBALS['wp_version']))
require(ABSPATH . '/wp-includes/version.php');
else
$wp_version = $GLOBALS['wp_version'];
?>
<div class="error">
<h3><?php _e( 'GeoIP Detection: Minimum requirements not met.', 'geoip-detect' ); ?></h3>
<p>
The plugin <strong>GeoIP Detection</strong> plugin requires PHP <?php echo GEOIP_REQUIRED_PHP_VERSION; ?> (you're using PHP <?php echo PHP_VERSION; ?>) and WordPress version <?php echo GEOIP_REQUIRED_WP_VERSION; ?> (you're using: <?php echo $wp_version; ?>) and therefore does exactly nothing.</p>
<p>
You can update, or install an <a href="https://github.com/yellowtree/wp-geoip-detect/releases">1.x legacy version</a> of this plugin instead.
</p>
</div>
<?php
}