Plugin Directory

Changeset 1382351


Ignore:
Timestamp:
03/30/2016 11:49:14 PM (9 years ago)
Author:
unbouncewordpress
Message:

Releasing version 1.0.21

Location:
unbounce
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • unbounce/tags/1.0.21/UBCompatibility.php

    r1372439 r1382351  
    11<?php
    22
     3// taken from: http://php.net/manual/en/function.http-response-code.php
    34// For 4.3.0 <= PHP <= 5.4.0
    45if (!function_exists('http_response_code')) {
     
    6768}
    6869
     70// taken from: http://php.net/manual/en/function.getallheaders.php
     71if (!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
    6987?>
  • unbounce/tags/1.0.21/UBConfig.php

    r1372439 r1382351  
    55  const UB_PLUGIN_NAME           = 'ub-wordpress';
    66  const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
    7   const UB_USER_AGENT            = 'Unbounce WP Plugin 1.0.20';
    8   const UB_VERSION               = '1.0.20';
     7  const UB_USER_AGENT            = 'Unbounce WP Plugin 1.0.21';
     8  const UB_VERSION               = '1.0.21';
    99
    1010  # Option keys
     
    286286    $cache_max_time_default = 10;
    287287
    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());
    289289    $domains_info = $options_getter(UBConfig::UB_ROUTES_CACHE_KEY);
    290290    $domain_info = UBUtil::array_fetch($domains_info, $domain, array());
  • unbounce/tags/1.0.21/UBDiagnostics.php

    r1372439 r1382351  
    2929      'PHP Version'             => phpversion(),
    3030      'WordPress Version'       => UBDiagnostics::wordpress_version(),
    31       'Unbounce Plugin Version' => "1.0.20",
     31      'Unbounce Plugin Version' => "1.0.21",
    3232      'Permalink Structure'     => get_option('permalink_structure', ''),
    3333      'Domain'                  => $domain,
  • unbounce/tags/1.0.21/UBHTTP.php

    r1372439 r1382351  
    88  public static $pie_htc_url = '/PIE.htc';
    99  // 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';
    1112
    1213  public static function is_private_ip_address($ip_address) {
     
    7172        header($result);
    7273
    73       } elseif (preg_match(UBHTTP::$forward_headers, $header_string)) {
     74      } elseif (preg_match(UBHTTP::$response_header_whitelist, $header_string)) {
    7475        // false means don't replace the exsisting header
    7576        header($header_string, false);
     
    127128  }
    128129
     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
    129141  public static function stream_request($method,
    130142                                        $target_url,
     
    137149    $remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR');
    138150
    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,
    140157                                              $forwarded_for,
    141158                                              $remote_ip);
    142 
    143159    UBLogger::debug_var('target_url', $target_url);
    144160
  • unbounce/tags/1.0.21/Unbounce-Page.php

    r1372439 r1382351  
    44Plugin URI: http://unbounce.com
    55Description: Unbounce is the most powerful standalone landing page builder available.
    6 Version: 1.0.20
     6Version: 1.0.21
    77Author: Unbounce
    88Author URI: http://unbounce.com
     
    2222
    2323register_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                   UBConfig::default_page_server_domain());
    28   add_site_option(UBConfig::UB_REMOTE_LOG_URL_KEY,
    29                   UBConfig::default_remote_log_url());
    30   add_site_option(UBConfig::UB_API_URL_KEY,
    31                   UBConfig::default_api_url());
    32   add_site_option(UBConfig::UB_API_CLIENT_ID_KEY,
    33                   UBConfig::default_api_client_id());
    34   add_site_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY,
    35                   UBConfig::default_authorized_domains());
    36   add_site_option(UBConfig::UB_HAS_AUTHORIZED_KEY, '');
    37   add_site_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY,
    38                   UBConfig::default_remote_events_url());
    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, '');
    4343});
    4444
     
    135135    $cookie_string = UBHTTP::cookie_string_from_array($cookies_to_forward);
    136136
    137     $req_headers = $referer == null ? array('Host: ' . $domain) : array('Referer: ' . $referer, 'Host: ' . $domain);
     137    $all_headers = getallheaders();
     138    $all_headers['Host'] = $domain;
    138139
    139140    // Make sure we don't get cached by Wordpress hosts like WPEngine
     
    143144                                                      $raw_url,
    144145                                                      $cookie_string,
    145                                                       $req_headers,
     146                                                      $all_headers,
    146147                                                      $user_agent);
    147148
  • unbounce/tags/1.0.21/readme.txt

    r1372439 r1382351  
    44Requires at least: 4.1.5
    55Tested up to: 4.4
    6 Stable tag: 1.0.20
     6Stable tag: 1.0.21
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • unbounce/tags/1.0.21/templates/main_authorized_footer.php

    r1372439 r1382351  
    1818</a>
    1919<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.20</p>
     20<p class="ub-version">Unbounce Version 1.0.21</p>
  • unbounce/tags/1.0.21/templates/main_unauthorized_footer.php

    r1372439 r1382351  
    55  Click here for troubleshooting and plugin diagnostics
    66</a>
    7 <p class="ub-version">Unbounce Version 1.0.20</p>
     7<p class="ub-version">Unbounce Version 1.0.21</p>
  • unbounce/trunk/UBCompatibility.php

    r1372439 r1382351  
    11<?php
    22
     3// taken from: http://php.net/manual/en/function.http-response-code.php
    34// For 4.3.0 <= PHP <= 5.4.0
    45if (!function_exists('http_response_code')) {
     
    6768}
    6869
     70// taken from: http://php.net/manual/en/function.getallheaders.php
     71if (!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
    6987?>
  • unbounce/trunk/UBConfig.php

    r1372439 r1382351  
    55  const UB_PLUGIN_NAME           = 'ub-wordpress';
    66  const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP';
    7   const UB_USER_AGENT            = 'Unbounce WP Plugin 1.0.20';
    8   const UB_VERSION               = '1.0.20';
     7  const UB_USER_AGENT            = 'Unbounce WP Plugin 1.0.21';
     8  const UB_VERSION               = '1.0.21';
    99
    1010  # Option keys
     
    286286    $cache_max_time_default = 10;
    287287
    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());
    289289    $domains_info = $options_getter(UBConfig::UB_ROUTES_CACHE_KEY);
    290290    $domain_info = UBUtil::array_fetch($domains_info, $domain, array());
  • unbounce/trunk/UBDiagnostics.php

    r1372439 r1382351  
    2929      'PHP Version'             => phpversion(),
    3030      'WordPress Version'       => UBDiagnostics::wordpress_version(),
    31       'Unbounce Plugin Version' => "1.0.20",
     31      'Unbounce Plugin Version' => "1.0.21",
    3232      'Permalink Structure'     => get_option('permalink_structure', ''),
    3333      'Domain'                  => $domain,
  • unbounce/trunk/UBHTTP.php

    r1372439 r1382351  
    88  public static $pie_htc_url = '/PIE.htc';
    99  // 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';
    1112
    1213  public static function is_private_ip_address($ip_address) {
     
    7172        header($result);
    7273
    73       } elseif (preg_match(UBHTTP::$forward_headers, $header_string)) {
     74      } elseif (preg_match(UBHTTP::$response_header_whitelist, $header_string)) {
    7475        // false means don't replace the exsisting header
    7576        header($header_string, false);
     
    127128  }
    128129
     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
    129141  public static function stream_request($method,
    130142                                        $target_url,
     
    137149    $remote_ip = UBUtil::array_fetch($_SERVER, 'REMOTE_ADDR');
    138150
    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,
    140157                                              $forwarded_for,
    141158                                              $remote_ip);
    142 
    143159    UBLogger::debug_var('target_url', $target_url);
    144160
  • unbounce/trunk/Unbounce-Page.php

    r1372439 r1382351  
    44Plugin URI: http://unbounce.com
    55Description: Unbounce is the most powerful standalone landing page builder available.
    6 Version: 1.0.20
     6Version: 1.0.21
    77Author: Unbounce
    88Author URI: http://unbounce.com
     
    2222
    2323register_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                   UBConfig::default_page_server_domain());
    28   add_site_option(UBConfig::UB_REMOTE_LOG_URL_KEY,
    29                   UBConfig::default_remote_log_url());
    30   add_site_option(UBConfig::UB_API_URL_KEY,
    31                   UBConfig::default_api_url());
    32   add_site_option(UBConfig::UB_API_CLIENT_ID_KEY,
    33                   UBConfig::default_api_client_id());
    34   add_site_option(UBConfig::UB_AUTHORIZED_DOMAINS_KEY,
    35                   UBConfig::default_authorized_domains());
    36   add_site_option(UBConfig::UB_HAS_AUTHORIZED_KEY, '');
    37   add_site_option(UBConfig::UB_REMOTE_EVENTS_URL_KEY,
    38                   UBConfig::default_remote_events_url());
    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, '');
    4343});
    4444
     
    135135    $cookie_string = UBHTTP::cookie_string_from_array($cookies_to_forward);
    136136
    137     $req_headers = $referer == null ? array('Host: ' . $domain) : array('Referer: ' . $referer, 'Host: ' . $domain);
     137    $all_headers = getallheaders();
     138    $all_headers['Host'] = $domain;
    138139
    139140    // Make sure we don't get cached by Wordpress hosts like WPEngine
     
    143144                                                      $raw_url,
    144145                                                      $cookie_string,
    145                                                       $req_headers,
     146                                                      $all_headers,
    146147                                                      $user_agent);
    147148
  • unbounce/trunk/readme.txt

    r1372439 r1382351  
    44Requires at least: 4.1.5
    55Tested up to: 4.4
    6 Stable tag: 1.0.20
     6Stable tag: 1.0.21
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • unbounce/trunk/templates/main_authorized_footer.php

    r1372439 r1382351  
    1818</a>
    1919<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.20</p>
     20<p class="ub-version">Unbounce Version 1.0.21</p>
  • unbounce/trunk/templates/main_unauthorized_footer.php

    r1372439 r1382351  
    55  Click here for troubleshooting and plugin diagnostics
    66</a>
    7 <p class="ub-version">Unbounce Version 1.0.20</p>
     7<p class="ub-version">Unbounce Version 1.0.21</p>
Note: See TracChangeset for help on using the changeset viewer.