Version Description
- Fix for websites using WP Rocket LazyLoad
Download this release
Release Info
Developer | jasperroel |
Plugin | Call Now Button |
Version | 1.1.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.6 to 1.1.7
- call-now-button.php +3 -2
- readme.txt +4 -1
- src/CallNowButton.php +5 -6
- src/admin/action/CnbActionViewEdit.php +11 -7
- src/admin/apikey/CnbApiKeyView.php +1 -1
- src/admin/button/CnbButtonView.php +7 -4
- src/admin/button/CnbButtonViewEdit.php +4 -3
- src/admin/condition/CnbConditionViewEdit.php +1 -1
- src/admin/domain/CnbDomainViewEdit.php +9 -5
- src/admin/domain/partials/CnbDomainViewUpgradeFinished.php +7 -3
- src/admin/legacy/CnbLegacyEdit.php +23 -13
- src/admin/legacy/CnbLegacyUpgrade.php +4 -2
- src/admin/partials/CnbFooter.php +4 -4
- src/admin/partials/CnbHeaderNotices.php +19 -14
- src/admin/profile/CnbProfileEdit.php +2 -2
- src/admin/settings/CnbSettingsViewEdit.php +8 -7
- src/renderers/modern/class-modernrenderer.php +4 -7
- src/utils/CnbUtils.php +27 -9
- src/utils/class-cachehandler.php +19 -3
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.1.
|
7 |
Author: Jerry Rietveld
|
8 |
Author URI: https://www.callnowbutton.com
|
9 |
GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
|
@@ -26,13 +26,14 @@ License: GPL2
|
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
-
define('CNB_VERSION', '1.1.
|
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_SLUG', sanitize_title(CNB_NAME));
|
37 |
|
38 |
require_once dirname( __FILE__ ) . '/src/call-now-button.php';
|
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.1.7
|
7 |
Author: Jerry Rietveld
|
8 |
Author URI: https://www.callnowbutton.com
|
9 |
GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
+
define('CNB_VERSION', '1.1.7');
|
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 |
require_once dirname( __FILE__ ) . '/src/call-now-button.php';
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: call button, click to call, convert, call now button, contact button
|
|
5 |
Requires at least: 3.9
|
6 |
Requires PHP: 5.4
|
7 |
Tested up to: 6.0
|
8 |
-
Stable tag: 1.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -111,6 +111,9 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
|
|
111 |
|
112 |
|
113 |
== Changelog ==
|
|
|
|
|
|
|
114 |
= 1.1.6 =
|
115 |
* Improved WP Rocket cache handling
|
116 |
* Improved WP Super Cache handling
|
5 |
Requires at least: 3.9
|
6 |
Requires PHP: 5.4
|
7 |
Tested up to: 6.0
|
8 |
+
Stable tag: 1.1.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
111 |
|
112 |
|
113 |
== Changelog ==
|
114 |
+
= 1.1.7 =
|
115 |
+
* Fix for websites using WP Rocket LazyLoad
|
116 |
+
|
117 |
= 1.1.6 =
|
118 |
* Improved WP Rocket cache handling
|
119 |
* Improved WP Super Cache handling
|
src/CallNowButton.php
CHANGED
@@ -147,7 +147,8 @@ class CallNowButton {
|
|
147 |
|
148 |
public static function plugin_meta( $links, $file ) {
|
149 |
$cnb_options = get_option( 'cnb' );
|
150 |
-
$
|
|
|
151 |
|
152 |
if ( $file == CNB_BASENAME ) {
|
153 |
|
@@ -159,7 +160,6 @@ class CallNowButton {
|
|
159 |
'page' => 'call-now-button'
|
160 |
),
|
161 |
$url );
|
162 |
-
$button_url = esc_url( $button_link );
|
163 |
|
164 |
$settings_link =
|
165 |
add_query_arg(
|
@@ -167,13 +167,12 @@ class CallNowButton {
|
|
167 |
'page' => 'call-now-button-settings'
|
168 |
),
|
169 |
$url );
|
170 |
-
$settings_url = esc_url( $settings_link );
|
171 |
|
172 |
$link_name = $cnb_cloud_hosting ? __( 'All buttons' ) : __( 'My button' );
|
173 |
$cnb_new_links = array(
|
174 |
-
sprintf( '<a href="%s">%s</a>', $
|
175 |
-
sprintf( '<a href="%s">%s</a>', $
|
176 |
-
sprintf( '<a href="%s">%s</a>',
|
177 |
);
|
178 |
array_push(
|
179 |
$links,
|
147 |
|
148 |
public static function plugin_meta( $links, $file ) {
|
149 |
$cnb_options = get_option( 'cnb' );
|
150 |
+
$cnb_utils = new CnbUtils();
|
151 |
+
$cnb_cloud_hosting = $cnb_utils->isCloudActive( $cnb_options );
|
152 |
|
153 |
if ( $file == CNB_BASENAME ) {
|
154 |
|
160 |
'page' => 'call-now-button'
|
161 |
),
|
162 |
$url );
|
|
|
163 |
|
164 |
$settings_link =
|
165 |
add_query_arg(
|
167 |
'page' => 'call-now-button-settings'
|
168 |
),
|
169 |
$url );
|
|
|
170 |
|
171 |
$link_name = $cnb_cloud_hosting ? __( 'All buttons' ) : __( 'My button' );
|
172 |
$cnb_new_links = array(
|
173 |
+
sprintf( '<a href="%s">%s</a>', esc_url( $button_link ), $link_name ),
|
174 |
+
sprintf( '<a href="%s">%s</a>', esc_url( $settings_link ), __( 'Settings' ) ),
|
175 |
+
sprintf( '<a href="%s">%s</a>', esc_url( $cnb_utils->get_support_url('', 'wp-plugins-page', 'support') ), __( 'Support' ) )
|
176 |
);
|
177 |
array_push(
|
178 |
$links,
|
src/admin/action/CnbActionViewEdit.php
CHANGED
@@ -119,6 +119,8 @@ class CnbActionViewEdit {
|
|
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 |
|
@@ -211,7 +213,7 @@ class CnbActionViewEdit {
|
|
211 |
</tr>
|
212 |
<tr class="button-text cnb_hide_on_modal">
|
213 |
<th scope="row"><label for="buttonTextField">Button label text <a
|
214 |
-
href="<?php echo
|
215 |
target="_blank" class="cnb-nounderscore">
|
216 |
<span class="dashicons dashicons-editor-help"></span>
|
217 |
</a></label></th>
|
@@ -427,7 +429,7 @@ class CnbActionViewEdit {
|
|
427 |
|
428 |
<tr class="cnb-action-properties-whatsapp">
|
429 |
<th scope="row">Show WhatsApp modal <a
|
430 |
-
href="<?php echo
|
431 |
target="_blank" class="cnb-nounderscore">
|
432 |
<span class="dashicons dashicons-editor-help"></span>
|
433 |
</a></th>
|
@@ -448,7 +450,7 @@ class CnbActionViewEdit {
|
|
448 |
</tr>
|
449 |
<tr id="action-properties-message-row" class="cnb-action-properties-sms">
|
450 |
<th scope="row"><label for="action-properties-message">Message template <a
|
451 |
-
href="<?php echo
|
452 |
target="_blank" class="cnb-nounderscore">
|
453 |
<span class="dashicons dashicons-editor-help"></span>
|
454 |
</a></label></th>
|
@@ -481,7 +483,8 @@ class CnbActionViewEdit {
|
|
481 |
placeholder="How can we help?"><?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-welcomeMessage'} ) ) {
|
482 |
echo esc_textarea( $action->properties->{'whatsapp-welcomeMessage'} );
|
483 |
} ?></textarea>
|
484 |
-
<p class="description">Press [Enter] to start a new speech bubble in the chat modal. Speech bubbles
|
|
|
485 |
</td>
|
486 |
</tr>
|
487 |
<tr class="cnb-action-properties-whatsapp">
|
@@ -499,7 +502,8 @@ class CnbActionViewEdit {
|
|
499 |
class="cnb_toggle_state cnb_toggle_false">(Off)</span>
|
500 |
<span data-cnb_toggle_state_label="cnb-action-show-notification-count"
|
501 |
class="cnb_toggle_state cnb_toggle_true">Yes</span>
|
502 |
-
|
|
|
503 |
</td>
|
504 |
</tr>
|
505 |
<tr class="cnb-action-properties-whatsapp-modal">
|
@@ -527,7 +531,7 @@ class CnbActionViewEdit {
|
|
527 |
</tr>
|
528 |
<tr class="cnb-action-properties-email">
|
529 |
<th scope="row"><label for="action-properties-body">Message template <a
|
530 |
-
href="<?php echo
|
531 |
target="_blank" class="cnb-nounderscore">
|
532 |
<span class="dashicons dashicons-editor-help"></span>
|
533 |
</a></label></th>
|
@@ -616,7 +620,7 @@ class CnbActionViewEdit {
|
|
616 |
|
617 |
</table>
|
618 |
<table data-tab-name="scheduler"
|
619 |
-
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'scheduler' ) )
|
620 |
<tr class="cnb_hide_on_modal">
|
621 |
<th></th>
|
622 |
<td></td>
|
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 |
|
213 |
</tr>
|
214 |
<tr class="button-text cnb_hide_on_modal">
|
215 |
<th scope="row"><label for="buttonTextField">Button label text <a
|
216 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/button-label/', 'question-mark', 'button-label' ) ) ?>"
|
217 |
target="_blank" class="cnb-nounderscore">
|
218 |
<span class="dashicons dashicons-editor-help"></span>
|
219 |
</a></label></th>
|
429 |
|
430 |
<tr class="cnb-action-properties-whatsapp">
|
431 |
<th scope="row">Show WhatsApp modal <a
|
432 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/whatsapp-modal/', 'question-mark', 'whatsapp-modal' ) ) ?>"
|
433 |
target="_blank" class="cnb-nounderscore">
|
434 |
<span class="dashicons dashicons-editor-help"></span>
|
435 |
</a></th>
|
450 |
</tr>
|
451 |
<tr id="action-properties-message-row" class="cnb-action-properties-sms">
|
452 |
<th scope="row"><label for="action-properties-message">Message template <a
|
453 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
|
454 |
target="_blank" class="cnb-nounderscore">
|
455 |
<span class="dashicons dashicons-editor-help"></span>
|
456 |
</a></label></th>
|
483 |
placeholder="How can we help?"><?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-welcomeMessage'} ) ) {
|
484 |
echo esc_textarea( $action->properties->{'whatsapp-welcomeMessage'} );
|
485 |
} ?></textarea>
|
486 |
+
<p class="description">Press [Enter] to start a new speech bubble in the chat modal. Speech bubbles
|
487 |
+
will appear in a sequence with a short pause between them.</p>
|
488 |
</td>
|
489 |
</tr>
|
490 |
<tr class="cnb-action-properties-whatsapp">
|
502 |
class="cnb_toggle_state cnb_toggle_false">(Off)</span>
|
503 |
<span data-cnb_toggle_state_label="cnb-action-show-notification-count"
|
504 |
class="cnb_toggle_state cnb_toggle_true">Yes</span>
|
505 |
+
<p class="description">Show a small red notification badge on WhatsApp the button to draw the
|
506 |
+
attention.</p>
|
507 |
</td>
|
508 |
</tr>
|
509 |
<tr class="cnb-action-properties-whatsapp-modal">
|
531 |
</tr>
|
532 |
<tr class="cnb-action-properties-email">
|
533 |
<th scope="row"><label for="action-properties-body">Message template <a
|
534 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
|
535 |
target="_blank" class="cnb-nounderscore">
|
536 |
<span class="dashicons dashicons-editor-help"></span>
|
537 |
</a></label></th>
|
620 |
|
621 |
</table>
|
622 |
<table data-tab-name="scheduler"
|
623 |
+
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'scheduler' ) ) ?>">
|
624 |
<tr class="cnb_hide_on_modal">
|
625 |
<th></th>
|
626 |
<td></td>
|
src/admin/apikey/CnbApiKeyView.php
CHANGED
@@ -57,7 +57,7 @@ class CnbApiKeyView {
|
|
57 |
add_thickbox();
|
58 |
?>
|
59 |
<div id="cnb-add-new-apikey-modal" style="display:none;">
|
60 |
-
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) )
|
61 |
<input type="hidden" name="page" value="call-now-button-apikeys"/>
|
62 |
<input type="hidden" name="action" value="cnb_apikey_create"/>
|
63 |
<input type="hidden" name="_wpnonce"
|
57 |
add_thickbox();
|
58 |
?>
|
59 |
<div id="cnb-add-new-apikey-modal" style="display:none;">
|
60 |
+
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post">
|
61 |
<input type="hidden" name="page" value="call-now-button-apikeys"/>
|
62 |
<input type="hidden" name="action" value="cnb_apikey_create"/>
|
63 |
<input type="hidden" name="_wpnonce"
|
src/admin/button/CnbButtonView.php
CHANGED
@@ -133,7 +133,10 @@ class CnbButtonView {
|
|
133 |
}
|
134 |
|
135 |
private function render_promos( $domain ) {
|
136 |
-
$
|
|
|
|
|
|
|
137 |
if ( isset( $upgrade_url ) && $upgrade_url ) {
|
138 |
echo '<div class="cnb-postbox-container cnb-side-column"> <!-- Sidebar promo boxes -->';
|
139 |
if ( $domain !== null && ! ( $domain instanceof WP_Error ) && $domain->type === 'FREE' ) {
|
@@ -152,9 +155,9 @@ class CnbButtonView {
|
|
152 |
( new CnbAdminFunctions() )->cnb_promobox(
|
153 |
'blue',
|
154 |
'Need help?',
|
155 |
-
'<p>Please head over to our <a href="
|
156 |
-
<p>✓ <a href="
|
157 |
-
<p>✓ <a href="
|
158 |
'welcome-learn-more'
|
159 |
);
|
160 |
echo '</div>';
|
133 |
}
|
134 |
|
135 |
private function render_promos( $domain ) {
|
136 |
+
$cnb_utils = new CnbUtils();
|
137 |
+
$upgrade_url = $cnb_utils->get_cnb_domain_upgrade( $domain );
|
138 |
+
$support_url = $cnb_utils->get_support_url('', 'promobox-need-help', 'Help Center');
|
139 |
+
$faq_url = $cnb_utils->get_support_url('wordpress/#faq', 'promobox-need-help', 'FAQ');
|
140 |
if ( isset( $upgrade_url ) && $upgrade_url ) {
|
141 |
echo '<div class="cnb-postbox-container cnb-side-column"> <!-- Sidebar promo boxes -->';
|
142 |
if ( $domain !== null && ! ( $domain instanceof WP_Error ) && $domain->type === 'FREE' ) {
|
155 |
( new CnbAdminFunctions() )->cnb_promobox(
|
156 |
'blue',
|
157 |
'Need help?',
|
158 |
+
'<p>Please head over to our <a href="' . esc_url( $support_url ) . '" target="_blank">Help Center</a> for all your questions.</p>
|
159 |
+
<p>✓ <a href="' . esc_url( $support_url ) . '" target="_blank">Help Center</a></p>
|
160 |
+
<p>✓ <a href="' . esc_url( $faq_url ) . '" target="_blank">FAQ</a></p>',
|
161 |
'welcome-learn-more'
|
162 |
);
|
163 |
echo '</div>';
|
src/admin/button/CnbButtonViewEdit.php
CHANGED
@@ -69,6 +69,7 @@ class CnbButtonViewEdit {
|
|
69 |
*/
|
70 |
public function render_form( $button_id, $button, $default_domain, $options = array() ) {
|
71 |
$adminFunctions = new CnbAdminFunctions();
|
|
|
72 |
$domains = CnbAppRemote::cnb_remote_get_domains();
|
73 |
|
74 |
$cnb_single_image_url = plugins_url( '../../../resources/images/button-new-single.png', __FILE__ );
|
@@ -125,7 +126,7 @@ class CnbButtonViewEdit {
|
|
125 |
let cnb_options = <?php echo wp_json_encode( new stdClass() ) ?>;
|
126 |
</script>
|
127 |
<form class="cnb-container <?php if ( ! $hide_on_modal ) { ?>cnb-validation<?php } ?>"
|
128 |
-
action="<?php echo esc_url( admin_url( 'admin-post.php' ) )
|
129 |
<input type="hidden" name="page" value="call-now-button"/>
|
130 |
<input type="hidden" name="action"
|
131 |
value="<?php echo $button_id === 'new' ? 'cnb_create_' . esc_attr( strtolower( $button->type ) ) . '_button' : 'cnb_update_' . esc_attr( strtolower( $button->type ) ) . '_button' ?>"/>
|
@@ -469,7 +470,7 @@ class CnbButtonViewEdit {
|
|
469 |
<?php } ?>
|
470 |
<tr>
|
471 |
<th scope="row">Position <a
|
472 |
-
href="<?php echo
|
473 |
target="_blank" class="cnb-nounderscore">
|
474 |
<span class="dashicons dashicons-editor-help"></span>
|
475 |
</a></th>
|
@@ -540,7 +541,7 @@ class CnbButtonViewEdit {
|
|
540 |
<?php if ( $button->type !== 'FULL' ) { ?>
|
541 |
<tr>
|
542 |
<th scope="row"><label for="button_options_animation">Button animation <a
|
543 |
-
href="<?php echo
|
544 |
target="_blank" class="cnb-nounderscore">
|
545 |
<span class="dashicons dashicons-editor-help"></span>
|
546 |
</a></label></th>
|
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__ );
|
126 |
let cnb_options = <?php echo wp_json_encode( new stdClass() ) ?>;
|
127 |
</script>
|
128 |
<form class="cnb-container <?php if ( ! $hide_on_modal ) { ?>cnb-validation<?php } ?>"
|
129 |
+
action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post">
|
130 |
<input type="hidden" name="page" value="call-now-button"/>
|
131 |
<input type="hidden" name="action"
|
132 |
value="<?php echo $button_id === 'new' ? 'cnb_create_' . esc_attr( strtolower( $button->type ) ) . '_button' : 'cnb_update_' . esc_attr( strtolower( $button->type ) ) . '_button' ?>"/>
|
470 |
<?php } ?>
|
471 |
<tr>
|
472 |
<th scope="row">Position <a
|
473 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'button-position/', 'question-mark', 'button-position' ) ) ?>"
|
474 |
target="_blank" class="cnb-nounderscore">
|
475 |
<span class="dashicons dashicons-editor-help"></span>
|
476 |
</a></th>
|
541 |
<?php if ( $button->type !== 'FULL' ) { ?>
|
542 |
<tr>
|
543 |
<th scope="row"><label for="button_options_animation">Button animation <a
|
544 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/button-animation/', 'question-mark', 'button-animation' ) ) ?>"
|
545 |
target="_blank" class="cnb-nounderscore">
|
546 |
<span class="dashicons dashicons-editor-help"></span>
|
547 |
</a></label></th>
|
src/admin/condition/CnbConditionViewEdit.php
CHANGED
@@ -127,7 +127,7 @@ class CnbConditionViewEdit {
|
|
127 |
do_action( 'cnb_header' );
|
128 |
?>
|
129 |
|
130 |
-
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) )
|
131 |
<input type="hidden" name="page" value="call-now-button-conditions"/>
|
132 |
<input type="hidden" name="bid" value="<?php echo esc_attr( $bid ) ?>"/>
|
133 |
<input type="hidden" name="condition_id" value="<?php echo esc_attr( $condition->id ) ?>"/>
|
127 |
do_action( 'cnb_header' );
|
128 |
?>
|
129 |
|
130 |
+
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post">
|
131 |
<input type="hidden" name="page" value="call-now-button-conditions"/>
|
132 |
<input type="hidden" name="bid" value="<?php echo esc_attr( $bid ) ?>"/>
|
133 |
<input type="hidden" name="condition_id" value="<?php echo esc_attr( $condition->id ) ?>"/>
|
src/admin/domain/CnbDomainViewEdit.php
CHANGED
@@ -45,7 +45,7 @@ class CnbDomainViewEdit {
|
|
45 |
do_action( 'cnb_header' );
|
46 |
?>
|
47 |
|
48 |
-
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) )
|
49 |
<input type="hidden" name="page" value="call-now-button"/>
|
50 |
<input type="hidden" name="action"
|
51 |
value="<?php echo $domain_id === 'new' ? 'cnb_create_domain' : 'cnb_update_domain' ?>"/>
|
@@ -107,7 +107,9 @@ class CnbDomainViewEdit {
|
|
107 |
<?php }
|
108 |
}
|
109 |
|
110 |
-
function render_form_tracking( $domain ) {
|
|
|
|
|
111 |
<tr>
|
112 |
<th colspan="2"><h2>Tracking</h2></th>
|
113 |
</tr>
|
@@ -124,7 +126,7 @@ class CnbDomainViewEdit {
|
|
124 |
<p class="description">
|
125 |
Supports Classic, Universal Analytics and Global site tag (v3 and v4).<br>
|
126 |
Using Google Tag Manager? Set up click tracking in GTM. <a
|
127 |
-
href="<?php echo
|
128 |
target="_blank">Here's how...</a>
|
129 |
</p>
|
130 |
</td>
|
@@ -149,7 +151,8 @@ class CnbDomainViewEdit {
|
|
149 |
}
|
150 |
|
151 |
function render_form_button_display( $domain ) {
|
152 |
-
$domain_controller
|
|
|
153 |
$domain_properties_zindex_order = $domain_controller->zindex_to_order( $domain->properties->zindex );
|
154 |
?>
|
155 |
<tr>
|
@@ -170,7 +173,8 @@ class CnbDomainViewEdit {
|
|
170 |
</tr>
|
171 |
<tr class="z-index">
|
172 |
<th scope="row"><label for="cnb_order_slider">Order (<span id="cnb_order_value"></span>)</label> <a
|
173 |
-
href="<?php echo
|
|
|
174 |
class="cnb-nounderscore">
|
175 |
<span class="dashicons dashicons-editor-help"></span>
|
176 |
</a></th>
|
45 |
do_action( 'cnb_header' );
|
46 |
?>
|
47 |
|
48 |
+
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post">
|
49 |
<input type="hidden" name="page" value="call-now-button"/>
|
50 |
<input type="hidden" name="action"
|
51 |
value="<?php echo $domain_id === 'new' ? 'cnb_create_domain' : 'cnb_update_domain' ?>"/>
|
107 |
<?php }
|
108 |
}
|
109 |
|
110 |
+
function render_form_tracking( $domain ) {
|
111 |
+
$cnb_utils = new CnbUtils();
|
112 |
+
?>
|
113 |
<tr>
|
114 |
<th colspan="2"><h2>Tracking</h2></th>
|
115 |
</tr>
|
126 |
<p class="description">
|
127 |
Supports Classic, Universal Analytics and Global site tag (v3 and v4).<br>
|
128 |
Using Google Tag Manager? Set up click tracking in GTM. <a
|
129 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'web-app/domains/tracking-button-clicks-gtm/', 'domain-settings-description', 'GA-tracking-with-GTM' ) ) ?>"
|
130 |
target="_blank">Here's how...</a>
|
131 |
</p>
|
132 |
</td>
|
151 |
}
|
152 |
|
153 |
function render_form_button_display( $domain ) {
|
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>
|
173 |
</tr>
|
174 |
<tr class="z-index">
|
175 |
<th scope="row"><label for="cnb_order_slider">Order (<span id="cnb_order_value"></span>)</label> <a
|
176 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/set-order/', 'domain-settings-question-mark', 'Order' ) ) ?>"
|
177 |
+
target="_blank"
|
178 |
class="cnb-nounderscore">
|
179 |
<span class="dashicons dashicons-editor-help"></span>
|
180 |
</a></th>
|
src/admin/domain/partials/CnbDomainViewUpgradeFinished.php
CHANGED
@@ -8,6 +8,7 @@ defined( 'ABSPATH' ) || die( '-1' );
|
|
8 |
use cnb\admin\api\CnbAppRemote;
|
9 |
use cnb\notices\CnbAdminNotices;
|
10 |
use cnb\notices\CnbNotice;
|
|
|
11 |
|
12 |
class CnbDomainViewUpgradeFinished {
|
13 |
|
@@ -42,6 +43,9 @@ class CnbDomainViewUpgradeFinished {
|
|
42 |
* @return void
|
43 |
*/
|
44 |
function render( $domain, $notice = null ) {
|
|
|
|
|
|
|
45 |
$portal_url = CnbAppRemote::cnb_remote_create_billing_portal();
|
46 |
|
47 |
echo '<p>Your domain <strong>' . esc_html( $domain->name ) . '</strong> ';
|
@@ -72,8 +76,8 @@ class CnbDomainViewUpgradeFinished {
|
|
72 |
echo $domain->renew == 1 ? ' renew automatically ' : ' expire ';
|
73 |
echo 'on ' . esc_html( date( 'F d, Y', strtotime( $domain->expires ) ) ) . '.';
|
74 |
}
|
75 |
-
echo 'You can change this on the <a href="' .
|
76 |
-
echo '<p>You can access and download your invoice via <a href="' .
|
77 |
-
echo 'For any questions, please head over to our <a href="
|
78 |
}
|
79 |
}
|
8 |
use cnb\admin\api\CnbAppRemote;
|
9 |
use cnb\notices\CnbAdminNotices;
|
10 |
use cnb\notices\CnbNotice;
|
11 |
+
use cnb\utils\CnbUtils;
|
12 |
|
13 |
class CnbDomainViewUpgradeFinished {
|
14 |
|
43 |
* @return void
|
44 |
*/
|
45 |
function render( $domain, $notice = null ) {
|
46 |
+
$cnb_utils = new CnbUtils();
|
47 |
+
$support_url = $cnb_utils->get_support_url('', 'upgrade-success-page', 'help-center');
|
48 |
+
|
49 |
$portal_url = CnbAppRemote::cnb_remote_create_billing_portal();
|
50 |
|
51 |
echo '<p>Your domain <strong>' . esc_html( $domain->name ) . '</strong> ';
|
76 |
echo $domain->renew == 1 ? ' renew automatically ' : ' expire ';
|
77 |
echo 'on ' . esc_html( date( 'F d, Y', strtotime( $domain->expires ) ) ) . '.';
|
78 |
}
|
79 |
+
echo 'You can change this on the <a href="' . esc_url( $this->get_settings_url() ) . '">settings page</a>.</p>';
|
80 |
+
echo '<p>You can access and download your invoice via <a href="' . esc_url( $portal_url->url ) . '">the invoice dashboard</a>. ';
|
81 |
+
echo 'For any questions, please head over to our <a href="' . esc_url( $support_url ) . '">help center</a>.</p>';
|
82 |
}
|
83 |
}
|
src/admin/legacy/CnbLegacyEdit.php
CHANGED
@@ -13,6 +13,7 @@ class CnbLegacyEdit {
|
|
13 |
$cnb_options = get_option( 'cnb' );
|
14 |
$view = new CnbLegacyEdit();
|
15 |
$adminFunctions = new CnbAdminFunctions();
|
|
|
16 |
|
17 |
wp_enqueue_script( CNB_SLUG . '-legacy-edit' );
|
18 |
|
@@ -33,7 +34,7 @@ class CnbLegacyEdit {
|
|
33 |
data-tab-name="extra_options">Presentation</a>
|
34 |
</h2>
|
35 |
|
36 |
-
<form method="post" action="<?php echo esc_url( admin_url( 'options.php' ) )
|
37 |
class="cnb-container">
|
38 |
<?php settings_fields( 'cnb_options' ); ?>
|
39 |
<table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) ) ?>"
|
@@ -52,7 +53,7 @@ class CnbLegacyEdit {
|
|
52 |
</tr>
|
53 |
<tr>
|
54 |
<th scope="row"><label for="cnb-number">Phone number</label> <a
|
55 |
-
href="<?php echo
|
56 |
target="_blank" class="cnb-nounderscore">
|
57 |
<span class="dashicons dashicons-editor-help"></span>
|
58 |
</a></th>
|
@@ -62,7 +63,7 @@ class CnbLegacyEdit {
|
|
62 |
<tr class="button-text">
|
63 |
<th scope="row"><label for="buttonTextField">Button text</label> <small
|
64 |
style="font-weight: 400">(optional)</small> <a
|
65 |
-
href="<?php echo
|
66 |
target="_blank" class="cnb-nounderscore">
|
67 |
<span class="dashicons dashicons-editor-help"></span>
|
68 |
</a></th>
|
@@ -94,7 +95,7 @@ class CnbLegacyEdit {
|
|
94 |
</tr>
|
95 |
<tr>
|
96 |
<th scope="row">Position <a
|
97 |
-
href="<?php echo
|
98 |
target="_blank" class="cnb-nounderscore">
|
99 |
<span class="dashicons dashicons-editor-help"></span>
|
100 |
</a></th>
|
@@ -169,7 +170,7 @@ class CnbLegacyEdit {
|
|
169 |
</tr>
|
170 |
<tr class="appearance">
|
171 |
<th scope="row"><label for="cnb-show">Limit appearance</label> <a
|
172 |
-
href="<?php echo
|
173 |
target="_blank" class="cnb-nounderscore">
|
174 |
<span class="dashicons dashicons-editor-help"></span>
|
175 |
</a></th>
|
@@ -179,7 +180,7 @@ class CnbLegacyEdit {
|
|
179 |
placeholder="E.g. 14, 345"/>
|
180 |
<p class="description">Enter IDs of the posts & pages, separated by commas
|
181 |
(leave blank for all). <a
|
182 |
-
href="<?php echo
|
183 |
target="_blank">Learn more...</a></p>
|
184 |
<div class="cnb-radio-item">
|
185 |
<input id="limit1" type="radio" name="cnb[limit]"
|
@@ -307,10 +308,11 @@ class CnbLegacyEdit {
|
|
307 |
|
308 |
function render_tracking() {
|
309 |
$cnb_options = get_option( 'cnb' );
|
|
|
310 |
?>
|
311 |
<tr>
|
312 |
<th scope="row">Click tracking <a
|
313 |
-
href="<?php echo
|
314 |
target="_blank" class="cnb-nounderscore">
|
315 |
<span class="dashicons dashicons-editor-help"></span>
|
316 |
</a></th>
|
@@ -336,7 +338,7 @@ class CnbLegacyEdit {
|
|
336 |
<label for="tracking2">Classic Google Analytics (ga.js)</label>
|
337 |
</div>
|
338 |
<p class="description">Using Google Tag Manager? Set up click tracking in GTM. <a
|
339 |
-
href="<?php echo
|
340 |
target="_blank">Learn how to do this...</a></p>
|
341 |
</td>
|
342 |
</tr>
|
@@ -345,10 +347,11 @@ class CnbLegacyEdit {
|
|
345 |
|
346 |
function render_conversions() {
|
347 |
$cnb_options = get_option( 'cnb' );
|
|
|
348 |
?>
|
349 |
<tr>
|
350 |
<th scope="row">Google Ads <a
|
351 |
-
href="<?php echo
|
352 |
target="_blank" class="cnb-nounderscore">
|
353 |
<span class="dashicons dashicons-editor-help"></span>
|
354 |
</a></th>
|
@@ -370,7 +373,7 @@ class CnbLegacyEdit {
|
|
370 |
</div>
|
371 |
<p class="description">Select this option if you want to track clicks on the button as Google Ads
|
372 |
conversions. This option requires the Event snippet to be present on the page. <a
|
373 |
-
href="<?php echo
|
374 |
target="_blank">Learn more...</a></p>
|
375 |
</td>
|
376 |
</tr>
|
@@ -394,10 +397,12 @@ class CnbLegacyEdit {
|
|
394 |
|
395 |
function render_zindex() {
|
396 |
$cnb_options = get_option( 'cnb' );
|
|
|
397 |
?>
|
398 |
<tr class="z-index">
|
399 |
<th scope="row"><label for="cnb_order_slider">Order (<span id="cnb_order_value"></span>)</label> <a
|
400 |
-
href="<?php echo
|
|
|
401 |
class="cnb-nounderscore">
|
402 |
<span class="dashicons dashicons-editor-help"></span>
|
403 |
</a></th>
|
@@ -423,6 +428,7 @@ class CnbLegacyEdit {
|
|
423 |
|
424 |
function render_welcome_banner() {
|
425 |
$legacyController = new CnbLegacyController();
|
|
|
426 |
if ( ! $legacyController->show_welcome_banner() ) {
|
427 |
return;
|
428 |
}
|
@@ -472,8 +478,12 @@ class CnbLegacyEdit {
|
|
472 |
|
473 |
<p><a href="<?php echo esc_url( $upgrade_link ) ?>">More info about Premium</a></p>
|
474 |
<h3>Other resources</h3>
|
475 |
-
<p
|
476 |
-
|
|
|
|
|
|
|
|
|
477 |
</div>
|
478 |
</div>
|
479 |
</div>
|
13 |
$cnb_options = get_option( 'cnb' );
|
14 |
$view = new CnbLegacyEdit();
|
15 |
$adminFunctions = new CnbAdminFunctions();
|
16 |
+
$cnb_utils = new CnbUtils();
|
17 |
|
18 |
wp_enqueue_script( CNB_SLUG . '-legacy-edit' );
|
19 |
|
34 |
data-tab-name="extra_options">Presentation</a>
|
35 |
</h2>
|
36 |
|
37 |
+
<form method="post" action="<?php echo esc_url( admin_url( 'options.php' ) ) ?>"
|
38 |
class="cnb-container">
|
39 |
<?php settings_fields( 'cnb_options' ); ?>
|
40 |
<table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) ) ?>"
|
53 |
</tr>
|
54 |
<tr>
|
55 |
<th scope="row"><label for="cnb-number">Phone number</label> <a
|
56 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/basics/phone-number/', 'legacy-basics-question-mark', 'phone-number' ) ) ?>"
|
57 |
target="_blank" class="cnb-nounderscore">
|
58 |
<span class="dashicons dashicons-editor-help"></span>
|
59 |
</a></th>
|
63 |
<tr class="button-text">
|
64 |
<th scope="row"><label for="buttonTextField">Button text</label> <small
|
65 |
style="font-weight: 400">(optional)</small> <a
|
66 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/basics/using-text-buttons/', 'legacy-basics-question-mark', 'using-text-buttons' ) ) ?>"
|
67 |
target="_blank" class="cnb-nounderscore">
|
68 |
<span class="dashicons dashicons-editor-help"></span>
|
69 |
</a></th>
|
95 |
</tr>
|
96 |
<tr>
|
97 |
<th scope="row">Position <a
|
98 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/presentation/button-position/', 'legacy-presentation-question-mark', 'button-position' ) ) ?>"
|
99 |
target="_blank" class="cnb-nounderscore">
|
100 |
<span class="dashicons dashicons-editor-help"></span>
|
101 |
</a></th>
|
170 |
</tr>
|
171 |
<tr class="appearance">
|
172 |
<th scope="row"><label for="cnb-show">Limit appearance</label> <a
|
173 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/presentation/limit-appearance/', 'legacy-presentation-question-mark', 'limit-appearance' ) ) ?>"
|
174 |
target="_blank" class="cnb-nounderscore">
|
175 |
<span class="dashicons dashicons-editor-help"></span>
|
176 |
</a></th>
|
180 |
placeholder="E.g. 14, 345"/>
|
181 |
<p class="description">Enter IDs of the posts & pages, separated by commas
|
182 |
(leave blank for all). <a
|
183 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/presentation/limit-appearance/', 'legacy-presentation-description', 'limit-appearance' ) ) ?>"
|
184 |
target="_blank">Learn more...</a></p>
|
185 |
<div class="cnb-radio-item">
|
186 |
<input id="limit1" type="radio" name="cnb[limit]"
|
308 |
|
309 |
function render_tracking() {
|
310 |
$cnb_options = get_option( 'cnb' );
|
311 |
+
$cnb_utils = new CnbUtils();
|
312 |
?>
|
313 |
<tr>
|
314 |
<th scope="row">Click tracking <a
|
315 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/click-tracking/', 'legacy-settings-question-mark', 'click-tracking' ) ) ?>"
|
316 |
target="_blank" class="cnb-nounderscore">
|
317 |
<span class="dashicons dashicons-editor-help"></span>
|
318 |
</a></th>
|
338 |
<label for="tracking2">Classic Google Analytics (ga.js)</label>
|
339 |
</div>
|
340 |
<p class="description">Using Google Tag Manager? Set up click tracking in GTM. <a
|
341 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/google-tag-manager-event-tracking/', 'legacy-settings-description', 'google-tag-manager-event-tracking' ) ) ?>"
|
342 |
target="_blank">Learn how to do this...</a></p>
|
343 |
</td>
|
344 |
</tr>
|
347 |
|
348 |
function render_conversions() {
|
349 |
$cnb_options = get_option( 'cnb' );
|
350 |
+
$cnb_utils = new CnbUtils();
|
351 |
?>
|
352 |
<tr>
|
353 |
<th scope="row">Google Ads <a
|
354 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/google-ads/', 'legacy-settings-question-mark', 'google-ads' ) ) ?>"
|
355 |
target="_blank" class="cnb-nounderscore">
|
356 |
<span class="dashicons dashicons-editor-help"></span>
|
357 |
</a></th>
|
373 |
</div>
|
374 |
<p class="description">Select this option if you want to track clicks on the button as Google Ads
|
375 |
conversions. This option requires the Event snippet to be present on the page. <a
|
376 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/google-ads/', 'legacy-settings-description', 'google-ads' ) ) ?>"
|
377 |
target="_blank">Learn more...</a></p>
|
378 |
</td>
|
379 |
</tr>
|
397 |
|
398 |
function render_zindex() {
|
399 |
$cnb_options = get_option( 'cnb' );
|
400 |
+
$cnb_utils = new CnbUtils();
|
401 |
?>
|
402 |
<tr class="z-index">
|
403 |
<th scope="row"><label for="cnb_order_slider">Order (<span id="cnb_order_value"></span>)</label> <a
|
404 |
+
href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/set-order/', 'legacy-settings-question-mark', 'Order' ) ) ?>"
|
405 |
+
target="_blank"
|
406 |
class="cnb-nounderscore">
|
407 |
<span class="dashicons dashicons-editor-help"></span>
|
408 |
</a></th>
|
428 |
|
429 |
function render_welcome_banner() {
|
430 |
$legacyController = new CnbLegacyController();
|
431 |
+
$cnb_utils = new CnbUtils();
|
432 |
if ( ! $legacyController->show_welcome_banner() ) {
|
433 |
return;
|
434 |
}
|
478 |
|
479 |
<p><a href="<?php echo esc_url( $upgrade_link ) ?>">More info about Premium</a></p>
|
480 |
<h3>Other resources</h3>
|
481 |
+
<p>
|
482 |
+
<a href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/', 'welcome-banner', 'Help center' ) ) ?>">Help
|
483 |
+
center</a></p>
|
484 |
+
<p>
|
485 |
+
<a href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/#faq', 'welcome-banner', 'FAQ' ) ) ?>">FAQ</a>
|
486 |
+
</p>
|
487 |
</div>
|
488 |
</div>
|
489 |
</div>
|
src/admin/legacy/CnbLegacyUpgrade.php
CHANGED
@@ -57,7 +57,9 @@ class CnbLegacyUpgrade {
|
|
57 |
</div>
|
58 |
<?php }
|
59 |
|
60 |
-
function premium_plugin_promobox() {
|
|
|
|
|
61 |
<div class="cnb-body-column">
|
62 |
<?php
|
63 |
( new CnbAdminFunctions() )->cnb_promobox(
|
@@ -70,7 +72,7 @@ class CnbLegacyUpgrade {
|
|
70 |
✓ Circular button (single & multi action)<br>
|
71 |
✓ Buttonbar (multi action)<br>
|
72 |
✓ Action labels<br>
|
73 |
-
✓ WhatsApp chat modal<a href="' .
|
74 |
</p>
|
75 |
<hr>
|
76 |
<p>
|
57 |
</div>
|
58 |
<?php }
|
59 |
|
60 |
+
function premium_plugin_promobox() {
|
61 |
+
$cnb_utils = new CnbUtils();
|
62 |
+
?>
|
63 |
<div class="cnb-body-column">
|
64 |
<?php
|
65 |
( new CnbAdminFunctions() )->cnb_promobox(
|
72 |
✓ Circular button (single & multi action)<br>
|
73 |
✓ Buttonbar (multi action)<br>
|
74 |
✓ Action labels<br>
|
75 |
+
✓ WhatsApp chat modal<a href="' . esc_url($cnb_utils->get_support_url('wordpress/buttons/whatsapp-modal/', 'question-mark', 'whatsapp-modal' ) ) . '" target="_blank" class="cnb-nounderscore"><span class="dashicons dashicons-editor-help"></span></a><br>
|
76 |
</p>
|
77 |
<hr>
|
78 |
<p>
|
src/admin/partials/CnbFooter.php
CHANGED
@@ -29,16 +29,16 @@ class CnbFooter {
|
|
29 |
<div class="feedback-collection">
|
30 |
<div class="cnb-clear"></div>
|
31 |
<p class="cnb-url cnb-center"><a
|
32 |
-
href="<?php echo
|
33 |
target="_blank">Call Now Button<?php if ( $cnb_utils->isCloudActive( $cnb_options ) ) {
|
34 |
echo '<span class="cnb_footer_beta">PREMIUM</span>';
|
35 |
} ?></a></p>
|
36 |
<p class="cnb-center">Version <?php echo esc_attr( CNB_VERSION ) ?>
|
37 |
<p class="cnb-center cnb-spacing">
|
38 |
-
<a href="<?php echo
|
39 |
-
|
40 |
title="Support">Support</a> ·
|
41 |
-
<a href="<?php echo
|
42 |
target="_blank" title="Feature Requests">Suggestions</a>
|
43 |
<?php if ( ! $cnb_utils->isCloudActive( $cnb_options ) ) { ?>
|
44 |
· <strong><a href="<?php echo esc_url( $upgrade_link ) ?>"
|
29 |
<div class="feedback-collection">
|
30 |
<div class="cnb-clear"></div>
|
31 |
<p class="cnb-url cnb-center"><a
|
32 |
+
href="<?php echo esc_url( $cnb_utils->get_website_url( '', 'footer-links', 'branding' ) ) ?>"
|
33 |
target="_blank">Call Now Button<?php if ( $cnb_utils->isCloudActive( $cnb_options ) ) {
|
34 |
echo '<span class="cnb_footer_beta">PREMIUM</span>';
|
35 |
} ?></a></p>
|
36 |
<p class="cnb-center">Version <?php echo esc_attr( CNB_VERSION ) ?>
|
37 |
<p class="cnb-center cnb-spacing">
|
38 |
+
<a href="<?php echo esc_url( $cnb_utils->get_support_url( '', 'footer-links', 'support' ) ) ?>"
|
39 |
+
target="_blank"
|
40 |
title="Support">Support</a> ·
|
41 |
+
<a href="<?php echo esc_url( $cnb_utils->get_support_url( 'feature-request/', 'footer-links', 'suggestions' ) ) ?>"
|
42 |
target="_blank" title="Feature Requests">Suggestions</a>
|
43 |
<?php if ( ! $cnb_utils->isCloudActive( $cnb_options ) ) { ?>
|
44 |
· <strong><a href="<?php echo esc_url( $upgrade_link ) ?>"
|
src/admin/partials/CnbHeaderNotices.php
CHANGED
@@ -77,15 +77,19 @@ class CnbHeaderNotices {
|
|
77 |
}
|
78 |
|
79 |
private function cnb_settings_get_account_missing_notice() {
|
|
|
|
|
|
|
|
|
80 |
$message = '<h3 class="title cnb-remove-add-new">Activating Premium</h3>';
|
81 |
-
$message .= '<p>To activate Premium, you\'ll need a <a href="
|
82 |
$message .= '<h4>Option 1: Email activation (easy and fast!)</h4>';
|
83 |
$message .= self::cnb_settings_email_activation_input();
|
84 |
|
85 |
$message .= '<hr>';
|
86 |
$message .= '<h4>Option 2: Web activation (manual process)</h4>';
|
87 |
$message .= '<ol>';
|
88 |
-
$message .= '<li>Create your account at <a href="
|
89 |
$message .= '<li>Go to your profile info by clicking on the user icon in the top right corner and then click <strong>Create new API key</strong>.</li>';
|
90 |
$message .= '<li>Copy the API key that appears, paste it into the field below and click <strong>Store API key</strong>.</li>';
|
91 |
$message .= '</ol>';
|
@@ -96,6 +100,8 @@ class CnbHeaderNotices {
|
|
96 |
}
|
97 |
|
98 |
private function cnb_settings_api_key_invalid_notice() {
|
|
|
|
|
99 |
$message = '<h3 class="title cnb-remove-add-new">Ooops, that API key doesn\'t seem right</h3>';
|
100 |
$message .= '<p>The saved API key is invalid. Let\'s give it another try:</p>';
|
101 |
$message .= '<h4>Option 1: Email activation</h4>';
|
@@ -104,7 +110,7 @@ class CnbHeaderNotices {
|
|
104 |
$message .= '<hr>';
|
105 |
$message .= '<h4>Option 2: Web activation (manual process)</h4>';
|
106 |
$message .= '<ol>';
|
107 |
-
$message .= '<li>Create your account at <a href="
|
108 |
$message .= '<li>Go to your profile info by clicking on the user icon in the top right corner and then click <strong>Create new API key</strong>.</li>';
|
109 |
$message .= '<li>Copy the API key that appears, paste it into the field below and click <strong>Store API key</strong>.</li>';
|
110 |
$message .= '</ol>';
|
@@ -116,6 +122,9 @@ class CnbHeaderNotices {
|
|
116 |
}
|
117 |
|
118 |
public static function cnb_settings_email_activation_input() {
|
|
|
|
|
|
|
119 |
$message = '<form class="cnb-container" onsubmit="return cnb_email_activation_submit()">';
|
120 |
$message .= '<div id="cnb_email_activation_alternate_formd">';
|
121 |
$message .= '<p style="margin-top: 0;"><strong>Email address</strong> (for sending you an activation link):</p>';
|
@@ -124,7 +133,7 @@ class CnbHeaderNotices {
|
|
124 |
$message .= '</div>';
|
125 |
$message .= '<p id="cnb_email_activation"></p>';
|
126 |
|
127 |
-
$message .= '<p class="nonessential">By clicking <u>Activate Premium</u> an account will be created with your email address on callnowbutton.com and you agree to our <a href="
|
128 |
$message .= '</form>';
|
129 |
|
130 |
return $message;
|
@@ -214,15 +223,8 @@ class CnbHeaderNotices {
|
|
214 |
}
|
215 |
|
216 |
function get_generic_changelog_message() {
|
217 |
-
$
|
218 |
-
$changelog_link =
|
219 |
-
array(
|
220 |
-
'utm_source' => 'wp-plugin_' . CNB_VERSION,
|
221 |
-
'utm_campaign' => 'update_notice',
|
222 |
-
'utm_medium' => 'referral',
|
223 |
-
),
|
224 |
-
$changelog_url
|
225 |
-
);
|
226 |
$changelog_message = '<a href="' . esc_url( $changelog_link ) . '">Click here to see what changed</a>';
|
227 |
$message = '<p><span class="dashicons dashicons-yes"></span> ';
|
228 |
$message .= 'The plugin has been updated. ';
|
@@ -440,10 +442,13 @@ class CnbHeaderNotices {
|
|
440 |
}
|
441 |
|
442 |
private function get_cnb_generic_error_notice() {
|
|
|
|
|
|
|
443 |
return '<h3 class="title">Something went wrong!</h3>
|
444 |
<p>Something has gone wrong and we do not know why...</p>
|
445 |
<p>As unlikely as it is, our service might be experiencing issues (check <a href="https://status.callnowbutton.com">our status page</a>).</p>
|
446 |
-
<p>If you think you\'ve found a bug, please report it at our <a href="
|
447 |
}
|
448 |
|
449 |
private function cnb_generic_error_notice( $user ) {
|
77 |
}
|
78 |
|
79 |
private function cnb_settings_get_account_missing_notice() {
|
80 |
+
$cnb_utils = new CnbUtils();
|
81 |
+
$register_url = $cnb_utils->get_app_url( 'register', 'upgrade-to-premium-options', 'callnowbutton.com');
|
82 |
+
$url = $cnb_utils->get_app_url( '', 'manual_activation', 'sign-up-for-api');
|
83 |
+
|
84 |
$message = '<h3 class="title cnb-remove-add-new">Activating Premium</h3>';
|
85 |
+
$message .= '<p>To activate Premium, you\'ll need a <a href="' . esc_url($register_url) . '" target="_blank">callnowbutton.com</a> account and an API key. There\'s 2 ways to do this:</p>';
|
86 |
$message .= '<h4>Option 1: Email activation (easy and fast!)</h4>';
|
87 |
$message .= self::cnb_settings_email_activation_input();
|
88 |
|
89 |
$message .= '<hr>';
|
90 |
$message .= '<h4>Option 2: Web activation (manual process)</h4>';
|
91 |
$message .= '<ol>';
|
92 |
+
$message .= '<li>Create your account at <a href="' . esc_url($url) . '">https://app.callnowbutton.com</a></li>';
|
93 |
$message .= '<li>Go to your profile info by clicking on the user icon in the top right corner and then click <strong>Create new API key</strong>.</li>';
|
94 |
$message .= '<li>Copy the API key that appears, paste it into the field below and click <strong>Store API key</strong>.</li>';
|
95 |
$message .= '</ol>';
|
100 |
}
|
101 |
|
102 |
private function cnb_settings_api_key_invalid_notice() {
|
103 |
+
$cnb_utils = new CnbUtils();
|
104 |
+
$url = $cnb_utils->get_app_url( '', 'manual_activation', 'sign-up-for-api');
|
105 |
$message = '<h3 class="title cnb-remove-add-new">Ooops, that API key doesn\'t seem right</h3>';
|
106 |
$message .= '<p>The saved API key is invalid. Let\'s give it another try:</p>';
|
107 |
$message .= '<h4>Option 1: Email activation</h4>';
|
110 |
$message .= '<hr>';
|
111 |
$message .= '<h4>Option 2: Web activation (manual process)</h4>';
|
112 |
$message .= '<ol>';
|
113 |
+
$message .= '<li>Create your account at <a href="' . esc_url($url) . '">https://app.callnowbutton.com</a></li>';
|
114 |
$message .= '<li>Go to your profile info by clicking on the user icon in the top right corner and then click <strong>Create new API key</strong>.</li>';
|
115 |
$message .= '<li>Copy the API key that appears, paste it into the field below and click <strong>Store API key</strong>.</li>';
|
116 |
$message .= '</ol>';
|
122 |
}
|
123 |
|
124 |
public static function cnb_settings_email_activation_input() {
|
125 |
+
$cnb_utils = new CnbUtils();
|
126 |
+
$terms_url = $cnb_utils->get_website_url('terms.html', 'email-activation', 'terms');
|
127 |
+
$privacy_url = $cnb_utils->get_website_url('privacy.html', 'email-activation', 'privacy');
|
128 |
$message = '<form class="cnb-container" onsubmit="return cnb_email_activation_submit()">';
|
129 |
$message .= '<div id="cnb_email_activation_alternate_formd">';
|
130 |
$message .= '<p style="margin-top: 0;"><strong>Email address</strong> (for sending you an activation link):</p>';
|
133 |
$message .= '</div>';
|
134 |
$message .= '<p id="cnb_email_activation"></p>';
|
135 |
|
136 |
+
$message .= '<p class="nonessential">By clicking <u>Activate Premium</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>';
|
137 |
$message .= '</form>';
|
138 |
|
139 |
return $message;
|
223 |
}
|
224 |
|
225 |
function get_generic_changelog_message() {
|
226 |
+
$cnb_utils = new CnbUtils();
|
227 |
+
$changelog_link = $cnb_utils->get_website_url('wordpress/changelog/', 'update_notice');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
$changelog_message = '<a href="' . esc_url( $changelog_link ) . '">Click here to see what changed</a>';
|
229 |
$message = '<p><span class="dashicons dashicons-yes"></span> ';
|
230 |
$message .= 'The plugin has been updated. ';
|
442 |
}
|
443 |
|
444 |
private function get_cnb_generic_error_notice() {
|
445 |
+
$cnb_utils = new CnbUtils();
|
446 |
+
$support_url = $cnb_utils->get_support_url('', 'notice-error', 'help-center');
|
447 |
+
|
448 |
return '<h3 class="title">Something went wrong!</h3>
|
449 |
<p>Something has gone wrong and we do not know why...</p>
|
450 |
<p>As unlikely as it is, our service might be experiencing issues (check <a href="https://status.callnowbutton.com">our status page</a>).</p>
|
451 |
+
<p>If you think you\'ve found a bug, please report it at our <a href="' . esc_url( $support_url ) . '" target="_blank">Help Center</a>.';
|
452 |
}
|
453 |
|
454 |
private function cnb_generic_error_notice( $user ) {
|
src/admin/profile/CnbProfileEdit.php
CHANGED
@@ -39,7 +39,7 @@ class CnbProfileEdit {
|
|
39 |
$cnb_user_stripe_verified = isset( $cnb_user->taxIds[0]->verification->status ) && $cnb_user->taxIds[0]->verification->status === 'verified';
|
40 |
$cnb_user_stripe_verification_pending = isset( $cnb_user->taxIds[0]->verification->status ) && $cnb_user->taxIds[0]->verification->status === 'pending';
|
41 |
?>
|
42 |
-
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) )
|
43 |
class="cnb-container cnb-settings-profile">
|
44 |
<input type="hidden" name="page" value="call-now-button"/>
|
45 |
<input type="hidden" name="action" value="cnb_profile_edit"/>
|
@@ -105,7 +105,7 @@ class CnbProfileEdit {
|
|
105 |
$user_country = $cnb_user->address->country;
|
106 |
}
|
107 |
/** @noinspection HtmlUnknownAttribute */
|
108 |
-
echo sprintf( '<option value="%1$s"%2$s>%3$s</option>',
|
109 |
esc_attr( $country['code'] ),
|
110 |
selected( $country['code'], $user_country ),
|
111 |
esc_html( $country['country'] )
|
39 |
$cnb_user_stripe_verified = isset( $cnb_user->taxIds[0]->verification->status ) && $cnb_user->taxIds[0]->verification->status === 'verified';
|
40 |
$cnb_user_stripe_verification_pending = isset( $cnb_user->taxIds[0]->verification->status ) && $cnb_user->taxIds[0]->verification->status === 'pending';
|
41 |
?>
|
42 |
+
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ) ?>" method="post"
|
43 |
class="cnb-container cnb-settings-profile">
|
44 |
<input type="hidden" name="page" value="call-now-button"/>
|
45 |
<input type="hidden" name="action" value="cnb_profile_edit"/>
|
105 |
$user_country = $cnb_user->address->country;
|
106 |
}
|
107 |
/** @noinspection HtmlUnknownAttribute */
|
108 |
+
echo sprintf( '<option value="%1$s" %2$s>%3$s</option>',
|
109 |
esc_attr( $country['code'] ),
|
110 |
selected( $country['code'], $user_country ),
|
111 |
esc_html( $country['country'] )
|
src/admin/settings/CnbSettingsViewEdit.php
CHANGED
@@ -37,7 +37,7 @@ class CnbSettingsViewEdit {
|
|
37 |
* @return void
|
38 |
*/
|
39 |
private function render_legacy_options() {
|
40 |
-
$view
|
41 |
?>
|
42 |
<tr>
|
43 |
<th colspan="2"><h2>Tracking</h2></th>
|
@@ -64,10 +64,11 @@ class CnbSettingsViewEdit {
|
|
64 |
$cnb_options = get_option( 'cnb' );
|
65 |
$show_advanced_view_only = array_key_exists( 'advanced_view', $cnb_options ) && $cnb_options['advanced_view'] === 1;
|
66 |
$adminFunctions = new CnbAdminFunctions();
|
|
|
67 |
|
68 |
?>
|
69 |
<table data-tab-name="account_options"
|
70 |
-
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'account_options' ) )
|
71 |
<tr>
|
72 |
<th colspan="2"></th>
|
73 |
</tr>
|
@@ -81,7 +82,7 @@ class CnbSettingsViewEdit {
|
|
81 |
placeholder="e.g. b52c3f83-38dc-4493-bc90-642da5be7e39"/>
|
82 |
</label>
|
83 |
<p class="description">Get your API key at <a
|
84 |
-
href="<?php echo
|
85 |
</p>
|
86 |
<?php } ?>
|
87 |
<?php if ( is_wp_error( $cnb_user ) && ! empty( $cnb_options['api_key'] ) ) { ?>
|
@@ -149,7 +150,7 @@ class CnbSettingsViewEdit {
|
|
149 |
$status = CnbSettingsController::getStatus( $cnb_options );
|
150 |
?>
|
151 |
<table data-tab-name="advanced_options"
|
152 |
-
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'advanced_options' ) )
|
153 |
<?php if ( isset( $cnb_cloud_domain ) && ! ( $cnb_cloud_domain instanceof WP_Error ) && $status === 'cloud' ) {
|
154 |
?>
|
155 |
<tr>
|
@@ -389,7 +390,7 @@ class CnbSettingsViewEdit {
|
|
389 |
|
390 |
<?php if ( $cnb_options['cloud_enabled'] == 1 && $cloud_successful && $cnb_cloud_domain->type !== 'PRO' ) { ?>
|
391 |
<p class="description">Free and paid options available.
|
392 |
-
<a href="<?php echo esc_url( ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain ) )
|
393 |
more</a>
|
394 |
</p>
|
395 |
<?php } ?>
|
@@ -453,11 +454,11 @@ class CnbSettingsViewEdit {
|
|
453 |
class="nav-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'advanced_options' ) ) ?>">Advanced</a>
|
454 |
<?php } ?>
|
455 |
</h2>
|
456 |
-
<form method="post" action="<?php echo esc_url( admin_url( 'options.php' ) )
|
457 |
class="cnb-container">
|
458 |
<?php settings_fields( 'cnb_options' ); ?>
|
459 |
<table data-tab-name="basic_options"
|
460 |
-
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) )
|
461 |
<?php
|
462 |
$this->render_premium_option( $cloud_successful, $cnb_cloud_domain );
|
463 |
if ( $status !== 'cloud' ) {
|
37 |
* @return void
|
38 |
*/
|
39 |
private function render_legacy_options() {
|
40 |
+
$view = new CnbLegacyEdit();
|
41 |
?>
|
42 |
<tr>
|
43 |
<th colspan="2"><h2>Tracking</h2></th>
|
64 |
$cnb_options = get_option( 'cnb' );
|
65 |
$show_advanced_view_only = array_key_exists( 'advanced_view', $cnb_options ) && $cnb_options['advanced_view'] === 1;
|
66 |
$adminFunctions = new CnbAdminFunctions();
|
67 |
+
$cnb_utils = new CnbUtils();
|
68 |
|
69 |
?>
|
70 |
<table data-tab-name="account_options"
|
71 |
+
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'account_options' ) ) ?>">
|
72 |
<tr>
|
73 |
<th colspan="2"></th>
|
74 |
</tr>
|
82 |
placeholder="e.g. b52c3f83-38dc-4493-bc90-642da5be7e39"/>
|
83 |
</label>
|
84 |
<p class="description">Get your API key at <a
|
85 |
+
href="<?php echo esc_url( $cnb_utils->get_website_url( '', 'settings-account', 'get-api-key' ) ) ?>"><?php echo esc_html( CNB_WEBSITE ) ?></a>
|
86 |
</p>
|
87 |
<?php } ?>
|
88 |
<?php if ( is_wp_error( $cnb_user ) && ! empty( $cnb_options['api_key'] ) ) { ?>
|
150 |
$status = CnbSettingsController::getStatus( $cnb_options );
|
151 |
?>
|
152 |
<table data-tab-name="advanced_options"
|
153 |
+
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'advanced_options' ) ) ?>">
|
154 |
<?php if ( isset( $cnb_cloud_domain ) && ! ( $cnb_cloud_domain instanceof WP_Error ) && $status === 'cloud' ) {
|
155 |
?>
|
156 |
<tr>
|
390 |
|
391 |
<?php if ( $cnb_options['cloud_enabled'] == 1 && $cloud_successful && $cnb_cloud_domain->type !== 'PRO' ) { ?>
|
392 |
<p class="description">Free and paid options available.
|
393 |
+
<a href="<?php echo esc_url( ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain ) ) ?>">Learn
|
394 |
more</a>
|
395 |
</p>
|
396 |
<?php } ?>
|
454 |
class="nav-tab <?php echo esc_attr( $adminFunctions->is_active_tab( 'advanced_options' ) ) ?>">Advanced</a>
|
455 |
<?php } ?>
|
456 |
</h2>
|
457 |
+
<form method="post" action="<?php echo esc_url( admin_url( 'options.php' ) ) ?>"
|
458 |
class="cnb-container">
|
459 |
<?php settings_fields( 'cnb_options' ); ?>
|
460 |
<table data-tab-name="basic_options"
|
461 |
+
class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'basic_options' ) ) ?>">
|
462 |
<?php
|
463 |
$this->render_premium_option( $cloud_successful, $cnb_cloud_domain );
|
464 |
if ( $status !== 'cloud' ) {
|
src/renderers/modern/class-modernrenderer.php
CHANGED
@@ -2,8 +2,6 @@
|
|
2 |
|
3 |
namespace cnb\renderer;
|
4 |
|
5 |
-
use cnb\utils\CnbUtils;
|
6 |
-
|
7 |
// don't load directly
|
8 |
defined( 'ABSPATH' ) || die( '-1' );
|
9 |
|
@@ -54,7 +52,7 @@ class ModernRenderer extends Renderer {
|
|
54 |
/**
|
55 |
* @return bool return true if the button should be rendered, false otherwise
|
56 |
*/
|
57 |
-
function should_render(
|
58 |
$cnb_options = get_option( 'cnb' );
|
59 |
|
60 |
// if we cannot even find this option, we skip the header completely
|
@@ -64,7 +62,8 @@ class ModernRenderer extends Renderer {
|
|
64 |
|
65 |
$cnb_hide_frontpage = isset( $cnb_options['frontpage'] ) && $cnb_options['frontpage'] == 1;
|
66 |
$cnb_show_limited = isset( $cnb_options['show'] ) && $cnb_options['show'] != '';
|
67 |
-
|
|
|
68 |
|
69 |
$is_page_for_posts = get_option( 'page_for_posts' ) == get_queried_object_id() && get_option( 'page_for_posts' ) > 0 && get_queried_object_id() > 0;
|
70 |
|
@@ -107,8 +106,6 @@ class ModernRenderer extends Renderer {
|
|
107 |
return null;
|
108 |
}
|
109 |
|
110 |
-
$cnb_utils = new CnbUtils();
|
111 |
-
|
112 |
$cnb_tracking_id = isset($cnb_options['tracking']) ? (int) $cnb_options['tracking'] : 0;
|
113 |
$cnb_conversion_id = isset($cnb_options['conversions']) ? (int) $cnb_options['conversions'] : 0;
|
114 |
$cnb_tracking_id = ( $cnb_tracking_id >= 0 && $cnb_tracking_id <= 3 ) ? $cnb_tracking_id : 0;
|
@@ -293,7 +290,7 @@ class ModernRenderer extends Renderer {
|
|
293 |
/**
|
294 |
* Get the zoom level for the Modern button.
|
295 |
*
|
296 |
-
* The internal values are 0.7 - 1.3
|
297 |
*
|
298 |
* @return int 70 - 130, defaults to 100
|
299 |
*/
|
2 |
|
3 |
namespace cnb\renderer;
|
4 |
|
|
|
|
|
5 |
// don't load directly
|
6 |
defined( 'ABSPATH' ) || die( '-1' );
|
7 |
|
52 |
/**
|
53 |
* @return bool return true if the button should be rendered, false otherwise
|
54 |
*/
|
55 |
+
function should_render() {
|
56 |
$cnb_options = get_option( 'cnb' );
|
57 |
|
58 |
// if we cannot even find this option, we skip the header completely
|
62 |
|
63 |
$cnb_hide_frontpage = isset( $cnb_options['frontpage'] ) && $cnb_options['frontpage'] == 1;
|
64 |
$cnb_show_limited = isset( $cnb_options['show'] ) && $cnb_options['show'] != '';
|
65 |
+
/** @noinspection PhpTernaryExpressionCanBeReplacedWithConditionInspection */
|
66 |
+
$cnb_show_included = isset($cnb_options['limit']) ? $cnb_options['limit'] === 'include' : true;
|
67 |
|
68 |
$is_page_for_posts = get_option( 'page_for_posts' ) == get_queried_object_id() && get_option( 'page_for_posts' ) > 0 && get_queried_object_id() > 0;
|
69 |
|
106 |
return null;
|
107 |
}
|
108 |
|
|
|
|
|
109 |
$cnb_tracking_id = isset($cnb_options['tracking']) ? (int) $cnb_options['tracking'] : 0;
|
110 |
$cnb_conversion_id = isset($cnb_options['conversions']) ? (int) $cnb_options['conversions'] : 0;
|
111 |
$cnb_tracking_id = ( $cnb_tracking_id >= 0 && $cnb_tracking_id <= 3 ) ? $cnb_tracking_id : 0;
|
290 |
/**
|
291 |
* Get the zoom level for the Modern button.
|
292 |
*
|
293 |
+
* The internal values are 0.7 - 1.3 (it defaults to 1.0)
|
294 |
*
|
295 |
* @return int 70 - 130, defaults to 100
|
296 |
*/
|
src/utils/CnbUtils.php
CHANGED
@@ -131,18 +131,36 @@ class CnbUtils {
|
|
131 |
|
132 |
/**
|
133 |
*
|
134 |
-
* @param $
|
135 |
-
* @param $
|
136 |
*
|
137 |
-
* @return
|
138 |
*/
|
139 |
-
function cnb_utm_params( $
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
-
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
function cnb_array_column( $array, $column_key, $index_key = null ) {
|
131 |
|
132 |
/**
|
133 |
*
|
134 |
+
* @param $utm_campaign string e.g. "footer-links"
|
135 |
+
* @param $utm_term string e.g. "support"
|
136 |
*
|
137 |
+
* @return array
|
138 |
*/
|
139 |
+
private function cnb_utm_params( $utm_campaign, $utm_term ) {
|
140 |
+
return array(
|
141 |
+
'utm_source' => 'wp-plugin_' . CNB_VERSION,
|
142 |
+
'utm_medium' => 'referral',
|
143 |
+
'utm_campaign' => $utm_campaign,
|
144 |
+
'utm_term' => $utm_term
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
function get_support_url($path = '', $utm_campaign = null, $utm_term = null) {
|
149 |
+
return add_query_arg(
|
150 |
+
$this->cnb_utm_params($utm_campaign, $utm_term),
|
151 |
+
CNB_SUPPORT . $path);
|
152 |
+
}
|
153 |
+
|
154 |
+
function get_website_url($path = '', $utm_campaign = null, $utm_term = null) {
|
155 |
+
return add_query_arg(
|
156 |
+
$this->cnb_utm_params($utm_campaign, $utm_term),
|
157 |
+
CNB_WEBSITE . $path);
|
158 |
+
}
|
159 |
|
160 |
+
function get_app_url($path = '', $utm_campaign = null, $utm_term = null) {
|
161 |
+
return add_query_arg(
|
162 |
+
$this->cnb_utm_params($utm_campaign, $utm_term),
|
163 |
+
CNB_APP . $path);
|
164 |
}
|
165 |
|
166 |
function cnb_array_column( $array, $column_key, $index_key = null ) {
|
src/utils/class-cachehandler.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace cnb\cache;
|
4 |
|
5 |
use cnb\utils\CnbUtils;
|
|
|
6 |
|
7 |
class CacheHandler {
|
8 |
|
@@ -15,6 +16,7 @@ class CacheHandler {
|
|
15 |
* @return void
|
16 |
*/
|
17 |
private function excludeCloudFromWpRocket() {
|
|
|
18 |
add_filter( 'rocket_minify_excluded_external_js',
|
19 |
function ( $excluded_external_js ) {
|
20 |
$excluded_external_js[] = 'user.callnowbutton.com';
|
@@ -22,6 +24,16 @@ class CacheHandler {
|
|
22 |
return $excluded_external_js;
|
23 |
}
|
24 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
/**
|
@@ -32,9 +44,13 @@ class CacheHandler {
|
|
32 |
* @return void
|
33 |
*/
|
34 |
public function clearWpSuperCache() {
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
|
3 |
namespace cnb\cache;
|
4 |
|
5 |
use cnb\utils\CnbUtils;
|
6 |
+
use Exception;
|
7 |
|
8 |
class CacheHandler {
|
9 |
|
16 |
* @return void
|
17 |
*/
|
18 |
private function excludeCloudFromWpRocket() {
|
19 |
+
// Exclude our CDN hosted JS file(s)
|
20 |
add_filter( 'rocket_minify_excluded_external_js',
|
21 |
function ( $excluded_external_js ) {
|
22 |
$excluded_external_js[] = 'user.callnowbutton.com';
|
24 |
return $excluded_external_js;
|
25 |
}
|
26 |
);
|
27 |
+
|
28 |
+
// This removes lazyloading from our Modern renderer,
|
29 |
+
// which is incompatbile with our base64-ended background image
|
30 |
+
// See https://github.com/wp-media/wp-rocket/blob/develop/inc/Dependencies/RocketLazyload/Image.php#L379
|
31 |
+
add_filter('rocket_lazyload_excluded_attributes',
|
32 |
+
function ($excluded_attributes) {
|
33 |
+
$excluded_attributes[] = 'id="callnowbutton"';
|
34 |
+
return $excluded_attributes;
|
35 |
+
}
|
36 |
+
);
|
37 |
}
|
38 |
|
39 |
/**
|
44 |
* @return void
|
45 |
*/
|
46 |
public function clearWpSuperCache() {
|
47 |
+
try {
|
48 |
+
if ( function_exists( 'wp_cache_clean_cache' ) ) {
|
49 |
+
global $file_prefix;
|
50 |
+
wp_cache_clean_cache( $file_prefix );
|
51 |
+
}
|
52 |
+
} catch ( Exception $e ) {
|
53 |
+
// NOOP
|
54 |
}
|
55 |
}
|
56 |
|