Version Description
- Effective reversal to 1.0.37 to address blocking issue to some customers
Download this release
Release Info
Developer | unbouncewordpress |
Plugin | Unbounce Landing Pages |
Version | 1.0.40 |
Comparing to | |
See all releases |
Code changes from version 1.0.39 to 1.0.40
- UBConfig.php +25 -43
- UBDiagnostics.php +10 -7
- UBHTTP.php +17 -154
- Unbounce-Page.php +43 -4
- readme.txt +3 -7
- templates/diagnostics.php +1 -1
- templates/main_authorized_footer.php +1 -1
- templates/main_unauthorized_footer.php +1 -1
UBConfig.php
CHANGED
@@ -5,8 +5,8 @@ class UBConfig
|
|
5 |
|
6 |
const UB_PLUGIN_NAME = 'ub-wordpress';
|
7 |
const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
|
8 |
-
const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.
|
9 |
-
const UB_VERSION = '1.0.
|
10 |
|
11 |
// Option keys
|
12 |
const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
|
@@ -24,44 +24,31 @@ class UBConfig
|
|
24 |
const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message';
|
25 |
const UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR = 'ub-allow-public-address-x-forwarded-for';
|
26 |
const UB_PLUGIN_VERSION_KEY = 'ub-plugin-version';
|
27 |
-
const UB_USE_CURL_KEY = 'ub-use-curl';
|
28 |
|
29 |
const UB_LOCK_NAME = 'ub-sql-lock';
|
30 |
|
31 |
-
public static function
|
32 |
{
|
33 |
// All options, used by UBDiagnostics and deactivation hook
|
34 |
// Arrays are not allowed in class constants, so use a function
|
35 |
return array(
|
36 |
-
UBConfig::UB_ROUTES_CACHE_KEY
|
37 |
-
UBConfig::UB_REMOTE_DEBUG_KEY
|
38 |
-
UBConfig::UB_PAGE_SERVER_DOMAIN_KEY
|
39 |
-
UBConfig::UB_REMOTE_LOG_URL_KEY
|
40 |
-
UBConfig::UB_REMOTE_EVENTS_URL_KEY
|
41 |
-
UBConfig::UB_API_URL_KEY
|
42 |
-
UBConfig::UB_API_CLIENT_ID_KEY
|
43 |
-
UBConfig::UB_AUTHORIZED_DOMAINS_KEY
|
44 |
-
UBConfig::UB_HAS_AUTHORIZED_KEY
|
45 |
-
UBConfig::UB_USER_ID_KEY
|
46 |
-
UBConfig::UB_DOMAIN_ID_KEY
|
47 |
-
UBConfig::UB_CLIENT_ID_KEY
|
48 |
-
UBConfig::UB_PROXY_ERROR_MESSAGE_KEY
|
49 |
-
UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR
|
50 |
-
UBConfig::UB_USE_CURL_KEY => 1,
|
51 |
-
UBConfig::UB_PLUGIN_VERSION_KEY => UBConfig::UB_VERSION
|
52 |
);
|
53 |
}
|
54 |
|
55 |
-
public static function set_options_if_not_exist()
|
56 |
-
{
|
57 |
-
$ub_options = UBConfig::ub_option_defaults();
|
58 |
-
foreach ($ub_options as $key => $default) {
|
59 |
-
if (!get_option($key)) {
|
60 |
-
add_option($key, $default);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
public static function default_page_server_domain()
|
66 |
{
|
67 |
$domain = getenv('UB_PAGE_SERVER_DOMAIN');
|
@@ -71,13 +58,19 @@ class UBConfig
|
|
71 |
public static function default_remote_log_url()
|
72 |
{
|
73 |
$url = getenv('UB_REMOTE_LOG_URL');
|
74 |
-
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
public static function default_remote_events_url()
|
78 |
{
|
79 |
$url = getenv('UB_REMOTE_EVENTS_URL');
|
80 |
-
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
public static function default_api_url()
|
@@ -92,12 +85,6 @@ class UBConfig
|
|
92 |
return $client_id ? $client_id : '660a311881321b9d4e777993e50875dec5da9cc4ef44369d121544b21da52b92';
|
93 |
}
|
94 |
|
95 |
-
public static function default_remote_debug_enabled()
|
96 |
-
{
|
97 |
-
$debug_enabled = getenv('UB_REMOTE_DEBUG_ENABLED');
|
98 |
-
return $debug_enabled ? $debug_enabled : 0;
|
99 |
-
}
|
100 |
-
|
101 |
public static function default_authorized_domains()
|
102 |
{
|
103 |
$domains = getenv('UB_AUTHORIZED_DOMAINS');
|
@@ -176,11 +163,6 @@ class UBConfig
|
|
176 |
null, null, null);
|
177 |
}
|
178 |
|
179 |
-
public static function use_curl()
|
180 |
-
{
|
181 |
-
return get_option(UBConfig::UB_USE_CURL_KEY, 1) == 1;
|
182 |
-
}
|
183 |
-
|
184 |
public static function domain()
|
185 |
{
|
186 |
return parse_url(get_home_url(), PHP_URL_HOST);
|
5 |
|
6 |
const UB_PLUGIN_NAME = 'ub-wordpress';
|
7 |
const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
|
8 |
+
const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.40';
|
9 |
+
const UB_VERSION = '1.0.40';
|
10 |
|
11 |
// Option keys
|
12 |
const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
|
24 |
const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message';
|
25 |
const UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR = 'ub-allow-public-address-x-forwarded-for';
|
26 |
const UB_PLUGIN_VERSION_KEY = 'ub-plugin-version';
|
|
|
27 |
|
28 |
const UB_LOCK_NAME = 'ub-sql-lock';
|
29 |
|
30 |
+
public static function ub_option_keys()
|
31 |
{
|
32 |
// All options, used by UBDiagnostics and deactivation hook
|
33 |
// Arrays are not allowed in class constants, so use a function
|
34 |
return array(
|
35 |
+
UBConfig::UB_ROUTES_CACHE_KEY,
|
36 |
+
UBConfig::UB_REMOTE_DEBUG_KEY,
|
37 |
+
UBConfig::UB_PAGE_SERVER_DOMAIN_KEY,
|
38 |
+
UBConfig::UB_REMOTE_LOG_URL_KEY,
|
39 |
+
UBConfig::UB_REMOTE_EVENTS_URL_KEY,
|
40 |
+
UBConfig::UB_API_URL_KEY,
|
41 |
+
UBConfig::UB_API_CLIENT_ID_KEY,
|
42 |
+
UBConfig::UB_AUTHORIZED_DOMAINS_KEY,
|
43 |
+
UBConfig::UB_HAS_AUTHORIZED_KEY,
|
44 |
+
UBConfig::UB_USER_ID_KEY,
|
45 |
+
UBConfig::UB_DOMAIN_ID_KEY,
|
46 |
+
UBConfig::UB_CLIENT_ID_KEY,
|
47 |
+
UBConfig::UB_PROXY_ERROR_MESSAGE_KEY,
|
48 |
+
UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR
|
|
|
|
|
49 |
);
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
public static function default_page_server_domain()
|
53 |
{
|
54 |
$domain = getenv('UB_PAGE_SERVER_DOMAIN');
|
58 |
public static function default_remote_log_url()
|
59 |
{
|
60 |
$url = getenv('UB_REMOTE_LOG_URL');
|
61 |
+
if ($url == null) {
|
62 |
+
return 'https://events-gateway.unbounce.com/events/wordpress_logs';
|
63 |
+
}
|
64 |
+
return $url;
|
65 |
}
|
66 |
|
67 |
public static function default_remote_events_url()
|
68 |
{
|
69 |
$url = getenv('UB_REMOTE_EVENTS_URL');
|
70 |
+
if ($url == null) {
|
71 |
+
return 'https://events-gateway.unbounce.com/events/domains';
|
72 |
+
}
|
73 |
+
return $url;
|
74 |
}
|
75 |
|
76 |
public static function default_api_url()
|
85 |
return $client_id ? $client_id : '660a311881321b9d4e777993e50875dec5da9cc4ef44369d121544b21da52b92';
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
public static function default_authorized_domains()
|
89 |
{
|
90 |
$domains = getenv('UB_AUTHORIZED_DOMAINS');
|
163 |
null, null, null);
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
|
|
166 |
public static function domain()
|
167 |
{
|
168 |
return parse_url(get_home_url(), PHP_URL_HOST);
|
UBDiagnostics.php
CHANGED
@@ -100,7 +100,7 @@ class UBDiagnostics
|
|
100 |
return array(
|
101 |
'PHP Version' => phpversion(),
|
102 |
'WordPress Version' => UBDiagnostics::wordpress_version(),
|
103 |
-
'Unbounce Plugin Version' => '1.0.
|
104 |
'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)),
|
105 |
'Options' => self::pp(UBDiagnostics::ub_options()),
|
106 |
'Permalink Structure' => get_option('permalink_structure', ''),
|
@@ -124,11 +124,14 @@ class UBDiagnostics
|
|
124 |
|
125 |
private static function ub_options()
|
126 |
{
|
127 |
-
$
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
private static function curl_version()
|
@@ -178,7 +181,7 @@ class UBDiagnostics
|
|
178 |
return array(
|
179 |
'php' => phpversion(),
|
180 |
'wordpress' => UBDiagnostics::wordpress_version(),
|
181 |
-
'plugin_version' => '1.0.
|
182 |
'curl_installed' => self::is_curl_installed(),
|
183 |
'xml_installed' => self::is_xml_installed(),
|
184 |
'sni_support' => self::hasSNI(),
|
100 |
return array(
|
101 |
'PHP Version' => phpversion(),
|
102 |
'WordPress Version' => UBDiagnostics::wordpress_version(),
|
103 |
+
'Unbounce Plugin Version' => '1.0.40',
|
104 |
'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)),
|
105 |
'Options' => self::pp(UBDiagnostics::ub_options()),
|
106 |
'Permalink Structure' => get_option('permalink_structure', ''),
|
124 |
|
125 |
private static function ub_options()
|
126 |
{
|
127 |
+
$option_values = array_map(function ($key) {
|
128 |
+
return get_option($key);
|
129 |
+
}, UBConfig::ub_option_keys());
|
130 |
+
|
131 |
+
// Return an array where the key is the option key and the value
|
132 |
+
// the option value:
|
133 |
+
// array('ub-option-key' => 'option value')
|
134 |
+
return array_combine(UBConfig::ub_option_keys(), $option_values);
|
135 |
}
|
136 |
|
137 |
private static function curl_version()
|
181 |
return array(
|
182 |
'php' => phpversion(),
|
183 |
'wordpress' => UBDiagnostics::wordpress_version(),
|
184 |
+
'plugin_version' => '1.0.40',
|
185 |
'curl_installed' => self::is_curl_installed(),
|
186 |
'xml_installed' => self::is_xml_installed(),
|
187 |
'sni_support' => self::hasSNI(),
|
UBHTTP.php
CHANGED
@@ -12,7 +12,6 @@ class UBHTTP
|
|
12 |
// @codingStandardsIgnoreLine
|
13 |
public static $response_header_whitelist = '/^(Content-Type:|Location:|Link:|Content-Location:|Set-Cookie:|X-Server-Instance:|X-Unbounce-PageId:|X-Unbounce-Variant:|X-Unbounce-VisitorID:)/i';
|
14 |
public static $request_header_blacklist = '/^(Accept-Encoding:)/i';
|
15 |
-
public static $cookie_whitelist = array('ubvs', 'ubpv', 'ubvt', 'hubspotutk');
|
16 |
|
17 |
public static function is_private_ip_address($ip_address)
|
18 |
{
|
@@ -69,6 +68,7 @@ class UBHTTP
|
|
69 |
}
|
70 |
|
71 |
public static function get_proxied_for_header(
|
|
|
72 |
$forwarded_for,
|
73 |
$current_ip
|
74 |
) {
|
@@ -79,7 +79,9 @@ class UBHTTP
|
|
79 |
} else {
|
80 |
$proxied_for = $current_ip;
|
81 |
}
|
82 |
-
|
|
|
|
|
83 |
}
|
84 |
|
85 |
public static function stream_headers_function($existing_headers)
|
@@ -154,12 +156,12 @@ class UBHTTP
|
|
154 |
}
|
155 |
|
156 |
// taken from: http://stackoverflow.com/a/13036310/322727
|
157 |
-
|
158 |
{
|
159 |
// map to curl-friendly format
|
160 |
$req_headers = array();
|
161 |
array_walk($headers, function (&$v, $k) use (&$req_headers) {
|
162 |
-
$req_headers
|
163 |
});
|
164 |
|
165 |
return $req_headers;
|
@@ -168,130 +170,33 @@ class UBHTTP
|
|
168 |
public static function stream_request(
|
169 |
$method,
|
170 |
$target_url,
|
|
|
171 |
$headers0,
|
172 |
$user_agent
|
173 |
) {
|
|
|
174 |
// Always add this header to responses to show it comes from our plugin.
|
175 |
header("X-Unbounce-Plugin: 1", false);
|
176 |
-
if (UBConfig::use_curl()) {
|
177 |
-
return UBHTTP::stream_request_curl(
|
178 |
-
$method,
|
179 |
-
$target_url,
|
180 |
-
$headers0,
|
181 |
-
$user_agent
|
182 |
-
);
|
183 |
-
} else {
|
184 |
-
return UBHTTP::stream_request_wp_remote(
|
185 |
-
$method,
|
186 |
-
$target_url,
|
187 |
-
$headers0,
|
188 |
-
$user_agent
|
189 |
-
);
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
private static function stream_request_wp_remote(
|
194 |
-
$method,
|
195 |
-
$target_url,
|
196 |
-
$headers0,
|
197 |
-
$user_agent
|
198 |
-
) {
|
199 |
-
$args = array(
|
200 |
-
'method' => $method,
|
201 |
-
'user-agent' => $user_agent,
|
202 |
-
'redirection' => 0,
|
203 |
-
'timeout' => 30,
|
204 |
-
'headers' => UBHTTP::prepare_request_headers($headers0, true)
|
205 |
-
);
|
206 |
-
if ($method == 'POST') {
|
207 |
-
$args['body'] = file_get_contents('php://input');
|
208 |
-
}
|
209 |
-
|
210 |
-
$resp = wp_remote_request($target_url, $args);
|
211 |
-
if (is_wp_error($resp)) {
|
212 |
-
$message = "Error proxying to '" . $target_url . "': " . $resp->get_error_message();
|
213 |
-
UBLogger::warning($message);
|
214 |
-
http_response_code(500);
|
215 |
-
return array(false, $message);
|
216 |
-
} else {
|
217 |
-
http_response_code($resp['response']['code']);
|
218 |
-
$response_headers = $resp['headers'];
|
219 |
-
UBHTTP::set_response_headers($response_headers);
|
220 |
-
echo $resp['body'];
|
221 |
-
return array(true, null);
|
222 |
-
}
|
223 |
-
}
|
224 |
|
225 |
-
|
226 |
-
{
|
227 |
$forwarded_for = UBUtil::array_fetch($_SERVER, 'HTTP_X_FORWARDED_FOR');
|
228 |
$remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR');
|
229 |
|
230 |
-
$
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
|
235 |
-
$
|
|
|
236 |
$forwarded_for,
|
237 |
$remote_ip
|
238 |
-
));
|
239 |
-
return $filtered_h;
|
240 |
-
}
|
241 |
-
|
242 |
-
public static function sanitize_cookies($headers)
|
243 |
-
{
|
244 |
-
$cookies_to_forward = UBUtil::array_select_by_key(
|
245 |
-
UBHTTP::cookie_array_from_string($headers["Cookie"]),
|
246 |
-
UBHTTP::$cookie_whitelist
|
247 |
);
|
248 |
-
$headers["Cookie"] = UBHTTP::cookie_string_from_array($cookies_to_forward);
|
249 |
-
return $headers;
|
250 |
-
}
|
251 |
-
|
252 |
-
public static function cookie_array_from_string($cookie_string)
|
253 |
-
{
|
254 |
-
$cookie_kv_array = array();
|
255 |
-
$cookie_flat_array = explode('; ', $cookie_string);
|
256 |
-
foreach ($cookie_flat_array as $itm) {
|
257 |
-
list($key, $val) = explode('=', $itm, 2);
|
258 |
-
$cookie_kv_array[$key] = $val;
|
259 |
-
}
|
260 |
-
return $cookie_kv_array;
|
261 |
-
}
|
262 |
-
|
263 |
-
public static function set_response_headers($headers)
|
264 |
-
{
|
265 |
-
foreach ($headers as $h_key => $h_value) {
|
266 |
-
if (preg_match(UBHTTP::$response_header_whitelist, $h_key . ":")) {
|
267 |
-
if (is_array($h_value)) {
|
268 |
-
foreach ($h_value as $header_item) {
|
269 |
-
header($h_key . ': ' . $header_item, false);
|
270 |
-
}
|
271 |
-
} else {
|
272 |
-
header($h_key . ': ' . $h_value, false);
|
273 |
-
}
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
|
279 |
-
private static function stream_request_curl(
|
280 |
-
$method,
|
281 |
-
$target_url,
|
282 |
-
$headers0,
|
283 |
-
$user_agent
|
284 |
-
) {
|
285 |
-
$base_response_headers = headers_list();
|
286 |
-
|
287 |
-
$headers1 = UBHTTP::prepare_request_headers($headers0);
|
288 |
-
$headers = UBHTTP::convert_headers_to_curl($headers1);
|
289 |
-
|
290 |
UBLogger::debug_var('target_url', $target_url);
|
291 |
UBLogger::debug_var('original_headers', print_r($headers0, true));
|
292 |
UBLogger::debug_var('sent_headers', print_r($headers, true));
|
293 |
|
294 |
-
$stream_headers = UBHTTP::stream_headers_function($
|
295 |
$stream_body = UBHTTP::stream_response_function();
|
296 |
$curl = curl_init();
|
297 |
// http://php.net/manual/en/function.curl-setopt.php
|
@@ -300,6 +205,7 @@ class UBHTTP
|
|
300 |
CURLOPT_POST => $method == "POST",
|
301 |
CURLOPT_CUSTOMREQUEST => $method,
|
302 |
CURLOPT_USERAGENT => $user_agent,
|
|
|
303 |
CURLOPT_HTTPHEADER => $headers,
|
304 |
CURLOPT_HEADERFUNCTION => $stream_headers,
|
305 |
CURLOPT_WRITEFUNCTION => $stream_body,
|
@@ -417,15 +323,6 @@ class UBHTTP
|
|
417 |
}
|
418 |
|
419 |
public static function send_event_to_events_gateway($url, $data_string)
|
420 |
-
{
|
421 |
-
if (UBConfig::use_curl()) {
|
422 |
-
UBHTTP::send_event_to_events_gateway_curl($url, $data_string);
|
423 |
-
} else {
|
424 |
-
UBHTTP::send_event_to_events_gateway_wp_remote($url, $data_string);
|
425 |
-
}
|
426 |
-
}
|
427 |
-
|
428 |
-
private static function send_event_to_events_gateway_curl($url, $data_string)
|
429 |
{
|
430 |
try {
|
431 |
$stream_function = function ($curl, $str) {
|
@@ -472,38 +369,4 @@ class UBHTTP
|
|
472 |
UBLogger::warning($message);
|
473 |
}
|
474 |
}
|
475 |
-
|
476 |
-
private static function send_event_to_events_gateway_wp_remote($url, $data_string)
|
477 |
-
{
|
478 |
-
$args = array(
|
479 |
-
'method' => 'POST',
|
480 |
-
'user-agent' => UBConfig::UB_USER_AGENT,
|
481 |
-
'redirection' => 0,
|
482 |
-
'timeout' => 2,
|
483 |
-
'headers' => array(
|
484 |
-
'Content-Type' => 'application/json',
|
485 |
-
'Content-Length' => strlen($data_string)
|
486 |
-
),
|
487 |
-
'body' => $data_string
|
488 |
-
);
|
489 |
-
|
490 |
-
$resp = wp_remote_request($url, $args);
|
491 |
-
if (is_wp_error($resp)) {
|
492 |
-
$message = "Unable to send log messages to '" . $url . "': " . $resp->get_error_message();
|
493 |
-
UBLogger::warning($message);
|
494 |
-
return;
|
495 |
-
}
|
496 |
-
|
497 |
-
$http_code = $resp['response']['code'];
|
498 |
-
if ($http_code >= 200 && $http_code < 300) {
|
499 |
-
$message = 'Successfully sent log messsages to ' . $url
|
500 |
-
. ' - HTTP status: ' . $http_code;
|
501 |
-
UBLogger::debug($message);
|
502 |
-
} else {
|
503 |
-
UBLogger::warning('$data_string=' . $data_string);
|
504 |
-
$message = 'Unable to send log messages to ' . $url
|
505 |
-
. ' - HTTP status: ' . $http_code;
|
506 |
-
UBLogger::warning($message);
|
507 |
-
}
|
508 |
-
}
|
509 |
}
|
12 |
// @codingStandardsIgnoreLine
|
13 |
public static $response_header_whitelist = '/^(Content-Type:|Location:|Link:|Content-Location:|Set-Cookie:|X-Server-Instance:|X-Unbounce-PageId:|X-Unbounce-Variant:|X-Unbounce-VisitorID:)/i';
|
14 |
public static $request_header_blacklist = '/^(Accept-Encoding:)/i';
|
|
|
15 |
|
16 |
public static function is_private_ip_address($ip_address)
|
17 |
{
|
68 |
}
|
69 |
|
70 |
public static function get_proxied_for_header(
|
71 |
+
$out_headers,
|
72 |
$forwarded_for,
|
73 |
$current_ip
|
74 |
) {
|
79 |
} else {
|
80 |
$proxied_for = $current_ip;
|
81 |
}
|
82 |
+
|
83 |
+
$out_headers[] = 'X-Proxied-For: ' . $proxied_for;
|
84 |
+
return $out_headers;
|
85 |
}
|
86 |
|
87 |
public static function stream_headers_function($existing_headers)
|
156 |
}
|
157 |
|
158 |
// taken from: http://stackoverflow.com/a/13036310/322727
|
159 |
+
private static function convert_headers_to_curl($headers)
|
160 |
{
|
161 |
// map to curl-friendly format
|
162 |
$req_headers = array();
|
163 |
array_walk($headers, function (&$v, $k) use (&$req_headers) {
|
164 |
+
array_push($req_headers, $k . ": " . $v);
|
165 |
});
|
166 |
|
167 |
return $req_headers;
|
170 |
public static function stream_request(
|
171 |
$method,
|
172 |
$target_url,
|
173 |
+
$cookie_string,
|
174 |
$headers0,
|
175 |
$user_agent
|
176 |
) {
|
177 |
+
|
178 |
// Always add this header to responses to show it comes from our plugin.
|
179 |
header("X-Unbounce-Plugin: 1", false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
+
$existing_headers = headers_list();
|
|
|
182 |
$forwarded_for = UBUtil::array_fetch($_SERVER, 'HTTP_X_FORWARDED_FOR');
|
183 |
$remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR');
|
184 |
|
185 |
+
$headers1 = UBHTTP::convert_headers_to_curl($headers0);
|
186 |
+
$curl_headers = array_filter($headers1, function ($key) {
|
187 |
+
return !preg_match(UBHTTP::$request_header_blacklist, $key);
|
188 |
+
});
|
189 |
|
190 |
+
$headers = UBHTTP::get_proxied_for_header(
|
191 |
+
$curl_headers,
|
192 |
$forwarded_for,
|
193 |
$remote_ip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
UBLogger::debug_var('target_url', $target_url);
|
196 |
UBLogger::debug_var('original_headers', print_r($headers0, true));
|
197 |
UBLogger::debug_var('sent_headers', print_r($headers, true));
|
198 |
|
199 |
+
$stream_headers = UBHTTP::stream_headers_function($existing_headers);
|
200 |
$stream_body = UBHTTP::stream_response_function();
|
201 |
$curl = curl_init();
|
202 |
// http://php.net/manual/en/function.curl-setopt.php
|
205 |
CURLOPT_POST => $method == "POST",
|
206 |
CURLOPT_CUSTOMREQUEST => $method,
|
207 |
CURLOPT_USERAGENT => $user_agent,
|
208 |
+
CURLOPT_COOKIE => $cookie_string,
|
209 |
CURLOPT_HTTPHEADER => $headers,
|
210 |
CURLOPT_HEADERFUNCTION => $stream_headers,
|
211 |
CURLOPT_WRITEFUNCTION => $stream_body,
|
323 |
}
|
324 |
|
325 |
public static function send_event_to_events_gateway($url, $data_string)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
{
|
327 |
try {
|
328 |
$stream_function = function ($curl, $str) {
|
369 |
UBLogger::warning($message);
|
370 |
}
|
371 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
}
|
Unbounce-Page.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Unbounce Landing Pages
|
4 |
Plugin URI: http://unbounce.com
|
5 |
Description: Unbounce is the most powerful standalone landing page builder available.
|
6 |
-
Version: 1.0.
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
@@ -22,14 +22,46 @@ require_once dirname(__FILE__) . '/UBEvents.php';
|
|
22 |
require_once dirname(__FILE__) . '/UBTemplate.php';
|
23 |
|
24 |
register_activation_hook(__FILE__, function () {
|
25 |
-
UBConfig::
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
// NOTE: This should be brought back when working on BEE-1136
|
28 |
// @UBDiagnostics::sendActivationEvent();
|
29 |
});
|
30 |
|
31 |
register_deactivation_hook(__FILE__, function () {
|
32 |
-
foreach (UBConfig::
|
33 |
delete_option($key);
|
34 |
}
|
35 |
});
|
@@ -116,6 +148,13 @@ add_action('init', function () {
|
|
116 |
|
117 |
UBLogger::debug("perform ''" . $url_purpose . "'' on received URL " . $current_url);
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
$all_headers = getallheaders();
|
120 |
$all_headers['Host'] = $domain;
|
121 |
|
@@ -125,6 +164,7 @@ add_action('init', function () {
|
|
125 |
list($success, $message) = UBHTTP::stream_request(
|
126 |
$http_method,
|
127 |
$raw_url,
|
|
|
128 |
$all_headers,
|
129 |
$user_agent
|
130 |
);
|
@@ -149,7 +189,6 @@ add_action('admin_init', function () {
|
|
149 |
$pluginVersion = get_option(UBConfig::UB_PLUGIN_VERSION_KEY);
|
150 |
if (UBConfig::UB_VERSION != $pluginVersion) {
|
151 |
@UBDiagnostics::sendActivationEvent($pluginVersion);
|
152 |
-
UBConfig::set_options_if_not_exist();
|
153 |
update_option(UBConfig::UB_PLUGIN_VERSION_KEY, UBConfig::UB_VERSION);
|
154 |
}
|
155 |
|
3 |
Plugin Name: Unbounce Landing Pages
|
4 |
Plugin URI: http://unbounce.com
|
5 |
Description: Unbounce is the most powerful standalone landing page builder available.
|
6 |
+
Version: 1.0.40
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
22 |
require_once dirname(__FILE__) . '/UBTemplate.php';
|
23 |
|
24 |
register_activation_hook(__FILE__, function () {
|
25 |
+
add_option(UBConfig::UB_ROUTES_CACHE_KEY, array());
|
26 |
+
add_option(UBConfig::UB_REMOTE_DEBUG_KEY, 0);
|
27 |
+
add_option(
|
28 |
+
UBConfig::UB_PAGE_SERVER_DOMAIN_KEY,
|
29 |
+
UBConfig::default_page_server_domain()
|
30 |
+
);
|
31 |
+
add_option(
|
32 |
+
UBConfig::UB_REMOTE_LOG_URL_KEY,
|
33 |
+
UBConfig::default_remote_log_url()
|
34 |
+
);
|
35 |
+
add_option(
|
36 |
+
UBConfig::UB_API_URL_KEY,
|
37 |
+
UBConfig::default_api_url()
|
38 |
+
);
|
39 |
+
add_option(
|
40 |
+
UBConfig::UB_API_CLIENT_ID_KEY,
|
41 |
+
UBConfig::default_api_client_id()
|
42 |
+
);
|
43 |
+
add_option(
|
44 |
+
UBConfig::UB_AUTHORIZED_DOMAINS_KEY,
|
45 |
+
UBConfig::default_authorized_domains()
|
46 |
+
);
|
47 |
+
add_option(UBConfig::UB_HAS_AUTHORIZED_KEY, '');
|
48 |
+
add_option(
|
49 |
+
UBConfig::UB_REMOTE_EVENTS_URL_KEY,
|
50 |
+
UBConfig::default_remote_events_url()
|
51 |
+
);
|
52 |
+
add_option(UBConfig::UB_USER_ID_KEY, '');
|
53 |
+
add_option(UBConfig::UB_DOMAIN_ID_KEY, '');
|
54 |
+
add_option(UBConfig::UB_CLIENT_ID_KEY, '');
|
55 |
+
add_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, '');
|
56 |
+
add_option(UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR, 0);
|
57 |
+
add_option(UBConfig::UB_PLUGIN_VERSION_KEY, UBConfig::UB_VERSION);
|
58 |
|
59 |
// NOTE: This should be brought back when working on BEE-1136
|
60 |
// @UBDiagnostics::sendActivationEvent();
|
61 |
});
|
62 |
|
63 |
register_deactivation_hook(__FILE__, function () {
|
64 |
+
foreach (UBConfig::ub_option_keys() as $key) {
|
65 |
delete_option($key);
|
66 |
}
|
67 |
});
|
148 |
|
149 |
UBLogger::debug("perform ''" . $url_purpose . "'' on received URL " . $current_url);
|
150 |
|
151 |
+
$cookies_to_forward = UBUtil::array_select_by_key(
|
152 |
+
$_COOKIE,
|
153 |
+
array('ubvs', 'ubpv', 'ubvt', 'hubspotutk')
|
154 |
+
);
|
155 |
+
|
156 |
+
$cookie_string = UBHTTP::cookie_string_from_array($cookies_to_forward);
|
157 |
+
|
158 |
$all_headers = getallheaders();
|
159 |
$all_headers['Host'] = $domain;
|
160 |
|
164 |
list($success, $message) = UBHTTP::stream_request(
|
165 |
$http_method,
|
166 |
$raw_url,
|
167 |
+
$cookie_string,
|
168 |
$all_headers,
|
169 |
$user_agent
|
170 |
);
|
189 |
$pluginVersion = get_option(UBConfig::UB_PLUGIN_VERSION_KEY);
|
190 |
if (UBConfig::UB_VERSION != $pluginVersion) {
|
191 |
@UBDiagnostics::sendActivationEvent($pluginVersion);
|
|
|
192 |
update_option(UBConfig::UB_PLUGIN_VERSION_KEY, UBConfig::UB_VERSION);
|
193 |
}
|
194 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: unbouncewordpress
|
|
3 |
Tags: Unbounce, AB testing, A/B testing, split testing, CRO, conversion optimization, wordpress landing page, wp landing pages, splash pages, landing pages, squeeze pages, lead gen, lead generation, email list, responsive landing pages, templates, inbound marketing, ppc, analytics
|
4 |
Requires at least: 4.1.5
|
5 |
Tested up to: 5.0
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -99,12 +99,8 @@ You should add a rule to your cache to avoid caching Unbounce Pages which have t
|
|
99 |
4. Edit and update all your landing pages from Unbounce’s page builder. They’ll automatically get updated on your WordPress site.
|
100 |
|
101 |
== Changelog ==
|
102 |
-
|
103 |
-
|
104 |
-
* Fixes an issue preventing new options from being created when upgrading the plugin
|
105 |
-
|
106 |
-
= 1.0.38 =
|
107 |
-
* Adds an option (ub-use-curl) to opt-out of using cURL as a proxying client, the alternative being wp_remore_request
|
108 |
|
109 |
= 1.0.37 =
|
110 |
* Better documentation and troubleshooting
|
3 |
Tags: Unbounce, AB testing, A/B testing, split testing, CRO, conversion optimization, wordpress landing page, wp landing pages, splash pages, landing pages, squeeze pages, lead gen, lead generation, email list, responsive landing pages, templates, inbound marketing, ppc, analytics
|
4 |
Requires at least: 4.1.5
|
5 |
Tested up to: 5.0
|
6 |
+
Stable tag: 1.0.40
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
99 |
4. Edit and update all your landing pages from Unbounce’s page builder. They’ll automatically get updated on your WordPress site.
|
100 |
|
101 |
== Changelog ==
|
102 |
+
= 1.0.40 =
|
103 |
+
* Effective reversal to 1.0.37 to address blocking issue to some customers
|
|
|
|
|
|
|
|
|
104 |
|
105 |
= 1.0.37 =
|
106 |
* Better documentation and troubleshooting
|
templates/diagnostics.php
CHANGED
@@ -98,7 +98,7 @@ $diagnostic_descriptions = array(
|
|
98 |
|
99 |
<p>Check that you don’t have any caching plugins installed, or any plugins that affect the order in which Javascript is loaded. These types of plugins will affect how Unbounce pages behave on WordPress.</p>
|
100 |
<ul class="causes">
|
101 |
-
<li>wp-rocket - This plugin re-orders script tags
|
102 |
<li>wp-super-cache - caching plugins often cause Unbounce pages to 404</li>
|
103 |
<li>wp-total-cache - caching plugins often cause Unbounce pages to 404</li>
|
104 |
<li>Cloudflare - caching plugins often cause Unbounce pages to 404</li>
|
98 |
|
99 |
<p>Check that you don’t have any caching plugins installed, or any plugins that affect the order in which Javascript is loaded. These types of plugins will affect how Unbounce pages behave on WordPress.</p>
|
100 |
<ul class="causes">
|
101 |
+
<li>wp-rocket - This plugin re-orders script tags in the <head> which break how Javascript Loads.</li>
|
102 |
<li>wp-super-cache - caching plugins often cause Unbounce pages to 404</li>
|
103 |
<li>wp-total-cache - caching plugins often cause Unbounce pages to 404</li>
|
104 |
<li>Cloudflare - caching plugins often cause Unbounce pages to 404</li>
|
templates/main_authorized_footer.php
CHANGED
@@ -21,4 +21,4 @@ $refresh_button = get_submit_button('refreshing the Published Pages list', 'seco
|
|
21 |
<a class="ub-diagnostics-link" href="<?php echo $diagnostics_url ?>">
|
22 |
Click here for troubleshooting and plugin diagnostics
|
23 |
</a>
|
24 |
-
<p class="ub-version">Unbounce Version 1.0.
|
21 |
<a class="ub-diagnostics-link" href="<?php echo $diagnostics_url ?>">
|
22 |
Click here for troubleshooting and plugin diagnostics
|
23 |
</a>
|
24 |
+
<p class="ub-version">Unbounce Version 1.0.40</p>
|
templates/main_unauthorized_footer.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
<a class="ub-diagnostics-link" href="<?php echo admin_url('admin.php?page=unbounce-pages-diagnostics'); ?>">
|
5 |
Click here for troubleshooting and plugin diagnostics
|
6 |
</a>
|
7 |
-
<p class="ub-version">Unbounce Version 1.0.
|
4 |
<a class="ub-diagnostics-link" href="<?php echo admin_url('admin.php?page=unbounce-pages-diagnostics'); ?>">
|
5 |
Click here for troubleshooting and plugin diagnostics
|
6 |
</a>
|
7 |
+
<p class="ub-version">Unbounce Version 1.0.40</p>
|