Unbounce Landing Pages - Version 1.0.34

Version Description

  • New diagnostics entry for SSL's SNI Support on WordPress installations
  • Better
Download this release

Release Info

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

Code changes from version 1.0.33 to 1.0.34

UBConfig.php CHANGED
@@ -5,8 +5,8 @@ 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.33';
9
- const UB_VERSION = '1.0.33';
10
 
11
  // Option keys
12
  const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
@@ -23,6 +23,7 @@ class UBConfig
23
  const UB_CLIENT_ID_KEY = 'ub-client-id';
24
  const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message';
25
  const UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR = 'ub-allow-public-address-x-forwarded-for';
 
26
 
27
  const UB_LOCK_NAME = 'ub-sql-lock';
28
 
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.34';
9
+ const UB_VERSION = '1.0.34';
10
 
11
  // Option keys
12
  const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
23
  const UB_CLIENT_ID_KEY = 'ub-client-id';
24
  const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message';
25
  const UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR = 'ub-allow-public-address-x-forwarded-for';
26
+ const UB_PLUGIN_VERSION_KEY = 'ub-plugin-version';
27
 
28
  const UB_LOCK_NAME = 'ub-sql-lock';
29
 
UBDiagnostics.php CHANGED
@@ -2,7 +2,6 @@
2
 
3
  class UBDiagnostics
4
  {
5
-
6
  const SUPPORTED_PHP_VERSION = '5.3';
7
  const SUPPORTED_WP_VERSION = '4.0';
8
 
@@ -19,7 +18,6 @@ class UBDiagnostics
19
  );
20
  }
21
 
22
-
23
  public static function system_checks()
24
  {
25
  return array(
@@ -35,10 +33,16 @@ class UBDiagnostics
35
  UBDiagnostics::wordpress_version(),
36
  UBDiagnostics::SUPPORTED_WP_VERSION,
37
  '>='
38
- )
 
39
  );
40
  }
41
 
 
 
 
 
 
42
  public static function is_curl_installed()
43
  {
44
  return function_exists('curl_init');
@@ -60,27 +64,64 @@ class UBDiagnostics
60
  }
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  public static function details($domain, $domain_info)
64
  {
65
  return array(
66
  'PHP Version' => phpversion(),
67
  'WordPress Version' => UBDiagnostics::wordpress_version(),
68
- 'Unbounce Plugin Version' => '1.0.33',
 
 
69
  'Permalink Structure' => get_option('permalink_structure', ''),
70
  'Domain' => $domain,
71
- 'Domain Authorized' => print_r(UBConfig::is_authorized_domain($domain), true),
72
- 'Has Authorized' => print_r(UBConfig::has_authorized(), true),
73
- 'Active Plugins' => print_r(get_option('active_plugins'), true),
74
- 'Plugin Details' => print_r(get_plugins(), true),
75
- 'Curl Version' => UBDiagnostics::curl_version(),
76
- 'Configuration Options' => print_r(ini_get_all(), true),
77
- 'Extensions' => print_r(get_loaded_extensions(), true),
 
78
  'Operating System' => php_uname(),
79
- 'Checks' => print_r(UBDiagnostics::checks($domain, $domain_info), true),
80
- 'Options' => print_r(UBDiagnostics::ub_options(), true)
81
  );
82
  }
83
 
 
 
 
 
 
84
  private static function ub_options()
85
  {
86
  $option_values = array_map(function ($key) {
@@ -96,7 +137,7 @@ class UBDiagnostics
96
  private static function curl_version()
97
  {
98
  if (function_exists('curl_version')) {
99
- return print_r(curl_version(), true);
100
  } else {
101
  return 'N/A';
102
  }
@@ -114,4 +155,67 @@ class UBDiagnostics
114
  $last_status = UBUtil::array_fetch($domain_info, 'last_status');
115
  return $last_status !== null && $last_status !== 'FAILURE';
116
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
2
 
3
  class UBDiagnostics
4
  {
 
5
  const SUPPORTED_PHP_VERSION = '5.3';
6
  const SUPPORTED_WP_VERSION = '4.0';
7
 
18
  );
19
  }
20
 
 
21
  public static function system_checks()
22
  {
23
  return array(
33
  UBDiagnostics::wordpress_version(),
34
  UBDiagnostics::SUPPORTED_WP_VERSION,
35
  '>='
36
+ ),
37
+ 'SNI Support' => self::hasSNI(),
38
  );
39
  }
40
 
41
+ public static function hasSNI()
42
+ {
43
+ return defined('OPENSSL_TLSEXT_SERVER_NAME') && OPENSSL_TLSEXT_SERVER_NAME;
44
+ }
45
+
46
  public static function is_curl_installed()
47
  {
48
  return function_exists('curl_init');
64
  }
65
  }
66
 
67
+ /**
68
+ * Format a variable as condensed human-readable output
69
+ * Example: non-assoc arrays are output as [foo, bar] and assoc looks like
70
+ * [
71
+ * foo: 'bar'
72
+ * baz: NULL
73
+ * ]
74
+ * @param mixed $var
75
+ * @param int $level
76
+ * @return string
77
+ */
78
+ private static function pp($var, $level = 1)
79
+ {
80
+ $str = '';
81
+ if (is_array($var)) {
82
+ $simple = empty($var) ? true : array_keys($var) === range(0, count($var) -1);
83
+ $str .= '[';
84
+ if ($simple) {
85
+ $str .= implode(', ', $var);
86
+ } else {
87
+ foreach ($var as $key => $value) {
88
+ $str .= "\n" . str_repeat(' ', $level) . "$key: " . self::pp($value, $level + 1);
89
+ }
90
+ }
91
+ $str .= ']';
92
+ } else {
93
+ $str = var_export($var, true);
94
+ }
95
+ return $str;
96
+ }
97
+
98
  public static function details($domain, $domain_info)
99
  {
100
  return array(
101
  'PHP Version' => phpversion(),
102
  'WordPress Version' => UBDiagnostics::wordpress_version(),
103
+ 'Unbounce Plugin Version' => '1.0.34',
104
+ 'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)),
105
+ 'Options' => self::pp(UBDiagnostics::ub_options()),
106
  'Permalink Structure' => get_option('permalink_structure', ''),
107
  'Domain' => $domain,
108
+ 'Domain Authorized' => self::pp(UBConfig::is_authorized_domain($domain)),
109
+ 'Has Authorized' => self::pp(UBConfig::has_authorized()),
110
+ 'Active Plugins' => self::pp(get_option('active_plugins')),
111
+ 'Plugin Details' => self::pp(get_plugins()),
112
+ 'Curl Version' => self::pp(UBDiagnostics::curl_version()),
113
+ 'SNI Support' => self::hasSNI(),
114
+ 'Configuration Options' => self::pp(self::phpConfig()),
115
+ 'Extensions' => self::pp(get_loaded_extensions()),
116
  'Operating System' => php_uname(),
 
 
117
  );
118
  }
119
 
120
+ private static function phpConfig()
121
+ {
122
+ return ini_get_all(null, false);
123
+ }
124
+
125
  private static function ub_options()
126
  {
127
  $option_values = array_map(function ($key) {
137
  private static function curl_version()
138
  {
139
  if (function_exists('curl_version')) {
140
+ return curl_version();
141
  } else {
142
  return 'N/A';
143
  }
155
  $last_status = UBUtil::array_fetch($domain_info, 'last_status');
156
  return $last_status !== null && $last_status !== 'FAILURE';
157
  }
158
+
159
+ /**
160
+ * Perform a sitemap request with default parameters to test communication with unbounce
161
+ * @return array
162
+ */
163
+ public static function testSiteMapRequest()
164
+ {
165
+ $res = UBConfig::fetch_proxyable_url_set(UBConfig::domain(), null, UBConfig::page_server_domain());
166
+ if (!is_array($res) || !isset($res[0])) {
167
+ return array(
168
+ 'status' => 'ERROR',
169
+ 'result' => var_export($res, true),
170
+ );
171
+ }
172
+ return $res[0];
173
+ }
174
+
175
+ /**
176
+ * Retrieve environment details relevant at plugin activation time
177
+ * @return array
178
+ */
179
+ public static function installationDetails()
180
+ {
181
+ return array(
182
+ 'php' => phpversion(),
183
+ 'wordpress' => UBDiagnostics::wordpress_version(),
184
+ 'plugin_version' => '1.0.34',
185
+ 'curl_installed' => self::is_curl_installed(),
186
+ 'xml_installed' => self::is_xml_installed(),
187
+ 'sni_support' => self::hasSNI(),
188
+ 'permalink_structure' => get_option('permalink_structure'),
189
+ 'domain' => UBConfig::domain(),
190
+ 'active_plugins' => get_option('active_plugins'),
191
+ 'curl_version' => UBDiagnostics::curl_version(),
192
+ 'php_config' => UBUtil::array_select_by_key(
193
+ self::phpConfig(),
194
+ array(
195
+ 'allow_url_fopen', 'cgi.discard_path', 'cgi.fix_pathinfo', 'curl.cainfo', 'default_charset',
196
+ 'default_socket_timeout', 'disable_functions', 'display_errors', 'error_reporting',
197
+ 'enable_post_data_reading', 'file_uploads', 'implicit_flush', 'memory_limit', 'max_execution_time',
198
+ 'max_input_time', 'opcache.enable', 'openssl.cafile', 'openssl.capath', 'output_buffering',
199
+ 'output_encoding', 'output_handler', 'post_max_size', 'short_open_tag', 'upload_max_filesize',
200
+ )
201
+ ),
202
+ 'php_extensions' => get_loaded_extensions(),
203
+ 'os' => php_uname(),
204
+ );
205
+ }
206
+
207
+ /**
208
+ * @param string|null $previousVersion
209
+ */
210
+ public static function sendActivationEvent($previousVersion = null)
211
+ {
212
+ if (!self::is_curl_installed()) {
213
+ return;
214
+ }
215
+
216
+ $env = self::installationDetails();
217
+ $sitemapRequest = self::testSiteMapRequest();
218
+ $event = UBEvents::activationEvent($env, $sitemapRequest, $previousVersion);
219
+ UBHTTP::send_event_to_events_gateway(UBConfig::remote_log_url(), $event);
220
+ }
221
  }
UBEvents.php CHANGED
@@ -19,6 +19,24 @@ class UBEvents
19
  );
20
  }
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  public static function log_event($data)
23
  {
24
  return UBEvents::event('WordpressLogV1.0', $data);
19
  );
20
  }
21
 
22
+ /**
23
+ * @param array $environment
24
+ * @param array|null $sitemapRequest
25
+ * @param string|null $previousVersion
26
+ *
27
+ * @return array
28
+ */
29
+ public static function activationEvent($environment, $sitemapRequest, $previousVersion = null)
30
+ {
31
+ $data = array('environment' => $environment, 'sitemap_request' => $sitemapRequest);
32
+
33
+ if ($previousVersion) {
34
+ $data['previous_version'] = $previousVersion;
35
+ }
36
+
37
+ return UBEvents::event('WordpressActivationEventV1.0', $data);
38
+ }
39
+
40
  public static function log_event($data)
41
  {
42
  return UBEvents::event('WordpressLogV1.0', $data);
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.33
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
@@ -54,6 +54,10 @@ register_activation_hook(__FILE__, function () {
54
  add_option(UBConfig::UB_CLIENT_ID_KEY, '');
55
  add_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, '');
56
  add_option(UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR, 0);
 
 
 
 
57
  });
58
 
59
  register_deactivation_hook(__FILE__, function () {
@@ -180,6 +184,14 @@ add_action('init', function () {
180
  }, UBConfig::int_min());
181
 
182
  add_action('admin_init', function () {
 
 
 
 
 
 
 
 
183
  UBUtil::clear_flash();
184
 
185
  // Disable incompatible scripts
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.34
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
54
  add_option(UBConfig::UB_CLIENT_ID_KEY, '');
55
  add_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, '');
56
  add_option(UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR, 0);
57
+ add_option(UBConfig::UB_PLUGIN_VERSION_KEY, UBConfig::UB_VERSION);
58
+
59
+ // NOTE: This should be brought back when working on BEE-1136
60
+ // @UBDiagnostics::sendActivationEvent();
61
  });
62
 
63
  register_deactivation_hook(__FILE__, function () {
184
  }, UBConfig::int_min());
185
 
186
  add_action('admin_init', function () {
187
+
188
+ // If plugin was updated, send event to unbounce
189
+ $pluginVersion = get_option(UBConfig::UB_PLUGIN_VERSION_KEY);
190
+ if (UBConfig::UB_VERSION != $pluginVersion) {
191
+ @UBDiagnostics::sendActivationEvent($pluginVersion);
192
+ update_option(UBConfig::UB_PLUGIN_VERSION_KEY, UBConfig::UB_VERSION);
193
+ }
194
+
195
  UBUtil::clear_flash();
196
 
197
  // Disable incompatible scripts
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.7.3
6
- Stable tag: 1.0.33
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -94,6 +94,10 @@ You should add a rule to your cache to avoid caching Unbounce Pages which have t
94
 
95
  == Changelog ==
96
 
 
 
 
 
97
  = 1.0.33 =
98
  * Improved support for PHP 7.1
99
 
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.7.3
6
+ Stable tag: 1.0.34
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
94
 
95
  == Changelog ==
96
 
97
+ = 1.0.34 =
98
+ * New diagnostics entry for SSL's SNI Support on WordPress installations
99
+ * Better
100
+
101
  = 1.0.33 =
102
  * Improved support for PHP 7.1
103
 
templates/diagnostics.php CHANGED
@@ -59,11 +59,11 @@ $diagnostic_descriptions = array(
59
  please also provide details on your hosting provider.
60
  </p>
61
  <textarea id="ub-diagnostics-text" rows="10" cols="100">
62
- <?php
63
 
64
- foreach ($details as $detail_name => $detail) {
65
- echo "[${detail_name}] ${detail}\n";
66
- }
67
 
68
  ?>
69
  </textarea>
59
  please also provide details on your hosting provider.
60
  </p>
61
  <textarea id="ub-diagnostics-text" rows="10" cols="100">
62
+ <?php
63
 
64
+ foreach ($details as $detail_name => $detail) {
65
+ echo "[${detail_name}] ${detail}\n";
66
+ }
67
 
68
  ?>
69
  </textarea>
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.33</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.34</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.33</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.34</p>