PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 3.0.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v3.0.0
5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 All 38 releases
double-opt-in / core / IPHelper.class.php

IPHelper.class.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 3.0.0, at core/IPHelper.class.php

31 lines 885 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace forge12\contactform7\CF7DoubleOptIn;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 class IPHelper {
10 /**
11 * Retrieves the IP address of the current client.
12 *
13 * The method checks if the IP address is obtained from a shared internet, proxy, or remote address.
14 *
15 * @return string The IP address of the current client.
16 */
17 public static function getIPAdress(): string {
18 //whether ip is from share internet
19 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
20 $ip_address = sanitize_text_field( $_SERVER['HTTP_CLIENT_IP'] );
21 } //whether ip is from proxy
22 elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
23 $ip_address = sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_FOR'] );
24 } //whether ip is from remote address
25 else {
26 $ip_address = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
27 }
28
29 return $ip_address;
30 }
31 }