Call Now Button - Version 0.4.6

Version Description

= * Fixed an upgrade regression (caused by the previous bugfix) which forced the position to become a boolean in certain scenarios

Download this release

Release Info

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

Code changes from version 0.4.5 to 0.4.6

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: 0.4.5
7
  Author: Jerry Rietveld
8
  Author URI: http://www.jgrietveld.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', '0.4.5');
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: 0.4.6
7
  Author: Jerry Rietveld
8
  Author URI: http://www.jgrietveld.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', '0.4.6');
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: 0.4.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -110,6 +110,9 @@ This is coming before the end of this year. We're currently looking for testers
110
 
111
 
112
  == Changelog ==
 
 
 
113
  = 0.4.5 =
114
  * Fixed an upgrade regression which forced the position to be FULL in certain scenarios
115
  * Removed HTML element that could overlay the label for certain buttons
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.8
8
+ Stable tag: 0.4.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
110
 
111
 
112
  == Changelog ==
113
+ = 0.4.6 =
114
+ * Fixed an upgrade regression (caused by the previous bugfix) which forced the position to become a boolean in certain scenarios
115
+
116
  = 0.4.5 =
117
  * Fixed an upgrade regression which forced the position to be FULL in certain scenarios
118
  * Removed HTML element that could overlay the label for certain buttons
src/admin/partials/admin-functions.php CHANGED
@@ -10,6 +10,7 @@ function cnb_is_active_tab($tab_name) {
10
 
11
  function cnb_get_changelog() {
12
  return array(
 
13
  '0.4.5' => array(
14
  'Fixed an upgrade regression which forced the position to be FULL in certain scenarios',
15
  'Removed HTML element that could overlay the label for certain buttons'
10
 
11
  function cnb_get_changelog() {
12
  return array(
13
+ '0.4.6' => 'Fixed an upgrade regression (caused by the previous bugfix) which forced the position to become a boolean in certain scenarios',
14
  '0.4.5' => array(
15
  'Fixed an upgrade regression which forced the position to be FULL in certain scenarios',
16
  'Removed HTML element that could overlay the label for certain buttons'
src/utils/utils.php CHANGED
@@ -70,8 +70,12 @@ function cnb_update_needed($cnb_options) {
70
  */
71
  function cnb_update_options() {
72
  $cnb_options = get_option('cnb');
 
 
 
 
 
73
  if(cnb_update_needed($cnb_options)) { // Check current version and if it needs an update
74
- $cnb_defaults = cnb_get_defaults();
75
  $cnb_options['active'] = isset($cnb_options['active'])
76
  ? $cnb_options['active'] == 1 ? 1 : 0
77
  : $cnb_defaults['active'];
@@ -79,7 +83,7 @@ function cnb_update_options() {
79
  $cnb_options['text'] = isset($cnb_options['text']) ? $cnb_options['text'] : $cnb_defaults['text'];
80
  $cnb_options['color'] = !empty($cnb_options['color']) ? $cnb_options['color'] : $cnb_defaults['color'];
81
  $cnb_options['iconcolor'] = isset($cnb_options['iconcolor']) ? $cnb_options['iconcolor'] : $cnb_defaults['iconcolor'];
82
- $cnb_options['appearance'] = !empty($cnb_options['appearance'] ? $cnb_options['appearance']: $cnb_defaults['appearance']);
83
  $cnb_options['hideIcon'] = isset($cnb_options['hideIcon'])
84
  ? $cnb_options['hideIcon'] == 1 ? 1 : 0
85
  : $cnb_defaults['hideIcon'];
70
  */
71
  function cnb_update_options() {
72
  $cnb_options = get_option('cnb');
73
+ $cnb_defaults = cnb_get_defaults();
74
+ // Bugfix for v0.4.5 - a wrong semicolon caused this variable to become a boolean(true) instead of a string
75
+ // This fix checks for that exact scenario and forces it back to the default "right" if needed.
76
+ // If this variable is set correctly (i.e. is a string), it will retain that value
77
+ $cnb_options['appearance'] = ($cnb_options['appearance'] === true) ? $cnb_defaults['appearance'] : $cnb_options['appearance'];
78
  if(cnb_update_needed($cnb_options)) { // Check current version and if it needs an update
 
79
  $cnb_options['active'] = isset($cnb_options['active'])
80
  ? $cnb_options['active'] == 1 ? 1 : 0
81
  : $cnb_defaults['active'];
83
  $cnb_options['text'] = isset($cnb_options['text']) ? $cnb_options['text'] : $cnb_defaults['text'];
84
  $cnb_options['color'] = !empty($cnb_options['color']) ? $cnb_options['color'] : $cnb_defaults['color'];
85
  $cnb_options['iconcolor'] = isset($cnb_options['iconcolor']) ? $cnb_options['iconcolor'] : $cnb_defaults['iconcolor'];
86
+ $cnb_options['appearance'] = !empty($cnb_options['appearance']) ? $cnb_options['appearance']: $cnb_defaults['appearance'];
87
  $cnb_options['hideIcon'] = isset($cnb_options['hideIcon'])
88
  ? $cnb_options['hideIcon'] == 1 ? 1 : 0
89
  : $cnb_defaults['hideIcon'];