Call Now Button - Version 0.3.3

Version Description

= * Check for active caching plugin * Added links from plugins page to settins page

Download this release

Release Info

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

Code changes from version 0.3.2 to 0.3.3

Files changed (2) hide show
  1. call-now-button.php +62 -5
  2. readme.txt +18 -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 fixed at the bottom of your site
6
- Version: 0.3.2
7
  Author: Jerry Rietveld
8
  Author URI: http://www.jgrietveld.com
9
  License: GPL2
@@ -26,13 +26,17 @@ License: GPL2
26
  */
27
  ?>
28
  <?php
29
- define('CNB_VERSION','0.3.2');
 
 
 
30
  add_action('admin_menu', 'register_cnb_page');
31
  add_action('admin_init', 'cnb_options_init');
32
 
33
  $cnb_changelog =
34
  array(
35
  array(
 
36
  '3.2' => 'Option to hide icon in text button, small bug fixes.',
37
  '3.1' => 'You can now add text to your button and it\'s possible to switch between including and excluding specific pages.',
38
  '3.0' => 'Option to add text to your button.',
@@ -48,7 +52,7 @@ $cnb_updated = $cnb_settings['updated'];
48
 
49
  $cnb_options['active'] = isset($cnb_options['active']) ? 1 : 0;
50
  $cnb_options['classic'] = isset($cnb_options['classic']) ? 1 : 0;
51
- $cnb_options['hideIcon'] = isset($cnb_options['hideIcon']) ? 1 : 0;
52
 
53
  $plugin_title = apply_filters( 'cnb_plugin_title', 'Call Now Button');
54
 
@@ -66,6 +70,28 @@ function cnb_enqueue_color_picker( $hook_suffix ) {
66
  function cnb_admin_styling() {
67
  wp_enqueue_style( 'cnb_styling' );
68
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  function cnb_options_init() {
70
  register_setting('cnb_options','cnb');
71
  wp_register_style( 'cnb_styling', plugins_url('call-now-button.css', __FILE__), false, CNB_VERSION, 'all' );
@@ -87,14 +113,20 @@ function call_now_settings_page() {
87
  echo '<div class="notice-error notice"><p>The Call Now Button is currently <b>inactive</b>.</p></div>';
88
  }
89
 
 
 
 
 
 
 
 
 
90
  // Display notification that the button is limited to a number of posts/pages
91
  if($cnb_options['active']==1 && $cnb_options['show'] != "") {
92
  echo '<div class="notice-error notice">'.
93
  '<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>';
94
  }
95
 
96
-
97
-
98
  // inform exisiting users about update to the button design
99
  if($cnb_updated[0]) { ?>
100
  <div class="notice-warning notice is-dismissible">
@@ -449,4 +481,29 @@ function buttonActive() {
449
  if(isset($cnb_options['active'])) { $output = true; } else { $output = false; }
450
  return $output;
451
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  ?>
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
  */
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 ) );
33
  add_action('admin_menu', 'register_cnb_page');
34
  add_action('admin_init', 'cnb_options_init');
35
 
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.',
42
  '3.0' => 'Option to add text to your button.',
52
 
53
  $cnb_options['active'] = isset($cnb_options['active']) ? 1 : 0;
54
  $cnb_options['classic'] = isset($cnb_options['classic']) ? 1 : 0;
55
+ $cnb_options['hideIcon'] = isset($cnb_options['hideIcon']) ? $cnb_options['hideIcon'] : 0;
56
 
57
  $plugin_title = apply_filters( 'cnb_plugin_title', 'Call Now Button');
58
 
70
  function cnb_admin_styling() {
71
  wp_enqueue_style( 'cnb_styling' );
72
  }
73
+
74
+ function cnb_plugin_meta($links, $file) {
75
+ if ( $file == CNB_BASENAME ) {
76
+ $cnb_new_links = array(
77
+ sprintf( '<a href="options-general.php?page=%s">%s</a>', CNB_FILENAME, __('Settings')),
78
+ '<a href="http://callnowbutton.com/support/">Support</a>');
79
+ array_push(
80
+ $links,
81
+ $cnb_new_links[0],
82
+ $cnb_new_links[1]
83
+ );
84
+ }
85
+ return $links;
86
+ }
87
+ add_filter( 'plugin_row_meta', 'cnb_plugin_meta', 10, 2 );
88
+
89
+ function cnb_plugin_add_settings_link( $links ) {
90
+ array_unshift( $links, sprintf( '<a href="options-general.php?page=%s">%s</a>', CNB_FILENAME, __('Settings') ) );
91
+ return $links;
92
+ }
93
+ add_filter( 'plugin_action_links_'. CNB_BASENAME, 'cnb_plugin_add_settings_link' );
94
+
95
  function cnb_options_init() {
96
  register_setting('cnb_options','cnb');
97
  wp_register_style( 'cnb_styling', plugins_url('call-now-button.css', __FILE__), false, CNB_VERSION, 'all' );
113
  echo '<div class="notice-error notice"><p>The Call Now Button is currently <b>inactive</b>.</p></div>';
114
  }
115
 
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
+
124
  // Display notification that the button is limited to a number of posts/pages
125
  if($cnb_options['active']==1 && $cnb_options['show'] != "") {
126
  echo '<div class="notice-error notice">'.
127
  '<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>';
128
  }
129
 
 
 
130
  // inform exisiting users about update to the button design
131
  if($cnb_updated[0]) { ?>
132
  <div class="notice-warning notice is-dismissible">
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(
487
+ 'autoptimize/autoptimize.php',
488
+ 'breeze/breeze.php',
489
+ 'cache-control/cache-control.php',
490
+ 'cache-enabler/cache-enabler.php',
491
+ 'comet-cache/comet-cache.php',
492
+ 'fast-velocity-minify/fvm.php',
493
+ 'hyper-cache/plugin.php',
494
+ 'litespeed-cache/litespeed-cache.php',
495
+ 'simple-cache/simple-cache.php',
496
+ 'w3-total-cache/w3-total-cache.php',
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
  ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -54,9 +54,21 @@ In the Settings section on your WordPress Dashboard you'll find a new addition:
54
 
55
  The button will only work on websites that use a responsive theme. Responsive means that the website adapts to the size of the screen it's being viewed on. Simply put, if you need to zoom in to be able to read the text of your website on your mobile phone, the plugin will not work.
56
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  = Do I have to add a country code to my phone number? =
58
 
59
- You don't have to but i recommend that you do to increase your options internationally.
60
 
61
  = Do I start the number with + or 00? =
62
 
@@ -86,6 +98,10 @@ Yes, this is coming soon. We're currently looking for testers so if you want to
86
 
87
  == Changelog ==
88
 
 
 
 
 
89
  = 0.3.2 =
90
  * Option to hide icon in text button
91
  * Fix for gtag tracking code
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
 
54
 
55
  The button will only work on websites that use a responsive theme. Responsive means that the website adapts to the size of the screen it's being viewed on. Simply put, if you need to zoom in to be able to read the text of your website on your mobile phone, the plugin will not work.
56
 
57
+ = My website is responsive but I don't see the button
58
+
59
+ Check if you have any caching plugins active on your website. Your website is likely cached and you're looking at an older copy of your website. Delete/empty the cache and reload your website.
60
+
61
+ = I updated the button but I'm not seeing the changes on my website
62
+
63
+ You have a caching plugin active on your website and you are looking at a cached version of your website. Delete/empty the cache and reload your website.
64
+
65
+ = I only see the button on some pages of my website
66
+
67
+ You have a caching plugin active on your website and the cached pages are showing an older version of your website. Delete/empty the cache and reload the pages.
68
+
69
  = Do I have to add a country code to my phone number? =
70
 
71
+ You don't have to but I recommend that you do to increase your options internationally.
72
 
73
  = Do I start the number with + or 00? =
74
 
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
107
  * Fix for gtag tracking code