Call Now Button - Version 1.0.1

Version Description

= * Fix upgrade flow

Download this release

Release Info

Developer jasperroel
Plugin Icon 128x128 Call Now Button
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

call-now-button.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
  Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
6
- Version: 1.0.0
7
  Author: Jerry Rietveld
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
@@ -26,7 +26,7 @@ License: GPL2
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
- define('CNB_VERSION', '1.0.0');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
  Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
6
+ Version: 1.0.1
7
  Author: Jerry Rietveld
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
+ define('CNB_VERSION', '1.0.1');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: call button, click to call, convert, call now button, contact button
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.8
8
- Stable tag: 1.0.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -111,6 +111,13 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
111
 
112
 
113
  == Changelog ==
 
 
 
 
 
 
 
114
  = 0.5.0 =
115
  * Button enablement is back in the creation view
116
  * Small UI improvements
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.8
8
+ Stable tag: 1.0.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
111
 
112
 
113
  == Changelog ==
114
+ = 1.0.1 =
115
+ * Fix upgrade flow
116
+
117
+ = 1.0.0 =
118
+ * Introducing Premium
119
+ * UI improvements
120
+
121
  = 0.5.0 =
122
  * Button enablement is back in the creation view
123
  * Small UI improvements
resources/js/call-now-button.js CHANGED
@@ -501,21 +501,6 @@ function cnb_button_overview_add_new_click() {
501
  return false;
502
  }
503
 
504
- /**
505
- * The equivalent of the PHP function `get_cnb_wordpress_upgrade_link`
506
- *
507
- * @return string URL of the upgrade URL
508
- */
509
- function set_cnb_wordpress_upgrade_link() {
510
- const action = jQuery('#admin_url').attr('value');
511
- const email = jQuery('#admin_email').prop('value')
512
- jQuery('#cnb-go-create-account').prop('href',
513
- 'https://www.callnowbutton.com/wordpress'
514
- + '?e=' + encodeURIComponent(email)
515
- + '&a=' + encodeURIComponent(action)
516
- + '&utm_source=wp-plugin&utm_medium=referral&utm_campaign=beta_tester&utm_term=sign-up-for-api');
517
- }
518
-
519
  jQuery( function() {
520
  // Generic
521
  cnb_setup_colors();
@@ -541,9 +526,6 @@ jQuery( function() {
541
  cnb_delete_action();
542
  cnb_button_overview_modal();
543
 
544
- // page: settings
545
- set_cnb_wordpress_upgrade_link();
546
-
547
  // page: Profile edit (and domain-upgrade, since it's in a modal there)
548
  cnb_profile_edit_setup();
549
  });
501
  return false;
502
  }
503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  jQuery( function() {
505
  // Generic
506
  cnb_setup_colors();
526
  cnb_delete_action();
527
  cnb_button_overview_modal();
528
 
 
 
 
529
  // page: Profile edit (and domain-upgrade, since it's in a modal there)
530
  cnb_profile_edit_setup();
531
  });
resources/js/domain-upgrade.js CHANGED
@@ -76,35 +76,46 @@ function cnb_domain_upgrade_notice_profile_saved() {
76
  }
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * This calls the admin-ajax action called 'cnb_settings_profile_save'
81
  */
82
  function cnb_ajax_submit_profile() {
83
- jQuery('.buttons_page_call-now-button-domains .cnb-settings-profile #submit')
84
- .on('click', function(){
85
- const form = jQuery('.buttons_page_call-now-button-domains .cnb-settings-profile');
86
-
87
- // Prep data
88
- const formData = form.serialize();
89
- const data = {
90
- action: 'cnb_settings_profile_save',
91
- data: formData
92
- };
93
 
94
- try {
95
- jQuery.post({
96
- url: ajaxurl,
97
- data: data,
98
- success: function () {
99
- // Close box
100
- cnb_domain_upgrade_notice_profile_saved();
101
- jQuery('#TB_closeWindowButton').trigger('click');
102
- }
103
- });
104
- } catch (e) {
105
- showMessage('error', e.message);
106
- }
107
- return false;
108
  });
109
  }
110
 
76
  }
77
  }
78
 
79
+ function do_cnb_ajax_submit_profile() {
80
+ const form = jQuery('.call-now-button_page_call-now-button-domains .cnb-settings-profile');
81
+
82
+ // Prep data
83
+ const formData = form.serialize();
84
+ const data = {
85
+ action: 'cnb_settings_profile_save',
86
+ data: formData
87
+ };
88
+
89
+ try {
90
+ jQuery.post({
91
+ url: ajaxurl,
92
+ data: data,
93
+ success: function () {
94
+ // Close box
95
+ cnb_domain_upgrade_notice_profile_saved();
96
+ jQuery('#TB_closeWindowButton').trigger('click');
97
+ }
98
+ });
99
+ } catch (e) {
100
+ showMessage('error', e.message);
101
+ }
102
+ return false;
103
+ }
104
  /**
105
  * This calls the admin-ajax action called 'cnb_settings_profile_save'
106
  */
107
  function cnb_ajax_submit_profile() {
108
+ console.log('attaching listerers...');
109
+ jQuery('.call-now-button_page_call-now-button-domains .cnb-settings-profile')
110
+ .on('submit', function(e) {
111
+ e.preventDefault();
112
+ return do_cnb_ajax_submit_profile();
113
+ });
114
+ jQuery('.call-now-button_page_call-now-button-domains .cnb-settings-profile #submit')
115
+ .on('click', function(e){
116
+ e.preventDefault();
117
+ return do_cnb_ajax_submit_profile();
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  });
120
  }
121
 
src/admin/legacy-upgrade.php CHANGED
@@ -95,9 +95,10 @@ function cnb_admin_page_legacy_upgrade_render() {
95
  <hr>
96
  <p class="cnb_align_center">From <strong>&euro;2.49/$2.99</strong> per month or <strong style="text-decoration:underline">FREE</strong> with subtle "<em>powered by</em>" branding.</p>',
97
  'cloud',
98
- '<strong>Free and Paid options</strong>',
99
  'Activate Premium',
100
- get_cnb_wordpress_upgrade_link()
 
101
  );
102
  ?>
103
  </div>
95
  <hr>
96
  <p class="cnb_align_center">From <strong>&euro;2.49/$2.99</strong> per month or <strong style="text-decoration:underline">FREE</strong> with subtle "<em>powered by</em>" branding.</p>',
97
  'cloud',
98
+ 'Go to <a href="'.cnb_settings_url().'">Settings</a> to upgrade manually<span class="hide-on-mobile"> or click <a href="'.get_cnb_wordpress_upgrade_link().'">Activate Premium</a></span>.',
99
  'Activate Premium',
100
+ get_cnb_wordpress_upgrade_link(),
101
+ 'Clicking "Activate Premium" will share your WordPress admin email and admin URL with callnowbutton.com so it can prefill your email and return you to this page when the process is done. None of this data is stored! When you click the "Activate" button on the next page, your email will be used for creating an account.'
102
  );
103
  ?>
104
  </div>
src/admin/partials/admin-functions.php CHANGED
@@ -115,10 +115,11 @@ function cnb_create_days_of_week_array($original) {
115
  * @param $cta_pretext
116
  * @param $cta_button_text
117
  * @param $cta_button_link
 
118
  *
119
  * @return null It <code>echo</code>s html output of the promobox
120
  */
121
- function cnb_promobox($color, $headline, $body, $icon = 'flag', $cta_pretext = null, $cta_button_text = 'Let\'s go', $cta_button_link = null) {
122
  $output = '
123
  <div id="cnb_upgrade_box" class="cnb-promobox">
124
  <div class="cnb-promobox-header cnb-promobox-header-'.$color.'">
@@ -151,7 +152,11 @@ function cnb_create_days_of_week_array($original) {
151
  </div>';
152
  }
153
  $output .= '
154
- <div class="clear"></div>
 
 
 
 
155
  </div>
156
  ';
157
  }
@@ -167,13 +172,23 @@ function cnb_create_days_of_week_array($original) {
167
  /**
168
  * Returns the url for the Upgrade to cloud page
169
  *
170
- * @return string admin page url
171
  */
172
  function cnb_legacy_upgrade_page() {
173
  $url = admin_url('admin.php');
174
  $new_link = add_query_arg( 'page', 'call-now-button-upgrade', $url );
175
  return esc_url_raw($new_link);
176
  }
 
 
 
 
 
 
 
 
 
 
177
 
178
  /**
179
  * The equivalent of the JS function `set_cnb_wordpress_upgrade_link`
@@ -186,6 +201,5 @@ function get_cnb_wordpress_upgrade_link() {
186
 
187
  return 'https://www.callnowbutton.com/wordpress'
188
  . '?e=' . $email
189
- . '&a=' . $action
190
- . '&utm_source=wp-plugin&utm_medium=referral&utm_campaign=beta_tester&utm_term=sign-up-for-api';
191
  }
115
  * @param $cta_pretext
116
  * @param $cta_button_text
117
  * @param $cta_button_link
118
+ * @param $cta_footer_notice
119
  *
120
  * @return null It <code>echo</code>s html output of the promobox
121
  */
122
+ function cnb_promobox($color, $headline, $body, $icon = 'flag', $cta_pretext = null, $cta_button_text = 'Let\'s go', $cta_button_link = null, $cta_footer_notice = null) {
123
  $output = '
124
  <div id="cnb_upgrade_box" class="cnb-promobox">
125
  <div class="cnb-promobox-header cnb-promobox-header-'.$color.'">
152
  </div>';
153
  }
154
  $output .= '
155
+ <div class="clear"></div>';
156
+ if(!is_null($cta_footer_notice)) {
157
+ $output .= '<div class="nonessential" style="padding-top: 5px;">'.$cta_footer_notice.'</div>';
158
+ }
159
+ $output .= '
160
  </div>
161
  ';
162
  }
172
  /**
173
  * Returns the url for the Upgrade to cloud page
174
  *
175
+ * @return string upgrade page url
176
  */
177
  function cnb_legacy_upgrade_page() {
178
  $url = admin_url('admin.php');
179
  $new_link = add_query_arg( 'page', 'call-now-button-upgrade', $url );
180
  return esc_url_raw($new_link);
181
  }
182
+ /**
183
+ * Returns the url for the Settings page
184
+ *
185
+ * @return string admin page url
186
+ */
187
+ function cnb_settings_url() {
188
+ $url = admin_url('admin.php');
189
+ $new_link = add_query_arg('page', 'call-now-button-settings', $url);
190
+ return esc_url( $new_link );
191
+ }
192
 
193
  /**
194
  * The equivalent of the JS function `set_cnb_wordpress_upgrade_link`
201
 
202
  return 'https://www.callnowbutton.com/wordpress'
203
  . '?e=' . $email
204
+ . '&a=' . $action;
 
205
  }
src/admin/partials/domain-upgrade/overview.php CHANGED
@@ -64,7 +64,7 @@ function cnb_domain_upgrade_overview($domain, $user) {
64
  });
65
  <?php } ?>
66
  </script>
67
- <p>Your domain <strong><?php esc_html_e($domain->name) ?></strong> is currently on the <code><?php esc_html_e($domain->type) ?></code> cloud plan.</p>
68
 
69
  <form id="wp_domain_upgrade" method="post">
70
  <input type="hidden" name="cnb_domain_id" id="cnb_domain_id" value="<?php esc_attr_e($domain->id) ?>">
@@ -82,9 +82,9 @@ function cnb_domain_upgrade_overview($domain, $user) {
82
  <div class="pricebox">
83
  <h3 class="yearly">Yearly Plan</h3>
84
  <div class="benefit">All branding removed</div>
85
- <div class="plan-amount"><span class="currency">€</span><span class="euros">1</span><span class="cents">.67</span><span class="timeframe">/month</span></div>
86
  <div class="billingprice">
87
- Billed at €19.99 annually
88
  </div>
89
  <?php getProfileEditModal('button button-primary', 'Next', 'Verify your information', 'powered-by-eur-yearly'); ?>
90
  <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
@@ -94,9 +94,9 @@ function cnb_domain_upgrade_overview($domain, $user) {
94
  <div class="pricebox">
95
  <h3 class="">Monthly Plan</h3>
96
  <div class="benefit">All branding removed</div>
97
- <div class="plan-amount"><span class="currency">€</span><span class="euros">4</span><span class="cents">.99</span><span class="timeframe">/month</span></div>
98
  <div class="billingprice">
99
- Billed at €4.99 monthly
100
  </div>
101
  <?php getProfileEditModal('button button-secondary', 'Next', 'Verify your information', 'powered-by-eur-monthly'); ?>
102
  <a class="button button-secondary button-upgrade powered-by-eur-monthly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
@@ -107,9 +107,9 @@ function cnb_domain_upgrade_overview($domain, $user) {
107
  <div class="pricebox">
108
  <h3 class="yearly">Yearly Plan</h3>
109
  <div class="benefit">All branding removed</div>
110
- <div class="plan-amount"><span class="currency">$</span><span class="euros">1</span><span class="cents">.99</span><span class="timeframe">/month</span></div>
111
  <div class="billingprice">
112
- Billed at $23.88 annually
113
  </div>
114
  <?php getProfileEditModal('button button-primary', 'Next', 'Verify your information', 'powered-by-usd-yearly'); ?>
115
  <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
@@ -118,9 +118,9 @@ function cnb_domain_upgrade_overview($domain, $user) {
118
  <div class="pricebox">
119
  <h3 class="">Monthly Plan</h3>
120
  <div class="benefit">All branding removed</div>
121
- <div class="plan-amount"><span class="currency">$</span><span class="euros">5</span><span class="cents">.99</span><span class="timeframe">/month</span></div>
122
  <div class="billingprice">
123
- Billed at $5.99 monthly
124
  </div>
125
  <?php getProfileEditModal('button button-secondary', 'Next', 'Verify your information', 'powered-by-usd-monthly'); ?>
126
  <a class="button button-secondary button-upgrade powered-by-usd-monthly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
@@ -129,13 +129,14 @@ function cnb_domain_upgrade_overview($domain, $user) {
129
  </div>
130
  </form>
131
 
132
- <p class="cnb-center">All <u>cloud</u> plans (free and paid) contain the following features:</p>
133
  <div class="cnb-center" style="margin-bottom:50px;">
134
  <div><b>&check;</b> Phone, Email, Location, WhatsApp, Links</div>
135
- <div><b>&check;</b> Unlimited buttons</div>
136
- <div><b>&check;</b> Multibutton</div>
137
- <div><b>&check;</b> Buttonbar (full width with multiple actions)</div>
138
  <div><b>&check;</b> Advanced page targeting options</div>
139
  <div><b>&check;</b> Scheduling</div>
 
140
  </div>
141
  <?php }
64
  });
65
  <?php } ?>
66
  </script>
67
+ <p>Your domain <strong><?php esc_html_e($domain->name) ?></strong> is currently on the Premium <code><?php esc_html_e($domain->type) ?></code> plan.</p>
68
 
69
  <form id="wp_domain_upgrade" method="post">
70
  <input type="hidden" name="cnb_domain_id" id="cnb_domain_id" value="<?php esc_attr_e($domain->id) ?>">
82
  <div class="pricebox">
83
  <h3 class="yearly">Yearly Plan</h3>
84
  <div class="benefit">All branding removed</div>
85
+ <div class="plan-amount"><span class="currency">€</span><span class="euros">2</span><span class="cents">.49</span><span class="timeframe">/month</span></div>
86
  <div class="billingprice">
87
+ Billed at €29.88 annually
88
  </div>
89
  <?php getProfileEditModal('button button-primary', 'Next', 'Verify your information', 'powered-by-eur-yearly'); ?>
90
  <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
94
  <div class="pricebox">
95
  <h3 class="">Monthly Plan</h3>
96
  <div class="benefit">All branding removed</div>
97
+ <div class="plan-amount"><span class="currency">€</span><span class="euros">4</span><span class="cents">.98</span><span class="timeframe">/month</span></div>
98
  <div class="billingprice">
99
+ Billed at €4.98 monthly
100
  </div>
101
  <?php getProfileEditModal('button button-secondary', 'Next', 'Verify your information', 'powered-by-eur-monthly'); ?>
102
  <a class="button button-secondary button-upgrade powered-by-eur-monthly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
107
  <div class="pricebox">
108
  <h3 class="yearly">Yearly Plan</h3>
109
  <div class="benefit">All branding removed</div>
110
+ <div class="plan-amount"><span class="currency">$</span><span class="euros">2</span><span class="cents">.99</span><span class="timeframe">/month</span></div>
111
  <div class="billingprice">
112
+ Billed at $34.88 annually
113
  </div>
114
  <?php getProfileEditModal('button button-primary', 'Next', 'Verify your information', 'powered-by-usd-yearly'); ?>
115
  <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
118
  <div class="pricebox">
119
  <h3 class="">Monthly Plan</h3>
120
  <div class="benefit">All branding removed</div>
121
+ <div class="plan-amount"><span class="currency">$</span><span class="euros">5</span><span class="cents">.98</span><span class="timeframe">/month</span></div>
122
  <div class="billingprice">
123
+ Billed at $5.98 monthly
124
  </div>
125
  <?php getProfileEditModal('button button-secondary', 'Next', 'Verify your information', 'powered-by-usd-monthly'); ?>
126
  <a class="button button-secondary button-upgrade powered-by-usd-monthly" href="#" onclick="cnb_get_checkout('<?php _e($plan->id) ?>')">Upgrade</a>
129
  </div>
130
  </form>
131
 
132
+ <p class="cnb-center">All <u>Premium</u> plans (free and paid) contain the following features:</p>
133
  <div class="cnb-center" style="margin-bottom:50px;">
134
  <div><b>&check;</b> Phone, Email, Location, WhatsApp, Links</div>
135
+ <div><b>&check;</b> Multiple buttons</div>
136
+ <div><b>&check;</b> Multibutton&trade; (expandable single button with multiple actions)</div>
137
+ <div><b>&check;</b> Buttonbar&trade; (full width with multiple actions)</div>
138
  <div><b>&check;</b> Advanced page targeting options</div>
139
  <div><b>&check;</b> Scheduling</div>
140
+ <div><b>&check;</b> And more!</div>
141
  </div>
142
  <?php }
src/admin/settings-profile.php CHANGED
@@ -266,6 +266,7 @@ function cnb_admin_profile_edit_process_real($nonce, $profile) {
266
  function cnb_admin_profile_edit_process() {
267
  global $cnb_slug_base;
268
  $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
 
269
  $profile = filter_input(
270
  INPUT_POST,
271
  'user',
@@ -279,13 +280,16 @@ function cnb_admin_profile_edit_process() {
279
  $transient_id = 'cnb-' . wp_generate_uuid4();
280
  set_transient( $transient_id, $notification, HOUR_IN_SECONDS );
281
 
 
 
 
282
  // Redirect
283
  // Create link
284
  $url = admin_url( 'admin.php' );
285
  $redirect_link =
286
  add_query_arg(
287
  array(
288
- 'page' => 'call-now-button-profile',
289
  'tid' => $transient_id
290
  ),
291
  $url );
@@ -318,7 +322,11 @@ function cnb_admin_page_profile_edit_render_form($modal = false) {
318
  <input type="hidden" name="page" value="call-now-button" />
319
  <input type="hidden" name="action" value="cnb_profile_edit" />
320
  <?php wp_nonce_field('cnb-profile-edit') ?>
321
- <table class="form-table nav-tab-only">
 
 
 
 
322
  <tbody>
323
  <?php if(!$modal) { ?>
324
  <tr>
266
  function cnb_admin_profile_edit_process() {
267
  global $cnb_slug_base;
268
  $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
269
+ $page_source = filter_input( INPUT_POST, 'page_source', FILTER_SANITIZE_STRING );
270
  $profile = filter_input(
271
  INPUT_POST,
272
  'user',
280
  $transient_id = 'cnb-' . wp_generate_uuid4();
281
  set_transient( $transient_id, $notification, HOUR_IN_SECONDS );
282
 
283
+ if ($page_source === 'domain-upgrade') {
284
+ return;
285
+ }
286
  // Redirect
287
  // Create link
288
  $url = admin_url( 'admin.php' );
289
  $redirect_link =
290
  add_query_arg(
291
  array(
292
+ 'page' => $cnb_slug_base . '-profile',
293
  'tid' => $transient_id
294
  ),
295
  $url );
322
  <input type="hidden" name="page" value="call-now-button" />
323
  <input type="hidden" name="action" value="cnb_profile_edit" />
324
  <?php wp_nonce_field('cnb-profile-edit') ?>
325
+ <?php
326
+ // Modal likely means "via domain-upgrade", so we need to send users back there
327
+ if ($modal) { ?><input type="hidden" name="page_source" value="domain-upgrade" /><?php } ?>
328
+
329
+ <table class="form-table nav-tab-only">
330
  <tbody>
331
  <?php if(!$modal) { ?>
332
  <tr>
src/admin/settings.php CHANGED
@@ -453,8 +453,8 @@ function cnb_admin_settings_page() {
453
  <p>If you need more phone numbers on a single page, then the Multibutton&trade; and the Buttonbar&trade; give you exactly what you need.</p>',
454
  'cloud',
455
  '<strong>Give it a try!</strong>',
456
- 'Enable Premium',
457
- get_cnb_wordpress_upgrade_link()
458
  );
459
  cnb_promobox(
460
  'grey',
453
  <p>If you need more phone numbers on a single page, then the Multibutton&trade; and the Buttonbar&trade; give you exactly what you need.</p>',
454
  'cloud',
455
  '<strong>Give it a try!</strong>',
456
+ 'Learn more',
457
+ cnb_legacy_upgrade_page()
458
  );
459
  cnb_promobox(
460
  'grey',
src/utils/notices.php CHANGED
@@ -30,8 +30,10 @@ function cnb_settings_get_account_missing_notice() {
30
  <p>To activate Call Now Button Premium, you\'ll need an account at
31
  <a href="https://app.callnowbutton.com?utm_source=wp-plugin&utm_medium=referral&utm_campaign=beta_tester&utm_term=sign-up-for-api">https://app.callnowbutton.com</a>, generate a unique key and paste that into the field below. There\'s 2 ways to do this:</p>
32
  <h4>Option 1: The fast track</h4>
33
- <a class="button button-primary" id="cnb-go-create-account" href="">Take the fast track</a>
 
34
  <p>In the fast track we\'ve tried to automate as much as possible of the process and make this as easy as possible.</p>
 
35
  <h4>Option 2: The manual process</h4>
36
  <ol>
37
  <li>Create your account at <a href="https://app.callnowbutton.com?utm_source=wp-plugin&utm_medium=referral&utm_campaign=beta_tester&utm_term=sign-up-for-api">https://app.callnowbutton.com</a></li>
@@ -84,8 +86,6 @@ function cnb_settings_api_key_input() {
84
  <tr class="when-cloud-enabled">
85
  <th scope="row">API key</th>
86
  <td>
87
- <input type="hidden" id="admin_email" value="'. esc_attr(get_bloginfo('admin_email')) .'">
88
- <input type="hidden" id="admin_url" value="'. esc_attr($settings_url) .'">
89
  <input type="text" class="regular-text" name="cnb[api_key]"
90
  placeholder="e.g. b52c3f83-38dc-4493-bc90-642da5be7e39"/>
91
  '. get_submit_button(__('Save API key'), 'primary', 'submit', false).'
30
  <p>To activate Call Now Button Premium, you\'ll need an account at
31
  <a href="https://app.callnowbutton.com?utm_source=wp-plugin&utm_medium=referral&utm_campaign=beta_tester&utm_term=sign-up-for-api">https://app.callnowbutton.com</a>, generate a unique key and paste that into the field below. There\'s 2 ways to do this:</p>
32
  <h4>Option 1: The fast track</h4>
33
+ <a class="button button-primary" href="' . get_cnb_wordpress_upgrade_link() .'">Take the fast track</a>
34
+ <p class="nonessential">This shares your WordPress admin email and this page\'s URL with callnowbutton.com so it can prefill your email and return you to this page when the process is done. None of this data is stored! When you click the "Activate Premium" button on the next page, your email will be used for creating an account.</p>
35
  <p>In the fast track we\'ve tried to automate as much as possible of the process and make this as easy as possible.</p>
36
+
37
  <h4>Option 2: The manual process</h4>
38
  <ol>
39
  <li>Create your account at <a href="https://app.callnowbutton.com?utm_source=wp-plugin&utm_medium=referral&utm_campaign=beta_tester&utm_term=sign-up-for-api">https://app.callnowbutton.com</a></li>
86
  <tr class="when-cloud-enabled">
87
  <th scope="row">API key</th>
88
  <td>
 
 
89
  <input type="text" class="regular-text" name="cnb[api_key]"
90
  placeholder="e.g. b52c3f83-38dc-4493-bc90-642da5be7e39"/>
91
  '. get_submit_button(__('Save API key'), 'primary', 'submit', false).'
src/utils/utils.php CHANGED
@@ -49,20 +49,14 @@ function cnb_get_options() { // Grabbing existing settings and creating them if
49
  * Compares version numbers
50
  *
51
  * @param $cnb_options array The result of a basic `get_option('cnb')`
52
- * @return bool
53
  */
54
  function cnb_update_needed($cnb_options) {
55
- $pluginVersion = CNB_VERSION;
56
- $setupVersion = array_key_exists('version', $cnb_options) ? $cnb_options['version'] : 0.1;
57
- if($pluginVersion == $setupVersion) {
58
- return false;
59
- } elseif(substr($pluginVersion,0,3) > substr($setupVersion,0,3)) {
60
- return true;
61
- } elseif(substr($pluginVersion,0,3) == substr($setupVersion,0,3)) {
62
- return substr($pluginVersion,-1) > substr($setupVersion,-1);
63
- } else {
64
- return false;
65
- }
66
  }
67
 
68
  /**
49
  * Compares version numbers
50
  *
51
  * @param $cnb_options array The result of a basic `get_option('cnb')`
52
+ * @return bool true if there has been an update, false otherwise
53
  */
54
  function cnb_update_needed($cnb_options) {
55
+ $setupVersion = array_key_exists('version', $cnb_options) ? $cnb_options['version'] : "0.1.0";
56
+
57
+ // 1 if version in DB is lower, 0 if the same, -1 if DB is higher than defined plugin (should never happen..)
58
+ $compare = version_compare(CNB_VERSION, $setupVersion);
59
+ return $compare === 1;
 
 
 
 
 
 
60
  }
61
 
62
  /**