Version Description
- Couple of UI improvements
- Minor bug fixes
Download this release
Release Info
Developer | jasperroel |
Plugin | Call Now Button |
Version | 1.2.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.1
- call-now-button.php +2 -2
- readme.txt +82 -41
- resources/images/onboarding/buttons-overview.png +0 -0
- resources/js/action-edit-fields.js +4 -1
- resources/js/call-now-button.js +2 -2
- src/admin/action/CnbActionType.php +39 -0
- src/admin/action/CnbActionViewEdit.php +24 -9
- src/admin/action/Cnb_Action_List_Table.php +1 -1
- src/admin/action/partials/class-action-whatsapp-settings.php +1 -1
- src/admin/api/CnbAppRemote.php +3 -1
- src/admin/button/CnbButtonView.php +7 -5
- src/admin/button/CnbButtonViewEdit.php +3 -3
- src/admin/button/Cnb_Button_List_Table.php +1 -1
- src/admin/condition/CnbConditionViewEdit.php +2 -1
- src/admin/domain/partials/CnbDomainViewUpgradeOverview.php +10 -3
- src/admin/getting-started/class-getting-started-view.php +3 -1
- src/admin/legacy/CnbLegacyUpgrade.php +7 -6
- src/admin/partials/CnbHeaderNotices.php +1 -1
- src/admin/settings/CnbApiKeyActivatedView.php +15 -10
- src/admin/settings/CnbSettingsRouter.php +4 -0
- src/admin/settings/CnbSettingsViewEdit.php +6 -25
- src/autoload.php +1 -0
- src/coupons/class-cnb-promotion-code.php +3 -0
- src/notices/CnbAdminNotices.php +35 -50
- src/notices/CnbNotice.php +14 -1
- src/utils/CnbAdminFunctions.php +16 -14
call-now-button.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Call Now Button
|
4 |
Plugin URI: https://callnowbutton.com
|
5 |
Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
|
6 |
-
Version: 1.2.
|
7 |
Author: Jerry & Jasper
|
8 |
Author URI: https://www.callnowbutton.com
|
9 |
GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
|
@@ -26,7 +26,7 @@ License: GPL2
|
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
-
define('CNB_VERSION', '1.2.
|
30 |
define('CNB_NAME', 'Call Now Button');
|
31 |
define('CNB_BASENAME', plugin_basename(__FILE__));
|
32 |
define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
|
3 |
Plugin Name: Call Now Button
|
4 |
Plugin URI: https://callnowbutton.com
|
5 |
Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
|
6 |
+
Version: 1.2.1
|
7 |
Author: Jerry & Jasper
|
8 |
Author URI: https://www.callnowbutton.com
|
9 |
GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
+
define('CNB_VERSION', '1.2.1');
|
30 |
define('CNB_NAME', 'Call Now Button');
|
31 |
define('CNB_BASENAME', plugin_basename(__FILE__));
|
32 |
define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
|
readme.txt
CHANGED
@@ -1,36 +1,81 @@
|
|
1 |
-
=== Call Now Button ===
|
2 |
Contributors: jgrietveld, jasperroel
|
3 |
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.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
The web's #1 click to call button for your website! A
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
###What does the plugin do?
|
17 |
|
18 |
This plugin places a Call Now Button (click-to-call button) to the bottom of the screen which is **only visible for your mobile visitors**. Because your mobile visitors already have a phone in their hands this plugin will allow them to call you with one simple touch of the button.
|
19 |
No more navigating to the contact page and no more complicated copy/pasting or memorizing the phone number!
|
20 |
|
|
|
|
|
|
|
21 |
###Could not be easier!
|
22 |
The settings are very easy: enable and enter your phone number. That's it!
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
|
36 |
== Installation ==
|
@@ -67,14 +112,6 @@ Next thing is to make sure that your theme is responsive. Responsive means that
|
|
67 |
|
68 |
Last thing to check is if you have a caching plugin installed. Caching plugins make your website faster by showing a copy of your website instead of the actual website. As a consequence you will not see the Call Now Button because the copy was made before the button was installed. To fix this, go to your cache plugin settings page and empty the cache (sometimes called flush the cache). After doing this you should see the button. Do the same thing each time you make changes to the button.
|
69 |
|
70 |
-
= My website is responsive but I don't see the button
|
71 |
-
|
72 |
-
Check if you have any caching plugins active on your website. Your website is likely cached and you're looking at an older copy of your website. Delete/empty the cache and reload your website.
|
73 |
-
|
74 |
-
= I updated the button but I'm not seeing the changes on my website
|
75 |
-
|
76 |
-
You have a caching plugin active on your website and you are looking at a cached version of your website. Delete/empty the cache and reload your website.
|
77 |
-
|
78 |
= I only see the button on some pages of my website
|
79 |
|
80 |
You have a caching plugin active on your website and the cached pages are showing an older version of your website. Delete/empty the cache and reload the pages.
|
@@ -83,11 +120,11 @@ Another option could be that you have set the Call Now Button to only appear on
|
|
83 |
|
84 |
= Do I have to add a country code to my phone number? =
|
85 |
|
86 |
-
You don't have to, but
|
87 |
|
88 |
= Do I start the number with + or 00? =
|
89 |
|
90 |
-
In most countries you'll be fine using either but there are some exceptions. To be on the safe side
|
91 |
|
92 |
= Can I change the appearance of the Call Now Button? =
|
93 |
|
@@ -99,7 +136,7 @@ Yes, you can enter the IDs of posts and pages you wish to include or exclude.
|
|
99 |
|
100 |
= I need way more flexibility! Isn't there a PRO version that I can use? =
|
101 |
|
102 |
-
Yes, you can
|
103 |
|
104 |
|
105 |
== Screenshots ==
|
@@ -111,6 +148,10 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
|
|
111 |
|
112 |
|
113 |
== Changelog ==
|
|
|
|
|
|
|
|
|
114 |
= 1.2.0 =
|
115 |
* Added an onboarding guide for new Cloud users (Cloud)
|
116 |
* Option to use images/photos on buttons (PRO)
|
@@ -133,14 +174,14 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
|
|
133 |
* Bugfixes
|
134 |
|
135 |
= 1.1.10 =
|
136 |
-
* Introduced geo targeting (
|
137 |
-
* New PRO feature: Reveal at scroll height (
|
138 |
* Small fixes/improvements
|
139 |
|
140 |
= 1.1.9 =
|
141 |
* Introduced exit surveys
|
142 |
* Error & usage reporting setting (off by default)
|
143 |
-
* Email subscription setting (
|
144 |
* Small fixes/improvements
|
145 |
|
146 |
= 1.1.8 =
|
@@ -161,11 +202,11 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
|
|
161 |
= 1.1.4 =
|
162 |
* New phone icon on call button
|
163 |
* Sunsetted the original (classic) corner button
|
164 |
-
* Added Facebook Messenger, Telegram and Signal buttons (
|
165 |
-
* New icons for link (calendar) and anchor (up arrow) buttons (
|
166 |
-
* Anchor button now has smooth scroll (
|
167 |
-
* Location button now has directions (
|
168 |
-
* WhatsApp modal improvement (multiple speech bubbles, animated conversation and notification count) (
|
169 |
|
170 |
= 1.1.3 =
|
171 |
* Bugfixes
|
@@ -178,21 +219,21 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
|
|
178 |
|
179 |
= 1.1.0 =
|
180 |
* Full code refactor
|
181 |
-
* Conditions now in WordPress table (
|
182 |
-
* Warning notification when debug mode is active (
|
183 |
* Added upgrade success page
|
184 |
* Minor bug fixes
|
185 |
* Performance improvements
|
186 |
|
187 |
= 1.0.8 =
|
188 |
-
* WhatsApp chat modal (
|
189 |
-
* Multiple buttons on a single page (
|
190 |
-
* Icon selection (
|
191 |
-
* Drag and drop action sorting (
|
192 |
-
* Time selector in the preview (
|
193 |
-
* Button animations (
|
194 |
-
* Set link target (
|
195 |
-
* Display setting shown in button overview (
|
196 |
|
197 |
= 1.0.7 =
|
198 |
* Bugfix for Localization
|
@@ -328,5 +369,5 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
|
|
328 |
* First time launch
|
329 |
|
330 |
== Upgrade Notice ==
|
331 |
-
= 1.
|
332 |
-
* Upgrade now to keep your Call Now Button up to date. The update contains some small UI improvements and
|
1 |
+
=== Call Now Button – Always Accessible Contact Buttons for Calls, SMS, Email, Chat, Maps and Much More. Improve Conversion Rates and Get More Business From Your Website ===
|
2 |
Contributors: jgrietveld, jasperroel
|
3 |
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.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
+
The web's #1 click to call button for your website! A simple and powerful plugin that adds a Call Now Button to your website for your mobile visitors.
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
### What does the plugin do?
|
17 |
|
18 |
This plugin places a Call Now Button (click-to-call button) to the bottom of the screen which is **only visible for your mobile visitors**. Because your mobile visitors already have a phone in their hands this plugin will allow them to call you with one simple touch of the button.
|
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!
|
26 |
|
27 |
+
The label allows you to add some text to your button. Leaving the label empty will show a nice circular phone button to your visitors (take a look at the screenshots).
|
28 |
+
|
29 |
+
#### Presentation controls
|
30 |
+
Under the **Presentation tab** you can change the colors of the button, move it to a different screen position and limit the pages on which the button should be visible.
|
31 |
+
|
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
|
39 |
+
SMS/Text, Email, Maps, URLs, Scroll to top
|
40 |
+
|
41 |
+
#### 🤗 Social chat
|
42 |
+
WhatsApp Chat, Messenger, Telegram, Signal
|
43 |
+
|
44 |
+
#### 🆕 Lots of buttons
|
45 |
+
Multiple buttons for your website, even on a single page
|
46 |
+
|
47 |
+
#### 🗂️ Multi action buttons
|
48 |
+
Multibutton (expandable) and Buttonbar (full width)
|
49 |
+
|
50 |
+
#### 💬 WhatsApp chat window
|
51 |
+
A WhatsApp chat window to slide into the screen
|
52 |
+
|
53 |
+
#### 🖥️ All devices
|
54 |
+
Desktop/laptop and mobile support
|
55 |
|
56 |
+
#### 🎯 Advanced page targeting
|
57 |
+
Create smart rules for your buttons to appear
|
58 |
|
59 |
+
#### 🕘 Scheduler
|
60 |
+
Create a weekly schedule for your buttons
|
61 |
|
62 |
+
#### 👋 Animations
|
63 |
+
Add extra attention grabbing animations
|
64 |
|
65 |
+
#### 🎨 Icon picker
|
66 |
+
Select the right icon for your button
|
67 |
+
|
68 |
+
#### 👽 3rd party integrations
|
69 |
+
Content Windows, Intercom chat and Tally forms
|
70 |
+
|
71 |
+
### Call Now Button PRO
|
72 |
+
We also offer a paid version of the Call Now Button. The PRO plan offers the following extras:
|
73 |
+
|
74 |
+
📄 Slide-in Content Windows
|
75 |
+
📷 Use custom images on buttons
|
76 |
+
🌍 Include and exclude countries
|
77 |
+
↕️ Set scroll height for buttons to appear
|
78 |
+
🔌 Intercom integration
|
79 |
|
80 |
|
81 |
== Installation ==
|
112 |
|
113 |
Last thing to check is if you have a caching plugin installed. Caching plugins make your website faster by showing a copy of your website instead of the actual website. As a consequence you will not see the Call Now Button because the copy was made before the button was installed. To fix this, go to your cache plugin settings page and empty the cache (sometimes called flush the cache). After doing this you should see the button. Do the same thing each time you make changes to the button.
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
= I only see the button on some pages of my website
|
116 |
|
117 |
You have a caching plugin active on your website and the cached pages are showing an older version of your website. Delete/empty the cache and reload the pages.
|
120 |
|
121 |
= Do I have to add a country code to my phone number? =
|
122 |
|
123 |
+
You don't have to, but we recommend that you do to increase your options internationally.
|
124 |
|
125 |
= Do I start the number with + or 00? =
|
126 |
|
127 |
+
In most countries you'll be fine using either but there are some exceptions. To be on the safe side we recommend using the plus sign.
|
128 |
|
129 |
= Can I change the appearance of the Call Now Button? =
|
130 |
|
136 |
|
137 |
= I need way more flexibility! Isn't there a PRO version that I can use? =
|
138 |
|
139 |
+
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/).
|
140 |
|
141 |
|
142 |
== Screenshots ==
|
148 |
|
149 |
|
150 |
== Changelog ==
|
151 |
+
= 1.2.1 =
|
152 |
+
* Couple of UI improvements
|
153 |
+
* Minor bug fixes
|
154 |
+
|
155 |
= 1.2.0 =
|
156 |
* Added an onboarding guide for new Cloud users (Cloud)
|
157 |
* Option to use images/photos on buttons (PRO)
|
174 |
* Bugfixes
|
175 |
|
176 |
= 1.1.10 =
|
177 |
+
* Introduced geo targeting (PRO)
|
178 |
+
* New PRO feature: Reveal at scroll height (PRO)
|
179 |
* Small fixes/improvements
|
180 |
|
181 |
= 1.1.9 =
|
182 |
* Introduced exit surveys
|
183 |
* Error & usage reporting setting (off by default)
|
184 |
+
* Email subscription setting (Cloud)
|
185 |
* Small fixes/improvements
|
186 |
|
187 |
= 1.1.8 =
|
202 |
= 1.1.4 =
|
203 |
* New phone icon on call button
|
204 |
* Sunsetted the original (classic) corner button
|
205 |
+
* Added Facebook Messenger, Telegram and Signal buttons (Cloud)
|
206 |
+
* New icons for link (calendar) and anchor (up arrow) buttons (Cloud)
|
207 |
+
* Anchor button now has smooth scroll (Cloud)
|
208 |
+
* Location button now has directions (Cloud)
|
209 |
+
* WhatsApp modal improvement (multiple speech bubbles, animated conversation and notification count) (Cloud)
|
210 |
|
211 |
= 1.1.3 =
|
212 |
* Bugfixes
|
219 |
|
220 |
= 1.1.0 =
|
221 |
* Full code refactor
|
222 |
+
* Conditions now in WordPress table (Cloud)
|
223 |
+
* Warning notification when debug mode is active (Cloud)
|
224 |
* Added upgrade success page
|
225 |
* Minor bug fixes
|
226 |
* Performance improvements
|
227 |
|
228 |
= 1.0.8 =
|
229 |
+
* WhatsApp chat modal (Cloud)
|
230 |
+
* Multiple buttons on a single page (Cloud)
|
231 |
+
* Icon selection (Cloud)
|
232 |
+
* Drag and drop action sorting (Cloud)
|
233 |
+
* Time selector in the preview (Cloud)
|
234 |
+
* Button animations (Cloud)
|
235 |
+
* Set link target (Cloud)
|
236 |
+
* Display setting shown in button overview (Cloud)
|
237 |
|
238 |
= 1.0.7 =
|
239 |
* Bugfix for Localization
|
369 |
* First time launch
|
370 |
|
371 |
== Upgrade Notice ==
|
372 |
+
= 1.2.1 =
|
373 |
+
* Upgrade now to keep your Call Now Button up to date. The update contains some small UI improvements and bug fixes.
|
resources/images/onboarding/buttons-overview.png
CHANGED
Binary file
|
resources/js/action-edit-fields.js
CHANGED
@@ -79,6 +79,7 @@ function cnb_action_update_appearance(value) {
|
|
79 |
const iframeEle = jQuery('.cnb-action-properties-iframe')
|
80 |
const tallyEle = jQuery('.cnb-action-properties-tally')
|
81 |
const intercomEle = jQuery('.cnb-action-properties-intercom')
|
|
|
82 |
|
83 |
const valueEle = jQuery('.cnb-action-value')
|
84 |
const valueTextEle = jQuery('#cnb_action_value_input')
|
@@ -98,6 +99,7 @@ function cnb_action_update_appearance(value) {
|
|
98 |
.add(iframeEle)
|
99 |
.add(tallyEle)
|
100 |
.add(intercomEle)
|
|
|
101 |
|
102 |
$all.hide()
|
103 |
|
@@ -110,8 +112,9 @@ function cnb_action_update_appearance(value) {
|
|
110 |
|
111 |
switch (value) {
|
112 |
case 'ANCHOR':
|
113 |
-
valuelabelEle.text('
|
114 |
valueTextEle.attr("required", "required")
|
|
|
115 |
break
|
116 |
case 'EMAIL':
|
117 |
valuelabelEle.text('E-mail address')
|
79 |
const iframeEle = jQuery('.cnb-action-properties-iframe')
|
80 |
const tallyEle = jQuery('.cnb-action-properties-tally')
|
81 |
const intercomEle = jQuery('.cnb-action-properties-intercom')
|
82 |
+
const anchorEle = jQuery('.cnb-action-properties-anchor')
|
83 |
|
84 |
const valueEle = jQuery('.cnb-action-value')
|
85 |
const valueTextEle = jQuery('#cnb_action_value_input')
|
99 |
.add(iframeEle)
|
100 |
.add(tallyEle)
|
101 |
.add(intercomEle)
|
102 |
+
.add(anchorEle)
|
103 |
|
104 |
$all.hide()
|
105 |
|
112 |
|
113 |
switch (value) {
|
114 |
case 'ANCHOR':
|
115 |
+
valuelabelEle.text('Page anchor')
|
116 |
valueTextEle.attr("required", "required")
|
117 |
+
anchorEle.show()
|
118 |
break
|
119 |
case 'EMAIL':
|
120 |
valuelabelEle.text('E-mail address')
|
resources/js/call-now-button.js
CHANGED
@@ -252,7 +252,7 @@ function cnb_button_overview_modal() {
|
|
252 |
jQuery('#button_type').val(cnbType)
|
253 |
})
|
254 |
|
255 |
-
jQuery("
|
256 |
setTimeout(function () {
|
257 |
// Ensure that the hidden value input is not required
|
258 |
jQuery('#cnb_action_value_input').removeAttr('required')
|
@@ -262,7 +262,7 @@ function cnb_button_overview_modal() {
|
|
262 |
}
|
263 |
|
264 |
function cnb_button_overview_add_new_click() {
|
265 |
-
jQuery("
|
266 |
return false
|
267 |
}
|
268 |
|
252 |
jQuery('#button_type').val(cnbType)
|
253 |
})
|
254 |
|
255 |
+
jQuery(".cnb-button-overview-modal-add-new").on("click", function() {
|
256 |
setTimeout(function () {
|
257 |
// Ensure that the hidden value input is not required
|
258 |
jQuery('#cnb_action_value_input').removeAttr('required')
|
262 |
}
|
263 |
|
264 |
function cnb_button_overview_add_new_click() {
|
265 |
+
jQuery(".cnb-button-overview-modal-add-new").trigger("click")
|
266 |
return false
|
267 |
}
|
268 |
|
src/admin/action/CnbActionType.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cnb\admin\action;
|
3 |
+
|
4 |
+
// don't load directly
|
5 |
+
defined( 'ABSPATH' ) || die( '-1' );
|
6 |
+
|
7 |
+
class CnbActionType {
|
8 |
+
|
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 |
+
/**
|
21 |
+
* PHONE, EMAIL, etc
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
public $type;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Display name, such as "💬 Phone", "🔗 Link", etc
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
public $name;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Whether this feature is a Pro feature
|
35 |
+
* @var boolean
|
36 |
+
*/
|
37 |
+
public $isPro;
|
38 |
+
|
39 |
+
}
|
src/admin/action/CnbActionViewEdit.php
CHANGED
@@ -29,7 +29,7 @@ class CnbActionViewEdit {
|
|
29 |
}
|
30 |
if ( $action->id !== 'new' ) {
|
31 |
$actionTypes = ( new CnbAdminFunctions() )->cnb_get_action_types();
|
32 |
-
$name = $actionTypes[ $action->actionType ];
|
33 |
if ( $action->actionValue ) {
|
34 |
$name = $action->actionValue;
|
35 |
}
|
@@ -173,19 +173,33 @@ class CnbActionViewEdit {
|
|
173 |
</th>
|
174 |
</tr>
|
175 |
<?php } ?>
|
176 |
-
|
177 |
-
<th colspan="2"></th>
|
178 |
-
</tr>
|
179 |
<tr class="cnb_hide_on_modal">
|
180 |
<th scope="row"><label for="cnb_action_type">Button type</label></th>
|
181 |
<td>
|
182 |
<select id="cnb_action_type" name="actions[<?php echo esc_attr( $action->id ) ?>][actionType]">
|
183 |
<?php foreach ( ( new CnbAdminFunctions() )->cnb_get_action_types() as $action_type_key => $action_type_value ) { ?>
|
184 |
-
<option
|
185 |
-
|
|
|
|
|
|
|
186 |
</option>
|
187 |
<?php } ?>
|
188 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
<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>
|
190 |
</td>
|
191 |
</tr>
|
@@ -203,6 +217,7 @@ class CnbActionViewEdit {
|
|
203 |
onclick="cnb_action_update_map_link(this)"
|
204 |
target="_blank">Google Maps</a></p>
|
205 |
<p class="description cnb-action-properties-tally">ID is last part of the share link, e.g. <code>wA74do</code> for <code>https://tally.so/r/wA74do</code>.</p>
|
|
|
206 |
<p class="description cnb-action-properties-intercom">E.g. <code>gkeb4bs</code>. See <a
|
207 |
href="https://www.intercom.com/help/en/articles/3539-where-can-i-find-my-workspace-id-app-id?utm_source=callnowbutton&utm_medium=callnowbutton-plugin"
|
208 |
target="_blank">this Intercom article</a> on how to find your app ID.</p>
|
@@ -409,10 +424,9 @@ class CnbActionViewEdit {
|
|
409 |
type='button'
|
410 |
class="button-secondary" value="<?php esc_attr_e( 'Select image' ); ?>"
|
411 |
id="cnb_select_image"
|
412 |
-
<?php if (!$isPro) { ?>disabled="disabled"<?php } ?>
|
413 |
/>
|
414 |
|
415 |
-
|
416 |
<?php if (!$isPro && $domain) {
|
417 |
$upgrade_link =
|
418 |
add_query_arg( array(
|
@@ -423,7 +437,8 @@ class CnbActionViewEdit {
|
|
423 |
admin_url( 'admin.php' ) );
|
424 |
?>
|
425 |
<p class="description">
|
426 |
-
|
|
|
427 |
</p>
|
428 |
<?php } ?>
|
429 |
|
29 |
}
|
30 |
if ( $action->id !== 'new' ) {
|
31 |
$actionTypes = ( new CnbAdminFunctions() )->cnb_get_action_types();
|
32 |
+
$name = $actionTypes[ $action->actionType ]->name;
|
33 |
if ( $action->actionValue ) {
|
34 |
$name = $action->actionValue;
|
35 |
}
|
173 |
</th>
|
174 |
</tr>
|
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>
|
217 |
onclick="cnb_action_update_map_link(this)"
|
218 |
target="_blank">Google Maps</a></p>
|
219 |
<p class="description cnb-action-properties-tally">ID is last part of the share link, e.g. <code>wA74do</code> for <code>https://tally.so/r/wA74do</code>.</p>
|
220 |
+
<p class="description cnb-action-properties-anchor">The anchor can be either a HTML tag name (e.g. <code>body</code>), a name attribute (e.g. a form field) or an ID attribute.</p>
|
221 |
<p class="description cnb-action-properties-intercom">E.g. <code>gkeb4bs</code>. See <a
|
222 |
href="https://www.intercom.com/help/en/articles/3539-where-can-i-find-my-workspace-id-app-id?utm_source=callnowbutton&utm_medium=callnowbutton-plugin"
|
223 |
target="_blank">this Intercom article</a> on how to find your app ID.</p>
|
424 |
type='button'
|
425 |
class="button-secondary" value="<?php esc_attr_e( 'Select image' ); ?>"
|
426 |
id="cnb_select_image"
|
427 |
+
<?php if (!$isPro) { ?>disabled="disabled" title="Upgrade to PRO to enable custom images"<?php } ?>
|
428 |
/>
|
429 |
|
|
|
430 |
<?php if (!$isPro && $domain) {
|
431 |
$upgrade_link =
|
432 |
add_query_arg( array(
|
437 |
admin_url( 'admin.php' ) );
|
438 |
?>
|
439 |
<p class="description">
|
440 |
+
Setting a custom image is a <span class="cnb-pro-badge">Pro</span> feature.
|
441 |
+
<a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a>.
|
442 |
</p>
|
443 |
<?php } ?>
|
444 |
|
src/admin/action/Cnb_Action_List_Table.php
CHANGED
@@ -413,7 +413,7 @@ class Cnb_Action_List_Table extends WP_List_Table {
|
|
413 |
}
|
414 |
|
415 |
$actionTypes = ( new CnbAdminFunctions() )->cnb_get_action_types();
|
416 |
-
$value = ! empty( $item->actionType ) ? esc_html( $actionTypes[ $item->actionType ] ) : '<em>No value</em>';
|
417 |
|
418 |
return sprintf(
|
419 |
'%1$s %2$s',
|
413 |
}
|
414 |
|
415 |
$actionTypes = ( new CnbAdminFunctions() )->cnb_get_action_types();
|
416 |
+
$value = ! empty( $item->actionType ) ? esc_html( $actionTypes[ $item->actionType ]->name ) : '<em>No value</em>';
|
417 |
|
418 |
return sprintf(
|
419 |
'%1$s %2$s',
|
src/admin/action/partials/class-action-whatsapp-settings.php
CHANGED
@@ -59,7 +59,7 @@ class ActionWhatsappSettings {
|
|
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' ); ?>>...
|
63 |
</option>
|
64 |
</select>
|
65 |
</td>
|
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>
|
src/admin/api/CnbAppRemote.php
CHANGED
@@ -158,7 +158,9 @@ class CnbAppRemote {
|
|
158 |
return $response;
|
159 |
}
|
160 |
if ( $response['response']['code'] == 403 ) {
|
161 |
-
|
|
|
|
|
162 |
}
|
163 |
if ( $response['response']['code'] == 404 ) {
|
164 |
return new WP_Error( 'CNB_ENTITY_NOT_FOUND', $response['response']['message'] );
|
158 |
return $response;
|
159 |
}
|
160 |
if ( $response['response']['code'] == 403 ) {
|
161 |
+
if ($response['response']['message'] == 'Forbidden' && str_contains($response['body'], 'Access Denied')) {
|
162 |
+
return new WP_Error( 'CNB_API_KEY_INVALID', $response['response']['message'] );
|
163 |
+
}
|
164 |
}
|
165 |
if ( $response['response']['code'] == 404 ) {
|
166 |
return new WP_Error( 'CNB_ENTITY_NOT_FOUND', $response['response']['message'] );
|
src/admin/button/CnbButtonView.php
CHANGED
@@ -38,7 +38,7 @@ class CnbButtonView {
|
|
38 |
public function cnb_create_new_button() {
|
39 |
$url = $this->get_modal_link();
|
40 |
printf(
|
41 |
-
'<a href="%s" title="%s" class="thickbox open-plugin-details-modal
|
42 |
esc_url( $url ),
|
43 |
esc_html__( 'Create new button' ),
|
44 |
'page-title-action',
|
@@ -55,7 +55,7 @@ class CnbButtonView {
|
|
55 |
public function render_lets_create_one_link() {
|
56 |
$url = $this->get_modal_link();
|
57 |
printf(
|
58 |
-
'<a href="%s" title="%s" class="thickbox open-plugin-details-modal
|
59 |
esc_url( $url ),
|
60 |
esc_html__( 'Create new button' ),
|
61 |
esc_html__( 'Choose a Button type' ),
|
@@ -163,9 +163,11 @@ class CnbButtonView {
|
|
163 |
'Remove "Powered by"',
|
164 |
'<p>✨ Remove the <em>Powered by</em> notice</p>
|
165 |
<p><strong>Plus enable extra features:</strong><br>
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
169 |
'flag',
|
170 |
'<strong>€<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> per month</strong>',
|
171 |
'Upgrade',
|
38 |
public function cnb_create_new_button() {
|
39 |
$url = $this->get_modal_link();
|
40 |
printf(
|
41 |
+
'<a href="%s" title="%s" class="thickbox open-plugin-details-modal cnb-button-overview-modal-add-new %s" data-title="%s">%s</a>',
|
42 |
esc_url( $url ),
|
43 |
esc_html__( 'Create new button' ),
|
44 |
'page-title-action',
|
55 |
public function render_lets_create_one_link() {
|
56 |
$url = $this->get_modal_link();
|
57 |
printf(
|
58 |
+
'<a href="%s" title="%s" class="thickbox open-plugin-details-modal cnb-button-overview-modal-add-new" data-title="%s">%s</a>',
|
59 |
esc_url( $url ),
|
60 |
esc_html__( 'Create new button' ),
|
61 |
esc_html__( 'Choose a Button type' ),
|
163 |
'Remove "Powered by"',
|
164 |
'<p>✨ Remove the <em>Powered by</em> notice</p>
|
165 |
<p><strong>Plus enable extra features:</strong><br>
|
166 |
+
📄 Slide-in content windows<br>
|
167 |
+
📷 Use custom images on buttons<br>
|
168 |
+
🌍 Include and exclude countries<br>
|
169 |
+
↕️ Set scroll height for buttons to appear<br>
|
170 |
+
🔌 Intercom Chat integration</p>',
|
171 |
'flag',
|
172 |
'<strong>€<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> per month</strong>',
|
173 |
'Upgrade',
|
src/admin/button/CnbButtonViewEdit.php
CHANGED
@@ -563,7 +563,7 @@ class CnbButtonViewEdit {
|
|
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-
|
567 |
target="_blank" class="cnb-nounderscore">
|
568 |
<span class="dashicons dashicons-editor-help"></span>
|
569 |
</a></label></th>
|
@@ -794,8 +794,8 @@ class CnbButtonViewEdit {
|
|
794 |
admin_url( 'admin.php' ) );
|
795 |
?>
|
796 |
<p class="description">
|
797 |
-
|
798 |
-
|
799 |
<?php } ?>
|
800 |
</td>
|
801 |
</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>
|
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>
|
src/admin/button/Cnb_Button_List_Table.php
CHANGED
@@ -248,7 +248,7 @@ class Cnb_Button_List_Table extends WP_List_Table {
|
|
248 |
$actionValue = ! empty( $action->actionValue ) ? esc_html( $action->actionValue ) : '<em>No value</em>';
|
249 |
$actionTypes = ( new CnbAdminFunctions() )->cnb_get_action_types();
|
250 |
$actionType = $actionTypes[ $action->actionType ];
|
251 |
-
$actionMsg .=
|
252 |
}
|
253 |
$diff = $count - count( $actions );
|
254 |
if ( $diff > 0 ) {
|
248 |
$actionValue = ! empty( $action->actionValue ) ? esc_html( $action->actionValue ) : '<em>No value</em>';
|
249 |
$actionTypes = ( new CnbAdminFunctions() )->cnb_get_action_types();
|
250 |
$actionType = $actionTypes[ $action->actionType ];
|
251 |
+
$actionMsg .= esc_html($actionType->name) . ' (' . esc_html($actionValue) . ')<br />';
|
252 |
}
|
253 |
$diff = $count - count( $actions );
|
254 |
if ( $diff > 0 ) {
|
src/admin/condition/CnbConditionViewEdit.php
CHANGED
@@ -111,7 +111,8 @@ class CnbConditionViewEdit {
|
|
111 |
admin_url( 'admin.php' ) );
|
112 |
?>
|
113 |
<p class="description">
|
114 |
-
|
|
|
115 |
</p>
|
116 |
<?php } ?>
|
117 |
</td>
|
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 } ?>
|
118 |
</td>
|
src/admin/domain/partials/CnbDomainViewUpgradeOverview.php
CHANGED
@@ -43,9 +43,14 @@ class CnbDomainViewUpgradeOverview {
|
|
43 |
$coupon = (new CnbAppRemotePromotionCodes())->get_coupon();
|
44 |
if ($coupon != null && !is_wp_error($coupon)) { ?>
|
45 |
<div class="cnb-promo-bar cnb-flexbox">
|
|
|
46 |
<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);?>">
|
47 |
Coupon expires in <?php echo esc_html($coupon->get_redeem_by()) ?>
|
48 |
</div>
|
|
|
|
|
|
|
|
|
49 |
<div class="cnb-coupon-details">
|
50 |
<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>
|
51 |
<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>
|
@@ -55,10 +60,12 @@ class CnbDomainViewUpgradeOverview {
|
|
55 |
<h1 class="cnb-upgrade-title">Upgrade <?php echo esc_html( $domain->name ) ?> to PRO</h1>
|
56 |
<div class="cnb-pricebox">
|
57 |
<div class="cnb-benefit">🧰 All features from Cloud</div>
|
58 |
-
<div class="cnb-benefit"
|
59 |
<div class="cnb-benefit">📷 Use custom images on buttons</div>
|
60 |
<div class="cnb-benefit">🌍 Include and exclude countries</div>
|
61 |
<div class="cnb-benefit">↕️ Set scroll height for buttons to appear</div>
|
|
|
|
|
62 |
</div>
|
63 |
<?php
|
64 |
$this->renderUpgradeForm( $domain );
|
@@ -108,7 +115,7 @@ class CnbDomainViewUpgradeOverview {
|
|
108 |
|
109 |
<div class="cnb-pricebox cnb-currency-box
|
110 |
<?php if ( $active_currency !== 'usd' ) { ?>currency-box-active<?php } ?>">
|
111 |
-
<h3 class="cnb-price-eur"
|
112 |
|
113 |
<div class="plan-amount"><span class="currency">€</span><span
|
114 |
class="euros"><?php echo esc_html( $plan_x ) ?></span><span
|
@@ -132,7 +139,7 @@ class CnbDomainViewUpgradeOverview {
|
|
132 |
?>
|
133 |
<div class="cnb-pricebox cnb-currency-box
|
134 |
<?php if ( $active_currency !== 'eur' ) { ?>currency-box-active<?php } ?>">
|
135 |
-
<h3 class="cnb-price-usd"
|
136 |
|
137 |
<div class="plan-amount"><span class="currency">$</span><span
|
138 |
class="euros"><?php echo esc_html( $plan_x ) ?></span><span
|
43 |
$coupon = (new CnbAppRemotePromotionCodes())->get_coupon();
|
44 |
if ($coupon != null && !is_wp_error($coupon)) { ?>
|
45 |
<div class="cnb-promo-bar cnb-flexbox">
|
46 |
+
<?php if ($coupon->redeemByDate) { ?>
|
47 |
<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);?>">
|
48 |
Coupon expires in <?php echo esc_html($coupon->get_redeem_by()) ?>
|
49 |
</div>
|
50 |
+
<?php } else { ?>
|
51 |
+
<div class="cnb_align_right cnb-coupon-timer"> </div>
|
52 |
+
<?php }?>
|
53 |
+
|
54 |
<div class="cnb-coupon-details">
|
55 |
<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>
|
56 |
<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>
|
60 |
<h1 class="cnb-upgrade-title">Upgrade <?php echo esc_html( $domain->name ) ?> to PRO</h1>
|
61 |
<div class="cnb-pricebox">
|
62 |
<div class="cnb-benefit">🧰 All features from Cloud</div>
|
63 |
+
<div class="cnb-benefit">📄 Slide-in content windows</div>
|
64 |
<div class="cnb-benefit">📷 Use custom images on buttons</div>
|
65 |
<div class="cnb-benefit">🌍 Include and exclude countries</div>
|
66 |
<div class="cnb-benefit">↕️ Set scroll height for buttons to appear</div>
|
67 |
+
<div class="cnb-benefit">🔌 Intercom Chat integration</div>
|
68 |
+
<div class="cnb-benefit">✨ "Powered by" notice removed</div>
|
69 |
</div>
|
70 |
<?php
|
71 |
$this->renderUpgradeForm( $domain );
|
115 |
|
116 |
<div class="cnb-pricebox cnb-currency-box
|
117 |
<?php if ( $active_currency !== 'usd' ) { ?>currency-box-active<?php } ?>">
|
118 |
+
<h3 class="cnb-price-eur">PRO €</h3>
|
119 |
|
120 |
<div class="plan-amount"><span class="currency">€</span><span
|
121 |
class="euros"><?php echo esc_html( $plan_x ) ?></span><span
|
139 |
?>
|
140 |
<div class="cnb-pricebox cnb-currency-box
|
141 |
<?php if ( $active_currency !== 'eur' ) { ?>currency-box-active<?php } ?>">
|
142 |
+
<h3 class="cnb-price-usd">PRO $</h3>
|
143 |
|
144 |
<div class="plan-amount"><span class="currency">$</span><span
|
145 |
class="euros"><?php echo esc_html( $plan_x ) ?></span><span
|
src/admin/getting-started/class-getting-started-view.php
CHANGED
@@ -56,7 +56,7 @@ class GettingStartedView {
|
|
56 |
<h3>🎨 Icon picker</h3>
|
57 |
<p>Select the right icon for your button</p>
|
58 |
<h3>👽 3rd party integrations</h3>
|
59 |
-
<p>
|
60 |
|
61 |
</div>
|
62 |
</div>
|
@@ -110,9 +110,11 @@ class GettingStartedView {
|
|
110 |
<div class="cnb-welcome-blocks">
|
111 |
<h2>PRO features include</h2>
|
112 |
<div class="cnb-center">
|
|
|
113 |
<h3>📷 Use custom images on buttons</h3>
|
114 |
<h3>🌍 Include and exclude countries</h3>
|
115 |
<h3>↕️ Set scroll height for buttons to appear</h3>
|
|
|
116 |
</div>
|
117 |
</div>
|
118 |
</div>
|
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>
|
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>
|
src/admin/legacy/CnbLegacyUpgrade.php
CHANGED
@@ -63,16 +63,16 @@ class CnbLegacyUpgrade {
|
|
63 |
<div class="cnb-body-column">
|
64 |
<?php
|
65 |
( new CnbAdminFunctions() )->cnb_promobox(
|
66 |
-
'
|
67 |
'Cloud',
|
68 |
'
|
69 |
<p><strong>✓ Lots of buttons!</strong><br>
|
70 |
-
✓ Phone, SMS/Text, Email, Maps, URLs,
|
71 |
-
✓ WhatsApp,
|
72 |
✓ Circular button (single & multi action)<br>
|
73 |
✓ Buttonbar (multi action)<br>
|
74 |
✓ Action labels<br>
|
75 |
-
✓ WhatsApp chat
|
76 |
</p>
|
77 |
<hr>
|
78 |
<p>
|
@@ -103,7 +103,8 @@ class CnbLegacyUpgrade {
|
|
103 |
</div>
|
104 |
<?php }
|
105 |
|
106 |
-
function upgrade_faq() {
|
|
|
107 |
<div style="max-width:600px;margin:0 auto">
|
108 |
<h1 class="cnb-center">FAQ</h1>
|
109 |
<h3>Is Cloud really free?</h3>
|
@@ -111,7 +112,7 @@ class CnbLegacyUpgrade {
|
|
111 |
only need an account for that. The difference with the PRO plan is that a small "Powered by"
|
112 |
notice is added to your buttons.</p>
|
113 |
<h3>What's included in PRO?</h3>
|
114 |
-
<p>Upgrading to PRO
|
115 |
<h3>Does Cloud require an account?</h3>
|
116 |
<p>Yes. We want the Call Now Button to be accessible to all website owners. Even those that do not have a
|
117 |
WordPress powered website. The Cloud version of the Call Now Button can be used by everyone on any website. You can
|
63 |
<div class="cnb-body-column">
|
64 |
<?php
|
65 |
( new CnbAdminFunctions() )->cnb_promobox(
|
66 |
+
'green',
|
67 |
'Cloud',
|
68 |
'
|
69 |
<p><strong>✓ Lots of buttons!</strong><br>
|
70 |
+
✓ Phone, SMS/Text, Email, Maps, URLs, Scroll to point<br>
|
71 |
+
✓ WhatsApp, Messenger, Telegram, Signal<br>
|
72 |
✓ Circular button (single & multi action)<br>
|
73 |
✓ Buttonbar (multi action)<br>
|
74 |
✓ Action labels<br>
|
75 |
+
✓ 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>
|
103 |
</div>
|
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>
|
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
|
src/admin/partials/CnbHeaderNotices.php
CHANGED
@@ -363,7 +363,7 @@ class CnbHeaderNotices {
|
|
363 |
$url );
|
364 |
$redirect_url = esc_url( $redirect_link );
|
365 |
$message = sprintf( '<p>Please set your timezone in the <a href="%1$s">Advanced settings</a> tab to avoid unpredictable behavior when using the scheduler.</p>', $redirect_url );
|
366 |
-
CnbAdminNotices::get_instance()->warning( $message );
|
367 |
}
|
368 |
|
369 |
public function is_timezone_valid( $domain ) {
|
363 |
$url );
|
364 |
$redirect_url = esc_url( $redirect_link );
|
365 |
$message = sprintf( '<p>Please set your timezone in the <a href="%1$s">Advanced settings</a> tab to avoid unpredictable behavior when using the scheduler.</p>', $redirect_url );
|
366 |
+
CnbAdminNotices::get_instance()->warning( $message, false, 'cnb-timezone-missing' );
|
367 |
}
|
368 |
|
369 |
public function is_timezone_valid( $domain ) {
|
src/admin/settings/CnbApiKeyActivatedView.php
CHANGED
@@ -96,7 +96,7 @@ class CnbApiKeyActivatedView {
|
|
96 |
echo '<div style="width:200px;margin: 0 auto;">';
|
97 |
( new CnbDomainViewUpgradeFinished() )->echoBigYaySvg();
|
98 |
echo '</div>';
|
99 |
-
echo '<h1>You have successfully activated
|
100 |
echo '</div>';
|
101 |
}
|
102 |
|
@@ -155,7 +155,7 @@ class CnbApiKeyActivatedView {
|
|
155 |
$img_visibility = plugins_url( '../../../resources/images/onboarding/visibility-settings.png', __FILE__ );
|
156 |
?>
|
157 |
<div class="cnb_onboarding_guide cnb-plan-features cnb-center top-50">
|
158 |
-
<h1>Quick start guide</h1>
|
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>
|
@@ -189,12 +189,14 @@ class CnbApiKeyActivatedView {
|
|
189 |
<h2 class="cnb-left">The preview phone</h2>
|
190 |
<div class="cnb_screenshot"><img src="<?php echo esc_url( $img_preview ) ?>" alt="A preview phone is always visible to validate your edits. The time in the phone can be changed to test your scheduled actions."></div>
|
191 |
<p class="bottom-50">A preview phone is always visible to validate your edits. The time in the phone can be changed to test your scheduled actions.</p>
|
192 |
-
<h1>Let's go!</h1>
|
193 |
-
<
|
|
|
194 |
<a class="button button-primary button-large" href="<?php echo esc_url( $this->getNewButtonLink() ) ?>">Create new button</a>
|
195 |
<a class="button button-large" href="<?php echo esc_url( $this->getAllButtonsLink() ) ?>">Button overview</a>
|
196 |
</p>
|
197 |
-
</div
|
|
|
198 |
<?php
|
199 |
}
|
200 |
|
@@ -213,13 +215,15 @@ class CnbApiKeyActivatedView {
|
|
213 |
return;
|
214 |
}
|
215 |
echo '<div class="cnb-plan-features cnb-center top-50">';
|
216 |
-
echo '<h1
|
217 |
echo '<h3>All features from Cloud plus...</h3>';
|
218 |
echo '<div class="cnb-pricebox cnb-smaller">
|
219 |
-
<div class="cnb-benefit"
|
220 |
-
<div class="cnb-benefit">📷
|
221 |
<div class="cnb-benefit">🌍 Include and exclude countries</div>
|
222 |
<div class="cnb-benefit">↕️ Set scroll height for buttons to appear</div>
|
|
|
|
|
223 |
</div>';
|
224 |
( new CnbDomainViewUpgradeOverview() )->renderUpgradeForm( $domain );
|
225 |
echo '</div>';
|
@@ -243,8 +247,9 @@ class CnbApiKeyActivatedView {
|
|
243 |
private function renderBenefits() {
|
244 |
echo '<div>';
|
245 |
echo '<h2 class="cnb-center">You now have access to the following functionality:</h2>';
|
|
|
246 |
( new CnbDomainViewUpgradeOverview() )->renderBenefits();
|
247 |
-
echo '</div>';
|
248 |
}
|
249 |
|
250 |
private function renderActivationStatus() {
|
@@ -256,7 +261,7 @@ class CnbApiKeyActivatedView {
|
|
256 |
echo '<div style="text-align: center"><h1>Cloud is already active</h1></div>';
|
257 |
}
|
258 |
if ( $this->activation->success || ! is_wp_error( $user ) ) {
|
259 |
-
|
260 |
$this->renderGetStarted();
|
261 |
$this->renderOnboarding();
|
262 |
$this->renderUpgradeToPro();
|
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 |
|
155 |
$img_visibility = plugins_url( '../../../resources/images/onboarding/visibility-settings.png', __FILE__ );
|
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>
|
189 |
<h2 class="cnb-left">The preview phone</h2>
|
190 |
<div class="cnb_screenshot"><img src="<?php echo esc_url( $img_preview ) ?>" alt="A preview phone is always visible to validate your edits. The time in the phone can be changed to test your scheduled actions."></div>
|
191 |
<p class="bottom-50">A preview phone is always visible to validate your edits. The time in the phone can be changed to test your scheduled actions.</p>
|
192 |
+
<h1><strong>Let's go!</strong></h1>
|
193 |
+
<hr/>
|
194 |
+
<p style="margin-bottom:100px;">
|
195 |
<a class="button button-primary button-large" href="<?php echo esc_url( $this->getNewButtonLink() ) ?>">Create new button</a>
|
196 |
<a class="button button-large" href="<?php echo esc_url( $this->getAllButtonsLink() ) ?>">Button overview</a>
|
197 |
</p>
|
198 |
+
</div>
|
199 |
+
|
200 |
<?php
|
201 |
}
|
202 |
|
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>';
|
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() {
|
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();
|
src/admin/settings/CnbSettingsRouter.php
CHANGED
@@ -15,6 +15,10 @@ class CnbSettingsRouter {
|
|
15 |
* @return void
|
16 |
*/
|
17 |
public function render() {
|
|
|
|
|
|
|
|
|
18 |
do_action( 'cnb_init', __METHOD__ );
|
19 |
$controller = new CnbSettingsController();
|
20 |
|
15 |
* @return void
|
16 |
*/
|
17 |
public function render() {
|
18 |
+
add_filter('cnb_admin_notice_filter', function ($notice) {
|
19 |
+
if ($notice->name === 'cnb-timezone-missing') return null;
|
20 |
+
return $notice;
|
21 |
+
});
|
22 |
do_action( 'cnb_init', __METHOD__ );
|
23 |
$controller = new CnbSettingsController();
|
24 |
|
src/admin/settings/CnbSettingsViewEdit.php
CHANGED
@@ -368,27 +368,6 @@ class CnbSettingsViewEdit {
|
|
368 |
'Enable cloud',
|
369 |
( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
|
370 |
);
|
371 |
-
( new CnbAdminFunctions() )->cnb_promobox(
|
372 |
-
'green',
|
373 |
-
'More buttons!',
|
374 |
-
'Enable cloud to get lots of extra buttons. Coupled with advanced page selection options you can get really creative.</p>' .
|
375 |
-
'<p>If you need more phone numbers on a single page, then the Multibutton™ and the Buttonbar™ give you excellent options.</p>',
|
376 |
-
'cloud',
|
377 |
-
'<strong>Try it out!</strong>',
|
378 |
-
'Learn more',
|
379 |
-
( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
|
380 |
-
);
|
381 |
-
( new CnbAdminFunctions() )->cnb_promobox(
|
382 |
-
'brown',
|
383 |
-
'Add more features!',
|
384 |
-
'Cloud adds a ton of extra power to the Call Now Button.</p>' .
|
385 |
-
'<p>The Free plan shows a little branding with your buttons but gives you access to 99% of all cloud features.</p>' .
|
386 |
-
'<p>Try it out and enjoy scheduling, multiple buttons, more button types, animations and much more!</p>',
|
387 |
-
'money-alt',
|
388 |
-
'',
|
389 |
-
'See what\'s incuded',
|
390 |
-
( new CnbAdminFunctions() )->cnb_legacy_upgrade_page()
|
391 |
-
);
|
392 |
}
|
393 |
if ( $use_cloud && isset( $cnb_cloud_domain ) && ! is_wp_error( $cnb_cloud_domain ) && $cnb_cloud_domain->type !== 'PRO' ) {
|
394 |
$coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
|
@@ -410,10 +389,12 @@ class CnbSettingsViewEdit {
|
|
410 |
'green',
|
411 |
'Remove Branding with PRO',
|
412 |
'<p>✨ Remove the <em>Powered by</em> notice</p>
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
417 |
'flag',
|
418 |
'<strong>From $<span class="usd-per-month"></span> monthly</strong>',
|
419 |
'Upgrade now',
|
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();
|
389 |
'green',
|
390 |
'Remove Branding with PRO',
|
391 |
'<p>✨ Remove the <em>Powered by</em> notice</p>
|
392 |
+
<p><strong>Plus enable extra features:</strong><br>
|
393 |
+
📄 Slide-in content windows<br>
|
394 |
+
📷 Use custom images on buttons<br>
|
395 |
+
🌍 Include and exclude countries<br>
|
396 |
+
↕️ Set scroll height for buttons to appear<br>
|
397 |
+
🔌 Intercom Chat integration</p>',
|
398 |
'flag',
|
399 |
'<strong>From $<span class="usd-per-month"></span> monthly</strong>',
|
400 |
'Upgrade now',
|
src/autoload.php
CHANGED
@@ -21,6 +21,7 @@ spl_autoload_register(
|
|
21 |
'cnb\\admin\\action\\cnbactionproperties' => '/admin/action/CnbAction.php',
|
22 |
'cnb\\admin\\action\\cnbactionrouter' => '/admin/action/CnbActionRouter.php',
|
23 |
'cnb\\admin\\action\\cnbactionschedule' => '/admin/action/CnbAction.php',
|
|
|
24 |
'cnb\\admin\\action\\cnbactionview' => '/admin/action/CnbActionView.php',
|
25 |
'cnb\\admin\\action\\cnbactionviewedit' => '/admin/action/CnbActionViewEdit.php',
|
26 |
'cnb\\admin\\api\\cnbadmincloud' => '/admin/api/CnbAdminCloud.php',
|
21 |
'cnb\\admin\\action\\cnbactionproperties' => '/admin/action/CnbAction.php',
|
22 |
'cnb\\admin\\action\\cnbactionrouter' => '/admin/action/CnbActionRouter.php',
|
23 |
'cnb\\admin\\action\\cnbactionschedule' => '/admin/action/CnbAction.php',
|
24 |
+
'cnb\\admin\\action\\cnbactiontype' => '/admin/action/CnbActionType.php',
|
25 |
'cnb\\admin\\action\\cnbactionview' => '/admin/action/CnbActionView.php',
|
26 |
'cnb\\admin\\action\\cnbactionviewedit' => '/admin/action/CnbActionViewEdit.php',
|
27 |
'cnb\\admin\\api\\cnbadmincloud' => '/admin/api/CnbAdminCloud.php',
|
src/coupons/class-cnb-promotion-code.php
CHANGED
@@ -150,6 +150,9 @@ class CnbPromotionCode {
|
|
150 |
if ( is_wp_error( $object ) ) {
|
151 |
return $object;
|
152 |
}
|
|
|
|
|
|
|
153 |
|
154 |
$promo_code = new CnbPromotionCode();
|
155 |
$promo_code->code = CnbUtils::getPropertyOrNull( $object, 'code' );
|
150 |
if ( is_wp_error( $object ) ) {
|
151 |
return $object;
|
152 |
}
|
153 |
+
if ($object === null) {
|
154 |
+
return null;
|
155 |
+
}
|
156 |
|
157 |
$promo_code = new CnbPromotionCode();
|
158 |
$promo_code->code = CnbUtils::getPropertyOrNull( $object, 'code' );
|
src/notices/CnbAdminNotices.php
CHANGED
@@ -23,6 +23,7 @@ class CnbAdminNotices {
|
|
23 |
$this->admin_notices = new CnbNotices();
|
24 |
|
25 |
add_action( 'cnb_admin_notices', array( $this, 'action_admin_notices' ) );
|
|
|
26 |
}
|
27 |
|
28 |
public static function get_instance() {
|
@@ -68,17 +69,6 @@ class CnbAdminNotices {
|
|
68 |
}
|
69 |
}
|
70 |
|
71 |
-
/**
|
72 |
-
* @param $notices CnbNotice[]
|
73 |
-
*
|
74 |
-
* @return void
|
75 |
-
*/
|
76 |
-
public function renderNotices( $notices ) {
|
77 |
-
foreach ( $notices as $notice ) {
|
78 |
-
$this->renderNotice( $notice );
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
/**
|
83 |
* @param $notice CnbNotice
|
84 |
*/
|
@@ -122,13 +112,26 @@ class CnbAdminNotices {
|
|
122 |
return get_option( $name );
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
public function action_admin_notices() {
|
126 |
foreach ( explode( ',', CnbNotices::TYPES ) as $type ) {
|
127 |
foreach ( $this->admin_notices->{$type} as $admin_notice ) {
|
128 |
-
|
129 |
-
|
130 |
-
$this->renderNotice( $admin_notice );
|
131 |
-
}
|
132 |
}
|
133 |
}
|
134 |
}
|
@@ -153,68 +156,50 @@ class CnbAdminNotices {
|
|
153 |
* @param $notice CnbNotice
|
154 |
*/
|
155 |
public function notice( $notice ) {
|
156 |
-
$notice =
|
157 |
$this->addNotice( $notice );
|
158 |
}
|
159 |
|
160 |
-
public function error( $message, $dismiss_option = false ) {
|
161 |
-
$notice =
|
162 |
$this->addNotice( $notice );
|
163 |
}
|
164 |
|
165 |
-
public function renderError( $message, $dismiss_option = false ) {
|
166 |
-
$notice =
|
167 |
$this->renderNotice( $notice );
|
168 |
}
|
169 |
|
170 |
-
public function warning( $message, $dismiss_option = false ) {
|
171 |
-
$notice =
|
172 |
$this->addNotice( $notice );
|
173 |
}
|
174 |
|
175 |
-
public function renderWarning( $message, $dismiss_option = false ) {
|
176 |
-
$notice =
|
177 |
$this->renderNotice( $notice );
|
178 |
}
|
179 |
|
180 |
-
public function success( $message, $dismiss_option = false ) {
|
181 |
-
$notice =
|
182 |
$this->addNotice( $notice );
|
183 |
}
|
184 |
|
185 |
-
public function renderSuccess( $message, $dismiss_option = false ) {
|
186 |
-
$notice =
|
187 |
$this->renderNotice( $notice );
|
188 |
}
|
189 |
|
190 |
-
public function info( $message, $dismiss_option = false ) {
|
191 |
-
$notice =
|
192 |
$this->addNotice( $notice );
|
193 |
}
|
194 |
|
195 |
-
public function renderInfo( $message, $dismiss_option = false ) {
|
196 |
-
$notice =
|
197 |
$this->renderNotice( $notice );
|
198 |
}
|
199 |
|
200 |
-
/**
|
201 |
-
* @param $type string one of info, success, warning, error
|
202 |
-
* @param $message string
|
203 |
-
* @param $dismissable boolean
|
204 |
-
* @param $dismiss_option boolean
|
205 |
-
*
|
206 |
-
* @return CnbNotice
|
207 |
-
*/
|
208 |
-
private function createNotice( $type, $message, $dismissable = false, $dismiss_option = false ) {
|
209 |
-
$notice = new CnbNotice();
|
210 |
-
$notice->message = $message;
|
211 |
-
$notice->dismissable = $dismissable;
|
212 |
-
$notice->dismiss_option = $dismiss_option;
|
213 |
-
$notice->type = $type;
|
214 |
-
|
215 |
-
return $notice;
|
216 |
-
}
|
217 |
-
|
218 |
/**
|
219 |
* @param $notice CnbNotice
|
220 |
*/
|
23 |
$this->admin_notices = new CnbNotices();
|
24 |
|
25 |
add_action( 'cnb_admin_notices', array( $this, 'action_admin_notices' ) );
|
26 |
+
add_filter('cnb_admin_notice_filter', array( $this, 'dismiss_filter' ) );
|
27 |
}
|
28 |
|
29 |
public static function get_instance() {
|
69 |
}
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
/**
|
73 |
* @param $notice CnbNotice
|
74 |
*/
|
112 |
return get_option( $name );
|
113 |
}
|
114 |
|
115 |
+
/**
|
116 |
+
* Returns the notice if it has not been previously dismissed.
|
117 |
+
*
|
118 |
+
* @param CnbNotice $notice
|
119 |
+
*
|
120 |
+
* @return CnbNotice
|
121 |
+
*/
|
122 |
+
public function dismiss_filter($notice) {
|
123 |
+
$option = $this->get_dismiss_option_name( $notice->dismiss_option );
|
124 |
+
if ( ! $notice->dismiss_option || ! $this->is_dismissed( $option ) ) {
|
125 |
+
return $notice;
|
126 |
+
}
|
127 |
+
return null;
|
128 |
+
}
|
129 |
+
|
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 |
}
|
136 |
}
|
137 |
}
|
156 |
* @param $notice CnbNotice
|
157 |
*/
|
158 |
public function notice( $notice ) {
|
159 |
+
$notice = new CnbNotice($notice->type, $notice->message, $notice->dismissable, $notice->dismiss_option );
|
160 |
$this->addNotice( $notice );
|
161 |
}
|
162 |
|
163 |
+
public function error( $message, $dismiss_option = false, $name = null ) {
|
164 |
+
$notice = new CnbNotice('error', $message, false, $dismiss_option, $name );
|
165 |
$this->addNotice( $notice );
|
166 |
}
|
167 |
|
168 |
+
public function renderError( $message, $dismiss_option = false, $name = null ) {
|
169 |
+
$notice = new CnbNotice('error', $message, false, $dismiss_option, $name );
|
170 |
$this->renderNotice( $notice );
|
171 |
}
|
172 |
|
173 |
+
public function warning( $message, $dismiss_option = false, $name = null ) {
|
174 |
+
$notice = new CnbNotice('warning', $message, false, $dismiss_option, $name );
|
175 |
$this->addNotice( $notice );
|
176 |
}
|
177 |
|
178 |
+
public function renderWarning( $message, $dismiss_option = false, $name = null ) {
|
179 |
+
$notice = new CnbNotice('warning', $message, false, $dismiss_option, $name );
|
180 |
$this->renderNotice( $notice );
|
181 |
}
|
182 |
|
183 |
+
public function success( $message, $dismiss_option = false, $name = null ) {
|
184 |
+
$notice = new CnbNotice('success', $message, false, $dismiss_option, $name );
|
185 |
$this->addNotice( $notice );
|
186 |
}
|
187 |
|
188 |
+
public function renderSuccess( $message, $dismiss_option = false, $name = null ) {
|
189 |
+
$notice = new CnbNotice('success', $message, false, $dismiss_option, $name );
|
190 |
$this->renderNotice( $notice );
|
191 |
}
|
192 |
|
193 |
+
public function info( $message, $dismiss_option = false, $name = null ) {
|
194 |
+
$notice = new CnbNotice('info', $message, false, $dismiss_option, $name );
|
195 |
$this->addNotice( $notice );
|
196 |
}
|
197 |
|
198 |
+
public function renderInfo( $message, $dismiss_option = false, $name = null ) {
|
199 |
+
$notice = new CnbNotice('info', $message, false, $dismiss_option, $name );
|
200 |
$this->renderNotice( $notice );
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
/**
|
204 |
* @param $notice CnbNotice
|
205 |
*/
|
src/notices/CnbNotice.php
CHANGED
@@ -26,11 +26,24 @@ class CnbNotice {
|
|
26 |
* @var string
|
27 |
*/
|
28 |
public $dismiss_option;
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
$this->type = $type;
|
32 |
$this->message = $message;
|
33 |
$this->dismissable = $dismissable;
|
34 |
$this->dismiss_option = $dismiss_option;
|
|
|
35 |
}
|
36 |
}
|
26 |
* @var string
|
27 |
*/
|
28 |
public $dismiss_option;
|
29 |
+
/**
|
30 |
+
* @var string
|
31 |
+
* @since v1.2.1
|
32 |
+
*/
|
33 |
+
public $name;
|
34 |
|
35 |
+
/**
|
36 |
+
* @param string $type one of info, success, warning, error
|
37 |
+
* @param string $message
|
38 |
+
* @param boolean $dismissable
|
39 |
+
* @param boolean $dismiss_option
|
40 |
+
* @param string $name
|
41 |
+
*/
|
42 |
+
public function __construct( $type = null, $message = null, $dismissable = false, $dismiss_option = false, $name = null ) {
|
43 |
$this->type = $type;
|
44 |
$this->message = $message;
|
45 |
$this->dismissable = $dismissable;
|
46 |
$this->dismiss_option = $dismiss_option;
|
47 |
+
$this->name = $name;
|
48 |
}
|
49 |
}
|
src/utils/CnbAdminFunctions.php
CHANGED
@@ -3,6 +3,8 @@
|
|
3 |
namespace cnb\utils;
|
4 |
|
5 |
// don't load directly
|
|
|
|
|
6 |
defined( 'ABSPATH' ) || die( '-1' );
|
7 |
|
8 |
class CnbAdminFunctions {
|
@@ -51,23 +53,23 @@ class CnbAdminFunctions {
|
|
51 |
* what feels more likely to be choosen
|
52 |
* - HOURS is missing, since that is not implemented yet
|
53 |
*
|
54 |
-
* @return
|
55 |
*/
|
56 |
function cnb_get_action_types() {
|
57 |
return array(
|
58 |
-
'PHONE' => '💬 Phone',
|
59 |
-
'EMAIL' => '💬 Email',
|
60 |
-
'SMS' => '💬 SMS/Text',
|
61 |
-
'WHATSAPP' => '💬 WhatsApp',
|
62 |
-
'FACEBOOK' => '💬 Messenger',
|
63 |
-
'SIGNAL' => '💬 Signal',
|
64 |
-
'TELEGRAM' => '💬 Telegram',
|
65 |
-
'ANCHOR' => '
|
66 |
-
'LINK' => '🔗 Link',
|
67 |
-
'MAP' => '📍 Location',
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'INTERCOM' => '🔌 Intercom chat'
|
71 |
);
|
72 |
}
|
73 |
|
3 |
namespace cnb\utils;
|
4 |
|
5 |
// don't load directly
|
6 |
+
use cnb\admin\action\CnbActionType;
|
7 |
+
|
8 |
defined( 'ABSPATH' ) || die( '-1' );
|
9 |
|
10 |
class CnbAdminFunctions {
|
53 |
* what feels more likely to be choosen
|
54 |
* - HOURS is missing, since that is not implemented yet
|
55 |
*
|
56 |
+
* @return CnbActionType[] array of ActionType to their nice names
|
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 |
|