Version Description
- Documentation changes
Download this release
Release Info
Developer | unbouncewordpress |
Plugin | Unbounce Landing Pages |
Version | 0.1.10 |
Comparing to | |
See all releases |
Code changes from version 0.1.9 to 0.1.10
- UBConfig.php +44 -11
- UBHTTP.php +4 -1
- Unbounce-Page.php +3 -3
- assets/banner-1544x500.png +0 -0
- assets/banner-772x250.png +0 -0
- assets/icon-128-128.png +0 -0
- assets/icon-256x256.png +0 -0
- readme.txt +2 -2
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');
|
@@ -32,11 +32,11 @@ class UBConfig {
|
|
32 |
|
33 |
public static function fetch_proxyable_url_set($domain, $etag) {
|
34 |
if(!$domain) {
|
35 |
-
UBLogger::warning('Domain not provided, not fetching
|
36 |
return array('FAILURE', null, null, null);
|
37 |
}
|
38 |
|
39 |
-
$url = 'https://' . UBConfig::get_page_server_domain() . '/
|
40 |
$curl = curl_init();
|
41 |
$curl_options = array(
|
42 |
CURLOPT_URL => $url,
|
@@ -79,16 +79,15 @@ class UBConfig {
|
|
79 |
}
|
80 |
|
81 |
if ($http_code == 200) {
|
82 |
-
$
|
83 |
|
84 |
-
if (
|
85 |
-
|
86 |
-
|
87 |
-
return array('FAILURE', null, null, null);
|
88 |
}
|
89 |
else {
|
90 |
-
UBLogger::
|
91 |
-
return array('
|
92 |
}
|
93 |
}
|
94 |
if ($http_code == 304) {
|
@@ -105,6 +104,40 @@ class UBConfig {
|
|
105 |
}
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
public static function _read_unbounce_domain_info($cache_getter,
|
109 |
$cache_setter,
|
110 |
$fetch_proxyable_url_set,
|
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';
|
10 |
+
const UB_VERSION = '0.1.10';
|
11 |
|
12 |
public static function get_page_server_domain() {
|
13 |
$domain = getenv('UB_PAGE_SERVER_DOMAIN');
|
32 |
|
33 |
public static function fetch_proxyable_url_set($domain, $etag) {
|
34 |
if(!$domain) {
|
35 |
+
UBLogger::warning('Domain not provided, not fetching sitemap.xml');
|
36 |
return array('FAILURE', null, null, null);
|
37 |
}
|
38 |
|
39 |
+
$url = 'https://' . UBConfig::get_page_server_domain() . '/sitemap.xml';
|
40 |
$curl = curl_init();
|
41 |
$curl_options = array(
|
42 |
CURLOPT_URL => $url,
|
79 |
}
|
80 |
|
81 |
if ($http_code == 200) {
|
82 |
+
list($success, $result) = UBConfig::url_list_from_sitemap($body);
|
83 |
|
84 |
+
if ($success) {
|
85 |
+
UBLogger::debug("Retrieved new routes, HTTP code: '$http_code'");
|
86 |
+
return array('NEW', $etag, $max_age, $result);
|
|
|
87 |
}
|
88 |
else {
|
89 |
+
UBLogger::warning("An error occurred while processing routes, XML errors: '$result'");
|
90 |
+
return array('FAILURE', null, null, null);
|
91 |
}
|
92 |
}
|
93 |
if ($http_code == 304) {
|
104 |
}
|
105 |
}
|
106 |
|
107 |
+
public static function url_list_from_sitemap($string) {
|
108 |
+
if (is_null($string)) {
|
109 |
+
return array(false, array('input is null'));
|
110 |
+
}
|
111 |
+
|
112 |
+
$use_internal_errors = libxml_use_internal_errors(true);
|
113 |
+
$sitemap = simplexml_load_string($string);
|
114 |
+
|
115 |
+
if($sitemap) {
|
116 |
+
libxml_use_internal_errors($use_internal_errors);
|
117 |
+
$urls = array();
|
118 |
+
|
119 |
+
// Valid XML that is not a valid sitemap.xml will be considered an empty sitemap.xml.
|
120 |
+
// We have no easy way to tell the difference between the two.
|
121 |
+
if (isset($sitemap->url)) {
|
122 |
+
foreach ($sitemap->url as $sitemap_url) {
|
123 |
+
if (isset($sitemap_url->loc)) {
|
124 |
+
$url = (string) $sitemap_url->loc;
|
125 |
+
// URLs come in with protocol and trailing slash, we need just host and path with no
|
126 |
+
// trailing slash internally.
|
127 |
+
$urls[] = parse_url($url, PHP_URL_HOST) . rtrim(parse_url($url, PHP_URL_PATH), '/');
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
return array(true, $urls);
|
133 |
+
}
|
134 |
+
else {
|
135 |
+
$errors = libxml_get_errors();
|
136 |
+
libxml_use_internal_errors($use_internal_errors);
|
137 |
+
return array(false, $errors);
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
public static function _read_unbounce_domain_info($cache_getter,
|
142 |
$cache_setter,
|
143 |
$fetch_proxyable_url_set,
|
UBHTTP.php
CHANGED
@@ -202,8 +202,11 @@ class UBHTTP {
|
|
202 |
|
203 |
public static function get_url_purpose($proxyable_url_set, $http_method, $url) {
|
204 |
$host = parse_url($url, PHP_URL_HOST);
|
205 |
-
$path = parse_url($url, PHP_URL_PATH);
|
206 |
$url_without_protocol = $host . $path;
|
|
|
|
|
|
|
207 |
|
208 |
if ($http_method == "POST" &&
|
209 |
preg_match("/^\/(fsn|fsg|fs)\/?$/", $path)) {
|
202 |
|
203 |
public static function get_url_purpose($proxyable_url_set, $http_method, $url) {
|
204 |
$host = parse_url($url, PHP_URL_HOST);
|
205 |
+
$path = rtrim(parse_url($url, PHP_URL_PATH), '/');
|
206 |
$url_without_protocol = $host . $path;
|
207 |
+
UBLogger::debug_var('get_url_purpose $host', $host);
|
208 |
+
UBLogger::debug_var('get_url_purpose $path', $path);
|
209 |
+
UBLogger::debug_var('get_url_purpose $url_without_protocol', $url_without_protocol);
|
210 |
|
211 |
if ($http_method == "POST" &&
|
212 |
preg_match("/^\/(fsn|fsg|fs)\/?$/", $path)) {
|
Unbounce-Page.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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
|
@@ -39,7 +39,7 @@ add_action('init', function() {
|
|
39 |
$current_path = UBUtil::array_fetch($_SERVER, 'REQUEST_URI');
|
40 |
|
41 |
$raw_url = $protocol . $ps_domain . $current_path;
|
42 |
-
$current_url =
|
43 |
|
44 |
$domain_info = UBConfig::read_unbounce_domain_info($domain, false);
|
45 |
$proxyable_url_set = UBUtil::array_fetch($domain_info, 'proxyable_url_set', array());
|
@@ -57,7 +57,7 @@ add_action('init', function() {
|
|
57 |
////////////////////
|
58 |
|
59 |
if ($proxyable_url_set == null) {
|
60 |
-
UBLogger::warning("
|
61 |
}
|
62 |
else {
|
63 |
$url_purpose = UBHTTP::get_url_purpose($proxyable_url_set,
|
3 |
Plugin Name: Unbounce
|
4 |
Plugin URI: http://unbounce.com
|
5 |
Description: Publish Unbounce Landing Pages to your Wordpress Domain.
|
6 |
+
Version: 0.1.10
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
39 |
$current_path = UBUtil::array_fetch($_SERVER, 'REQUEST_URI');
|
40 |
|
41 |
$raw_url = $protocol . $ps_domain . $current_path;
|
42 |
+
$current_url = $protocol . $domain . $current_path;
|
43 |
|
44 |
$domain_info = UBConfig::read_unbounce_domain_info($domain, false);
|
45 |
$proxyable_url_set = UBUtil::array_fetch($domain_info, 'proxyable_url_set', array());
|
57 |
////////////////////
|
58 |
|
59 |
if ($proxyable_url_set == null) {
|
60 |
+
UBLogger::warning("sitemap.xml not found for domain " . $domain);
|
61 |
}
|
62 |
else {
|
63 |
$url_purpose = UBHTTP::get_url_purpose($proxyable_url_set,
|
assets/banner-1544x500.png
ADDED
Binary file
|
assets/banner-772x250.png
ADDED
Binary file
|
assets/icon-128-128.png
ADDED
Binary file
|
assets/icon-256x256.png
ADDED
Binary file
|
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.10
|
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.10 =
|
68 |
* Documentation changes
|
69 |
|
70 |
= 0.1.1 =
|