Call Now Button - Version 0.1.2

Version Description

= * Transparent button fix * Small debug fixes

Download this release

Release Info

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

Code changes from version 0.1.1 to 0.1.2

Files changed (2) hide show
  1. call-now-button.php +44 -5
  2. readme.txt +6 -2
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 at the bottom of your site
6
- Version: 0.1.1
7
  Author: Jerry G. Rietveld
8
  Author URI: http://www.jgrietveld.com
9
  License: GPL2
@@ -27,13 +27,15 @@ License: GPL2
27
  */
28
  ?>
29
  <?php
30
- define('CNB_VERSION','0.1.1');
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
 
38
  // add the color picker
39
  add_action( 'admin_enqueue_scripts', 'cnb_enqueue_color_picker' );
@@ -51,11 +53,14 @@ function call_now_settings_page() { ?>
51
 
52
  <form method="post" action="options.php">
53
              <?php settings_fields('cnb_options'); ?>
54
-             <?php $options = get_option('cnb'); ?>
55
  <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>
56
  <table class="form-table">
57
  <tr valign="top"><th scope="row">Call Now Button</th>
58
- <td><input name="cnb[active]" type="checkbox" value="1" <?php checked('1', $options['active']); ?> /> Enable</td>
 
 
 
59
  </tr>
60
                  <tr valign="top"><th scope="row">Phone number</th>
61
                      <td><input type="text" name="cnb[number]" value="<?php echo $options['number']; ?>" /></td>
@@ -83,7 +88,8 @@ function call_now_settings_page() { ?>
83
  </td>
84
  </tr>
85
                  <tr valign="top"><th scope="row">Click tracking</th>
86
-                     <td><input type="checkbox" name="cnb[tracking]" value="1" <?php checked('1', $options['tracking']); ?> /> Enable
 
87
  <p class="description">Only for sites using Google Analytics.</p></td>
88
                  </tr>
89
                  <tr valign="top"><th scope="row">Limit appearance</th>
@@ -176,4 +182,37 @@ if(get_option('cnb') && !is_admin()) {
176
  }
177
  add_action('wp_footer', 'cnb_footer');
178
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  } ?>
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.2
7
  Author: Jerry G. Rietveld
8
  Author URI: http://www.jgrietveld.com
9
  License: GPL2
27
  */
28
  ?>
29
  <?php
30
+ define('CNB_VERSION','0.1.2');
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' );
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>
88
  </td>
89
  </tr>
90
                  <tr valign="top"><th scope="row">Click tracking</th>
91
+                     <td><input type="radio" name="cnb[tracking]" value="1" <?php checked('1', $options['tracking']); ?> /> Enabled<br />
92
+ <input type="radio" name="cnb[tracking]" value="0" <?php checked('0', $options['tracking']); ?> /> Disabled
93
  <p class="description">Only for sites using Google Analytics.</p></td>
94
                  </tr>
95
                  <tr valign="top"><th scope="row">Limit appearance</th>
182
  }
183
  add_action('wp_footer', 'cnb_footer');
184
  }
185
+ }
186
+
187
+ function cnb_get_options() { // Checking and setting the default options
188
+ if(!get_option('cnb')) {
189
+ $default_options = array(
190
+ 'active' => 0,
191
+ 'number' => '',
192
+ 'color' => '#009900',
193
+ 'appearance' => 'right',
194
+ 'tracking' => 0,
195
+ 'show' => ''
196
+ );
197
+ add_option('cnb',$default_options);
198
+ $options = get_option('cnb');
199
+ }
200
+
201
+ $options = get_option('cnb');
202
+
203
+ return $options;
204
+ }
205
+ function set_basic_options() {
206
+ if(get_option('cnb') && !array_key_exists('color', get_option('cnb'))) {
207
+ $options = get_option('cnb');
208
+ $default_options = array(
209
+ 'active' => $options['active'],
210
+ 'number' => $options['number'],
211
+ 'color' => '#009900',
212
+ 'appearance' => 'right',
213
+ 'tracking' => 0,
214
+ 'show' => ''
215
+ );
216
+ update_option('cnb',$default_options);
217
+ }
218
  } ?>
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
5
  Requires at least: 2.7
6
- Tested up to: 3.5.2
7
- Stable tag: 0.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -75,6 +75,10 @@ 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.1 =
79
  * JavaScript fix (needed for Advanced Settings)
80
 
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.0
7
+ Stable tag: 0.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
75
 
76
  == Changelog ==
77
 
78
+ = 0.1.2 =
79
+ * Transparent button fix
80
+ * Small debug fixes
81
+
82
  = 0.1.1 =
83
  * JavaScript fix (needed for Advanced Settings)
84