PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / public / utils / class-proxyutils.php

class-proxyutils.php in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.75, at public/utils/class-proxyutils.php

81 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Leadin\utils;
4
5 use Leadin\data\Portal_Options;
6 use Leadin\data\Filters;
7 /**
8 * Static class containing all the utility functions related to proxy mappings.
9 */
10 class ProxyUtils {
11
12 /**
13 * Info logger function to log messages.
14 *
15 * @param string $message The message to log.
16 */
17 public static function info_log( $message ) {
18 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, WordPress.NamingConventions.ValidHookName.UseUnderscores
19 do_action( 'qm/debug', $message );
20 }
21
22 /**
23 * Error logger function to log messages.
24 *
25 * @param string $message The message to log.
26 */
27 public static function error_log( $message ) {
28 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, WordPress.NamingConventions.ValidHookName.UseUnderscores
29 do_action( 'qm/error', $message );
30 }
31
32 /**
33 * Get the client IP address.
34 *
35 * @return string The client IP address.
36 */
37 public static function get_client_ip() {
38 $ip_keys = array(
39 'HTTP_CLIENT_IP',
40 'HTTP_X_FORWARDED_FOR',
41 'HTTP_X_FORWARDED',
42 'HTTP_FORWARDED_FOR',
43 'HTTP_FORWARDED',
44 'REMOTE_ADDR',
45 );
46 foreach ( $ip_keys as $key ) {
47 if ( isset( $_SERVER[ $key ] ) && ! empty( $_SERVER[ $key ] ) ) {
48 return sanitize_text_field( wp_unslash( $_SERVER[ $key ] ) );
49 }
50 }
51 return '';
52 }
53
54 /**
55 * Get the destination domain.
56 *
57 * @return string The destination domain.
58 */
59 public static function get_destination_domain() {
60 return isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
61 }
62
63 /**
64 * Get the proxy plugin mapping API base URL.
65 *
66 * @return string The API base URL.
67 */
68 public static function get_plugin_mappings_api_url() {
69 return Filters::apply_plugin_mappings_api_url();
70 }
71
72 /**
73 * Get the proxy base URL.
74 *
75 * @return string The proxy base URL.
76 */
77 public static function get_proxy_base_url() {
78 return Filters::apply_sites_proxy_cdn_filters();
79 }
80 }
81