Changeset 1382351
- Timestamp:
- 03/30/2016 11:49:14 PM (9 years ago)
- Location:
- unbounce
- Files:
-
- 16 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
unbounce/tags/1.0.21/UBCompatibility.php
r1372439 r1382351 1 1 <?php 2 2 3 // taken from: http://php.net/manual/en/function.http-response-code.php 3 4 // For 4.3.0 <= PHP <= 5.4.0 4 5 if (!function_exists('http_response_code')) { … … 67 68 } 68 69 70 // taken from: http://php.net/manual/en/function.getallheaders.php 71 if (!function_exists('getallheaders')) 72 { 73 function getallheaders() 74 { 75 $headers = ''; 76 foreach ($_SERVER as $name => $value) 77 { 78 if (substr($name, 0, 5) == 'HTTP_') 79 { 80 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; 81 } 82 } 83 return $headers; 84 } 85 } 86 69 87 ?> -
unbounce/tags/1.0.21/UBConfig.php
r1372439 r1382351 5 5 const UB_PLUGIN_NAME = 'ub-wordpress'; 6 6 const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP'; 7 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.2 0';8 const UB_VERSION = '1.0.2 0';7 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.21'; 8 const UB_VERSION = '1.0.21'; 9 9 10 10 # Option keys … … 286 286 $cache_max_time_default = 10; 287 287 288 $ps_domain = $options_getter(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY );288 $ps_domain = $options_getter(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY, UBConfig::default_page_server_domain()); 289 289 $domains_info = $options_getter(UBConfig::UB_ROUTES_CACHE_KEY); 290 290 $domain_info = UBUtil::array_fetch($domains_info, $domain, array()); -
unbounce/tags/1.0.21/UBDiagnostics.php
r1372439 r1382351 29 29 'PHP Version' => phpversion(), 30 30 'WordPress Version' => UBDiagnostics::wordpress_version(), 31 'Unbounce Plugin Version' => "1.0.2 0",31 'Unbounce Plugin Version' => "1.0.21", 32 32 'Permalink Structure' => get_option('permalink_structure', ''), 33 33 'Domain' => $domain, -
unbounce/tags/1.0.21/UBHTTP.php
r1372439 r1382351 8 8 public static $pie_htc_url = '/PIE.htc'; 9 9 // Suppress Etag and Last-Modified so that browser doesn't send If-None-Match and If-Modified-Since header (to bypass front-end caches) 10 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 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'; 11 public static $request_header_blacklist = '/^(Accept-Encoding:)/i'; 11 12 12 13 public static function is_private_ip_address($ip_address) { … … 71 72 header($result); 72 73 73 } elseif (preg_match(UBHTTP::$ forward_headers, $header_string)) {74 } elseif (preg_match(UBHTTP::$response_header_whitelist, $header_string)) { 74 75 // false means don't replace the exsisting header 75 76 header($header_string, false); … … 127 128 } 128 129 130 // taken from: http://stackoverflow.com/a/13036310/322727 131 private static function convert_headers_to_curl($headers) { 132 // map to curl-friendly format 133 $req_headers = array(); 134 array_walk($headers, function(&$v, $k) use (&$req_headers) { 135 array_push($req_headers, $k . ": " . $v); 136 }); 137 138 return $req_headers; 139 } 140 129 141 public static function stream_request($method, 130 142 $target_url, … … 137 149 $remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR'); 138 150 139 $headers = UBHTTP::get_proxied_for_header($headers0, 151 $headers1 = UBHTTP::convert_headers_to_curl($headers0); 152 $curl_headers = array_filter($headers1, function($key) { 153 return !preg_match(UBHTTP::$request_header_blacklist, $key); 154 }); 155 156 $headers = UBHTTP::get_proxied_for_header($curl_headers, 140 157 $forwarded_for, 141 158 $remote_ip); 142 143 159 UBLogger::debug_var('target_url', $target_url); 144 160 -
unbounce/tags/1.0.21/Unbounce-Page.php
r1372439 r1382351 4 4 Plugin URI: http://unbounce.com 5 5 Description: Unbounce is the most powerful standalone landing page builder available. 6 Version: 1.0.2 06 Version: 1.0.21 7 7 Author: Unbounce 8 8 Author URI: http://unbounce.com … … 22 22 23 23 register_activation_hook(__FILE__, function() { 24 add_ site_option(UBConfig::UB_ROUTES_CACHE_KEY, array());25 add_ site_option(UBConfig::UB_REMOTE_DEBUG_KEY, 0);26 add_ site_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY,27 28 add_ site_option(UBConfig::UB_REMOTE_LOG_URL_KEY,29 30 add_ site_option(UBConfig::UB_API_URL_KEY,31 32 add_ site_option(UBConfig::UB_API_CLIENT_ID_KEY,33 34 add_ site_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY,35 36 add_ site_option(UBConfig::UB_HAS_AUTHORIZED_KEY, '');37 add_ site_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY,38 39 add_ site_option(UBConfig::UB_USER_ID_KEY, '');40 add_ site_option(UBConfig::UB_DOMAIN_ID_KEY, '');41 add_ site_option(UBConfig::UB_CLIENT_ID_KEY, '');42 add_ site_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, '');24 add_option(UBConfig::UB_ROUTES_CACHE_KEY, array()); 25 add_option(UBConfig::UB_REMOTE_DEBUG_KEY, 0); 26 add_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY, 27 UBConfig::default_page_server_domain()); 28 add_option(UBConfig::UB_REMOTE_LOG_URL_KEY, 29 UBConfig::default_remote_log_url()); 30 add_option(UBConfig::UB_API_URL_KEY, 31 UBConfig::default_api_url()); 32 add_option(UBConfig::UB_API_CLIENT_ID_KEY, 33 UBConfig::default_api_client_id()); 34 add_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY, 35 UBConfig::default_authorized_domains()); 36 add_option(UBConfig::UB_HAS_AUTHORIZED_KEY, ''); 37 add_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY, 38 UBConfig::default_remote_events_url()); 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 43 }); 44 44 … … 135 135 $cookie_string = UBHTTP::cookie_string_from_array($cookies_to_forward); 136 136 137 $req_headers = $referer == null ? array('Host: ' . $domain) : array('Referer: ' . $referer, 'Host: ' . $domain); 137 $all_headers = getallheaders(); 138 $all_headers['Host'] = $domain; 138 139 139 140 // Make sure we don't get cached by Wordpress hosts like WPEngine … … 143 144 $raw_url, 144 145 $cookie_string, 145 $ req_headers,146 $all_headers, 146 147 $user_agent); 147 148 -
unbounce/tags/1.0.21/readme.txt
r1372439 r1382351 4 4 Requires at least: 4.1.5 5 5 Tested up to: 4.4 6 Stable tag: 1.0.2 06 Stable tag: 1.0.21 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
unbounce/tags/1.0.21/templates/main_authorized_footer.php
r1372439 r1382351 18 18 </a> 19 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.2 0</p>20 <p class="ub-version">Unbounce Version 1.0.21</p> -
unbounce/tags/1.0.21/templates/main_unauthorized_footer.php
r1372439 r1382351 5 5 Click here for troubleshooting and plugin diagnostics 6 6 </a> 7 <p class="ub-version">Unbounce Version 1.0.2 0</p>7 <p class="ub-version">Unbounce Version 1.0.21</p> -
unbounce/trunk/UBCompatibility.php
r1372439 r1382351 1 1 <?php 2 2 3 // taken from: http://php.net/manual/en/function.http-response-code.php 3 4 // For 4.3.0 <= PHP <= 5.4.0 4 5 if (!function_exists('http_response_code')) { … … 67 68 } 68 69 70 // taken from: http://php.net/manual/en/function.getallheaders.php 71 if (!function_exists('getallheaders')) 72 { 73 function getallheaders() 74 { 75 $headers = ''; 76 foreach ($_SERVER as $name => $value) 77 { 78 if (substr($name, 0, 5) == 'HTTP_') 79 { 80 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; 81 } 82 } 83 return $headers; 84 } 85 } 86 69 87 ?> -
unbounce/trunk/UBConfig.php
r1372439 r1382351 5 5 const UB_PLUGIN_NAME = 'ub-wordpress'; 6 6 const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP'; 7 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.2 0';8 const UB_VERSION = '1.0.2 0';7 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.21'; 8 const UB_VERSION = '1.0.21'; 9 9 10 10 # Option keys … … 286 286 $cache_max_time_default = 10; 287 287 288 $ps_domain = $options_getter(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY );288 $ps_domain = $options_getter(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY, UBConfig::default_page_server_domain()); 289 289 $domains_info = $options_getter(UBConfig::UB_ROUTES_CACHE_KEY); 290 290 $domain_info = UBUtil::array_fetch($domains_info, $domain, array()); -
unbounce/trunk/UBDiagnostics.php
r1372439 r1382351 29 29 'PHP Version' => phpversion(), 30 30 'WordPress Version' => UBDiagnostics::wordpress_version(), 31 'Unbounce Plugin Version' => "1.0.2 0",31 'Unbounce Plugin Version' => "1.0.21", 32 32 'Permalink Structure' => get_option('permalink_structure', ''), 33 33 'Domain' => $domain, -
unbounce/trunk/UBHTTP.php
r1372439 r1382351 8 8 public static $pie_htc_url = '/PIE.htc'; 9 9 // Suppress Etag and Last-Modified so that browser doesn't send If-None-Match and If-Modified-Since header (to bypass front-end caches) 10 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 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'; 11 public static $request_header_blacklist = '/^(Accept-Encoding:)/i'; 11 12 12 13 public static function is_private_ip_address($ip_address) { … … 71 72 header($result); 72 73 73 } elseif (preg_match(UBHTTP::$ forward_headers, $header_string)) {74 } elseif (preg_match(UBHTTP::$response_header_whitelist, $header_string)) { 74 75 // false means don't replace the exsisting header 75 76 header($header_string, false); … … 127 128 } 128 129 130 // taken from: http://stackoverflow.com/a/13036310/322727 131 private static function convert_headers_to_curl($headers) { 132 // map to curl-friendly format 133 $req_headers = array(); 134 array_walk($headers, function(&$v, $k) use (&$req_headers) { 135 array_push($req_headers, $k . ": " . $v); 136 }); 137 138 return $req_headers; 139 } 140 129 141 public static function stream_request($method, 130 142 $target_url, … … 137 149 $remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR'); 138 150 139 $headers = UBHTTP::get_proxied_for_header($headers0, 151 $headers1 = UBHTTP::convert_headers_to_curl($headers0); 152 $curl_headers = array_filter($headers1, function($key) { 153 return !preg_match(UBHTTP::$request_header_blacklist, $key); 154 }); 155 156 $headers = UBHTTP::get_proxied_for_header($curl_headers, 140 157 $forwarded_for, 141 158 $remote_ip); 142 143 159 UBLogger::debug_var('target_url', $target_url); 144 160 -
unbounce/trunk/Unbounce-Page.php
r1372439 r1382351 4 4 Plugin URI: http://unbounce.com 5 5 Description: Unbounce is the most powerful standalone landing page builder available. 6 Version: 1.0.2 06 Version: 1.0.21 7 7 Author: Unbounce 8 8 Author URI: http://unbounce.com … … 22 22 23 23 register_activation_hook(__FILE__, function() { 24 add_ site_option(UBConfig::UB_ROUTES_CACHE_KEY, array());25 add_ site_option(UBConfig::UB_REMOTE_DEBUG_KEY, 0);26 add_ site_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY,27 28 add_ site_option(UBConfig::UB_REMOTE_LOG_URL_KEY,29 30 add_ site_option(UBConfig::UB_API_URL_KEY,31 32 add_ site_option(UBConfig::UB_API_CLIENT_ID_KEY,33 34 add_ site_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY,35 36 add_ site_option(UBConfig::UB_HAS_AUTHORIZED_KEY, '');37 add_ site_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY,38 39 add_ site_option(UBConfig::UB_USER_ID_KEY, '');40 add_ site_option(UBConfig::UB_DOMAIN_ID_KEY, '');41 add_ site_option(UBConfig::UB_CLIENT_ID_KEY, '');42 add_ site_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, '');24 add_option(UBConfig::UB_ROUTES_CACHE_KEY, array()); 25 add_option(UBConfig::UB_REMOTE_DEBUG_KEY, 0); 26 add_option(UBConfig::UB_PAGE_SERVER_DOMAIN_KEY, 27 UBConfig::default_page_server_domain()); 28 add_option(UBConfig::UB_REMOTE_LOG_URL_KEY, 29 UBConfig::default_remote_log_url()); 30 add_option(UBConfig::UB_API_URL_KEY, 31 UBConfig::default_api_url()); 32 add_option(UBConfig::UB_API_CLIENT_ID_KEY, 33 UBConfig::default_api_client_id()); 34 add_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY, 35 UBConfig::default_authorized_domains()); 36 add_option(UBConfig::UB_HAS_AUTHORIZED_KEY, ''); 37 add_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY, 38 UBConfig::default_remote_events_url()); 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 43 }); 44 44 … … 135 135 $cookie_string = UBHTTP::cookie_string_from_array($cookies_to_forward); 136 136 137 $req_headers = $referer == null ? array('Host: ' . $domain) : array('Referer: ' . $referer, 'Host: ' . $domain); 137 $all_headers = getallheaders(); 138 $all_headers['Host'] = $domain; 138 139 139 140 // Make sure we don't get cached by Wordpress hosts like WPEngine … … 143 144 $raw_url, 144 145 $cookie_string, 145 $ req_headers,146 $all_headers, 146 147 $user_agent); 147 148 -
unbounce/trunk/readme.txt
r1372439 r1382351 4 4 Requires at least: 4.1.5 5 5 Tested up to: 4.4 6 Stable tag: 1.0.2 06 Stable tag: 1.0.21 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
unbounce/trunk/templates/main_authorized_footer.php
r1372439 r1382351 18 18 </a> 19 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.2 0</p>20 <p class="ub-version">Unbounce Version 1.0.21</p> -
unbounce/trunk/templates/main_unauthorized_footer.php
r1372439 r1382351 5 5 Click here for troubleshooting and plugin diagnostics 6 6 </a> 7 <p class="ub-version">Unbounce Version 1.0.2 0</p>7 <p class="ub-version">Unbounce Version 1.0.21</p>
Note: See TracChangeset
for help on using the changeset viewer.