Call Now Button - Version 0.3.4

Version Description

= * Bug fix for function causing 500 error on some versions of PHP * Added feature to increase or decrease the button size * Added feature to change the z-index of the button with a slider

Download this release

Release Info

Developer jgrietveld
Plugin Icon 128x128 Call Now Button
Version 0.3.4
Comparing to
See all releases

Code changes from version 0.3.3 to 0.3.4

Files changed (4) hide show
  1. call-now-button.css +10 -0
  2. call-now-button.js +11 -1
  3. call-now-button.php +54 -14
  4. readme.txt +8 -3
call-now-button.css CHANGED
@@ -47,6 +47,16 @@ p.submit,
47
.red-background {
48
background-color: #ffdbdb !important;
49
}
50
51
@media screen and (min-width: 960px) {
52
.radio-item {
47
.red-background {
48
background-color: #ffdbdb !important;
49
}
50
+ #cnb_slider_value {
51
+ font-weight: normal;
52
+ }
53
+ input[type='range'] {
54
+ position: relative;
55
+ top: 8px;
56
+ }
57
+ .cnb_slider_value {
58
+ font-weight: normal;
59
+ }
60
61
@media screen and (min-width: 960px) {
62
.radio-item {
call-now-button.js CHANGED
@@ -25,4 +25,14 @@ jQuery(document).ready(function($){
25
scrollTop: $("tr.classic").offset().top
26
}, 500);
27
});
28
- });
25
scrollTop: $("tr.classic").offset().top
26
}, 500);
27
});
28
+ $("a#paypalLink").click(function(e){
29
+ e.preventDefault();
30
+ $("#paypal").click();
31
+ });
32
+ });
33
+ var cnb_slider = document.getElementById("cnb_slider");
34
+ var cnb_slider_value = document.getElementById("cnb_slider_value");
35
+ cnb_slider_value.innerHTML = Math.round(cnb_slider.value * 100) + "%";
36
+ cnb_slider.oninput = function() {
37
+ cnb_slider_value.innerHTML = Math.round(this.value * 100) + "%";
38
+ }
call-now-button.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Call Now Button
4
Plugin URI: http://callnowbutton.com
5
Description: Mobile visitors will see a call now button fixed at the bottom of your site
6
- Version: 0.3.3
7
Author: Jerry Rietveld
8
Author URI: http://www.jgrietveld.com
9
License: GPL2
@@ -26,7 +26,7 @@ License: GPL2
26
*/
27
?>
28
<?php
29
- define('CNB_VERSION','0.3.3');
30
define('CNB_BASENAME', plugin_basename( __FILE__ ) );
31
define('CNB_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
32
define('CNB_FILENAME', str_replace( CNB_BASEFOLDER.'/', '', CNB_BASENAME ) );
@@ -36,6 +36,7 @@ add_action('admin_init', 'cnb_options_init');
36
$cnb_changelog =
37
array(
38
array(
39
'3.3' => 'Some small improvements.',
40
'3.2' => 'Option to hide icon in text button, small bug fixes.',
41
'3.1' => 'You can now add text to your button and it\'s possible to switch between including and excluding specific pages.',
@@ -56,7 +57,9 @@ $cnb_options['hideIcon'] = isset($cnb_options['hideIcon']) ? $cnb_options['hideI
56
57
$plugin_title = apply_filters( 'cnb_plugin_title', 'Call Now Button');
58
59
- add_action( 'admin_enqueue_scripts', 'cnb_enqueue_color_picker' ); // add the color picker
60
61
function register_cnb_page() {
62
global $plugin_title;
@@ -116,8 +119,8 @@ function call_now_settings_page() {
116
// Display notification that there's a caching plugin active
117
if(isset($_GET['settings-updated'])) {
118
$cnb_caching_check = cnb_check_for_caching();
119
- if(is_array($cnb_caching_check)) {
120
- echo '<div class="notice-error notice"><p><span class="dashicons dashicons-warning"></span> Your website is using a <strong><i>Caching Plugin</i></strong> ('.$cnb_caching_check[0].'). If you\'re not seeing your button or your changes, make sure you empty your cache first.</p></div>';
121
}
122
}
123
@@ -231,6 +234,19 @@ function call_now_settings_page() {
231
232
</td>
233
</tr>
234
<tr valign="top" class="classic">
235
<th scope="row">Back to old button design:</th>
236
<td>
@@ -249,9 +265,11 @@ function call_now_settings_page() {
249
<p class="cnb-url cnb-center"><a href="http://callnowbutton.com" target="_blank">callnowbutton.com</a></p>
250
251
<hr>
252
<p class="cnb-center cnb-spacing">
253
<a href="http://callnowbutton.com/support/" target="_blank" title="Support">Support</a> &middot;
254
<a href="http://callnowbutton.com/feature-request/" target="_blank" title="Feature Requests">Suggestions</a> &middot;
255
<a href="http://callnowbutton.com/praise/" target="_blank" title="Praise">Just say thanks :-)</a>
256
</p>
257
<!--// Display notification about the testing program -->
@@ -266,7 +284,7 @@ function call_now_settings_page() {
266
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
267
<input type="hidden" name="cmd" value="_s-xclick">
268
<input type="hidden" name="hosted_button_id" value="Q82GBVSERC9AW">
269
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
270
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
271
</form>
272
</div><!--.donate-->
@@ -298,13 +316,13 @@ if(get_option('cnb') && !is_admin()) {
298
$ButtonAppearance = "width:100px;right:0;border-bottom-left-radius:40px; border-top-left-radius:40px;";
299
}
300
301
- $credits .= "<style>#callnowbutton {display:none;} @media screen and (max-width:650px){#callnowbutton {display:block; ".$ButtonAppearance." height:80px; position:fixed; bottom:-20px; border-top:2px solid ".changeColor($cnb_options['color'],'lighter')."; background:url(data:image/svg+xml;base64,".svg(changeColor($cnb_options['color'], 'darker') ).") center 2px no-repeat ".$cnb_options['color']."; text-decoration:none; box-shadow:0 0 5px #888; z-index:2147483647;background-size:58px 58px}".$ButtonExtra."}</style>\n";
302
303
} else {
304
// NEWEST BUTTON DESIGN
305
$credits = "\n<!-- Call Now Button ".CNB_VERSION." by Jerry Rietveld (callnowbutton.com) -->\n";
306
307
- $ButtonShape = "width:65px; height:65px; border-radius:50%; border-top:1px solid ".changeColor($cnb_options['color'], 'lighter')."; bottom:15px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);";
308
309
if($cnb_options['appearance'] == 'full' || $showTextButton) {
310
$ButtonAppearance = "width:100%;left:0;bottom:0;height:60px;border-top:1px solid ".changeColor($cnb_options['color'], 'lighter')."; border-bottom:1px solid ".changeColor($cnb_options['color'], 'darker').";";
@@ -312,7 +330,7 @@ if(get_option('cnb') && !is_admin()) {
312
if($showTextButton) {
313
$ButtonAppearance .= "text-shadow: 0 1px ".changeColor($cnb_options['color'], 'darker')."; text-align:center;color:#fff; font-weight:600; font-size:120%; overflow: hidden;";
314
if(!isset($cnb_options['hideIcon'])) {
315
- $ButtonAppearance .= 'padding-right:27px;';
316
}
317
}
318
}
@@ -327,7 +345,7 @@ if(get_option('cnb') && !is_admin()) {
327
}
328
329
$credits = $credits ."<style>";
330
- $credits .= "#callnowbutton {display:none;} @media screen and (max-width:650px){#callnowbutton {display:block; position:fixed; text-decoration:none; z-index:2147483647;";
331
$credits .= $ButtonAppearance;
332
if(!$showTextButton) {
333
$credits .= "background:url(data:image/svg+xml;base64,".svg(changeColor($cnb_options['color'], 'darker') ).") center/50px 50px no-repeat ".$cnb_options['color'].";";
@@ -367,7 +385,7 @@ if(get_option('cnb') && !is_admin()) {
367
} elseif(isset($cnb_options['hideIcon'])) {
368
$buttonText = $cnb_options['text'];
369
} else {
370
- $buttonText = '<img src="data:image/svg+xml;base64,'.svg(changeColor($cnb_options['color'], 'darker')).'" width="55">'. $cnb_options['text'];
371
}
372
373
$callLink = '<a href="tel:'.$cnb_options['number'].'" id="callnowbutton" '.$tracking.'>'.$buttonText.'</a>';
@@ -402,6 +420,8 @@ function cnb_get_options() { // Grabbing existing settings and creating them if
402
'tracking' => 0,
403
'show' => '',
404
'limit' => 'include',
405
'version' => CNB_VERSION
406
);
407
add_option('cnb',$default_options);
@@ -445,6 +465,8 @@ function cnb_update_options() {
445
'tracking' => $cnb_options['tracking'],
446
'show' => $cnb_options['show'],
447
'limit' => $cnb_options['limit'],
448
'version' => CNB_VERSION
449
);
450
if(array_key_exists('classic', $cnb_options) && $cnb_options['classic'] == 1 ) {
@@ -481,6 +503,21 @@ function buttonActive() {
481
if(isset($cnb_options['active'])) { $output = true; } else { $output = false; }
482
return $output;
483
}
484
485
function cnb_check_for_caching() {
486
$caching_plugins = array(
@@ -497,13 +534,16 @@ function cnb_check_for_caching() {
497
'wp-fastest-cache/wpFastestCache.php',
498
'wp-super-cache/wp-cache.php'
499
);
500
foreach ($caching_plugins as $plugin) {
501
if ( is_plugin_active( $plugin ) ) {
502
- $output = TRUE;
503
- $output = array(explode('/', $plugin)[0], TRUE);
504
break;
505
}
506
}
507
- return isset($output) ? $output : FALSE;
508
}
509
?>
3
Plugin Name: Call Now Button
4
Plugin URI: http://callnowbutton.com
5
Description: Mobile visitors will see a call now button fixed at the bottom of your site
6
+ Version: 0.3.4
7
Author: Jerry Rietveld
8
Author URI: http://www.jgrietveld.com
9
License: GPL2
26
*/
27
?>
28
<?php
29
+ define('CNB_VERSION','0.3.4');
30
define('CNB_BASENAME', plugin_basename( __FILE__ ) );
31
define('CNB_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
32
define('CNB_FILENAME', str_replace( CNB_BASEFOLDER.'/', '', CNB_BASENAME ) );
36
$cnb_changelog =
37
array(
38
array(
39
+ '3.4' => 'Option to resize your button and change where it sits in the stack order (z-index).',
40
'3.3' => 'Some small improvements.',
41
'3.2' => 'Option to hide icon in text button, small bug fixes.',
42
'3.1' => 'You can now add text to your button and it\'s possible to switch between including and excluding specific pages.',
57
58
$plugin_title = apply_filters( 'cnb_plugin_title', 'Call Now Button');
59
60
+ if(isset($_GET['page']) && $_GET['page'] == 'call-now-button') {
61
+ add_action( 'admin_enqueue_scripts', 'cnb_enqueue_color_picker' ); // add the color picker
62
+ }
63
64
function register_cnb_page() {
65
global $plugin_title;
119
// Display notification that there's a caching plugin active
120
if(isset($_GET['settings-updated'])) {
121
$cnb_caching_check = cnb_check_for_caching();
122
+ if($cnb_caching_check[0] == TRUE) {
123
+ echo '<div class="notice-error notice"><p><span class="dashicons dashicons-warning"></span> Your website is using a <strong><i>Caching Plugin</i></strong> ('.$cnb_caching_check[1].'). If you\'re not seeing your button or your changes, make sure you empty your cache first.</p></div>';
124
}
125
}
126
234
235
</td>
236
</tr>
237
+ <tr valign="top" class="zoom">
238
+ <th scope="row">Button size (<span id="cnb_slider_value"></span>):</th>
239
+ <td>
240
+ <label class="cnb_slider_value">Smaller&nbsp;&laquo;&nbsp;</label><input type="range" min="0.7" max="1.3" name="cnb[zoom]" value="<?php echo $cnb_options['zoom']; ?>" class="slider" id="cnb_slider" step="0.1"><label class="cnb_slider_value">&nbsp;&raquo;&nbsp;Bigger</label>
241
+ </td>
242
+ </tr>
243
+ <tr valign="top" class="z-index">
244
+ <th scope="row">Order:</th>
245
+ <td>
246
+ <label class="cnb_slider_value">Backwards&nbsp;&laquo;&nbsp;</label><input type="range" min="1" max="10" name="cnb[z-index]" value="<?php echo $cnb_options['z-index']; ?>" class="slider2" id="cnb_slider2" step="1"><label class="cnb_slider_value">&nbsp;&raquo;&nbsp;Front</label>
247
+ <p class="description">The default (and recommended) value is all the way to the front so the button sits on top of everything else. In case you have a specific usecase where you want something else to sit in front of the Call Now Button (e.g. a chat window or a cookie notice) you can move this backwards one step at a time to adapt it to your situation. <span class="whatsThis">(<a href="http://callnowbutton.com/set-order/" target="_blank">Learn more...</a>)</span></p>
248
+ </td>
249
+ </tr>
250
<tr valign="top" class="classic">
251
<th scope="row">Back to old button design:</th>
252
<td>
265
<p class="cnb-url cnb-center"><a href="http://callnowbutton.com" target="_blank">callnowbutton.com</a></p>
266
267
<hr>
268
+
269
<p class="cnb-center cnb-spacing">
270
<a href="http://callnowbutton.com/support/" target="_blank" title="Support">Support</a> &middot;
271
<a href="http://callnowbutton.com/feature-request/" target="_blank" title="Feature Requests">Suggestions</a> &middot;
272
+ <a href="#donate" id="paypalLink">Donate</a> &middot;
273
<a href="http://callnowbutton.com/praise/" target="_blank" title="Praise">Just say thanks :-)</a>
274
</p>
275
<!--// Display notification about the testing program -->
284
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
285
<input type="hidden" name="cmd" value="_s-xclick">
286
<input type="hidden" name="hosted_button_id" value="Q82GBVSERC9AW">
287
+ <input id="paypal" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
288
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
289
</form>
290
</div><!--.donate-->
316
$ButtonAppearance = "width:100px;right:0;border-bottom-left-radius:40px; border-top-left-radius:40px;";
317
}
318
319
+ $credits .= "<style>#callnowbutton {display:none;} @media screen and (max-width:650px){#callnowbutton {display:block; ".$ButtonAppearance." height:80px; position:fixed; bottom:-20px; border-top:2px solid ".changeColor($cnb_options['color'],'lighter')."; background:url(data:image/svg+xml;base64,".svg(changeColor($cnb_options['color'], 'darker') ).") center 2px no-repeat ".$cnb_options['color']."; text-decoration:none; box-shadow:0 0 5px #888; z-index:".zindex($cnb_options['z-index']).";background-size:58px 58px}".$ButtonExtra."}</style>\n";
320
321
} else {
322
// NEWEST BUTTON DESIGN
323
$credits = "\n<!-- Call Now Button ".CNB_VERSION." by Jerry Rietveld (callnowbutton.com) -->\n";
324
325
+ $ButtonShape = "width:65px; height:65px; border-radius:50%; border-top:1px solid ".changeColor($cnb_options['color'], 'lighter')."; bottom:15px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);transform: scale(" . $cnb_options['zoom'] . ");";
326
327
if($cnb_options['appearance'] == 'full' || $showTextButton) {
328
$ButtonAppearance = "width:100%;left:0;bottom:0;height:60px;border-top:1px solid ".changeColor($cnb_options['color'], 'lighter')."; border-bottom:1px solid ".changeColor($cnb_options['color'], 'darker').";";
330
if($showTextButton) {
331
$ButtonAppearance .= "text-shadow: 0 1px ".changeColor($cnb_options['color'], 'darker')."; text-align:center;color:#fff; font-weight:600; font-size:120%; overflow: hidden;";
332
if(!isset($cnb_options['hideIcon'])) {
333
+ $ButtonAppearance .= 'padding-right:20px;';
334
}
335
}
336
}
345
}
346
347
$credits = $credits ."<style>";
348
+ $credits .= "#callnowbutton {display:none;} @media screen and (max-width:650px){#callnowbutton {display:block; position:fixed; text-decoration:none; z-index:".zindex($cnb_options['z-index']).";";
349
$credits .= $ButtonAppearance;
350
if(!$showTextButton) {
351
$credits .= "background:url(data:image/svg+xml;base64,".svg(changeColor($cnb_options['color'], 'darker') ).") center/50px 50px no-repeat ".$cnb_options['color'].";";
385
} elseif(isset($cnb_options['hideIcon'])) {
386
$buttonText = $cnb_options['text'];
387
} else {
388
+ $buttonText = '<img src="data:image/svg+xml;base64,'.svg(changeColor($cnb_options['color'], 'darker')).'" width="40">'. $cnb_options['text'];
389
}
390
391
$callLink = '<a href="tel:'.$cnb_options['number'].'" id="callnowbutton" '.$tracking.'>'.$buttonText.'</a>';
420
'tracking' => 0,
421
'show' => '',
422
'limit' => 'include',
423
+ 'zoom' => '1',
424
+ 'z-index' => '10',
425
'version' => CNB_VERSION
426
);
427
add_option('cnb',$default_options);
465
'tracking' => $cnb_options['tracking'],
466
'show' => $cnb_options['show'],
467
'limit' => $cnb_options['limit'],
468
+ 'zoom' => '1',
469
+ 'z-index' => '10',
470
'version' => CNB_VERSION
471
);
472
if(array_key_exists('classic', $cnb_options) && $cnb_options['classic'] == 1 ) {
503
if(isset($cnb_options['active'])) { $output = true; } else { $output = false; }
504
return $output;
505
}
506
+ function zindex($value) {
507
+ $zindex = array(
508
+ 10 => 2147483647,
509
+ 9 => 214748365,
510
+ 8 => 21474836,
511
+ 7 => 2147484,
512
+ 6 => 214748,
513
+ 5 => 21475,
514
+ 4 => 2147,
515
+ 3 => 215,
516
+ 2 => 21,
517
+ 1 => 2
518
+ );
519
+ return $zindex[$value];
520
+ }
521
522
function cnb_check_for_caching() {
523
$caching_plugins = array(
534
'wp-fastest-cache/wpFastestCache.php',
535
'wp-super-cache/wp-cache.php'
536
);
537
+ $active = FALSE; //Default is false
538
+ $name = 'none'; // Default name is none
539
foreach ($caching_plugins as $plugin) {
540
if ( is_plugin_active( $plugin ) ) {
541
+ $active = TRUE;
542
+ $name = explode('/', $plugin);
543
+ $name = $name[0];
544
break;
545
}
546
}
547
+ return array($active,$name);
548
}
549
?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jgrietveld
3
Donate link: http://callnowbutton.com/donate/
4
Tags: call, contact, customers, sell, sales, leads, convert, conversions, call now button
5
Requires at least: 2.7
6
- Tested up to: 4.9
7
- Stable tag: 0.3.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -98,9 +98,14 @@ Yes, this is coming soon. We're currently looking for testers so if you want to
98
99
== Changelog ==
100
101
= 0.3.3 =
102
* Check for active caching plugin
103
- * Added links from plugins page to settins page
104
105
= 0.3.2 =
106
* Option to hide icon in text button
3
Donate link: http://callnowbutton.com/donate/
4
Tags: call, contact, customers, sell, sales, leads, convert, conversions, call now button
5
Requires at least: 2.7
6
+ Tested up to: 5.0
7
+ Stable tag: 0.3.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
98
99
== Changelog ==
100
101
+ = 0.3.4 =
102
+ * Bug fix for function causing 500 error on some versions of PHP
103
+ * Added feature to increase or decrease the button size
104
+ * Added feature to change the z-index of the button with a slider
105
+
106
= 0.3.3 =
107
* Check for active caching plugin
108
+ * Added links from plugins page to settings page
109
110
= 0.3.2 =
111
* Option to hide icon in text button