Call Now Button - Version 0.2.0

Version Description

= * New circular button design * Option to revert to the old button design * Classic button design still available through advanced settings * Added middle button position * Added admin notices for clarity * Added link to Google Analytics integration manual * More contact links to support and feature requests * Some small design tweaks to admin screen

Download this release

Release Info

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

Code changes from version 0.1.3 to 0.2.0

Files changed (4) hide show
  1. call-now-button.css +54 -0
  2. call-now-button.js +24 -6
  3. call-now-button.php +219 -108
  4. readme.txt +20 -6
call-now-button.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wrap {
2
+ max-width: 1050px;
3
+ }
4
+ .version {
5
+ font-weight: 200;
6
+ }
7
+ .form-table td p.description,
8
+ .inline-helper {
9
+ font-size: 12px;
10
+ }
11
+ .cnb-url a {
12
+ text-decoration: none;
13
+ font-weight: 200;
14
+ font-size: 28px;
15
+ color: black;
16
+ }
17
+ .cnb-center {
18
+ text-align: center;
19
+ }
20
+ #settings {
21
+ display: none;
22
+ }
23
+ .cnb-container input[type="radio"] + label {
24
+ font-weight: 300;
25
+ }
26
+ .cnb-container input[type="radio"]:checked + label {
27
+ font-weight: bold;
28
+ }
29
+ .radio-item {
30
+ margin: 10px 0;
31
+ }
32
+ p.submit,
33
+ .cnb_settings {
34
+ display: inline-block;
35
+ }
36
+ .cnb_settings {
37
+ margin-left: 25px;
38
+ cursor: pointer;
39
+ }
40
+ .check-settings,
41
+ .cnb-switch-back {
42
+ color: #0073aa;
43
+ text-decoration: underline;
44
+ cursor: pointer;
45
+ }
46
+ .red-background {
47
+ background-color: #ffdbdb !important;
48
+ }
49
+
50
+ @media screen and (min-width: 960px) {
51
+ .radio-item {
52
+ margin: 5px 0;
53
+ }
54
+ }
call-now-button.js CHANGED
@@ -1,10 +1,28 @@
1
  jQuery(document).ready(function($){
2
  $('.cnb-color-field').wpColorPicker();
3
- $("#settings").hide();
4
- $(".minus").hide();;
5
- $("h4.cnb_settings").click(function() {
6
- $("#settings").slideToggle();
7
- $(".plus").toggle();
8
- $(".minus").toggle();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  });
10
  });
1
  jQuery(document).ready(function($){
2
  $('.cnb-color-field').wpColorPicker();
3
+ $(".cnb_settings").click(function() {
4
+ $("#settings").slideDown();
5
+ $(".cnb_settings").remove();
6
+ });
7
+ $("span.check-settings").click(function() {
8
+ if($("#settings").is(":hidden")) {
9
+ $("#settings").slideDown('fast');
10
+ $("div.cnb_settings").remove();
11
+ }
12
+ $("tr.appearance input").addClass("red-background").focus();
13
+ $('html, body').animate({
14
+ scrollTop: $("tr.appearance").offset().top
15
+ }, 500);
16
+ $("span.check-settings").remove();
17
+ });
18
+ $(".cnb-switch-back").click(function() {
19
+ if($("#settings").is(":hidden")) {
20
+ $("#settings").slideDown('fast');
21
+ $("div.cnb_settings").remove();
22
+ }
23
+ $("tr.classic ").addClass("red-background").focus();
24
+ $('html, body').animate({
25
+ scrollTop: $("tr.classic").offset().top
26
+ }, 500);
27
  });
28
  });
call-now-button.php CHANGED
@@ -2,15 +2,14 @@
2
  /*
3
  Plugin Name: Call Now Button
4
  Plugin URI: http://callnowbutton.com
5
- Description: Mobile visitors will see a call now button at the bottom of your site
6
- Version: 0.1.3
7
  Author: Jerry Rietveld
8
  Author URI: http://www.jgrietveld.com
9
  License: GPL2
10
  */
11
- ?>
12
- <?php
13
- /* Copyright 2013 Jerry Rietveld (email : jerry@jgrietveld.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
@@ -27,96 +26,171 @@ License: GPL2
27
  */
28
  ?>
29
  <?php
30
- define('CNB_VERSION','0.1.3');
31
  add_action('admin_menu', 'register_cnb_page');
32
  add_action('admin_init', 'cnb_options_init');
33
 
34
- function register_cnb_page() {
35
- add_submenu_page('options-general.php', 'Call Now Button', 'Call Now Button', 'manage_options', 'call-now-button', 'call_now_settings_page');
36
- }
37
- set_basic_options();
38
 
 
 
39
 
40
- // add the color picker
41
- add_action( 'admin_enqueue_scripts', 'cnb_enqueue_color_picker' );
 
 
 
 
 
 
 
 
 
42
  function cnb_enqueue_color_picker( $hook_suffix ) {
43
  wp_enqueue_style( 'wp-color-picker' );
44
- wp_enqueue_script( 'cnb-script-handle', plugins_url('call-now-button.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
 
 
 
45
  }
46
-
47
  function cnb_options_init() {
48
  register_setting('cnb_options','cnb');
 
49
  }
50
- function call_now_settings_page() { ?>
51
- <div class="wrap"><h2>Call Now Button <span style="font-size:12px; font-variant: small-caps; font-family: Verdana, Geneva, sans-serif;">by <a class="pluginhelp" style=" text-decoration:none;" href="http://www.jgrietveld.com" rel="help">Jerry Rietveld</a></span></h2>
52
-
53
-
54
- <form method="post" action="options.php">
55
-             <?php settings_fields('cnb_options'); ?>
56
-             <?php $options = cnb_get_options(); ?>
57
- <h4 style="max-width:700px; text-align:right; margin:0;cursor:pointer; color:#21759b" class="cnb_settings"><span class="plus">+</span><span class="minus">-</span> Advanced settings</h4>
58
- <table class="form-table">
59
- <tr valign="top"><th scope="row">Call Now Button</th>
60
- <td>
61
- <input name="cnb[active]" type="radio" value="1" <?php checked('1', $options['active']); ?> /> Enabled<br />
62
- <input name="cnb[active]" type="radio" value="0" <?php checked('0', $options['active']); ?> /> Disabled
63
- </td>
64
- </tr>
65
-                 <tr valign="top"><th scope="row">Phone number</th>
66
-                     <td><input type="text" name="cnb[number]" value="<?php echo $options['number']; ?>" /></td>
67
-                 </tr>
68
- </table>
69
- <div id="settings">
70
- <table class="form-table">
71
- <tr valign="top"><th scope="row">Button color</th>
72
- <td><input name="cnb[color]" type="text" value="<?php echo $options['color']; ?>" class="cnb-color-field" data-default-color="#009900" /></td>
73
- </tr>
74
- <tr valign="top"><th scope="row">Appearance</th>
75
- <td>
76
- <label title="right">
77
- <input type="radio" name="cnb[appearance]" value="right" <?php checked('right', $options['appearance']); ?>>
78
- <span>Right corner</span>
79
- </label><br />
80
- <label title="left">
81
- <input type="radio" name="cnb[appearance]" value="left" <?php checked('left', $options['appearance']); ?>>
82
- <span>Left corner</span>
83
- </label><br />
84
- <label title="full">
85
- <input type="radio" name="cnb[appearance]" value="full" <?php checked('full', $options['appearance']); ?>>
86
- <span>Full bottom</span>
87
- </label>
88
- </td>
89
- </tr>
90
-                 <tr valign="top"><th scope="row">Click tracking</th>
91
-                     <td><input type="radio" name="cnb[tracking]" value="2" <?php checked('2', $options['tracking']); ?> /> Google Universal Analytics (analytics.js)<br />
92
- <input type="radio" name="cnb[tracking]" value="1" <?php checked('1', $options['tracking']); ?> /> Google Classic Analytics (ga.js)<br />
93
- <input type="radio" name="cnb[tracking]" value="0" <?php checked('0', $options['tracking']); ?> /> Disabled
94
- <p class="description">Once click tracking has been set up and working on your site for a day, go to the Content section of the reports and view Event Tracking.</p></td>
95
-                 </tr>
96
-                 <tr valign="top"><th scope="row">Limit appearance</th>
97
-                     <td><input type="text" name="cnb[show]" value="<?php echo $options['show']; ?>" />
98
- <p class="description">Enter IDs of the posts & pages the Call Now Button should appear on (leave blank for all).</p></td>
99
-                 </tr>
100
-             </table>
101
- </div><!--#settings-->
102
-             <p class="submit">
103
-             <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
104
-             </p>
105
-         </form>
106
-
107
- <h2>Feedback, Requests &amp; Appreciation</h2>
108
- <div class="donate" style="width:160px; float:left; padding:20px; height:70px;">
109
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
110
- <input type="hidden" name="cmd" value="_s-xclick">
111
- <input type="hidden" name="hosted_button_id" value="Q82GBVSERC9AW">
112
- <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!">
113
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
114
- </form>
115
- </div><!--.donate-->
116
-
117
- <p><strong>Feedback:</strong> I'm very interested in hearing your thoughts about the plugin. Please drop me a line on <a href="http://callnowbutton.com">CallNowButton.com</a></p>
118
- <p><strong>Coding requests:</strong> If you have any particular modification request you can hire me to tailor the plugin to meet your needs. You can contact me <a href="http://www.jgrietveld.com/contact-me/">here</a>.</p>
119
- <p><strong>Say thanks:</strong> Developing a plugin takes time and energy. If you like the plugin or use it for clients, consider making a donation. Thanks.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
      </div>
121
  <?php }
122
  if(get_option('cnb') && !is_admin()) {
@@ -139,28 +213,51 @@ if(get_option('cnb') && !is_admin()) {
139
  $options = get_option('cnb');
140
  if(isset($options['active'])) $enabled = $options['active']; else $enabled = 0;
141
  if($enabled == '1') {
142
- // it's enables so put footer stuff here
143
  function cnb_head() {
144
  $options = get_option('cnb');
145
- $credits = "\n<!-- Call Now Button ".CNB_VERSION." by Jerry Rietveld (callnowbutton.com) -->\n";
146
- if($options['appearance'] == 'full') {
147
- $ButtonAppearance = "width:100%;left:0;";
148
- $ButtonExtra = "body {padding-bottom:60px;}";
149
- } elseif($options['appearance'] == 'left') {
150
- $ButtonAppearance = "width:100px;left:0;border-bottom-right-radius:40px; border-top-right-radius:40px;";
151
- $ButtonExtra = "";
 
 
 
 
 
 
 
 
152
  } else {
153
- $ButtonAppearance = "width:100px;right:0;border-bottom-left-radius:40px; border-top-left-radius:40px;";
154
- $ButtonExtra = "";
155
- }
156
- echo $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($options['color'],'lighter')."; background:url(data:image/svg+xml;base64,".svg(changeColor($options['color'], 'darker') ).") center 2px no-repeat ".$options['color']."; text-decoration:none; box-shadow:0 0 5px #888; z-index:9999;background-size:58px 58px}".$ButtonExtra."}</style>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
  add_action('wp_head', 'cnb_head');
159
 
160
  function cnb_footer() {
161
  $alloptions = get_option('cnb');
162
-
163
-
164
  if(isset($alloptions['show']) && $alloptions['show'] != "") {
165
  $show = explode(',', str_replace(' ', '' ,$alloptions['show']));
166
  $limited = TRUE;
@@ -175,13 +272,15 @@ if(get_option('cnb') && !is_admin()) {
175
  } else {
176
  $tracking = "";
177
  }
 
 
178
 
179
  if($limited) {
180
  if(is_single($show) || is_page($show)) {
181
- echo '<a href="tel:'.$alloptions['number'].'" id="callnowbutton" '.$tracking.'>&nbsp;</a>';
182
  }
183
  } else {
184
- echo '<a href="tel:'.$alloptions['number'].'" id="callnowbutton" '.$tracking.'>&nbsp;</a>';
185
  }
186
  }
187
  add_action('wp_footer', 'cnb_footer');
@@ -191,12 +290,13 @@ if(get_option('cnb') && !is_admin()) {
191
  function cnb_get_options() { // Checking and setting the default options
192
  if(!get_option('cnb')) {
193
  $default_options = array(
194
- 'active' => 0,
195
  'number' => '',
196
  'color' => '#009900',
197
  'appearance' => 'right',
198
  'tracking' => 0,
199
- 'show' => ''
 
200
  );
201
  add_option('cnb',$default_options);
202
  $options = get_option('cnb');
@@ -207,21 +307,32 @@ function cnb_get_options() { // Checking and setting the default options
207
  return $options;
208
  }
209
  function set_basic_options() {
210
- if(get_option('cnb') && !array_key_exists('color', get_option('cnb'))) {
211
  $options = get_option('cnb');
 
212
  $default_options = array(
213
  'active' => $options['active'],
214
  'number' => $options['number'],
215
- 'color' => '#009900',
216
- 'appearance' => 'right',
217
- 'tracking' => 0,
218
- 'show' => ''
 
219
  );
220
  update_option('cnb',$default_options);
 
 
 
221
  }
222
  }
223
  function svg($color2) {
224
  $phone1 = '<path d="M7.104 14.032l15.586 1.984c0 0-0.019 0.5 0 0.953c0.029 0.756-0.26 1.534-0.809 2.1 l-4.74 4.742c2.361 3.3 16.5 17.4 19.8 19.8l16.813 1.141c0 0 0 0.4 0 1.1 c-0.002 0.479-0.176 0.953-0.549 1.327l-6.504 6.505c0 0-11.261 0.988-25.925-13.674C6.117 25.3 7.1 14 7.1 14" fill="'.$color2.'"/><path d="M7.104 13.032l6.504-6.505c0.896-0.895 2.334-0.678 3.1 0.35l5.563 7.8 c0.738 1 0.5 2.531-0.36 3.426l-4.74 4.742c2.361 3.3 5.3 6.9 9.1 10.699c3.842 3.8 7.4 6.7 10.7 9.1 l4.74-4.742c0.897-0.895 2.471-1.026 3.498-0.289l7.646 5.455c1.025 0.7 1.3 2.2 0.4 3.105l-6.504 6.5 c0 0-11.262 0.988-25.925-13.674C6.117 24.3 7.1 13 7.1 13" fill="#fff"/>';
225
  $svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 60 60">' . $phone1 . '</svg>';
226
  return base64_encode($svg);
227
- } ?>
 
 
 
 
 
 
2
  /*
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.2.0
7
  Author: Jerry Rietveld
8
  Author URI: http://www.jgrietveld.com
9
  License: GPL2
10
  */
11
+
12
+ /* Copyright 2013-2017 Jerry Rietveld (email : jerry@jgrietveld.com)
 
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
26
  */
27
  ?>
28
  <?php
29
+ define('CNB_VERSION','0.2.0');
30
  add_action('admin_menu', 'register_cnb_page');
31
  add_action('admin_init', 'cnb_options_init');
32
 
33
+ $options = cnb_get_options();
 
 
 
34
 
35
+ $options['active'] = isset($options['active']) ? 1 : 0;
36
+ $options['classic'] = isset($options['classic']) ? 1 : 0;
37
 
38
+ $plugin_title = apply_filters( 'cnb_plugin_title', 'Call Now Button');
39
+
40
+ $cnb_updated = set_basic_options();
41
+
42
+ add_action( 'admin_enqueue_scripts', 'cnb_enqueue_color_picker' ); // add the color picker
43
+
44
+ function register_cnb_page() {
45
+ global $plugin_title;
46
+ $page = add_submenu_page('options-general.php', $plugin_title, $plugin_title, 'manage_options', 'call-now-button', 'call_now_settings_page');
47
+ add_action( 'admin_print_styles-' . $page , 'cnb_admin_styling' );
48
+ }
49
  function cnb_enqueue_color_picker( $hook_suffix ) {
50
  wp_enqueue_style( 'wp-color-picker' );
51
+ wp_enqueue_script( 'cnb-script-handle', plugins_url('call-now-button.js', __FILE__ ), array( 'wp-color-picker' ), CNB_VERSION, true );
52
+ }
53
+ function cnb_admin_styling() {
54
+ wp_enqueue_style( 'cnb_styling' );
55
  }
 
56
  function cnb_options_init() {
57
  register_setting('cnb_options','cnb');
58
+ wp_register_style( 'cnb_styling', plugins_url('call-now-button.css', __FILE__), false, CNB_VERSION, 'all' );
59
  }
60
+ function call_now_settings_page() {
61
+ global $options;
62
+ global $plugin_title;
63
+ global $cnb_updated;
64
+ ?>
65
+
66
+ <div class="wrap">
67
+ <h1>Call Now Button <span class="version">v.<?php echo CNB_VERSION;?></span></h1>
68
+ <!--## NOTIFICATION BARS ## -->
69
+ <?php
70
+ // Display notification that the button is active or inactive
71
+ if(!$options['active']==1) {
72
+ echo '<div class="notice-error notice"><p>The Call Now Button is currently <b>inactive</b>.</p></div>';
73
+ }
74
+
75
+ // Display notification that the button is limited to a number of posts/pages
76
+ if($options['active']==1 && $options['show'] != "") {
77
+ echo '<div class="notice-error notice">'.
78
+ '<p><span>Appearance of the Button is <b>limited</b><span class="hide-on-mobile"> to specific Posts or Pages</span>. <span class="check-settings">Review settings &raquo;</span></p></div>';
79
+ }
80
+
81
+
82
+
83
+ // inform exisiting users about update to the button design
84
+ if($cnb_updated) { ?>
85
+ <div class="notice-warning notice is-dismissible">
86
+ <p>The Call Now Button has a fresh new look! If you prefer the old button, you can <span class="cnb-switch-back">switch back</span> in the Advanced Settings. <a href="http://callnowbutton.com/new-button-design/" target="_blank" class="cnb-external"><i>See the difference &raquo;</i></a></p>
87
+ </div>
88
+ <?php } ?>
89
+
90
+
91
+ <form method="post" action="options.php" class="cnb-container">
92
+ <?php settings_fields('cnb_options'); ?>
93
+ <table class="form-table">
94
+ <tr valign="top">
95
+ <th scope="row">Button status:</th>
96
+ <td class="activated">
97
+ <input id="activated" name="cnb[active]" type="checkbox" value="1" <?php checked('1', $options['active']); ?> /> <label title="Enable" for="activated">Enabled</label> &nbsp; &nbsp;
98
+ </td>
99
+ </tr>
100
+ <tr valign="top"><th scope="row">Phone number:</th>
101
+ <td><input type="text" name="cnb[number]" value="<?php echo $options['number']; ?>" /></td>
102
+ </tr>
103
+ </table>
104
+ <div id="settings">
105
+ <table class="form-table">
106
+ <tr valign="top"><th scope="row">Button color:</th>
107
+ <td><input name="cnb[color]" type="text" value="<?php echo $options['color']; ?>" class="cnb-color-field" data-default-color="#009900" /></td>
108
+ </tr>
109
+ <tr valign="top"><th scope="row">Position</th>
110
+ <td class="appearance">
111
+ <div class="radio-item">
112
+ <input type="radio" id="appearance1" name="cnb[appearance]" value="right" <?php checked('right', $options['appearance']); ?>>
113
+ <label title="right" for="appearance1">Right corner</label>
114
+ </div>
115
+ <div class="radio-item">
116
+ <input type="radio" id="appearance2" name="cnb[appearance]" value="left" <?php checked('left', $options['appearance']); ?>>
117
+ <label title="left" for="appearance2">Left corner</label>
118
+ </div>
119
+ <div class="radio-item">
120
+ <input type="radio" id="appearance3" name="cnb[appearance]" value="middle" <?php checked('middle', $options['appearance']); ?>>
121
+ <label title="middle" for="appearance3">Center bottom</label>
122
+ </div>
123
+ <div class="radio-item">
124
+ <input type="radio" id="appearance4" name="cnb[appearance]" value="full" <?php checked('full', $options['appearance']); ?>>
125
+ <label title="full" for="appearance4">Full bottom</label>
126
+ </div>
127
+ </td>
128
+ </tr>
129
+ <tr valign="top">
130
+ <th scope="row">Click tracking:</th>
131
+ <td>
132
+ <div class="radio-item">
133
+ <input id="tracking3" type="radio" name="cnb[tracking]" value="0" <?php checked('0', $options['tracking']); ?> />
134
+ <label for="tracking3">Disabled</label><br />
135
+ </div>
136
+ <div class="radio-item">
137
+ <input id="tracking1" type="radio" name="cnb[tracking]" value="2" <?php checked('2', $options['tracking']); ?> />
138
+ <label for="tracking1">Google Universal Analytics (analytics.js)</label><br />
139
+ </div>
140
+ <div class="radio-item">
141
+ <input id="tracking2" type="radio" name="cnb[tracking]" value="1" <?php checked('1', $options['tracking']); ?> />
142
+ <label for="tracking2">Google Classic Analytics (ga.js)</label>
143
+ </div>
144
+ <p class="description">Click tracking turned on? Wait for about a day then log into your Google Analytics accunt and click in the <strong>Behavior</strong> section on <strong>Events</strong>. <span class="whatsThis">(<a href="https://support.google.com/analytics/answer/1033068#SeeAlerts" target="_blank">What's this?</a>)</span></p>
145
+ </td>
146
+ </tr>
147
+ <tr valign="top" class="appearance">
148
+ <th scope="row">Limit appearance:</th>
149
+ <td>
150
+ <input type="text" name="cnb[show]" value="<?php echo $options['show']; ?>" />
151
+ <p class="description">Enter IDs of the posts &amp; pages the Call Now Button should appear on (leave blank for all).</p>
152
+ </td>
153
+ </tr>
154
+ <tr valign="top" class="classic">
155
+ <th scope="row">Back to old button design:</th>
156
+ <td>
157
+ <input id="classic" name="cnb[classic]" type="checkbox" value="1" <?php checked('1', $options['classic']); ?> /> <label title="Enable" for="classic">Old button <span class="inline-helper">- <a href="http://callnowbutton.com/new-button-design/" target="_blank" class="cnb-normal"><i>What's the difference?</i></a></span></label>
158
+ </td>
159
+ </tr>
160
+ </table>
161
+ </div><!--#settings-->
162
+ <input type="hidden" name="cnb[version]" value="<?php echo CNB_VERSION; ?>" />
163
+ <p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
164
+ <div class="cnb_settings">+ Advanced settings</div>
165
+ </form>
166
+
167
+ <div class="feedback-collection">
168
+ <div class="cnb-clear"></div>
169
+ <p class="cnb-url cnb-center"><a href="http://callnowbutton.com" target="_blank">callnowbutton.com</a></p>
170
+
171
+ <hr>
172
+ <p class="cnb-center cnb-spacing">
173
+ <a href="http://callnowbutton.com/support/" target="_blank" title="Support">Support</a> &middot;
174
+ <a href="http://callnowbutton.com/feature-request/" target="_blank" title="Feature Requests">Suggestions</a> &middot;
175
+ <a href="http://callnowbutton.com/praise/" target="_blank" title="Praise">Just say thanks :-)</a>
176
+ </p>
177
+ <!--// Display notification about the testing program -->
178
+ <div class="postbox cnb-alert-box cnb-center">
179
+ <p>We're looking for testers for the Call&nbsp;Now&nbsp;Button&nbsp;<b>Pro</b>!
180
+ <a class="cnb-external" href="http://callnowbutton.com/join-test-team/" rel="help" target="_blank">Join us here &raquo;</a>
181
+ </p>
182
+ </div>
183
+
184
+ <hr>
185
+ <div class="donate cnb-center">
186
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
187
+ <input type="hidden" name="cmd" value="_s-xclick">
188
+ <input type="hidden" name="hosted_button_id" value="Q82GBVSERC9AW">
189
+ <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!">
190
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
191
+ </form>
192
+ </div><!--.donate-->
193
+ </div>
194
      </div>
195
  <?php }
196
  if(get_option('cnb') && !is_admin()) {
213
  $options = get_option('cnb');
214
  if(isset($options['active'])) $enabled = $options['active']; else $enabled = 0;
215
  if($enabled == '1') {
216
+ // it's enabled so put footer stuff here
217
  function cnb_head() {
218
  $options = get_option('cnb');
219
+ if(isset($options['classic'])) $classic = $options['classic']; else $classic = 0;
220
+ $credits = "\n<!-- Call Now Button ".CNB_VERSION." by Jerry Rietveld (callnowbutton.com) -->\n";
221
+ $ButtonExtra = "";
222
+ if($classic == 1) {
223
+
224
+ // OLD BUTTON DESIGN
225
+ if($options['appearance'] == 'full' || $options['appearance'] == 'middle') {
226
+ $ButtonAppearance = "width:100%;left:0;";
227
+ $ButtonExtra = "body {padding-bottom:60px;}";
228
+ }
229
+ elseif($options['appearance'] == 'left') { $ButtonAppearance = "width:100px;left:0;border-bottom-right-radius:40px; border-top-right-radius:40px;"; }
230
+ else { $ButtonAppearance = "width:100px;right:0;border-bottom-left-radius:40px; border-top-left-radius:40px;"; }
231
+
232
+ $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($options['color'],'lighter')."; background:url(data:image/svg+xml;base64,".svg(changeColor($options['color'], 'darker') ).") center 2px no-repeat ".$options['color']."; text-decoration:none; box-shadow:0 0 5px #888; z-index:9999;background-size:58px 58px}".$ButtonExtra."}</style>\n";
233
+
234
  } else {
235
+
236
+ // NEW BUTTON DESIGN
237
+ $credits = "\n<!-- Call Now Button ".CNB_VERSION." by Jerry Rietveld (callnowbutton.com) -->\n";
238
+ $ButtonShape = "width:65px; height:65px; border-radius:80px; border:2px solid #fff; bottom:15px;";
239
+ if($options['appearance'] == 'full') {
240
+ $ButtonAppearance = "width:100%;left:0;bottom:0;height:60px;border-top:1px solid ".changeColor($options['color'], 'lighter')."; border-bottom:1px solid ".changeColor($options['color'], 'darker').";";
241
+ $ButtonExtra = "body {padding-bottom:60px;}";
242
+ }
243
+ elseif($options['appearance'] == 'left' ) { $ButtonAppearance = $ButtonShape . "left:20px;"; }
244
+ elseif($options['appearance'] == 'middle') { $ButtonAppearance = $ButtonShape . "left:50%; margin-left:-33px;"; }
245
+ else { $ButtonAppearance = $ButtonShape . "right:20px;"; }
246
+
247
+ $credits = $credits ."<style>";
248
+ $credits .= "#callnowbutton {display:none;} @media screen and (max-width:650px){#callnowbutton {display:block; position:fixed; text-decoration:none; z-index:9999;";
249
+ $credits .= $ButtonAppearance;
250
+ $credits .= "background:url(data:image/svg+xml;base64,".svg(changeColor($options['color'], 'darker') ).") center/50px 50px no-repeat ".$options['color'].";";
251
+ $credits .= "}" . $ButtonExtra . "}";
252
+ $credits .= "</style>\n";
253
+ }
254
+ echo $credits;
255
  }
256
  add_action('wp_head', 'cnb_head');
257
 
258
  function cnb_footer() {
259
  $alloptions = get_option('cnb');
260
+
 
261
  if(isset($alloptions['show']) && $alloptions['show'] != "") {
262
  $show = explode(',', str_replace(' ', '' ,$alloptions['show']));
263
  $limited = TRUE;
272
  } else {
273
  $tracking = "";
274
  }
275
+
276
+ $callLink = '<a href="tel:'.$alloptions['number'].'" id="callnowbutton" '.$tracking.'>&nbsp;</a>';
277
 
278
  if($limited) {
279
  if(is_single($show) || is_page($show)) {
280
+ echo $callLink;
281
  }
282
  } else {
283
+ echo $callLink;
284
  }
285
  }
286
  add_action('wp_footer', 'cnb_footer');
290
  function cnb_get_options() { // Checking and setting the default options
291
  if(!get_option('cnb')) {
292
  $default_options = array(
293
+ 'active',
294
  'number' => '',
295
  'color' => '#009900',
296
  'appearance' => 'right',
297
  'tracking' => 0,
298
+ 'show' => '',
299
+ 'version' => CNB_VERSION
300
  );
301
  add_option('cnb',$default_options);
302
  $options = get_option('cnb');
307
  return $options;
308
  }
309
  function set_basic_options() {
310
+ if(!array_key_exists('version', get_option('cnb'))) {
311
  $options = get_option('cnb');
312
+ $options['active'] = isset($options['active']) ? 1 : 0;
313
  $default_options = array(
314
  'active' => $options['active'],
315
  'number' => $options['number'],
316
+ 'color' => $options['color'],
317
+ 'appearance' => $options['appearance'],
318
+ 'tracking' => $options['tracking'],
319
+ 'show' => $options['show'],
320
+ 'version' => CNB_VERSION
321
  );
322
  update_option('cnb',$default_options);
323
+ return true; // plugin was updated
324
+ } else {
325
+ return false; // no update
326
  }
327
  }
328
  function svg($color2) {
329
  $phone1 = '<path d="M7.104 14.032l15.586 1.984c0 0-0.019 0.5 0 0.953c0.029 0.756-0.26 1.534-0.809 2.1 l-4.74 4.742c2.361 3.3 16.5 17.4 19.8 19.8l16.813 1.141c0 0 0 0.4 0 1.1 c-0.002 0.479-0.176 0.953-0.549 1.327l-6.504 6.505c0 0-11.261 0.988-25.925-13.674C6.117 25.3 7.1 14 7.1 14" fill="'.$color2.'"/><path d="M7.104 13.032l6.504-6.505c0.896-0.895 2.334-0.678 3.1 0.35l5.563 7.8 c0.738 1 0.5 2.531-0.36 3.426l-4.74 4.742c2.361 3.3 5.3 6.9 9.1 10.699c3.842 3.8 7.4 6.7 10.7 9.1 l4.74-4.742c0.897-0.895 2.471-1.026 3.498-0.289l7.646 5.455c1.025 0.7 1.3 2.2 0.4 3.105l-6.504 6.5 c0 0-11.262 0.988-25.925-13.674C6.117 24.3 7.1 13 7.1 13" fill="#fff"/>';
330
  $svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 60 60">' . $phone1 . '</svg>';
331
  return base64_encode($svg);
332
+ }
333
+ function buttonActive() {
334
+ $options = get_option('cnb');
335
+ if(isset($options['active'])) { $output = true; } else { $output = false; }
336
+ return $output;
337
+ }
338
+ ?>
readme.txt CHANGED
@@ -3,18 +3,18 @@ Contributors: jgrietveld
3
  Donate link: http://callnowbutton.com/donate/
4
  Tags: call, contact, customers, sell, sales, leads, convert, conversions
5
  Requires at least: 2.7
6
- Tested up to: 4.7.0
7
- Stable tag: 0.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- A very simple yet very effective plugin that adds a Call Now button to your website for mobile visitors (only for mobile optimized websites).
12
 
13
  == Description ==
14
 
15
  ###What does the plugin do?
16
 
17
- This plugin places a Call Now button to the bottom right corner of the screen which is only visible for your mobile visitors. Because your mobile visitors are already holding their phone it will allow them to call you with one simple touch of the button.
18
  No more complicated copy-and-pasting or memorizing the phone number!
19
 
20
  ###Could not be easier!
@@ -23,7 +23,7 @@ The settings are very easy: enable and enter your phone number. That's it!
23
  But if you want more control, you can always open up the Advanced Settings and change the default behavior.
24
 
25
  ###Only for mobile optimized themes
26
- Usage at this point is only recommended for responsive websites or websites otherwise optimized for display on mobile devices.
27
 
28
 
29
  == Installation ==
@@ -54,7 +54,7 @@ The button will only work on websites that use a responsive theme. Responsive me
54
 
55
  = Do I add a country code to my phone number? =
56
 
57
- You don't have to but i recommend you do to increase your options internationally.
58
 
59
  = Do I start the number with + or 00? =
60
 
@@ -64,6 +64,10 @@ Up to you. Your phone will understand both!
64
 
65
  Yes! You can easily change the color of the button and make it sit in the left or right corner. Or spread it out over the full bottom of the phone screen.
66
 
 
 
 
 
67
 
68
  == Screenshots ==
69
 
@@ -75,6 +79,16 @@ Yes! You can easily change the color of the button and make it sit in the left o
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
 
 
 
 
 
78
  = 0.1.3 =
79
  * Click tracking added for Universal Analytics
80
  * Phone icon now SVG so super crisp on high pixel density screens (e.g. Retina screens)
3
  Donate link: http://callnowbutton.com/donate/
4
  Tags: call, contact, customers, sell, sales, leads, convert, conversions
5
  Requires at least: 2.7
6
+ Tested up to: 4.8
7
+ Stable tag: 0.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ A very simple yet very effective plugin that adds a Call Now button to your website for mobile visitors (only for responsive websites).
12
 
13
  == Description ==
14
 
15
  ###What does the plugin do?
16
 
17
+ This plugin places a Call Now button (click-to-call) to the bottom of the screen which is only visible for your mobile visitors. Because your mobile visitors are already holding their phone it will allow them to call you with one simple touch of the button.
18
  No more complicated copy-and-pasting or memorizing the phone number!
19
 
20
  ###Could not be easier!
23
  But if you want more control, you can always open up the Advanced Settings and change the default behavior.
24
 
25
  ###Only for mobile optimized themes
26
+ Usage at this point is only for responsive websites (websites optimized for display on mobile devices).
27
 
28
 
29
  == Installation ==
54
 
55
  = Do I add a country code to my phone number? =
56
 
57
+ You don't have to but i recommend that you do to increase your options internationally.
58
 
59
  = Do I start the number with + or 00? =
60
 
64
 
65
  Yes! You can easily change the color of the button and make it sit in the left or right corner. Or spread it out over the full bottom of the phone screen.
66
 
67
+ = I need way more flexibility! Isn't there a PRO version that I can use? =
68
+
69
+ Yes, this is coming soon. We're currently looking for testers so if you want to give it a try already, please sign up at callnowbutton.com
70
+
71
 
72
  == Screenshots ==
73
 
79
 
80
  == Changelog ==
81
 
82
+ = 0.2.0 =
83
+ * New circular button design
84
+ * Option to revert to the old button design
85
+ * Classic button design still available through advanced settings
86
+ * Added middle button position
87
+ * Added admin notices for clarity
88
+ * Added link to Google Analytics integration manual
89
+ * More contact links to support and feature requests
90
+ * Some small design tweaks to admin screen
91
+
92
  = 0.1.3 =
93
  * Click tracking added for Universal Analytics
94
  * Phone icon now SVG so super crisp on high pixel density screens (e.g. Retina screens)