Call Now Button - Version 1.0.2

Version Description

= * Fixes a domain name bug which caused a very sticky warning notice during the upgrade process

Download this release

Release Info

Developer jasperroel
Plugin Icon 128x128 Call Now Button
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

call-now-button.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
  Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
6
- Version: 1.0.1
7
  Author: Jerry Rietveld
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
@@ -26,7 +26,7 @@ License: GPL2
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
- define('CNB_VERSION', '1.0.1');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
  Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
6
+ Version: 1.0.2
7
  Author: Jerry Rietveld
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
+ define('CNB_VERSION', '1.0.2');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: call button, click to call, convert, call now button, contact button
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.8
8
- Stable tag: 1.0.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -111,6 +111,9 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
111
 
112
 
113
  == Changelog ==
 
 
 
114
  = 1.0.1 =
115
  * Fix upgrade flow
116
 
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.8
8
+ Stable tag: 1.0.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
111
 
112
 
113
  == Changelog ==
114
+ = 1.0.2 =
115
+ * Fixes a domain name bug which caused a very sticky warning notice during the upgrade process
116
+
117
  = 1.0.1 =
118
  * Fix upgrade flow
119
 
src/admin/api/CnbAppRemote.php CHANGED
@@ -160,7 +160,11 @@ class CnbAppRemote {
160
 
161
  $url = parse_url($siteUrl, PHP_URL_HOST);
162
  if ($url) {
163
- return strtolower($url);
 
 
 
 
164
  }
165
 
166
  // Fallback behavior
@@ -168,10 +172,17 @@ class CnbAppRemote {
168
  // 1: Strip everything after // (so to remove a potential protocol like http(s)://
169
  // 2: Strip the port if found, via :1234
170
  // 3: Strip everything after /, so that "example.org/test" becomes "example.org"
171
-
172
- return strtolower(preg_replace( '/\/.*/', '',
173
- preg_replace( '/:[0-9]+/', '',
174
- preg_replace( '/.*\/\//', '', $siteUrl, 1 ), 1 ), 1 ));
 
 
 
 
 
 
 
175
  }
176
 
177
  /**
160
 
161
  $url = parse_url($siteUrl, PHP_URL_HOST);
162
  if ($url) {
163
+ return
164
+ preg_replace('/^www\./', '',
165
+ trim(
166
+ strtolower($url))
167
+ , 1);
168
  }
169
 
170
  // Fallback behavior
172
  // 1: Strip everything after // (so to remove a potential protocol like http(s)://
173
  // 2: Strip the port if found, via :1234
174
  // 3: Strip everything after /, so that "example.org/test" becomes "example.org"
175
+ // 4: Lowercase & trim everything
176
+ // 5: Remove a potential "www." prefix
177
+
178
+ return
179
+ preg_replace('/^www\./', '',
180
+ trim(
181
+ strtolower(preg_replace( '/\/.*/', '',
182
+ preg_replace( '/:[0-9]+/', '',
183
+ preg_replace( '/.*\/\//', '', $siteUrl, 1 ), 1 ), 1 ))
184
+ )
185
+ , 1);
186
  }
187
 
188
  /**