Call Now Button - Version 1.3.0

Version Description

  • Cloud becomes NowButtons
  • UI improvements
  • Changes to free and pro plans (NowButtons)
Download this release

Release Info

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

Code changes from version 1.2.2 to 1.3.0

Files changed (51) hide show
  1. call-now-button.php +8 -7
  2. readme.txt +22 -14
  3. resources/images/confetti.gif +0 -0
  4. resources/images/confetti2.gif +0 -0
  5. resources/images/custom-image.jpg +0 -0
  6. resources/images/nowbuttons-256x256.png +0 -0
  7. resources/images/onboarding/add-action.png +0 -0
  8. resources/images/onboarding/button-presenation.png +0 -0
  9. resources/images/onboarding/button-presentation.png +0 -0
  10. resources/images/onboarding/buttons-overview.png +0 -0
  11. resources/images/onboarding/nav-position.png +0 -0
  12. resources/images/onboarding/preview.png +0 -0
  13. resources/images/scheduler.png +0 -0
  14. resources/js/call-now-button.js +35 -2
  15. resources/js/condition-edit.js +2 -0
  16. resources/js/domain-upgrade.js +9 -0
  17. resources/js/js-confetti/js-confetti.browser.js +1 -0
  18. resources/js/preview.js +1 -1
  19. resources/style/call-now-button.css +303 -13
  20. src/CallNowButton.php +13 -3
  21. src/admin/CnbAdminAjax.php +14 -0
  22. src/admin/action/CnbActionType.php +6 -7
  23. src/admin/action/CnbActionViewEdit.php +48 -41
  24. src/admin/action/partials/class-action-whatsapp-settings.php +28 -4
  25. src/admin/button/CnbButton.php +1 -1
  26. src/admin/button/CnbButtonController.php +3 -2
  27. src/admin/button/CnbButtonView.php +39 -28
  28. src/admin/button/CnbButtonViewEdit.php +15 -589
  29. src/admin/button/partials/class-button-edit-table.php +709 -0
  30. src/admin/condition/CnbCondition.php +1 -1
  31. src/admin/condition/CnbConditionViewEdit.php +32 -22
  32. src/admin/domain/CnbDomain.php +4 -1
  33. src/admin/domain/CnbDomainViewEdit.php +47 -25
  34. src/admin/domain/CnbDomainViewUpgrade.php +6 -6
  35. src/admin/domain/Cnb_Domain_List_Table.php +2 -0
  36. src/admin/domain/partials/CnbDomainViewUpgradeFinished.php +35 -47
  37. src/admin/domain/partials/CnbDomainViewUpgradeOverview.php +654 -107
  38. src/admin/getting-started/class-getting-started-view.php +62 -57
  39. src/admin/legacy/CnbLegacyEdit.php +46 -53
  40. src/admin/legacy/CnbLegacyUpgrade.php +145 -100
  41. src/admin/models/CnbPlan.php +13 -8
  42. src/admin/partials/CnbFooter.php +13 -8
  43. src/admin/partials/CnbHeaderNotices.php +1 -1
  44. src/admin/settings/CnbApiKeyActivatedView.php +64 -50
  45. src/admin/settings/CnbSettingsController.php +4 -4
  46. src/admin/settings/CnbSettingsViewEdit.php +57 -40
  47. src/autoload.php +1 -0
  48. src/coupons/class-cnb-promotion-code.php +4 -4
  49. src/notices/CnbAdminNotices.php +1 -0
  50. src/utils/CnbAdminFunctions.php +34 -18
  51. src/utils/CnbUtils.php +1 -1
call-now-button.php CHANGED
@@ -2,15 +2,15 @@
2
  /*
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.2.2
7
  Author: Jerry & Jasper
8
- Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
10
  License: GPL2
11
  */
12
 
13
- /* Copyright 2013-2020 Jerry Rietveld (email : jerry@studiostacks.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
@@ -26,14 +26,15 @@ License: GPL2
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
- define('CNB_VERSION', '1.2.2');
30
  define('CNB_NAME', 'Call Now Button');
 
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
33
  define('CNB_FILENAME', str_replace(CNB_BASEFOLDER . '/', '', CNB_BASENAME));
34
- define('CNB_WEBSITE', 'https://callnowbutton.com/');
35
  define('CNB_SUPPORT', CNB_WEBSITE . 'support/');
36
- define('CNB_APP', 'https://app.callnowbutton.com/');
37
  define('CNB_SLUG', sanitize_title(CNB_NAME));
38
 
39
  register_activation_hook(__FILE__, array('cnb\admin\deactivation\Activation', 'onActivation'));
2
  /*
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
+ Description: Shows a <strong>Call Now Button</strong> to your mobile visitors. 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. Create an account to enable extra actions such as <strong>WhatsApp</strong>, <strong>Messenger</strong>, <strong>Telegram</strong>, <strong>Signal</strong>, <strong>Email</strong>, <strong>SMS</strong>, <strong>Maps</strong> and <strong>links</strong>. Also offers additional functionality such as advanced display rules, scheduling, geo rules, appear after scrolling, button animations and much more.
6
+ Version: 1.3.0
7
  Author: Jerry & Jasper
8
+ Author URI: https://nowbuttons.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
10
  License: GPL2
11
  */
12
 
13
+ /* Copyright 2013-2020 Jerry Rietveld (email : jerry@nowbuttons.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
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
+ define('CNB_VERSION', '1.3.0');
30
  define('CNB_NAME', 'Call Now Button');
31
+ define('CNB_CLOUD_NAME', 'NowButtons for WordPress');
32
  define('CNB_BASENAME', plugin_basename(__FILE__));
33
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
34
  define('CNB_FILENAME', str_replace(CNB_BASEFOLDER . '/', '', CNB_BASENAME));
35
+ define('CNB_WEBSITE', 'https://nowbuttons.com/');
36
  define('CNB_SUPPORT', CNB_WEBSITE . 'support/');
37
+ define('CNB_APP', 'https://app.nowbuttons.com/');
38
  define('CNB_SLUG', sanitize_title(CNB_NAME));
39
 
40
  register_activation_hook(__FILE__, array('cnb\admin\deactivation\Activation', 'onActivation'));
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://callnowbutton.com/donate/
4
  Tags: call button, click to call, convert, call now button, contact button
5
  Requires at least: 4.1
6
  Requires PHP: 5.4
7
- Tested up to: 6.0
8
- Stable tag: 1.2.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -19,7 +19,7 @@ This plugin places a Call Now Button (click-to-call button) to the bottom of the
19
  No more navigating to the contact page and no more complicated copy/pasting or memorizing the phone number!
20
 
21
  #### More actions
22
- Connect to our **cloud service** to enable more action buttons such as **WhatsApp Chat**, **Signal**, **Telegram**, **Messenger**, **SMS/Text**, **Email**, **Directions** and more. Find a more complete overview below in the _Cloud section_.
23
 
24
  ###Could not be easier!
25
  The settings are very easy: enable and enter your phone number. That's it!
@@ -32,24 +32,27 @@ Under the **Presentation tab** you can change the colors of the button, move it
32
  #### Settings
33
  In the **Settings menu** you'll find a bunch of features such as click tracking in Google Analytics, fire a conversion tag so a call is registered as a conversion in Google Ads, adjust the size of the button or move the button further backwards in case you want something else to sit on top of it (e.g. your privacy notice). Here you can also enable the connection to our _Cloud service_.
34
 
35
- ### Call Now Button CLOUD
36
- Connect the plugin to our Cloud service (which is super easy) enables many extra features. Here's an overview:
37
 
38
  * ⚡ More actions: SMS/Text, Email, Maps, URLs, Scroll to top
39
- * 🤗 Social chat: WhatsApp Chat, Messenger, Telegram, Signal
40
- * 🆕Multiple buttons for your website, even on a single page
 
41
  * 🗂️ Multi action buttons
 
 
 
 
 
 
 
42
  * 💬 WhatsApp chat window
43
  * 🖥️Desktop/laptop and mobile support
44
- * 🎯Create smart rules for your buttons to appear
45
  * 🕘 Scheduler: create a weekly schedule for your buttons
46
- * 👋Add extra attention grabbing animations
47
  * 🎨 Icon picker
48
  * 👽 3rd party integrations
49
-
50
- ### Call Now Button PRO
51
- We also offer a paid version of the Call Now Button. The PRO plan offers the following extras:
52
-
53
  * ✨ Slide-in Content Windows
54
  * 📷 Use custom images on buttons
55
  * 🌍 Include and exclude countries
@@ -115,7 +118,7 @@ Yes, you can enter the IDs of posts and pages you wish to include or exclude.
115
 
116
  = I need way more flexibility! Isn't there a PRO version that I can use? =
117
 
118
- Yes, you can connect to our Cloud service (for free) to enable tons of extra features. There you also have the option to upgrade to PRO. Scroll up to see what's included in Cloud and PRO. Or check out [callnowbutton.com](https://callnowbutton.com/).
119
 
120
 
121
  == Screenshots ==
@@ -127,6 +130,11 @@ Yes, you can connect to our Cloud service (for free) to enable tons of extra fea
127
 
128
 
129
  == Changelog ==
 
 
 
 
 
130
  = 1.2.2 =
131
  * UI improvements
132
 
4
  Tags: call button, click to call, convert, call now button, contact button
5
  Requires at least: 4.1
6
  Requires PHP: 5.4
7
+ Tested up to: 6.1
8
+ Stable tag: 1.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
19
  No more navigating to the contact page and no more complicated copy/pasting or memorizing the phone number!
20
 
21
  #### More actions
22
+ Connect to our **cloud service** to enable more action buttons such as **WhatsApp**, **Signal**, **Telegram**, **Messenger**, **SMS/Text**, **Email**, **Directions** and more. Find a more complete overview below in the _Account_ section.
23
 
24
  ###Could not be easier!
25
  The settings are very easy: enable and enter your phone number. That's it!
32
  #### Settings
33
  In the **Settings menu** you'll find a bunch of features such as click tracking in Google Analytics, fire a conversion tag so a call is registered as a conversion in Google Ads, adjust the size of the button or move the button further backwards in case you want something else to sit on top of it (e.g. your privacy notice). Here you can also enable the connection to our _Cloud service_.
34
 
35
+ ### Connecting to NowButtons.com
36
+ Connect the plugin to our cloud service NowButtons.com is super easy and enables extra actions & features. Here's an overview:
37
 
38
  * ⚡ More actions: SMS/Text, Email, Maps, URLs, Scroll to top
39
+ * 🤗 Social chat: WhatsApp, Messenger, Telegram, Signal
40
+ * 🆕 Create 5 different buttons (instead of 1)
41
+ * 🎯 Create smarter rules to decide where buttons should appear
42
  * 🗂️ Multi action buttons
43
+
44
+ ### Call Now Button PRO
45
+ We also offer a paid version of NowButtons which you can try 14 days for free!
46
+
47
+ The PRO plan offers the following extras:
48
+
49
+ * 🧳 Create 100 unique buttons
50
  * 💬 WhatsApp chat window
51
  * 🖥️Desktop/laptop and mobile support
 
52
  * 🕘 Scheduler: create a weekly schedule for your buttons
53
+ * 👋 Add extra attention grabbing animations
54
  * 🎨 Icon picker
55
  * 👽 3rd party integrations
 
 
 
 
56
  * ✨ Slide-in Content Windows
57
  * 📷 Use custom images on buttons
58
  * 🌍 Include and exclude countries
118
 
119
  = I need way more flexibility! Isn't there a PRO version that I can use? =
120
 
121
+ Yes, you can connect the plugin to our cloud service NowButton.com. That already enables a bunch of extras. From there you can easily upgrade to PRO. Scroll up to see what's included PRO. Or check out [NowButtons.com](https://nowbuttons.com/).
122
 
123
 
124
  == Screenshots ==
130
 
131
 
132
  == Changelog ==
133
+ = 1.3.0 =
134
+ * Cloud becomes NowButtons
135
+ * UI improvements
136
+ * Changes to free and pro plans (NowButtons)
137
+
138
  = 1.2.2 =
139
  * UI improvements
140
 
resources/images/confetti.gif ADDED
Binary file
resources/images/confetti2.gif ADDED
Binary file
resources/images/custom-image.jpg ADDED
Binary file
resources/images/nowbuttons-256x256.png ADDED
Binary file
resources/images/onboarding/add-action.png CHANGED
Binary file
resources/images/onboarding/button-presenation.png DELETED
Binary file
resources/images/onboarding/button-presentation.png ADDED
Binary file
resources/images/onboarding/buttons-overview.png CHANGED
Binary file
resources/images/onboarding/nav-position.png CHANGED
Binary file
resources/images/onboarding/preview.png CHANGED
Binary file
resources/images/scheduler.png ADDED
Binary file
resources/js/call-now-button.js CHANGED
@@ -123,6 +123,24 @@ function cnb_setup_toggle_label_clicks() {
123
  jQuery('#' + stateLabel).trigger('click')
124
  })
125
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  function cnb_hide_edit_action_if_advanced() {
128
  const element = jQuery('#toplevel_page_call-now-button li.current a')
@@ -246,7 +264,7 @@ function cnb_delete_action() {
246
  */
247
  function cnb_button_overview_modal() {
248
  jQuery(".cnb_type_selector_item").on('click', function(){
249
- jQuery(".cnb_type_selector_item").removeClass('cnb_type_selector_active')
250
  jQuery(this).addClass("cnb_type_selector_active")
251
  const cnbType = jQuery(this).attr("data-cnb-selection")
252
  jQuery('#button_type').val(cnbType)
@@ -326,7 +344,7 @@ function cnb_hide_add_new_on_error() {
326
 
327
  function cnb_setup_pricing() {
328
  // Find the elements
329
- const elements = jQuery('.eur-per-month, .usd-per-month, .eur-discount, .usd-discount')
330
 
331
  // If there are elements, find the pricing (ajax call)
332
  if (elements.length) {
@@ -336,15 +354,29 @@ function cnb_setup_pricing() {
336
  jQuery.post(ajaxurl, data)
337
  .done((result) => {
338
  // Fix the elements
 
 
339
  result['eur_per_month'] = parseFloat(result['eur_per_month']).toFixed(2)
340
  result['usd_per_month'] = parseFloat(result['usd_per_month']).toFixed(2)
341
  result['eur_discount'] = Math.ceil(parseFloat(result['eur_discount']))
342
  result['usd_discount'] = Math.ceil(parseFloat(result['usd_discount']))
 
 
343
 
 
 
344
  jQuery('.eur-per-month').text(result['eur_per_month'])
345
  jQuery('.usd-per-month').text(result['usd_per_month'])
346
  jQuery('.eur-discount').text(result['eur_discount'])
347
  jQuery('.usd-discount').text(result['usd_discount'])
 
 
 
 
 
 
 
 
348
  })
349
  }
350
  }
@@ -360,6 +392,7 @@ jQuery( function() {
360
  cnb_strip_beta_from_referrer()
361
  cnb_animate_saving()
362
  cnb_setup_toggle_label_clicks()
 
363
  cnb_switch_tab_from_history_listener()
364
 
365
  // Allow for tab switching to be dynamic
123
  jQuery('#' + stateLabel).trigger('click')
124
  })
125
  }
126
+ function cnb_currency_toggle() {
127
+ jQuery('.cnb-currency-toggle-cb').change(
128
+ function(){
129
+ jQuery('.cnb-currency-toggle-cb').prop('checked', jQuery(this).is(':checked'))
130
+ if (jQuery(this).is(':checked')) {
131
+ jQuery('.cnb_currency_active_eur').css('font-weight','normal')
132
+ jQuery('.cnb_currency_active_usd').css('font-weight','bold')
133
+ jQuery('.currency-box-eur').css('display','none')
134
+ jQuery('.currency-box-usd').css('display','flex')
135
+ } else {
136
+ jQuery('.cnb_currency_active_usd').css('font-weight','normal')
137
+ jQuery('.cnb_currency_active_eur').css('font-weight','bold')
138
+ jQuery('.currency-box-eur').css('display','flex')
139
+ jQuery('.currency-box-usd').css('display','none')
140
+ }
141
+ });
142
+ }
143
+
144
 
145
  function cnb_hide_edit_action_if_advanced() {
146
  const element = jQuery('#toplevel_page_call-now-button li.current a')
264
  */
265
  function cnb_button_overview_modal() {
266
  jQuery(".cnb_type_selector_item").on('click', function(){
267
+ jQuery(".cnb_type_selector").removeClass('cnb_type_selector_active')
268
  jQuery(this).addClass("cnb_type_selector_active")
269
  const cnbType = jQuery(this).attr("data-cnb-selection")
270
  jQuery('#button_type').val(cnbType)
344
 
345
  function cnb_setup_pricing() {
346
  // Find the elements
347
+ const elements = jQuery('.eur-per-year, .usd-per-year, .eur-per-month, .usd-per-month, .eur-discount, .usd-discount, .eur-trial-period-days, .usd-trial-period-days')
348
 
349
  // If there are elements, find the pricing (ajax call)
350
  if (elements.length) {
354
  jQuery.post(ajaxurl, data)
355
  .done((result) => {
356
  // Fix the elements
357
+ result['eur_per_year'] = (Math.round(result['eur_per_year'] * 100) / 100).toFixed(2)
358
+ result['usd_per_year'] = (Math.round(result['usd_per_year'] * 100) / 100).toFixed(2)
359
  result['eur_per_month'] = parseFloat(result['eur_per_month']).toFixed(2)
360
  result['usd_per_month'] = parseFloat(result['usd_per_month']).toFixed(2)
361
  result['eur_discount'] = Math.ceil(parseFloat(result['eur_discount']))
362
  result['usd_discount'] = Math.ceil(parseFloat(result['usd_discount']))
363
+ result['eur_trial_period_days'] = Math.ceil(parseFloat(result['eur_trial_period_days']))
364
+ result['usd_trial_period_days'] = Math.ceil(parseFloat(result['usd_trial_period_days']))
365
 
366
+ jQuery('.eur-per-year').text(result['eur_per_year'])
367
+ jQuery('.usd-per-year').text(result['usd_per_year'])
368
  jQuery('.eur-per-month').text(result['eur_per_month'])
369
  jQuery('.usd-per-month').text(result['usd_per_month'])
370
  jQuery('.eur-discount').text(result['eur_discount'])
371
  jQuery('.usd-discount').text(result['usd_discount'])
372
+ if (result['eur_trial_period_days'] > 0) {
373
+ jQuery('.eur-trial-period-days').text(result['eur_trial_period_days'])
374
+ jQuery('.eur-trial-period-days-wrapper').removeClass('eur-trial-period-days-wrapper')
375
+ }
376
+ if (result['usd_trial_period_days'] > 0) {
377
+ jQuery('.usd-trial-period-days').text(result['usd_trial_period_days'])
378
+ jQuery('.usd-trial-period-days-wrapper').removeClass('usd-trial-period-days-wrapper')
379
+ }
380
  })
381
  }
382
  }
392
  cnb_strip_beta_from_referrer()
393
  cnb_animate_saving()
394
  cnb_setup_toggle_label_clicks()
395
+ cnb_currency_toggle()
396
  cnb_switch_tab_from_history_listener()
397
 
398
  // Allow for tab switching to be dynamic
resources/js/condition-edit.js CHANGED
@@ -9,6 +9,8 @@ function cnb_show_condition_placeholder_action() {
9
  placeholderText = 'category/'
10
  } else if(optionSelected === 'REGEX') {
11
  placeholderText = '/(index|about)(\?id=[0-9]+)?$'
 
 
12
  } else if(optionSelected === 'COUNTRY_CODE') {
13
  placeholderText = '2 letter country code (e.g. NL)'
14
  }
9
  placeholderText = 'category/'
10
  } else if(optionSelected === 'REGEX') {
11
  placeholderText = '/(index|about)(\?id=[0-9]+)?$'
12
+ } else if(optionSelected === 'PARAMETER') {
13
+ placeholderText = 'foo=bar'
14
  } else if(optionSelected === 'COUNTRY_CODE') {
15
  placeholderText = '2 letter country code (e.g. NL)'
16
  }
resources/js/domain-upgrade.js CHANGED
@@ -98,6 +98,15 @@ function cnb_countdown_timer() {
98
  }, 1000);
99
  }
100
 
 
 
 
 
 
 
 
 
 
101
  jQuery(function () {
102
  cnb_domain_upgrade_hide_notice()
103
  cnb_domain_upgrade_currency()
98
  }, 1000);
99
  }
100
 
101
+ /**
102
+ * Requires https://github.com/loonywizard/js-confetti
103
+ * Which is injected via PHP: <code>wp_enqueue_script( CNB_SLUG . '-confetti' );</code>
104
+ */
105
+ function cnb_confetti() {
106
+ const jsConfetti = new JSConfetti()
107
+ jsConfetti.addConfetti()
108
+ }
109
+
110
  jQuery(function () {
111
  cnb_domain_upgrade_hide_notice()
112
  cnb_domain_upgrade_currency()
resources/js/js-confetti/js-confetti.browser.js ADDED
@@ -0,0 +1 @@
 
1
+ var JSConfetti=function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}function n(t){return+t.replace(/px/,"")}function s(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=Math.random()*(e-t)+t;return Math.floor(n*Math.pow(10,i))/Math.pow(10,i)}function o(t){return t[s(0,t.length)]}var a=["#fcf403","#62fc03","#f4fc03","#03e7fc","#03fca5","#a503fc","#fc03ad","#fc03c2"];function r(t){return Math.log(t)/Math.log(1920)}var h=function(){function e(i){t(this,e);var n=i.initialPosition,a=i.direction,h=i.confettiRadius,c=i.confettiColors,u=i.emojis,l=i.emojiSize,d=i.canvasWidth,f=s(.9,1.7,3)*r(d);this.confettiSpeed={x:f,y:f},this.finalConfettiSpeedX=s(.2,.6,3),this.rotationSpeed=u.length?.01:s(.03,.07,3)*r(d),this.dragForceCoefficient=s(5e-4,9e-4,6),this.radius={x:h,y:h},this.initialRadius=h,this.rotationAngle="left"===a?s(0,.2,3):s(-.2,0,3),this.emojiSize=l,this.emojiRotationAngle=s(0,2*Math.PI),this.radiusYUpdateDirection="down";var m="left"===a?s(82,15)*Math.PI/180:s(-15,-82)*Math.PI/180;this.absCos=Math.abs(Math.cos(m)),this.absSin=Math.abs(Math.sin(m));var v=s(-150,0),p={x:n.x+("left"===a?-v:v)*this.absCos,y:n.y-v*this.absSin};this.currentPosition=Object.assign({},p),this.initialPosition=Object.assign({},p),this.color=u.length?null:o(c),this.emoji=u.length?o(u):null,this.createdAt=(new Date).getTime(),this.direction=a}return i(e,[{key:"draw",value:function(t){var e=this.currentPosition,i=this.radius,n=this.color,s=this.emoji,o=this.rotationAngle,a=this.emojiRotationAngle,r=this.emojiSize,h=window.devicePixelRatio;n?(t.fillStyle=n,t.beginPath(),t.ellipse(e.x*h,e.y*h,i.x*h,i.y*h,o,0,2*Math.PI),t.fill()):s&&(t.font="".concat(r,"px serif"),t.save(),t.translate(h*e.x,h*e.y),t.rotate(a),t.textAlign="center",t.fillText(s,0,0),t.restore())}},{key:"updatePosition",value:function(t,e){var i=this.confettiSpeed,n=this.dragForceCoefficient,s=this.finalConfettiSpeedX,o=this.radiusYUpdateDirection,a=this.rotationSpeed,r=this.createdAt,h=this.direction,c=e-r;i.x>s&&(this.confettiSpeed.x-=n*t),this.currentPosition.x+=i.x*("left"===h?-this.absCos:this.absCos)*t,this.currentPosition.y=this.initialPosition.y-i.y*this.absSin*c+.00125*Math.pow(c,2)/2,this.rotationSpeed-=this.emoji?1e-4:1e-5*t,this.rotationSpeed<0&&(this.rotationSpeed=0),this.emoji?this.emojiRotationAngle+=this.rotationSpeed*t%(2*Math.PI):"down"===o?(this.radius.y-=t*a,this.radius.y<=0&&(this.radius.y=0,this.radiusYUpdateDirection="up")):(this.radius.y+=t*a,this.radius.y>=this.initialRadius&&(this.radius.y=this.initialRadius,this.radiusYUpdateDirection="down"))}},{key:"getIsVisibleOnCanvas",value:function(t){return this.currentPosition.y<t+100}}]),e}();function c(){var t=document.createElement("canvas");return t.style.position="fixed",t.style.width="100%",t.style.height="100%",t.style.top="0",t.style.left="0",t.style.zIndex="1000",t.style.pointerEvents="none",document.body.appendChild(t),t}function u(t){var e=t.confettiRadius,i=void 0===e?6:e,n=t.confettiNumber,s=void 0===n?t.confettiesNumber||(t.emojis?40:250):n,o=t.confettiColors,r=void 0===o?a:o,h=t.emojis,c=void 0===h?t.emojies||[]:h,u=t.emojiSize,l=void 0===u?80:u;return t.emojies&&console.error("emojies argument is deprecated, please use emojis instead"),t.confettiesNumber&&console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"),{confettiRadius:i,confettiNumber:s,confettiColors:r,emojis:c,emojiSize:l}}var l=function(){function e(i){var n=this;t(this,e),this.canvasContext=i,this.shapes=[],this.promise=new Promise((function(t){return n.resolvePromise=t}))}return i(e,[{key:"getBatchCompletePromise",value:function(){return this.promise}},{key:"addShapes",value:function(){var t;(t=this.shapes).push.apply(t,arguments)}},{key:"complete",value:function(){var t;return!this.shapes.length&&(null===(t=this.resolvePromise)||void 0===t||t.call(this),!0)}},{key:"processShapes",value:function(t,e,i){var n=this,s=t.timeDelta,o=t.currentTime;this.shapes=this.shapes.filter((function(t){return t.updatePosition(s,o),t.draw(n.canvasContext),!i||t.getIsVisibleOnCanvas(e)}))}}]),e}();return function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.activeConfettiBatches=[],this.canvas=i.canvas||c(),this.canvasContext=this.canvas.getContext("2d"),this.requestAnimationFrameRequested=!1,this.lastUpdated=(new Date).getTime(),this.iterationIndex=0,this.loop=this.loop.bind(this),requestAnimationFrame(this.loop)}return i(e,[{key:"loop",value:function(){var t,e,i,s,o;this.requestAnimationFrameRequested=!1,t=this.canvas,e=window.devicePixelRatio,i=getComputedStyle(t),s=n(i.getPropertyValue("width")),o=n(i.getPropertyValue("height")),t.setAttribute("width",(s*e).toString()),t.setAttribute("height",(o*e).toString());var a=(new Date).getTime(),r=a-this.lastUpdated,h=this.canvas.offsetHeight,c=this.iterationIndex%10==0;this.activeConfettiBatches=this.activeConfettiBatches.filter((function(t){return t.processShapes({timeDelta:r,currentTime:a},h,c),!c||!t.complete()})),this.iterationIndex++,this.queueAnimationFrameIfNeeded(a)}},{key:"queueAnimationFrameIfNeeded",value:function(t){this.requestAnimationFrameRequested||this.activeConfettiBatches.length<1||(this.requestAnimationFrameRequested=!0,this.lastUpdated=t||(new Date).getTime(),requestAnimationFrame(this.loop))}},{key:"addConfetti",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=u(t),i=e.confettiRadius,n=e.confettiNumber,s=e.confettiColors,o=e.emojis,a=e.emojiSize,r=this.canvas.getBoundingClientRect(),c=r.width,d=r.height,f=5*d/7,m={x:0,y:f},v={x:c,y:f},p=new l(this.canvasContext),g=0;g<n/2;g++){var y=new h({initialPosition:m,direction:"right",confettiRadius:i,confettiColors:s,confettiNumber:n,emojis:o,emojiSize:a,canvasWidth:c}),C=new h({initialPosition:v,direction:"left",confettiRadius:i,confettiColors:s,confettiNumber:n,emojis:o,emojiSize:a,canvasWidth:c});p.addShapes(y,C)}return this.activeConfettiBatches.push(p),this.queueAnimationFrameIfNeeded(),p.getBatchCompletePromise()}},{key:"clearCanvas",value:function(){this.activeConfettiBatches=[]}}]),e}()}();
resources/js/preview.js CHANGED
@@ -3,7 +3,7 @@ function getCleanDomain() {
3
  }
4
 
5
  function createButtonFromData(formData) {
6
- let domainType = 'FREE'
7
  if (formData && formData.domain) {
8
  domainType = formData.domain.type
9
  }
3
  }
4
 
5
  function createButtonFromData(formData) {
6
+ let domainType = 'STARTER'
7
  if (formData && formData.domain) {
8
  domainType = formData.domain.type
9
  }
resources/style/call-now-button.css CHANGED
@@ -189,6 +189,12 @@ table.form-table.nav-tab-only {
189
  font-weight: 200;
190
  font-size: 28px;
191
  color: black;
 
 
 
 
 
 
192
  }
193
  .cnb-center {
194
  text-align: center;
@@ -326,16 +332,68 @@ input[type='range'] {
326
  .cnb-version {
327
  font-weight: 200;
328
  }
329
- .cnb_type_selector .cnb_type_selector_item {
 
330
  transition: all 0.5s;
331
  opacity: 0.3;
332
  filter: grayscale(1);
 
 
 
 
 
 
 
333
  cursor: pointer;
334
  }
335
- .cnb_type_selector .cnb_type_selector_active {
 
 
 
336
  opacity: 1;
337
  filter: grayscale(0);
338
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  .cnb-flexbox {
340
  display: flex;
341
  justify-content:center;
@@ -344,14 +402,34 @@ input[type='range'] {
344
  flex: 1 1 0;
345
  }
346
  /* Pricing page */
 
347
  h1.cnb-upgrade-title {
 
348
  text-align: center;
349
- font-size: xx-large;
350
- font-weight: bold;
351
- margin: 1em auto;
352
- max-width: 1000px;
353
- border-bottom:1px solid #c3c4c7;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  }
 
 
 
355
  .cnb-pricebox {
356
  text-align: center;
357
  }
@@ -399,9 +477,9 @@ h1.cnb-upgrade-title {
399
  font-weight: normal;
400
  }
401
  .cnb-price-plans .currency {
402
- font-size:150%;
403
  color:#444;
404
- font-weight: normal;
405
  }
406
  .cnb-price-plans .cnb-currency-box {
407
  display:none;
@@ -410,10 +488,30 @@ h1.cnb-upgrade-title {
410
  display: block;
411
  }
412
 
413
- .only-big-screens {
 
 
 
 
 
 
 
 
 
 
 
414
  display: none;
415
  }
416
 
 
 
 
 
 
 
 
 
 
417
  @media screen and (max-width:599px) {
418
  .cnb-plan-features {
419
  flex-direction: column;
@@ -425,6 +523,13 @@ h1.cnb-upgrade-title {
425
  display: inline-block;
426
  width: 30%;
427
  }
 
 
 
 
 
 
 
428
  }
429
  @media screen and (min-width:600px) {
430
  .cnb-plan-features ul:first-child {
@@ -563,6 +668,8 @@ input[type=checkbox].cnb_toggle_checkbox:checked ~ .cnb_toggle_true {
563
  input[type=checkbox].cnb_toggle_checkbox:not(:checked) ~ .cnb_toggle_false {
564
  display: inline-block;
565
  }
 
 
566
  /* Scheduler Weekdays checkbox styling */
567
  input[type=checkbox].cnb_day_selector {
568
  height: 0;
@@ -681,16 +788,39 @@ input[type=checkbox].cnb_day_selector:checked + label.cnb_day_selector {
681
  border: 1px solid #B16323;
682
  color: #fff;
683
  }
 
 
 
 
 
 
 
 
 
684
  .cnb-promobox .cnb-promobox-header-purple {
685
  background-color: #B12371;
686
  border: 1px solid #B12371;
687
  color: #fff;
688
  }
 
 
 
 
 
 
 
 
 
689
  .cnb-promobox .cnb-promobox-header-green {
690
  background-color: #00aa00;
691
  border: 1px solid #00aa00;
692
  color: #fff;
693
  }
 
 
 
 
 
694
  .cnb-promobox.cnb-promobox-green .button-primary {
695
  background: #00aa00;
696
  border-color: #00aa00;
@@ -725,7 +855,9 @@ input[type=checkbox].cnb_day_selector:checked + label.cnb_day_selector {
725
  .cnb-promobox .cnb-promobox-header-brown h2,
726
  .cnb-promobox .cnb-promobox-header-brown h3,
727
  .cnb-promobox .cnb-promobox-header-green h2,
728
- .cnb-promobox .cnb-promobox-header-green h3 {
 
 
729
  color:#fff;
730
  }
731
  .cnb-one-column-section .cnb-promobox .inside,
@@ -959,10 +1091,17 @@ Enforce mobile viewport for previews via overwrites:
959
  #cnb-button-preview .cnb-full:before {
960
  box-shadow: none !important;
961
  }
 
962
  #cnb-button-preview .cnb-full.call-now-button a,
963
  #cnb-button-preview .cnb-full.call-now-button:before {
964
  border-radius:0;
965
  }
 
 
 
 
 
 
966
  #cnb-button-preview .cnb-full.cnb-items-1 a .cnb-inside-item {
967
  flex-direction: row;
968
  align-items: center;
@@ -1294,6 +1433,10 @@ span.cnb-pro-badge {
1294
  text-align: center;
1295
  background-color: #fff;
1296
  }
 
 
 
 
1297
  .cnb-welcome-blocks .cnb-logo {
1298
  margin-top:calc(-35px - 64px);
1299
  padding:15px 15px 13px;
@@ -1346,6 +1489,10 @@ span.cnb-pro-badge {
1346
  box-sizing: border-box;
1347
  width: 50%;
1348
  }
 
 
 
 
1349
  @media screen and (max-width: 750px) {
1350
  .cnb-welcome-blocks .cnb-features-list .cnb-column p {
1351
  display: none;
@@ -1456,14 +1603,157 @@ span.cnb-pro-badge {
1456
  font-size: 16px;
1457
  font-weight: 900;
1458
  }
 
 
 
 
 
 
 
 
1459
  .cnb_onboarding_guide {
1460
  max-width: 750px;
1461
  }
1462
  .cnb_onboarding_guide .cnb_screenshot img {
1463
- border-radius: 42px;
1464
- border: 5px solid #fff;
1465
  box-shadow: 0 0 15px rgb(0 0 0 / 20%);
1466
  width:100%;
1467
  max-width: 650px;
1468
  height: auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
  }
189
  font-weight: 200;
190
  font-size: 28px;
191
  color: black;
192
+ line-height: .6em;
193
+ }
194
+ .cnb-url a span {
195
+ font-size: 13px;
196
+ color:#6c6c6c;
197
+ display: block;
198
  }
199
  .cnb-center {
200
  text-align: center;
332
  .cnb-version {
333
  font-weight: 200;
334
  }
335
+
336
+ .cnb_type_selector .cnb_type_selector {
337
  transition: all 0.5s;
338
  opacity: 0.3;
339
  filter: grayscale(1);
340
+ }
341
+ .cnb_type_selector .cnb_type_selector:hover {
342
+ opacity: 0.5;
343
+ filter: grayscale(0.6);
344
+ }
345
+
346
+ .cnb_type_selector .cnb_type_selector_item {
347
  cursor: pointer;
348
  }
349
+
350
+ .cnb_type_selector .cnb_type_selector .cnb-pro-badge,
351
+ .cnb_type_selector .cnb_type_selector_active,
352
+ .cnb_type_selector .cnb_type_selector_active:hover {
353
  opacity: 1;
354
  filter: grayscale(0);
355
  }
356
+
357
+ .cnb-pro-overlay {
358
+ display: none;
359
+ }
360
+ .cnb_type_selector_container {
361
+ position: relative;
362
+ }
363
+ .cnb_type_only_pro {
364
+ position: relative;
365
+ cursor: not-allowed;
366
+ }
367
+ .cnb_type_only_pro + .cnb-pro-overlay {
368
+ display: block;
369
+ opacity: 0.7;
370
+ position: absolute;
371
+ top: 40px;
372
+ background: #fff;
373
+ padding: 10px;
374
+ text-align: center;
375
+ border: 1px solid #666;
376
+ width: 30%;
377
+ max-width: 33%;
378
+ left: calc(50% - 15%);
379
+ z-index: 5;
380
+ box-sizing: border-box;
381
+ }
382
+ .cnb_type_only_pro:hover + .cnb-pro-overlay,
383
+ .cnb_type_only_pro + .cnb-pro-overlay:hover {
384
+ opacity: 0.9;
385
+ }
386
+ @media (max-width:530px) {
387
+ .cnb_type_only_pro + .cnb-pro-overlay {
388
+ padding:0 3px 3px;
389
+ top: 10px;
390
+ }
391
+ .cnb_type_only_pro + .cnb-pro-overlay p {
392
+ padding: 0 !important;
393
+ }
394
+ }
395
+
396
+
397
  .cnb-flexbox {
398
  display: flex;
399
  justify-content:center;
402
  flex: 1 1 0;
403
  }
404
  /* Pricing page */
405
+
406
  h1.cnb-upgrade-title {
407
+ padding: 8px 0;
408
  text-align: center;
409
+ background-color: rgba(0,163,42,1);
410
+ color:rgba(255, 255, 255, 1);
411
+ animation-name: cnb-upgrade-title;
412
+ animation-duration: 1.5s;
413
+ }
414
+
415
+ @keyframes cnb-upgrade-title {
416
+ 0% {
417
+ background-color: rgba(0,163,42,0);
418
+ color:rgba(255, 255, 255, 0);
419
+ transform: scale(0.8);
420
+ }
421
+ 50% {
422
+ transform: scale(1.8);
423
+ }
424
+ 100% {
425
+ background-color: rgba(0,163,42,1);
426
+ color:rgba(255, 255, 255, 1);
427
+ transform: scale(1);
428
+ }
429
  }
430
+
431
+
432
+
433
  .cnb-pricebox {
434
  text-align: center;
435
  }
477
  font-weight: normal;
478
  }
479
  .cnb-price-plans .currency {
480
+ font-size:3em;
481
  color:#444;
482
+ font-weight: 200;
483
  }
484
  .cnb-price-plans .cnb-currency-box {
485
  display:none;
488
  display: block;
489
  }
490
 
491
+ .cnb-price-plans .free-trial-days {
492
+ margin: 20px 0;
493
+ font-weight: 700;
494
+ font-size: 16px;
495
+ }
496
+
497
+ .eur-trial-period-days-wrapper,
498
+ .usd-trial-period-days-wrapper {
499
+ display: none;
500
+ }
501
+
502
+ .only-big-screens {
503
  display: none;
504
  }
505
 
506
+ .cnb-pro-tile {
507
+ display: inline-block;
508
+ max-width:176px;
509
+ padding: 10px;
510
+ margin: 10px;
511
+ border-radius: 5px;
512
+ box-shadow: 0 2px 5px rgba(0,0,0,0.3);
513
+ }
514
+
515
  @media screen and (max-width:599px) {
516
  .cnb-plan-features {
517
  flex-direction: column;
523
  display: inline-block;
524
  width: 30%;
525
  }
526
+ .currency-box.cnb-flexbox {
527
+ flex-direction: column;
528
+ }
529
+ .cnb-currency-box {
530
+ border: 1px solid #ddd;
531
+ border-radius: 5px;
532
+ }
533
  }
534
  @media screen and (min-width:600px) {
535
  .cnb-plan-features ul:first-child {
668
  input[type=checkbox].cnb_toggle_checkbox:not(:checked) ~ .cnb_toggle_false {
669
  display: inline-block;
670
  }
671
+
672
+
673
  /* Scheduler Weekdays checkbox styling */
674
  input[type=checkbox].cnb_day_selector {
675
  height: 0;
788
  border: 1px solid #B16323;
789
  color: #fff;
790
  }
791
+ .cnb-promobox.cnb-promobox-brown .button-primary {
792
+ background: #B16323;
793
+ border-color: #B16323;
794
+ }
795
+ .cnb-promobox.cnb-promobox-brown .button-primary:hover,
796
+ .cnb-promobox.cnb-promobox-brown .button-primary:active {
797
+ background: #8d4f1b;
798
+ border-color: #8d4f1b;
799
+ }
800
  .cnb-promobox .cnb-promobox-header-purple {
801
  background-color: #B12371;
802
  border: 1px solid #B12371;
803
  color: #fff;
804
  }
805
+ .cnb-promobox.cnb-promobox-purple .button-primary {
806
+ background: #B12371;
807
+ border-color: #B12371;
808
+ }
809
+ .cnb-promobox.cnb-promobox-purple .button-primary:hover,
810
+ .cnb-promobox.cnb-promobox-purple .button-primary:active {
811
+ background: #8d1b5a;
812
+ border-color: #8d1b5a;
813
+ }
814
  .cnb-promobox .cnb-promobox-header-green {
815
  background-color: #00aa00;
816
  border: 1px solid #00aa00;
817
  color: #fff;
818
  }
819
+ .cnb-promobox .cnb-promobox-header-dark-green {
820
+ background-color: #006600;
821
+ border: 1px solid #006600;
822
+ color: #fff;
823
+ }
824
  .cnb-promobox.cnb-promobox-green .button-primary {
825
  background: #00aa00;
826
  border-color: #00aa00;
855
  .cnb-promobox .cnb-promobox-header-brown h2,
856
  .cnb-promobox .cnb-promobox-header-brown h3,
857
  .cnb-promobox .cnb-promobox-header-green h2,
858
+ .cnb-promobox .cnb-promobox-header-green h3,
859
+ .cnb-promobox .cnb-promobox-header-dark-green h2,
860
+ .cnb-promobox .cnb-promobox-header-dark-green h3 {
861
  color:#fff;
862
  }
863
  .cnb-one-column-section .cnb-promobox .inside,
1091
  #cnb-button-preview .cnb-full:before {
1092
  box-shadow: none !important;
1093
  }
1094
+ #cnb-button-preview .cnb-full.call-now-button,
1095
  #cnb-button-preview .cnb-full.call-now-button a,
1096
  #cnb-button-preview .cnb-full.call-now-button:before {
1097
  border-radius:0;
1098
  }
1099
+ #cnb-button-preview .cnb-full.cnb-full-bottom {
1100
+ bottom: 0;
1101
+ }
1102
+ #cnb-button-preview .cnb-full.cnb-full-top {
1103
+ top: 0;
1104
+ }
1105
  #cnb-button-preview .cnb-full.cnb-items-1 a .cnb-inside-item {
1106
  flex-direction: row;
1107
  align-items: center;
1433
  text-align: center;
1434
  background-color: #fff;
1435
  }
1436
+ .cnb-welcome-blocks-plain {
1437
+ border-color: transparent;
1438
+ background-color: transparent;
1439
+ }
1440
  .cnb-welcome-blocks .cnb-logo {
1441
  margin-top:calc(-35px - 64px);
1442
  padding:15px 15px 13px;
1489
  box-sizing: border-box;
1490
  width: 50%;
1491
  }
1492
+ .cnb-features-list ul li {
1493
+ margin-left: 40px;
1494
+ font-size: 14px;
1495
+ }
1496
  @media screen and (max-width: 750px) {
1497
  .cnb-welcome-blocks .cnb-features-list .cnb-column p {
1498
  display: none;
1603
  font-size: 16px;
1604
  font-weight: 900;
1605
  }
1606
+ .cnb-coupon-timer {
1607
+ position: absolute;
1608
+ top: -10px;
1609
+ right:20px;
1610
+ background: #fbffe0;
1611
+ border: 1px solid #ccc;
1612
+ padding: 0 3px;
1613
+ }
1614
  .cnb_onboarding_guide {
1615
  max-width: 750px;
1616
  }
1617
  .cnb_onboarding_guide .cnb_screenshot img {
 
 
1618
  box-shadow: 0 0 15px rgb(0 0 0 / 20%);
1619
  width:100%;
1620
  max-width: 650px;
1621
  height: auto;
1622
+ margin: 20px auto;
1623
+ border: 1px solid #ccc;
1624
+ }
1625
+
1626
+ .cnb-nb-plans tbody td:not(.value) {
1627
+ color:#ccc;
1628
+ font-weight: 600;
1629
+ }
1630
+ .cnb-nb-plans tbody td.yes {
1631
+ color:#00aa00;
1632
+ font-weight: 600;
1633
+ }
1634
+ .cnb-nb-plans tbody td.limited {
1635
+ font-weight: 400;
1636
+ font-size: 13px;
1637
+ }
1638
+ .cnb-nb-plans tbody td.partly {
1639
+ color:#999;
1640
+ font-weight: 400;
1641
+ }
1642
+ .cnb-nb-plans .no {
1643
+ color:#C00;
1644
+ }
1645
+ .cnb-nb-plans .row .col1 {
1646
+ width:100%;
1647
+ }
1648
+ .cnb-nb-plans .row .col2,
1649
+ .cnb-nb-plans .row .col3 {
1650
+ max-width: 60px;
1651
+ width: 100%;
1652
+ text-align: center;
1653
+ /* font-size:18px; */
1654
+ }
1655
+ .cnb-nb-plans {
1656
+ width:100%;
1657
+ border-collapse: collapse;
1658
+ }
1659
+ .cnb-prod-cnb {
1660
+ background: #eee;
1661
+ }
1662
+ .cnb-prod-nb,
1663
+ .cnb-prod-nb h3 {
1664
+ background: #0a0;
1665
+ color: #fff;
1666
+ }
1667
+
1668
+ .cnb-nb-plans tbody,
1669
+ .font-18,
1670
+ #cnb_upgrade_box .font-18 {
1671
+ font-size: 16px;
1672
+ }
1673
+ .font-22,
1674
+ #cnb_upgrade_box .font-22 {
1675
+ font-size: 22px;
1676
+ }
1677
+ .cnb-nb-plans thead tr:last-child,
1678
+ .cnb-nb-plans tfoot tr:last-child {
1679
+ background-color:#f4f4f4
1680
+ }
1681
+ .cnb-nb-plans thead tr:last-child h4,
1682
+ .cnb-nb-plans tfoot tr:last-child h4 {
1683
+ margin: 5px 0;
1684
+ }
1685
+ .cnb-nb-plans thead tr:last-child th:nth-child(3),
1686
+ .cnb-nb-plans tfoot tr:last-child th:nth-child(3),
1687
+ .cnb-nb-plans tbody td:nth-child(3)
1688
+ {
1689
+ background-color: rgba(0,170,0,0.15);
1690
+ }
1691
+ .cnb-nb-plans thead tr:last-child th:nth-child(4),
1692
+ .cnb-nb-plans tfoot tr:last-child th:nth-child(4),
1693
+ .cnb-nb-plans tbody td:nth-child(4) {
1694
+ background-color: rgba(0,170,0,0.3);
1695
+ }
1696
+ .cnb-nb-plans tbody th {
1697
+ padding-left:10px;
1698
+ text-align: left;
1699
+ font-weight: 400;
1700
+ font-size: 13px;
1701
+ color:#6c6c6c;
1702
+ position: relative;
1703
+ }
1704
+ .cnb-nb-plans tbody td {
1705
+ text-align: center;
1706
+ }
1707
+ .cnb-nb-plans tbody tr:not(.line):hover {
1708
+ background-color:#f4f4f4;
1709
+ }
1710
+ .cnb-compare-features .cnb-promobox .inside .cnb-promobox-copy {
1711
+ padding: 0;
1712
+ }
1713
+ .cnb-compare-features .cnb_promobox_item {
1714
+ margin:0
1715
+ }
1716
+ .cnb-tooltip-icon {
1717
+ cursor: help;
1718
+ display: inline-block;
1719
+ width: 15px;
1720
+ height: 15px;
1721
+ border: 1px solid #999;
1722
+ border-radius: 50%;
1723
+ text-align: center;
1724
+ color: #999;
1725
+ line-height: 1.1;
1726
+ }
1727
+ .cnb-tooltip-icon:hover {
1728
+ background-color: #999;
1729
+ color: #fff;
1730
+ }
1731
+ .cnb-tooltip-text {
1732
+ display: none;
1733
+ position: absolute;
1734
+ width: 250px;
1735
+ background: rgba(0, 0, 0, 0.8);
1736
+ color: #ffffff;
1737
+ border-radius: 5px;
1738
+ padding: 3px 8px;
1739
+ box-shadow: 0 1px 4px rgb(0 0 0 / 30%);
1740
+ line-height: 1.2;
1741
+ font-weight: 544;
1742
+ z-index: 1;
1743
+ }
1744
+ .cnb-tooltip-icon:hover + .cnb-tooltip-text {
1745
+ display: inline-block;
1746
+ }
1747
+ @media screen and (max-width:599px) {
1748
+ .cnb-tooltip-text {
1749
+ left: 2px;
1750
+ top:30px;
1751
+ }
1752
+ .cnb-nb-plans h3 {
1753
+ font-size: 14px;
1754
+ margin: 5px 5px;
1755
+ }
1756
+ .cnb-nb-plans tbody tr {
1757
+ height:30px;
1758
+ }
1759
  }
src/CallNowButton.php CHANGED
@@ -50,7 +50,9 @@ class CallNowButton {
50
  array( $legacy_edit, 'render' );
51
 
52
  $counter = 0;
53
- $menu_page_title = 'Call Now Button<span class="awaiting-mod" id="cnb-nav-counter" style="display: none">' . $counter . '</span>';
 
 
54
  $menu_page_position = $cnb_cloud_hosting ? 30 : 66;
55
 
56
  $header_notices = new CnbHeaderNotices();
@@ -68,7 +70,8 @@ class CallNowButton {
68
  }
69
 
70
  // Oldest WordPress only has "smartphone", no "phone" (this is added in a later version)
71
- $icon_url = version_compare( $wp_version, '5.5.0', '<' ) ? 'dashicons-smartphone' : 'dashicons-phone';
 
72
 
73
  add_menu_page(
74
  'Call Now Button - Overview',
@@ -250,7 +253,6 @@ class CallNowButton {
250
  }
251
 
252
  public function register_styles_and_scripts() {
253
- $options = get_option('cnb');
254
  wp_register_style(
255
  CNB_SLUG . '-styling',
256
  plugins_url( '../resources/style/call-now-button.css', __FILE__ ),
@@ -418,6 +420,14 @@ class CallNowButton {
418
  null,
419
  '17.0.12',
420
  true );
 
 
 
 
 
 
 
 
421
  }
422
 
423
  public function register_global_actions() {
50
  array( $legacy_edit, 'render' );
51
 
52
  $counter = 0;
53
+ $menu_page_header = $cnb_cloud_hosting ? 'Buttons' : 'Call Now Button';
54
+ $menu_page_title = $menu_page_header . '<span class="awaiting-mod" id="cnb-nav-counter" style="display: none">' . $counter . '</span>';
55
+
56
  $menu_page_position = $cnb_cloud_hosting ? 30 : 66;
57
 
58
  $header_notices = new CnbHeaderNotices();
70
  }
71
 
72
  // Oldest WordPress only has "smartphone", no "phone" (this is added in a later version)
73
+ $cnb_free_icon = version_compare( $wp_version, '5.5.0', '<' ) ? 'dashicons-smartphone' : 'dashicons-phone';
74
+ $icon_url = $cnb_cloud_hosting ? 'dashicons-marker' : $cnb_free_icon;
75
 
76
  add_menu_page(
77
  'Call Now Button - Overview',
253
  }
254
 
255
  public function register_styles_and_scripts() {
 
256
  wp_register_style(
257
  CNB_SLUG . '-styling',
258
  plugins_url( '../resources/style/call-now-button.css', __FILE__ ),
420
  null,
421
  '17.0.12',
422
  true );
423
+ // Original: https://cdn.jsdelivr.net/npm/js-confetti@latest/dist/js-confetti.browser.js
424
+ // Via https://github.com/loonywizard/js-confetti
425
+ wp_register_script(
426
+ CNB_SLUG . '-confetti',
427
+ plugins_url( '../resources/js/js-confetti/js-confetti.browser.js', __FILE__ ),
428
+ array(CNB_SLUG . '-domain-upgrade'),
429
+ '0.11.0',
430
+ true );
431
  }
432
 
433
  public function register_global_actions() {
src/admin/CnbAdminAjax.php CHANGED
@@ -137,21 +137,27 @@ class CnbAdminAjax {
137
 
138
  // Hardcoded fallback values in case the API call fails
139
  $eur_yearly_per_month = 4.16;
 
140
  $eur_discount = 17;
 
141
  $usd_yearly_per_month = 4.99;
 
142
  $usd_discount = 17;
 
143
 
144
  if (is_array($plans)) {
145
  $eur_yearly_plan = array_filter( $plans, function ( $plan ) {
146
  return $plan->nickname === 'powered-by-eur-yearly';
147
  } );
148
  $eur_yearly_plan = array_pop( $eur_yearly_plan );
 
149
  $eur_yearly_per_month = round( $eur_yearly_plan->price / 12.0, 2 );
150
 
151
  $usd_yearly_plan = array_filter( $plans, function ( $plan ) {
152
  return $plan->nickname === 'powered-by-usd-yearly';
153
  } );
154
  $usd_yearly_plan = array_pop( $usd_yearly_plan );
 
155
  $usd_yearly_per_month = round( $usd_yearly_plan->price / 12.0, 2 );
156
 
157
  $eur_monthly_plan = array_filter( $plans, function ( $plan ) {
@@ -164,13 +170,21 @@ class CnbAdminAjax {
164
  // Calculate discounts
165
  $eur_discount = $domain_controller->get_discount_percentage( $eur_yearly_plan, array_pop( $eur_monthly_plan ) );
166
  $usd_discount = $domain_controller->get_discount_percentage( $usd_yearly_plan, array_pop( $usd_monthly_plan ) );
 
 
 
 
167
  }
168
 
169
  wp_send_json( array(
 
170
  'eur_per_month' => $eur_yearly_per_month,
171
  'eur_discount' => $eur_discount,
 
 
172
  'usd_per_month' => $usd_yearly_per_month,
173
  'usd_discount' => $usd_discount,
 
174
  ) );
175
  do_action( 'cnb_finish' );
176
  wp_die();
137
 
138
  // Hardcoded fallback values in case the API call fails
139
  $eur_yearly_per_month = 4.16;
140
+ $eur_yearly_plan_year = 49.90;
141
  $eur_discount = 17;
142
+ $eur_trial_period_days = 14;
143
  $usd_yearly_per_month = 4.99;
144
+ $usd_yearly_plan_year = 49.90;
145
  $usd_discount = 17;
146
+ $usd_trial_period_days = $eur_trial_period_days;
147
 
148
  if (is_array($plans)) {
149
  $eur_yearly_plan = array_filter( $plans, function ( $plan ) {
150
  return $plan->nickname === 'powered-by-eur-yearly';
151
  } );
152
  $eur_yearly_plan = array_pop( $eur_yearly_plan );
153
+ $eur_yearly_plan_year = round( $eur_yearly_plan->price, 2 );
154
  $eur_yearly_per_month = round( $eur_yearly_plan->price / 12.0, 2 );
155
 
156
  $usd_yearly_plan = array_filter( $plans, function ( $plan ) {
157
  return $plan->nickname === 'powered-by-usd-yearly';
158
  } );
159
  $usd_yearly_plan = array_pop( $usd_yearly_plan );
160
+ $usd_yearly_plan_year = round( $usd_yearly_plan->price, 2 );
161
  $usd_yearly_per_month = round( $usd_yearly_plan->price / 12.0, 2 );
162
 
163
  $eur_monthly_plan = array_filter( $plans, function ( $plan ) {
170
  // Calculate discounts
171
  $eur_discount = $domain_controller->get_discount_percentage( $eur_yearly_plan, array_pop( $eur_monthly_plan ) );
172
  $usd_discount = $domain_controller->get_discount_percentage( $usd_yearly_plan, array_pop( $usd_monthly_plan ) );
173
+
174
+ // Get trial days
175
+ $eur_trial_period_days = $eur_yearly_plan->trialPeriodDays;
176
+ $usd_trial_period_days = $usd_yearly_plan->trialPeriodDays;
177
  }
178
 
179
  wp_send_json( array(
180
+ 'eur_per_year' => $eur_yearly_plan_year,
181
  'eur_per_month' => $eur_yearly_per_month,
182
  'eur_discount' => $eur_discount,
183
+ 'eur_trial_period_days' => $eur_trial_period_days,
184
+ 'usd_per_year' => $usd_yearly_plan_year,
185
  'usd_per_month' => $usd_yearly_per_month,
186
  'usd_discount' => $usd_discount,
187
+ 'usd_trial_period_days' => $usd_trial_period_days
188
  ) );
189
  do_action( 'cnb_finish' );
190
  wp_die();
src/admin/action/CnbActionType.php CHANGED
@@ -9,12 +9,12 @@ class CnbActionType {
9
  /**
10
  * @param string $type
11
  * @param string $name
12
- * @param bool $isPro
13
  */
14
- public function __construct( $type, $name, $isPro ) {
15
  $this->type = $type;
16
  $this->name = $name;
17
- $this->isPro = $isPro;
18
  }
19
 
20
  /**
@@ -31,9 +31,8 @@ class CnbActionType {
31
  public $name;
32
 
33
  /**
34
- * Whether this feature is a Pro feature
35
- * @var boolean
36
  */
37
- public $isPro;
38
-
39
  }
9
  /**
10
  * @param string $type
11
  * @param string $name
12
+ * @param string[] $plans
13
  */
14
+ public function __construct( $type, $name, $plans ) {
15
  $this->type = $type;
16
  $this->name = $name;
17
+ $this->plans = $plans;
18
  }
19
 
20
  /**
31
  public $name;
32
 
33
  /**
34
+ * Domain types where this ActionType is available
35
+ * @var string[]
36
  */
37
+ public $plans;
 
38
  }
src/admin/action/CnbActionViewEdit.php CHANGED
@@ -119,8 +119,6 @@ class CnbActionViewEdit {
119
  */
120
  global $wp_locale;
121
 
122
- $cnb_utils = new CnbUtils();
123
-
124
  // In case a domain is not passed, we take it from the button
125
  $domain = isset( $domain ) ? $domain : ( isset( $button ) ? $button->domain : null );
126
 
@@ -156,7 +154,16 @@ class CnbActionViewEdit {
156
 
157
  $timezone_set_correctly = ( new CnbHeaderNotices() )->is_timezone_valid( $domain );
158
 
159
- $isPro = $domain != null && !is_wp_error($domain) && $domain->type === 'PRO';
 
 
 
 
 
 
 
 
 
160
 
161
  ?>
162
  <input type="hidden" name="actions[<?php echo esc_attr( $action->id ) ?>][id]"
@@ -175,31 +182,20 @@ class CnbActionViewEdit {
175
  <?php } ?>
176
 
177
  <tr class="cnb_hide_on_modal">
178
- <th scope="row"><label for="cnb_action_type">Button type</label></th>
179
  <td>
180
  <select id="cnb_action_type" name="actions[<?php echo esc_attr( $action->id ) ?>][actionType]">
181
  <?php foreach ( ( new CnbAdminFunctions() )->cnb_get_action_types() as $action_type_key => $action_type_value ) { ?>
182
  <option
183
  value="<?php echo esc_attr( $action_type_key ) ?>"
184
  <?php selected( $action_type_value->type, $action->actionType ) ?>
185
- <?php if (!$isPro && $action_type_value->isPro) { echo ' disabled="disabled"'; } ?>>
186
  <?php echo esc_html( $action_type_value->name ) ?>
 
187
  </option>
188
  <?php } ?>
189
  </select>
190
- <?php if (!$isPro && $domain) {
191
- $upgrade_link =
192
- add_query_arg( array(
193
- 'page' => 'call-now-button-domains',
194
- 'action' => 'upgrade',
195
- 'id' => $domain->id
196
- ),
197
- admin_url( 'admin.php' ) );
198
- ?>
199
- <p class="description">
200
- Content Window and Intercom Chat are <span class="cnb-pro-badge">Pro</span> features. <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
201
- </p>
202
- <?php } ?>
203
  <p class="description cnb-action-properties-tally"><a target="_blank" href="https://tally.so?ref=callnowbutton&utm_source=callnowbutton&utm_medium=wordpress">Tally</a> is our favorite form tool.</p>
204
  </td>
205
  </tr>
@@ -246,6 +242,7 @@ class CnbActionViewEdit {
246
  <tr class="cnb_hide_on_modal">
247
  <th scope="row"><label for="actions-<?php echo esc_attr( $action->id ) ?>-iconText">Button icon/image</label></th>
248
  <td data-icon-text-target="cnb_action_icon_text" data-icon-type-target="cnb_action_icon_type">
 
249
  <div class="icon-text-options" id="icon-text-ANCHOR">
250
  <div class="cnb-button-icon">
251
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="anchor">anchor</i>
@@ -298,6 +295,7 @@ class CnbActionViewEdit {
298
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="calendar">calendar</i>
299
  </div>
300
  </div>
 
301
  <div class="icon-text-options" id="icon-text-MAP">
302
  <div class="cnb-button-icon">
303
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="directions">directions</i>
@@ -318,6 +316,7 @@ class CnbActionViewEdit {
318
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="directions6">directions6</i>
319
  </div>
320
  </div>
 
321
  <div class="icon-text-options" id="icon-text-PHONE">
322
  <div class="cnb-button-icon">
323
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call">call</i>
@@ -414,6 +413,14 @@ class CnbActionViewEdit {
414
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="intercom">intercom</i>
415
  </div>
416
  </div>
 
 
 
 
 
 
 
 
417
 
418
  <div class="cnb-button-icon cnb-button-image cnb_icon_active" id="cnb_selected_action_background_image" style="background-image:<?php echo esc_attr( $action->iconBackgroundImage ) ?>">
419
 
@@ -423,28 +430,17 @@ class CnbActionViewEdit {
423
  name="actions[<?php echo esc_attr( $action->id ) ?>][iconBackgroundImage]"
424
  value="<?php echo esc_attr( $action->iconBackgroundImage ) ?>"
425
  id="cnb_action_icon_background_image"/>
426
- <input
427
- type='button'
428
- class="button-secondary" value="<?php esc_attr_e( 'Select image' ); ?>"
429
- id="cnb_select_image"
430
- <?php if (!$isPro) { ?>disabled="disabled" title="Upgrade to PRO to enable custom images"<?php } ?>
431
- />
432
-
433
- <?php if (!$isPro && $domain) {
434
- $upgrade_link =
435
- add_query_arg( array(
436
- 'page' => 'call-now-button-domains',
437
- 'action' => 'upgrade',
438
- 'id' => $domain->id
439
- ),
440
- admin_url( 'admin.php' ) );
441
- ?>
442
- <p class="description">
443
- Setting a custom image is a <span class="cnb-pro-badge">Pro</span> feature.
444
- <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
445
- </p>
446
  <?php } ?>
447
 
 
448
  <a
449
  href="#"
450
  onclick="return cnb_show_icon_text_advanced(this)"
@@ -529,7 +525,7 @@ class CnbActionViewEdit {
529
  $action_sms_settings->render($action);
530
 
531
  $action_whatsapp_settings = new ActionWhatsappSettings();
532
- $action_whatsapp_settings->render($action);
533
 
534
  $action_email_settings = new ActionEmailSettings();
535
  $action_email_settings->render($action);
@@ -564,12 +560,16 @@ class CnbActionViewEdit {
564
  $showAlwaysValue = $action->id === 'new' || ( isset( $action->schedule ) && $action->schedule->showAlways ); ?>
565
  <?php if ( $timezone_set_correctly ) { ?>
566
  <input name="actions[<?php echo esc_attr( $action->id ) ?>][schedule][showAlways]" type="hidden"
567
- value="false"/>
568
  <input id="actions_schedule_show_always" class="cnb_toggle_checkbox"
569
  onchange="return cnb_hide_on_show_always();"
570
  name="actions[<?php echo esc_attr( $action->id ) ?>][schedule][showAlways]"
571
  type="checkbox"
572
- value="true" <?php checked( true, $showAlwaysValue ); ?>
 
 
 
 
573
  />
574
  <label for="actions_schedule_show_always" class="cnb_toggle_label">Toggle</label>
575
  <span data-cnb_toggle_state_label="actions_schedule_show_always"
@@ -599,6 +599,13 @@ class CnbActionViewEdit {
599
  before making any more changes. See the notice at the top of the page for more information.
600
  </p>
601
  <?php } ?>
 
 
 
 
 
 
 
602
  </td>
603
  </tr>
604
  <tr>
119
  */
120
  global $wp_locale;
121
 
 
 
122
  // In case a domain is not passed, we take it from the button
123
  $domain = isset( $domain ) ? $domain : ( isset( $button ) ? $button->domain : null );
124
 
154
 
155
  $timezone_set_correctly = ( new CnbHeaderNotices() )->is_timezone_valid( $domain );
156
 
157
+ $domain_type = $domain != null && !is_wp_error($domain) ? $domain->type : null;
158
+ $isPro = $domain_type === 'PRO';
159
+
160
+ $upgrade_link =
161
+ add_query_arg( array(
162
+ 'page' => 'call-now-button-domains',
163
+ 'action' => 'upgrade',
164
+ 'id' => $button->domain->id
165
+ ),
166
+ admin_url( 'admin.php' ) );
167
 
168
  ?>
169
  <input type="hidden" name="actions[<?php echo esc_attr( $action->id ) ?>][id]"
182
  <?php } ?>
183
 
184
  <tr class="cnb_hide_on_modal">
185
+ <th scope="row"><label for="cnb_action_type">Button action</label></th>
186
  <td>
187
  <select id="cnb_action_type" name="actions[<?php echo esc_attr( $action->id ) ?>][actionType]">
188
  <?php foreach ( ( new CnbAdminFunctions() )->cnb_get_action_types() as $action_type_key => $action_type_value ) { ?>
189
  <option
190
  value="<?php echo esc_attr( $action_type_key ) ?>"
191
  <?php selected( $action_type_value->type, $action->actionType ) ?>
192
+ <?php if (!$isPro && !in_array($domain_type, $action_type_value->plans)) { echo ' disabled="disabled"'; } ?>>
193
  <?php echo esc_html( $action_type_value->name ) ?>
194
+ <?php if (!$isPro && !in_array($domain_type, $action_type_value->plans)) { echo ' (PRO)'; } ?>
195
  </option>
196
  <?php } ?>
197
  </select>
198
+
 
 
 
 
 
 
 
 
 
 
 
 
199
  <p class="description cnb-action-properties-tally"><a target="_blank" href="https://tally.so?ref=callnowbutton&utm_source=callnowbutton&utm_medium=wordpress">Tally</a> is our favorite form tool.</p>
200
  </td>
201
  </tr>
242
  <tr class="cnb_hide_on_modal">
243
  <th scope="row"><label for="actions-<?php echo esc_attr( $action->id ) ?>-iconText">Button icon/image</label></th>
244
  <td data-icon-text-target="cnb_action_icon_text" data-icon-type-target="cnb_action_icon_type">
245
+ <?php if ( $button->domain->type !== 'STARTER' ) { ?>
246
  <div class="icon-text-options" id="icon-text-ANCHOR">
247
  <div class="cnb-button-icon">
248
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="anchor">anchor</i>
295
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="calendar">calendar</i>
296
  </div>
297
  </div>
298
+
299
  <div class="icon-text-options" id="icon-text-MAP">
300
  <div class="cnb-button-icon">
301
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="directions">directions</i>
316
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="directions6">directions6</i>
317
  </div>
318
  </div>
319
+
320
  <div class="icon-text-options" id="icon-text-PHONE">
321
  <div class="cnb-button-icon">
322
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call">call</i>
413
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="intercom">intercom</i>
414
  </div>
415
  </div>
416
+ <?php } ?>
417
+
418
+ <?php if ( $button->domain->type === 'STARTER' ) { ?>
419
+ <p class="description">
420
+ Icon selection and custom images are <span class="cnb-pro-badge">Pro</span> features.
421
+ <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
422
+ </p>
423
+ <?php } ?>
424
 
425
  <div class="cnb-button-icon cnb-button-image cnb_icon_active" id="cnb_selected_action_background_image" style="background-image:<?php echo esc_attr( $action->iconBackgroundImage ) ?>">
426
 
430
  name="actions[<?php echo esc_attr( $action->id ) ?>][iconBackgroundImage]"
431
  value="<?php echo esc_attr( $action->iconBackgroundImage ) ?>"
432
  id="cnb_action_icon_background_image"/>
433
+
434
+ <?php if ( $button->domain->type !== 'STARTER' ) { ?>
435
+ <input
436
+ type='button'
437
+ class="button-secondary" value="<?php esc_attr_e( 'Select image' ); ?>"
438
+ id="cnb_select_image"
439
+ <?php if (!$isPro) { ?>disabled="disabled" title="Upgrade to PRO to enable custom images"<?php } ?>
440
+ />
 
 
 
 
 
 
 
 
 
 
 
 
441
  <?php } ?>
442
 
443
+
444
  <a
445
  href="#"
446
  onclick="return cnb_show_icon_text_advanced(this)"
525
  $action_sms_settings->render($action);
526
 
527
  $action_whatsapp_settings = new ActionWhatsappSettings();
528
+ $action_whatsapp_settings->render($action, $button);
529
 
530
  $action_email_settings = new ActionEmailSettings();
531
  $action_email_settings->render($action);
560
  $showAlwaysValue = $action->id === 'new' || ( isset( $action->schedule ) && $action->schedule->showAlways ); ?>
561
  <?php if ( $timezone_set_correctly ) { ?>
562
  <input name="actions[<?php echo esc_attr( $action->id ) ?>][schedule][showAlways]" type="hidden"
563
+ value="<?php if ( $button->domain->type === 'STARTER' ) { echo 'true'; } else { echo 'false'; } ?>"/>
564
  <input id="actions_schedule_show_always" class="cnb_toggle_checkbox"
565
  onchange="return cnb_hide_on_show_always();"
566
  name="actions[<?php echo esc_attr( $action->id ) ?>][schedule][showAlways]"
567
  type="checkbox"
568
+ value="true"
569
+ <?php if ( $button->domain->type === 'STARTER' ) {
570
+ $showAlwaysValue = true;
571
+ ?>disabled="disabled"<?php } ?>
572
+ <?php checked( true, $showAlwaysValue ); ?>
573
  />
574
  <label for="actions_schedule_show_always" class="cnb_toggle_label">Toggle</label>
575
  <span data-cnb_toggle_state_label="actions_schedule_show_always"
599
  before making any more changes. See the notice at the top of the page for more information.
600
  </p>
601
  <?php } ?>
602
+ <?php if ( $button->domain->type === 'STARTER' ) { ?>
603
+ <p class="description">
604
+ Scheduling is a <span class="cnb-pro-badge">Pro</span> feature.
605
+ <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
606
+ </p>
607
+ <?php } ?>
608
+
609
  </td>
610
  </tr>
611
  <tr>
src/admin/action/partials/class-action-whatsapp-settings.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace cnb\admin\action;
4
 
5
  // don't load directly
 
6
  use cnb\utils\CnbUtils;
7
 
8
  defined( 'ABSPATH' ) || die( '-1' );
@@ -10,12 +11,13 @@ defined( 'ABSPATH' ) || die( '-1' );
10
  class ActionWhatsappSettings {
11
  /**
12
  * @param CnbAction $action
 
13
  *
14
  * @return void
15
  */
16
- function render( $action ) {
17
  $this->render_header();
18
- $this->render_options( $action );
19
  $this->render_close_header();
20
  }
21
 
@@ -45,23 +47,45 @@ class ActionWhatsappSettings {
45
 
46
  /**
47
  * @param CnbAction $action
 
48
  *
49
  * @return void
50
  */
51
- function render_options( $action ) {
52
  $cnb_utils = new CnbUtils();
 
 
 
 
 
 
 
 
 
53
  ?>
54
  <table class="cnb-settings-section-table">
55
  <tr class="cnb-action-properties-whatsapp">
56
- <th scope="row">When clicked...</th>
 
 
 
 
57
  <td class="appearance">
58
  <?php $value = isset( $action->properties ) && isset( $action->properties->{'whatsapp-dialog-type'} ) && $action->properties->{'whatsapp-dialog-type'} ? $action->properties->{'whatsapp-dialog-type'} : ''; ?>
59
  <select id="cnb-action-modal"
 
60
  name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-dialog-type]">
61
  <option value="" <?php selected( $value, '' ); ?>>...directly open WhatsApp</option>
62
  <option value="popout" <?php selected( $value, 'popout' ); ?>>...show WhatsApp chat window
63
  </option>
64
  </select>
 
 
 
 
 
 
 
65
  </td>
66
  </tr>
67
  <!-- TODO: Message template kijkt naar isVisible maar "Extra WhatsApp Settings" zijn nu hidden by default -->
3
  namespace cnb\admin\action;
4
 
5
  // don't load directly
6
+ use cnb\admin\button\CnbButton;
7
  use cnb\utils\CnbUtils;
8
 
9
  defined( 'ABSPATH' ) || die( '-1' );
11
  class ActionWhatsappSettings {
12
  /**
13
  * @param CnbAction $action
14
+ * @param CnbButton $button
15
  *
16
  * @return void
17
  */
18
+ function render( $action, $button ) {
19
  $this->render_header();
20
+ $this->render_options( $action, $button );
21
  $this->render_close_header();
22
  }
23
 
47
 
48
  /**
49
  * @param CnbAction $action
50
+ * @param CnbButton $button
51
  *
52
  * @return void
53
  */
54
+ function render_options( $action, CnbButton $button ) {
55
  $cnb_utils = new CnbUtils();
56
+
57
+ $upgrade_link =
58
+ add_query_arg( array(
59
+ 'page' => 'call-now-button-domains',
60
+ 'action' => 'upgrade',
61
+ 'id' => $button->domain->id
62
+ ),
63
+ admin_url( 'admin.php' ) );
64
+
65
  ?>
66
  <table class="cnb-settings-section-table">
67
  <tr class="cnb-action-properties-whatsapp">
68
+ <th scope="row">
69
+ <label for="cnb-action-modal">
70
+ When clicked...
71
+ </label>
72
+ </th>
73
  <td class="appearance">
74
  <?php $value = isset( $action->properties ) && isset( $action->properties->{'whatsapp-dialog-type'} ) && $action->properties->{'whatsapp-dialog-type'} ? $action->properties->{'whatsapp-dialog-type'} : ''; ?>
75
  <select id="cnb-action-modal"
76
+ <?php if ( $button->domain->type === 'STARTER' ) { ?>disabled="disabled"<?php } ?>
77
  name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-dialog-type]">
78
  <option value="" <?php selected( $value, '' ); ?>>...directly open WhatsApp</option>
79
  <option value="popout" <?php selected( $value, 'popout' ); ?>>...show WhatsApp chat window
80
  </option>
81
  </select>
82
+ <?php if ( $button->domain->type === 'STARTER' ) { ?>
83
+ <p class="description">
84
+ WhatsApp chat window is a <span class="cnb-pro-badge">Pro</span> feature.
85
+ <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
86
+ </p>
87
+
88
+ <?php } ?>
89
  </td>
90
  </tr>
91
  <!-- TODO: Message template kijkt naar isVisible maar "Extra WhatsApp Settings" zijn nu hidden by default -->
src/admin/button/CnbButton.php CHANGED
@@ -73,7 +73,7 @@ class CnbButton implements JsonSerializable {
73
  */
74
  public static function createDummyButton( $domain = null ) {
75
  $button = new CnbButton();
76
- $button->id = '';
77
  $button->active = true;
78
  $button->name = '';
79
  $button->type = 'SINGLE';
73
  */
74
  public static function createDummyButton( $domain = null ) {
75
  $button = new CnbButton();
76
+ $button->id = 'new';
77
  $button->active = true;
78
  $button->name = '';
79
  $button->type = 'SINGLE';
src/admin/button/CnbButtonController.php CHANGED
@@ -134,7 +134,7 @@ class CnbButtonController {
134
  $conditions = array();
135
  }
136
 
137
- /** @var CnbAction[] */
138
  $processed_actions = array();
139
  if ( is_array( $actions ) ) {
140
  foreach ( $actions as $action ) {
@@ -142,7 +142,7 @@ class CnbButtonController {
142
  }
143
  }
144
 
145
- /** @var CnbCondition[] */
146
  $processed_conditions = array();
147
  if ( is_array( $conditions ) ) {
148
  foreach ( $conditions as $condition ) {
@@ -150,6 +150,7 @@ class CnbButtonController {
150
  }
151
  }
152
 
 
153
  $button['actions'] = $processed_actions;
154
  $button['conditions'] = $processed_conditions;
155
  $processed_button = CnbButton::fromObject( $button );
134
  $conditions = array();
135
  }
136
 
137
+ /** @var CnbAction[] $processed_actions */
138
  $processed_actions = array();
139
  if ( is_array( $actions ) ) {
140
  foreach ( $actions as $action ) {
142
  }
143
  }
144
 
145
+ /** @var CnbCondition[] $processed_conditions */
146
  $processed_conditions = array();
147
  if ( is_array( $conditions ) ) {
148
  foreach ( $conditions as $condition ) {
150
  }
151
  }
152
 
153
+ $button['id'] = $button['id'] !== 'new' ? $button['id'] : null;
154
  $button['actions'] = $processed_actions;
155
  $button['conditions'] = $processed_conditions;
156
  $processed_button = CnbButton::fromObject( $button );
src/admin/button/CnbButtonView.php CHANGED
@@ -26,7 +26,7 @@ class CnbButtonView {
26
  array(
27
  'TB_inline' => 'true',
28
  'inlineId' => 'cnb-add-new-modal',
29
- 'height' => '433', // 433 seems ideal -> To hide the scrollbar. 500 to include validation errors
30
  'page' => 'call-now-button',
31
  'action' => 'new',
32
  'type' => 'single',
@@ -142,38 +142,51 @@ class CnbButtonView {
142
  $faq_url = $cnb_utils->get_support_url( 'wordpress/#faq', 'promobox-need-help', 'FAQ' );
143
  if ( isset( $upgrade_url ) && $upgrade_url ) {
144
  echo '<div class="cnb-postbox-container cnb-side-column"> <!-- Sidebar promo boxes -->';
145
- if ( $domain !== null && ! ( $domain instanceof WP_Error ) && $domain->type === 'FREE' ) {
146
- $coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
147
- $discount_illustration = plugins_url( '../../../resources/images/discount.png', __FILE__ );
148
- if ( $coupon != null && ! is_wp_error( $coupon ) ) {
 
 
 
149
  ( new CnbAdminFunctions() )->cnb_promobox(
150
  'green',
151
- 'SPECIAL UPGRADE OFFER!',
152
- '<h4>Get an extra ' . esc_html( $coupon->get_discount() ) . ' off the PRO plan!</h4>' .
153
- '<p>Enter coupon code <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code> during checkout.</p>' .
154
- '<div class="cnb-center" style="padding: 10px 30px"><img src="' . esc_url( $discount_illustration ) . '" alt="Upgrade your domain to PRO with an extra discount" style="max-width:300px; width:100%; height:auto;" /></div>',
155
- 'flag',
156
- 'Code: <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code>',
157
  'Upgrade',
158
  $upgrade_url
159
  );
160
- } else {
161
  ( new CnbAdminFunctions() )->cnb_promobox(
162
- 'purple',
163
  'Professional features',
164
- '<p>
165
- Slide-in Content Windows<a
166
- href="' . esc_url( $cnb_utils->get_website_url( 'integrations/#iframes', 'pro-upgrade', 'content-windows' ) ) . '"
167
- target="_blank" class="cnb-nounderscore"><span class="dashicons dashicons-editor-help"></span></a><br>
168
- 📷 Use custom images on buttons<br>
169
- 🌍 Include and exclude countries<br>
170
- ↕️ Set scroll height for buttons to appear<br>
171
- 🔌 Intercom Chat integration<a
172
- href="' . esc_url( $cnb_utils->get_website_url( 'integrations/#intercom', 'pro-upgrade', 'intercom' ) ) . '"
173
- target="_blank" class="cnb-nounderscore"><span class="dashicons dashicons-editor-help"></span></a><br>
174
- ✨ Remove the <em>Powered by</em> notice</p>',
175
  'performance',
176
- '<strong>&euro;<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> per month</strong>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  'Upgrade',
178
  $upgrade_url
179
  );
@@ -210,13 +223,11 @@ class CnbButtonView {
210
  $domain = CnbAppRemote::cnb_remote_get_wp_domain();
211
  }
212
 
213
- $button_id = 'new';
214
-
215
  // Create a dummy button
216
  $button = CnbButton::createDummyButton( $domain );
217
 
218
  $options = array( 'modal_view' => true, 'submit_button_text' => 'Next' );
219
- ( new CnbButtonViewEdit() )->render_form( $button_id, $button, $domain, $options );
220
  echo '</div></div>';
221
 
222
  }
26
  array(
27
  'TB_inline' => 'true',
28
  'inlineId' => 'cnb-add-new-modal',
29
+ 'height' => '452', // 433 + 19 (19 for PRO message) seems ideal -> To hide the scrollbar. 500 to include validation errors
30
  'page' => 'call-now-button',
31
  'action' => 'new',
32
  'type' => 'single',
142
  $faq_url = $cnb_utils->get_support_url( 'wordpress/#faq', 'promobox-need-help', 'FAQ' );
143
  if ( isset( $upgrade_url ) && $upgrade_url ) {
144
  echo '<div class="cnb-postbox-container cnb-side-column"> <!-- Sidebar promo boxes -->';
145
+ if ( $domain !== null && ! ( $domain instanceof WP_Error ) && $domain->type === 'STARTER' ) {
146
+ $promoboxes = range(1,3);
147
+ shuffle($promoboxes);
148
+ $promoItem = array_rand($promoboxes);
149
+ $schedule_illustration = plugins_url( '../../../resources/images/scheduler.png', __FILE__ );
150
+ $custom_image = plugins_url( '../../../resources/images/custom-image.jpg', __FILE__ );
151
+ if ( $promoItem == 1) {
152
  ( new CnbAdminFunctions() )->cnb_promobox(
153
  'green',
154
+ 'Schedule your buttons',
155
+ '<h4>Show a call button during office hours</h4>' .
156
+ '<div class="cnb-center" style="padding: 10px 30px"><img src="' . esc_url( $schedule_illustration ) . '" alt="Upgrade your domain to PRO with an extra discount" style="max-width:300px; width:100%; height:auto;" /></div>' .
157
+ '<p>A mail button when your off.</p>' ,
158
+ 'clock',
159
+ 'Try PRO 14 days free',
160
  'Upgrade',
161
  $upgrade_url
162
  );
163
+ } elseif ( $promoItem == 2) {
164
  ( new CnbAdminFunctions() )->cnb_promobox(
165
+ 'green',
166
  'Professional features',
167
+ '<p>⏱️ Button scheduler<br>
168
+ 📷 Icons & custom images on buttons<br>
169
+ 👮 Advanced display rules<br>
170
+ 🌍 Geo targeting<br>
171
+ ↕️ Set scroll height for buttons to appear<br>
172
+ Slide-in content windows<br>
173
+ 🔌 Integrate your Intercom chat</p><h3>And much more!</h3>',
 
 
 
 
174
  'performance',
175
+ '<strong>Try it 14 days free!</strong>',
176
+ 'Upgrade',
177
+ $upgrade_url
178
+ );
179
+ } else {
180
+ ( new CnbAdminFunctions() )->cnb_promobox(
181
+ 'green',
182
+ 'Customize your buttons',
183
+ '<h4>Unlock more icons...</h4>' .
184
+ '<p>Upgrade to Pro to enable an icon picker for your actions.</p>' .
185
+ '<h4>...or personalize with Custom Images</h4>' .
186
+ '<div class="cnb-center" style="padding: 0 34px"><img src="' . esc_url( $custom_image ) . '" alt="Custom button images" style="max-width:246px; width:100%; height:auto;" /></div>' .
187
+ '<p>With custom images you can add your own image to your buttons. For example a headshot on a contact button.</p>',
188
+ 'art',
189
+ '<strong>Try it 14 days free!</strong>',
190
  'Upgrade',
191
  $upgrade_url
192
  );
223
  $domain = CnbAppRemote::cnb_remote_get_wp_domain();
224
  }
225
 
 
 
226
  // Create a dummy button
227
  $button = CnbButton::createDummyButton( $domain );
228
 
229
  $options = array( 'modal_view' => true, 'submit_button_text' => 'Next' );
230
+ ( new CnbButtonViewEdit() )->render_form( $button, $domain, $options );
231
  echo '</div></div>';
232
 
233
  }
src/admin/button/CnbButtonViewEdit.php CHANGED
@@ -5,15 +5,9 @@ namespace cnb\admin\button;
5
  // don't load directly
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
- use cnb\admin\action\CnbAction;
9
- use cnb\admin\action\CnbActionProperties;
10
- use cnb\admin\action\CnbActionView;
11
- use cnb\admin\action\CnbActionViewEdit;
12
  use cnb\admin\api\CnbAppRemote;
13
- use cnb\admin\condition\CnbConditionView;
14
  use cnb\admin\domain\CnbDomain;
15
  use cnb\utils\CnbAdminFunctions;
16
- use cnb\utils\CnbUtils;
17
  use stdClass;
18
  use WP_Error;
19
 
@@ -60,21 +54,15 @@ class CnbButtonViewEdit {
60
  *
61
  * This renders JUST the form (no tabs, preview phone, etc.) and is also used in button-overview for the "Add new" modal.
62
  *
63
- * @param $button_id int
64
  * @param $button CnbButton
65
  * @param $default_domain CnbDomain|WP_Error
66
  * @param $options array (modal_view (boolean), submit_button_text (string), advanced_view (boolean)
67
  *
68
  * @return void
69
  */
70
- public function render_form( $button_id, $button, $default_domain, $options = array() ) {
71
  $adminFunctions = new CnbAdminFunctions();
72
- $cnb_utils = new CnbUtils();
73
- $domains = CnbAppRemote::cnb_remote_get_domains();
74
-
75
- $cnb_single_image_url = plugins_url( '../../../resources/images/button-new-single.png', __FILE__ );
76
- $cnb_multi_image_url = plugins_url( '../../../resources/images/button-new-multi.png', __FILE__ );
77
- $cnb_full_image_url = plugins_url( '../../../resources/images/button-new-full.png', __FILE__ );
78
 
79
  $submit_button_text = array_key_exists( 'submit_button_text', $options ) ? $options['submit_button_text'] : '';
80
  $hide_on_modal = array_key_exists( 'modal_view', $options ) && $options['modal_view'] === true;
@@ -82,29 +70,6 @@ class CnbButtonViewEdit {
82
  echo '<script type="text/javascript">cnb_hide_on_modal_set=1</script>';
83
  }
84
 
85
- // Create "add Action" link WITH Button association
86
- $url = admin_url( 'admin.php' );
87
- $new_action_link =
88
- add_query_arg(
89
- array(
90
- 'page' => 'call-now-button-actions',
91
- 'action' => 'new',
92
- 'id' => 'new',
93
- 'tab' => 'basic_options',
94
- 'bid' => $button->id
95
- ),
96
- $url );
97
-
98
- $new_condition_link =
99
- add_query_arg(
100
- array(
101
- 'page' => 'call-now-button-conditions',
102
- 'action' => 'new',
103
- 'id' => 'new',
104
- 'bid' => $button->id
105
- ),
106
- $url );
107
-
108
  // In case the API isn't working properly
109
  if ( $default_domain instanceof WP_Error ) {
110
  $default_domain = new CnbDomain();
@@ -130,7 +95,7 @@ class CnbButtonViewEdit {
130
  action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post">
131
  <input type="hidden" name="page" value="call-now-button"/>
132
  <input type="hidden" name="action"
133
- value="<?php echo $button_id === 'new' ? 'cnb_create_' . esc_attr( strtolower( $button->type ) ) . '_button' : 'cnb_update_' . esc_attr( strtolower( $button->type ) ) . '_button' ?>"/>
134
  <input type="hidden" name="_wpnonce_button"
135
  value="<?php echo esc_attr( wp_create_nonce( 'cnb-button-edit' ) ) ?>"/>
136
  <input type="hidden" name="tab" value="<?php echo esc_attr( $adminFunctions->get_active_tab_name() ) ?>"/>
@@ -140,491 +105,12 @@ class CnbButtonViewEdit {
140
  <input type="hidden" name="button[active]" value="<?php echo esc_attr( $button->active ) ?>"/>
141
  <input type="hidden" name="button[domain]" value="<?php echo esc_attr( $default_domain->id ) ?>"/>
142
 
143
- <table class="form-table <?php if ( ! $hide_on_modal ) {
144
- echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) );
145
- } else {
146
- echo 'nav-tab-only';
147
- } ?>" data-tab-name="basic_options">
148
- <tr class="cnb_hide_on_modal">
149
- <th></th>
150
- <td></td>
151
- </tr>
152
- <tr class="cnb_hide_on_modal">
153
- <th scope="row"><label for="cnb-enable">Button status</label></th>
154
-
155
- <td class="activated">
156
- <input type="hidden" name="button[active]" value="0"/>
157
- <input id="cnb-enable" class="cnb_toggle_checkbox" type="checkbox" name="button[active]"
158
- value="1" <?php checked( true, $button->active ); ?> />
159
- <label for="cnb-enable" class="cnb_toggle_label">Toggle</label>
160
- <span data-cnb_toggle_state_label="cnb-enable" class="cnb_toggle_state cnb_toggle_false">(Inactive)</span>
161
- <span data-cnb_toggle_state_label="cnb-enable"
162
- class="cnb_toggle_state cnb_toggle_true">Active</span>
163
- </td>
164
- </tr>
165
- <tr>
166
- <th scope="row"><label for="button_name">Button name</label></th>
167
-
168
- <td class="activated">
169
- <input type="text" name="button[name]" id="button_name" required="required"
170
- value="<?php echo esc_attr( $button->name ); ?>"/>
171
- </td>
172
- </tr>
173
- <tr class="cnb_hide_on_modal cnb_advanced_view">
174
- <th scope="row"><label for="button_domain">Domain</label></th>
175
- <td>
176
- <select name="button[domain]" id="button_domain">
177
- <?php
178
- foreach ( $domains as $domain ) { ?>
179
- <option
180
- <?php selected( $domain->id, $button->domain->id ) ?>
181
- value="<?php echo esc_attr( $domain->id ) ?>">
182
- <?php echo esc_html( $domain->name ) ?>
183
- <?php if ( $domain->id == $default_domain->id ) {
184
- echo ' (current WordPress domain)';
185
- } ?>
186
- </option>
187
- <?php } ?>
188
- </select>
189
- </td>
190
- </tr>
191
- <?php if ( $button->type !== 'SINGLE' ) { ?>
192
- <tr class="cnb_hide_on_modal">
193
- <th colspan="2" class="cnb_padding_0">
194
- <h2>
195
- Actions <?php echo '<a href="' . esc_url( $new_action_link ) . '" class="page-title-action">Add Action</a>'; ?></h2>
196
- </th>
197
- </tr>
198
- <?php }
199
- if ( $button->type === 'SINGLE' ) {
200
- $action = new CnbAction();
201
-
202
- // If there is a real one, use that one
203
- if ( sizeof( $button->actions ) > 0 ) {
204
- $action = $button->actions[0];
205
- } else {
206
- // Create a dummy Action
207
- $action->id = 'new';
208
- $action->actionType = '';
209
- $action->actionValue = '';
210
- $action->labelText = '';
211
- $action->properties = new CnbActionProperties();
212
- }
213
- // Start workaround: This table below (<tr>...</tr>) needs to be there for the modal to work!
214
- if ( $hide_on_modal ) { ?>
215
- <tr class="cnb_hide_on_modal">
216
- <th></th>
217
- <td>
218
- <input type="hidden" name="actions[<?php echo esc_attr( $action->id ) ?>][id]"
219
- value="<?php echo esc_attr( $action->id ) ?>"/>
220
- <?php }
221
- ( new CnbActionViewEdit() )->render_main( $action, $button, $default_domain );
222
- if ( $hide_on_modal ) { ?>
223
- </td>
224
- </tr>
225
- <?php } // End workaround
226
- } else { ?>
227
- </table>
228
-
229
- <!-- This div exists to allow rendering the Action table outside the existing table -->
230
- <div data-tab-name="basic_options" class="cnb-button-edit-action-table <?php if ( $hide_on_modal ) {
231
- echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) );
232
- } else {
233
- echo 'nav-tab-only';
234
- } ?>" <?php if ( ! $adminFunctions->is_active_tab( 'basic_options' ) ) {
235
- echo 'style="display:none"';
236
- } ?>>
237
- <?php ( new CnbActionView() )->renderTable( $button ); ?>
238
- </div>
239
-
240
- <table class="form-table <?php if ( ! $hide_on_modal ) {
241
- echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) );
242
- } else {
243
- echo 'nav-tab-only';
244
- } ?>"><?php
245
- } ?>
246
- <script>
247
- let cnb_actions = <?php echo wp_json_encode( $button->actions ) ?>;
248
- let cnb_domain = <?php echo wp_json_encode( $button->domain ) ?>;
249
- </script>
250
-
251
- <?php if ( $button_id === 'new' ) { ?>
252
- <tr>
253
- <th scope="row">Select button type</th>
254
- </tr>
255
- <tr>
256
- <td colspan="2">
257
- <div class="cnb-flexbox cnb_type_selector">
258
- <div class="cnb_type_selector_item cnb_type_selector_single cnb_type_selector_active"
259
- data-cnb-selection="single">
260
- <img style="max-width:100%;" alt="Choose a Single button type"
261
- src="<?php echo esc_url( $cnb_single_image_url ) ?>">
262
- <div style="text-align:center">Single button</div>
263
- </div>
264
- <div class="cnb_type_selector_item cnb_type_selector_multi" data-cnb-selection="multi">
265
- <img style="max-width:100%;" alt="Choose a Multibutton type"
266
- src="<?php echo esc_url( $cnb_multi_image_url ) ?>">
267
- <div style="text-align:center">Multibutton</div>
268
- </div>
269
- <div class="cnb_type_selector_item cnb_type_selector_full" data-cnb-selection="full">
270
- <img style="max-width:100%;" alt="Choose a Full button type"
271
- src="<?php echo esc_url( $cnb_full_image_url ) ?>">
272
- <div style="text-align:center">Buttonbar</div>
273
- </div>
274
- </div>
275
- </td>
276
- </tr>
277
- <?php } ?>
278
- </table>
279
- <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>"
280
- data-tab-name="extra_options">
281
- <?php if ( $button->type === 'FULL' ) { ?>
282
- <tr class="cnb_hide_on_modal">
283
- <th></th>
284
- <td></td>
285
- </tr>
286
- <tr class="cnb_advanced_view">
287
- <th colspan="2">
288
- <h3>Colors for the Buttonbar are defined via the individual Action(s).</h3>
289
- <input name="button[options][iconBackgroundColor]" type="hidden"
290
- value="<?php echo esc_attr( $button->options->iconBackgroundColor ); ?>"/>
291
- <input name="button[options][iconColor]" type="hidden"
292
- value="<?php echo esc_attr( $button->options->iconColor ); ?>"/>
293
- </th>
294
- </tr>
295
- <?php } else if ( $button->type === 'SINGLE' ) {
296
- // Migration note:
297
- //- we move from button.options.iconBackgroundColor to action.backgroundColor
298
- //- we move from button.options.iconColor to action.iconColor
299
- // So for now, "button" take priority, but once the new value is saved, we blank the button options
300
- $backgroundColor = ( $button && $button->options && $button->options->iconBackgroundColor ) ? $button->options->iconBackgroundColor : ( $action->backgroundColor ?: '#009900' );
301
- $iconColor = ( $button && $button->options && $button->options->iconColor ) ? $button->options->iconColor : ( $action->iconColor ?: '#FFFFFF' );
302
- ?>
303
- <tr class="cnb_hide_on_modal">
304
- <th></th>
305
- <td>
306
- <input name="button[options][iconBackgroundColor]" type="hidden" value=""/>
307
- <input name="button[options][iconColor]" type="hidden" value=""/>
308
- <!-- We always enable the icon when the type if SINGLE, original value is "<?php echo esc_attr( $action->iconEnabled ) ?>" -->
309
- <input name="actions[<?php echo esc_attr( $action->id ) ?>][iconEnabled]" type="hidden"
310
- value="1"/>
311
- </td>
312
- </tr>
313
- <tr>
314
- <th scope="row"><label for="actions-options-iconBackgroundColor">Button color</label></th>
315
- <td>
316
- <input name="actions[<?php echo esc_attr( $action->id ) ?>][backgroundColor]"
317
- id="actions-options-iconBackgroundColor" type="text"
318
- value="<?php echo esc_attr( $backgroundColor ); ?>" class="cnb-iconcolor-field"
319
- data-default-color="#009900"/>
320
- </td>
321
- </tr>
322
- <tr>
323
- <th scope="row"><label for="actions-options-iconColor">Icon color</label></th>
324
- <td>
325
- <input name="actions[<?php echo esc_attr( $action->id ) ?>][iconColor]"
326
- id="actions-options-iconColor" type="text"
327
- value="<?php echo esc_attr( $iconColor ); ?>" class="cnb-iconcolor-field"
328
- data-default-color="#FFFFFF"/>
329
- </td>
330
- </tr>
331
-
332
- <?php } else if ( $button->type === 'MULTI' ) {
333
- $backgroundColor = ( $button->options && $button->options->iconBackgroundColor ) ? $button->options->iconBackgroundColor :
334
- ( $button->multiButtonOptions ? $button->multiButtonOptions->iconBackgroundColor : '#009900' );
335
- $iconColor = ( $button->options && $button->options->iconColor ) ? $button->options->iconColor :
336
- ( $button->multiButtonOptions ? $button->multiButtonOptions->iconColor : '#FFFFFF' );
337
- $multi_button_id =( $button->multiButtonOptions && $button->multiButtonOptions->id ) ? $button->multiButtonOptions->id : '';
338
- $iconTextOpen = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTextOpen ) ? $button->multiButtonOptions->iconTextOpen : 'more_vert';
339
- $iconTypeOpen = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeOpen ) ? $button->multiButtonOptions->iconTypeOpen : 'FONT';
340
- $iconTextClose = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTextClose ) ? $button->multiButtonOptions->iconTextClose : 'close';
341
- $iconTypeClose = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeClose ) ? $button->multiButtonOptions->iconTypeClose : 'FONT';
342
- $labelText = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeClose ) ? $button->multiButtonOptions->labelText : null;
343
- $labelBackgroundColor = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeClose ) ? $button->multiButtonOptions->labelBackgroundColor : null;
344
- ?>
345
- <tr class="cnb_hide_on_modal">
346
- <th></th>
347
- <td></td>
348
- </tr>
349
- <tr>
350
- <th scope="row"><label for="button-multiButtonOptions-iconBackgroundColor">Main button
351
- color</label></th>
352
- <td>
353
- <input name="button[multiButtonOptions][id]" type="hidden"
354
- value="<?php echo esc_attr( $multi_button_id ); ?>"/>
355
- <input name="button[multiButtonOptions][iconBackgroundColor]"
356
- id="button-multiButtonOptions-iconBackgroundColor" type="text"
357
- value="<?php echo esc_attr( $backgroundColor ); ?>"
358
- class="cnb-iconcolor-field" data-default-color="#009900"/>
359
- </td>
360
- </tr>
361
- <tr>
362
- <th scope="row"><label for="button-multiButtonOptions-iconColor">Main icon color</label></th>
363
- <td>
364
- <input name="button[multiButtonOptions][iconColor]" id="button-multiButtonOptions-iconColor"
365
- type="text" value="<?php echo esc_attr( $iconColor ); ?>"
366
- class="cnb-iconcolor-field" data-default-color="#FFFFFF"/>
367
- </td>
368
- </tr>
369
- <tr>
370
- <th scope="row"><label for="button-multiButtonOptions-iconTextOpen">Main icon</label></th>
371
- <td>
372
- <div class="icon-text-options" id="icon-text-open"
373
- data-icon-text-target="button-multiButtonOptions-iconTextOpen"
374
- data-icon-type-target="button-multiButtonOptions-iconTypeOpen">
375
- <div class="cnb-button-icon">
376
- <i class="cnb-font-icon" data-icon-type="FONT"
377
- data-icon-text="more_vert">more_vert</i>
378
- </div>
379
- <div class="cnb-button-icon">
380
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="menu">menu</i>
381
- </div>
382
- <div class="cnb-button-icon">
383
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="support">support</i>
384
- </div>
385
- <div class="cnb-button-icon">
386
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="communicate">communicate</i>
387
- </div>
388
- <div class="cnb-button-icon">
389
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="more_info">more_info</i>
390
- </div>
391
- <div class="cnb-button-icon">
392
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="conversation">conversation</i>
393
- </div>
394
- <div class="cnb-button-icon">
395
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call3">call3</i>
396
- </div>
397
- <div class="cnb-button-icon">
398
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="whatsapp">whatsapp</i>
399
- </div>
400
- <div class="cnb-button-icon">
401
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="email">email</i>
402
- </div>
403
- <div class="cnb-button-icon">
404
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call">call</i>
405
- </div>
406
- <div class="cnb-button-icon">
407
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="directions3">directions3</i>
408
- </div>
409
- </div>
410
- <div class="cnb_advanced_view">
411
- <a
412
- href="#"
413
- onclick="return cnb_show_icon_text_advanced(this)"
414
- data-icon-text="button-multiButtonOptions-iconTextOpen"
415
- data-icon-type="button-multiButtonOptions-iconTypeOpen"
416
- data-description="button-multiButtonOptions-iconTextOpen-description"
417
- class="cnb_advanced_view">Use a custom icon</a>
418
- <input name="button[multiButtonOptions][iconTextOpen]"
419
- id="button-multiButtonOptions-iconTextOpen" type="hidden"
420
- value="<?php echo esc_attr( $iconTextOpen ); ?>"/>
421
- <input name="button[multiButtonOptions][iconTypeOpen]"
422
- id="button-multiButtonOptions-iconTypeOpen" type="hidden"
423
- value="<?php echo esc_attr( $iconTypeOpen ); ?>"/>
424
- <p class="description" id="button-multiButtonOptions-iconTextOpen-description"
425
- style="display: none">
426
- You can enter a custom Material Design font code here. Search the full library at <a
427
- href="https://fonts.google.com/icons" target="_blank">Google Fonts</a>.<br/>
428
- The Call Now Button uses the <code>filled</code> version of icons.</p>
429
- </div>
430
- </td>
431
- </tr>
432
- <tr class="cnb_advanced_view">
433
- <th scope="row"><label for="button-multiButtonOptions-iconTextClose">Close Icon</label></th>
434
- <td>
435
- <div class="icon-text-options" id="icon-text-close"
436
- data-icon-text-target="button-multiButtonOptions-iconTextClose"
437
- data-icon-type-target="button-multiButtonOptions-iconTypeClose">
438
- <div class="cnb-button-icon">
439
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="close">close</i>
440
- </div>
441
- <div class="cnb-button-icon">
442
- <i class="cnb-font-icon family-material" data-icon-type="FONT_MATERIAL"
443
- data-icon-text="cancel">cancel</i>
444
- </div>
445
- <div class="cnb-button-icon">
446
- <i class="cnb-font-icon family-material" data-icon-type="FONT_MATERIAL"
447
- data-icon-text="close">close</i>
448
- </div>
449
- <div class="cnb-button-icon">
450
- <i class="cnb-font-icon family-material" data-icon-type="FONT_MATERIAL"
451
- data-icon-text="zoom_in_map">zoom_in_map</i>
452
- </div>
453
- </div>
454
- <a
455
- href="#"
456
- onclick="return cnb_show_icon_text_advanced(this)"
457
- data-icon-text="button-multiButtonOptions-iconTextClose"
458
- data-icon-type="button-multiButtonOptions-iconTypeClose"
459
- data-description="button-multiButtonOptions-iconTextClose-description"
460
- class="cnb_advanced_view">Use a custom icon</a>
461
- <input name="button[multiButtonOptions][iconTextClose]"
462
- id="button-multiButtonOptions-iconTextClose" type="hidden"
463
- value="<?php echo esc_attr( $iconTextClose ); ?>"/>
464
- <input name="button[multiButtonOptions][iconTypeClose]"
465
- id="button-multiButtonOptions-iconTypeClose" type="hidden"
466
- value="<?php echo esc_attr( $iconTypeClose ); ?>"/>
467
- <p class="description" id="button-multiButtonOptions-iconTextClose-description"
468
- style="display: none">
469
- You can enter a custom Material Design font code here. Search the full library at <a
470
- href="https://fonts.google.com/icons" target="_blank">Google Fonts</a>.<br/>
471
- The Call Now Button uses the <code>filled</code> version of icons.</p>
472
- </td>
473
- </tr>
474
- <tr class="cnb_advanced_view">
475
- <th scope="row"><label for="button-multiButtonOptions-labelText">Label text (when open)</label>
476
- </th>
477
- <td>
478
- <input name="button[multiButtonOptions][labelText]" id="button-multiButtonOptions-labelText"
479
- type="text" value="<?php echo esc_attr( $labelText ); ?>"/>
480
- </td>
481
- </tr>
482
- <tr class="cnb_advanced_view">
483
- <th scope="row"><label for="button-multiButtonOptions-labelBackgroundColor">Label background
484
- color</label></th>
485
- <td>
486
- <input name="button[multiButtonOptions][labelBackgroundColor]"
487
- id="button-multiButtonOptions-labelBackgroundColor" type="text"
488
- value="<?php echo esc_attr( $labelBackgroundColor ); ?>"
489
- class="cnb-iconcolor-field" data-default-color="#3c434a"/>
490
- </td>
491
- </tr>
492
- <?php } ?>
493
- <tr>
494
- <th scope="row">Position <a
495
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/presentation/button-position/', 'question-mark', 'button-position' ) ) ?>"
496
- target="_blank" class="cnb-nounderscore">
497
- <span class="dashicons dashicons-editor-help"></span>
498
- </a></th>
499
- <td class="appearance">
500
- <div class="appearance-options">
501
- <?php if ( $button->type === 'FULL' ) { ?>
502
- <div class="cnb-radio-item">
503
- <input type="radio" id="appearance1" name="button[options][placement]"
504
- value="TOP_CENTER" <?php checked( 'TOP_CENTER', $button->options->placement ); ?>>
505
- <label title="top-center" for="appearance1">Top</label>
506
- </div>
507
- <div class="cnb-radio-item">
508
- <input type="radio" id="appearance2" name="button[options][placement]"
509
- value="BOTTOM_CENTER" <?php checked( 'BOTTOM_CENTER', $button->options->placement ); ?>>
510
- <label title="bottom-center" for="appearance2">Bottom</label>
511
- </div>
512
- <?php } else { ?>
513
- <div class="cnb-radio-item">
514
- <input type="radio" id="appearance1" name="button[options][placement]"
515
- value="BOTTOM_RIGHT" <?php checked( 'BOTTOM_RIGHT', $button->options->placement ); ?>>
516
- <label title="bottom-right" for="appearance1">Right corner</label>
517
- </div>
518
- <div class="cnb-radio-item">
519
- <input type="radio" id="appearance2" name="button[options][placement]"
520
- value="BOTTOM_LEFT" <?php checked( 'BOTTOM_LEFT', $button->options->placement ); ?>>
521
- <label title="bottom-left" for="appearance2">Left corner</label>
522
- </div>
523
- <div class="cnb-radio-item">
524
- <input type="radio" id="appearance3" name="button[options][placement]"
525
- value="BOTTOM_CENTER" <?php checked( 'BOTTOM_CENTER', $button->options->placement ); ?>>
526
- <label title="bottom-center" for="appearance3">Center</label>
527
- </div>
528
-
529
- <!-- Extra placement options -->
530
- <br class="cnb-extra-placement">
531
- <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'MIDDLE_RIGHT' ? 'cnb-extra-active' : ''; ?>">
532
- <input type="radio" id="appearance5" name="button[options][placement]"
533
- value="MIDDLE_RIGHT" <?php checked( 'MIDDLE_RIGHT', $button->options->placement ); ?>>
534
- <label title="middle-right" for="appearance5">Middle right</label>
535
- </div>
536
- <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'MIDDLE_LEFT' ? 'cnb-extra-active' : ''; ?>">
537
- <input type="radio" id="appearance6" name="button[options][placement]"
538
- value="MIDDLE_LEFT" <?php checked( 'MIDDLE_LEFT', $button->options->placement ); ?>>
539
- <label title="middle-left" for="appearance6">Middle left </label>
540
- </div>
541
- <br class="cnb-extra-placement">
542
- <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'TOP_RIGHT' ? 'cnb-extra-active' : ''; ?>">
543
- <input type="radio" id="appearance7" name="button[options][placement]"
544
- value="TOP_RIGHT" <?php checked( 'TOP_RIGHT', $button->options->placement ); ?>>
545
- <label title="top-right" for="appearance7">Top right corner</label>
546
- </div>
547
- <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'TOP_LEFT' ? 'cnb-extra-active' : ''; ?>">
548
- <input type="radio" id="appearance8" name="button[options][placement]"
549
- value="TOP_LEFT" <?php checked( 'TOP_LEFT', $button->options->placement ); ?>>
550
- <label title="top-left" for="appearance8">Top left corner</label>
551
- </div>
552
- <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'TOP_CENTER' ? 'cnb-extra-active' : ''; ?>">
553
- <input type="radio" id="appearance9" name="button[options][placement]"
554
- value="TOP_CENTER" <?php checked( 'TOP_CENTER', $button->options->placement ); ?>>
555
- <label title="top-center" for="appearance9">Center top</label>
556
- </div>
557
- <a href="#" id="button-more-placements">More placement options...</a>
558
- <!-- END extra placement options -->
559
- <?php } ?>
560
- </div>
561
- </td>
562
- </tr>
563
- <?php if ( $button->type !== 'FULL' ) { ?>
564
- <tr>
565
- <th scope="row"><label for="button_options_animation">Button animation <a
566
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/button-animations/', 'question-mark', 'button-animation' ) ) ?>"
567
- target="_blank" class="cnb-nounderscore">
568
- <span class="dashicons dashicons-editor-help"></span>
569
- </a></label></th>
570
- <td>
571
- <select name="button[options][animation]" id="button_options_animation">
572
- <?php foreach ( CnbButtonOptions::getAnimationTypes() as $animation_type_key => $animation_type_value ) { ?>
573
- <option value="<?php echo esc_attr( $animation_type_key ) ?>"<?php selected( $animation_type_key, $button->options->animation ) ?>><?php echo esc_html( $animation_type_value ) ?></option>
574
- <?php } ?>
575
- </select>
576
- </td>
577
- </tr>
578
- <?php } ?>
579
- </table>
580
- <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'visibility' ) ) ?>"
581
- data-tab-name="visibility">
582
- <tbody id="cnb_form_table_visibility">
583
- <tr>
584
- <th></th>
585
- <td></td>
586
- </tr>
587
- <tr>
588
- <th scope="row"><label for="button_options_displaymode">Display on </label></th>
589
- <td class="appearance">
590
- <select name="button[options][displayMode]" id="button_options_displaymode">
591
- <option value="MOBILE_ONLY"<?php selected( 'MOBILE_ONLY', $button->options->displayMode ) ?>>
592
- Mobile only
593
- </option>
594
- <option value="DESKTOP_ONLY"<?php selected( 'DESKTOP_ONLY', $button->options->displayMode ) ?>>
595
- Desktop only
596
- </option>
597
- <option value="ALWAYS"<?php selected( 'ALWAYS', $button->options->displayMode ) ?>>All
598
- screens
599
- </option>
600
- </select>
601
- </td>
602
- </tr>
603
- <?php $this->render_scroll_options($button); ?>
604
- <tr class="cnb_hide_on_modal">
605
- <th class="cnb_padding_0">
606
- <h2>Display rules</h2>
607
- </th>
608
- <td>
609
- <?php echo '<a href="' . esc_url( $new_condition_link ) . '" class="button">Add display rule</a>'; ?>
610
- </td>
611
- </tr>
612
- </tbody>
613
- </table>
614
-
615
- <!-- This div exists to allow rendering the Conditions' table outside the existing table -->
616
- <div data-tab-name="visibility" class="cnb-button-edit-conditions-table <?php if ( $hide_on_modal ) {
617
- echo esc_attr( $adminFunctions->is_active_tab( 'visibility' ) );
618
- } else {
619
- echo 'nav-tab-only';
620
- } ?>" <?php if ( ! $adminFunctions->is_active_tab( 'visibility' ) ) {
621
- echo 'style="display:none"';
622
- } ?>>
623
- <?php
624
- $view = new CnbConditionView();
625
- $view->renderTable( $button );
626
- ?>
627
- </div>
628
 
629
  <?php submit_button( $submit_button_text ); ?>
630
  <div class="cnb_advanced_view">
@@ -639,15 +125,15 @@ class CnbButtonViewEdit {
639
  global $wp_locale;
640
  $cnb_options = get_option( 'cnb' );
641
 
642
- $button_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_STRING );
643
  $button = new CnbButton();
 
644
 
645
  // Get the various supported domains
646
  $domain = CnbAppRemote::cnb_remote_get_wp_domain();
647
 
648
- if ( strlen( $button_id ) > 0 && $button_id !== 'new' ) {
649
- $button = CnbAppRemote::cnb_remote_get_button_full( $button_id );
650
- } elseif ( $button_id === 'new' ) {
651
  $button->type = strtoupper( filter_input( INPUT_GET, 'type', FILTER_SANITIZE_STRING ) );
652
  $button->domain = $domain;
653
  }
@@ -691,7 +177,7 @@ class CnbButtonViewEdit {
691
  <a href="<?php echo esc_url( $this->get_tab_url( $button, 'basic_options' ) ) ?>"
692
  class="nav-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) ) ?>"
693
  data-tab-name="basic_options">Basics</a>
694
- <?php if ( $button_id !== 'new' ) { ?>
695
  <a href="<?php echo esc_url( $this->get_tab_url( $button, 'extra_options' ) ) ?>"
696
  class="nav-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>"
697
  data-tab-name="extra_options">Presentation</a>
@@ -707,7 +193,7 @@ class CnbButtonViewEdit {
707
  <a class="nav-tab"><i>Additional options available after saving</i></a>
708
  <?php } ?>
709
  </h2>
710
- <?php $this->render_form( $button_id, $button, $domain, $options ); ?>
711
  </div> <!-- /cnb-body-content -->
712
  </div> <!-- /cnb-body-column -->
713
  <div class="cnb-side-column">
@@ -762,64 +248,4 @@ class CnbButtonViewEdit {
762
  <?php
763
  do_action( 'cnb_footer' );
764
  }
765
-
766
- /**
767
- * @param $button CnbButton
768
- *
769
- * @return void
770
- */
771
- private function render_scroll_options($button) {
772
- global $cnb_domain;
773
- $isPro = $cnb_domain != null && !is_wp_error($cnb_domain) && $cnb_domain->type === 'PRO';
774
- ?>
775
- <tr class="cnb_hide_on_modal">
776
- <?php $reveal_at_height = $button->options->scroll ? $button->options->scroll->revealAtHeight : 0 ?>
777
- <th><label for="cnb-button-options-scroll-revealatheight">Reveal after scrolling</label></th>
778
- <td>
779
- <input
780
- name="button[options][scroll][revealAtHeight]"
781
- id="cnb-button-options-scroll-revealatheight"
782
- type="number"
783
- min="0"
784
- <?php if (!$isPro) { ?>disabled="disabled"<?php } ?>
785
- style="width: 80px"
786
- value="<?php echo esc_attr($reveal_at_height) ?>"> pixels from the top
787
- <?php if (!$isPro) {
788
- $upgrade_link =
789
- add_query_arg( array(
790
- 'page' => 'call-now-button-domains',
791
- 'action' => 'upgrade',
792
- 'id' => $cnb_domain->id
793
- ),
794
- admin_url( 'admin.php' ) );
795
- ?>
796
- <p class="description">
797
- Reveal after scrolling is a <span class="cnb-pro-badge">Pro</span> feature.
798
- <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.</p>
799
- <?php } ?>
800
- </td>
801
- </tr>
802
- <tr class="cnb_hide_on_modal cnb_advanced_view">
803
- <?php $hide_at_height = $button->options->scroll ? $button->options->scroll->hideAtHeight : 0 ?>
804
- <th><label for="cnb-button-options-scroll-hideAtHeight">Hide after scrolling</label></th>
805
- <td>
806
- <input name="button[options][scroll][hideAtHeight]" id="cnb-button-options-scroll-hideAtHeight" type="number" min="0" style="width: 80px" value="<?php echo esc_attr($hide_at_height) ?>"> pixels from the top
807
- <p class="description">hideAtHeight</p>
808
- </td>
809
- </tr>
810
- <tr class="cnb_hide_on_modal cnb_advanced_view">
811
- <?php $never_hide = $button->options->scroll ? $button->options->scroll->neverHide : false ?>
812
- <th><label for="cnb-button-options-scroll-neverhide">Never hide</label></th>
813
- <td>
814
- <input type="hidden" name="button[options][scroll][neverHide]" value="0"/>
815
- <input id="cnb-button-options-scroll-neverhide" class="cnb_toggle_checkbox" type="checkbox" name="button[options][scroll][neverHide]"
816
- value="1" <?php checked( true, $never_hide ); ?> />
817
- <label for="cnb-button-options-scroll-neverhide" class="cnb_toggle_label">Toggle</label>
818
- <span data-cnb_toggle_state_label="cnb-button-options-scroll-neverhide" class="cnb_toggle_state cnb_toggle_false">(Inactive)</span>
819
- <span data-cnb_toggle_state_label="cnb-button-options-scroll-neverhide" class="cnb_toggle_state cnb_toggle_true">Active</span>
820
- <p class="description">Once this Button is revealed, it will not be hidden again.</p>
821
- </td>
822
- </tr>
823
- <?php
824
- }
825
  }
5
  // don't load directly
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
 
 
 
 
8
  use cnb\admin\api\CnbAppRemote;
 
9
  use cnb\admin\domain\CnbDomain;
10
  use cnb\utils\CnbAdminFunctions;
 
11
  use stdClass;
12
  use WP_Error;
13
 
54
  *
55
  * This renders JUST the form (no tabs, preview phone, etc.) and is also used in button-overview for the "Add new" modal.
56
  *
 
57
  * @param $button CnbButton
58
  * @param $default_domain CnbDomain|WP_Error
59
  * @param $options array (modal_view (boolean), submit_button_text (string), advanced_view (boolean)
60
  *
61
  * @return void
62
  */
63
+ public function render_form( $button, $default_domain, $options = array() ) {
64
  $adminFunctions = new CnbAdminFunctions();
65
+ $button_edit_table = new Button_Edit_Table();
 
 
 
 
 
66
 
67
  $submit_button_text = array_key_exists( 'submit_button_text', $options ) ? $options['submit_button_text'] : '';
68
  $hide_on_modal = array_key_exists( 'modal_view', $options ) && $options['modal_view'] === true;
70
  echo '<script type="text/javascript">cnb_hide_on_modal_set=1</script>';
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  // In case the API isn't working properly
74
  if ( $default_domain instanceof WP_Error ) {
75
  $default_domain = new CnbDomain();
95
  action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post">
96
  <input type="hidden" name="page" value="call-now-button"/>
97
  <input type="hidden" name="action"
98
+ value="<?php echo $button->id === 'new' ? 'cnb_create_' . esc_attr( strtolower( $button->type ) ) . '_button' : 'cnb_update_' . esc_attr( strtolower( $button->type ) ) . '_button' ?>"/>
99
  <input type="hidden" name="_wpnonce_button"
100
  value="<?php echo esc_attr( wp_create_nonce( 'cnb-button-edit' ) ) ?>"/>
101
  <input type="hidden" name="tab" value="<?php echo esc_attr( $adminFunctions->get_active_tab_name() ) ?>"/>
105
  <input type="hidden" name="button[active]" value="<?php echo esc_attr( $button->active ) ?>"/>
106
  <input type="hidden" name="button[domain]" value="<?php echo esc_attr( $default_domain->id ) ?>"/>
107
 
108
+ <?php
109
+ $button_edit_table->render_tab_basic_options($button, $hide_on_modal, $default_domain);
110
+ $button_edit_table->render_tab_extra_options($button);
111
+ $button_edit_table->render_tab_visibility($button);
112
+ $button_edit_table->render_tab_visibility_condition_table($button, $hide_on_modal);
113
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
  <?php submit_button( $submit_button_text ); ?>
116
  <div class="cnb_advanced_view">
125
  global $wp_locale;
126
  $cnb_options = get_option( 'cnb' );
127
 
 
128
  $button = new CnbButton();
129
+ $button->id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_STRING );
130
 
131
  // Get the various supported domains
132
  $domain = CnbAppRemote::cnb_remote_get_wp_domain();
133
 
134
+ if ( strlen( $button->id ) > 0 && $button->id !== 'new' ) {
135
+ $button = CnbAppRemote::cnb_remote_get_button_full( $button->id );
136
+ } elseif ( $button->id === 'new' ) {
137
  $button->type = strtoupper( filter_input( INPUT_GET, 'type', FILTER_SANITIZE_STRING ) );
138
  $button->domain = $domain;
139
  }
177
  <a href="<?php echo esc_url( $this->get_tab_url( $button, 'basic_options' ) ) ?>"
178
  class="nav-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) ) ?>"
179
  data-tab-name="basic_options">Basics</a>
180
+ <?php if ( $button->id !== 'new' ) { ?>
181
  <a href="<?php echo esc_url( $this->get_tab_url( $button, 'extra_options' ) ) ?>"
182
  class="nav-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>"
183
  data-tab-name="extra_options">Presentation</a>
193
  <a class="nav-tab"><i>Additional options available after saving</i></a>
194
  <?php } ?>
195
  </h2>
196
+ <?php $this->render_form( $button, $domain, $options ); ?>
197
  </div> <!-- /cnb-body-content -->
198
  </div> <!-- /cnb-body-column -->
199
  <div class="cnb-side-column">
248
  <?php
249
  do_action( 'cnb_footer' );
250
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
src/admin/button/partials/class-button-edit-table.php ADDED
@@ -0,0 +1,709 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @noinspection SpellCheckingInspection */
3
+
4
+ namespace cnb\admin\button;
5
+
6
+ // don't load directly
7
+ defined( 'ABSPATH' ) || die( '-1' );
8
+
9
+ use cnb\admin\action\CnbAction;
10
+ use cnb\admin\action\CnbActionProperties;
11
+ use cnb\admin\action\CnbActionView;
12
+ use cnb\admin\action\CnbActionViewEdit;
13
+ use cnb\admin\api\CnbAppRemote;
14
+ use cnb\admin\condition\CnbConditionView;
15
+ use cnb\admin\domain\CnbDomain;
16
+ use cnb\utils\CnbAdminFunctions;
17
+ use cnb\utils\CnbUtils;
18
+
19
+ class Button_Edit_Table {
20
+
21
+ /**
22
+ * @param CnbButton $button
23
+ * @param boolean $hide_on_modal
24
+ * @param CnbDomain $default_domain
25
+ *
26
+ * @return void
27
+ */
28
+ function render_tab_basic_options( $button, $hide_on_modal, $default_domain ) {
29
+ $adminFunctions = new CnbAdminFunctions();
30
+ $domains = CnbAppRemote::cnb_remote_get_domains();
31
+
32
+ $cnb_single_image_url = plugins_url( '../../../../resources/images/button-new-single.png', __FILE__ );
33
+ $cnb_multi_image_url = plugins_url( '../../../../resources/images/button-new-multi.png', __FILE__ );
34
+ $cnb_full_image_url = plugins_url( '../../../../resources/images/button-new-full.png', __FILE__ );
35
+
36
+ $url = admin_url( 'admin.php' );
37
+ $new_action_link =
38
+ add_query_arg(
39
+ array(
40
+ 'page' => 'call-now-button-actions',
41
+ 'action' => 'new',
42
+ 'id' => 'new',
43
+ 'tab' => 'basic_options',
44
+ 'bid' => $button->id
45
+ ),
46
+ $url );
47
+
48
+ $upgrade_link =
49
+ add_query_arg( array(
50
+ 'page' => 'call-now-button-domains',
51
+ 'action' => 'upgrade',
52
+ 'id' => $default_domain->id
53
+ ),
54
+ $url );
55
+
56
+ $action = $this->get_action( $button );
57
+
58
+ ?>
59
+ <table class="form-table <?php if ( ! $hide_on_modal ) {
60
+ echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) );
61
+ } else {
62
+ echo 'nav-tab-only';
63
+ } ?>" data-tab-name="basic_options">
64
+ <tr class="cnb_hide_on_modal">
65
+ <th></th>
66
+ <td></td>
67
+ </tr>
68
+ <tr class="cnb_hide_on_modal">
69
+ <th scope="row"><label for="cnb-enable">Button status</label></th>
70
+
71
+ <td class="activated">
72
+ <input type="hidden" name="button[active]" value="0"/>
73
+ <input id="cnb-enable" class="cnb_toggle_checkbox" type="checkbox" name="button[active]"
74
+ value="1" <?php checked( true, $button->active ); ?> />
75
+ <label for="cnb-enable" class="cnb_toggle_label">Toggle</label>
76
+ <span data-cnb_toggle_state_label="cnb-enable"
77
+ class="cnb_toggle_state cnb_toggle_false">(Inactive)</span>
78
+ <span data-cnb_toggle_state_label="cnb-enable"
79
+ class="cnb_toggle_state cnb_toggle_true">Active</span>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <th scope="row"><label for="button_name">Button name</label></th>
84
+
85
+ <td class="activated">
86
+ <input type="text" name="button[name]" id="button_name" required="required"
87
+ value="<?php echo esc_attr( $button->name ); ?>"/>
88
+ </td>
89
+ </tr>
90
+ <tr class="cnb_hide_on_modal cnb_advanced_view">
91
+ <th scope="row"><label for="button_domain">Domain</label></th>
92
+ <td>
93
+ <select name="button[domain]" id="button_domain">
94
+ <?php
95
+ foreach ( $domains as $domain ) { ?>
96
+ <option
97
+ <?php selected( $domain->id, $button->domain->id ) ?>
98
+ value="<?php echo esc_attr( $domain->id ) ?>">
99
+ <?php echo esc_html( $domain->name ) ?>
100
+ <?php if ( $domain->id == $default_domain->id ) {
101
+ echo ' (current WordPress domain)';
102
+ } ?>
103
+ </option>
104
+ <?php } ?>
105
+ </select>
106
+ </td>
107
+ </tr>
108
+ <?php if ( $button->type !== 'SINGLE' ) { ?>
109
+ <tr class="cnb_hide_on_modal">
110
+ <th colspan="2" class="cnb_padding_0">
111
+ <h2>
112
+ Actions
113
+ <?php
114
+ if ($default_domain->type === 'STARTER' && $button->type === 'FULL' && count($button->actions)) {
115
+ echo '<a href="#" class="page-title-action" style="color: #1d232780; pointer-events: none;cursor: default;" >Add Action</a>';
116
+ } else {
117
+ echo '<a href="' . esc_url( $new_action_link ) . '" class="page-title-action">Add Action</a>';
118
+ }
119
+ ?>
120
+ </h2>
121
+ <?php
122
+ if ($default_domain->type === 'STARTER' && $button->type === 'FULL' && count($button->actions)) {
123
+ echo '<p class="description" style="font-weight:400;">
124
+ Add up to 5 actions to a single Buttonbar with <span class="cnb-pro-badge">Pro</span>. <a href="' . esc_url( $upgrade_link ) . '">Upgrade</a>
125
+ </p>';
126
+ }
127
+ ?>
128
+ </th>
129
+ </tr>
130
+ <?php }
131
+
132
+ if ( $button->type === 'SINGLE' ) {
133
+ // Start workaround: This table below (<tr>...</tr>) needs to be there for the modal to work!
134
+ if ( $hide_on_modal ) { ?>
135
+ <tr class="cnb_hide_on_modal">
136
+ <th></th>
137
+ <td>
138
+ <input type="hidden" name="actions[<?php echo esc_attr( $action->id ) ?>][id]"
139
+ value="<?php echo esc_attr( $action->id ) ?>"/>
140
+ <?php }
141
+ ( new CnbActionViewEdit() )->render_main( $action, $button, $default_domain );
142
+ if ( $hide_on_modal ) { ?>
143
+ </td>
144
+ </tr>
145
+ <?php } // End workaround
146
+ }
147
+
148
+ if ( $button->type !== 'SINGLE' ) { ?>
149
+ </table>
150
+
151
+ <!-- This div exists to allow rendering the Action table outside the existing table -->
152
+ <div data-tab-name="basic_options" class="cnb-button-edit-action-table <?php if ( $hide_on_modal ) {
153
+ echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) );
154
+ } else {
155
+ echo 'nav-tab-only';
156
+ } ?>" <?php if ( ! $adminFunctions->is_active_tab( 'basic_options' ) ) {
157
+ echo 'style="display:none"';
158
+ } ?>>
159
+ <?php ( new CnbActionView() )->renderTable( $button ); ?>
160
+ </div>
161
+
162
+ <table class="form-table <?php if ( ! $hide_on_modal ) {
163
+ echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) );
164
+ } else {
165
+ echo 'nav-tab-only';
166
+ } ?>"><?php
167
+ } ?>
168
+ <script>
169
+ let cnb_actions = <?php echo wp_json_encode( $button->actions ) ?>;
170
+ let cnb_domain = <?php echo wp_json_encode( $button->domain ) ?>;
171
+ </script>
172
+
173
+ <?php if ( $button->id === 'new' ) { ?>
174
+ <tr>
175
+ <th scope="row">Select button type</th>
176
+ </tr>
177
+ <tr>
178
+ <td colspan="2">
179
+ <div class="cnb-flexbox cnb_type_selector cnb_type_selector_container">
180
+ <div class="cnb_type_selector cnb_type_selector_item cnb_type_selector_single cnb_type_selector_active"
181
+ data-cnb-selection="single">
182
+ <img style="max-width:100%;" alt="Select the Single button"
183
+ src="<?php echo esc_url( $cnb_single_image_url ) ?>">
184
+ <div style="text-align:center">Single button</div>
185
+ </div>
186
+ <div class="cnb_type_selector <?php if ( $default_domain->type !== 'STARTER' ) { ?>cnb_type_selector_item<?php } else { ?>cnb_type_only_pro<?php } ?> cnb_type_selector_multi"
187
+ data-cnb-selection="multi">
188
+ <img style="max-width:100%;" alt="Select the Multibutton"
189
+ src="<?php echo esc_url( $cnb_multi_image_url ) ?>">
190
+ <div style="text-align:center">
191
+ Multibutton
192
+ <?php if ( $default_domain->type === 'STARTER' ) { ?><span
193
+ class="cnb-pro-badge">Pro</span><?php } ?>
194
+ </div>
195
+ </div>
196
+ <?php if ( $default_domain->type === 'STARTER' ) { ?>
197
+ <div class="cnb-pro-overlay">
198
+ <p class="description">
199
+ Multibutton is a <span class="cnb-pro-badge">Pro</span> feature.
200
+ <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a> here.
201
+ </p>
202
+ </div>
203
+ <?php } ?>
204
+ <div class="cnb_type_selector cnb_type_selector_item cnb_type_selector_full"
205
+ data-cnb-selection="full">
206
+ <img style="max-width:100%;" alt="Select the Buttonbar"
207
+ src="<?php echo esc_url( $cnb_full_image_url ) ?>">
208
+ <div style="text-align:center">
209
+ Buttonbar
210
+ </div>
211
+ </div>
212
+ </div>
213
+ </td>
214
+ </tr>
215
+ <?php } ?>
216
+ </table>
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * "extra_options" == "Presentation"
222
+ *
223
+ * @param $button CnbButton
224
+ *
225
+ * @return void
226
+ */
227
+ function render_tab_extra_options( $button ) {
228
+ $adminFunctions = new CnbAdminFunctions();
229
+ $cnb_utils = new CnbUtils();
230
+ $action = $this->get_action( $button );
231
+
232
+ $upgrade_link =
233
+ add_query_arg( array(
234
+ 'page' => 'call-now-button-domains',
235
+ 'action' => 'upgrade',
236
+ 'id' => $button->domain->id
237
+ ),
238
+ admin_url( 'admin.php' ) );
239
+
240
+ ?>
241
+ <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>"
242
+ data-tab-name="extra_options">
243
+ <?php if ( $button->type === 'FULL' ) { ?>
244
+ <tr class="cnb_hide_on_modal">
245
+ <th></th>
246
+ <td></td>
247
+ </tr>
248
+ <tr class="cnb_advanced_view">
249
+ <th colspan="2">
250
+ <h3>Colors for the Buttonbar are defined via the individual Action(s).</h3>
251
+ <input name="button[options][iconBackgroundColor]" type="hidden"
252
+ value="<?php echo esc_attr( $button->options->iconBackgroundColor ); ?>"/>
253
+ <input name="button[options][iconColor]" type="hidden"
254
+ value="<?php echo esc_attr( $button->options->iconColor ); ?>"/>
255
+ </th>
256
+ </tr>
257
+ <?php } else if ( $button->type === 'SINGLE' ) {
258
+ // Migration note:
259
+ //- we move from button.options.iconBackgroundColor to action.backgroundColor
260
+ //- we move from button.options.iconColor to action.iconColor
261
+ // So for now, "button" take priority, but once the new value is saved, we blank the button options
262
+ $backgroundColor = ( $button && $button->options && $button->options->iconBackgroundColor ) ? $button->options->iconBackgroundColor : ( $action->backgroundColor ?: '#009900' );
263
+ $iconColor = ( $button && $button->options && $button->options->iconColor ) ? $button->options->iconColor : ( $action->iconColor ?: '#FFFFFF' );
264
+ ?>
265
+ <tr class="cnb_hide_on_modal">
266
+ <th></th>
267
+ <td>
268
+ <input name="button[options][iconBackgroundColor]" type="hidden" value=""/>
269
+ <input name="button[options][iconColor]" type="hidden" value=""/>
270
+ <!-- We always enable the icon when the type if SINGLE, original value is "<?php echo esc_attr( $action->iconEnabled ) ?>" -->
271
+ <input name="actions[<?php echo esc_attr( $action->id ) ?>][iconEnabled]" type="hidden"
272
+ value="1"/>
273
+ </td>
274
+ </tr>
275
+ <tr>
276
+ <th scope="row"><label for="actions-options-iconBackgroundColor">Button color</label></th>
277
+ <td>
278
+ <input name="actions[<?php echo esc_attr( $action->id ) ?>][backgroundColor]"
279
+ id="actions-options-iconBackgroundColor" type="text"
280
+ value="<?php echo esc_attr( $backgroundColor ); ?>" class="cnb-iconcolor-field"
281
+ data-default-color="#009900"/>
282
+ </td>
283
+ </tr>
284
+ <tr>
285
+ <th scope="row"><label for="actions-options-iconColor">Icon color</label></th>
286
+ <td>
287
+ <input name="actions[<?php echo esc_attr( $action->id ) ?>][iconColor]"
288
+ id="actions-options-iconColor" type="text"
289
+ value="<?php echo esc_attr( $iconColor ); ?>" class="cnb-iconcolor-field"
290
+ data-default-color="#FFFFFF"/>
291
+ </td>
292
+ </tr>
293
+
294
+ <?php } else if ( $button->type === 'MULTI' ) {
295
+ $backgroundColor = ( $button->options && $button->options->iconBackgroundColor ) ? $button->options->iconBackgroundColor :
296
+ ( $button->multiButtonOptions ? $button->multiButtonOptions->iconBackgroundColor : '#009900' );
297
+ $iconColor = ( $button->options && $button->options->iconColor ) ? $button->options->iconColor :
298
+ ( $button->multiButtonOptions ? $button->multiButtonOptions->iconColor : '#FFFFFF' );
299
+ $multi_button_id = ( $button->multiButtonOptions && $button->multiButtonOptions->id ) ? $button->multiButtonOptions->id : '';
300
+ $iconTextOpen = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTextOpen ) ? $button->multiButtonOptions->iconTextOpen : 'more_vert';
301
+ $iconTypeOpen = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeOpen ) ? $button->multiButtonOptions->iconTypeOpen : 'FONT';
302
+ $iconTextClose = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTextClose ) ? $button->multiButtonOptions->iconTextClose : 'close';
303
+ $iconTypeClose = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeClose ) ? $button->multiButtonOptions->iconTypeClose : 'FONT';
304
+ $labelText = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeClose ) ? $button->multiButtonOptions->labelText : null;
305
+ $labelBackgroundColor = ( $button->multiButtonOptions && $button->multiButtonOptions->iconTypeClose ) ? $button->multiButtonOptions->labelBackgroundColor : null;
306
+ ?>
307
+ <tr class="cnb_hide_on_modal">
308
+ <th></th>
309
+ <td></td>
310
+ </tr>
311
+ <tr>
312
+ <th scope="row"><label for="button-multiButtonOptions-iconBackgroundColor">Main button
313
+ color</label></th>
314
+ <td>
315
+ <input name="button[multiButtonOptions][id]" type="hidden"
316
+ value="<?php echo esc_attr( $multi_button_id ); ?>"/>
317
+ <input name="button[multiButtonOptions][iconBackgroundColor]"
318
+ id="button-multiButtonOptions-iconBackgroundColor" type="text"
319
+ value="<?php echo esc_attr( $backgroundColor ); ?>"
320
+ class="cnb-iconcolor-field" data-default-color="#009900"/>
321
+ </td>
322
+ </tr>
323
+ <tr>
324
+ <th scope="row"><label for="button-multiButtonOptions-iconColor">Main icon color</label></th>
325
+ <td>
326
+ <input name="button[multiButtonOptions][iconColor]" id="button-multiButtonOptions-iconColor"
327
+ type="text" value="<?php echo esc_attr( $iconColor ); ?>"
328
+ class="cnb-iconcolor-field" data-default-color="#FFFFFF"/>
329
+ </td>
330
+ </tr>
331
+ <tr>
332
+ <th scope="row"><label for="button-multiButtonOptions-iconTextOpen">Main icon</label></th>
333
+ <td>
334
+ <div class="icon-text-options" id="icon-text-open"
335
+ data-icon-text-target="button-multiButtonOptions-iconTextOpen"
336
+ data-icon-type-target="button-multiButtonOptions-iconTypeOpen">
337
+ <div class="cnb-button-icon">
338
+ <i class="cnb-font-icon" data-icon-type="FONT"
339
+ data-icon-text="more_vert">more_vert</i>
340
+ </div>
341
+ <div class="cnb-button-icon">
342
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="menu">menu</i>
343
+ </div>
344
+ <div class="cnb-button-icon">
345
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="support">support</i>
346
+ </div>
347
+ <div class="cnb-button-icon">
348
+ <i class="cnb-font-icon" data-icon-type="FONT"
349
+ data-icon-text="communicate">communicate</i>
350
+ </div>
351
+ <div class="cnb-button-icon">
352
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="more_info">more_info</i>
353
+ </div>
354
+ <div class="cnb-button-icon">
355
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="conversation">conversation</i>
356
+ </div>
357
+ <div class="cnb-button-icon">
358
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call3">call3</i>
359
+ </div>
360
+ <div class="cnb-button-icon">
361
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="whatsapp">whatsapp</i>
362
+ </div>
363
+ <div class="cnb-button-icon">
364
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="email">email</i>
365
+ </div>
366
+ <div class="cnb-button-icon">
367
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call">call</i>
368
+ </div>
369
+ <div class="cnb-button-icon">
370
+ <i class="cnb-font-icon" data-icon-type="FONT"
371
+ data-icon-text="directions3">directions3</i>
372
+ </div>
373
+ </div>
374
+ <div class="cnb_advanced_view">
375
+ <a
376
+ href="#"
377
+ onclick="return cnb_show_icon_text_advanced(this)"
378
+ data-icon-text="button-multiButtonOptions-iconTextOpen"
379
+ data-icon-type="button-multiButtonOptions-iconTypeOpen"
380
+ data-description="button-multiButtonOptions-iconTextOpen-description"
381
+ class="cnb_advanced_view">Use a custom icon</a>
382
+ <input name="button[multiButtonOptions][iconTextOpen]"
383
+ id="button-multiButtonOptions-iconTextOpen" type="hidden"
384
+ value="<?php echo esc_attr( $iconTextOpen ); ?>"/>
385
+ <input name="button[multiButtonOptions][iconTypeOpen]"
386
+ id="button-multiButtonOptions-iconTypeOpen" type="hidden"
387
+ value="<?php echo esc_attr( $iconTypeOpen ); ?>"/>
388
+ <p class="description" id="button-multiButtonOptions-iconTextOpen-description"
389
+ style="display: none">
390
+ You can enter a custom Material Design font code here. Search the full library at <a
391
+ href="https://fonts.google.com/icons" target="_blank">Google Fonts</a>.<br/>
392
+ The Call Now Button uses the <code>filled</code> version of icons.</p>
393
+ </div>
394
+ </td>
395
+ </tr>
396
+ <tr class="cnb_advanced_view">
397
+ <th scope="row"><label for="button-multiButtonOptions-iconTextClose">Close Icon</label></th>
398
+ <td>
399
+ <div class="icon-text-options" id="icon-text-close"
400
+ data-icon-text-target="button-multiButtonOptions-iconTextClose"
401
+ data-icon-type-target="button-multiButtonOptions-iconTypeClose">
402
+ <div class="cnb-button-icon">
403
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="close">close</i>
404
+ </div>
405
+ <div class="cnb-button-icon">
406
+ <i class="cnb-font-icon family-material" data-icon-type="FONT_MATERIAL"
407
+ data-icon-text="cancel">cancel</i>
408
+ </div>
409
+ <div class="cnb-button-icon">
410
+ <i class="cnb-font-icon family-material" data-icon-type="FONT_MATERIAL"
411
+ data-icon-text="close">close</i>
412
+ </div>
413
+ <div class="cnb-button-icon">
414
+ <i class="cnb-font-icon family-material" data-icon-type="FONT_MATERIAL"
415
+ data-icon-text="zoom_in_map">zoom_in_map</i>
416
+ </div>
417
+ </div>
418
+ <a
419
+ href="#"
420
+ onclick="return cnb_show_icon_text_advanced(this)"
421
+ data-icon-text="button-multiButtonOptions-iconTextClose"
422
+ data-icon-type="button-multiButtonOptions-iconTypeClose"
423
+ data-description="button-multiButtonOptions-iconTextClose-description"
424
+ class="cnb_advanced_view">Use a custom icon</a>
425
+ <input name="button[multiButtonOptions][iconTextClose]"
426
+ id="button-multiButtonOptions-iconTextClose" type="hidden"
427
+ value="<?php echo esc_attr( $iconTextClose ); ?>"/>
428
+ <input name="button[multiButtonOptions][iconTypeClose]"
429
+ id="button-multiButtonOptions-iconTypeClose" type="hidden"
430
+ value="<?php echo esc_attr( $iconTypeClose ); ?>"/>
431
+ <p class="description" id="button-multiButtonOptions-iconTextClose-description"
432
+ style="display: none">
433
+ You can enter a custom Material Design font code here. Search the full library at <a
434
+ href="https://fonts.google.com/icons" target="_blank">Google Fonts</a>.<br/>
435
+ The Call Now Button uses the <code>filled</code> version of icons.</p>
436
+ </td>
437
+ </tr>
438
+ <tr class="cnb_advanced_view">
439
+ <th scope="row"><label for="button-multiButtonOptions-labelText">Label text (when open)</label>
440
+ </th>
441
+ <td>
442
+ <input name="button[multiButtonOptions][labelText]" id="button-multiButtonOptions-labelText"
443
+ type="text" value="<?php echo esc_attr( $labelText ); ?>"/>
444
+ </td>
445
+ </tr>
446
+ <tr class="cnb_advanced_view">
447
+ <th scope="row"><label for="button-multiButtonOptions-labelBackgroundColor">Label background
448
+ color</label></th>
449
+ <td>
450
+ <input name="button[multiButtonOptions][labelBackgroundColor]"
451
+ id="button-multiButtonOptions-labelBackgroundColor" type="text"
452
+ value="<?php echo esc_attr( $labelBackgroundColor ); ?>"
453
+ class="cnb-iconcolor-field" data-default-color="#3c434a"/>
454
+ </td>
455
+ </tr>
456
+ <?php } ?>
457
+ <tr>
458
+ <th scope="row">Position <a
459
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/presentation/button-position/', 'question-mark', 'button-position' ) ) ?>"
460
+ target="_blank" class="cnb-nounderscore">
461
+ <span class="dashicons dashicons-editor-help"></span>
462
+ </a></th>
463
+ <td class="appearance">
464
+ <div class="appearance-options">
465
+ <?php if ( $button->type === 'FULL' ) { ?>
466
+ <div class="cnb-radio-item">
467
+ <input type="radio" id="appearance1" name="button[options][placement]"
468
+ value="TOP_CENTER" <?php checked( 'TOP_CENTER', $button->options->placement ); ?>>
469
+ <label title="top-center" for="appearance1">Top</label>
470
+ </div>
471
+ <div class="cnb-radio-item">
472
+ <input type="radio" id="appearance2" name="button[options][placement]"
473
+ value="BOTTOM_CENTER" <?php checked( 'BOTTOM_CENTER', $button->options->placement ); ?>>
474
+ <label title="bottom-center" for="appearance2">Bottom</label>
475
+ </div>
476
+ <?php } else { ?>
477
+ <div class="cnb-radio-item">
478
+ <input type="radio" id="appearance1" name="button[options][placement]"
479
+ value="BOTTOM_RIGHT" <?php checked( 'BOTTOM_RIGHT', $button->options->placement ); ?>>
480
+ <label title="bottom-right" for="appearance1">Right corner</label>
481
+ </div>
482
+ <div class="cnb-radio-item">
483
+ <input type="radio" id="appearance2" name="button[options][placement]"
484
+ value="BOTTOM_LEFT" <?php checked( 'BOTTOM_LEFT', $button->options->placement ); ?>>
485
+ <label title="bottom-left" for="appearance2">Left corner</label>
486
+ </div>
487
+ <div class="cnb-radio-item">
488
+ <input type="radio" id="appearance3" name="button[options][placement]"
489
+ value="BOTTOM_CENTER" <?php checked( 'BOTTOM_CENTER', $button->options->placement ); ?>>
490
+ <label title="bottom-center" for="appearance3">Center</label>
491
+ </div>
492
+
493
+ <!-- Extra placement options -->
494
+ <br class="cnb-extra-placement">
495
+ <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'MIDDLE_RIGHT' ? 'cnb-extra-active' : ''; ?>">
496
+ <input type="radio" id="appearance5" name="button[options][placement]"
497
+ value="MIDDLE_RIGHT" <?php checked( 'MIDDLE_RIGHT', $button->options->placement ); ?>>
498
+ <label title="middle-right" for="appearance5">Middle right</label>
499
+ </div>
500
+ <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'MIDDLE_LEFT' ? 'cnb-extra-active' : ''; ?>">
501
+ <input type="radio" id="appearance6" name="button[options][placement]"
502
+ value="MIDDLE_LEFT" <?php checked( 'MIDDLE_LEFT', $button->options->placement ); ?>>
503
+ <label title="middle-left" for="appearance6">Middle left </label>
504
+ </div>
505
+ <br class="cnb-extra-placement">
506
+ <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'TOP_RIGHT' ? 'cnb-extra-active' : ''; ?>">
507
+ <input type="radio" id="appearance7" name="button[options][placement]"
508
+ value="TOP_RIGHT" <?php checked( 'TOP_RIGHT', $button->options->placement ); ?>>
509
+ <label title="top-right" for="appearance7">Top right corner</label>
510
+ </div>
511
+ <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'TOP_LEFT' ? 'cnb-extra-active' : ''; ?>">
512
+ <input type="radio" id="appearance8" name="button[options][placement]"
513
+ value="TOP_LEFT" <?php checked( 'TOP_LEFT', $button->options->placement ); ?>>
514
+ <label title="top-left" for="appearance8">Top left corner</label>
515
+ </div>
516
+ <div class="cnb-radio-item cnb-extra-placement <?php echo $button->options->placement == 'TOP_CENTER' ? 'cnb-extra-active' : ''; ?>">
517
+ <input type="radio" id="appearance9" name="button[options][placement]"
518
+ value="TOP_CENTER" <?php checked( 'TOP_CENTER', $button->options->placement ); ?>>
519
+ <label title="top-center" for="appearance9">Center top</label>
520
+ </div>
521
+ <a href="#" id="button-more-placements">More placement options...</a>
522
+ <!-- END extra placement options -->
523
+ <?php } ?>
524
+ </div>
525
+ </td>
526
+ </tr>
527
+ <?php if ( $button->type !== 'FULL' ) { ?>
528
+ <tr>
529
+ <th scope="row"><label for="button_options_animation">Button animation <?php if ( $button->domain->type !== 'STARTER' ) { ?><a
530
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/button-animations/', 'question-mark', 'button-animation' ) ) ?>"
531
+ target="_blank" class="cnb-nounderscore">
532
+ <span class="dashicons dashicons-editor-help"></span>
533
+ </a><?php } ?></label>
534
+ <?php if ( $button->domain->type === 'STARTER' ) { ?>
535
+ <a href="<?php echo esc_url( $upgrade_link ) ?>"><span class="cnb-pro-badge">Pro</span></a>
536
+ <?php } ?>
537
+ </th>
538
+ <td>
539
+ <select
540
+ name="button[options][animation]"
541
+ id="button_options_animation"
542
+ <?php if ( $button->domain->type === 'STARTER' ) { ?>disabled="disabled"<?php } ?>
543
+ >
544
+ <?php foreach ( CnbButtonOptions::getAnimationTypes() as $animation_type_key => $animation_type_value ) { ?>
545
+ <option value="<?php echo esc_attr( $animation_type_key ) ?>"<?php selected( $animation_type_key, $button->options->animation ) ?>><?php echo esc_html( $animation_type_value ) ?></option>
546
+ <?php } ?>
547
+ </select>
548
+ </td>
549
+ </tr>
550
+ <?php } ?>
551
+ </table>
552
+ <?php
553
+ }
554
+
555
+ function render_tab_visibility( $button ) {
556
+ $adminFunctions = new CnbAdminFunctions();
557
+
558
+ $url = admin_url( 'admin.php' );
559
+ $new_condition_link =
560
+ add_query_arg(
561
+ array(
562
+ 'page' => 'call-now-button-conditions',
563
+ 'action' => 'new',
564
+ 'id' => 'new',
565
+ 'bid' => $button->id
566
+ ),
567
+ $url );
568
+
569
+ ?>
570
+ <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'visibility' ) ) ?>"
571
+ data-tab-name="visibility">
572
+ <tbody id="cnb_form_table_visibility">
573
+ <tr>
574
+ <th></th>
575
+ <td></td>
576
+ </tr>
577
+ <tr>
578
+ <th scope="row"><label for="button_options_displaymode">Display on </label></th>
579
+ <td class="appearance">
580
+ <select name="button[options][displayMode]" id="button_options_displaymode">
581
+ <option value="MOBILE_ONLY"<?php selected( 'MOBILE_ONLY', $button->options->displayMode ) ?>>
582
+ Mobile only
583
+ </option>
584
+ <option value="DESKTOP_ONLY"<?php selected( 'DESKTOP_ONLY', $button->options->displayMode ) ?>>
585
+ Desktop only
586
+ </option>
587
+ <option value="ALWAYS"<?php selected( 'ALWAYS', $button->options->displayMode ) ?>>All
588
+ screens
589
+ </option>
590
+ </select>
591
+ </td>
592
+ </tr>
593
+ <?php $this->render_scroll_options( $button ); ?>
594
+ <tr class="cnb_hide_on_modal">
595
+ <th class="cnb_padding_0">
596
+ <h2>Display rules</h2>
597
+ </th>
598
+ <td>
599
+ <?php echo '<a href="' . esc_url( $new_condition_link ) . '" class="button">Add display rule</a>'; ?>
600
+ </td>
601
+ </tr>
602
+ </tbody>
603
+ </table>
604
+ <?php
605
+ }
606
+
607
+ function render_tab_visibility_condition_table( $button, $hide_on_modal ) {
608
+ $adminFunctions = new CnbAdminFunctions();
609
+ ?>
610
+ <!-- This div exists to allow rendering the Conditions' table outside the existing table -->
611
+ <div data-tab-name="visibility" class="cnb-button-edit-conditions-table <?php if ( $hide_on_modal ) {
612
+ echo esc_attr( $adminFunctions->is_active_tab( 'visibility' ) );
613
+ } else {
614
+ echo 'nav-tab-only';
615
+ } ?>" <?php if ( ! $adminFunctions->is_active_tab( 'visibility' ) ) {
616
+ echo 'style="display:none"';
617
+ } ?>>
618
+ <?php
619
+ $view = new CnbConditionView();
620
+ $view->renderTable( $button );
621
+ ?>
622
+ </div>
623
+ <?php
624
+ }
625
+
626
+ /**
627
+ * @param $button CnbButton
628
+ *
629
+ * @return void
630
+ */
631
+ private function render_scroll_options( $button ) {
632
+ global $cnb_domain;
633
+ $isPro = $cnb_domain != null && ! is_wp_error( $cnb_domain ) && $cnb_domain->type === 'PRO';
634
+ ?>
635
+ <tr class="cnb_hide_on_modal">
636
+ <?php $reveal_at_height = $button->options->scroll ? $button->options->scroll->revealAtHeight : 0 ?>
637
+ <th><label for="cnb-button-options-scroll-revealatheight">Reveal after scrolling</label>
638
+ <?php if ( ! $isPro ) {
639
+ $upgrade_link =
640
+ add_query_arg( array(
641
+ 'page' => 'call-now-button-domains',
642
+ 'action' => 'upgrade',
643
+ 'id' => $cnb_domain->id
644
+ ),
645
+ admin_url( 'admin.php' ) );
646
+ ?>
647
+ <a href="<?php echo esc_url( $upgrade_link ) ?>"><span class="cnb-pro-badge">Pro</span></a></th>
648
+ <?php } ?>
649
+ <td>
650
+ <input
651
+ name="button[options][scroll][revealAtHeight]"
652
+ id="cnb-button-options-scroll-revealatheight"
653
+ type="number"
654
+ min="0"
655
+ <?php if ( ! $isPro ) { ?>disabled="disabled"<?php } ?>
656
+ style="width: 80px"
657
+ value="<?php echo esc_attr( $reveal_at_height ) ?>"> pixels from the top
658
+ </td>
659
+ </tr>
660
+ <tr class="cnb_hide_on_modal cnb_advanced_view">
661
+ <?php $hide_at_height = $button->options->scroll ? $button->options->scroll->hideAtHeight : 0 ?>
662
+ <th><label for="cnb-button-options-scroll-hideAtHeight">Hide after scrolling</label></th>
663
+ <td>
664
+ <input name="button[options][scroll][hideAtHeight]" id="cnb-button-options-scroll-hideAtHeight"
665
+ type="number" min="0" style="width: 80px" value="<?php echo esc_attr( $hide_at_height ) ?>">
666
+ pixels from the top
667
+ <p class="description">hideAtHeight</p>
668
+ </td>
669
+ </tr>
670
+ <tr class="cnb_hide_on_modal cnb_advanced_view">
671
+ <?php $never_hide = $button->options->scroll ? $button->options->scroll->neverHide : false ?>
672
+ <th><label for="cnb-button-options-scroll-neverhide">Never hide</label></th>
673
+ <td>
674
+ <input type="hidden" name="button[options][scroll][neverHide]" value="0"/>
675
+ <input id="cnb-button-options-scroll-neverhide" class="cnb_toggle_checkbox" type="checkbox"
676
+ name="button[options][scroll][neverHide]"
677
+ value="1" <?php checked( true, $never_hide ); ?> />
678
+ <label for="cnb-button-options-scroll-neverhide" class="cnb_toggle_label">Toggle</label>
679
+ <span data-cnb_toggle_state_label="cnb-button-options-scroll-neverhide"
680
+ class="cnb_toggle_state cnb_toggle_false">(Inactive)</span>
681
+ <span data-cnb_toggle_state_label="cnb-button-options-scroll-neverhide"
682
+ class="cnb_toggle_state cnb_toggle_true">Active</span>
683
+ <p class="description">Once this Button is revealed, it will not be hidden again.</p>
684
+ </td>
685
+ </tr>
686
+ <?php
687
+ }
688
+
689
+ /**
690
+ * @param $button CnbButton
691
+ *
692
+ * @return CnbAction
693
+ */
694
+ private function get_action( $button ) {
695
+ $action = new CnbAction();
696
+ // Create a dummy Action
697
+ $action->id = 'new';
698
+ $action->actionType = '';
699
+ $action->actionValue = '';
700
+ $action->labelText = '';
701
+ $action->properties = new CnbActionProperties();
702
+ // If there is a real one, use that one
703
+ if ( sizeof( $button->actions ) > 0 ) {
704
+ $action = $button->actions[0];
705
+ }
706
+
707
+ return $action;
708
+ }
709
+ }
src/admin/condition/CnbCondition.php CHANGED
@@ -19,7 +19,7 @@ class CnbCondition implements JsonSerializable {
19
  public $conditionType = 'URL';
20
  public $filterType;
21
  /**
22
- * @var string can be one of SIMPLE, EXACT, REGEX, SUBSTRING (for URL).
23
  * or COUNTRY_CODE (for GEO)
24
  */
25
  public $matchType;
19
  public $conditionType = 'URL';
20
  public $filterType;
21
  /**
22
+ * @var string can be one of SIMPLE, EXACT, REGEX, SUBSTRING, PARAMETER (for URL).
23
  * or COUNTRY_CODE (for GEO)
24
  */
25
  public $matchType;
src/admin/condition/CnbConditionViewEdit.php CHANGED
@@ -36,8 +36,16 @@ class CnbConditionViewEdit {
36
  */
37
  function render_table( $condition ) {
38
  global $cnb_domain;
39
- $isPro = $cnb_domain != null && !is_wp_error($cnb_domain) && $cnb_domain->type === 'PRO';
40
  $cnb_utils = new CnbUtils();
 
 
 
 
 
 
 
 
41
  $bid = $cnb_utils->get_query_val( 'bid' );
42
  if ( $bid !== null ) {
43
  // Create back link
@@ -52,10 +60,10 @@ class CnbConditionViewEdit {
52
  ),
53
  $url ) );
54
  ?>
55
- <h2 class="nav-tab-wrapper">
56
- <a href="<?php echo esc_url( $redirect_link ); ?>" class="cnb-nav-tab"><span
57
- class="dashicons dashicons-arrow-left-alt"></span></a>
58
- </h2>
59
  <?php
60
 
61
  }
@@ -93,25 +101,17 @@ class CnbConditionViewEdit {
93
  name="conditions[<?php echo esc_attr( $condition->id ) ?>][conditionType]">
94
  <?php foreach ( ( new CnbAdminFunctions() )->cnb_get_condition_types() as $type_key => $type_key_value ) { ?>
95
  <option
96
- value="<?php echo esc_attr( $type_key ) ?>"
97
  <?php selected( $type_key, $condition->conditionType ) ?>
98
- <?php if ($type_key_value['proOnly'] && !$isPro) { ?>disabled="disabled" <?php } ?>
99
  >
100
  <?php echo esc_html( $type_key_value['name'] ) ?>
101
  </option>
102
  <?php } ?>
103
  </select>
104
- <?php if (!$isPro) {
105
- $upgrade_link =
106
- add_query_arg( array(
107
- 'page' => 'call-now-button-domains',
108
- 'action' => 'upgrade',
109
- 'id' => $cnb_domain->id
110
- ),
111
- admin_url( 'admin.php' ) );
112
- ?>
113
  <p class="description">
114
- Visitor location is a <span class="cnb-pro-badge">Pro</span> display rule.
115
  <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
116
  </p>
117
  <?php } ?>
@@ -124,20 +124,30 @@ class CnbConditionViewEdit {
124
  name="conditions[<?php echo esc_attr( $condition->id ) ?>][matchType]">
125
  <?php
126
  foreach ( ( new CnbAdminFunctions() )->cnb_get_condition_match_types() as $condition_match_type_key => $condition_match_type_value ) { ?>
127
- <option class="conditionType conditionType_URL" value="<?php echo esc_attr( $condition_match_type_key ) ?>"<?php selected( $condition_match_type_key, $condition->matchType ) ?>>
128
- <?php echo esc_html( $condition_match_type_value ) ?>
 
 
 
 
129
  </option>
130
  <?php } ?>
131
 
132
  <?php
133
  foreach ( ( new CnbAdminFunctions() )->cnb_get_condition_match_types_geo() as $condition_match_type_key => $condition_match_type_value ) { ?>
134
- <option class="conditionType conditionType_GEO" value="<?php echo esc_attr( $condition_match_type_key ) ?>"<?php selected( $condition_match_type_key, $condition->matchType ) ?>>
 
135
  <?php echo esc_html( $condition_match_type_value ) ?>
136
  </option>
137
  <?php } ?>
138
-
139
- ?>
140
  </select>
 
 
 
 
 
 
 
141
  </td>
142
  </tr>
143
  <tr>
36
  */
37
  function render_table( $condition ) {
38
  global $cnb_domain;
39
+ $isPro = $cnb_domain != null && ! is_wp_error( $cnb_domain ) && $cnb_domain->type === 'PRO';
40
  $cnb_utils = new CnbUtils();
41
+ $upgrade_link =
42
+ add_query_arg( array(
43
+ 'page' => 'call-now-button-domains',
44
+ 'action' => 'upgrade',
45
+ 'id' => $cnb_domain->id
46
+ ),
47
+ admin_url( 'admin.php' ) );
48
+
49
  $bid = $cnb_utils->get_query_val( 'bid' );
50
  if ( $bid !== null ) {
51
  // Create back link
60
  ),
61
  $url ) );
62
  ?>
63
+ <h2 class="nav-tab-wrapper">
64
+ <a href="<?php echo esc_url( $redirect_link ); ?>" class="cnb-nav-tab"><span
65
+ class="dashicons dashicons-arrow-left-alt"></span></a>
66
+ </h2>
67
  <?php
68
 
69
  }
101
  name="conditions[<?php echo esc_attr( $condition->id ) ?>][conditionType]">
102
  <?php foreach ( ( new CnbAdminFunctions() )->cnb_get_condition_types() as $type_key => $type_key_value ) { ?>
103
  <option
104
+ value="<?php echo esc_attr( $type_key ) ?>"
105
  <?php selected( $type_key, $condition->conditionType ) ?>
106
+ <?php if ( $type_key_value['proOnly'] && ! $isPro ) { ?>disabled="disabled" <?php } ?>
107
  >
108
  <?php echo esc_html( $type_key_value['name'] ) ?>
109
  </option>
110
  <?php } ?>
111
  </select>
112
+ <?php if ( ! $isPro ) { ?>
 
 
 
 
 
 
 
 
113
  <p class="description">
114
+ Location based rules are a <span class="cnb-pro-badge">Pro</span> feature.
115
  <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
116
  </p>
117
  <?php } ?>
124
  name="conditions[<?php echo esc_attr( $condition->id ) ?>][matchType]">
125
  <?php
126
  foreach ( ( new CnbAdminFunctions() )->cnb_get_condition_match_types() as $condition_match_type_key => $condition_match_type_value ) { ?>
127
+ <option
128
+ class="conditionType conditionType_URL"
129
+ value="<?php echo esc_attr( $condition_match_type_key ) ?>"
130
+ <?php if ( ! in_array( $cnb_domain->type, $condition_match_type_value['plans'] ) ) { ?>disabled="disabled"<?php } ?>
131
+ <?php selected( $condition_match_type_key, $condition->matchType ) ?>>
132
+ <?php echo esc_html( $condition_match_type_value['name'] ) ?>
133
  </option>
134
  <?php } ?>
135
 
136
  <?php
137
  foreach ( ( new CnbAdminFunctions() )->cnb_get_condition_match_types_geo() as $condition_match_type_key => $condition_match_type_value ) { ?>
138
+ <option class="conditionType conditionType_GEO"
139
+ value="<?php echo esc_attr( $condition_match_type_key ) ?>"<?php selected( $condition_match_type_key, $condition->matchType ) ?>>
140
  <?php echo esc_html( $condition_match_type_value ) ?>
141
  </option>
142
  <?php } ?>
 
 
143
  </select>
144
+ <?php if ( $cnb_domain->type === 'STARTER' ) { ?>
145
+ <p class="description">
146
+ RegEx and parameter filtering are <span class="cnb-pro-badge">Pro</span> features.
147
+ <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
148
+ </p>
149
+ <?php } ?>
150
+
151
  </td>
152
  </tr>
153
  <tr>
src/admin/domain/CnbDomain.php CHANGED
@@ -15,6 +15,9 @@ class CnbDomain implements JsonSerializable {
15
  public $id;
16
  public $name;
17
  public $interval;
 
 
 
18
  public $type;
19
  public $expires;
20
  /**
@@ -116,7 +119,7 @@ class CnbDomain implements JsonSerializable {
116
  $domain->timezone = null;
117
  }
118
  if ( empty( $domain->type ) ) {
119
- $domain->type = 'FREE';
120
  }
121
  if ( empty( $domain->properties ) ) {
122
  $domain->properties = new CnbDomainProperties();
15
  public $id;
16
  public $name;
17
  public $interval;
18
+ /**
19
+ * @var string STARTER/PRO/FREE
20
+ */
21
  public $type;
22
  public $expires;
23
  /**
119
  $domain->timezone = null;
120
  }
121
  if ( empty( $domain->type ) ) {
122
+ $domain->type = 'STARTER';
123
  }
124
  if ( empty( $domain->properties ) ) {
125
  $domain->properties = new CnbDomainProperties();
src/admin/domain/CnbDomainViewEdit.php CHANGED
@@ -79,13 +79,12 @@ class CnbDomainViewEdit {
79
  <code><?php echo esc_html( $domain->type ) ?></code>
80
  <?php
81
  if ( $domain->type !== 'PRO' && ! empty( $domain->id ) ) {
82
- echo '<a href="' . esc_url( $upgrade_link ) . '">Upgrade!</a>
83
- <p class="description">The FREE plan adds delicate branding to your buttons and enables most features.</p>';
84
  }
85
  ?>
86
  </td>
87
  </tr>
88
- <?php if ( $domain->type != 'FREE' ) { ?>
89
  <tr>
90
  <th scope="row">Auto renew</th>
91
  <td>
@@ -154,6 +153,14 @@ class CnbDomainViewEdit {
154
  $domain_controller = new CnbDomainController();
155
  $cnb_utils = new CnbUtils();
156
  $domain_properties_zindex_order = $domain_controller->zindex_to_order( $domain->properties->zindex );
 
 
 
 
 
 
 
 
157
  ?>
158
  <tr>
159
  <th colspan="2"><h2>Button display</h2></th>
@@ -194,22 +201,35 @@ class CnbDomainViewEdit {
194
  </td>
195
  </tr>
196
  <tr>
197
- <th scope="row"><label for="domain_properties_allow_multiple_buttons">Multiple buttons per page</label></th>
 
 
 
 
198
  <td>
199
  <input type="hidden" name="domain[properties][allowMultipleButtons]" value="false"/>
200
- <input id="domain_properties_allow_multiple_buttons" class="cnb_toggle_checkbox"
201
- name="domain[properties][allowMultipleButtons]" type="checkbox"
202
- value="true" <?php checked( true, $domain->properties->allowMultipleButtons ); ?> />
 
 
 
 
 
 
 
 
203
  <label for="domain_properties_allow_multiple_buttons" class="cnb_toggle_label">Allow multiple Buttons on
204
  a single page</label>
205
  <span data-cnb_toggle_state_label="domain_properties_allow_multiple_buttons"
206
  class="cnb_toggle_state cnb_toggle_false">(Disabled)</span>
207
  <span data-cnb_toggle_state_label="domain_properties_allow_multiple_buttons"
208
  class="cnb_toggle_state cnb_toggle_true">Enabled</span>
209
-
210
- <p class="description">
211
- When enabled, more than one button can be displayed on a single page.
212
- </p>
 
213
  </td>
214
  </tr>
215
  <?php
@@ -282,22 +302,24 @@ class CnbDomainViewEdit {
282
  }
283
 
284
  public function getTimezoneSelect( $domain ) {
285
- $result = '<select name="domain[timezone]" id="domain_timezone" class="cnb_timezone_picker">';
286
- $result .= wp_timezone_choice( $domain->timezone );
287
- $result .= '</select>';
288
- $result .= '<p class="description" id="domain_timezone-description">';
289
- if ( empty( $domain->timezone ) ) {
290
- $result .= 'This is important for the scheduler to function.';
291
- $wordpress_timezone_string = wp_timezone_string();
292
- if ( ( new CnbUtils() )->is_valid_timezone_string( $wordpress_timezone_string ) ) {
293
- $result .= '<br/>WordPress is set to: <code>' . $wordpress_timezone_string . '</code>';
 
 
 
294
  }
295
- } else {
296
- $result .= 'Set to <code>' . esc_html( $domain->timezone ) . '</code>';
297
- }
298
- $result .= '</p>';
299
 
300
- return $result;
 
 
301
  }
302
 
303
  private function render_form( $domain ) {
79
  <code><?php echo esc_html( $domain->type ) ?></code>
80
  <?php
81
  if ( $domain->type !== 'PRO' && ! empty( $domain->id ) ) {
82
+ echo '<p class="description"><a href="' . esc_url( $upgrade_link ) . '">Upgrade</a> to <span class="cnb-pro-badge">Pro</span> to get tons of buttons, more features and extra button types.</p>';
 
83
  }
84
  ?>
85
  </td>
86
  </tr>
87
+ <?php if ( $domain->type != 'STARTER' ) { ?>
88
  <tr>
89
  <th scope="row">Auto renew</th>
90
  <td>
153
  $domain_controller = new CnbDomainController();
154
  $cnb_utils = new CnbUtils();
155
  $domain_properties_zindex_order = $domain_controller->zindex_to_order( $domain->properties->zindex );
156
+ $upgrade_link =
157
+ add_query_arg( array(
158
+ 'page' => 'call-now-button-domains',
159
+ 'action' => 'upgrade',
160
+ 'id' => $domain->id
161
+ ),
162
+ admin_url( 'admin.php' ) );
163
+
164
  ?>
165
  <tr>
166
  <th colspan="2"><h2>Button display</h2></th>
201
  </td>
202
  </tr>
203
  <tr>
204
+ <th scope="row"><label for="domain_properties_allow_multiple_buttons">Multiple buttons per page</label>
205
+ <?php if ( $domain->type === 'STARTER' ) { ?>
206
+ <a href="<?php echo esc_url( $upgrade_link ) ?>"><span class="cnb-pro-badge">Pro</span><a/>
207
+ <?php } ?>
208
+ </th>
209
  <td>
210
  <input type="hidden" name="domain[properties][allowMultipleButtons]" value="false"/>
211
+ <input
212
+ id="domain_properties_allow_multiple_buttons"
213
+ class="cnb_toggle_checkbox"
214
+ name="domain[properties][allowMultipleButtons]"
215
+ type="checkbox"
216
+ value="true"
217
+ <?php if ( $domain->type === 'STARTER' ) {
218
+ $domain->properties->allowMultipleButtons = false;
219
+ ?>disabled="disabled"<?php } ?>
220
+ <?php checked( true, $domain->properties->allowMultipleButtons ); ?>
221
+ />
222
  <label for="domain_properties_allow_multiple_buttons" class="cnb_toggle_label">Allow multiple Buttons on
223
  a single page</label>
224
  <span data-cnb_toggle_state_label="domain_properties_allow_multiple_buttons"
225
  class="cnb_toggle_state cnb_toggle_false">(Disabled)</span>
226
  <span data-cnb_toggle_state_label="domain_properties_allow_multiple_buttons"
227
  class="cnb_toggle_state cnb_toggle_true">Enabled</span>
228
+ <?php if ( $domain->type !== 'STARTER' ) { ?>
229
+ <p class="description">
230
+ When enabled, more than one button can be displayed on a single page.
231
+ </p>
232
+ <?php } ?>
233
  </td>
234
  </tr>
235
  <?php
302
  }
303
 
304
  public function getTimezoneSelect( $domain ) {
305
+ if ( ! is_wp_error($domain) ) {
306
+ $result = '<select name="domain[timezone]" id="domain_timezone" class="cnb_timezone_picker">';
307
+ $result .= wp_timezone_choice( $domain->timezone );
308
+ $result .= '</select>';
309
+ $result .= '<p class="description" id="domain_timezone-description">';
310
+ if ( empty( $domain->timezone ) ) {
311
+ $wordpress_timezone_string = wp_timezone_string();
312
+ if ( ( new CnbUtils() )->is_valid_timezone_string( $wordpress_timezone_string ) ) {
313
+ $result .= '<br/>WordPress is set to: <code>' . $wordpress_timezone_string . '</code>';
314
+ }
315
+ } else {
316
+ $result .= 'Set to <code>' . esc_html( $domain->timezone ) . '</code>';
317
  }
318
+ $result .= '</p>';
 
 
 
319
 
320
+ return $result;
321
+ }
322
+ return '<p class="description" id="domain_timezone-description">Something went wrong</p>';
323
  }
324
 
325
  private function render_form( $domain ) {
src/admin/domain/CnbDomainViewUpgrade.php CHANGED
@@ -7,12 +7,12 @@ defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
9
  use cnb\admin\api\CnbAppRemotePayment;
10
- use cnb\admin\profile\CnbProfileEdit;
11
  use cnb\notices\CnbNotice;
12
 
13
  class CnbDomainViewUpgrade {
14
  function header() {
15
- echo 'Upgrade the Call Now Button';
 
16
  }
17
 
18
  /**
@@ -34,11 +34,11 @@ class CnbDomainViewUpgrade {
34
  * @return CnbNotice
35
  */
36
  private function get_upgrade_notice( $domain ) {
37
- $upgradeStatus = filter_input( INPUT_GET, 'upgrade', FILTER_SANITIZE_STRING );
38
- $checkoutSesionId = filter_input( INPUT_GET, 'checkout_session_id', FILTER_SANITIZE_STRING );
39
  if ( $upgradeStatus === 'success?payment=success' ) {
40
  // Get checkout Session Details
41
- $session = CnbAppRemotePayment::cnb_remote_get_subscription_session( $checkoutSesionId );
42
  if ( ! is_wp_error( $session ) ) {
43
  // This results in a subscription (via ->subscriptionId), get that for ->type
44
  $subscription = CnbAppRemotePayment::cnb_remote_get_subscription( $session->subscriptionId );
@@ -66,7 +66,7 @@ class CnbDomainViewUpgrade {
66
  // See if the domain is JUST upgraded
67
  $notice = $this->get_upgrade_notice( $domain );
68
  if ( $notice ) {
69
- // And if so, refetch the domain
70
  $domain = CnbDomain::setSaneDefault( $this->get_domain() );
71
  // Also flush the cache
72
  do_action( 'cnb_after_button_changed' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
9
  use cnb\admin\api\CnbAppRemotePayment;
 
10
  use cnb\notices\CnbNotice;
11
 
12
  class CnbDomainViewUpgrade {
13
  function header() {
14
+ $domain = $this->get_domain();
15
+ echo 'Upgrade ' . esc_html( $domain->name ) . ' to PRO';
16
  }
17
 
18
  /**
34
  * @return CnbNotice
35
  */
36
  private function get_upgrade_notice( $domain ) {
37
+ $upgradeStatus = filter_input( INPUT_GET, 'upgrade', FILTER_SANITIZE_STRING );
38
+ $checkoutSessionId = filter_input( INPUT_GET, 'checkout_session_id', FILTER_SANITIZE_STRING );
39
  if ( $upgradeStatus === 'success?payment=success' ) {
40
  // Get checkout Session Details
41
+ $session = CnbAppRemotePayment::cnb_remote_get_subscription_session( $checkoutSessionId );
42
  if ( ! is_wp_error( $session ) ) {
43
  // This results in a subscription (via ->subscriptionId), get that for ->type
44
  $subscription = CnbAppRemotePayment::cnb_remote_get_subscription( $session->subscriptionId );
66
  // See if the domain is JUST upgraded
67
  $notice = $this->get_upgrade_notice( $domain );
68
  if ( $notice ) {
69
+ // And if so, re-fetch the domain
70
  $domain = CnbDomain::setSaneDefault( $this->get_domain() );
71
  // Also flush the cache
72
  do_action( 'cnb_after_button_changed' );
src/admin/domain/Cnb_Domain_List_Table.php CHANGED
@@ -132,6 +132,8 @@ class Cnb_Domain_List_Table extends WP_List_Table {
132
  return 'Free';
133
  case 'PRO':
134
  return 'Pro';
 
 
135
  default:
136
  return esc_html( $item->type );
137
  }
132
  return 'Free';
133
  case 'PRO':
134
  return 'Pro';
135
+ case 'STARTER':
136
+ return 'Starter';
137
  default:
138
  return esc_html( $item->type );
139
  }
src/admin/domain/partials/CnbDomainViewUpgradeFinished.php CHANGED
@@ -6,7 +6,6 @@ namespace cnb\admin\domain;
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
9
- use cnb\admin\domain\CnbDomainViewUpgradeOverview;
10
  use cnb\notices\CnbAdminNotices;
11
  use cnb\notices\CnbNotice;
12
  use cnb\utils\CnbUtils;
@@ -40,17 +39,7 @@ class CnbDomainViewUpgradeFinished {
40
  ),
41
  $url );
42
  }
43
- /**
44
- * Print Cloud benefits
45
- *
46
- * @return void
47
- */
48
- private function renderBenefits() {
49
- echo '<div>';
50
- echo '<h1 class="cnb-center top-50"><strong>Other features include:</strong></h1><hr>';
51
- ( new CnbDomainViewUpgradeOverview() )->renderBenefits();
52
- echo '</div>';
53
- }
54
 
55
  private function renderLetsGo() {
56
  $portal_url = CnbAppRemote::cnb_remote_create_billing_portal();
@@ -61,17 +50,17 @@ class CnbDomainViewUpgradeFinished {
61
  <div class="box">
62
  <h2>Manage your buttons</h2>
63
  <p>
64
- <a class="button premium-button" href="%1$s">Button overview</a>
65
  </p>
66
  </div>
67
  <div class="box">
68
  <h2>Check your Settings</h2>
69
- <p><a class="button premium-button" href="%2$s">Open settings
70
  </a></p>
71
  </div>
72
  <div class="box">
73
  <h2>Administration</h2>
74
- <p><a class="button premium-button" href="%3$s">Invoices</a></p>
75
  </div>
76
  </div>
77
  </div>',
@@ -81,15 +70,6 @@ class CnbDomainViewUpgradeFinished {
81
  );
82
  }
83
 
84
- /**
85
- * print SVG wrapped in a div with a big, nice and pretty "Yay!"
86
- *
87
- * @return void
88
- */
89
- public function echoBigYaySvg() {
90
- echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 561 309"><path d="M107.373,301.9a109.773,109.773,0,0,0,19.32-5.52,155.59,155.59,0,0,0,36.6-20.16,121,121,0,0,0,30.12-31.44q18.477-.241,34.68-0.96t25.08-4.32q9.837-4.083,14.04-10.44t4.2-11.4a10.559,10.559,0,0,0-.12-1.68,10.242,10.242,0,0,0-.36-1.44q-1.2-3.841-2.16-3.84-0.72,0-.72,2.16v1.44q0,6.959-3.96,10.2a92.727,92.727,0,0,1-11.88,7.8q-6.723,3.837-21.96,5.04t-33,1.2a290.972,290.972,0,0,0,12.84-27.48q6.356-15.48,12-32.4t10.2-33.36q4.555-16.435,7.68-30.36,2.16-9.837,2.16-14.64t-1.32-6.72a3.863,3.863,0,0,0-3.24-1.92q-2.88,0-6,2.88t-3.6,5.04q-2.16,7.443-6.24,18.48t-9.84,23.64q-5.76,12.6-12.96,24.96a184.347,184.347,0,0,1-15.48,22.68,84.992,84.992,0,0,1-17.16,16.56q-11.284,7.92-21.36,7.92a14.461,14.461,0,0,1-10.32-3.84q-4.085-3.836-4.08-12.24,0-1.917.24-4.32a48.082,48.082,0,0,1,.72-4.8,149.376,149.376,0,0,1,8.16-24.96q5.76-13.916,13.56-28.8t15.96-28.56a174.627,174.627,0,0,0,14.16-30.12,87.036,87.036,0,0,0,5.52-29.16,46.691,46.691,0,0,0-5.28-22.2q-5.283-9.956-18-15.48a41.469,41.469,0,0,0-11.52-3.72,77.4,77.4,0,0,0-13.2-1.08q-16.083,0-34.32,6.12a162.671,162.671,0,0,0-35.88,17.4,176.481,176.481,0,0,0-32.28,26.52A129.268,129.268,0,0,0,14.853,88.3a108.621,108.621,0,0,0-6.96,18.6,70.9,70.9,0,0,0-2.4,18.36q0,15.363,6.48,26.64a46.526,46.526,0,0,0,16.92,17.4,43.619,43.619,0,0,0,22.44,6.12,45.766,45.766,0,0,0,17.76-3.6,82.446,82.446,0,0,0,27.12-17.64,88.512,88.512,0,0,0,17.4-23.52q6.12-12.357,6.12-22.44,0-8.64-4.56-14.16t-14.4-5.52a51.739,51.739,0,0,0-11.76,1.68,6.733,6.733,0,0,0-3.12,1.32q-1.44,1.08-1.44,1.56,0,0.962,2.16.96h1.2a6.994,6.994,0,0,0,1.68-.24,29.9,29.9,0,0,1,6.24-.72q7.92,0,11.4,4.44t3.48,11.4a46.527,46.527,0,0,1-3.12,15.6,78.488,78.488,0,0,1-8.76,17.04,83.89,83.89,0,0,1-12.96,15.12,44.622,44.622,0,0,1-15.72,9.6,46.932,46.932,0,0,1-15.36,2.64,36.88,36.88,0,0,1-17.52-4.32,33.31,33.31,0,0,1-13.2-12.84q-5.04-8.516-5.04-21.48a73.287,73.287,0,0,1,2.04-16.32,119.309,119.309,0,0,1,6.36-19.2,125.152,125.152,0,0,1,19.68-31.44,165.561,165.561,0,0,1,28.92-27,156.037,156.037,0,0,1,33.24-18.84q17.037-6.958,32.4-6.96,14.4,0,24.96,6.72a16.293,16.293,0,0,1,6.6,8.28,34.892,34.892,0,0,1,2.04,12.36,85.436,85.436,0,0,1-3.12,21.12,162.259,162.259,0,0,1-8.88,24.96,215.654,215.654,0,0,1-13.44,25.44q-6.48,10.8-14.04,24.36a280.918,280.918,0,0,0-13.44,27.48,112.986,112.986,0,0,0-7.8,25.92q-0.243,1.683-.36,3.36c-0.083,1.122-.12,2.16-0.12,3.12q0,13.923,7.92,20.4a28.988,28.988,0,0,0,18.96,6.48q14.877,0,28.8-9.36a95.478,95.478,0,0,0,20.64-19.32,189.687,189.687,0,0,0,16.56-24.12,232.159,232.159,0,0,0,11.52-22.32q-6.48,24-14.88,47.04t-17.76,46.32a523.566,523.566,0,0,0-54.48,2.76,175.855,175.855,0,0,0-49.92,12.6q-15.362,6.239-22.2,13.92t-6.84,14.16q0,8.877,10.44,15.12t27.24,6.24A97.719,97.719,0,0,0,107.373,301.9Zm-34.08-8.16q-7.324-3.122-7.32-8.4,0-4.083,4.68-9.36t15.48-11.28a130.694,130.694,0,0,1,46.56-16.2,334.727,334.727,0,0,1,49.44-3.72,101.744,101.744,0,0,1-27,28.92,137.241,137.241,0,0,1-32.28,17.4,95.658,95.658,0,0,1-16.08,4.32,87.429,87.429,0,0,1-15.12,1.44Q80.611,296.863,73.293,293.743ZM429.57,163.9q-6.245,12.483-11.16,21a75.586,75.586,0,0,1-10.8,14.64,60.436,60.436,0,0,1-14.28,10.8,156.273,156.273,0,0,1-21.36,9.48q-5.76,10.317-13.08,21.48a148.749,148.749,0,0,1-16.56,20.88,83.473,83.473,0,0,1-20.4,15.84,50.308,50.308,0,0,1-24.6,6.12q-12.477,0-17.76-4.92a15.412,15.412,0,0,1-5.28-11.64,18.313,18.313,0,0,1,.96-6.24q0.962-2.643,2.88-6.72a35.934,35.934,0,0,1,9.36-12,55.137,55.137,0,0,1,12.96-8.16,142.837,142.837,0,0,1,28.44-9.36q15.957-3.6,30.6-7.92a124.05,124.05,0,0,0,8.4-18.12q3.836-10.2,6.96-19.92t5.04-15.96q-2.88,5.283-7.32,12.84a145.514,145.514,0,0,1-9.96,14.76,62.714,62.714,0,0,1-11.88,12,21.791,21.791,0,0,1-13.32,4.8,21.187,21.187,0,0,1-6.36-1.2,14.088,14.088,0,0,1-6.48-4.44q-2.763-3.24-2.76-9.72a26.341,26.341,0,0,1,3-12.12c1.191-2.336,2.327-4.617,3.434-6.869-0.6,1.142-1.224,2.308-1.872,3.509a169.966,169.966,0,0,1-8.88,14.64,65.146,65.146,0,0,1-9.96,11.76q-5.163,4.68-10.44,5.16a12.548,12.548,0,0,1-6-1.2,13.526,13.526,0,0,1-5.88-5.28q-2.52-3.836-2.52-10.8a55.888,55.888,0,0,1,2.16-13.92q-2.88,4.563-7.44,11.16a74.782,74.782,0,0,1-9.84,11.64,34.073,34.073,0,0,1-8.64,6.24,17.655,17.655,0,0,1-7.44,1.92q-6.243,0-10.08-5.64t-3.84-14.76q0-9.6,4.8-21.84t15.6-25.44a53.97,53.97,0,0,1,16.92-13.56,42.337,42.337,0,0,1,19.56-5.16,31.164,31.164,0,0,1,10.56,1.8,22.469,22.469,0,0,1,8.88,5.88,5.3,5.3,0,0,1,1.68,3.84,2.954,2.954,0,0,1-1.2,2.4,3.412,3.412,0,0,1-3.12.48q-2.643-8.4-11.28-8.4a21.446,21.446,0,0,0-9.36,2.64q-8.162,4.32-16.92,14.16a144,144,0,0,0-15.24,20.4,59.659,59.659,0,0,0-3,5.52q-2.041,4.084-3.96,9.12a47.329,47.329,0,0,0-2.64,9.84,14.3,14.3,0,0,0-.24,2.04v1.8q0,7.92,6,7.92,7.2,0,16.32-10.56a138.065,138.065,0,0,0,11.28-16.08q5.04-8.4,10.32-18a109.441,109.441,0,0,1,6.72-10.8,10.3,10.3,0,0,1,8.88-4.32,20.007,20.007,0,0,1,5.28.72,12.723,12.723,0,0,0,5.52.24,42.9,42.9,0,0,0-5.16,7.2q-3.24,5.283-6.84,12t-6.48,13.68a82,82,0,0,0-4.08,12q-0.242,1.44-.6,4.08a32.118,32.118,0,0,0-.36,3.84q0,6.723,3.84,6.72t8.28-4.56a71.612,71.612,0,0,0,8.76-11.28q4.32-6.716,7.92-13.56t5.76-11.16a4.008,4.008,0,0,1,1.5-2.013c0.487-.979.953-1.979,1.373-3.027q3.6-7.436,7.2-14.28t6.24-12.12q2.637-5.276,9.12-5.28h14.88q-1.683,1.44-4.2,3.24a17.671,17.671,0,0,0-4.68,5.4q-6.48,11.043-11.28,21.24t-10.32,21.72a57.607,57.607,0,0,0-3.84,10.08,31.653,31.653,0,0,0-1.2,7.92q0,7.92,5.28,7.92,5.76,0,13.92-9.36a162.607,162.607,0,0,0,13.56-18.84q6.84-10.917,13.2-22.56t11.16-21.48q2.637-5.276,9.36-5.28h13.2a31.662,31.662,0,0,0-10.68,12.48q-3.725,7.684-8.28,19.68-5.04,13.2-9.48,27.24t-9.96,28.2a108.823,108.823,0,0,0,17.88-8.16,49.041,49.041,0,0,0,16.92-15.84,164.176,164.176,0,0,0,9.48-15.72q3.96-7.56,5.64-10.92c0.637-1.6,1.518-2.4,2.64-2.4s1.68,0.72,1.68,2.16A5.964,5.964,0,0,1,429.57,163.9ZM329.13,231.7a165.51,165.51,0,0,0-24.36,8.28,42.165,42.165,0,0,0-18.12,13.68q-6.6,8.877-6.6,15.84a9.6,9.6,0,0,0,2.76,7.08q2.762,2.757,8.76,2.76,7.92,0,16.32-4.8a89.765,89.765,0,0,0,16.32-12.12,195.3,195.3,0,0,0,14.52-14.88q6.6-7.56,10.68-13.32a43.594,43.594,0,0,0,2.64-4.32q1.44-2.643,2.88-5.04Q343.167,227.98,329.13,231.7Zm139.916-60.36q5.159-7.677,12.36-18.24t15.36-22.44q8.157-11.88,16.08-23.76t14.52-21.84q6.6-9.956,10.8-16.56t4.68-8.28l-0.48-1.2-1.2-.72h-7.68a34.313,34.313,0,0,0-7.2.72,7.142,7.142,0,0,0-5.04,4.08l-61.44,116.88-0.24,1.44,2.4,0.48Q463.885,179.023,469.046,171.343Zm-11.04,36.24a11.089,11.089,0,0,0,3.72-8.16,7.76,7.76,0,0,0-2.4-5.88,8.7,8.7,0,0,0-6.24-2.28,12.445,12.445,0,0,0-7.44,2.64,9.635,9.635,0,0,0-4.08,6.96,10.481,10.481,0,0,0,1.56,7.2q2.037,3.117,6.6,3.12A11.656,11.656,0,0,0,458.006,207.583Z"/></svg>';
91
- }
92
-
93
  /**
94
  * @param $domain CnbDomain
95
  * @param $notice CnbNotice
@@ -104,32 +84,40 @@ class CnbDomainViewUpgradeFinished {
104
 
105
  // Render notice if JUST upgraded and show general information about domain (instead of upgrade form)
106
  if ( $notice ) {
 
 
107
  CnbAdminNotices::get_instance()->renderNotice( $notice );
108
- // Big "Yay!"
109
- echo '<h1 class="cnb-upgrade-title"><span style="text-transform:uppercase">' . esc_html( $domain->name ) . '</span> is now a PRO domain!</h1>';
110
- echo '<div style="width:200px; height:auto; margin:0 auto">';
111
- $this->echoBigYaySvg();
112
- echo '</div>';
113
- echo '<div class="cnb-pricebox">';
114
- echo '<div class="cnb-benefit">✨ All "Powered by" notices are removed! ✨</div>';
115
- echo '<div class="cnb-benefit">⚡ Create slide-in Content Windows ⚡</div>';
116
- echo '<div class="cnb-benefit">📷 Use custom images on buttons 📷</div>';
117
- echo '<div class="cnb-benefit">🌍 You can include and exclude countries 🌍</div>';
118
- echo '<div class="cnb-benefit">↕️ Set scroll depth (buttons appear after scrolling) ↕️</div>';
119
- echo '<div class="cnb-benefit">🔌 Include Intercom Chat via our integration 🔌</div>';
120
- echo '</div>';
 
 
 
 
121
 
 
122
  $this->renderLetsGo();
123
- $this->renderBenefits();
124
- }
125
-
126
-
127
- echo '<p>';
128
- if ( ! empty( $domain->expires ) ) {
129
- echo 'Your subscription will';
130
- echo $domain->renew == 1 ? ' renew automatically ' : ' expire ';
131
- echo 'on ' . esc_html( date( 'F d, Y', strtotime( $domain->expires ) ) ) . '.';
132
  }
133
-
134
  }
 
 
 
 
 
 
 
 
 
135
  }
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
 
9
  use cnb\notices\CnbAdminNotices;
10
  use cnb\notices\CnbNotice;
11
  use cnb\utils\CnbUtils;
39
  ),
40
  $url );
41
  }
42
+
 
 
 
 
 
 
 
 
 
 
43
 
44
  private function renderLetsGo() {
45
  $portal_url = CnbAppRemote::cnb_remote_create_billing_portal();
50
  <div class="box">
51
  <h2>Manage your buttons</h2>
52
  <p>
53
+ <a class="button button-primary" href="%1$s">Button overview</a>
54
  </p>
55
  </div>
56
  <div class="box">
57
  <h2>Check your Settings</h2>
58
+ <p><a class="button button-primary" href="%2$s">Open settings
59
  </a></p>
60
  </div>
61
  <div class="box">
62
  <h2>Administration</h2>
63
+ <p><a class="button button-primary" href="%3$s">Invoices</a></p>
64
  </div>
65
  </div>
66
  </div>',
70
  );
71
  }
72
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * @param $domain CnbDomain
75
  * @param $notice CnbNotice
84
 
85
  // Render notice if JUST upgraded and show general information about domain (instead of upgrade form)
86
  if ( $notice ) {
87
+ wp_enqueue_script( CNB_SLUG . '-confetti' );
88
+ $cnb_utils = new CnbUtils();
89
  CnbAdminNotices::get_instance()->renderNotice( $notice );
90
+ ?>
91
+ <h1 class="cnb-upgrade-title">
92
+ <span style="font-size:30px; width:38px;" class="dashicons dashicons-yes-alt"></span>
93
+ Your domain <b><?php echo esc_html( $domain->name ); ?></b> was successfully upgraded to PRO!
94
+ </h1>
95
+ <div class="cnb-center">
96
+ <img width="200" height="200" src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/confetti2.gif')?>" alt="Upgraded to pro successfully">
97
+ </div>
98
+ <div class="cnb-welcome-blocks">
99
+ <div class="cnb-block">
100
+ <h1>Congratulations!</h1>
101
+ <p style="font-size:16px;">Your domain is now on the PRO plan! This means you have access to every single feature including the scheduler, multi-action buttons, advanced display rules and much much more.</p>
102
+ <p style="font-size:16px;">If you have any questions, take a look at our <a target="_blank" href="<?php echo esc_url( $cnb_utils->get_support_url('', 'upgrade-success-page', 'help-center') ); ?>">help center</a> or feel free to email us directly at <a href="mailto:hello@nowbuttons.com">hello@nowbuttons.com</a>.</p>
103
+ <p style="font-size:16px;">Thanks for choosing NowButtons!</p>
104
+ <p style="font-size:16px;">Jasper & Jerry</p>
105
+ </div>
106
+ </div>
107
 
108
+ <?php
109
  $this->renderLetsGo();
110
+ echo '<br><br><br>';
111
+ add_filter('admin_footer_text', array($this, 'render_confetti_image_credits'));
 
 
 
 
 
 
 
112
  }
 
113
  }
114
+
115
+ /**
116
+ * Add credits for using the animated confetti image to the page footer
117
+ *
118
+ * @return void
119
+ */
120
+ function render_confetti_image_credits() {
121
+ echo '<span id="footer-thankyou">Thanks to <a href="https://lordicon.com/" target="_blank">Lordicon</a> for the confetti animation.</span><script>jQuery(() => {cnb_confetti()})</script>';
122
+ }
123
  }
src/admin/domain/partials/CnbDomainViewUpgradeOverview.php CHANGED
@@ -18,7 +18,7 @@ class CnbDomainViewUpgradeOverview {
18
  *
19
  * @return string|null
20
  */
21
- private function getActiveCurrency( $user ) {
22
  $active_currency = null;
23
  if ( $user && ! is_wp_error( $user ) && isset( $user->stripeDetails ) && ! empty( $user->stripeDetails->currency ) ) {
24
  $active_currency = $user->stripeDetails->currency;
@@ -35,52 +35,112 @@ class CnbDomainViewUpgradeOverview {
35
  * @return void
36
  */
37
  function render( $domain ) {
38
- $cnb_utils = new CnbUtils();
39
- if ( $domain->type !== 'FREE' ) { ?><p>Your domain is currently on the
40
- <code><?php echo esc_html( $domain->type ) ?></code> plan.</p>
41
- <?php } ?>
42
 
43
- <?php
44
 
45
- $coupon = (new CnbAppRemotePromotionCodes())->get_coupon();
46
- if ($coupon != null && !is_wp_error($coupon)) { ?>
47
- <div class="cnb-promo-bar cnb-flexbox">
48
- <?php if ($coupon->redeemByDate) { ?>
49
- <div class="cnb_align_right cnb-coupon-timer" style="width:100%; padding-right:10px;" id="cnb-coupon-expiration-countdown" data-coupon-expiration-time="<?php echo esc_attr($coupon->redeemBy);?>">
50
- Coupon expires in <?php echo esc_html($coupon->get_redeem_by()) ?>
51
- </div>
52
- <?php } else { ?>
53
- <div class="cnb_align_right cnb-coupon-timer">&nbsp;</div>
54
- <?php }?>
55
-
56
- <div class="cnb-coupon-details">
57
- <h5>USE COUPON <code class="cnb-coupon-code"><?php echo esc_html($coupon->code); ?></code> FOR EXTRA <?php echo esc_html($coupon->get_discount()); ?> DISCOUNT</h5>
58
- <p>Add coupon code <code class="cnb-coupon-code"><?php echo esc_html($coupon->code); ?></code> during checkout for an extra <strong><?php echo esc_html($coupon->get_discount()); ?></strong> off <?php echo esc_html($coupon->get_period()); ?> on <?php echo esc_html($coupon->get_plan()); ?>.</div>
59
- </div>
60
- <?php } ?>
61
 
62
- <h1 class="cnb-upgrade-title">Upgrade <?php echo esc_html( $domain->name ) ?> to PRO</h1>
63
- <div class="cnb-pricebox">
64
- <div class="cnb-benefit">🧰 All features from Cloud</div>
65
- <div class="cnb-benefit">⚡ Slide-in Content Windows<a
66
- href="<?php echo esc_url( $cnb_utils->get_website_url( 'integrations/#iframes', 'pro-upgrade', 'content-windows' ) ) ?>"
67
- target="_blank" class="cnb-nounderscore"><span class="dashicons dashicons-editor-help"></span></a></div>
68
- <div class="cnb-benefit">📷 Use custom images on buttons</div>
69
- <div class="cnb-benefit">🌍 Include and exclude countries</div>
70
- <div class="cnb-benefit">↕️ Set scroll depth (buttons appear after scrolling)</div>
71
- <div class="cnb-benefit">🔌 Intercom Chat integration<a
72
- href="<?php echo esc_url( $cnb_utils->get_website_url( 'integrations/#intercom', 'pro-upgrade', 'intercom' ) ) ?>"
73
- target="_blank" class="cnb-nounderscore"><span class="dashicons dashicons-editor-help"></span></a></div>
74
- <div class="cnb-benefit">✨ "Powered by" notice removed</div>
 
 
 
 
 
 
 
 
 
 
 
 
75
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  <?php
77
- $this->renderUpgradeForm( $domain );
78
- echo '<h2 class="cnb-center cnb-plan-features">The PRO plan also includes the following Cloud features:</h2>';
79
- $this->renderBenefits();
80
  }
81
 
82
- private function renderJsToHideCurrency( $user ) {
83
- $active_currency = $this->getActiveCurrency( $user );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  if ( $active_currency ) {
85
  // We already know the currency, so a "select currency" tab menu makes no sense
86
  echo '<script>';
@@ -91,69 +151,144 @@ class CnbDomainViewUpgradeOverview {
91
 
92
  /**
93
  * @param $domain CnbDomain
 
94
  *
95
  * @return void
96
  */
97
- public function renderUpgradeForm( $domain ) {
98
  global $cnb_user;
99
- $this->renderJsToHideCurrency( $cnb_user );
100
- $plans = CnbAppRemotePayment::cnb_remote_get_plans();
101
- $active_currency = $this->getActiveCurrency( $cnb_user );
102
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
103
  <form id="wp_domain_upgrade" method="post">
104
  <input type="hidden" name="cnb_domain_id" id="cnb_domain_id" value="<?php echo esc_attr( $domain->id ) ?>">
105
 
106
  <div class="cnb-price-plans">
107
- <div class="cnb-message notice"><p class="cnb-error-message"></p></div>
108
-
109
- <div class="currency-box
110
- currency-box-eur
111
- cnb-flexbox
112
- ">
113
  <?php
114
- $plan_year = $this->get_plan( $plans, 'powered-by-eur-yearly' );
115
  $plan_year_monthly = $plan_year->price / 12;
116
- $plan_x = floor( $plan_year_monthly );
117
- $plan_y = round( ( $plan_year_monthly ) - floor( $plan_year_monthly ), 2 ) * 100;
118
  ?>
119
 
120
- <div class="cnb-pricebox cnb-currency-box
121
- <?php if ( $active_currency !== 'usd' ) { ?>currency-box-active<?php } ?>">
122
- <h3 class="cnb-price-eur">PRO EURO</h3>
123
 
124
  <div class="plan-amount"><span class="currency">€</span><span
125
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
126
  class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
127
  </div>
128
  <div class="billingprice">
129
- <span class="">Billed &euro;<?php echo esc_html(number_format($plan_year->price,2,'.',''));?> every 12 months.<br>VAT may apply</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  </div>
131
 
132
- <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
133
- onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Upgrade Now</a>
 
 
 
 
 
 
134
  </div>
135
 
 
 
 
136
  <?php
137
- $plan_year = $this->get_plan( $plans, 'powered-by-usd-yearly' );
138
  $plan_year_monthly = $plan_year->price / 12;
139
- $plan_x = floor( $plan_year_monthly );
140
- $plan_y = round( ( $plan_year_monthly ) - floor( $plan_year_monthly ), 2 ) * 100;
 
 
 
 
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  ?>
143
- <div class="cnb-pricebox cnb-currency-box
144
- <?php if ( $active_currency !== 'eur' ) { ?>currency-box-active<?php } ?>">
145
- <h3 class="cnb-price-usd">PRO USD</h3>
146
 
147
  <div class="plan-amount"><span class="currency">$</span><span
148
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
149
  class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
150
  </div>
151
  <div class="billingprice">
152
- <span class="">Billed $<?php echo esc_html(number_format($plan_year->price,2,'.',''));?> every 12 months.<br>VAT may apply</span>
153
  </div>
154
 
155
- <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
156
- onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Upgrade Now</a>
 
 
 
 
 
 
157
  </div>
158
 
159
  </div>
@@ -162,45 +297,457 @@ class CnbDomainViewUpgradeOverview {
162
  <?php
163
  }
164
 
165
- public function renderBenefits() {
166
- echo '
167
- <div class="cnb-flexbox cnb-plan-features">
168
- <ul class="cnb-checklist">
169
- <li><strong>Phone</strong> <span class="only-big-screens">buttons</span></li>
170
- <li><strong>Email</strong> <span class="only-big-screens">buttons</span></li>
171
- <li><strong>SMS/text</strong> <span class="only-big-screens">buttons</span></li>
172
- <li><strong>WhatsApp</strong> <span class="only-big-screens">buttons</span></li>
173
- <li><strong>Messenger</strong> <span class="only-big-screens">buttons</span></li>
174
- <li><strong>Signal</strong> <span class="only-big-screens">buttons</span></li>
175
- <li><strong>Telegram</strong> <span class="only-big-screens">buttons</span></li>
176
- <li><strong>Location</strong> <span class="only-big-screens">buttons</span></li>
177
- <li><strong>Links</strong> <span class="only-big-screens">buttons</span></li>
178
- <li><strong>Smooth scroll</strong> <span class="only-big-screens">buttons</span></li>
179
- </ul>
180
- <ul class="cnb-checklist">
181
- <li><strong>Multiple buttons</strong><br>Add up to 8 buttons to a single page!</li>
182
- <li><strong>Circular action button</strong><br>The famous single action button</li>
183
- <li><strong>Multi action buttons</strong><br>Multibutton&trade; (expandable single button)<br>Buttonbar&trade;
184
- (Add up to 5 actions to a full width button)
185
- </li>
186
- <li><strong>WhatsApp Chat window</strong><br>A chat window to kickstart the conversation</li>
187
- <li><strong>Tally Form window</strong><br>Easily embed a Tally form in our Content Window</li>
188
- </ul>
189
- <ul class="cnb-checklist">
190
- <li><strong>Button animations</strong><br>Draw more attention to your buttons with subtle
191
- animations
192
- </li>
193
- <li><strong>Buttons slide-in</strong><br>Buttons don\'t just appear but smoothly slide into the page.
194
- </li>
195
- <li><strong>Advanced page targeting options</strong><br>Ability to select full URLs, entire
196
- folders or even url parameters
197
- </li>
198
- <li><strong>Clicks & conversions</strong><br>Clicks & conversion tracking with Google
199
- </li>
200
- <li><strong>Scheduling</strong><br>Select days and times your buttons should be visible</li>
201
- <li><strong>And so much more!</strong></li>
202
- </ul>
203
- </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  }
205
 
206
  /**
18
  *
19
  * @return string|null
20
  */
21
+ private function get_active_currency( $user ) {
22
  $active_currency = null;
23
  if ( $user && ! is_wp_error( $user ) && isset( $user->stripeDetails ) && ! empty( $user->stripeDetails->currency ) ) {
24
  $active_currency = $user->stripeDetails->currency;
35
  * @return void
36
  */
37
  function render( $domain ) {
38
+ $cnb_utils = new CnbUtils();
39
+ if ( $domain->type === 'PRO' ) {
40
+ ?><p>Your domain is currently on the <code><?php echo esc_html( $domain->type ) ?></code> plan.</p><?php
41
+ }
42
 
43
+ $this->render_payment_cancelled_message();
44
 
45
+ $this->render_coupon();
46
+ $upgrade_msg = $cnb_utils->get_query_val( 'upgrade' );
47
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
+ <div class="cnb-welcome-blocks">
50
+ <?php if ( $upgrade_msg === 'success?payment=cancelled' ) { ?>
51
+ <h1>Yearly billing gives you <b>3 months free</b> each year!</h1>
52
+ <?php } else { ?>
53
+ <h1>Ready to turn your website into a conversion engine?</h1>
54
+ <?php } ?>
55
+ <h2>Upgrade to PRO and unlock everything NowButtons has to offer</h2>
56
+ <p>(full benefits overview below)</p><br>
57
+ <?php
58
+ $this->render_upgrade_form( $domain, '-comparison-top' );
59
+ ?>
60
+ </div>
61
+ <div class="cnb-welcome-blocks">
62
+ <?php
63
+ $this->render_pro_features_nice_view();
64
+ ?>
65
+ <br><br>
66
+ <?php
67
+ $this->render_pro_features_extras();
68
+ ?>
69
+ <br>
70
+ <h1>Select a plan and try it <b>14 days for free</b>!</h1><br>
71
+ <?php
72
+ $this->render_upgrade_form( $domain );
73
+ ?>
74
  </div>
75
+ <div class="cnb-welcome-blocks">
76
+ <h1>Feature comparison</h1>
77
+ <h3>An overview of the features that are included in the Starter (free) and Pro plans.</h3>
78
+ <?php
79
+ $this->render_pro_feature_comparison();
80
+ ?>
81
+ <br>
82
+ <h1>Ready to give PRO a try?</h1><br>
83
+ <?php
84
+ $this->render_upgrade_form( $domain, '-comparison-bottom' );
85
+ ?>
86
+ </div>
87
+ <br><br>
88
+ <div class="cnb-message notice"><p class="cnb-error-message"></p></div>
89
  <?php
 
 
 
90
  }
91
 
92
+ private function render_coupon() {
93
+ $cnb_utils = new CnbUtils();
94
+ $notshowingcoupon = $cnb_utils->get_query_val( 'notshowingcoupon' );
95
+ if ( $notshowingcoupon ) { // hiding this block for now
96
+ $coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
97
+ if ( $coupon != null && ! is_wp_error( $coupon ) ) { ?>
98
+ <div class="cnb-welcome-blocks ">
99
+ <div class="cnb-coupon-details">
100
+ <h5>USE COUPON <code class="cnb-coupon-code"><?php echo esc_html( $coupon->code ); ?></code> FOR
101
+ EXTRA <?php echo esc_html( $coupon->get_discount() ); ?> DISCOUNT</h5>
102
+ <p>Add coupon code <code class="cnb-coupon-code"><?php echo esc_html( $coupon->code ); ?></code>
103
+ during checkout for an extra
104
+ <strong><?php echo esc_html( $coupon->get_discount() ); ?></strong>
105
+ off <?php echo esc_html( $coupon->get_period() ); ?> <?php echo esc_html( $coupon->get_plan() ); ?>
106
+ .</div>
107
+ <?php if ( $coupon->redeemByDate ) { ?>
108
+ <div class="cnb_align_right cnb-coupon-timer" id="cnb-coupon-expiration-countdown"
109
+ data-coupon-expiration-time="<?php echo esc_attr( $coupon->redeemBy ); ?>">
110
+ Coupon expires in <?php echo esc_html( $coupon->get_redeem_by() ) ?>
111
+ </div>
112
+ <?php } else { ?>
113
+ <div class="cnb_align_right cnb-coupon-timer">&nbsp;</div>
114
+ <?php } ?>
115
+ </div>
116
+ <?php
117
+ }
118
+ }
119
+ }
120
+
121
+ private function render_payment_cancelled_message() {
122
+ $cnb_utils = new CnbUtils();
123
+ $upgrade_msg = $cnb_utils->get_query_val( 'upgrade' );
124
+ if ( $upgrade_msg === 'success?payment=cancelled' ) {
125
+ $coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
126
+ ?>
127
+ <div class="cnb-welcome-blocks ">
128
+ <?php if ( $coupon != null && ! is_wp_error( $coupon ) ) { ?>
129
+ <h2>Discount available</h2>
130
+ <p>Use coupon <code><?php echo esc_html( $coupon->code ); ?></code> during checkout to receive an
131
+ extra <?php echo esc_html( $coupon->get_discount() ); ?>
132
+ off <?php echo esc_html( $coupon->get_period() ); ?> <?php echo esc_html( $coupon->get_plan() ); ?>
133
+ .</p>
134
+ <?php } ?>
135
+ <h2>Any questions?</h2>
136
+ <p>If you have any questions at all, feel free to contact us at <a href="mailto:hello@nowbuttons.com">hello@nowbuttons.com</a>.
137
+ </p>
138
+ </div>
139
+ <?php }
140
+ }
141
+
142
+ private function render_js_to_hide_currency( $user ) {
143
+ $active_currency = $this->get_active_currency( $user );
144
  if ( $active_currency ) {
145
  // We already know the currency, so a "select currency" tab menu makes no sense
146
  echo '<script>';
151
 
152
  /**
153
  * @param $domain CnbDomain
154
+ * @param $additional_id_value string. Default is 0 but required for the toggle if more occurrences on the same page (ID should be unique)
155
  *
156
  * @return void
157
  */
158
+ public function render_upgrade_form( $domain, $additional_id_value = '' ) {
159
  global $cnb_user;
160
+ $this->render_js_to_hide_currency( $cnb_user );
161
+ $plans = CnbAppRemotePayment::cnb_remote_get_plans();
162
+ $active_currency = $this->get_active_currency( $cnb_user );
163
  ?>
164
+
165
+ <?php if ( ! $active_currency ) { ?>
166
+ <div class="cnb-currency-toggle">
167
+ <span class="cnb_currency_active cnb_currency_active_eur" style="font-weight:bold">EUR</span>
168
+ <input id="cnb-currency-toggle<?php echo esc_attr( $additional_id_value ) ?>"
169
+ class="cnb-currency-toggle-cb cnb_toggle_checkbox" name="currency" type="checkbox"
170
+ value="usd"/>
171
+ <label for="cnb-currency-toggle<?php echo esc_attr( $additional_id_value ) ?>" class="cnb_toggle_label">Toggle</label>
172
+ <span style="display: inline-block; margin-left: 4px;"
173
+ class="cnb_currency_active cnb_currency_active_usd">USD</span>
174
+ </div>
175
+ <?php } ?>
176
  <form id="wp_domain_upgrade" method="post">
177
  <input type="hidden" name="cnb_domain_id" id="cnb_domain_id" value="<?php echo esc_attr( $domain->id ) ?>">
178
 
179
  <div class="cnb-price-plans">
180
+ <div class="currency-box currency-box-eur cnb-flexbox" style="<?php if ( $active_currency === 'usd' ) {
181
+ echo 'display:none';
182
+ } ?>">
 
 
 
183
  <?php
184
+ $plan_year = $this->get_plan( $plans, 'powered-by-eur-yearly' );
185
  $plan_year_monthly = $plan_year->price / 12;
186
+ $plan_x = floor( $plan_year_monthly );
187
+ $plan_y = round( ( $plan_year_monthly ) - floor( $plan_year_monthly ), 2 ) * 100;
188
  ?>
189
 
190
+ <div class="cnb-pricebox cnb-currency-box currency-box-active">
191
+
192
+ <h3 class="cnb-price-eur">Yearly billing</h3>
193
 
194
  <div class="plan-amount"><span class="currency">€</span><span
195
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
196
  class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
197
  </div>
198
  <div class="billingprice">
199
+ <span class="">Billed &euro;<?php echo esc_html( number_format( $plan_year->price, 2, '.', '' ) ); ?> every 12 months.<br>VAT may apply</span>
200
+ </div>
201
+
202
+ <?php if ( $plan_year->trialPeriodDays && $plan_year->trialPeriodDays > 0 ) { ?>
203
+ <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
204
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Try <?php echo esc_html( $plan_year->trialPeriodDays ) ?>
205
+ days free</a>
206
+ <?php } else { ?>
207
+ <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
208
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Upgrade now</a>
209
+ <?php } ?>
210
+ </div>
211
+ <?php
212
+ $plan = $this->get_plan( $plans, 'powered-by-eur-monthly' );
213
+ $plan_x = floor( $plan->price );
214
+ $plan_y = round( ( $plan->price ) - floor( $plan->price ), 2 ) * 100;
215
+ ?>
216
+ <div class="cnb-pricebox cnb-currency-box currency-box-active">
217
+ <h3 class="cnb-price-usd">Monthly billing</h3>
218
+
219
+ <div class="plan-amount"><span class="currency">&euro;</span><span
220
+ class="euros"><?php echo esc_html( $plan_x ) ?></span><span
221
+ class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
222
+ </div>
223
+ <div class="billingprice">
224
+ <span class="">Billed monthly.<br>VAT may apply</span>
225
  </div>
226
 
227
+ <?php if ( $plan_year->trialPeriodDays && $plan_year->trialPeriodDays > 0 ) { ?>
228
+ <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
229
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Try <?php echo esc_html( $plan_year->trialPeriodDays ) ?>
230
+ days free</a>
231
+ <?php } else { ?>
232
+ <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
233
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Upgrade now</a>
234
+ <?php } ?>
235
  </div>
236
 
237
+ </div>
238
+ <div class="currency-box currency-box-usd cnb-flexbox"
239
+ style="<?php if ( $active_currency !== 'usd' ) { ?>display:none<?php } ?>">
240
  <?php
241
+ $plan_year = $this->get_plan( $plans, 'powered-by-usd-yearly' );
242
  $plan_year_monthly = $plan_year->price / 12;
243
+ $plan_x = floor( $plan_year_monthly );
244
+ $plan_y = round( ( $plan_year_monthly ) - floor( $plan_year_monthly ), 2 ) * 100;
245
+ ?>
246
+
247
+ <div class="cnb-pricebox cnb-currency-box currency-box-active">
248
+ <h3 class="cnb-price-eur">Yearly billing</h3>
249
 
250
+ <div class="plan-amount"><span class="currency">$</span><span
251
+ class="euros"><?php echo esc_html( $plan_x ) ?></span><span
252
+ class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
253
+ </div>
254
+ <div class="billingprice">
255
+ <span class="">Billed $<?php echo esc_html( number_format( $plan_year->price, 2, '.', '' ) ); ?> every 12 months.<br>VAT may apply</span>
256
+ </div>
257
+
258
+ <?php if ( $plan_year->trialPeriodDays && $plan_year->trialPeriodDays > 0 ) { ?>
259
+ <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#"
260
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Try <?php echo esc_html( $plan_year->trialPeriodDays ) ?>
261
+ days free</a>
262
+ <?php } else { ?>
263
+ <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#"
264
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Upgrade now</a>
265
+ <?php } ?>
266
+ </div>
267
+
268
+ <?php
269
+ $plan = $this->get_plan( $plans, 'powered-by-usd-monthly' );
270
+ $plan_x = floor( $plan->price );
271
+ $plan_y = round( ( $plan->price ) - floor( $plan->price ), 2 ) * 100;
272
  ?>
273
+ <div class="cnb-pricebox cnb-currency-box currency-box-active">
274
+ <h3 class="cnb-price-usd">Monthly billing</h3>
 
275
 
276
  <div class="plan-amount"><span class="currency">$</span><span
277
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
278
  class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
279
  </div>
280
  <div class="billingprice">
281
+ <span class="">Billed monthly.<br>VAT may apply</span>
282
  </div>
283
 
284
+ <?php if ( $plan_year->trialPeriodDays && $plan_year->trialPeriodDays > 0 ) { ?>
285
+ <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#"
286
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Try <?php echo esc_html( $plan_year->trialPeriodDays ) ?>
287
+ days free</a>
288
+ <?php } else { ?>
289
+ <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#"
290
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Upgrade now</a>
291
+ <?php } ?>
292
  </div>
293
 
294
  </div>
297
  <?php
298
  }
299
 
300
+ public function render_pro_features_nice_view() {
301
+ $plans = CnbAppRemotePayment::cnb_remote_get_plans();
302
+ $plan_year = $this->get_plan( $plans, 'powered-by-usd-yearly' ); ?>
303
+
304
+ <div class="cnb-block">
305
+
306
+ <?php if ( $plan_year->trialPeriodDays && $plan_year->trialPeriodDays > 0 ) { ?>
307
+ <h1>Try <b>PRO</b> <?php echo esc_html( $plan_year->trialPeriodDays ) ?> days for FREE!</h1>
308
+ <h3>Upgrade today and try out all professional
309
+ features <?php echo esc_html( $plan_year->trialPeriodDays ) ?> days for free!</h3>
310
+ <?php } else { ?>
311
+ <h1><b>Upgrade to PRO</b> and enjoy everything NowButtons has to offer!</h1>
312
+ <?php } ?>
313
+
314
+
315
+ <br>
316
+ <h2>The scheduler</h2>
317
+ <img src="<?php echo esc_url( WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/button-scheduler.png' ); ?>"
318
+ alt="The scheduler">
319
+ <p>Control exactly when your buttons are displayed. Maybe a call button during business hours and a mail
320
+ buttons when you're closed.</p>
321
+ <div class="cnb-divider"></div>
322
+ <h2>Icon selection with each action</h2>
323
+ <img class="cnb-width-80 cnb-extra-space"
324
+ src="<?php echo esc_url( WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/cnb-icons-actions.png' ); ?>"
325
+ alt="WhatsApp modal">
326
+
327
+ <div class="cnb-divider"></div>
328
+
329
+ <h2>Add WhatsApp Chat to your website</h2>
330
+ <img src="<?php echo esc_url( WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/whatsapp-modal.png' ); ?>"
331
+ alt="WhatsApp modal">
332
+ <p>Start the WhatsApp conversation on your website.</p>
333
+
334
+ <div class="cnb-divider"></div>
335
+
336
+ <h2>Multibutton</h2>
337
+ <img class="cnb-width-80"
338
+ src="<?php echo esc_url( WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/multibutton.png' ); ?>"
339
+ alt="Multibutton">
340
+ <p>Takes up little space but reveals a treasure of options. Add an infinite number of actions to the
341
+ Multibutton.</p>
342
+
343
+ <div class="cnb-divider"></div>
344
+
345
+ <h2>Buttonbar</h2>
346
+ <img class="cnb-width-80"
347
+ src="<?php echo esc_url( WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/buttonbar.png' ); ?>"
348
+ alt="Buttonbar">
349
+ <p>Create a web app experience on your website with the Buttonbar. Add up to 5 actions to the Buttonbar that
350
+ sits fixed at the bottom or top of your page.</p>
351
+
352
+ </div>
353
+ <?php }
354
+
355
+ public function render_pro_features_extras() {
356
+ ?>
357
+ <div class="cnb-block">
358
+ <h2>Plus...</h2>
359
+ <div class="cnb-center">
360
+ <div class="cnb-pro-tile">
361
+ <h3>👋 Button animations</h3>
362
+ <p>Add an extra animation effect to your button to draw more attention to it.</p>
363
+ </div>
364
+ <div class="cnb-pro-tile">
365
+ <h3>📄 Slide-in content windows</h3>
366
+ <p>Add any content to your slide-in window. E.g. a form, quick links, a YouTube video, etc.</p>
367
+ </div>
368
+ <div class="cnb-pro-tile">
369
+ <h3>📷 Use custom images on buttons</h3>
370
+ <p>Freedom to use your own image on a button. E.g. add a headshot to your contact button to make it
371
+ more personal.</p>
372
+ </div>
373
+ <div class="cnb-pro-tile">
374
+ <h3>👮 More advanced Display rules</h3>
375
+ <p>Create more sophisticated Display rules with RegEx rules and parameter filtering (e.g. for ad
376
+ campaigns).</p>
377
+ </div>
378
+ <div class="cnb-pro-tile">
379
+ <h3>🌍 Include and exclude countries</h3>
380
+ <p>Show different contact details depending on the visitor's location.</p>
381
+ </div>
382
+ <div class="cnb-pro-tile">
383
+ <h3>↕️ Set scroll height for buttons to appear</h3>
384
+ <p>Don't want to distract people from your hero section? Set a scroll height so your buttons appear
385
+ when a user has scrolled past it.</p>
386
+ </div>
387
+ <div class="cnb-pro-tile">
388
+ <h3>🔌 Intercom Chat integration</h3>
389
+ <p>Intercom customers can use our buttons, animations and scheduler to fire the Intercom chat
390
+ window.</p>
391
+ </div>
392
+ </div>
393
+ <h2>...and much more!</h2>
394
+ </div>
395
+ <?php
396
+ }
397
+
398
+ public function render_pro_feature_comparison() {
399
+ ?>
400
+ <div class="cnb-block">
401
+ <table class="cnb-nb-plans">
402
+ <thead>
403
+ <tr>
404
+ <td></td>
405
+ <th><h3>Starter (Free)</h3></th>
406
+ <th><h3>Pro</h3></th>
407
+ </tr>
408
+ </thead>
409
+ <tbody>
410
+ <tr class="line">
411
+ <td>&nbsp;</td>
412
+ <td></td>
413
+ <td></td>
414
+ </tr>
415
+ <tr>
416
+ <th>No. of buttons</th>
417
+ <td class="value">5</td>
418
+ <td class="value">100</td>
419
+ </tr>
420
+ <tr>
421
+ <th>Multiple buttons per page
422
+ <span class="cnb-tooltip-icon">?</span>
423
+ <div class="cnb-tooltip-text">
424
+ PRO users can add up to 8 buttons on a single page.
425
+ </div>
426
+ </th>
427
+ <td>𐄂</td>
428
+ <td class="yes">✓</td>
429
+ </tr>
430
+ <tr class="line">
431
+ <td>&nbsp;</td>
432
+ <td></td>
433
+ <td></td>
434
+ </tr>
435
+ <tr>
436
+ <th>Phone</th>
437
+ <td class="yes">✓</td>
438
+ <td class="yes">✓</td>
439
+ </tr>
440
+ <tr>
441
+ <th>SMS/Text</th>
442
+ <td class="yes">✓</td>
443
+ <td class="yes">✓</td>
444
+ </tr>
445
+ <tr>
446
+ <th>Email</th>
447
+ <td class="yes">✓</td>
448
+ <td class="yes">✓</td>
449
+ </tr>
450
+ <tr>
451
+ <th>Maps
452
+ <span class="cnb-tooltip-icon">?</span>
453
+ <div class="cnb-tooltip-text">
454
+ The button will open the Google Maps or Apple Maps app to show the location or prompt for
455
+ the input of an origin to give travel directions.
456
+ </div>
457
+ </th>
458
+ <td class="yes">✓</td>
459
+ <td class="yes">✓</td>
460
+ </tr>
461
+ <tr>
462
+ <th>URLs</th>
463
+ <td class="yes">✓</td>
464
+ <td class="yes">✓</td>
465
+ </tr>
466
+ <tr>
467
+ <th>Scroll to point
468
+ <span class="cnb-tooltip-icon">?</span>
469
+ <div class="cnb-tooltip-text">
470
+ Scroll to point enables you to create a button that triggers a smooth scroll through the
471
+ page to a selected point.<br><br>E.g. a Back-to-top button
472
+ </div>
473
+ </th>
474
+ <td class="yes">✓</td>
475
+ <td class="yes">✓</td>
476
+ </tr>
477
+ <tr>
478
+ <th>WhatsApp
479
+ <span class="cnb-tooltip-icon">?</span>
480
+ <div class="cnb-tooltip-text">
481
+ A WhatsApp button that starts a conversation with you directly in the WhatsApp app.
482
+ </div>
483
+ </th>
484
+ <td class="yes">✓</td>
485
+ <td class="yes">✓</td>
486
+ </tr>
487
+ <tr>
488
+ <th>Messenger
489
+ <span class="cnb-tooltip-icon">?</span>
490
+ <div class="cnb-tooltip-text">
491
+ A button that opens the Messenger app and starts a conversation with you.
492
+ </div>
493
+ </th>
494
+ <td class="yes">✓</td>
495
+ <td class="yes">✓</td>
496
+ </tr>
497
+ <tr>
498
+ <th>Telegram
499
+ <span class="cnb-tooltip-icon">?</span>
500
+ <div class="cnb-tooltip-text">
501
+ A button that opens the Telegram app and starts a conversation with you.
502
+ </div>
503
+ </th>
504
+ <td class="yes">✓</td>
505
+ <td class="yes">✓</td>
506
+ </tr>
507
+ <tr>
508
+ <th>Signal
509
+ <span class="cnb-tooltip-icon">?</span>
510
+ <div class="cnb-tooltip-text">
511
+ A button that opens the Signal app and starts a conversation with you.
512
+ </div>
513
+ </th>
514
+ <td class="yes">✓</td>
515
+ <td class="yes">✓</td>
516
+ </tr>
517
+ <tr class="line">
518
+ <td>&nbsp;</td>
519
+ <td></td>
520
+ <td></td>
521
+ </tr>
522
+ <tr>
523
+ <th>WhatsApp Chat window
524
+ <span class="cnb-tooltip-icon">?</span>
525
+ <div class="cnb-tooltip-text">
526
+ A button that fires a WhatsApp chat window right on your website where you can greet the
527
+ visitor. You can automate multiple speech bubbles which appear in sequence.<br>The WhatsApp
528
+ app is opened once the visitor engages in the conversation.
529
+ </div>
530
+ </th>
531
+ <td>𐄂</td>
532
+ <td class="yes">✓</td>
533
+ </tr>
534
+ <tr>
535
+ <th>Intercom chat (integration)
536
+ <span class="cnb-tooltip-icon">?</span>
537
+ <div class="cnb-tooltip-text">
538
+ Create a button to open the Intercom chat window. This way the Intercom button will match
539
+ nicely with your other buttons and allows you to combine it with the scheduler. You can also
540
+ place it inside a Multibutton or Buttonbar.
541
+ </div>
542
+ </th>
543
+ <td>𐄂</td>
544
+ <td class="yes">✓</td>
545
+ </tr>
546
+ <tr>
547
+ <th>Content Windows
548
+ <span class="cnb-tooltip-icon">?</span>
549
+ <div class="cnb-tooltip-text">
550
+ Opened by a button, the Content Window enables you to add any content to a small window that
551
+ slides into the screen.<br><br>A great use-case is showing a booking form without sending
552
+ visitors off the page.
553
+ </div>
554
+ </th>
555
+ <td>𐄂</td>
556
+ <td class="yes">✓</td>
557
+ </tr>
558
+ <tr>
559
+ <th>Tally Form window
560
+ <span class="cnb-tooltip-icon">?</span>
561
+ <div class="cnb-tooltip-text">
562
+ With this integration you only need a form ID to place a Tally contact form inside a
563
+ slide-in Content Window.
564
+ </div>
565
+ </th>
566
+ <td>𐄂</td>
567
+ <td class="yes">✓</td>
568
+ </tr>
569
+ <tr class="line">
570
+ <td>&nbsp;</td>
571
+ <td></td>
572
+ <td></td>
573
+ </tr>
574
+ <tr>
575
+ <th>Change button icons</th>
576
+ <td>𐄂</td>
577
+ <td class="yes">✓</td>
578
+ </tr>
579
+ <tr>
580
+ <th>Custom button images
581
+ <span class="cnb-tooltip-icon">?</span>
582
+ <div class="cnb-tooltip-text">
583
+ Instead of an icon you can add your own image to your button.<br><br>E.g. add a headshot of
584
+ the person answering the phone to make it more personal.
585
+ </div>
586
+ </th>
587
+ <td>𐄂</td>
588
+ <td class="yes">✓</td>
589
+ </tr>
590
+ <tr>
591
+ <th>Appear after scrolling
592
+ <span class="cnb-tooltip-icon">?</span>
593
+ <div class="cnb-tooltip-text">
594
+ Set the number of pixels your visitors have to scroll down before the button
595
+ appears.<br><br>E.g. combine it with the Scroll-to-point action to create a back-to-top
596
+ button.
597
+ </div>
598
+ </th>
599
+ <td>𐄂</td>
600
+ <td class="yes">✓</td>
601
+ </tr>
602
+ <tr class="line">
603
+ <td>&nbsp;</td>
604
+ <td></td>
605
+ <td></td>
606
+ </tr>
607
+ <tr>
608
+ <th>Single button</th>
609
+ <td class="yes">✓</td>
610
+ <td class="yes">✓</td>
611
+ </tr>
612
+ <tr>
613
+ <th>Buttonbar (single action)
614
+ <span class="cnb-tooltip-icon">?</span>
615
+ <div class="cnb-tooltip-text">
616
+ The Buttonbar is a bar of one or more buttons that sits at the top or bottom of your screen.
617
+ In the Starter plan the Buttonbar only offers a single action.
618
+ </div>
619
+ </th>
620
+ <td class="yes">✓</td>
621
+ <td class="yes">✓</td>
622
+ </tr>
623
+ <tr>
624
+ <th>Buttonbar (multi-action)
625
+ <span class="cnb-tooltip-icon">?</span>
626
+ <div class="cnb-tooltip-text">
627
+ The multi-action Buttonbar can hold up to 5 actions.
628
+ </div>
629
+ </th>
630
+ <td>𐄂</td>
631
+ <td class="yes">✓</td>
632
+ </tr>
633
+ <tr>
634
+ <th>Multibutton
635
+ <span class="cnb-tooltip-icon">?</span>
636
+ <div class="cnb-tooltip-text">
637
+ The Multibutton shows a single circular button but expands into multiple buttons when
638
+ clicked.
639
+ </div>
640
+ </th>
641
+ <td>𐄂</td>
642
+ <td class="yes">✓</td>
643
+ </tr>
644
+ <tr class="line">
645
+ <td>&nbsp;</td>
646
+ <td></td>
647
+ <td></td>
648
+ </tr>
649
+ <tr>
650
+ <th>Mobile + Desktop
651
+ <span class="cnb-tooltip-icon">?</span>
652
+ <div class="cnb-tooltip-text">
653
+ Buttons can be displayed on all screen sizes.
654
+ </div>
655
+ </th>
656
+ <td class="yes">✓</td>
657
+ <td class="yes">✓</td>
658
+ </tr>
659
+ <tr>
660
+ <th>Scheduler
661
+ <span class="cnb-tooltip-icon">?</span>
662
+ <div class="cnb-tooltip-text">
663
+ Schedule your buttons to appear on the right days and the right times.<br>The scheduler can
664
+ be used on each action, so you can change the contents of multi-action buttons throughout the
665
+ day.<br><br>E.g. a phone button during working hours and a contact form when you're closed.
666
+ </div>
667
+ </th>
668
+ <td>𐄂</td>
669
+ <td class="yes">✓</td>
670
+ </tr>
671
+ <tr>
672
+ <th>Button animations
673
+ <span class="cnb-tooltip-icon">?</span>
674
+ <div class="cnb-tooltip-text">
675
+ Draw more attention to your buttons by adding delicate animations.
676
+ </div>
677
+ </th>
678
+ <td>𐄂</td>
679
+ <td class="yes">✓</td>
680
+ </tr>
681
+ <tr>
682
+ <th>Display rules (Basic)
683
+ <span class="cnb-tooltip-icon">?</span>
684
+ <div class="cnb-tooltip-text">
685
+ Create simple rules for where your buttons should appear. They can match an exact url, a
686
+ path or if the url contains a string.
687
+ </div>
688
+ </th>
689
+ <td class="yes">✓</td>
690
+ <td class="yes">✓</td>
691
+ </tr>
692
+ <tr>
693
+ <th>Display rules (Advanced)
694
+ <span class="cnb-tooltip-icon">?</span>
695
+ <div class="cnb-tooltip-text">
696
+ With the advanced display rules you can set rules on parameters (great in combination with
697
+ PPC campaigns) and use RegEx to create even more powerful rules.
698
+ </div>
699
+ </th>
700
+ <td>𐄂</td>
701
+ <td class="yes">✓</td>
702
+ </tr>
703
+ <tr>
704
+ <th>Geo targeting
705
+ <span class="cnb-tooltip-icon">?</span>
706
+ <div class="cnb-tooltip-text">
707
+ Show the right contact options to the right people. With Geo display rules you tailor the
708
+ buttons to the visitor's country.
709
+ </div>
710
+ </th>
711
+ <td>𐄂</td>
712
+ <td class="yes">✓</td>
713
+ </tr>
714
+ <tr>
715
+ <th>Click tracking in GA
716
+ <span class="cnb-tooltip-icon">?</span>
717
+ <div class="cnb-tooltip-text">
718
+ With a single click you can enable event tracking in Google Analytics to get insights into
719
+ button engagement on your website.
720
+ </div>
721
+ </th>
722
+ <td class="yes">✓</td>
723
+ <td class="yes">✓</td>
724
+ </tr>
725
+ <tr>
726
+ <th>Google Ads conversion tracking
727
+ <span class="cnb-tooltip-icon">?</span>
728
+ <div class="cnb-tooltip-text">
729
+ Enable conversion tracking on your Google Ads landing pages so when a paid visitor clicks on
730
+ the button it's measured as a conversion.
731
+ </div>
732
+ </th>
733
+ <td class="yes">✓</td>
734
+ <td class="yes">✓</td>
735
+ </tr>
736
+ <tr>
737
+ <th>Live preview
738
+ <span class="cnb-tooltip-icon">?</span>
739
+ <div class="cnb-tooltip-text">
740
+ Displays a real-time preview of the buttons your building. PRO can simulate the day and time
741
+ to test scheduled buttons.
742
+ </div>
743
+ </th>
744
+ <td class="yes">✓</td>
745
+ <td class="yes">✓</td>
746
+ </tr>
747
+ </tbody>
748
+ </table>
749
+ </div>
750
+ <?php
751
  }
752
 
753
  /**
src/admin/getting-started/class-getting-started-view.php CHANGED
@@ -29,59 +29,61 @@ class GettingStartedView {
29
  <h1>Welcome to Call Now Button</h1>
30
  <h3>Thank you for choosing Call Now Button - The web's most popular click-to-call button</h3>
31
  <div class="cnb-divider"></div>
32
- <h2>Create an account to enable additional features:</h2>
33
- <div class="cnb-block cnb-features-list">
34
- <div class="cnb-column cnb-col-1">
35
- <h3>👋 Additional actions</h3>
36
- <p>SMS/Text, Email, Maps, URLs, Scroll to top</p>
37
- <h3>🤗 Social chat</h3>
38
- <p>WhatsApp, Messenger, Telegram, Signal</p>
39
- <h3>🆕 Lots of buttons</h3>
40
- <p>Multiple buttons for your website, even on a single page</p>
41
- <h3>🗂️ Multi action buttons</h3>
42
- <p>Multibutton (expandable) and Buttonbar (full width)</p>
43
- <h3>💬 WhatsApp chat modal</h3>
44
- <p>A WhatsApp chat panel to slide into the screen</p>
45
- </div>
46
 
47
- <div class="cnb-column cnb-col-2">
 
 
 
 
 
 
48
  <h3>🖥️ All devices</h3>
49
  <p>Desktop/laptop and mobile support</p>
50
- <h3>🎯 Advanced page targeting</h3>
51
- <p>Create smart rules for your buttons to appear</p>
52
- <h3>🕘 Scheduler</h3>
53
- <p>Create a weekly schedule for your buttons</p>
54
- <h3>👋 Animations</h3>
55
- <p>Add extra attention grabbing animations</p>
56
- <h3>🎨 Icon picker</h3>
57
- <p>Select the right icon for your button</p>
58
- <h3>👽 3rd party integrations</h3>
59
- <p>Content Windows, Intercom chat and Tally forms</p>
60
 
61
- </div>
62
  </div>
63
  <div class="cnb-block cnb-signup-box">
64
- <h2>Sign up now to get all this and more</h2>
 
65
  <?php echo CnbHeaderNotices::cnb_settings_email_activation_input(); // phpcs:ignore WordPress.Security ?>
66
  </div>
67
- <div class="cnb-divider"></div>
68
- <p><i>Only need a Call button? <a href="<?php echo esc_url( $link ) ?>">Continue without an account</a>.</i></p>
69
  </div>
70
- <div class="cnb-welcome-blocks">
71
-
72
  <div class="cnb-block">
73
- <h1>Why do I need an account?</h1>
74
- <h3>With an account you enable the cloud features from callnowbutton.com.</h3>
75
- <p>Here's a close-up of some of the cloud features:</p>
76
- <div class="cnb-divider"></div>
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
- <h2>🎁 More actions and icons 🎁</h2>
 
 
79
  <img class="cnb-width-80 cnb-extra-space" src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/cnb-icons-actions.png');?>" alt="WhatsApp modal">
80
- <p>New actions include WhatsApp, SMS/Text, Email, Signal, Telegram, Messenger, Location, Link and Smooth scroll to point.</p>
81
 
82
  <div class="cnb-divider"></div>
83
 
84
- <h2>💬 Pop up windows for WhatsApp, iframes & more 💬</h2>
85
  <img src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/whatsapp-modal.png');?>" alt="WhatsApp modal">
86
  <p>Start the WhatsApp conversation on your website.</p>
87
 
@@ -103,29 +105,32 @@ class GettingStartedView {
103
  <img src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/button-scheduler.png');?>" alt="The scheduler">
104
  <p>Control exactly when your buttons are displayed. Maybe a call button during business hours and a mail buttons when you're closed.</p>
105
 
106
- <div class="cnb-divider"></div>
107
- <h3>And much more!</h3>
108
- </div>
109
- </div>
110
- <div class="cnb-welcome-blocks">
111
- <h2>PRO features include</h2>
112
- <div class="cnb-center">
113
- <h3>📄 Slide-in content windows</h3>
114
- <h3>📷 Use custom images on buttons</h3>
115
- <h3>🌍 Include and exclude countries</h3>
116
- <h3>↕️ Set scroll height for buttons to appear</h3>
117
- <h3>🔌 Intercom Chat integration</h3>
118
  </div>
119
  </div>
 
120
  </div>
121
- <div class="cnb-welcome-blocks">
122
- <div class="cnb-block cnb-signup-box">
123
- <h2>Create your free account and supercharge your Call Now Button.</h2>
124
- <?php echo CnbHeaderNotices::cnb_settings_email_activation_input(); // phpcs:ignore WordPress.Security ?>
125
- </div>
126
- <div class="cnb-divider"></div>
127
- <p><i>Only need a Call button? <a href="<?php echo esc_url( $link ) ?>">Continue without an account</a>.</i></p>
128
  </div>
 
 
 
 
 
 
 
129
 
130
  <?php }
131
  }
29
  <h1>Welcome to Call Now Button</h1>
30
  <h3>Thank you for choosing Call Now Button - The web's most popular click-to-call button</h3>
31
  <div class="cnb-divider"></div>
32
+ <p>If you just need a call button, <a href="<?php echo esc_url( $link ) ?>">click here</a> to continue.</p>
33
+ <div class="cnb-divider"></div>
34
+ <h2>👋 Connect with NowButtons.com to get more actions...</h2>
35
+ <div class="cnb-block">
36
+
37
+ <h3 style="line-height:1.9">
38
+ <span>WhatsApp</span> ✨ <span>Messenger</span> ✨ <span>Telegram</span> ✨ <span>Signal</span> <br> <span>SMS/Text</span> ✨ <span>Email</span><br><span>Location</span> ✨ <span>URLs</span> ✨ <span>Scroll to Point</span>
39
+ </h3>
 
 
 
 
 
 
40
 
41
+ <br>
42
+ <h2>...and enable more features!</h2>
43
+ <br>
44
+
45
+
46
+ <h3>🆕 4 extra buttons</h3>
47
+ <p>Get 5 buttons instead of 1</p>
48
  <h3>🖥️ All devices</h3>
49
  <p>Desktop/laptop and mobile support</p>
50
+ <h3>🎯 Display rules</h3>
51
+ <p>Create smarter rules for your buttons to appear</p>
 
 
 
 
 
 
 
 
52
 
 
53
  </div>
54
  <div class="cnb-block cnb-signup-box">
55
+ <br>
56
+ <h2>Sign up now to enable all of this for free</h2>
57
  <?php echo CnbHeaderNotices::cnb_settings_email_activation_input(); // phpcs:ignore WordPress.Security ?>
58
  </div>
 
 
59
  </div>
60
+ <div class="cnb-welcome-blocks cnb-welcome-blocks-plain">
 
61
  <div class="cnb-block">
62
+ <p><i>Only need a Call button? <a href="<?php echo esc_url( $link ) ?>">Continue without an account</a>.</i></p>
63
+ </div>
64
+ </div>
65
+ <div class="cnb-welcome-blocks">
66
+ <div class="cnb-block">
67
+ <h1>Why do I need an account?</h1>
68
+ <h3>With an account you enable the cloud features from nowbuttons.com.</h3>
69
+ <p>Once you've signed up you directly have access to the features described above. <strong>Completely FREE!</strong></p>
70
+ <div class="cnb-block cnb-signup-box">
71
+ <?php echo CnbHeaderNotices::cnb_settings_email_activation_input(); // phpcs:ignore WordPress.Security ?>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ <div class="cnb-welcome-blocks">
76
+ <div class="cnb-block">
77
+ <h1>Upgrade to PRO to get even more!</h1>
78
 
79
+
80
+ <br>
81
+ <h2>🎁 Icon selection with each action 🎁</h2>
82
  <img class="cnb-width-80 cnb-extra-space" src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/cnb-icons-actions.png');?>" alt="WhatsApp modal">
 
83
 
84
  <div class="cnb-divider"></div>
85
 
86
+ <h2>💬 Add WhatsApp Chat to your website 💬</h2>
87
  <img src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/whatsapp-modal.png');?>" alt="WhatsApp modal">
88
  <p>Start the WhatsApp conversation on your website.</p>
89
 
105
  <img src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/button-scheduler.png');?>" alt="The scheduler">
106
  <p>Control exactly when your buttons are displayed. Maybe a call button during business hours and a mail buttons when you're closed.</p>
107
 
108
+ <br>
109
+ <h2>Plus...</h2>
110
+ <div class="cnb-center">
111
+ <h3>📄 Slide-in content windows</h3>
112
+ <h3>📷 Use custom images on buttons</h3>
113
+ <h3>🌍 Include and exclude countries</h3>
114
+ <h3>↕️ Set scroll height for buttons to appear</h3>
115
+ <h3>🔌 Intercom Chat integration</h3>
116
+ </div>
117
+ <h2>...and much more!</h2>
 
 
118
  </div>
119
  </div>
120
+
121
  </div>
122
+ <div class="cnb-welcome-blocks">
123
+ <div class="cnb-block cnb-signup-box">
124
+ <h2>Create your free account and supercharge your Call Now Button.</h2>
125
+ <?php echo CnbHeaderNotices::cnb_settings_email_activation_input(); // phpcs:ignore WordPress.Security ?>
 
 
 
126
  </div>
127
+ </div>
128
+
129
+ <div class="cnb-welcome-blocks cnb-welcome-blocks-plain">
130
+ <div class="cnb-block cnb-signup-box">
131
+ <p><i>Only need a Call button? <a href="<?php echo esc_url( $link ) ?>">Continue without an account</a>.</i></p>
132
+ </div>
133
+ </div>
134
 
135
  <?php }
136
  }
src/admin/legacy/CnbLegacyEdit.php CHANGED
@@ -197,21 +197,20 @@ class CnbLegacyEdit {
197
  </td>
198
  </tr>
199
  <tr>
200
- <th scope="row"><label for="cnb_action_type">Button type</label></th>
201
  <td>
202
  <select>
203
  <option selected="selected">Phone</option>
204
- <option disabled>Email*</option>
205
- <option disabled>SMS/Text*</option>
206
- <option disabled>WhatsApp*</option>
207
- <option disabled>Messenger*</option>
208
- <option disabled>Signal*</option>
209
- <option disabled>Telegram*</option>
210
- <option disabled>Link*</option>
211
- <option disabled>Google Maps*</option>
212
- <option disabled>Anchor*</option>
213
  </select>
214
- <p class="description">*<a href="<?php echo esc_url(( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()); ?>">Create an account</a> to enable these actions</p>
215
  </td>
216
  </tr>
217
 
@@ -355,6 +354,7 @@ class CnbLegacyEdit {
355
  value="exclude" <?php checked( 'exclude', $cnb_options['limit'] ); ?> />
356
  <label for="limit2">Exclude these posts and pages.</label>
357
  </div>
 
358
  </td>
359
  </tr>
360
  <tr class="appearance">
@@ -375,7 +375,7 @@ class CnbLegacyEdit {
375
  </table>
376
  <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'scheduler' ) ) ?>" data-tab-name="scheduler">
377
  <tr>
378
- <th colspan="2"><a href="<?php echo esc_url(( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()); ?>">Create an account</a> to enable the scheduler.</th>
379
  </tr>
380
  <tr class="cnb_disabled_feature">
381
  <th scope="row">Show at all times</th>
@@ -437,6 +437,8 @@ class CnbLegacyEdit {
437
  ?>
438
  </table>
439
  <?php submit_button(); ?>
 
 
440
 
441
  </form>
442
  </div>
@@ -448,35 +450,34 @@ class CnbLegacyEdit {
448
  'purple',
449
  'Unlock extra power',
450
  '<p><span class="cnb-purple">&check;</span> More buttons<br>
451
- <span class="cnb-purple">&check;</span> Text/SMS, Email, Links, Directions<br>
452
- <span class="cnb-purple">&check;</span> Signal, Telegram, Messenger<br>
453
- <span class="cnb-purple">&check;</span> WhatsApp with Chat modal<br>
454
- <span class="cnb-purple">&check;</span> Scheduling<br>
455
- <span class="cnb-purple">&check;</span> Multi action buttons<br>
456
- <span class="cnb-purple">&check;</span> Change icons<br>
457
- <span class="cnb-purple">&check;</span> Button animations<br>
458
  <span class="cnb-purple">&check;</span> Live previews</p>
459
- <p>Enable <strong>Cloud</strong> to get all of this and more!</p>',
460
  'unlock',
461
  '',
462
- 'Create account',
463
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
464
  );
465
  ?>
466
  <?php
467
  ( new CnbAdminFunctions() )->cnb_promobox(
468
  'green',
469
- 'A button for everything!',
470
- '<p>&check; SMS/Text<br>
471
- &check; Email<br>
472
- &check; Messenger, Telegram, Signal<br>
473
- &check; WhatsApp with Chat modal<br>
474
- &check; Directions<br>
475
- &check; Smooth scroll anchors<br>
476
- &check; Links</p>',
 
 
477
  'format-chat',
478
- '<strong>More everything!</strong>',
479
- 'Discover Cloud',
480
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
481
  );
482
  ?>
@@ -484,30 +485,22 @@ class CnbLegacyEdit {
484
  <div class="cnb-on-active-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>">
485
  <?php
486
  ( new CnbAdminFunctions() )->cnb_promobox(
487
- 'blue',
488
- 'Powerful page targeting',
489
  '<p>Do you need more flexibility in selecting the pages where you want a button to appear?</p>
490
- <p>Sign up to unlock 4 methods for selecting the right pages:</p>
491
- <p>&check; Exact URL<br>
492
- &check; Path begins with ...<br>
493
- &check; URL contains<br>
494
- &check; RegEx</p>',
 
 
495
  'visibility',
496
  '',
497
  'Learn more',
498
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
499
  );
500
- ( new CnbAdminFunctions() )->cnb_promobox(
501
- 'blue',
502
- 'Get more for FREE!',
503
- 'Cloud adds a ton of extra power to the Call Now Button.</p>
504
- <p>The free Cloud plan shows a little branding with your buttons and gives you full access to 99% of all features.</p>
505
- <p>Try it out and enjoy scheduling, multiple buttons, more button types, animations and much more!</p>',
506
- 'money-alt',
507
- '',
508
- 'Try Cloud',
509
- ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
510
- );
511
  ?>
512
  </div>
513
  <div class="cnb-on-active-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'scheduler' ) ) ?>">
@@ -515,11 +508,11 @@ class CnbLegacyEdit {
515
  ( new CnbAdminFunctions() )->cnb_promobox(
516
  'purple',
517
  'Phones off at 6pm?',
518
- '<p>Sign up to enable a scheduler that allows you to set the days and hours that you are available.</p>' .
519
- '<p>You can even replace it with an email button during your off-hours so people can still contact you.</p>',
520
  'clock',
521
- '<strong>Use the scheduler!</strong>',
522
- 'Enable cloud',
523
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
524
  );
525
  ?>
197
  </td>
198
  </tr>
199
  <tr>
200
+ <th scope="row"><label for="cnb_action_type">Button action</label></th>
201
  <td>
202
  <select>
203
  <option selected="selected">Phone</option>
204
+ <option disabled>* Email</option>
205
+ <option disabled>* SMS/Text</option>
206
+ <option disabled>* WhatsApp</option>
207
+ <option disabled>* Messenger</option>
208
+ <option disabled>* Signal</option>
209
+ <option disabled>* Telegram</option>
210
+ <option disabled>* Link</option>
211
+ <option disabled>* Location</option>
212
+ <option disabled>* Scroll to point</option>
213
  </select>
 
214
  </td>
215
  </tr>
216
 
354
  value="exclude" <?php checked( 'exclude', $cnb_options['limit'] ); ?> />
355
  <label for="limit2">Exclude these posts and pages.</label>
356
  </div>
357
+ <p class="description">Display Rules give you more control. <a href="<?php echo esc_url(( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()); ?>">Sign up now</a> (it's free).</p>
358
  </td>
359
  </tr>
360
  <tr class="appearance">
375
  </table>
376
  <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'scheduler' ) ) ?>" data-tab-name="scheduler">
377
  <tr>
378
+ <th colspan="2"><a href="<?php echo esc_url(( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()); ?>">Upgrade</a> to enable the scheduler.</th>
379
  </tr>
380
  <tr class="cnb_disabled_feature">
381
  <th scope="row">Show at all times</th>
437
  ?>
438
  </table>
439
  <?php submit_button(); ?>
440
+ <div class="description" data-tab-name="basic_options">* <a href="<?php echo esc_url(( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()); ?>">Create an account</a> to enable extra button actions.</div>
441
+
442
 
443
  </form>
444
  </div>
450
  'purple',
451
  'Unlock extra power',
452
  '<p><span class="cnb-purple">&check;</span> More buttons<br>
453
+ <span class="cnb-purple">&check;</span> Text/SMS, Email<br>
454
+ <span class="cnb-purple">&check;</span> Links, Directions<br>
455
+ <span class="cnb-purple">&check;</span> WhatsApp, Signal<br>
456
+ <span class="cnb-purple">&check;</span> Telegram, Messenger<br>
 
 
 
457
  <span class="cnb-purple">&check;</span> Live previews</p>
458
+ <p><strong>Sign up </strong> to directly enable these extras!</p>',
459
  'unlock',
460
  '',
461
+ 'Sign up now',
462
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
463
  );
464
  ?>
465
  <?php
466
  ( new CnbAdminFunctions() )->cnb_promobox(
467
  'green',
468
+ 'Business Pack',
469
+ '<p>Upgrade to PRO and enable:</p>
470
+ <p>&check; Button scheduler<br>
471
+ &check; WhatsApp Chat module<br>
472
+ &check; Extra actions<br>
473
+ &check; Multi-action buttons<br>
474
+ &check; Slide-in content windows<br>
475
+ &check; Custom images<br>
476
+ &check; And so much more</p>
477
+ <p>Go PRO and give your conversion rates an extra boost.</p>',
478
  'format-chat',
479
+ '',
480
+ 'Learn more',
481
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
482
  );
483
  ?>
485
  <div class="cnb-on-active-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>">
486
  <?php
487
  ( new CnbAdminFunctions() )->cnb_promobox(
488
+ 'purple',
489
+ 'More control with Display Rules',
490
  '<p>Do you need more flexibility in selecting the pages where you want a button to appear?</p>
491
+ <p>Sign up to unlock 3 methods for selecting the right pages:</p>
492
+ <p>&check; Page URL is ...<br>
493
+ &check; Page URL contains ...<br>
494
+ &check; Page path starts with ...</p>
495
+ <p>PRO adds 2 more:</p>
496
+ <p>&check; URL Parameter contains ...<br>
497
+ &check; URL matches RegEx ...</p>',
498
  'visibility',
499
  '',
500
  'Learn more',
501
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
502
  );
503
+
 
 
 
 
 
 
 
 
 
 
504
  ?>
505
  </div>
506
  <div class="cnb-on-active-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'scheduler' ) ) ?>">
508
  ( new CnbAdminFunctions() )->cnb_promobox(
509
  'purple',
510
  'Phones off at 6pm?',
511
+ '<p>Upgrade to enable a scheduler that allows you to set the days and hours that you are available.</p>' .
512
+ '<p>Use the scheduler to show a mail button when you\'re off and a phone button during your business hours.</p>',
513
  'clock',
514
+ '<strong>Try it 14 days free!</strong>',
515
+ 'Upgrade',
516
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
517
  );
518
  ?>
src/admin/legacy/CnbLegacyUpgrade.php CHANGED
@@ -7,95 +7,150 @@ defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\utils\CnbAdminFunctions;
9
  use cnb\CnbHeaderNotices;
10
- use cnb\utils\CnbUtils;
11
 
12
  class CnbLegacyUpgrade {
13
  function header() {
14
- echo 'Activate Cloud to unlock lots of extra features';
15
  }
16
 
17
- private function standard_plugin_promobox() {
18
- ?>
19
- <div class="cnb-body-column hide-on-mobile">
20
- <?php
21
- ( new CnbAdminFunctions() )->cnb_promobox(
22
- 'grey',
23
- 'Lite',
24
- '<p>&check; One button<br>
25
- &check; Phone<br><br>
26
- &check; Circular (single action)<br>
27
- &check; Buttonbar (single action)<br>
28
- &check; Action label<br>
29
- &nbsp;<br>
30
- </p>
31
- <hr>
32
- <p>
33
- &check; Placement options<br>
34
- &check; For mobile devices<br>
35
- &check; Include or exclude pages<br>
36
- &nbsp;<br>
37
- &nbsp;<br>
38
- &nbsp;
39
- </p>
40
- <hr>
41
- <p>
42
- &check; Google Analytics tracking<br>
43
- &check; Google Ads conversion tracking<br>
44
- </p>
45
- <hr>
46
- <p>
47
- &check; Adjust the button size<br>
48
- &check; Flexible z-index<br>
49
- &nbsp;
50
- </p>',
51
- 'database',
52
- '<strong>Free</strong>',
53
- 'Currently active',
54
- 'disabled'
55
- );
56
- ?>
57
- </div>
58
- <?php }
59
-
60
- private function premium_plugin_promobox() {
61
- $cnb_utils = new CnbUtils();
62
  ?>
63
  <div class="cnb-body-column">
64
  <?php
65
  ( new CnbAdminFunctions() )->cnb_promobox(
66
- 'green',
67
- 'Cloud',
68
- '
69
- <p><strong>&check; Lots of buttons!</strong><br>
70
- &check; Phone, SMS/Text, Email, Maps, URLs, Scroll to point<br>
71
- &check; WhatsApp, Messenger, Telegram, Signal<br>
72
- &check; Circular button (single & multi action)<br>
73
- &check; Buttonbar (multi action)<br>
74
- &check; Action labels<br>
75
- &check; WhatsApp chat window<a href="' . esc_url($cnb_utils->get_support_url('wordpress/buttons/whatsapp-modal/', 'question-mark', 'whatsapp-window' ) ) . '" target="_blank" class="cnb-nounderscore"><span class="dashicons dashicons-editor-help"></span></a><br>
76
- </p>
77
- <hr>
78
- <p>
79
- &check; Placement options<br>
80
- &check; For mobile and desktop/laptop<br>
81
- &check; Advanced page targeting<br>
82
- &check; Scheduling<br>
83
- &check; Button animations (to draw attention)<br>
84
- &check; Icon selection<br>
85
- </p>
86
- <hr>
87
- <p>
88
- &check; Google Analytics tracking<br>
89
- &check; Google Ads conversion tracking<br>
90
- </p>
91
- <hr>
92
- <p>
93
- &check; Adjust the button size<br>
94
- &check; Flexible z-index<br>
95
- &check; Live button preview</p>
96
- <hr>
97
- <p class="cnb_align_center"><strong style="text-decoration:underline">FREE</strong> with subtle branding. PRO from &euro;<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> per month.</p>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  'cloud',
 
 
99
  CnbHeaderNotices::cnb_settings_email_activation_input(),
100
  'none'
101
  );
@@ -104,26 +159,17 @@ class CnbLegacyUpgrade {
104
  <?php }
105
 
106
  function upgrade_faq() {
107
- $cnb_utils = new CnbUtils(); ?>
108
- <div style="max-width:600px;margin:0 auto">
109
  <h1 class="cnb-center">FAQ</h1>
110
- <h3>Is Cloud really free?</h3>
111
- <p>Yes. You can use 99% of the cloud features of the Call Now Button for free. No credit card is required. You
112
- only need an account for that. The difference with the PRO plan is that a small "Powered by"
113
- notice is added to your buttons.</p>
114
  <h3>What's included in PRO?</h3>
115
- <p>Upgrading to PRO gives you access to a number of premium features: Slide-in content windows (<a href="<?php echo esc_url($cnb_utils->get_website_url('integrations/#iframes', 'faq', 'content-windows' ) );?>" target="_blank">learn more</a>), Custom button images, Intercom chat integration (<a href="<?php echo esc_url($cnb_utils->get_website_url('integrations/#intercom', 'faq', 'intercom' ) );?>" target="_blank">learn more</a>), GEO targeting and Appear after scroll. It also removes the "Powered by Call Now Button" notice from your button.</p>
116
- <h3>Does Cloud require an account?</h3>
117
- <p>Yes. We want the Call Now Button to be accessible to all website owners. Even those that do not have a
118
- WordPress powered website. The Cloud version of the Call Now Button can be used by everyone on any website. You can
119
- continue to manage your buttons from your WordPress instance, but you could also do this via our web
120
- app on <a href="https://callnowbutton.com" target="_blank">callnowbutton.com</a>. And should you ever move to a different CMS, your button(s) will just move with you.</p>
121
- <h3>What is the "Powered by" notice?</h3>
122
- <p>The cloud version of Call Now Button is available for a small yearly or monthly fee, but there is also a
123
- <em>free</em> option. The free option introduces a small notice to your buttons that says "Powered by Call
124
- Now Button". It's very delicate and will not distract the the visitor from your content.</p>
125
- <h3>Why is it called Cloud?</h3>
126
- <p>It's called Cloud because it is served from remote servers (the cloud) and no longer stored locally on your website. Therefore you need an account to enabled it. WordPress is currently the only platform that has its own interface so you can still manage your buttons from inside WordPress. Other platforms can use the Call Now Button as well but manage their buttons via the web app on app.callnowbutton.com.</p>
127
  </div>
128
  <?php }
129
 
@@ -138,9 +184,8 @@ class CnbLegacyUpgrade {
138
 
139
  <div class="cnb-one-column-section">
140
  <div class="cnb-body-content">
141
- <div class="cnb-two-promobox-row">
142
- <?php $this->premium_plugin_promobox() ?>
143
- <?php $this->standard_plugin_promobox() ?>
144
  </div>
145
  <?php $this->upgrade_faq() ?>
146
  </div>
7
 
8
  use cnb\utils\CnbAdminFunctions;
9
  use cnb\CnbHeaderNotices;
 
10
 
11
  class CnbLegacyUpgrade {
12
  function header() {
13
+ echo 'Sign up for <b>more features</b>';
14
  }
15
 
16
+ private function feature_comparison_free_promobox() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ?>
18
  <div class="cnb-body-column">
19
  <?php
20
  ( new CnbAdminFunctions() )->cnb_promobox(
21
+ 'blue',
22
+ 'Compare features',
23
+ '<table class="cnb-nb-plans">
24
+ <thead>
25
+ <tr>
26
+ <td></td>
27
+ <th class="cnb-prod-cnb"><h3>No account<br><span style="font-weight:normal;">(Currently active)</span></h3></th>
28
+ <th class="cnb-prod-nb" colspan="2"><h3>With account<br><span style="font-weight:normal;">(NowButtons.com)</span></h3></th>
29
+ </tr>
30
+ <tr class="font-18">
31
+ <th style="text-align:left; padding-left:10px">Price</th>
32
+ <th><h4>Free</h4></th>
33
+ <th><h4>Free</h4></th>
34
+ </tr>
35
+ </thead>
36
+ <tbody>
37
+ <tr class="line"><td>&nbsp;</td><td></td><td></td></tr>
38
+ <tr>
39
+ <th>No. of buttons</th>
40
+ <td class="value">1</td>
41
+ <td class="value">5</td>
42
+ </tr>
43
+ <tr>
44
+ <th>Single button</th>
45
+ <td class="yes">✓</td>
46
+ <td class="yes">✓</td>
47
+ </tr>
48
+ <tr>
49
+ <th>Buttonbar (full width)</th>
50
+ <td class="yes">✓</td>
51
+ <td class="yes">✓</td>
52
+ </tr>
53
+ <tr class="line"><td>&nbsp;</td><td></td><td></td></tr>
54
+ <tr>
55
+ <th>Phone</th>
56
+ <td class="yes">✓</td>
57
+ <td class="yes">✓</td>
58
+ </tr>
59
+ <tr>
60
+ <th>SMS/Text</th>
61
+ <td>𐄂</td>
62
+ <td class="yes">✓</td>
63
+ </tr>
64
+ <tr>
65
+ <th>Email</th>
66
+ <td>𐄂</td>
67
+ <td class="yes">✓</td>
68
+ </tr>
69
+ <tr>
70
+ <th>Maps</th>
71
+ <td>𐄂</td>
72
+ <td class="yes">✓</td>
73
+ </tr>
74
+ <tr>
75
+ <th>URLs</th>
76
+ <td>𐄂</td>
77
+ <td class="yes">✓</td>
78
+ </tr>
79
+ <tr>
80
+ <th>Scroll to point</th>
81
+ <td>𐄂</td>
82
+ <td class="yes">✓</td>
83
+ </tr>
84
+ <tr>
85
+ <th>WhatsApp</th>
86
+ <td>𐄂</td>
87
+ <td class="yes">✓</td>
88
+ </tr>
89
+ <tr>
90
+ <th>Messenger</th>
91
+ <td>𐄂</td>
92
+ <td class="yes">✓</td>
93
+ </tr>
94
+ <tr>
95
+ <th>Telegram</th>
96
+ <td>𐄂</td>
97
+ <td class="yes">✓</td>
98
+ </tr>
99
+ <tr>
100
+ <th>Signal</th>
101
+ <td>𐄂</td>
102
+ <td class="yes">✓</td>
103
+ </tr>
104
+
105
+ <tr class="line"><td>&nbsp;</td><td></td><td></td></tr>
106
+ <tr>
107
+ <th>Mobile</th>
108
+ <td class="yes">✓</td>
109
+ <td class="yes">✓</td>
110
+ </tr>
111
+ <tr>
112
+ <th>Desktop</th>
113
+ <td>𐄂</td>
114
+ <td class="yes">✓</td>
115
+ </tr>
116
+ <tr>
117
+ <th>Limit appearance</th>
118
+ <td class="yes">✓</td>
119
+ <td class="yes">✓</td>
120
+ </tr>
121
+ <tr>
122
+ <th>Display rules (Basic)</th>
123
+ <td>𐄂</td>
124
+ <td class="yes">✓</td>
125
+ </tr>
126
+ <tr>
127
+ <th>Click tracking in GA</th>
128
+ <td class="yes">✓</td>
129
+ <td class="yes">✓</td>
130
+ </tr>
131
+ <tr>
132
+ <th>Google Ads conversion tracking</th>
133
+ <td class="yes">✓</td>
134
+ <td class="yes">✓</td>
135
+ </tr>
136
+ <tr>
137
+ <th>Live preview</th>
138
+ <td>𐄂</td>
139
+ <td class="yes">✓</td>
140
+ </tr>
141
+ <tr class="line"><td>&nbsp;</td><td></td><td></td></tr>
142
+ </tbody>
143
+ <tfoot>
144
+ <tr class="font-18">
145
+ <th style="text-align:left; padding-left:10px">Price</th>
146
+ <th><h4>Free</h4></th>
147
+ <th><h4>Free</h4></th>
148
+ </tr>
149
+ </tfoot>
150
+ </table>',
151
  'cloud',
152
+ '<h3 class="font-22">Sign up now for extra features (no cost)</h3>
153
+ <p class="font-18" style="padding-left:12px; margin-top:0">Sign up to create an account on NowButtons.com. Once you\'ve confirmed your account via email, Call Now Button is automatically upgraded to ' . esc_html(CNB_CLOUD_NAME) . '.</p>' .
154
  CnbHeaderNotices::cnb_settings_email_activation_input(),
155
  'none'
156
  );
159
  <?php }
160
 
161
  function upgrade_faq() {
162
+ ?>
163
+ <div style="max-width:800px;">
164
  <h1 class="cnb-center">FAQ</h1>
165
+ <h3>Is a NowButtons.com account really free?</h3>
166
+ <p>Yes. NowButtons has a paid plan as well, however the features described above are all part of the Starter plan which is free. Enter your email above and click <b>Create account</b> to sign up and enable the extra features.</p>
167
+ <h3>Is there a PRO plan?</h3>
168
+ <p>Yes, NowButtons offers a PRO plan with many advanced feature for even more buttons and more control.</p>
169
  <h3>What's included in PRO?</h3>
170
+ <p>PRO turns your website into a conversion machine. It adds a big collection of premium features such as scheduling, multi-action buttons, animations, WhatsApp Chat window, and much much more. Checkout <a href="<?php echo esc_html(CNB_WEBSITE) ?>pricing/" target="_blank"><?php echo esc_html(CNB_WEBSITE) ?>pricing/</a> for a full features overview.</p>
171
+ <h3>Why do I have to sign up for <?php echo esc_html(CNB_CLOUD_NAME); ?>?</h3>
172
+ <p>NowButtons is a cloud service and can be added to any website. Even those that do not have a WordPress powered website. Once you've signed up, you can continue to manage your buttons from your WordPress instance, but you could also do this via the web app found at <a href="<?php echo esc_html(CNB_APP) ?>" target="_blank"><?php echo esc_html(CNB_APP) ?></a>.</p><p>And should you ever move to a different CMS, your button(s) will just move with you.</p>
 
 
 
 
 
 
 
 
 
173
  </div>
174
  <?php }
175
 
184
 
185
  <div class="cnb-one-column-section">
186
  <div class="cnb-body-content">
187
+ <div class="cnb-compare-features" style="max-width:800px;">
188
+ <?php $this->feature_comparison_free_promobox() ?>
 
189
  </div>
190
  <?php $this->upgrade_faq() ?>
191
  </div>
src/admin/models/CnbPlan.php CHANGED
@@ -36,10 +36,14 @@ class CnbPlan {
36
  * @var float
37
  */
38
  public $price;
 
 
 
 
39
 
40
  /**
41
  * If a stdClass is passed, it is transformed into a CnbButton.
42
- * a WP_Error is ignored and return immediatly
43
  * a null if converted into an (empty) CnbButton
44
  *
45
  * @param $object stdClass|array|WP_Error|null
@@ -51,13 +55,14 @@ class CnbPlan {
51
  return $object;
52
  }
53
 
54
- $plan = new CnbPlan();
55
- $plan->id = CnbUtils::getPropertyOrNull( $object, 'id' );
56
- $plan->nickname = CnbUtils::getPropertyOrNull( $object, 'nickname' );
57
- $plan->domainType = CnbUtils::getPropertyOrNull( $object, 'domainType' );
58
- $plan->currency = CnbUtils::getPropertyOrNull( $object, 'currency' );
59
- $plan->interval = CnbUtils::getPropertyOrNull( $object, 'interval' );
60
- $plan->price = floatval( CnbUtils::getPropertyOrNull( $object, 'price' ) );
 
61
 
62
  return $plan;
63
  }
36
  * @var float
37
  */
38
  public $price;
39
+ /**
40
+ * @var float
41
+ */
42
+ public $trialPeriodDays;
43
 
44
  /**
45
  * If a stdClass is passed, it is transformed into a CnbButton.
46
+ * a WP_Error is ignored and return immediately
47
  * a null if converted into an (empty) CnbButton
48
  *
49
  * @param $object stdClass|array|WP_Error|null
55
  return $object;
56
  }
57
 
58
+ $plan = new CnbPlan();
59
+ $plan->id = CnbUtils::getPropertyOrNull( $object, 'id' );
60
+ $plan->nickname = CnbUtils::getPropertyOrNull( $object, 'nickname' );
61
+ $plan->domainType = CnbUtils::getPropertyOrNull( $object, 'domainType' );
62
+ $plan->currency = CnbUtils::getPropertyOrNull( $object, 'currency' );
63
+ $plan->interval = CnbUtils::getPropertyOrNull( $object, 'interval' );
64
+ $plan->price = floatval( CnbUtils::getPropertyOrNull( $object, 'price' ) );
65
+ $plan->trialPeriodDays = floatval( CnbUtils::getPropertyOrNull( $object, 'trialPeriodDays' ) );
66
 
67
  return $plan;
68
  }
src/admin/partials/CnbFooter.php CHANGED
@@ -24,7 +24,7 @@ class CnbFooter {
24
  $this->cnb_show_feedback_collection();
25
  $this->cnb_show_api_traces();
26
  $this->add_usage_details();
27
- echo '</div> <!-- /wrap -->'; // This is started in CnbHeader::
28
  }
29
 
30
  private function cnb_show_feedback_collection() {
@@ -40,12 +40,17 @@ class CnbFooter {
40
  ?>
41
  <div class="feedback-collection">
42
  <div class="cnb-clear"></div>
43
- <p class="cnb-url cnb-center"><a
44
- href="<?php echo esc_url( $cnb_utils->get_website_url( '', 'footer-links', 'branding' ) ) ?>"
45
- target="_blank">Call Now Button<?php if ( $cnb_utils->isCloudActive( $cnb_options ) ) {
46
- echo '<span class="cnb_footer_beta">CLOUD</span>';
47
- } else { echo '<span class="cnb_footer_beta">Lite</span>'; } ?></a></p>
48
- <p class="cnb-center">Version <?php echo esc_attr( CNB_VERSION ) ?>
 
 
 
 
 
49
  <p class="cnb-center cnb-spacing">
50
  <a href="<?php echo esc_url( $cnb_utils->get_support_url( '', 'footer-links', 'support' ) ) ?>"
51
  target="_blank"
@@ -54,7 +59,7 @@ class CnbFooter {
54
  target="_blank" title="Feature Requests">Suggestions</a>
55
  <?php if ( ! $cnb_utils->isCloudActive( $cnb_options ) ) { ?>
56
  &middot; <strong><a href="<?php echo esc_url( $upgrade_link ) ?>"
57
- title="Unlock features">Enable cloud</a></strong>
58
  <?php } ?>
59
  </p>
60
  </div>
24
  $this->cnb_show_feedback_collection();
25
  $this->cnb_show_api_traces();
26
  $this->add_usage_details();
27
+ echo '</div> <!-- /wrap -->'; // This is started in CnbHeader::renderHeader
28
  }
29
 
30
  private function cnb_show_feedback_collection() {
40
  ?>
41
  <div class="feedback-collection">
42
  <div class="cnb-clear"></div>
43
+ <p class="cnb-url cnb-center">
44
+ <a href="<?php echo esc_url( $cnb_utils->get_website_url( '', 'footer-links', 'branding' ) ) ?>"
45
+ target="_blank">
46
+ <?php if ( $cnb_utils->isCloudActive( $cnb_options ) ) {
47
+ echo esc_html(CNB_CLOUD_NAME);
48
+ echo '<span>(' . esc_html(CNB_NAME) . ' ⚡ NowButtons.com)</span>';
49
+ } else {
50
+ echo esc_html(CNB_NAME);
51
+ } ?>
52
+ </a></p>
53
+ <p class="cnb-center"><?php echo esc_html(CNB_NAME) ?> version <?php echo esc_attr( CNB_VERSION ) ?>
54
  <p class="cnb-center cnb-spacing">
55
  <a href="<?php echo esc_url( $cnb_utils->get_support_url( '', 'footer-links', 'support' ) ) ?>"
56
  target="_blank"
59
  target="_blank" title="Feature Requests">Suggestions</a>
60
  <?php if ( ! $cnb_utils->isCloudActive( $cnb_options ) ) { ?>
61
  &middot; <strong><a href="<?php echo esc_url( $upgrade_link ) ?>"
62
+ title="Unlock features"><?php echo esc_html(CNB_CLOUD_NAME); ?></a></strong>
63
  <?php } ?>
64
  </p>
65
  </div>
src/admin/partials/CnbHeaderNotices.php CHANGED
@@ -138,7 +138,7 @@ class CnbHeaderNotices {
138
  $message .= get_submit_button( __( 'Create account' ), 'primary', 'cnb_email_activation_submit', false );
139
  $message .= '<p class="cnb_email_activation_message"></p>';
140
 
141
- $message .= '<p class="nonessential">By clicking <u>Create account</u> an account will be created with your email address on callnowbutton.com and you agree to our <a href="' . esc_url( $terms_url ) . '" target="_blank">Terms & Conditions</a> and <a href="' . esc_url( $privacy_url ) . '" target="_blank">Privacy statement</a>.</p>';
142
  $message .= '</form>';
143
 
144
  return $message;
138
  $message .= get_submit_button( __( 'Create account' ), 'primary', 'cnb_email_activation_submit', false );
139
  $message .= '<p class="cnb_email_activation_message"></p>';
140
 
141
+ $message .= '<p class="nonessential">By clicking <u>Create account</u> an account will be created with your email address on nowbuttons.com and you agree to our <a href="' . esc_url( $terms_url ) . '" target="_blank">Terms & Conditions</a> and <a href="' . esc_url( $privacy_url ) . '" target="_blank">Privacy statement</a>.</p>';
142
  $message .= '</form>';
143
 
144
  return $message;
src/admin/settings/CnbApiKeyActivatedView.php CHANGED
@@ -5,7 +5,6 @@ namespace cnb\admin\settings;
5
  use cnb\admin\api\CnbAdminCloud;
6
  use cnb\admin\api\CnbAppRemote;
7
  use cnb\admin\domain\CnbDomainViewEdit;
8
- use cnb\admin\domain\CnbDomainViewUpgradeFinished;
9
  use cnb\admin\domain\CnbDomainViewUpgradeOverview;
10
  use cnb\admin\models\CnbActivation;
11
  use cnb\admin\models\CnbUser;
@@ -19,7 +18,7 @@ class CnbApiKeyActivatedView {
19
  private $activation;
20
 
21
  function header() {
22
- echo 'Cloud activation';
23
  }
24
 
25
  /**
@@ -91,12 +90,21 @@ class CnbApiKeyActivatedView {
91
  }
92
  }
93
 
 
 
 
 
 
 
 
 
 
 
 
94
  private function renderActivationSuccess() {
95
  echo '<div style="text-align: center;">';
96
- echo '<div style="width:200px;margin: 0 auto;">';
97
- ( new CnbDomainViewUpgradeFinished() )->echoBigYaySvg();
98
- echo '</div>';
99
- echo '<h1>You have successfully activated Cloud account</h1>';
100
  echo '</div>';
101
  }
102
 
@@ -142,12 +150,9 @@ class CnbApiKeyActivatedView {
142
  }
143
 
144
  private function renderOnboarding() {
145
- $img_scheduling = plugins_url( '../../../resources/images/onboarding/action-scheduling.png', __FILE__ );
146
- $img_action_extras = plugins_url( '../../../resources/images/onboarding/action-extra-options.png', __FILE__ );
147
- $img_actions = plugins_url( '../../../resources/images/onboarding/actions-overview.png', __FILE__ );
148
  $img_add_action = plugins_url( '../../../resources/images/onboarding/add-action.png', __FILE__ );
149
  $img_add_rule = plugins_url( '../../../resources/images/onboarding/add-display-rule.png', __FILE__ );
150
- $img_presentation = plugins_url( '../../../resources/images/onboarding/button-presenation.png', __FILE__ );
151
  $img_buttons = plugins_url( '../../../resources/images/onboarding/buttons-overview.png', __FILE__ );
152
  $img_nav_position = plugins_url( '../../../resources/images/onboarding/nav-position.png', __FILE__ );
153
  $img_new_button = plugins_url( '../../../resources/images/onboarding/new-button.png', __FILE__ );
@@ -156,9 +161,9 @@ class CnbApiKeyActivatedView {
156
  ?>
157
  <div class="cnb_onboarding_guide cnb-plan-features cnb-center top-50">
158
  <h1><strong>Quick start guide</strong></h1><hr>
159
- <h2 class="cnb-left">Locating the Call Now Button</h2>
160
- <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_nav_position ) ?>" alt="Find the Call Now Button in the side nav of your WordPress dashboard."></div>
161
- <p class="bottom-50">Find the Call Now Button in the side nav of your WordPress dashboard.</p>
162
  <h2 class="cnb-left">Your buttons overview</h2>
163
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_buttons ) ?>" alt="The buttons overview page where you can add, edit and remove buttons."></div>
164
  <p class="bottom-50">The buttons overview page where you can add, edit and remove buttons. Click <strong>Add New</strong> at the top to start a new button.</p>
@@ -167,20 +172,12 @@ class CnbApiKeyActivatedView {
167
  <p class="bottom-50">When creating a new button, start with selecting your button type.</p>
168
  <h2 class="cnb-left">Add an action to your button</h2>
169
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_add_action ) ?>" alt="Every button contains one or more actions."></div>
170
- <p class="bottom-50">Every button contains one or more actions.</p>
171
- <h2 class="cnb-left">Some actions have additional options</h2>
172
- <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_action_extras ) ?>" alt="Some actions accept extra settings for more advanced features. Here's an example for WhatsApp."></div>
173
- <p class="bottom-50">Some actions accept extra settings for more advanced features. Here's an example for WhatsApp.</p>
174
- <h2 class="cnb-left">Multi-action buttons contain action overviews</h2>
175
- <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_actions ) ?>" alt="You can drag & drop the actions on the Buttonbar and the Multibutton to change the order."></div>
176
- <p class="bottom-50">You can drag & drop the actions on the Buttonbar and the Multibutton to change the order.</p>
177
- <h2 class="cnb-left">Every action can be scheduled</h2>
178
- <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_scheduling ) ?>" alt="Every action can be individually scheduled."></div>
179
- <p class="bottom-50">Every action can be individually scheduled.</p>
180
  <h2 class="cnb-left">Change the presentation of your button</h2>
181
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_presentation ) ?>" alt="In the presentation tab you can set placement, the colors and pick an animation effect for your button."></div>
182
- <p class="bottom-50">In the presentation tab you can set placement, the colors and pick an animation effect for your button.</p>
183
- <h2 class="cnb-left">Adjust the visibility of your button</h2>
184
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_visibility ) ?>" alt="On the Visibility tab you can decide where your button should appear. Here you also see an overview of all active Display Rules."></div>
185
  <p class="bottom-50">On the Visibility tab you can decide where your button should appear. Here you also see an overview of all active Display Rules.</p>
186
  <h2 class="cnb-left">Adding Display Rules</h2>
@@ -210,23 +207,39 @@ class CnbApiKeyActivatedView {
210
  if ( $domain === null ) {
211
  $domain = CnbAppRemote::cnb_remote_get_wp_domain();
212
  }
213
- if ( $domain->type !== 'FREE' ) {
 
 
 
 
214
  // Already upgraded, so skip all of this
215
  return;
216
  }
217
- echo '<div class="cnb-plan-features cnb-center top-50">';
218
- echo '<h1><strong>Need even more power?</strong></h1><hr>';
219
- echo '<h3>All features from Cloud plus...</h3>';
220
- echo '<div class="cnb-pricebox cnb-smaller">
221
- <div class="cnb-benefit">📄 Slide-in content windows</div>
222
- <div class="cnb-benefit">📷 Use custom images on buttons</div>
223
- <div class="cnb-benefit">🌍 Include and exclude countries</div>
224
- <div class="cnb-benefit">↕️ Set scroll height for buttons to appear</div>
225
- <div class="cnb-benefit">🔌 Intercom Chat integration</div>
226
- <div class="cnb-benefit">✨ "Powered by" notice removed</div>
227
- </div>';
228
- ( new CnbDomainViewUpgradeOverview() )->renderUpgradeForm( $domain );
229
- echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
 
232
  /**
@@ -236,7 +249,10 @@ class CnbApiKeyActivatedView {
236
  */
237
  private function renderActivationFailure( $user ) {
238
  if ( ! is_wp_error( $user ) ) {
239
- echo '<div style="text-align: center"><h2>Cloud is already active</h2></div>';
 
 
 
240
 
241
  return;
242
  }
@@ -244,24 +260,22 @@ class CnbApiKeyActivatedView {
244
  echo '<h1>You tried to activate CLOUD, but something went wrong.</h1>';
245
  }
246
 
247
- private function renderBenefits() {
248
- echo '<div>';
249
- echo '<h2 class="cnb-center">You now have access to the following functionality:</h2>';
250
- echo '<div class="cnb-benefits-block">';
251
- ( new CnbDomainViewUpgradeOverview() )->renderBenefits();
252
- echo '</div></div>';
253
- }
254
-
255
  private function renderActivationStatus() {
256
  $user = CnbAppRemote::cnb_remote_get_user_info();
257
  if ( $this->activation->success ) {
258
  $this->renderActivationSuccess();
259
  }
260
  if ( ! $this->activation->success && ! is_wp_error( $user ) ) {
261
- echo '<div style="text-align: center"><h1>Cloud is already active</h1></div>';
 
 
 
 
 
 
 
262
  }
263
  if ( $this->activation->success || ! is_wp_error( $user ) ) {
264
- //$this->renderBenefits();
265
  $this->renderGetStarted();
266
  $this->renderOnboarding();
267
  $this->renderUpgradeToPro();
5
  use cnb\admin\api\CnbAdminCloud;
6
  use cnb\admin\api\CnbAppRemote;
7
  use cnb\admin\domain\CnbDomainViewEdit;
 
8
  use cnb\admin\domain\CnbDomainViewUpgradeOverview;
9
  use cnb\admin\models\CnbActivation;
10
  use cnb\admin\models\CnbUser;
18
  private $activation;
19
 
20
  function header() {
21
+ echo 'Your NowButtons account';
22
  }
23
 
24
  /**
90
  }
91
  }
92
 
93
+ /**
94
+ * print SVG wrapped in a div with a cloud symbol and success tick
95
+ *
96
+ * @return void
97
+ */
98
+ public function accountConnectionSvg() {
99
+ echo '<div style="max-width:120px; margin:0 auto;">';
100
+ echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.5,18a7.45207,7.45207,0,0,1-1.92773,5,6.389,6.389,0,0,1-3.81873,1.93469,7.52112,7.52112,0,0,0,.15118-3.10339,3.19012,3.19012,0,0,0,1.441-.842A4.45541,4.45541,0,0,0,27.5,18a5.00588,5.00588,0,0,0-5-5c-.16486,0-1.01178.10578-1.527.17216a.497.497,0,0,1-.53424-.33408l-.20362-.594A6.16993,6.16993,0,0,0,15.1093,8.03026,5.97887,5.97887,0,0,0,8.665,15.37109l.21353.91336a.5.5,0,0,1-.34225.59245l-.89862.27154A2.97242,2.97242,0,0,0,5.5,20a2.01441,2.01441,0,0,0,.41406,1.22852A2.42324,2.42324,0,0,0,7.70312,22H9.06946a7.55663,7.55663,0,0,0,.19385,3H7.70312a5.35308,5.35308,0,0,1-4.23535-2.03516A5.03407,5.03407,0,0,1,2.5,20a5.93806,5.93806,0,0,1,3.03809-5.19922C5.5127,14.53223,5.5,14.26465,5.5,14a8.99653,8.99653,0,0,1,17.05664-4A8.00931,8.00931,0,0,1,30.5,18ZM23,23a6,6,0,1,1-6-6A6,6,0,0,1,23,23Zm-2.85236-2.23358-.51147-.37879a.29677.29677,0,0,0-.37677.02674l-3.15,2.96063-1.766-.84467a.32278.32278,0,0,0-.37695.09528l-.43353.55444a.29685.29685,0,0,0,.02673.37683l2.23328,2.236a.83043.83043,0,0,0,1.29761-.1L20.2,21.11816A.25358.25358,0,0,0,20.14764,20.76642Z"/></svg>';
101
+ echo '</div>';
102
+ }
103
+
104
  private function renderActivationSuccess() {
105
  echo '<div style="text-align: center;">';
106
+ $this->accountConnectionSvg();
107
+ echo '<h2>NowButtons.com account connection successfully established!</h2>';
 
 
108
  echo '</div>';
109
  }
110
 
150
  }
151
 
152
  private function renderOnboarding() {
 
 
 
153
  $img_add_action = plugins_url( '../../../resources/images/onboarding/add-action.png', __FILE__ );
154
  $img_add_rule = plugins_url( '../../../resources/images/onboarding/add-display-rule.png', __FILE__ );
155
+ $img_presentation = plugins_url( '../../../resources/images/onboarding/button-presentation.png', __FILE__ );
156
  $img_buttons = plugins_url( '../../../resources/images/onboarding/buttons-overview.png', __FILE__ );
157
  $img_nav_position = plugins_url( '../../../resources/images/onboarding/nav-position.png', __FILE__ );
158
  $img_new_button = plugins_url( '../../../resources/images/onboarding/new-button.png', __FILE__ );
161
  ?>
162
  <div class="cnb_onboarding_guide cnb-plan-features cnb-center top-50">
163
  <h1><strong>Quick start guide</strong></h1><hr>
164
+ <h2 class="cnb-left">Locating your buttons</h2>
165
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_nav_position ) ?>" alt="Find your Buttons in the side nav of your WordPress dashboard."></div>
166
+ <p class="bottom-50">You can find the Buttons in the side nav of your WordPress dashboard.</p>
167
  <h2 class="cnb-left">Your buttons overview</h2>
168
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_buttons ) ?>" alt="The buttons overview page where you can add, edit and remove buttons."></div>
169
  <p class="bottom-50">The buttons overview page where you can add, edit and remove buttons. Click <strong>Add New</strong> at the top to start a new button.</p>
172
  <p class="bottom-50">When creating a new button, start with selecting your button type.</p>
173
  <h2 class="cnb-left">Add an action to your button</h2>
174
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_add_action ) ?>" alt="Every button contains one or more actions."></div>
175
+ <p class="bottom-50">Every button contains at least one action. The action is what the button does when it is clicked. For example a call button has a Phone action.</p>
176
+
 
 
 
 
 
 
 
 
177
  <h2 class="cnb-left">Change the presentation of your button</h2>
178
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_presentation ) ?>" alt="In the presentation tab you can set placement, the colors and pick an animation effect for your button."></div>
179
+ <p class="bottom-50">In the presentation tab you can set placement and the colors of your button.</p>
180
+ <h2 class="cnb-left">Decide where your button should appear</h2>
181
  <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_visibility ) ?>" alt="On the Visibility tab you can decide where your button should appear. Here you also see an overview of all active Display Rules."></div>
182
  <p class="bottom-50">On the Visibility tab you can decide where your button should appear. Here you also see an overview of all active Display Rules.</p>
183
  <h2 class="cnb-left">Adding Display Rules</h2>
207
  if ( $domain === null ) {
208
  $domain = CnbAppRemote::cnb_remote_get_wp_domain();
209
  }
210
+ if ( is_wp_error( $domain ) ) {
211
+ // Something went wrong
212
+ return;
213
+ }
214
+ if ( $domain->type === 'PRO' ) {
215
  // Already upgraded, so skip all of this
216
  return;
217
  }
218
+ ?>
219
+ <div class="cnb-welcome-blocks">
220
+
221
+ <?php ( new CnbDomainViewUpgradeOverview() )->render_pro_features_nice_view( ); ?>
222
+
223
+ <br>
224
+ <?php ( new CnbDomainViewUpgradeOverview() )->render_pro_features_extras( ); ?>
225
+
226
+ <br>
227
+ <h1>Select your <b>PRO</b> plan</h1>
228
+ <br>
229
+
230
+ <?php ( new CnbDomainViewUpgradeOverview() )->render_upgrade_form( $domain ); ?>
231
+ </div>
232
+ <div class="cnb-welcome-blocks">
233
+ <h1>Feature comparison</h1>
234
+ <h3>An overview of the features that are included in the Starter and Pro plans.</h3>
235
+ <?php ( new CnbDomainViewUpgradeOverview() )->render_pro_feature_comparison( ); ?>
236
+
237
+ <br>
238
+ <div class="cnb-block">
239
+ <?php ( new CnbDomainViewUpgradeOverview() )->render_upgrade_form( $domain, '-upgrade-form' ); ?>
240
+ </div>
241
+ </div>
242
+ <?php
243
  }
244
 
245
  /**
249
  */
250
  private function renderActivationFailure( $user ) {
251
  if ( ! is_wp_error( $user ) ) {
252
+ echo '<div style="text-align: center">';
253
+ $this->accountConnectionSvg();
254
+ echo '<h2>NowButtons.com account connection already established.</h2>';
255
+ echo '</div>';
256
 
257
  return;
258
  }
260
  echo '<h1>You tried to activate CLOUD, but something went wrong.</h1>';
261
  }
262
 
 
 
 
 
 
 
 
 
263
  private function renderActivationStatus() {
264
  $user = CnbAppRemote::cnb_remote_get_user_info();
265
  if ( $this->activation->success ) {
266
  $this->renderActivationSuccess();
267
  }
268
  if ( ! $this->activation->success && ! is_wp_error( $user ) ) {
269
+ echo '<div style="text-align: center">';
270
+ $this->accountConnectionSvg();
271
+ echo '<h2>NowButtons.com account connection already established.</h2>';
272
+ echo '</div>';
273
+ }
274
+ if ( ! $this->activation->success && is_wp_error( $this->activation->domain ) ) {
275
+ $notice = CnbAdminCloud::cnb_admin_get_error_message( 'update', 'domain', $this->activation->domain );
276
+ CnbAdminNotices::get_instance()->renderNotice( $notice );
277
  }
278
  if ( $this->activation->success || ! is_wp_error( $user ) ) {
 
279
  $this->renderGetStarted();
280
  $this->renderOnboarding();
281
  $this->renderUpgradeToPro();
src/admin/settings/CnbSettingsController.php CHANGED
@@ -338,7 +338,7 @@ class CnbSettingsController {
338
  // set "migration done"
339
  // We should really only do this once, so we need to save something in the settings to stop continuous migration.
340
  add_option( 'cnb_cloud_migration_done', true );
341
- CnbAdminNotices::get_instance()->success( '<p>Successfully connected to your Call Now Button cloud account.</p>' );
342
  }
343
 
344
  // If an API key was passed (no matter the status of activation)
@@ -423,7 +423,7 @@ class CnbSettingsController {
423
  );
424
  $success = 1;
425
  }
426
- // Always redirect back, even when not succesful
427
  $this->redirect_to_delete_all_settings($success);
428
  }
429
 
@@ -439,7 +439,7 @@ class CnbSettingsController {
439
  Activation::onActivation( null, false );
440
  $success = 2;
441
  }
442
- // Always redirect back, even when not succesful
443
  $this->redirect_to_delete_all_settings($success);
444
  }
445
 
@@ -457,7 +457,7 @@ class CnbSettingsController {
457
  update_option('cnb', $options);
458
  $success = 3;
459
  }
460
- // Always redirect back, even when not succesful
461
  $this->redirect_to_delete_all_settings($success);
462
  }
463
 
338
  // set "migration done"
339
  // We should really only do this once, so we need to save something in the settings to stop continuous migration.
340
  add_option( 'cnb_cloud_migration_done', true );
341
+ CnbAdminNotices::get_instance()->success( '<p>Successfully connected to your NowButtons account.</p>' );
342
  }
343
 
344
  // If an API key was passed (no matter the status of activation)
423
  );
424
  $success = 1;
425
  }
426
+ // Always redirect back, even when not successful
427
  $this->redirect_to_delete_all_settings($success);
428
  }
429
 
439
  Activation::onActivation( null, false );
440
  $success = 2;
441
  }
442
+ // Always redirect back, even when not successful
443
  $this->redirect_to_delete_all_settings($success);
444
  }
445
 
457
  update_option('cnb', $options);
458
  $success = 3;
459
  }
460
+ // Always redirect back, even when not successful
461
  $this->redirect_to_delete_all_settings($success);
462
  }
463
 
src/admin/settings/CnbSettingsViewEdit.php CHANGED
@@ -122,7 +122,7 @@ class CnbSettingsViewEdit {
122
  ?>
123
  <tr>
124
  <th scope="row">Invoices</th>
125
- <td><a href="<? echo esc_url( $stripe_link->url ) ?>" target="_blank">Billing portal</a>
126
  </td>
127
  </tr>
128
  <?php } ?>
@@ -161,10 +161,9 @@ class CnbSettingsViewEdit {
161
  <?php if ( is_wp_error( $cnb_user ) && ! empty( $cnb_options['api_key'] ) ) { ?>
162
  <p><span class="dashicons dashicons-warning"></span> There is an API key,
163
  but it seems to be invalid or outdated.</p>
164
- <p class="description">Clicking "Disconnect account" will drop the API key
165
- and disconnect the plugin from your account. You will lose access to
166
- your buttons and cloud functionality until you reconnect with a
167
- callnowbutton.com account.
168
  <br>
169
  <input type="button" name="cnb_api_key_delete" id="cnb_api_key_delete"
170
  class="button button-link"
@@ -175,16 +174,16 @@ class CnbSettingsViewEdit {
175
  <?php if ( ! is_wp_error( $cnb_user ) && isset( $cnb_options['api_key'] ) ) {
176
  $icon = version_compare( $wp_version, '5.5.0', '<' ) ? 'dashicons-yes' : 'dashicons-saved';
177
  ?>
178
- <p><strong><span class="dashicons <?php echo esc_attr( $icon ) ?>"></span>Success!</strong>
179
- The plugin is connected to your callnowbutton.com account.</p>
180
  <p>
181
  <input type="button" name="cnb_api_key_delete" id="cnb_api_key_delete"
182
  class="button button-secondary"
183
  value="<?php esc_attr_e( 'Disconnect account' ) ?>"
184
  onclick="return cnb_delete_apikey();"></p>
185
  <p class="description">Clicking "Disconnect account" will drop the API key and disconnect the
186
- plugin from your account. You will lose access to your buttons and all cloud functionality
187
- until you reconnect with a callnowbutton.com account.</p>
188
 
189
 
190
  <input type="hidden" name="cnb[api_key]" id="cnb_api_key" value="delete_me"
@@ -359,45 +358,63 @@ class CnbSettingsViewEdit {
359
  echo '<div class="cnb-postbox-container cnb-side-column">';
360
  if ( ! $use_cloud ) {
361
  ( new CnbAdminFunctions() )->cnb_promobox(
362
- 'purple',
363
- 'Phones off at 6pm?',
364
- '<p>Sign up to enable a scheduler that allows you to set the days and hours that you are available.</p>' .
365
- '<p>You can even replace it with an email button during your off-hours so people can still contact you.</p>',
366
- 'clock',
367
- '<strong>Use the scheduler!</strong>',
368
- 'Enable cloud',
369
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
370
  );
371
  }
372
  if ( $use_cloud && isset( $cnb_cloud_domain ) && ! is_wp_error( $cnb_cloud_domain ) && $cnb_cloud_domain->type !== 'PRO' ) {
373
- $coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
374
- $discount_illustration = plugins_url( '../../../resources/images/discount.png', __FILE__ );
375
- if ( $coupon != null && ! is_wp_error( $coupon ) ) {
 
 
 
 
376
  ( new CnbAdminFunctions() )->cnb_promobox(
377
  'green',
378
- 'SPECIAL PRO OFFER!',
379
- '<h4>Upgrade now with ' . esc_html( $coupon->get_discount() ) . ' extra discount!</h4>' .
380
- '<p>Enter coupon code <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code> during checkout.</p>' .
381
- '<div class="cnb-center" style="padding: 10px 30px"><img src="' . esc_url( $discount_illustration ) . '" alt="Upgrade your domain to PRO with an extra discount" style="max-width:300px; width:100%; height:auto;" /></div>',
382
- 'flag',
383
- 'Code: <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code>',
384
  'Upgrade',
385
- ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain )
386
  );
387
- } else {
388
  ( new CnbAdminFunctions() )->cnb_promobox(
389
  'green',
390
- 'Business features',
391
- '<p>✨ Remove the <em>Powered by</em> notice<br>
392
- Slide-in content windows<br>
393
- 📷 Use custom images on buttons<br>
394
- 🌍 Include and exclude countries<br>
395
  ↕️ Set scroll height for buttons to appear<br>
396
- 🔌 Intercom Chat integration</p>',
397
- 'flag',
398
- '<strong>$<span class="usd-per-month"></span> or &euro;<span class="eur-per-month"></span> monthly</strong>',
399
- 'Upgrade now',
400
- ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  );
402
  }
403
  }
@@ -427,11 +444,11 @@ class CnbSettingsViewEdit {
427
  $cnb_options = get_option( 'cnb' );
428
  ?>
429
  <tr>
430
- <th colspan="2"></th>
431
  </tr>
432
  <tr>
433
  <th scope="row">
434
- <label for="cnb_cloud_enabled">Cloud
435
  <?php if ( $cnb_options['cloud_enabled'] == 0 ) { ?>
436
  <a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>"
437
  class="cnb-nounderscore">
@@ -453,7 +470,7 @@ class CnbSettingsViewEdit {
453
  <?php if ( $cnb_options['cloud_enabled'] == 0 ) { ?>
454
  <p class="description"><a
455
  href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Sign
456
- up</a> (free) to enable cloud and enjoy extra functionality.
457
  <a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Learn
458
  more</a>
459
  </p>
122
  ?>
123
  <tr>
124
  <th scope="row">Invoices</th>
125
+ <td><a href="<?php echo esc_url( $stripe_link->url ) ?>" target="_blank">Billing portal</a>
126
  </td>
127
  </tr>
128
  <?php } ?>
161
  <?php if ( is_wp_error( $cnb_user ) && ! empty( $cnb_options['api_key'] ) ) { ?>
162
  <p><span class="dashicons dashicons-warning"></span> There is an API key,
163
  but it seems to be invalid or outdated.</p>
164
+ <p class="description">Clicking "Disconnect account" will drop the API key and disconnect the
165
+ plugin from your NowButtons.com account. You will lose access to your buttons and all cloud functionality
166
+ until you reconnect with a NowButtons.com account.
 
167
  <br>
168
  <input type="button" name="cnb_api_key_delete" id="cnb_api_key_delete"
169
  class="button button-link"
174
  <?php if ( ! is_wp_error( $cnb_user ) && isset( $cnb_options['api_key'] ) ) {
175
  $icon = version_compare( $wp_version, '5.5.0', '<' ) ? 'dashicons-yes' : 'dashicons-saved';
176
  ?>
177
+ <p><strong><span class="dashicons <?php echo esc_attr( $icon ) ?>"></span></strong>
178
+ The plugin is connected to your NowButtons.com account.</p>
179
  <p>
180
  <input type="button" name="cnb_api_key_delete" id="cnb_api_key_delete"
181
  class="button button-secondary"
182
  value="<?php esc_attr_e( 'Disconnect account' ) ?>"
183
  onclick="return cnb_delete_apikey();"></p>
184
  <p class="description">Clicking "Disconnect account" will drop the API key and disconnect the
185
+ plugin from your NowButtons.com account. You will lose access to your buttons and all cloud functionality
186
+ until you reconnect with a NowButtons.com account.</p>
187
 
188
 
189
  <input type="hidden" name="cnb[api_key]" id="cnb_api_key" value="delete_me"
358
  echo '<div class="cnb-postbox-container cnb-side-column">';
359
  if ( ! $use_cloud ) {
360
  ( new CnbAdminFunctions() )->cnb_promobox(
361
+ 'green',
362
+ 'Enable NowButtons features!',
363
+ '<p>Sign up to enable NowButtons features. A set of additional actions and features to power your website.</p>',
364
+ 'unlock',
365
+ '<strong>Get more for FREE!</strong>',
366
+ 'Learn more',
 
367
  ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
368
  );
369
  }
370
  if ( $use_cloud && isset( $cnb_cloud_domain ) && ! is_wp_error( $cnb_cloud_domain ) && $cnb_cloud_domain->type !== 'PRO' ) {
371
+ $custom_image = plugins_url( '../../../resources/images/custom-image.jpg', __FILE__ );
372
+ $schedule_illustration = plugins_url( '../../../resources/images/scheduler.png', __FILE__ );
373
+ $promoboxes = range(1,3);
374
+ shuffle($promoboxes);
375
+ $promoItem = array_rand($promoboxes);
376
+ $upgrade_url = ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain );
377
+ if ( $promoItem == 1) {
378
  ( new CnbAdminFunctions() )->cnb_promobox(
379
  'green',
380
+ 'Schedule your buttons',
381
+ '<h4>Show a call button during office hours</h4>' .
382
+ '<div class="cnb-center" style="padding: 10px 30px"><img src="' . esc_url( $schedule_illustration ) . '" alt="Upgrade your domain to PRO with an extra discount" style="max-width:300px; width:100%; height:auto;" /></div>' .
383
+ '<p>A mail button when your off.</p>' ,
384
+ 'clock',
385
+ 'Try PRO 14 days free',
386
  'Upgrade',
387
+ $upgrade_url
388
  );
389
+ } elseif ( $promoItem == 2) {
390
  ( new CnbAdminFunctions() )->cnb_promobox(
391
  'green',
392
+ 'Professional features',
393
+ '<p>⏱️ Button scheduler<br>
394
+ 📷 Icons & custom images on buttons<br>
395
+ 👮 Advanced display rules<br>
396
+ 🌍 Geo targeting<br>
397
  ↕️ Set scroll height for buttons to appear<br>
398
+ Slide-in content windows<br>
399
+ 🔌 Integrate your Intercom chat</p><h3>And much more!</h3>',
400
+ 'performance',
401
+ 'Try PRO 14 days free!',
402
+ 'Upgrade',
403
+ $upgrade_url
404
+ );
405
+ } else {
406
+ ( new CnbAdminFunctions() )->cnb_promobox(
407
+ 'green',
408
+ 'Customize your buttons',
409
+ '<h4>Unlock more icons...</h4>' .
410
+ '<p>Upgrade to Pro to enable an icon picker for your actions.</p>' .
411
+ '<h4>...or personalize with Custom Images</h4>' .
412
+ '<div class="cnb-center" style="padding: 0 34px"><img src="' . esc_url( $custom_image ) . '" alt="Custom button images" style="max-width:246px; width:100%; height:auto;" /></div>' .
413
+ '<p>With custom images you can add your own image to your buttons.</p>',
414
+ 'art',
415
+ 'Try PRO 14 days free!',
416
+ 'Upgrade',
417
+ $upgrade_url
418
  );
419
  }
420
  }
444
  $cnb_options = get_option( 'cnb' );
445
  ?>
446
  <tr>
447
+ <th colspan="2"><h2>NowButtons.com</h2></th>
448
  </tr>
449
  <tr>
450
  <th scope="row">
451
+ <label for="cnb_cloud_enabled">Connection
452
  <?php if ( $cnb_options['cloud_enabled'] == 0 ) { ?>
453
  <a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>"
454
  class="cnb-nounderscore">
470
  <?php if ( $cnb_options['cloud_enabled'] == 0 ) { ?>
471
  <p class="description"><a
472
  href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Sign
473
+ up</a> (free) to add extra functionality.
474
  <a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Learn
475
  more</a>
476
  </p>
src/autoload.php CHANGED
@@ -38,6 +38,7 @@ spl_autoload_register(
38
  'cnb\\admin\\apikey\\cnbapikeycontroller' => '/admin/api-key/CnbApiKeyController.php',
39
  'cnb\\admin\\apikey\\cnbapikeyrouter' => '/admin/api-key/CnbApiKeyRouter.php',
40
  'cnb\\admin\\apikey\\cnbapikeyview' => '/admin/api-key/CnbApiKeyView.php',
 
41
  'cnb\\admin\\button\\cnb_button_list_table' => '/admin/button/Cnb_Button_List_Table.php',
42
  'cnb\\admin\\button\\cnbbutton' => '/admin/button/CnbButton.php',
43
  'cnb\\admin\\button\\cnbbuttoncontroller' => '/admin/button/CnbButtonController.php',
38
  'cnb\\admin\\apikey\\cnbapikeycontroller' => '/admin/api-key/CnbApiKeyController.php',
39
  'cnb\\admin\\apikey\\cnbapikeyrouter' => '/admin/api-key/CnbApiKeyRouter.php',
40
  'cnb\\admin\\apikey\\cnbapikeyview' => '/admin/api-key/CnbApiKeyView.php',
41
+ 'cnb\\admin\\button\\button_edit_table' => '/admin/button/partials/class-button-edit-table.php',
42
  'cnb\\admin\\button\\cnb_button_list_table' => '/admin/button/Cnb_Button_List_Table.php',
43
  'cnb\\admin\\button\\cnbbutton' => '/admin/button/CnbButton.php',
44
  'cnb\\admin\\button\\cnbbuttoncontroller' => '/admin/button/CnbButtonController.php',
src/coupons/class-cnb-promotion-code.php CHANGED
@@ -60,14 +60,14 @@ class CnbPromotionCode {
60
  public function get_restrictions() {
61
  $restrictions = '';
62
  if ( $this->restrictions->firstTimeTransaction ) {
63
- $restrictions .= 'The discount only applies to first-time orders only.';
64
  }
65
 
66
  if ( $this->duration === 'forever' ) {
67
  $restrictions .= 'This discount applies to all your future invoices.';
68
  }
69
  if ( $this->duration === 'once' ) {
70
- $restrictions .= 'This discount applies to your first invoice.';
71
  }
72
  if ( $this->duration === 'repeating' ) {
73
  if ( $this->durationInMonths == 12 ) {
@@ -87,7 +87,7 @@ class CnbPromotionCode {
87
  * @return string
88
  */
89
  public function get_plan() {
90
- return $this->restrictions->minimumAmount > 1000 ? 'the annual plan' : 'all plans';
91
  }
92
 
93
  /**
@@ -98,7 +98,7 @@ class CnbPromotionCode {
98
  if ( $this->duration == 'forever' ) {
99
  $output .= 'for the entire length of your subscription';
100
  } elseif ( $this->duration == 'once' ) {
101
- $output .= 'on your first bill';
102
  } elseif ( $this->restrictions->minimumAmount > 1000 && ceil( $this->durationInMonths / 12 ) > 1 ) {
103
  $output .= 'for the first ' . ceil( $this->durationInMonths / 12 ) . ' years';
104
  } elseif ( $this->restrictions->minimumAmount > 1000 && ceil( $this->durationInMonths / 12 ) == 1 ) {
60
  public function get_restrictions() {
61
  $restrictions = '';
62
  if ( $this->restrictions->firstTimeTransaction ) {
63
+ $restrictions .= 'The discount applies to first-time orders only.';
64
  }
65
 
66
  if ( $this->duration === 'forever' ) {
67
  $restrictions .= 'This discount applies to all your future invoices.';
68
  }
69
  if ( $this->duration === 'once' ) {
70
+ $restrictions .= 'This discount is only applied to your first invoice.';
71
  }
72
  if ( $this->duration === 'repeating' ) {
73
  if ( $this->durationInMonths == 12 ) {
87
  * @return string
88
  */
89
  public function get_plan() {
90
+ return $this->restrictions->minimumAmount > 1000 ? 'when choosing Yearly billing' : 'on all plans';
91
  }
92
 
93
  /**
98
  if ( $this->duration == 'forever' ) {
99
  $output .= 'for the entire length of your subscription';
100
  } elseif ( $this->duration == 'once' ) {
101
+ $output .= 'your first bill';
102
  } elseif ( $this->restrictions->minimumAmount > 1000 && ceil( $this->durationInMonths / 12 ) > 1 ) {
103
  $output .= 'for the first ' . ceil( $this->durationInMonths / 12 ) . ' years';
104
  } elseif ( $this->restrictions->minimumAmount > 1000 && ceil( $this->durationInMonths / 12 ) == 1 ) {
src/notices/CnbAdminNotices.php CHANGED
@@ -130,6 +130,7 @@ class CnbAdminNotices {
130
  public function action_admin_notices() {
131
  foreach ( explode( ',', CnbNotices::TYPES ) as $type ) {
132
  foreach ( $this->admin_notices->{$type} as $admin_notice ) {
 
133
  $notice = apply_filters( 'cnb_admin_notice_filter', $admin_notice );
134
  $this->renderNotice( $notice );
135
  }
130
  public function action_admin_notices() {
131
  foreach ( explode( ',', CnbNotices::TYPES ) as $type ) {
132
  foreach ( $this->admin_notices->{$type} as $admin_notice ) {
133
+ if (!$admin_notice) return;
134
  $notice = apply_filters( 'cnb_admin_notice_filter', $admin_notice );
135
  $this->renderNotice( $notice );
136
  }
src/utils/CnbAdminFunctions.php CHANGED
@@ -57,19 +57,19 @@ class CnbAdminFunctions {
57
  */
58
  function cnb_get_action_types() {
59
  return array(
60
- 'PHONE' => new CnbActionType('PHONE', '💬 Phone', false),
61
- 'EMAIL' => new CnbActionType('EMAIL', '💬 Email', false),
62
- 'SMS' => new CnbActionType('SMS', '💬 SMS/Text', false),
63
- 'WHATSAPP' => new CnbActionType('WHATSAPP', '💬 WhatsApp', false),
64
- 'FACEBOOK' => new CnbActionType('FACEBOOK', '💬 Messenger', false),
65
- 'SIGNAL' => new CnbActionType('SIGNAL', '💬 Signal', false),
66
- 'TELEGRAM' => new CnbActionType('TELEGRAM', '💬 Telegram', false),
67
- 'ANCHOR' => new CnbActionType('ANCHOR', '⏬ Scroll to point', false),
68
- 'LINK' => new CnbActionType('LINK', '🔗 Link', false),
69
- 'MAP' => new CnbActionType('MAP', '📍 Location', false),
70
- 'TALLY' => new CnbActionType('TALLY', '🔌 Tally form window', false),
71
- 'IFRAME' => new CnbActionType('IFRAME', '🔌 Content window', true),
72
- 'INTERCOM' => new CnbActionType('INTERCOM', '🔌 Intercom chat', true)
73
  );
74
  }
75
 
@@ -95,14 +95,30 @@ class CnbAdminFunctions {
95
 
96
  /**
97
  * These apply to URL only
98
- * @return string[]
99
  */
100
  function cnb_get_condition_match_types() {
101
  return array(
102
- 'SIMPLE' => 'Page path is',
103
- 'EXACT' => 'Page URL is',
104
- 'SUBSTRING' => 'Page URL contains',
105
- 'REGEX' => 'Page URL matches RegEx',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  );
107
  }
108
 
57
  */
58
  function cnb_get_action_types() {
59
  return array(
60
+ 'PHONE' => new CnbActionType('PHONE', '💬 Phone', ['STARTER', 'PRO', 'FREE']),
61
+ 'EMAIL' => new CnbActionType('EMAIL', '💬 Email', ['STARTER', 'PRO', 'FREE']),
62
+ 'SMS' => new CnbActionType('SMS', '💬 SMS/Text', ['STARTER', 'PRO', 'FREE']),
63
+ 'WHATSAPP' => new CnbActionType('WHATSAPP', '💬 WhatsApp', ['STARTER', 'PRO', 'FREE']),
64
+ 'FACEBOOK' => new CnbActionType('FACEBOOK', '💬 Messenger', ['STARTER', 'PRO', 'FREE']),
65
+ 'SIGNAL' => new CnbActionType('SIGNAL', '💬 Signal', ['STARTER', 'PRO', 'FREE']),
66
+ 'TELEGRAM' => new CnbActionType('TELEGRAM', '💬 Telegram', ['STARTER', 'PRO', 'FREE']),
67
+ 'ANCHOR' => new CnbActionType('ANCHOR', '⏬ Scroll to point', ['STARTER', 'PRO', 'FREE']),
68
+ 'LINK' => new CnbActionType('LINK', '🔗 Link', ['STARTER', 'PRO', 'FREE']),
69
+ 'MAP' => new CnbActionType('MAP', '📍 Location', ['STARTER', 'PRO', 'FREE']),
70
+ 'TALLY' => new CnbActionType('TALLY', '🔌 Tally form window', ['PRO', 'FREE']),
71
+ 'IFRAME' => new CnbActionType('IFRAME', '🔌 Content window', ['PRO']),
72
+ 'INTERCOM' => new CnbActionType('INTERCOM', '🔌 Intercom chat', ['PRO'])
73
  );
74
  }
75
 
95
 
96
  /**
97
  * These apply to URL only
98
+ * @return array[]
99
  */
100
  function cnb_get_condition_match_types() {
101
  return array(
102
+ 'SIMPLE' => [
103
+ 'name' => 'Page path is',
104
+ 'plans' => ['STARTER', 'PRO', 'FREE']
105
+ ],
106
+ 'EXACT' => [
107
+ 'name' => 'Page URL is',
108
+ 'plans' => ['STARTER', 'PRO', 'FREE']
109
+ ],
110
+ 'SUBSTRING' => [
111
+ 'name' => 'Page URL contains',
112
+ 'plans' => ['STARTER', 'PRO', 'FREE']
113
+ ],
114
+ 'REGEX' => [
115
+ 'name' => 'Page URL matches RegEx',
116
+ 'plans' => ['PRO', 'FREE']
117
+ ],
118
+ 'PARAMETER' => [
119
+ 'name' => 'Page URL parameter is',
120
+ 'plans' => ['PRO']
121
+ ]
122
  );
123
  }
124
 
src/utils/CnbUtils.php CHANGED
@@ -108,7 +108,7 @@ class CnbUtils {
108
  */
109
  private function cnb_utm_params( $utm_campaign, $utm_term ) {
110
  return array(
111
- 'utm_source' => 'wp-plugin_' . CNB_VERSION,
112
  'utm_medium' => 'referral',
113
  'utm_campaign' => $utm_campaign,
114
  'utm_term' => $utm_term
108
  */
109
  private function cnb_utm_params( $utm_campaign, $utm_term ) {
110
  return array(
111
+ 'utm_source' => 'wp-plugin_' . str_replace(' ', '' , CNB_NAME) . '_' . CNB_VERSION,
112
  'utm_medium' => 'referral',
113
  'utm_campaign' => $utm_campaign,
114
  'utm_term' => $utm_term