Unbounce Landing Pages - Version 1.0.49

Version Description

  • Added setting to customize response headers forwarded from Unbounce
Download this release

Release Info

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

Code changes from version 1.0.48 to 1.0.49

UBConfig.php CHANGED
@@ -5,10 +5,15 @@ 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.48';
9
- const UB_VERSION = '1.0.48';
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';
@@ -25,24 +30,32 @@ class UBConfig
25
 
26
  const UB_LOCK_NAME = 'ub-sql-lock';
27
 
 
 
28
  public static function ub_option_defaults()
29
  {
30
  // All options, used by UBDiagnostics and deactivation hook
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(),
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
- UBConfig::UB_PROXY_ERROR_MESSAGE_KEY => '',
43
- UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR => 0,
44
- UBConfig::UB_USE_CURL_KEY => 1,
45
- UBConfig::UB_PLUGIN_VERSION_KEY => UBConfig::UB_VERSION
 
 
 
 
 
 
46
  );
47
  }
48
 
@@ -158,6 +171,11 @@ class UBConfig
158
  }
159
  }
160
 
 
 
 
 
 
161
  public static function fetch_proxyable_url_set($domain, $etag, $ps_domain)
162
  {
163
  if (!$domain) {
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.49';
9
+ const UB_VERSION = '1.0.49';
10
 
11
+ // WP Admin Pages
12
+ const UB_ADMIN_PAGE_MAIN = 'unbounce-pages';
13
+ const UB_ADMIN_PAGE_SETTINGS = 'unbounce-pages-settings';
14
+ const UB_ADMIN_PAGE_DIAGNOSTICS = 'unbounce-pages-diagnostics';
15
+
16
+ // Option keys
17
  const UB_ROUTES_CACHE_KEY = 'ub-route-cache';
18
  const UB_PAGE_SERVER_DOMAIN_KEY = 'ub-page-server-domain';
19
  const UB_API_URL_KEY = 'ub-api-url';
30
 
31
  const UB_LOCK_NAME = 'ub-sql-lock';
32
 
33
+ const UB_RESPONSE_HEADERS_FORWARDED_KEY = 'ub-response-headers-forwarded';
34
+
35
  public static function ub_option_defaults()
36
  {
37
  // All options, used by UBDiagnostics and deactivation hook
38
  // Arrays are not allowed in class constants, so use a function
39
  return array(
40
+ UBConfig::UB_ROUTES_CACHE_KEY => array(),
41
+ UBConfig::UB_PAGE_SERVER_DOMAIN_KEY => UBConfig::default_page_server_domain(),
42
+ UBConfig::UB_API_URL_KEY => UBConfig::default_api_url(),
43
+ UBConfig::UB_API_CLIENT_ID_KEY => UBConfig::default_api_client_id(),
44
+ UBConfig::UB_AUTHORIZED_DOMAINS_KEY => UBConfig::default_authorized_domains(),
45
+ UBConfig::UB_HAS_AUTHORIZED_KEY => '',
46
+ UBConfig::UB_USER_ID_KEY => '',
47
+ UBConfig::UB_DOMAIN_ID_KEY => '',
48
+ UBConfig::UB_CLIENT_ID_KEY => '',
49
+ UBConfig::UB_PROXY_ERROR_MESSAGE_KEY => '',
50
+ UBConfig::UB_ALLOW_PUBLIC_ADDRESS_X_FORWARDED_FOR => 0,
51
+ UBConfig::UB_USE_CURL_KEY => 1,
52
+ UBConfig::UB_PLUGIN_VERSION_KEY => UBConfig::UB_VERSION,
53
+ // headers are expected to be in lowercase to simplify filtering
54
+ UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY => array(
55
+ 'x-unbounce-pageid',
56
+ 'x-unbounce-variant',
57
+ 'x-unbounce-visitorid'
58
+ )
59
  );
60
  }
61
 
171
  }
172
  }
173
 
174
+ public static function response_headers_forwarded()
175
+ {
176
+ return get_option(UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY);
177
+ }
178
+
179
  public static function fetch_proxyable_url_set($domain, $etag, $ps_domain)
180
  {
181
  if (!$domain) {
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.48',
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.48',
182
  'curl_installed' => self::is_curl_installed(),
183
  'xml_installed' => self::is_xml_installed(),
184
  'sni_support' => self::hasSNI(),
100
  return array(
101
  'PHP Version' => phpversion(),
102
  'WordPress Version' => UBDiagnostics::wordpress_version(),
103
+ 'Unbounce Plugin Version' => '1.0.49',
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.49',
182
  'curl_installed' => self::is_curl_installed(),
183
  'xml_installed' => self::is_xml_installed(),
184
  'sni_support' => self::hasSNI(),
UBHTTP.php CHANGED
@@ -2,18 +2,21 @@
2
 
3
  class UBHTTP
4
  {
5
- public static $powered_by_header_regex = '/^X-Powered-By: (.+)$/i';
6
  public static $form_confirmation_url_regex = '/(.+)\/[a-z]+-form_confirmation\.html/i';
7
  public static $lightbox_url_regex = '/(.+)\/[a-z]+-[0-9]+-lightbox\.html/i';
8
  public static $variant_url_regex = '/(.+)\/[a-z]+\.html/i';
9
  public static $pie_htc_url = '/PIE.htc';
10
- // Suppress Etag and Last-Modified so that browser doesn't send
11
- // If-None-Match and If-Modified-Since header (to bypass front-end caches)
12
- // @codingStandardsIgnoreLine
13
- public static $response_header_whitelist = '/^(Content-Type:|Location:|Link:|Content-Location:|Set-Cookie:|X-Server-Instance:|X-Unbounce-PageId:|X-Unbounce-Variant:|X-Unbounce-VisitorID:)/i';
14
- public static $request_header_blacklist = '/^(Accept-Encoding:)/i';
15
  public static $location_header_regex = '/^(Location:)/i';
16
- public static $cookie_whitelist = array('ubvs', 'ubpv', 'ubvt', 'hubspotutk');
 
 
 
 
 
 
 
 
17
 
18
  public static function is_private_ip_address($ip_address)
19
  {
@@ -50,25 +53,6 @@ class UBHTTP
50
  };
51
  }
52
 
53
- public static function rewrite_x_powered_by_header($header_string, $existing_headers)
54
- {
55
- $fetch_powered_by_value = UBHTTP::fetch_header_value_function(UBHTTP::$powered_by_header_regex);
56
-
57
- $existing_powered_by = preg_grep(
58
- UBHTTP::$powered_by_header_regex,
59
- $existing_headers
60
- );
61
-
62
- $existing_powered_by = array_map(
63
- $fetch_powered_by_value,
64
- $existing_powered_by
65
- );
66
-
67
- return 'X-Powered-By: ' .
68
- join($existing_powered_by, ', ') . ', ' .
69
- $fetch_powered_by_value($header_string);
70
- }
71
-
72
  public static function get_proxied_for_header(
73
  $forwarded_for,
74
  $current_ip
@@ -83,23 +67,18 @@ class UBHTTP
83
  return array('X-Proxied-For' => $proxied_for);
84
  }
85
 
86
- public static function stream_headers_function($existing_headers)
87
  {
88
- return function ($curl, $header_string) use ($existing_headers) {
89
- $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
90
-
91
- http_response_code($http_status_code);
92
 
93
- if (preg_match(UBHTTP::$powered_by_header_regex, $header_string) == 1) {
94
- $result = UBHTTP::rewrite_x_powered_by_header($header_string, $existing_headers);
95
- header($result);
96
- } elseif (preg_match(UBHTTP::$response_header_whitelist, $header_string)) {
97
  // false means don't replace the exsisting header
98
- header($header_string, false);
99
  }
100
 
101
  // We must show curl that we've processed every byte of the input header
102
- return strlen($header_string);
103
  };
104
  }
105
 
@@ -230,7 +209,7 @@ class UBHTTP
230
 
231
  $filtered_h = array();
232
  array_walk($base_h, function ($v, $k) use (&$filtered_h) {
233
- if (!preg_match(UBHTTP::$request_header_blacklist, $k . ": " . $v)) {
234
  $filtered_h[$k] = $v;
235
  }
236
  });
@@ -247,7 +226,7 @@ class UBHTTP
247
 
248
  private static function get_diagnostic_headers()
249
  {
250
- $headers = array('X-UB-WordPress-Plugin-Version' => '1.0.48');
251
 
252
  try {
253
  // OS info:
@@ -283,7 +262,7 @@ class UBHTTP
283
 
284
  $cookies_to_forward = UBUtil::array_select_by_key(
285
  UBHTTP::cookie_array_from_string($headers[$cookie_key]),
286
- UBHTTP::$cookie_whitelist
287
  );
288
  if (sizeof($cookies_to_forward) > 0) {
289
  $headers[$cookie_key] = UBHTTP::cookie_string_from_array($cookies_to_forward);
@@ -304,8 +283,10 @@ class UBHTTP
304
 
305
  public static function set_response_headers($headers)
306
  {
 
 
307
  foreach ($headers as $h_key => $h_value) {
308
- if (preg_match(UBHTTP::$response_header_whitelist, $h_key . ":")) {
309
  if (is_array($h_value)) {
310
  foreach ($h_value as $header_item) {
311
  header($h_key . ': ' . $header_item, false);
@@ -333,7 +314,7 @@ class UBHTTP
333
  UBLogger::debug_var('original_headers', print_r($headers0, true));
334
  UBLogger::debug_var('sent_headers', print_r($headers, true));
335
 
336
- $stream_headers = UBHTTP::stream_headers_function($base_response_headers);
337
  $stream_body = UBHTTP::stream_response_function();
338
  $curl = curl_init();
339
  // http://php.net/manual/en/function.curl-setopt.php
@@ -367,6 +348,8 @@ class UBHTTP
367
  $result = array(false, $message);
368
  }
369
  } else {
 
 
370
  $result = array(true, null);
371
  }
372
 
@@ -475,4 +458,41 @@ class UBHTTP
475
  return null;
476
  }
477
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  }
2
 
3
  class UBHTTP
4
  {
 
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
  public static $pie_htc_url = '/PIE.htc';
9
+ public static $request_header_blocklist = '/^(Accept-Encoding:)/i';
 
 
 
 
10
  public static $location_header_regex = '/^(Location:)/i';
11
+ public static $cookie_allowlist = array('ubvs', 'ubpv', 'ubvt', 'hubspotutk');
12
+ public static $response_headers_always_forwarded = array(
13
+ 'content-length',
14
+ 'content-location',
15
+ 'content-type',
16
+ 'location',
17
+ 'link',
18
+ 'set-cookie'
19
+ );
20
 
21
  public static function is_private_ip_address($ip_address)
22
  {
53
  };
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  public static function get_proxied_for_header(
57
  $forwarded_for,
58
  $current_ip
67
  return array('X-Proxied-For' => $proxied_for);
68
  }
69
 
70
+ public static function stream_headers_function()
71
  {
72
+ $header_filter = UBHTTP::create_curl_response_header_filter();
 
 
 
73
 
74
+ return function ($curl, $header_line) use ($header_filter) {
75
+ if ($header_filter($header_line)) {
 
 
76
  // false means don't replace the exsisting header
77
+ header($header_line, false);
78
  }
79
 
80
  // We must show curl that we've processed every byte of the input header
81
+ return strlen($header_line);
82
  };
83
  }
84
 
209
 
210
  $filtered_h = array();
211
  array_walk($base_h, function ($v, $k) use (&$filtered_h) {
212
+ if (!preg_match(UBHTTP::$request_header_blocklist, $k . ": " . $v)) {
213
  $filtered_h[$k] = $v;
214
  }
215
  });
226
 
227
  private static function get_diagnostic_headers()
228
  {
229
+ $headers = array('X-UB-WordPress-Plugin-Version' => '1.0.49');
230
 
231
  try {
232
  // OS info:
262
 
263
  $cookies_to_forward = UBUtil::array_select_by_key(
264
  UBHTTP::cookie_array_from_string($headers[$cookie_key]),
265
+ UBHTTP::$cookie_allowlist
266
  );
267
  if (sizeof($cookies_to_forward) > 0) {
268
  $headers[$cookie_key] = UBHTTP::cookie_string_from_array($cookies_to_forward);
283
 
284
  public static function set_response_headers($headers)
285
  {
286
+ $header_filter = UBHTTP::create_response_header_filter();
287
+
288
  foreach ($headers as $h_key => $h_value) {
289
+ if ($header_filter($h_key)) {
290
  if (is_array($h_value)) {
291
  foreach ($h_value as $header_item) {
292
  header($h_key . ': ' . $header_item, false);
314
  UBLogger::debug_var('original_headers', print_r($headers0, true));
315
  UBLogger::debug_var('sent_headers', print_r($headers, true));
316
 
317
+ $stream_headers = UBHTTP::stream_headers_function();
318
  $stream_body = UBHTTP::stream_response_function();
319
  $curl = curl_init();
320
  // http://php.net/manual/en/function.curl-setopt.php
348
  $result = array(false, $message);
349
  }
350
  } else {
351
+ $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
352
+ http_response_code($http_status_code);
353
  $result = array(true, null);
354
  }
355
 
458
  return null;
459
  }
460
  }
461
+
462
+ private static function create_curl_response_header_filter()
463
+ {
464
+ $blocklist_regex = '/^connection:/i';
465
+ $config_headers_forwarded = UBConfig::response_headers_forwarded();
466
+
467
+ if ($config_headers_forwarded === array('*')) {
468
+ return function ($header) use ($blocklist_regex) {
469
+ return !preg_match($blocklist_regex, $header);
470
+ };
471
+ }
472
+
473
+ $allowlist = array_merge($config_headers_forwarded, UBHTTP::$response_headers_always_forwarded);
474
+ $allowlist_regex = '/^('.implode('|', $allowlist).'):/i';
475
+ return function ($header) use ($blocklist_regex, $allowlist_regex) {
476
+ return preg_match($allowlist_regex, $header) && !preg_match($blocklist_regex, $header);
477
+ };
478
+ }
479
+
480
+ private static function create_response_header_filter()
481
+ {
482
+ $config_headers_forwarded = UBConfig::response_headers_forwarded();
483
+
484
+ if ($config_headers_forwarded === array('*')) {
485
+ return function ($header) {
486
+ return strcasecmp($header, 'connection') !== 0;
487
+ };
488
+ }
489
+
490
+ $allowlist = array_merge($config_headers_forwarded, UBHTTP::$response_headers_always_forwarded);
491
+
492
+ return function ($header) use ($allowlist) {
493
+ // headers in the allow list are lowercase
494
+ $header = strtolower($header);
495
+ return $header !== 'connection' && in_array($header, $allowlist);
496
+ };
497
+ }
498
  }
UBIcon.php CHANGED
@@ -5,6 +5,6 @@ class UBIcon
5
  public static function base64_encoded_svg()
6
  {
7
  // @codingStandardsIgnoreLine
8
- return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmlld0JveD0iMCAwIDI1Mi43ODY2NyAyNTIuNzg2NjciCiAgIGhlaWdodD0iMjUyLjc4NjY3IgogICB3aWR0aD0iMjUyLjc4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yy01Mi41LDAtOTUsNDIuNS05NSw5NXM0Mi41LDk1LDk1LDk1czk1LTQyLjUsOTUtOTVTMTUwLjgsNC44LDk4LjMsNC44eiBNOTQuOSwxMzcuMmwtNywyMC41CgkJYy0wLjIsMC43LTAuNiwxLjMtMC45LDEuOWMtMC45LDEuNC0yLDIuNC0zLjQsMy4yYy0xLjIsMC42LTIuNiwxLTQuMSwxYy0xLDAtMS45LTAuMi0yLjktMC41Yy00LTEuNC02LjMtNS4zLTYtOS4zCgkJQzUxLDE0My45LDM3LjYsMTIzLjQsMzcuNiw5OS44YzAtMzMuNiwyNy4yLTYwLjgsNjAuOC02MC44YzMuOSwwLDcuNywwLjQsMTEuNCwxLjFjMi4yLTMuNCw2LjQtNSwxMC40LTMuNwoJCWMyLjEsMC43LDMuNywyLjEsNC43LDMuOWMxLDEuNiwxLjQsMy41LDEuMiw1LjRjLTAuMSwwLjctMC4yLDEuNC0wLjQsMmwtNywyMC41TDk0LjksMTM3LjJ6IE0xMDIuNywxNjAuNWw4LjMtMjUuMwoJCWMxNC41LTUuMiwyNC45LTE5LDI0LjktMzUuM2MwLTcuNy0yLjQtMTQuOS02LjQtMjAuOWw4LjMtMjUuM2MxMywxMS4xLDIxLjMsMjcuNywyMS4zLDQ2LjJDMTU5LjEsMTMyLDEzNC4yLDE1OC4yLDEwMi43LDE2MC41eiIvPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTYwLjgsOTkuOGMwLDEzLjIsNi45LDI0LjksMTcuMywzMS41bDIzLjYtNjguOWMtMS4xLTAuMS0yLjMtMC4yLTMuNC0wLjJDNzcuNiw2Mi4zLDYwLjgsNzkuMSw2MC44LDk5Ljh6Ii8+CjwvZz4KPC9zdmc+Cg==';
9
  }
10
  }
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.48
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
@@ -149,14 +149,14 @@ add_action('admin_init', function () {
149
 
150
  UBUtil::clear_flash();
151
 
152
- // Disable incompatible scripts
153
 
154
- // WPML
155
  wp_dequeue_script('installer-admin');
156
 
157
- // Enqueue our own scripts
158
 
159
- // Main page
160
  wp_enqueue_script(
161
  'ub-rx',
162
  plugins_url('js/rx.lite.compat.min.js', __FILE__)
@@ -172,7 +172,7 @@ add_action('admin_init', function () {
172
  array('jquery')
173
  );
174
 
175
- // Diagnostics page
176
  wp_enqueue_script(
177
  'ub-clipboard-js',
178
  plugins_url('js/clipboard.min.js', __FILE__)
@@ -182,19 +182,43 @@ add_action('admin_init', function () {
182
  plugins_url('js/unbounce-diagnostics.js', __FILE__),
183
  array('jquery', 'ub-clipboard-js')
184
  );
185
- // Re-enable incompatible scripts
186
 
187
- // WPML
188
  wp_enqueue_script('installer-admin');
189
 
190
  wp_enqueue_style(
191
  'unbounce-pages-css',
192
  plugins_url('css/unbounce-pages.css', __FILE__)
193
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }, 0);
195
 
196
  add_action('admin_menu', function () {
197
- // Main admin page
198
  $print_admin_panel = function () {
199
  $domain = UBConfig::domain();
200
  $domain_info = UBConfig::read_unbounce_domain_info($domain, false);
@@ -210,23 +234,28 @@ add_action('admin_menu', function () {
210
  'Unbounce Pages',
211
  'Unbounce Pages',
212
  'manage_options',
213
- 'unbounce-pages',
214
  $print_admin_panel,
215
  UBIcon::base64_encoded_svg()
216
  );
217
 
218
- // Diagnostics page
 
 
 
 
 
219
  $print_diagnostics_panel = function () {
220
  $domain = UBConfig::domain();
221
  $domain_info = UBConfig::read_unbounce_domain_info($domain, false);
222
 
223
  echo UBTemplate::render(
224
  'diagnostics',
225
- array('img_url' => plugins_url('img/unbounce-logo-blue.png', __FILE__),
226
- 'checks' => UBDiagnostics::checks($domain, $domain_info),
227
- 'details' => UBDiagnostics::details($domain, $domain_info),
228
- 'domain' => $domain,
229
- 'permalink_url' => admin_url('options-permalink.php'),
230
  'curl_error_message' => UBUtil::array_fetch(
231
  $domain_info,
232
  'failure_message'
@@ -235,11 +264,29 @@ add_action('admin_menu', function () {
235
  };
236
 
237
  add_submenu_page(
238
- 'unbounce-pages',
239
- 'Unbounce Pages Diagnostics',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  'Unbounce Pages Diagnostics',
 
241
  'manage_options',
242
- 'unbounce-pages-diagnostics',
243
  $print_diagnostics_panel
244
  );
245
  });
@@ -270,15 +317,15 @@ add_action('admin_post_set_unbounce_domains', function () {
270
  UBUtil::set_flash('authorization', $authorization);
271
 
272
  status_header(301);
273
- $location = admin_url('admin.php?page=unbounce-pages');
274
  header("Location: $location");
275
  });
276
 
277
  add_action('admin_post_flush_unbounce_pages', function () {
278
  $domain = UBConfig::domain();
279
- // Expire cache and redirect
280
  $_domain_info = UBConfig::read_unbounce_domain_info($domain, true);
281
  status_header(301);
282
- $location = admin_url('admin.php?page=unbounce-pages');
283
  header("Location: $location");
284
  });
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.49
7
  Author: Unbounce
8
  Author URI: http://unbounce.com
9
  License: GPLv2
149
 
150
  UBUtil::clear_flash();
151
 
152
+ // Disable incompatible scripts
153
 
154
+ // WPML
155
  wp_dequeue_script('installer-admin');
156
 
157
+ // Enqueue our own scripts
158
 
159
+ // Main page
160
  wp_enqueue_script(
161
  'ub-rx',
162
  plugins_url('js/rx.lite.compat.min.js', __FILE__)
172
  array('jquery')
173
  );
174
 
175
+ // Diagnostics page
176
  wp_enqueue_script(
177
  'ub-clipboard-js',
178
  plugins_url('js/clipboard.min.js', __FILE__)
182
  plugins_url('js/unbounce-diagnostics.js', __FILE__),
183
  array('jquery', 'ub-clipboard-js')
184
  );
185
+ // Re-enable incompatible scripts
186
 
187
+ // WPML
188
  wp_enqueue_script('installer-admin');
189
 
190
  wp_enqueue_style(
191
  'unbounce-pages-css',
192
  plugins_url('css/unbounce-pages.css', __FILE__)
193
  );
194
+
195
+ // Plugin settings
196
+ register_setting(
197
+ UBConfig::UB_ADMIN_PAGE_SETTINGS,
198
+ UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY,
199
+ array('sanitize_callback' => function ($input_value) {
200
+ return array_filter(array_map('trim', explode(PHP_EOL, strtolower($input_value))));
201
+ })
202
+ );
203
+
204
+ add_settings_section('default', null, null, UBConfig::UB_ADMIN_PAGE_SETTINGS);
205
+
206
+ add_settings_field(
207
+ UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY,
208
+ 'Response Headers Forwarded',
209
+ function ($args) {
210
+ echo UBTemplate::render('settings_response_headers_forwarded', array(
211
+ 'value' => get_option(UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY),
212
+ 'default' => UBConfig::ub_option_defaults()[UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY]
213
+ ));
214
+ },
215
+ UBConfig::UB_ADMIN_PAGE_SETTINGS,
216
+ 'default'
217
+ );
218
  }, 0);
219
 
220
  add_action('admin_menu', function () {
221
+ // Main admin page
222
  $print_admin_panel = function () {
223
  $domain = UBConfig::domain();
224
  $domain_info = UBConfig::read_unbounce_domain_info($domain, false);
234
  'Unbounce Pages',
235
  'Unbounce Pages',
236
  'manage_options',
237
+ UBConfig::UB_ADMIN_PAGE_MAIN,
238
  $print_admin_panel,
239
  UBIcon::base64_encoded_svg()
240
  );
241
 
242
+ // Settings page
243
+ $print_settings_panel = function () {
244
+ echo UBTemplate::render('settings');
245
+ };
246
+
247
+ // Diagnostics page
248
  $print_diagnostics_panel = function () {
249
  $domain = UBConfig::domain();
250
  $domain_info = UBConfig::read_unbounce_domain_info($domain, false);
251
 
252
  echo UBTemplate::render(
253
  'diagnostics',
254
+ array(
255
+ 'checks' => UBDiagnostics::checks($domain, $domain_info),
256
+ 'details' => UBDiagnostics::details($domain, $domain_info),
257
+ 'domain' => $domain,
258
+ 'permalink_url' => admin_url('options-permalink.php'),
259
  'curl_error_message' => UBUtil::array_fetch(
260
  $domain_info,
261
  'failure_message'
264
  };
265
 
266
  add_submenu_page(
267
+ UBConfig::UB_ADMIN_PAGE_MAIN,
268
+ 'Unbounce Pages',
269
+ 'Pages',
270
+ 'manage_options',
271
+ UBConfig::UB_ADMIN_PAGE_MAIN,
272
+ $print_admin_panel
273
+ );
274
+
275
+ add_submenu_page(
276
+ UBConfig::UB_ADMIN_PAGE_MAIN,
277
+ 'Unbounce Pages Settings',
278
+ 'Settings',
279
+ 'manage_options',
280
+ UBConfig::UB_ADMIN_PAGE_SETTINGS,
281
+ $print_settings_panel
282
+ );
283
+
284
+ add_submenu_page(
285
+ UBConfig::UB_ADMIN_PAGE_MAIN,
286
  'Unbounce Pages Diagnostics',
287
+ 'Diagnostics',
288
  'manage_options',
289
+ UBConfig::UB_ADMIN_PAGE_DIAGNOSTICS,
290
  $print_diagnostics_panel
291
  );
292
  });
317
  UBUtil::set_flash('authorization', $authorization);
318
 
319
  status_header(301);
320
+ $location = admin_url('admin.php?page='.UBConfig::UB_ADMIN_PAGE_MAIN);
321
  header("Location: $location");
322
  });
323
 
324
  add_action('admin_post_flush_unbounce_pages', function () {
325
  $domain = UBConfig::domain();
326
+ // Expire cache and redirect
327
  $_domain_info = UBConfig::read_unbounce_domain_info($domain, true);
328
  status_header(301);
329
+ $location = admin_url('admin.php?page='.UBConfig::UB_ADMIN_PAGE_MAIN);
330
  header("Location: $location");
331
  });
css/unbounce-pages.css CHANGED
@@ -1,16 +1,8 @@
1
- .ub-plugin-wrapper {
2
- padding-bottom: 100px;
3
- }
4
-
5
  .ub-logo {
6
- width: 40px;
7
- height: 40px;
8
  float: left;
9
- margin: -10px 10px 0 0;
10
- }
11
-
12
- .ub-unbounce-pages-heading {
13
- margin-top: 30px;
14
  }
15
 
16
  .ub-authorize-message {
 
 
 
 
1
  .ub-logo {
2
+ width: 30px;
3
+ height: 30px;
4
  float: left;
5
+ margin: 10px 10px 0 0;
 
 
 
 
6
  }
7
 
8
  .ub-authorize-message {
img/unbounce-logo-white.png ADDED
Binary file
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: 6.0.2
6
- Stable tag: 1.0.48
7
  Requires PHP: 7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -103,6 +103,9 @@ You should add a rule to your cache to avoid caching Unbounce Pages which have t
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 1.0.48 =
107
  * Tested with WP 6.0
108
 
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: 6.0.2
6
+ Stable tag: 1.0.49
7
  Requires PHP: 7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
103
 
104
  == Changelog ==
105
 
106
+ = 1.0.49 =
107
+ * Added setting to customize response headers forwarded from Unbounce
108
+
109
  = 1.0.48 =
110
  * Tested with WP 6.0
111
 
templates/authorize_button.php CHANGED
@@ -16,11 +16,11 @@
16
  $wrap_in_p,
17
  array(
18
  'data-set-domains-url' => admin_url('admin-post.php?action=set_unbounce_domains'),
19
- 'data-redirect-uri' => admin_url('admin.php?page=unbounce-pages'),
20
  'data-api-url' => UBConfig::api_url(),
21
  'data-api-client-id' => UBConfig::api_client_id(),
22
  'data-wordpress-domain-name' => $domain,
23
  'style' => $style,
24
  )
25
  ); ?>
26
- </form>
16
  $wrap_in_p,
17
  array(
18
  'data-set-domains-url' => admin_url('admin-post.php?action=set_unbounce_domains'),
19
+ 'data-redirect-uri' => admin_url('admin.php?page='.UBConfig::UB_ADMIN_PAGE_MAIN),
20
  'data-api-url' => UBConfig::api_url(),
21
  'data-api-client-id' => UBConfig::api_client_id(),
22
  'data-wordpress-domain-name' => $domain,
23
  'style' => $style,
24
  )
25
  ); ?>
26
+ </form>
templates/diagnostics.php CHANGED
@@ -49,82 +49,76 @@ $diagnostic_descriptions = array(
49
 
50
  ?>
51
 
52
- <div class="ub-plugin-wrapper">
53
- <img class="ub-logo" src="<?php echo $img_url; ?>" />
54
- <h1 class="ub-unbounce-pages-heading">Unbounce Pages Diagnostics</h1>
55
- <a href="<?php echo admin_url('admin.php?page=unbounce-pages'); ?>">Main Plugin Page</a>
56
- <br/>
57
- <ul class="ub-diagnostics-checks">
58
- <?php foreach ($checks as $check => $success) : ?>
59
- <?php $css_class = ($success ? 'dashicons-yes' : 'dashicons-no-alt'); ?>
60
- <li>
61
- <span class='dashicons <?php echo $css_class; ?>'></span>
62
- <?php
63
- echo $check;
64
-
65
- if (!$success) {
66
- foreach ($diagnostic_descriptions as $title => $description) {
67
- if ($title == $check) {
68
- echo '<p class="ub-diagnostics-check-description">' . $description . '</p>';
69
  }
70
- }
71
- }
72
- ?>
73
- </li>
74
- <?php endforeach; ?>
75
- </ul>
76
 
77
- <h2>Troubleshooting Information</h2>
78
- <p>There are a number of known issues with the Unbounce WP Plugin, with different possible causes.</p>
79
 
80
- <div class="info">
81
- <h2>Known issues:</h2>
82
- <ul class="causes">
83
  <li>Unbounce Pages 404ing</li>
84
  <li> Unbounce Pages are not tracking stats</li>
85
  <li>Form Confirmation Dialog isn't loading</li>
86
- <li>Lightboxes aren't loading</li>
87
  <li>Buttons (clkn/clkg) links do not redirect properly</li>
88
  <li>Domain Directory in Unbounce says "Plugin Setup Required"</li>
89
  <li>Seeing Protected Assets after form submission</li>
90
- </ul>
91
 
92
 
93
- <p>Each of the above issues are usually a configuration issue. Please read through our <a href="https://documentation.unbounce.com/hc/en-us/articles/360000393623-Troubleshooting-WordPress-Plugin-Technical-Issues" target="_blank">Troubleshooting Documentation</a> to address each symptom.</p>
94
- </div>
95
 
96
- <div class="info">
97
- <h2>Known Incompatible Plugins:</h2>
98
 
99
- <p>Check that you don’t have any caching plugins installed, or any plugins that affect the order in which Javascript is loaded. These types of plugins will affect how Unbounce pages behave on WordPress.</p>
100
- <ul class="causes">
101
- <li>wp-rocket - This plugin re-orders script tags, which breaks how Javascript loads for Unbounce pages.</li>
102
- <li>wp-super-cache - caching plugins often cause Unbounce pages to 404</li>
103
- <li>wp-total-cache - caching plugins often cause Unbounce pages to 404</li>
104
- <li>Cloudflare - caching plugins often cause Unbounce pages to 404</li>
105
- </ul>
106
- <p>Please see our <a href="https://documentation.unbounce.com/hc/en-us/articles/360000393623-Troubleshooting-WordPress-Plugin-Technical-Issues" target="_blank">Support Documentation</a> for troubleshooting.</p>
107
- </div>
108
 
109
- <div class="info">
110
- <h2>Still having issues? Contact our support team</h2>
111
- <p>If you are experiencing problems with the Unbounce Pages plugin after attempting to troubleshoot the issue, please reach out to our support team at <em>support@unbounce.com</em>.</p>
112
- <p>Please make sure to include the details below, and if possible, please also provide details on your hosting provider.</p>
113
- </div>
114
-
115
- <h2>Details</h2>
116
- <textarea id="ub-diagnostics-text" rows="10" cols="100">
117
- <?php
118
 
119
- foreach ($details as $detail_name => $detail) {
120
- echo "[${detail_name}] ${detail}\n";
121
- }
122
-
123
- ?>
124
- </textarea>
125
- <div id="ub-diagnostics-copy-result"></div>
 
 
126
  <?php
127
-
128
  echo get_submit_button(
129
  'Copy to Clipboard',
130
  'primary',
@@ -132,6 +126,5 @@ foreach ($details as $detail_name => $detail) {
132
  false,
133
  array('data-clipboard-target' => '#ub-diagnostics-text')
134
  );
135
-
136
  ?>
137
  </div>
49
 
50
  ?>
51
 
52
+ <div class="wrap">
53
+ <?php echo UBTemplate::render('title'); ?>
54
+ <ul class="ub-diagnostics-checks">
55
+ <?php foreach ($checks as $check => $success) : ?>
56
+ <?php $css_class = ($success ? 'dashicons-yes' : 'dashicons-no-alt'); ?>
57
+ <li>
58
+ <span class='dashicons <?php echo $css_class; ?>'></span>
59
+ <?php
60
+ echo $check;
61
+
62
+ if (!$success) {
63
+ foreach ($diagnostic_descriptions as $title => $description) {
64
+ if ($title == $check) {
65
+ echo '<p class="ub-diagnostics-check-description">' . $description . '</p>';
66
+ }
67
+ }
 
68
  }
69
+ ?>
70
+ </li>
71
+ <?php endforeach; ?>
72
+ </ul>
 
 
73
 
74
+ <h2>Troubleshooting Information</h2>
75
+ <p>There are a number of known issues with the Unbounce WP Plugin, with different possible causes.</p>
76
 
77
+ <div class="info">
78
+ <h2>Known issues:</h2>
79
+ <ul class="causes">
80
  <li>Unbounce Pages 404ing</li>
81
  <li> Unbounce Pages are not tracking stats</li>
82
  <li>Form Confirmation Dialog isn't loading</li>
83
+ <li>Lightboxes aren't loading</li>
84
  <li>Buttons (clkn/clkg) links do not redirect properly</li>
85
  <li>Domain Directory in Unbounce says "Plugin Setup Required"</li>
86
  <li>Seeing Protected Assets after form submission</li>
87
+ </ul>
88
 
89
 
90
+ <p>Each of the above issues are usually a configuration issue. Please read through our <a href="https://documentation.unbounce.com/hc/en-us/articles/360000393623-Troubleshooting-WordPress-Plugin-Technical-Issues" target="_blank">Troubleshooting Documentation</a> to address each symptom.</p>
91
+ </div>
92
 
93
+ <div class="info">
94
+ <h2>Known Incompatible Plugins:</h2>
95
 
96
+ <p>Check that you don’t have any caching plugins installed, or any plugins that affect the order in which Javascript is loaded. These types of plugins will affect how Unbounce pages behave on WordPress.</p>
97
+ <ul class="causes">
98
+ <li>wp-rocket - This plugin re-orders script tags, which breaks how Javascript loads for Unbounce pages.</li>
99
+ <li>wp-super-cache - caching plugins often cause Unbounce pages to 404</li>
100
+ <li>wp-total-cache - caching plugins often cause Unbounce pages to 404</li>
101
+ <li>Cloudflare - caching plugins often cause Unbounce pages to 404</li>
102
+ </ul>
103
+ <p>Please see our <a href="https://documentation.unbounce.com/hc/en-us/articles/360000393623-Troubleshooting-WordPress-Plugin-Technical-Issues" target="_blank">Support Documentation</a> for troubleshooting.</p>
104
+ </div>
105
 
106
+ <div class="info">
107
+ <h2>Still having issues? Contact our support team</h2>
108
+ <p>If you are experiencing problems with the Unbounce Pages plugin after attempting to troubleshoot the issue, please reach out to our support team at <em>support@unbounce.com</em>.</p>
109
+ <p>Please make sure to include the details below, and if possible, please also provide details on your hosting provider.</p>
110
+ </div>
 
 
 
 
111
 
112
+ <h2>Details</h2>
113
+ <textarea id="ub-diagnostics-text" rows="10" cols="100">
114
+ <?php
115
+ foreach ($details as $detail_name => $detail) {
116
+ echo "[${detail_name}] ${detail}\n";
117
+ }
118
+ ?>
119
+ </textarea>
120
+ <div id="ub-diagnostics-copy-result"></div>
121
  <?php
 
122
  echo get_submit_button(
123
  'Copy to Clipboard',
124
  'primary',
126
  false,
127
  array('data-clipboard-target' => '#ub-diagnostics-text')
128
  );
 
129
  ?>
130
  </div>
templates/main.php CHANGED
@@ -1,13 +1,12 @@
1
  <?php
2
 
3
- echo '<div class="ub-plugin-wrapper>';
4
 
5
  $is_authorized = UBConfig::is_authorized_domain($domain);
6
 
7
  echo UBTemplate::render(
8
  'main_header',
9
  array(
10
- 'img_url' => plugins_url('img/unbounce-logo-blue.png', __FILE__),
11
  'is_authorized' => $is_authorized,
12
  'authorization' => UBUtil::get_flash('authorization'),
13
  'show_warning' => UBDiagnostics::should_show_warning($domain, $domain_info)
1
  <?php
2
 
3
+ echo '<div class="wrap">';
4
 
5
  $is_authorized = UBConfig::is_authorized_domain($domain);
6
 
7
  echo UBTemplate::render(
8
  'main_header',
9
  array(
 
10
  'is_authorized' => $is_authorized,
11
  'authorization' => UBUtil::get_flash('authorization'),
12
  'show_warning' => UBDiagnostics::should_show_warning($domain, $domain_info)
templates/main_authorized_footer.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  $flush_pages_url = admin_url('admin-post.php');
4
- $diagnostics_url = admin_url('admin.php?page=unbounce-pages-diagnostics');
5
  $refresh_button = get_submit_button('refreshing the Published Pages list', 'secondary', 'flush-unbounce-pages', false);
6
  ?>
7
 
@@ -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.48</p>
1
  <?php
2
 
3
  $flush_pages_url = admin_url('admin-post.php');
4
+ $diagnostics_url = admin_url('admin.php?page='.UBConfig::UB_ADMIN_PAGE_DIAGNOSTICS);
5
  $refresh_button = get_submit_button('refreshing the Published Pages list', 'secondary', 'flush-unbounce-pages', false);
6
  ?>
7
 
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.49</p>
templates/main_header.php CHANGED
@@ -1,5 +1,4 @@
1
- <img class="ub-logo src=<?php echo $img_url; ?>" />
2
- <h1 class="ub-unbounce-pages-heading">Unbounce Pages</h1>
3
 
4
  <?php if ($authorization === 'success' && $is_authorized) : ?>
5
  <div class="updated"><p>Authorized with Unbounce and WordPress domain successfully enabled.</p></div>
@@ -14,7 +13,7 @@
14
  <div class="error">
15
  <p>
16
  We have identified a configuration issue with this Unbounce Pages Plugin and your WordPress
17
- configuration, please <a href="<?php echo admin_url('admin.php?page=unbounce-pages-diagnostics'); ?>">click here
18
  </a> for more details.
19
  </p>
20
  </div>
1
+ <?php echo UBTemplate::render('title'); ?>
 
2
 
3
  <?php if ($authorization === 'success' && $is_authorized) : ?>
4
  <div class="updated"><p>Authorized with Unbounce and WordPress domain successfully enabled.</p></div>
13
  <div class="error">
14
  <p>
15
  We have identified a configuration issue with this Unbounce Pages Plugin and your WordPress
16
+ configuration, please <a href="<?php echo admin_url('admin.php?page='.UBConfig::UB_ADMIN_PAGE_DIAGNOSTICS); ?>">click here
17
  </a> for more details.
18
  </p>
19
  </div>
templates/main_unauthorized_footer.php CHANGED
@@ -1,7 +1,7 @@
1
  <a href="https://documentation.unbounce.com/hc/en-us/articles/360000393623-Troubleshooting-WordPress-Plugin-Technical-Issues"
2
  target="_blank">Check out our knowledge base.</a>
3
  <br/>
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.48</p>
1
  <a href="https://documentation.unbounce.com/hc/en-us/articles/360000393623-Troubleshooting-WordPress-Plugin-Technical-Issues"
2
  target="_blank">Check out our knowledge base.</a>
3
  <br/>
4
+ <a class="ub-diagnostics-link" href="<?php echo admin_url('admin.php?page='.UBConfig::UB_ADMIN_PAGE_DIAGNOSTICS); ?>">
5
  Click here for troubleshooting and plugin diagnostics
6
  </a>
7
+ <p class="ub-version">Unbounce Version 1.0.49</p>
templates/settings.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (isset($_GET['settings-updated']) && count(get_settings_errors(UBConfig::UB_ADMIN_PAGE_SETTINGS)) === 0) {
3
+ // add settings saved message with the class of "updated"
4
+ add_settings_error(UBConfig::UB_ADMIN_PAGE_SETTINGS, 'unbounce-pages-settings-updated', 'Settings Saved.', 'updated');
5
+ }
6
+ ?>
7
+
8
+ <div class="wrap">
9
+ <?php echo UBTemplate::render('title'); ?>
10
+ <?php settings_errors(UBConfig::UB_ADMIN_PAGE_SETTINGS); ?>
11
+
12
+ <form action="options.php" method="post">
13
+ <?php
14
+ settings_fields(UBConfig::UB_ADMIN_PAGE_SETTINGS);
15
+ do_settings_sections(UBConfig::UB_ADMIN_PAGE_SETTINGS);
16
+ ?>
17
+
18
+ <p class="submit">
19
+ <?php echo get_submit_button('Save Changes', 'button-primary', 'submit', false); ?>
20
+ <button type="button" class="button" onclick="resetInputs()">Reset Defaults</button>
21
+ </p>
22
+ </form>
23
+ <script>
24
+ function resetInputs() {
25
+ const elements = document.getElementsByClassName('ub-settings-input');
26
+ for (const element of elements) {
27
+ if (element.dataset['default']) {
28
+ element.value = element.dataset['default'];
29
+ }
30
+ }
31
+ }
32
+ </script>
33
+ </div>
templates/settings_response_headers_forwarded.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <textarea
2
+ name="<?php echo UBConfig::UB_RESPONSE_HEADERS_FORWARDED_KEY; ?>"
3
+ rows="<?php echo count($value); ?>"
4
+ data-default="<?php echo esc_attr(implode(PHP_EOL, $default)); ?>"
5
+ class="ub-settings-input"><?php echo sanitize_textarea_field(implode(PHP_EOL, $value)); ?></textarea>
6
+
7
+ <p class="description">
8
+ Each line represents an HTTP header sent by Unbounce that is allowed to be forwarded to visitors. In order to forward all headers, set this field to <code>*</code>.
9
+ <strong>Note:</strong> the following headers are always forwarded whether they are listed or not:
10
+ <?php
11
+ $headers = array_map(function ($header) {
12
+ return '<code>'.$header.'</code>';
13
+ }, UBHTTP::$response_headers_always_forwarded);
14
+ echo implode(',', array_slice($headers, 0, -1)).' and '.end($headers);
15
+ ?>
16
+ </p>
templates/title.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <img class="ub-logo" src="<?php echo plugins_url('img/unbounce-logo-white.png', dirname(__FILE__)); ?>" />
2
+ <h1><?php echo esc_html(get_admin_page_title()); ?></h1>