Unbounce Landing Pages - Version 1.0.14

Version Description

Download this release

Release Info

Developer unbouncewordpress
Plugin Icon Unbounce Landing Pages
Version 1.0.14
Comparing to
See all releases

Code changes from version 1.0.13 to 1.0.14

UBConfig.php CHANGED
@@ -4,27 +4,28 @@ 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.13';
8
- const UB_VERSION = '1.0.13';
9
 
10
  # Option keys
11
- const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
12
- const UB_REMOTE_DEBUG_KEY = 'ub-remote-debug';
13
- const UB_PAGE_SERVER_DOMAIN_KEY = 'ub-page-server-domain';
14
- const UB_REMOTE_LOG_URL_KEY = 'ub-remote-log-url';
15
- const UB_REMOTE_EVENTS_URL_KEY = 'ub-remote-events-url';
16
- const UB_API_URL_KEY = 'ub-api-url';
17
- const UB_API_CLIENT_ID_KEY = 'ub-api-client-id';
18
- const UB_AUTHORIZED_DOMAINS_KEY = 'ub-authorized-domains';
19
- const UB_HAS_AUTHORIZED_KEY = 'ub-has-authorized';
20
- const UB_USER_ID_KEY = 'ub-user-id';
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
29
  return array(
30
  UBConfig::UB_ROUTES_CACHE_KEY,
@@ -38,7 +39,8 @@ class UBConfig {
38
  UBConfig::UB_HAS_AUTHORIZED_KEY,
39
  UBConfig::UB_USER_ID_KEY,
40
  UBConfig::UB_DOMAIN_ID_KEY,
41
- UBConfig::UB_CLIENT_ID_KEY
 
42
  );
43
  }
44
 
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.14';
8
+ const UB_VERSION = '1.0.14';
9
 
10
  # Option keys
11
+ const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
12
+ const UB_REMOTE_DEBUG_KEY = 'ub-remote-debug';
13
+ const UB_PAGE_SERVER_DOMAIN_KEY = 'ub-page-server-domain';
14
+ const UB_REMOTE_LOG_URL_KEY = 'ub-remote-log-url';
15
+ const UB_REMOTE_EVENTS_URL_KEY = 'ub-remote-events-url';
16
+ const UB_API_URL_KEY = 'ub-api-url';
17
+ const UB_API_CLIENT_ID_KEY = 'ub-api-client-id';
18
+ const UB_AUTHORIZED_DOMAINS_KEY = 'ub-authorized-domains';
19
+ const UB_HAS_AUTHORIZED_KEY = 'ub-has-authorized';
20
+ const UB_USER_ID_KEY = 'ub-user-id';
21
+ const UB_DOMAIN_ID_KEY = 'ub-domain-id';
22
+ const UB_CLIENT_ID_KEY = 'ub-client-id';
23
+ const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message';
24
+
25
+ const UB_LOCK_NAME = 'ub-sql-lock';
26
 
27
  public static function ub_option_keys() {
28
+ # All options, used by UBDiagnostics and deactivation hook
29
  # Arrays are not allowed in class constants, so use a function
30
  return array(
31
  UBConfig::UB_ROUTES_CACHE_KEY,
39
  UBConfig::UB_HAS_AUTHORIZED_KEY,
40
  UBConfig::UB_USER_ID_KEY,
41
  UBConfig::UB_DOMAIN_ID_KEY,
42
+ UBConfig::UB_CLIENT_ID_KEY,
43
+ UBConfig::UB_PROXY_ERROR_MESSAGE_KEY
44
  );
45
  }
46
 
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.13",
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.14",
32
  'Permalink Structure' => get_option('permalink_structure', ''),
33
  'Domain' => $domain,
34
  'Domain Authorized' => print_r(UBConfig::is_authorized_domain($domain), true),
UBHTTP.php CHANGED
@@ -2,7 +2,9 @@
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
  // Suppress Etag and Last-Modified so that browser doesn't send If-None-Match and If-Modified-Since header (to bypass front-end caches)
7
  public static $forward_headers = '/^(Content-Type:|Location:|Link:|Content-Location:|Set-Cookie:|X-Server-Instance:|X-Unbounce-PageId:|X-Unbounce-Variant:|X-Unbounce-VisitorID:)/i';
8
 
@@ -167,8 +169,14 @@ class UBHTTP {
167
  $message = 'Error proxying to "' . $target_url . ", " . '": "' . curl_error($curl) . '" - Code: ' . curl_errno($curl);
168
  UBLogger::warning($message);
169
  http_response_code(500);
 
 
 
170
  }
 
171
  curl_close($curl);
 
 
172
  }
173
 
174
  public static function is_extract_url_proxyable($proxyable_url_set,
@@ -190,6 +198,20 @@ class UBHTTP {
190
  $url_without_protocol);
191
  }
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  public static function is_tracking_link($proxyable_url_set, $url_without_protocol) {
194
  return UBHTTP::is_extract_url_proxyable($proxyable_url_set,
195
  "/^(.+)?\/(clkn|clkg)\/?/",
@@ -204,26 +226,20 @@ class UBHTTP {
204
  UBLogger::debug_var('get_url_purpose $host', $host);
205
  UBLogger::debug_var('get_url_purpose $path', $path);
206
  UBLogger::debug_var('get_url_purpose $url_without_protocol', $url_without_protocol);
207
-
208
- $url_without_protocol_without_variant = preg_replace('/\/[a-zA-Z]+\.html$/', '', $url_without_protocol);
209
- UBLogger::debug_var('get_url_purpose $url_without_protocol_without_variant', $url_without_protocol_without_variant);
210
-
211
  if ($http_method == 'GET' && $path == '/_ubhc') {
212
  return 'HealthCheck';
213
-
214
  } elseif ($http_method == "POST" &&
215
  preg_match("/^\/(fsn|fsg|fs)\/?$/", $path)) {
216
  return "SubmitLead";
217
-
218
  } elseif ($http_method == "GET" &&
219
- UBHTTP::is_tracking_link($proxyable_url_set, $url_without_protocol_without_variant)) {
220
  return "TrackClick";
221
-
222
  } elseif (($http_method == "GET" || $http_method == "POST") &&
223
- (in_array($url_without_protocol_without_variant, $proxyable_url_set) ||
224
- UBHTTP::is_confirmation_dialog($proxyable_url_set, $url_without_protocol_without_variant))) {
 
 
225
  return "ViewLandingPage";
226
-
227
  } else {
228
  return null;
229
  }
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/i';
6
+ public static $lightbox_url_regex = '/(.+)\/[a-z]+-[0-9]+-lightbox\.html/i';
7
+ public static $variant_url_regex = '/(.+)\/[a-z]+\.html/i';
8
  // Suppress Etag and Last-Modified so that browser doesn't send If-None-Match and If-Modified-Since header (to bypass front-end caches)
9
  public static $forward_headers = '/^(Content-Type:|Location:|Link:|Content-Location:|Set-Cookie:|X-Server-Instance:|X-Unbounce-PageId:|X-Unbounce-Variant:|X-Unbounce-VisitorID:)/i';
10
 
169
  $message = 'Error proxying to "' . $target_url . ", " . '": "' . curl_error($curl) . '" - Code: ' . curl_errno($curl);
170
  UBLogger::warning($message);
171
  http_response_code(500);
172
+ $result = array(false, $message);
173
+ } else {
174
+ $result = array(true, null);
175
  }
176
+
177
  curl_close($curl);
178
+
179
+ return $result;
180
  }
181
 
182
  public static function is_extract_url_proxyable($proxyable_url_set,
198
  $url_without_protocol);
199
  }
200
 
201
+ public static function is_lightbox($proxyable_url_set, $url_without_protocol) {
202
+ return UBHTTP::is_extract_url_proxyable($proxyable_url_set,
203
+ UBHTTP::$lightbox_url_regex,
204
+ 1,
205
+ $url_without_protocol);
206
+ }
207
+
208
+ public static function is_variant($proxyable_url_set, $url_without_protocol) {
209
+ return UBHTTP::is_extract_url_proxyable($proxyable_url_set,
210
+ UBHTTP::$variant_url_regex,
211
+ 1,
212
+ $url_without_protocol);
213
+ }
214
+
215
  public static function is_tracking_link($proxyable_url_set, $url_without_protocol) {
216
  return UBHTTP::is_extract_url_proxyable($proxyable_url_set,
217
  "/^(.+)?\/(clkn|clkg)\/?/",
226
  UBLogger::debug_var('get_url_purpose $host', $host);
227
  UBLogger::debug_var('get_url_purpose $path', $path);
228
  UBLogger::debug_var('get_url_purpose $url_without_protocol', $url_without_protocol);
 
 
 
 
229
  if ($http_method == 'GET' && $path == '/_ubhc') {
230
  return 'HealthCheck';
 
231
  } elseif ($http_method == "POST" &&
232
  preg_match("/^\/(fsn|fsg|fs)\/?$/", $path)) {
233
  return "SubmitLead";
 
234
  } elseif ($http_method == "GET" &&
235
+ UBHTTP::is_tracking_link($proxyable_url_set, $url_without_protocol)) {
236
  return "TrackClick";
 
237
  } elseif (($http_method == "GET" || $http_method == "POST") &&
238
+ (in_array($url_without_protocol, $proxyable_url_set) ||
239
+ UBHTTP::is_confirmation_dialog($proxyable_url_set, $url_without_protocol) ||
240
+ UBHTTP::is_lightbox($proxyable_url_set, $url_without_protocol) ||
241
+ UBHTTP::is_variant($proxyable_url_set, $url_without_protocol))) {
242
  return "ViewLandingPage";
 
243
  } else {
244
  return null;
245
  }
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.13
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
@@ -39,21 +39,13 @@ register_activation_hook(__FILE__, function() {
39
  add_option(UBConfig::UB_USER_ID_KEY);
40
  add_option(UBConfig::UB_DOMAIN_ID_KEY);
41
  add_option(UBConfig::UB_CLIENT_ID_KEY);
 
42
  });
43
 
44
  register_deactivation_hook(__FILE__, function() {
45
- delete_option(UBConfig::UB_ROUTES_CACHE_KEY);
46
- delete_option(UBConfig::UB_REMOTE_DEBUG_KEY);
47
- delete_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY);
48
- delete_option(UBConfig::UB_REMOTE_LOG_URL_KEY);
49
- delete_option(UBConfig::UB_API_URL_KEY);
50
- delete_option(UBConfig::UB_API_CLIENT_ID_KEY);
51
- delete_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY);
52
- delete_option(UBConfig::UB_HAS_AUTHORIZED_KEY);
53
- delete_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY);
54
- delete_option(UBConfig::UB_USER_ID_KEY);
55
- delete_option(UBConfig::UB_DOMAIN_ID_KEY);
56
- delete_option(UBConfig::UB_CLIENT_ID_KEY);
57
  });
58
 
59
  add_action('init', function() {
@@ -147,11 +139,15 @@ add_action('init', function() {
147
  // Make sure we don't get cached by Wordpress hosts like WPEngine
148
  header('Cache-Control: max-age=0; private');
149
 
150
- UBHTTP::stream_request($http_method,
151
- $raw_url,
152
- $cookie_string,
153
- $req_headers,
154
- $user_agent);
 
 
 
 
155
 
156
  $end = microtime(true);
157
  $time_taken = ($end - $start) * 1000;
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.14
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
39
  add_option(UBConfig::UB_USER_ID_KEY);
40
  add_option(UBConfig::UB_DOMAIN_ID_KEY);
41
  add_option(UBConfig::UB_CLIENT_ID_KEY);
42
+ add_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY);
43
  });
44
 
45
  register_deactivation_hook(__FILE__, function() {
46
+ foreach(UBConfig::ub_option_keys() as $key) {
47
+ delete_option($key);
48
+ }
 
 
 
 
 
 
 
 
 
49
  });
50
 
51
  add_action('init', function() {
139
  // Make sure we don't get cached by Wordpress hosts like WPEngine
140
  header('Cache-Control: max-age=0; private');
141
 
142
+ list($success, $message) = UBHTTP::stream_request($http_method,
143
+ $raw_url,
144
+ $cookie_string,
145
+ $req_headers,
146
+ $user_agent);
147
+
148
+ if($success === false) {
149
+ update_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, $message);
150
+ }
151
 
152
  $end = microtime(true);
153
  $time_taken = ($end - $start) * 1000;
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.13
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.14
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.13</p>
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.14</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.13</p>
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.14</p>