Unbounce Landing Pages - Version 1.0.45

Version Description

  • Documentation updates to reflect minimum PHP requirements (currently 7.2)
  • Add support for PHP 7.2 and higher
  • Tested with WP 5.4
Download this release

Release Info

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

Code changes from version 1.0.44 to 1.0.45

UBConfig.php CHANGED
@@ -5,15 +5,12 @@ 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.44';
9
- const UB_VERSION = '1.0.44';
10
 
11
  // Option keys
12
  const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
13
- const UB_REMOTE_DEBUG_KEY = 'ub-remote-debug';
14
  const UB_PAGE_SERVER_DOMAIN_KEY = 'ub-page-server-domain';
15
- const UB_REMOTE_LOG_URL_KEY = 'ub-remote-log-url';
16
- const UB_REMOTE_EVENTS_URL_KEY = 'ub-remote-events-url';
17
  const UB_API_URL_KEY = 'ub-api-url';
18
  const UB_API_CLIENT_ID_KEY = 'ub-api-client-id';
19
  const UB_AUTHORIZED_DOMAINS_KEY = 'ub-authorized-domains';
@@ -34,10 +31,7 @@ class UBConfig
34
  // Arrays are not allowed in class constants, so use a function
35
  return array(
36
  UBConfig::UB_ROUTES_CACHE_KEY => array(),
37
- UBConfig::UB_REMOTE_DEBUG_KEY => UBConfig::default_remote_debug_enabled(),
38
  UBConfig::UB_PAGE_SERVER_DOMAIN_KEY => UBConfig::default_page_server_domain(),
39
- UBConfig::UB_REMOTE_LOG_URL_KEY => UBConfig::default_remote_log_url(),
40
- UBConfig::UB_REMOTE_EVENTS_URL_KEY => UBConfig::default_remote_events_url(),
41
  UBConfig::UB_API_URL_KEY => UBConfig::default_api_url(),
42
  UBConfig::UB_API_CLIENT_ID_KEY => UBConfig::default_api_client_id(),
43
  UBConfig::UB_AUTHORIZED_DOMAINS_KEY => UBConfig::default_authorized_domains(),
@@ -68,18 +62,6 @@ class UBConfig
68
  return $domain ? $domain : 'wp.unbounce.com';
69
  }
70
 
71
- public static function default_remote_log_url()
72
- {
73
- $url = getenv('UB_REMOTE_LOG_URL');
74
- return $url ? $url : 'https://events-gateway.unbounce.com/events/wordpress_logs';
75
- }
76
-
77
- public static function default_remote_events_url()
78
- {
79
- $url = getenv('UB_REMOTE_EVENTS_URL');
80
- return $url ? $url : 'https://events-gateway.unbounce.com/events/domains';
81
- }
82
-
83
  public static function default_api_url()
84
  {
85
  $url = getenv('UB_API_URL');
@@ -92,12 +74,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');
@@ -109,16 +85,6 @@ class UBConfig
109
  return get_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY, UBConfig::default_page_server_domain());
110
  }
111
 
112
- public static function remote_log_url()
113
- {
114
- return get_option(UBConfig::UB_REMOTE_LOG_URL_KEY, UBConfig::default_remote_log_url());
115
- }
116
-
117
- public static function remote_events_url()
118
- {
119
- return get_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY, UBConfig::default_remote_events_url());
120
- }
121
-
122
  public static function api_url()
123
  {
124
  return get_option(UBConfig::UB_API_URL_KEY, UBConfig::default_api_url());
@@ -141,12 +107,7 @@ class UBConfig
141
 
142
  public static function debug_loggging_enabled()
143
  {
144
- return (defined('UB_ENABLE_LOCAL_LOGGING') && UB_ENABLE_LOCAL_LOGGING) || self::remote_debug_logging_enabled();
145
- }
146
-
147
- public static function remote_debug_logging_enabled()
148
- {
149
- return get_option(UBConfig::UB_REMOTE_DEBUG_KEY, 0) == 1;
150
  }
151
 
152
  public static function allow_public_address_x_forwarded_for()
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.45';
9
+ const UB_VERSION = '1.0.45';
10
 
11
  // Option keys
12
  const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
 
13
  const UB_PAGE_SERVER_DOMAIN_KEY = 'ub-page-server-domain';
 
 
14
  const UB_API_URL_KEY = 'ub-api-url';
15
  const UB_API_CLIENT_ID_KEY = 'ub-api-client-id';
16
  const UB_AUTHORIZED_DOMAINS_KEY = 'ub-authorized-domains';
31
  // Arrays are not allowed in class constants, so use a function
32
  return array(
33
  UBConfig::UB_ROUTES_CACHE_KEY => array(),
 
34
  UBConfig::UB_PAGE_SERVER_DOMAIN_KEY => UBConfig::default_page_server_domain(),
 
 
35
  UBConfig::UB_API_URL_KEY => UBConfig::default_api_url(),
36
  UBConfig::UB_API_CLIENT_ID_KEY => UBConfig::default_api_client_id(),
37
  UBConfig::UB_AUTHORIZED_DOMAINS_KEY => UBConfig::default_authorized_domains(),
62
  return $domain ? $domain : 'wp.unbounce.com';
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  public static function default_api_url()
66
  {
67
  $url = getenv('UB_API_URL');
74
  return $client_id ? $client_id : '660a311881321b9d4e777993e50875dec5da9cc4ef44369d121544b21da52b92';
75
  }
76
 
 
 
 
 
 
 
77
  public static function default_authorized_domains()
78
  {
79
  $domains = getenv('UB_AUTHORIZED_DOMAINS');
85
  return get_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY, UBConfig::default_page_server_domain());
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
88
  public static function api_url()
89
  {
90
  return get_option(UBConfig::UB_API_URL_KEY, UBConfig::default_api_url());
107
 
108
  public static function debug_loggging_enabled()
109
  {
110
+ return (defined('UB_ENABLE_LOCAL_LOGGING') && UB_ENABLE_LOCAL_LOGGING);
 
 
 
 
 
111
  }
112
 
113
  public static function allow_public_address_x_forwarded_for()
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.44',
104
  'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)),
105
  'Options' => self::pp(UBDiagnostics::ub_options()),
106
  'Permalink Structure' => get_option('permalink_structure', ''),
@@ -178,7 +178,7 @@ class UBDiagnostics
178
  return array(
179
  'php' => phpversion(),
180
  'wordpress' => UBDiagnostics::wordpress_version(),
181
- 'plugin_version' => '1.0.44',
182
  'curl_installed' => self::is_curl_installed(),
183
  'xml_installed' => self::is_xml_installed(),
184
  'sni_support' => self::hasSNI(),
@@ -200,19 +200,4 @@ class UBDiagnostics
200
  'os' => php_uname(),
201
  );
202
  }
203
-
204
- /**
205
- * @param string|null $previousVersion
206
- */
207
- public static function sendActivationEvent($previousVersion = null)
208
- {
209
- if (!self::is_curl_installed()) {
210
- return;
211
- }
212
-
213
- $env = self::installationDetails();
214
- $sitemapRequest = self::testSiteMapRequest();
215
- $event = UBEvents::activationEvent($env, $sitemapRequest, $previousVersion);
216
- UBHTTP::send_event_to_events_gateway(UBConfig::remote_log_url(), $event);
217
- }
218
  }
100
  return array(
101
  'PHP Version' => phpversion(),
102
  'WordPress Version' => UBDiagnostics::wordpress_version(),
103
+ 'Unbounce Plugin Version' => '1.0.45',
104
  'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)),
105
  'Options' => self::pp(UBDiagnostics::ub_options()),
106
  'Permalink Structure' => get_option('permalink_structure', ''),
178
  return array(
179
  'php' => phpversion(),
180
  'wordpress' => UBDiagnostics::wordpress_version(),
181
+ 'plugin_version' => '1.0.45',
182
  'curl_installed' => self::is_curl_installed(),
183
  'xml_installed' => self::is_xml_installed(),
184
  'sni_support' => self::hasSNI(),
200
  'os' => php_uname(),
201
  );
202
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  }
UBHTTP.php CHANGED
@@ -446,95 +446,4 @@ class UBHTTP
446
  return null;
447
  }
448
  }
449
-
450
- public static function send_event_to_events_gateway($url, $data_string)
451
- {
452
- if (UBConfig::use_curl()) {
453
- UBHTTP::send_event_to_events_gateway_curl($url, $data_string);
454
- } else {
455
- UBHTTP::send_event_to_events_gateway_wp_remote($url, $data_string);
456
- }
457
- }
458
-
459
- private static function send_event_to_events_gateway_curl($url, $data_string)
460
- {
461
- try {
462
- $stream_function = function ($curl, $str) {
463
- return strlen($str);
464
- };
465
-
466
- $curl = curl_init();
467
- $curl_options = array(
468
- CURLOPT_URL => $url,
469
- CURLOPT_CUSTOMREQUEST => 'POST',
470
- CURLOPT_USERAGENT => UBConfig::UB_USER_AGENT,
471
- CURLOPT_FOLLOWLOCATION => false,
472
- CURLOPT_HTTPHEADER => array(
473
- 'Content-Type: application/json',
474
- 'Content-Length: ' . strlen($data_string)
475
- ),
476
- CURLOPT_HEADERFUNCTION => $stream_function,
477
- CURLOPT_WRITEFUNCTION => $stream_function,
478
- CURLOPT_POSTFIELDS => $data_string,
479
- CURLOPT_TIMEOUT => 2
480
- );
481
- curl_setopt_array($curl, $curl_options);
482
- $success = curl_exec($curl);
483
- $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
484
-
485
- if (!$success) {
486
- $message = 'Unable to send log messages to ' . $url . ': "'
487
- . curl_error($curl) . '" - HTTP status: ' . curl_errno($curl);
488
- UBLogger::warning($message);
489
- } elseif ($http_code >= 200 && $http_code < 300) {
490
- $message = 'Successfully sent log messsages to ' . $url
491
- . ' - HTTP status: ' . $http_code;
492
- UBLogger::debug($message);
493
- } else {
494
- $message = 'Unable to send log messages to ' . $url
495
- . ' - HTTP status: ' . $http_code;
496
- UBLogger::warning($message);
497
- }
498
-
499
- curl_close($curl);
500
- } catch (Exception $e) {
501
- $message = 'Unable to send log messages to ' . $url
502
- . ' - Error: ' . $e;
503
- UBLogger::warning($message);
504
- }
505
- }
506
-
507
- private static function send_event_to_events_gateway_wp_remote($url, $data_string)
508
- {
509
- $args = array(
510
- 'method' => 'POST',
511
- 'user-agent' => UBConfig::UB_USER_AGENT,
512
- 'redirection' => 0,
513
- 'timeout' => 2,
514
- 'headers' => array(
515
- 'Content-Type' => 'application/json',
516
- 'Content-Length' => strlen($data_string)
517
- ),
518
- 'body' => $data_string
519
- );
520
-
521
- $resp = wp_remote_request($url, $args);
522
- if (is_wp_error($resp)) {
523
- $message = "Unable to send log messages to '" . $url . "': " . $resp->get_error_message();
524
- UBLogger::warning($message);
525
- return;
526
- }
527
-
528
- $http_code = $resp['response']['code'];
529
- if ($http_code >= 200 && $http_code < 300) {
530
- $message = 'Successfully sent log messsages to ' . $url
531
- . ' - HTTP status: ' . $http_code;
532
- UBLogger::debug($message);
533
- } else {
534
- UBLogger::warning('$data_string=' . $data_string);
535
- $message = 'Unable to send log messages to ' . $url
536
- . ' - HTTP status: ' . $http_code;
537
- UBLogger::warning($message);
538
- }
539
- }
540
  }
446
  return null;
447
  }
448
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  }
UBLogger.php CHANGED
@@ -13,23 +13,6 @@ class UBLogger
13
  $GLOBALS['wp_log_plugins'][UBConfig::UB_PLUGIN_NAME . '-vars'] = array();
14
  }
15
 
16
- public static function upload_logs_to_unbounce($url)
17
- {
18
- // The assumption is that if curl is not installed will likely have
19
- // reached support and would have been diagnosed through diagnostics
20
- if (!UBDiagnostics::is_curl_installed()) {
21
- return;
22
- }
23
-
24
- if (UBConfig::remote_debug_logging_enabled()) {
25
- $data = array(
26
- 'messages' => $GLOBALS['wp_log'][UBConfig::UB_PLUGIN_NAME],
27
- 'vars' => $GLOBALS['wp_log'][UBConfig::UB_PLUGIN_NAME . '-vars'],
28
- );
29
- UBHTTP::send_event_to_events_gateway($url, UBEvents::log_event($data));
30
- }
31
- }
32
-
33
  public static function format_log_entry($level, $msg)
34
  {
35
  $msg = is_string($msg) ? $msg : print_r($msg, true);
13
  $GLOBALS['wp_log_plugins'][UBConfig::UB_PLUGIN_NAME . '-vars'] = array();
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  public static function format_log_entry($level, $msg)
17
  {
18
  $msg = is_string($msg) ? $msg : print_r($msg, true);
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.44
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
@@ -18,14 +18,10 @@ require_once dirname(__FILE__) . '/UBHTTP.php';
18
  require_once dirname(__FILE__) . '/UBIcon.php';
19
  require_once dirname(__FILE__) . '/UBWPListTable.php';
20
  require_once dirname(__FILE__) . '/UBPageTable.php';
21
- require_once dirname(__FILE__) . '/UBEvents.php';
22
  require_once dirname(__FILE__) . '/UBTemplate.php';
23
 
24
  register_activation_hook(__FILE__, function () {
25
  UBConfig::set_options_if_not_exist();
26
-
27
- // NOTE: This should be brought back when working on BEE-1136
28
- // @UBDiagnostics::sendActivationEvent();
29
  });
30
 
31
  register_deactivation_hook(__FILE__, function () {
@@ -145,10 +141,8 @@ add_action('init', function () {
145
 
146
  add_action('admin_init', function () {
147
 
148
- // If plugin was updated, send event to unbounce
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
  }
@@ -269,13 +263,6 @@ add_action('admin_post_set_unbounce_domains', function () {
269
  );
270
 
271
  UBConfig::update_authorization_options($domains, $data);
272
-
273
- if (UBConfig::is_authorized_domain(UBConfig::domain())) {
274
- $event = UBEvents::successful_authorization_event($data);
275
- } else {
276
- $event = UBEvents::failed_authorization_event($data);
277
- }
278
- UBHTTP::send_event_to_events_gateway(UBConfig::remote_events_url(), $event);
279
  } else {
280
  $authorization = 'failure';
281
  }
@@ -295,7 +282,3 @@ add_action('admin_post_flush_unbounce_pages', function () {
295
  $location = admin_url('admin.php?page=unbounce-pages');
296
  header("Location: $location");
297
  });
298
-
299
- add_action('shutdown', function () {
300
- UBLogger::upload_logs_to_unbounce(UBConfig::remote_log_url());
301
- });
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.45
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
18
  require_once dirname(__FILE__) . '/UBIcon.php';
19
  require_once dirname(__FILE__) . '/UBWPListTable.php';
20
  require_once dirname(__FILE__) . '/UBPageTable.php';
 
21
  require_once dirname(__FILE__) . '/UBTemplate.php';
22
 
23
  register_activation_hook(__FILE__, function () {
24
  UBConfig::set_options_if_not_exist();
 
 
 
25
  });
26
 
27
  register_deactivation_hook(__FILE__, function () {
141
 
142
  add_action('admin_init', function () {
143
 
 
144
  $pluginVersion = get_option(UBConfig::UB_PLUGIN_VERSION_KEY);
145
  if (UBConfig::UB_VERSION != $pluginVersion) {
 
146
  UBConfig::set_options_if_not_exist();
147
  update_option(UBConfig::UB_PLUGIN_VERSION_KEY, UBConfig::UB_VERSION);
148
  }
263
  );
264
 
265
  UBConfig::update_authorization_options($domains, $data);
 
 
 
 
 
 
 
266
  } else {
267
  $authorization = 'failure';
268
  }
282
  $location = admin_url('admin.php?page=unbounce-pages');
283
  header("Location: $location");
284
  });
 
 
 
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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.1
6
- Stable tag: 1.0.44
7
- Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -43,7 +43,7 @@ Our plugin requires the following setup for the WordPress Server:
43
  - cURL 7.34.0+
44
  - OpenSSL 1.0.1+
45
 
46
- We recommend at least PHP 5.6.
47
 
48
  1. Create a Wordpress domain in [Unbounce](http://unbounce.com/ "The Mobile Responsive Landing Page Builder for Marketers")
49
  1. Install this plugin through the WordPress store
@@ -101,6 +101,11 @@ You should add a rule to your cache to avoid caching Unbounce Pages which have t
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
104
  = 1.0.44 =
105
  * Documentation updates to reflect minimum PHP requirements (currently 5.3)
106
  * Tested with WP 5.1
2
  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.4
6
+ Stable tag: 1.0.45
7
+ Requires PHP: 7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
43
  - cURL 7.34.0+
44
  - OpenSSL 1.0.1+
45
 
46
+ We recommend at least PHP 7.2.
47
 
48
  1. Create a Wordpress domain in [Unbounce](http://unbounce.com/ "The Mobile Responsive Landing Page Builder for Marketers")
49
  1. Install this plugin through the WordPress store
101
 
102
  == Changelog ==
103
 
104
+ = 1.0.45 =
105
+ * Documentation updates to reflect minimum PHP requirements (currently 7.2)
106
+ * Add support for PHP 7.2 and higher
107
+ * Tested with WP 5.4
108
+
109
  = 1.0.44 =
110
  * Documentation updates to reflect minimum PHP requirements (currently 5.3)
111
  * Tested with WP 5.1
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.44</p>
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.45</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.44</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.45</p>