Version Description
Download this release
Release Info
Developer | unbouncewordpress |
Plugin | Unbounce Landing Pages |
Version | 1.0.10 |
Comparing to | |
See all releases |
Code changes from version 1.0.9 to 1.0.10
- UBConfig.php +56 -34
- UBDiagnostics.php +1 -1
- UBUtil.php +29 -1
- Unbounce-Page.php +1 -1
- readme.txt +1 -1
- templates/main_authorized_footer.php +1 -1
- templates/main_unauthorized_footer.php +1 -1
UBConfig.php
CHANGED
@@ -4,8 +4,8 @@ class UBConfig {
|
|
4 |
|
5 |
const UB_PLUGIN_NAME = 'ub-wordpress';
|
6 |
const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
|
7 |
-
const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.
|
8 |
-
const UB_VERSION = '1.0.
|
9 |
|
10 |
# Option keys
|
11 |
const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
|
@@ -21,6 +21,8 @@ class UBConfig {
|
|
21 |
const UB_DOMAIN_ID_KEY = 'ub-domain-id';
|
22 |
const UB_CLIENT_ID_KEY = 'ub-client-id';
|
23 |
|
|
|
|
|
24 |
public static function ub_option_keys() {
|
25 |
# All options, used by UBDiagnostics
|
26 |
# Arrays are not allowed in class constants, so use a function
|
@@ -169,9 +171,11 @@ class UBConfig {
|
|
169 |
|
170 |
curl_setopt_array($curl, $curl_options);
|
171 |
$data = curl_exec($curl);
|
172 |
-
|
173 |
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
|
|
174 |
$curl_error = null;
|
|
|
|
|
175 |
|
176 |
// when having an CURL error, http_code is 0
|
177 |
if ($http_code == 0) {
|
@@ -180,7 +184,7 @@ class UBConfig {
|
|
180 |
|
181 |
curl_close($curl);
|
182 |
|
183 |
-
|
184 |
|
185 |
$matches = array();
|
186 |
$does_match = preg_match('/ETag: (\S+)/is', $headers, $matches);
|
@@ -195,6 +199,7 @@ class UBConfig {
|
|
195 |
}
|
196 |
|
197 |
if ($http_code == 200) {
|
|
|
198 |
list($success, $result) = UBConfig::url_list_from_sitemap($body);
|
199 |
|
200 |
if ($success) {
|
@@ -295,41 +300,58 @@ class UBConfig {
|
|
295 |
is_null($proxyable_url_set) ||
|
296 |
($current_time - $proxyable_url_set_fetched_at > $cache_max_time)) {
|
297 |
|
298 |
-
|
299 |
-
$domain,
|
300 |
-
$proxyable_url_set_etag,
|
301 |
-
$ps_domain);
|
302 |
|
303 |
-
|
|
|
304 |
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
-
|
322 |
-
UBLogger::warning(
|
323 |
}
|
324 |
|
325 |
-
|
326 |
-
|
327 |
-
$domain_info['last_status'] = $routes_status['status'];
|
328 |
-
if ($routes_status['status'] == 'FAILURE') {
|
329 |
-
$domain_info['failure_message'] = $routes_status['failure_message'];
|
330 |
-
}
|
331 |
-
$domains_info[$domain] = $domain_info;
|
332 |
-
$options_setter(UBConfig::UB_ROUTES_CACHE_KEY, $domains_info);
|
333 |
}
|
334 |
|
335 |
return UBUtil::array_select_by_key($domain_info,
|
4 |
|
5 |
const UB_PLUGIN_NAME = 'ub-wordpress';
|
6 |
const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
|
7 |
+
const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.10';
|
8 |
+
const UB_VERSION = '1.0.10';
|
9 |
|
10 |
# Option keys
|
11 |
const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
|
21 |
const UB_DOMAIN_ID_KEY = 'ub-domain-id';
|
22 |
const UB_CLIENT_ID_KEY = 'ub-client-id';
|
23 |
|
24 |
+
const UB_LOCK_NAME = 'ub-sql-lock';
|
25 |
+
|
26 |
public static function ub_option_keys() {
|
27 |
# All options, used by UBDiagnostics
|
28 |
# Arrays are not allowed in class constants, so use a function
|
171 |
|
172 |
curl_setopt_array($curl, $curl_options);
|
173 |
$data = curl_exec($curl);
|
|
|
174 |
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
175 |
+
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
176 |
$curl_error = null;
|
177 |
+
$etag = null;
|
178 |
+
$max_age = null;
|
179 |
|
180 |
// when having an CURL error, http_code is 0
|
181 |
if ($http_code == 0) {
|
184 |
|
185 |
curl_close($curl);
|
186 |
|
187 |
+
$headers = substr($data, 0, $header_size);
|
188 |
|
189 |
$matches = array();
|
190 |
$does_match = preg_match('/ETag: (\S+)/is', $headers, $matches);
|
199 |
}
|
200 |
|
201 |
if ($http_code == 200) {
|
202 |
+
$body = substr($data, $header_size);
|
203 |
list($success, $result) = UBConfig::url_list_from_sitemap($body);
|
204 |
|
205 |
if ($success) {
|
300 |
is_null($proxyable_url_set) ||
|
301 |
($current_time - $proxyable_url_set_fetched_at > $cache_max_time)) {
|
302 |
|
303 |
+
try {
|
|
|
|
|
|
|
304 |
|
305 |
+
$can_fetch = UBUtil::get_lock();
|
306 |
+
UBLogger::debug('Locking: ' . $can_fetch);
|
307 |
|
308 |
+
if ($can_fetch) {
|
309 |
+
|
310 |
+
$result_array = call_user_func($fetch_proxyable_url_set,
|
311 |
+
$domain,
|
312 |
+
$proxyable_url_set_etag,
|
313 |
+
$ps_domain);
|
314 |
+
|
315 |
+
list($routes_status, $etag, $max_age, $proxyable_url_set_new) = $result_array;
|
316 |
+
|
317 |
+
if ($routes_status['status'] == 'NEW') {
|
318 |
+
$domain_info['proxyable_url_set'] = $proxyable_url_set_new;
|
319 |
+
$domain_info['proxyable_url_set_etag'] = $etag;
|
320 |
+
$domain_info['proxyable_url_set_cache_timeout'] = $max_age;
|
321 |
+
}
|
322 |
+
elseif ($routes_status['status'] == 'SAME') {
|
323 |
+
// Just extend the cache
|
324 |
+
$domain_info['proxyable_url_set_cache_timeout'] = $max_age;
|
325 |
+
}
|
326 |
+
elseif ($routes_status['status'] == 'NONE') {
|
327 |
+
$domain_info['proxyable_url_set'] = array();
|
328 |
+
$domain_info['proxyable_url_set_etag'] = null;
|
329 |
+
}
|
330 |
+
elseif ($routes_status['status'] == 'FAILURE') {
|
331 |
+
UBLogger::warning('Route fetching failed');
|
332 |
+
}
|
333 |
+
else {
|
334 |
+
UBLogger::warning("Unknown response from route fetcher: '$routes_status'");
|
335 |
+
}
|
336 |
+
|
337 |
+
// Creation of domain_info entry
|
338 |
+
$domain_info['proxyable_url_set_fetched_at'] = $current_time;
|
339 |
+
$domain_info['last_status'] = $routes_status['status'];
|
340 |
+
if ($routes_status['status'] == 'FAILURE') {
|
341 |
+
$domain_info['failure_message'] = $routes_status['failure_message'];
|
342 |
+
}
|
343 |
+
$domains_info[$domain] = $domain_info;
|
344 |
+
// set autoload to false so that options are always loaded from DB
|
345 |
+
$options_setter(UBConfig::UB_ROUTES_CACHE_KEY, $domains_info, false);
|
346 |
+
|
347 |
+
}
|
348 |
}
|
349 |
+
catch (Exception $e) {
|
350 |
+
UBLogger::warning('Could not update sitemap: ' . $e);
|
351 |
}
|
352 |
|
353 |
+
$release_result = UBUtil::release_lock();
|
354 |
+
UBLogger::debug('Unlocking: ' . $release_result);
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
|
357 |
return UBUtil::array_select_by_key($domain_info,
|
UBDiagnostics.php
CHANGED
@@ -28,7 +28,7 @@ class UBDiagnostics {
|
|
28 |
return array(
|
29 |
'PHP Version' => phpversion(),
|
30 |
'WordPress Version' => UBDiagnostics::wordpress_version(),
|
31 |
-
'Unbounce Plugin Version' => "1.0.
|
32 |
'Permalink Structure' => get_option('permalink_structure', ''),
|
33 |
'Domain' => $domain,
|
34 |
'Domain Authorized' => print_r(UBConfig::is_authorized_domain($domain), true),
|
28 |
return array(
|
29 |
'PHP Version' => phpversion(),
|
30 |
'WordPress Version' => UBDiagnostics::wordpress_version(),
|
31 |
+
'Unbounce Plugin Version' => "1.0.10",
|
32 |
'Permalink Structure' => get_option('permalink_structure', ''),
|
33 |
'Domain' => $domain,
|
34 |
'Domain Authorized' => print_r(UBConfig::is_authorized_domain($domain), true),
|
UBUtil.php
CHANGED
@@ -57,5 +57,33 @@ class UBUtil {
|
|
57 |
setcookie("ub-flash-${cookie_name}", $value, time() + 60);
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
-
?>
|
57 |
setcookie("ub-flash-${cookie_name}", $value, time() + 60);
|
58 |
}
|
59 |
|
60 |
+
public static function get_lock() {
|
61 |
+
global $wpdb;
|
62 |
+
|
63 |
+
try {
|
64 |
+
$lock = $wpdb->get_var('select coalesce(get_lock("' . UBConfig::UB_LOCK_NAME . '",0), 0);');
|
65 |
+
|
66 |
+
return (bool) $lock;
|
67 |
+
}
|
68 |
+
catch (Exception $e) {
|
69 |
+
// ensure backward compatibility on failure
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
public static function release_lock() {
|
75 |
+
global $wpdb;
|
76 |
+
|
77 |
+
try {
|
78 |
+
$release = $wpdb->get_var('select coalesce(release_lock("' . UBConfig::UB_LOCK_NAME . '"), 0);');
|
79 |
+
|
80 |
+
return (bool) $release;
|
81 |
+
}
|
82 |
+
catch (Exception $e) {
|
83 |
+
// ensure backward compatibility on failure
|
84 |
+
return true;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
}
|
89 |
+
?>
|
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: 1.0.
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
3 |
Plugin Name: Unbounce
|
4 |
Plugin URI: http://unbounce.com
|
5 |
Description: Publish Unbounce Landing Pages to your Wordpress Domain.
|
6 |
+
Version: 1.0.10
|
7 |
Author: Unbounce
|
8 |
Author URI: http://unbounce.com
|
9 |
License: GPLv2
|
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: 4.3
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
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: 4.3
|
6 |
+
Stable tag: 1.0.10
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
templates/main_authorized_footer.php
CHANGED
@@ -17,4 +17,4 @@ $refresh_button = get_submit_button('refreshing the Published Pages list', 'seco
|
|
17 |
Check out our knowledge base.
|
18 |
</a>
|
19 |
<br/><a class="ub-diagnostics-link" href="<?php echo $diagnostics_url ?>">Click here for troubleshooting and plugin diagnostics</a>
|
20 |
-
<p class="ub-version">Unbounce Version 1.0.
|
17 |
Check out our knowledge base.
|
18 |
</a>
|
19 |
<br/><a class="ub-diagnostics-link" href="<?php echo $diagnostics_url ?>">Click here for troubleshooting and plugin diagnostics</a>
|
20 |
+
<p class="ub-version">Unbounce Version 1.0.10</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.10</p>
|