Changeset 1665532
- Timestamp:
- 05/26/2017 06:25:08 PM (9 years ago)
- Location:
- unbounce
- Files:
-
- 16 edited
- 1 copied
-
tags/1.0.34 (copied) (copied from unbounce/trunk)
-
tags/1.0.34/UBConfig.php (modified) (2 diffs)
-
tags/1.0.34/UBDiagnostics.php (modified) (7 diffs)
-
tags/1.0.34/UBEvents.php (modified) (1 diff)
-
tags/1.0.34/Unbounce-Page.php (modified) (3 diffs)
-
tags/1.0.34/readme.txt (modified) (2 diffs)
-
tags/1.0.34/templates/diagnostics.php (modified) (1 diff)
-
tags/1.0.34/templates/main_authorized_footer.php (modified) (1 diff)
-
tags/1.0.34/templates/main_unauthorized_footer.php (modified) (1 diff)
-
trunk/UBConfig.php (modified) (2 diffs)
-
trunk/UBDiagnostics.php (modified) (7 diffs)
-
trunk/UBEvents.php (modified) (1 diff)
-
trunk/Unbounce-Page.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/diagnostics.php (modified) (1 diff)
-
trunk/templates/main_authorized_footer.php (modified) (1 diff)
-
trunk/templates/main_unauthorized_footer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
unbounce/tags/1.0.34/UBConfig.php
r1615299 r1665532 6 6 const UB_PLUGIN_NAME = 'ub-wordpress'; 7 7 const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP'; 8 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.3 3';9 const UB_VERSION = '1.0.3 3';8 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.34'; 9 const UB_VERSION = '1.0.34'; 10 10 11 11 // Option keys … … 24 24 const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message'; 25 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'; 26 27 27 28 const UB_LOCK_NAME = 'ub-sql-lock'; -
unbounce/tags/1.0.34/UBDiagnostics.php
r1615299 r1665532 3 3 class UBDiagnostics 4 4 { 5 6 5 const SUPPORTED_PHP_VERSION = '5.3'; 7 6 const SUPPORTED_WP_VERSION = '4.0'; … … 19 18 ); 20 19 } 21 22 20 23 21 public static function system_checks() … … 36 34 UBDiagnostics::SUPPORTED_WP_VERSION, 37 35 '>=' 38 ) 39 ); 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; 40 44 } 41 45 … … 61 65 } 62 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 63 98 public static function details($domain, $domain_info) 64 99 { … … 66 101 'PHP Version' => phpversion(), 67 102 'WordPress Version' => UBDiagnostics::wordpress_version(), 68 'Unbounce Plugin Version' => '1.0.33', 103 'Unbounce Plugin Version' => '1.0.34', 104 'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)), 105 'Options' => self::pp(UBDiagnostics::ub_options()), 69 106 'Permalink Structure' => get_option('permalink_structure', ''), 70 107 '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), 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()), 78 116 'Operating System' => php_uname(), 79 'Checks' => print_r(UBDiagnostics::checks($domain, $domain_info), true), 80 'Options' => print_r(UBDiagnostics::ub_options(), true) 81 ); 117 ); 118 } 119 120 private static function phpConfig() 121 { 122 return ini_get_all(null, false); 82 123 } 83 124 … … 97 138 { 98 139 if (function_exists('curl_version')) { 99 return print_r(curl_version(), true);140 return curl_version(); 100 141 } else { 101 142 return 'N/A'; … … 115 156 return $last_status !== null && $last_status !== 'FAILURE'; 116 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 } 117 221 } -
unbounce/tags/1.0.34/UBEvents.php
r1601650 r1665532 18 18 UBEvents::authorization_event($data) 19 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); 20 38 } 21 39 -
unbounce/tags/1.0.34/Unbounce-Page.php
r1615299 r1665532 4 4 Plugin URI: http://unbounce.com 5 5 Description: Unbounce is the most powerful standalone landing page builder available. 6 Version: 1.0.3 36 Version: 1.0.34 7 7 Author: Unbounce 8 8 Author URI: http://unbounce.com … … 55 55 add_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, ''); 56 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(); 57 61 }); 58 62 … … 181 185 182 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 183 195 UBUtil::clear_flash(); 184 196 -
unbounce/tags/1.0.34/readme.txt
r1615299 r1665532 4 4 Requires at least: 4.1.5 5 5 Tested up to: 4.7.3 6 Stable tag: 1.0.3 36 Stable tag: 1.0.34 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 95 95 == Changelog == 96 96 97 = 1.0.34 = 98 * New diagnostics entry for SSL's SNI Support on WordPress installations 99 * Better 100 97 101 = 1.0.33 = 98 102 * Improved support for PHP 7.1 -
unbounce/tags/1.0.34/templates/diagnostics.php
r1601650 r1665532 60 60 </p> 61 61 <textarea id="ub-diagnostics-text" rows="10" cols="100"> 62 <?php62 <?php 63 63 64 foreach ($details as $detail_name => $detail) {65 echo "[${detail_name}] ${detail}\n";66 }64 foreach ($details as $detail_name => $detail) { 65 echo "[${detail_name}] ${detail}\n"; 66 } 67 67 68 68 ?> -
unbounce/tags/1.0.34/templates/main_authorized_footer.php
r1615299 r1665532 22 22 Click here for troubleshooting and plugin diagnostics 23 23 </a> 24 <p class="ub-version">Unbounce Version 1.0.3 3</p>24 <p class="ub-version">Unbounce Version 1.0.34</p> -
unbounce/tags/1.0.34/templates/main_unauthorized_footer.php
r1615299 r1665532 5 5 Click here for troubleshooting and plugin diagnostics 6 6 </a> 7 <p class="ub-version">Unbounce Version 1.0.3 3</p>7 <p class="ub-version">Unbounce Version 1.0.34</p> -
unbounce/trunk/UBConfig.php
r1615299 r1665532 6 6 const UB_PLUGIN_NAME = 'ub-wordpress'; 7 7 const UB_CACHE_TIMEOUT_ENV_KEY = 'UB_WP_ROUTES_CACHE_EXP'; 8 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.3 3';9 const UB_VERSION = '1.0.3 3';8 const UB_USER_AGENT = 'Unbounce WP Plugin 1.0.34'; 9 const UB_VERSION = '1.0.34'; 10 10 11 11 // Option keys … … 24 24 const UB_PROXY_ERROR_MESSAGE_KEY = 'ub-proxy-error-message'; 25 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'; 26 27 27 28 const UB_LOCK_NAME = 'ub-sql-lock'; -
unbounce/trunk/UBDiagnostics.php
r1615299 r1665532 3 3 class UBDiagnostics 4 4 { 5 6 5 const SUPPORTED_PHP_VERSION = '5.3'; 7 6 const SUPPORTED_WP_VERSION = '4.0'; … … 19 18 ); 20 19 } 21 22 20 23 21 public static function system_checks() … … 36 34 UBDiagnostics::SUPPORTED_WP_VERSION, 37 35 '>=' 38 ) 39 ); 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; 40 44 } 41 45 … … 61 65 } 62 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 63 98 public static function details($domain, $domain_info) 64 99 { … … 66 101 'PHP Version' => phpversion(), 67 102 'WordPress Version' => UBDiagnostics::wordpress_version(), 68 'Unbounce Plugin Version' => '1.0.33', 103 'Unbounce Plugin Version' => '1.0.34', 104 'Checks' => self::pp(UBDiagnostics::checks($domain, $domain_info)), 105 'Options' => self::pp(UBDiagnostics::ub_options()), 69 106 'Permalink Structure' => get_option('permalink_structure', ''), 70 107 '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), 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()), 78 116 'Operating System' => php_uname(), 79 'Checks' => print_r(UBDiagnostics::checks($domain, $domain_info), true), 80 'Options' => print_r(UBDiagnostics::ub_options(), true) 81 ); 117 ); 118 } 119 120 private static function phpConfig() 121 { 122 return ini_get_all(null, false); 82 123 } 83 124 … … 97 138 { 98 139 if (function_exists('curl_version')) { 99 return print_r(curl_version(), true);140 return curl_version(); 100 141 } else { 101 142 return 'N/A'; … … 115 156 return $last_status !== null && $last_status !== 'FAILURE'; 116 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 } 117 221 } -
unbounce/trunk/UBEvents.php
r1601650 r1665532 18 18 UBEvents::authorization_event($data) 19 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); 20 38 } 21 39 -
unbounce/trunk/Unbounce-Page.php
r1615299 r1665532 4 4 Plugin URI: http://unbounce.com 5 5 Description: Unbounce is the most powerful standalone landing page builder available. 6 Version: 1.0.3 36 Version: 1.0.34 7 7 Author: Unbounce 8 8 Author URI: http://unbounce.com … … 55 55 add_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, ''); 56 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(); 57 61 }); 58 62 … … 181 185 182 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 183 195 UBUtil::clear_flash(); 184 196 -
unbounce/trunk/readme.txt
r1615299 r1665532 4 4 Requires at least: 4.1.5 5 5 Tested up to: 4.7.3 6 Stable tag: 1.0.3 36 Stable tag: 1.0.34 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 95 95 == Changelog == 96 96 97 = 1.0.34 = 98 * New diagnostics entry for SSL's SNI Support on WordPress installations 99 * Better 100 97 101 = 1.0.33 = 98 102 * Improved support for PHP 7.1 -
unbounce/trunk/templates/diagnostics.php
r1601650 r1665532 60 60 </p> 61 61 <textarea id="ub-diagnostics-text" rows="10" cols="100"> 62 <?php62 <?php 63 63 64 foreach ($details as $detail_name => $detail) {65 echo "[${detail_name}] ${detail}\n";66 }64 foreach ($details as $detail_name => $detail) { 65 echo "[${detail_name}] ${detail}\n"; 66 } 67 67 68 68 ?> -
unbounce/trunk/templates/main_authorized_footer.php
r1615299 r1665532 22 22 Click here for troubleshooting and plugin diagnostics 23 23 </a> 24 <p class="ub-version">Unbounce Version 1.0.3 3</p>24 <p class="ub-version">Unbounce Version 1.0.34</p> -
unbounce/trunk/templates/main_unauthorized_footer.php
r1615299 r1665532 5 5 Click here for troubleshooting and plugin diagnostics 6 6 </a> 7 <p class="ub-version">Unbounce Version 1.0.3 3</p>7 <p class="ub-version">Unbounce Version 1.0.34</p>
Note: See TracChangeset
for help on using the changeset viewer.