Current Path : /storage/v11800/affypharma/public_html/wp-content/plugins/bdthemes-element-pack/includes/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/affypharma/public_html/wp-content/plugins/bdthemes-element-pack/includes/utils.php |
<?php
namespace ElementPack\Classes;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Utils {
public static function get_client_ip() {
$server_ip_keys = [
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_X_CLUSTER_CLIENT_IP',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR',
];
foreach ( $server_ip_keys as $key ) {
if ( isset( $_SERVER[ $key ] ) && filter_var( $_SERVER[ $key ], FILTER_VALIDATE_IP ) ) {
return $_SERVER[ $key ];
}
}
// Fallback local ip.
return '127.0.0.1';
}
public static function get_site_domain() {
return str_ireplace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) );
}
}