PluginProbe
OPcache Manager / 3.3.0
OPcache Manager v3.3.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 2.0.0 2.1.0 2.10.0 2.11.0 2.12.0 2.13.0 2.13.1 2.14.0 2.2.0 2.3.0 2.3.1 2.3.2 2.4.0 2.5.0 2.6.0 All 36 releases
opcache-manager / includes / system / class-hosting.php

class-hosting.php in OPcache Manager 3.3.0, at includes/system/class-hosting.php

71 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Hosting environment handling.
4 *
5 * @package System
6 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
7 * @since 1.0.0
8 */
9
10 namespace OPcacheManager\System;
11
12 /**
13 * The class responsible to manage and detect hosting environment.
14 *
15 * @package System
16 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
17 * @since 1.0.0
18 */
19 class Hosting {
20
21
22 /**
23 * Initializes the class and set its properties.
24 *
25 * @since 1.0.0
26 */
27 public function __construct() {
28 }
29
30 /**
31 * Check if Cloudflare Geoip is enabled.
32 *
33 * @return bool True if Cloudflare Geoip is enabled.
34 * @since 1.0.0
35 */
36 public static function is_cloudflare_geoip_enabled() {
37 return array_key_exists( 'HTTP_CF_IPCOUNTRY', $_SERVER ) || array_key_exists( 'CF-IPCountry', $_SERVER );
38 }
39
40 /**
41 * Check if Cloudfront (AWS) Geoip is enabled.
42 *
43 * @return bool True if Cloudfront Geoip is enabled.
44 * @since 1.0.0
45 */
46 public static function is_cloudfront_geoip_enabled() {
47 return array_key_exists( 'CloudFront-Viewer-Country', $_SERVER );
48 }
49
50 /**
51 * Check if Google LB Geoip is enabled.
52 *
53 * @return bool True if Google Geoip is enabled.
54 * @since 2.3.0
55 */
56 public static function is_googlelb_geoip_enabled() {
57 return array_key_exists( 'X-Client-Geo-Location', $_SERVER );
58 }
59
60 /**
61 * Check if Apache Geoip is enabled.
62 *
63 * @return bool True if Cloudfront Geoip is enabled.
64 * @since 1.0.0
65 */
66 public static function is_apache_geoip_enabled() {
67 return array_key_exists( 'GEOIP_COUNTRY_CODE', $_SERVER );
68 }
69
70 }
71