Version Description
= * Click tracking added for Universal Analytics * Phone icon now SVG so super crisp on high pixel density screens (e.g. Retina screens) * SVG icon embedded in code so no more http requests
Download this release
Release Info
Developer | jgrietveld |
Plugin | Call Now Button |
Version | 0.1.3 |
Comparing to | |
See all releases |
Code changes from version 0.1.2 to 0.1.3
- call-now-button.php +21 -12
- callbutton01.png +0 -0
- readme.txt +7 -2
call-now-button.php
CHANGED
@@ -3,14 +3,14 @@
|
|
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.
|
7 |
-
Author: Jerry
|
8 |
Author URI: http://www.jgrietveld.com
|
9 |
License: GPL2
|
10 |
*/
|
11 |
?>
|
12 |
<?php
|
13 |
-
/* Copyright 2013 Jerry
|
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,7 +27,7 @@ License: GPL2
|
|
27 |
*/
|
28 |
?>
|
29 |
<?php
|
30 |
-
define('CNB_VERSION','0.1.
|
31 |
add_action('admin_menu', 'register_cnb_page');
|
32 |
add_action('admin_init', 'cnb_options_init');
|
33 |
|
@@ -48,7 +48,7 @@ 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
|
52 |
|
53 |
|
54 |
<form method="post" action="options.php">
|
@@ -88,9 +88,10 @@ function call_now_settings_page() { ?>
|
|
88 |
</td>
|
89 |
</tr>
|
90 |
<tr valign="top"><th scope="row">Click tracking</th>
|
91 |
-
<td><input type="radio" name="cnb[tracking]" value="
|
|
|
92 |
<input type="radio" name="cnb[tracking]" value="0" <?php checked('0', $options['tracking']); ?> /> Disabled
|
93 |
-
<p class="description">
|
94 |
</tr>
|
95 |
<tr valign="top"><th scope="row">Limit appearance</th>
|
96 |
<td><input type="text" name="cnb[show]" value="<?php echo $options['show']; ?>" />
|
@@ -120,13 +121,14 @@ function call_now_settings_page() { ?>
|
|
120 |
<?php }
|
121 |
if(get_option('cnb') && !is_admin()) {
|
122 |
|
123 |
-
//
|
124 |
-
function
|
125 |
if(!preg_match('/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i', $color, $parts));
|
|
|
126 |
for($i = 1; $i <= 3; $i++) {
|
127 |
$parts[$i] = hexdec($parts[$i]);
|
128 |
-
$parts[$i] = round($parts[$i]
|
129 |
-
if($parts[$i] > 255) { $parts[$i] = 255; }
|
130 |
$parts[$i] = dechex($parts[$i]);
|
131 |
}
|
132 |
$output = '#' . str_pad($parts[1],2,"0",STR_PAD_LEFT) . str_pad($parts[2],2,"0",STR_PAD_LEFT) . str_pad($parts[3],2,"0",STR_PAD_LEFT);
|
@@ -151,7 +153,7 @@ if(get_option('cnb') && !is_admin()) {
|
|
151 |
$ButtonAppearance = "width:100px;right:0;border-bottom-left-radius:40px; border-top-left-radius:40px;";
|
152 |
$ButtonExtra = "";
|
153 |
}
|
154 |
-
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 ".
|
155 |
}
|
156 |
add_action('wp_head', 'cnb_head');
|
157 |
|
@@ -168,6 +170,8 @@ if(get_option('cnb') && !is_admin()) {
|
|
168 |
|
169 |
if($alloptions['tracking'] == '1') {
|
170 |
$tracking = "onclick=\"_gaq.push(['_trackEvent', 'Contact', 'Call Now Button', 'Phone']);\"";
|
|
|
|
|
171 |
} else {
|
172 |
$tracking = "";
|
173 |
}
|
@@ -215,4 +219,9 @@ function set_basic_options() {
|
|
215 |
);
|
216 |
update_option('cnb',$default_options);
|
217 |
}
|
|
|
|
|
|
|
|
|
|
|
218 |
} ?>
|
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 |
*/
|
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 |
|
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">
|
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']; ?>" />
|
121 |
<?php }
|
122 |
if(get_option('cnb') && !is_admin()) {
|
123 |
|
124 |
+
// Color functions to calculate borders
|
125 |
+
function changeColor($color, $direction) {
|
126 |
if(!preg_match('/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i', $color, $parts));
|
127 |
+
if(!isset($direction) || $direction == "lighter") { $change = 45; } else { $change = -50; }
|
128 |
for($i = 1; $i <= 3; $i++) {
|
129 |
$parts[$i] = hexdec($parts[$i]);
|
130 |
+
$parts[$i] = round($parts[$i] + $change);
|
131 |
+
if($parts[$i] > 255) { $parts[$i] = 255; } elseif($parts[$i] < 0) { $parts[$i] = 0; }
|
132 |
$parts[$i] = dechex($parts[$i]);
|
133 |
}
|
134 |
$output = '#' . str_pad($parts[1],2,"0",STR_PAD_LEFT) . str_pad($parts[2],2,"0",STR_PAD_LEFT) . str_pad($parts[3],2,"0",STR_PAD_LEFT);
|
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 |
|
170 |
|
171 |
if($alloptions['tracking'] == '1') {
|
172 |
$tracking = "onclick=\"_gaq.push(['_trackEvent', 'Contact', 'Call Now Button', 'Phone']);\"";
|
173 |
+
} elseif($alloptions['tracking'] == '2') {
|
174 |
+
$tracking = "onclick=\"ga('send', 'event', 'Contact', 'Call Now Button', 'Phone');\"";
|
175 |
} else {
|
176 |
$tracking = "";
|
177 |
}
|
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 |
} ?>
|
callbutton01.png
DELETED
Binary file
|
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: 4.0
|
7 |
-
Stable tag: 0.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -75,6 +75,11 @@ 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.2 =
|
79 |
* Transparent button fix
|
80 |
* Small debug fixes
|
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 |
|
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)
|
81 |
+
* SVG icon embedded in code so no more http requests
|
82 |
+
|
83 |
= 0.1.2 =
|
84 |
* Transparent button fix
|
85 |
* Small debug fixes
|