Version Description
- Documentation changes
Download this release
Release Info
Developer | unbouncewordpress |
Plugin | Unbounce Landing Pages |
Version | 0.1.18 |
Comparing to | |
See all releases |
Code changes from version 0.1.16 to 0.1.18
- UBCompatibility.php +69 -0
- UBConfig.php +4 -3
- UBHTTP.php +7 -10
- UBLogger.php +2 -1
- Unbounce-Page.php +4 -3
- readme.txt +2 -2
UBCompatibility.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// For 4.3.0 <= PHP <= 5.4.0
|
4 |
+
if (!function_exists('http_response_code')) {
|
5 |
+
function http_response_code($code = NULL) {
|
6 |
+
|
7 |
+
if ($code !== NULL) {
|
8 |
+
|
9 |
+
switch ($code) {
|
10 |
+
case 100: $text = 'Continue'; break;
|
11 |
+
case 101: $text = 'Switching Protocols'; break;
|
12 |
+
case 200: $text = 'OK'; break;
|
13 |
+
case 201: $text = 'Created'; break;
|
14 |
+
case 202: $text = 'Accepted'; break;
|
15 |
+
case 203: $text = 'Non-Authoritative Information'; break;
|
16 |
+
case 204: $text = 'No Content'; break;
|
17 |
+
case 205: $text = 'Reset Content'; break;
|
18 |
+
case 206: $text = 'Partial Content'; break;
|
19 |
+
case 300: $text = 'Multiple Choices'; break;
|
20 |
+
case 301: $text = 'Moved Permanently'; break;
|
21 |
+
case 302: $text = 'Moved Temporarily'; break;
|
22 |
+
case 303: $text = 'See Other'; break;
|
23 |
+
case 304: $text = 'Not Modified'; break;
|
24 |
+
case 305: $text = 'Use Proxy'; break;
|
25 |
+
case 400: $text = 'Bad Request'; break;
|
26 |
+
case 401: $text = 'Unauthorized'; break;
|
27 |
+
case 402: $text = 'Payment Required'; break;
|
28 |
+
case 403: $text = 'Forbidden'; break;
|
29 |
+
case 404: $text = 'Not Found'; break;
|
30 |
+
case 405: $text = 'Method Not Allowed'; break;
|
31 |
+
case 406: $text = 'Not Acceptable'; break;
|
32 |
+
case 407: $text = 'Proxy Authentication Required'; break;
|
33 |
+
case 408: $text = 'Request Time-out'; break;
|
34 |
+
case 409: $text = 'Conflict'; break;
|
35 |
+
case 410: $text = 'Gone'; break;
|
36 |
+
case 411: $text = 'Length Required'; break;
|
37 |
+
case 412: $text = 'Precondition Failed'; break;
|
38 |
+
case 413: $text = 'Request Entity Too Large'; break;
|
39 |
+
case 414: $text = 'Request-URI Too Large'; break;
|
40 |
+
case 415: $text = 'Unsupported Media Type'; break;
|
41 |
+
case 500: $text = 'Internal Server Error'; break;
|
42 |
+
case 501: $text = 'Not Implemented'; break;
|
43 |
+
case 502: $text = 'Bad Gateway'; break;
|
44 |
+
case 503: $text = 'Service Unavailable'; break;
|
45 |
+
case 504: $text = 'Gateway Time-out'; break;
|
46 |
+
case 505: $text = 'HTTP Version not supported'; break;
|
47 |
+
default:
|
48 |
+
exit('Unknown http status code "' . htmlentities($code) . '"');
|
49 |
+
break;
|
50 |
+
}
|
51 |
+
|
52 |
+
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1');
|
53 |
+
|
54 |
+
header($protocol . ' ' . $code . ' ' . $text);
|
55 |
+
|
56 |
+
$GLOBALS['http_response_code'] = $code;
|
57 |
+
|
58 |
+
} else {
|
59 |
+
|
60 |
+
$code = (isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200);
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
return $code;
|
65 |
+
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
?>
|
UBConfig.php
CHANGED
@@ -6,8 +6,8 @@ class UBConfig {
|
|
6 |
const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
|
7 |
const UB_REMOTE_DEBUG_KEY = 'ub-remote-debug';
|
8 |
const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
|
9 |
-
const UB_USER_AGENT = 'Unbounce WP Plugin 0.1.
|
10 |
-
const UB_VERSION = '0.1.
|
11 |
|
12 |
public static function get_page_server_domain() {
|
13 |
$domain = getenv('UB_PAGE_SERVER_DOMAIN');
|
@@ -86,7 +86,8 @@ class UBConfig {
|
|
86 |
return array('NEW', $etag, $max_age, $result);
|
87 |
}
|
88 |
else {
|
89 |
-
|
|
|
90 |
return array('FAILURE', null, null, null);
|
91 |
}
|
92 |
}
|
6 |
const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
|
7 |
const UB_REMOTE_DEBUG_KEY = 'ub-remote-debug';
|
8 |
const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
|
9 |
+
const UB_USER_AGENT = 'Unbounce WP Plugin 0.1.18';
|
10 |
+
const UB_VERSION = '0.1.18';
|
11 |
|
12 |
public static function get_page_server_domain() {
|
13 |
$domain = getenv('UB_PAGE_SERVER_DOMAIN');
|
86 |
return array('NEW', $etag, $max_age, $result);
|
87 |
}
|
88 |
else {
|
89 |
+
$errors = join(', ', $result);
|
90 |
+
UBLogger::warning("An error occurred while processing routes, XML errors: '$errors'");
|
91 |
return array('FAILURE', null, null, null);
|
92 |
}
|
93 |
}
|
UBHTTP.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
class UBHTTP {
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
|
9 |
public static function is_private_ip_address($ip_address) {
|
10 |
return !filter_var($ip_address,
|
@@ -45,10 +44,8 @@ class UBHTTP {
|
|
45 |
}
|
46 |
|
47 |
public static function get_proxied_for_header($out_headers,
|
48 |
-
$
|
49 |
$current_ip) {
|
50 |
-
$forwarded_for = UBUtil::array_fetch($request_headers, 'X-Forwarded-For');
|
51 |
-
|
52 |
if($forwarded_for !== null && UBHTTP::is_private_ip_address($current_ip)) {
|
53 |
$proxied_for = $forwarded_for;
|
54 |
} else {
|
@@ -133,11 +130,11 @@ class UBHTTP {
|
|
133 |
$user_agent) {
|
134 |
|
135 |
$existing_headers = headers_list();
|
136 |
-
$
|
137 |
-
$remote_ip = $_SERVER
|
138 |
|
139 |
$headers = UBHTTP::get_proxied_for_header($headers0,
|
140 |
-
$
|
141 |
$remote_ip);
|
142 |
|
143 |
UBLogger::debug_var('target_url', $target_url);
|
1 |
<?php
|
2 |
|
3 |
class UBHTTP {
|
4 |
+
public static $powered_by_header_regex = '/^X-Powered-By: (.+)$/i';
|
5 |
+
public static $form_confirmation_url_regex = '/(.+)\/[a-z]+-form_confirmation\.html/';
|
6 |
+
public static $forward_headers = '/^(Content-Type:|Location:|ETag:|Last-Modified:|Link:|Content-Location:|Set-Cookie:|X-Server-Instance:|X-Unbounce-PageId:|X-Unbounce-Variant:|X-Unbounce-VisitorID:)/i';
|
|
|
7 |
|
8 |
public static function is_private_ip_address($ip_address) {
|
9 |
return !filter_var($ip_address,
|
44 |
}
|
45 |
|
46 |
public static function get_proxied_for_header($out_headers,
|
47 |
+
$forwarded_for,
|
48 |
$current_ip) {
|
|
|
|
|
49 |
if($forwarded_for !== null && UBHTTP::is_private_ip_address($current_ip)) {
|
50 |
$proxied_for = $forwarded_for;
|
51 |
} else {
|
130 |
$user_agent) {
|
131 |
|
132 |
$existing_headers = headers_list();
|
133 |
+
$forwarded_for = UBUtil::array_fetch($_SERVER, 'HTTP_X_FORWARDED_FOR');
|
134 |
+
$remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR');
|
135 |
|
136 |
$headers = UBHTTP::get_proxied_for_header($headers0,
|
137 |
+
$forwarded_for,
|
138 |
$remote_ip);
|
139 |
|
140 |
UBLogger::debug_var('target_url', $target_url);
|
UBLogger.php
CHANGED
@@ -24,7 +24,8 @@ class UBLogger {
|
|
24 |
'time_sent' => $datetime->format('Y-m-d\TH:i:s.000\Z'),
|
25 |
'source' => UBConfig::UB_USER_AGENT . ' ' . gethostname()
|
26 |
);
|
27 |
-
$
|
|
|
28 |
|
29 |
$curl = curl_init();
|
30 |
$curl_options = array(
|
24 |
'time_sent' => $datetime->format('Y-m-d\TH:i:s.000\Z'),
|
25 |
'source' => UBConfig::UB_USER_AGENT . ' ' . gethostname()
|
26 |
);
|
27 |
+
$json_unescaped = json_encode($data);
|
28 |
+
$data_string = str_replace('\\/', '/', $json_unescaped);
|
29 |
|
30 |
$curl = curl_init();
|
31 |
$curl_options = array(
|
Unbounce-Page.php
CHANGED
@@ -3,17 +3,18 @@
|
|
3 |
Plugin Name: Unbounce
|
4 |
Plugin URI: http://unbounce.com
|
5 |
Description: Publish Unbounce Landing Pages to your Wordpress Domain.
|
6 |
-
Version: 0.1.
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
10 |
*/
|
11 |
|
|
|
12 |
require_once dirname(__FILE__) . '/UBUtil.php';
|
13 |
require_once dirname(__FILE__) . '/UBConfig.php';
|
14 |
require_once dirname(__FILE__) . '/UBLogger.php';
|
15 |
require_once dirname(__FILE__) . '/UBHTTP.php';
|
16 |
-
require_once dirname(__FILE__). '/UBIcon.php';
|
17 |
|
18 |
register_activation_hook(__FILE__, function() {
|
19 |
add_option(UBConfig::UB_ROUTES_CACHE_KEY, array());
|
@@ -52,7 +53,7 @@ add_action('init', function() {
|
|
52 |
UBLogger::debug_var('domain', $domain);
|
53 |
UBLogger::debug_var('current_path', $current_path);
|
54 |
UBLogger::debug_var('raw_url', $raw_url);
|
55 |
-
UBLogger::debug_var('current_url
|
56 |
|
57 |
////////////////////
|
58 |
|
3 |
Plugin Name: Unbounce
|
4 |
Plugin URI: http://unbounce.com
|
5 |
Description: Publish Unbounce Landing Pages to your Wordpress Domain.
|
6 |
+
Version: 0.1.18
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
10 |
*/
|
11 |
|
12 |
+
require_once dirname(__FILE__) . '/UBCompatibility.php';
|
13 |
require_once dirname(__FILE__) . '/UBUtil.php';
|
14 |
require_once dirname(__FILE__) . '/UBConfig.php';
|
15 |
require_once dirname(__FILE__) . '/UBLogger.php';
|
16 |
require_once dirname(__FILE__) . '/UBHTTP.php';
|
17 |
+
require_once dirname(__FILE__) . '/UBIcon.php';
|
18 |
|
19 |
register_activation_hook(__FILE__, function() {
|
20 |
add_option(UBConfig::UB_ROUTES_CACHE_KEY, array());
|
53 |
UBLogger::debug_var('domain', $domain);
|
54 |
UBLogger::debug_var('current_path', $current_path);
|
55 |
UBLogger::debug_var('raw_url', $raw_url);
|
56 |
+
UBLogger::debug_var('current_url', $current_url );
|
57 |
|
58 |
////////////////////
|
59 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: unbouncewordpress
|
|
3 |
Tags: unbounce
|
4 |
Requires at least: 4.1.5
|
5 |
Tested up to: 4.2.2
|
6 |
-
Stable tag: 0.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -64,7 +64,7 @@ to help track down the issue.
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
-
= 0.1.
|
68 |
* Documentation changes
|
69 |
|
70 |
= 0.1.1 =
|
3 |
Tags: unbounce
|
4 |
Requires at least: 4.1.5
|
5 |
Tested up to: 4.2.2
|
6 |
+
Stable tag: 0.1.18
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
+
= 0.1.18 =
|
68 |
* Documentation changes
|
69 |
|
70 |
= 0.1.1 =
|