PluginProbe
DecaLog / 4.4.0
DecaLog v4.4.0
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / includes / system / class-hosting.php

class-hosting.php in DecaLog 4.4.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 Decalog\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