Call Now Button - Version 1.1.2

Version Description

Bugfixes

Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

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.1
7
  Author: Jerry Rietveld
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
@@ -26,7 +26,7 @@ License: GPL2
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
- define('CNB_VERSION', '1.1.1');
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.1.2
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.2');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: call button, click to call, convert, call now button, contact button
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.9
8
- Stable tag: 1.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.1 =
115
  Fix for storing profile info
116
 
5
  Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 5.9
8
+ Stable tag: 1.1.2
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.2 =
115
+ Bugfixes
116
+
117
  = 1.1.1 =
118
  Fix for storing profile info
119
 
src/admin/CnbAdminAjax.php CHANGED
@@ -5,7 +5,6 @@ namespace cnb\admin;
5
  // don't load directly
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
- use cnb\admin\action\CnbActionController;
9
  use cnb\admin\api\CnbAppRemote;
10
  use cnb\admin\api\CnbAppRemotePayment;
11
  use cnb\admin\models\CnbUser;
5
  // don't load directly
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
 
8
  use cnb\admin\api\CnbAppRemote;
9
  use cnb\admin\api\CnbAppRemotePayment;
10
  use cnb\admin\models\CnbUser;
src/admin/action/CnbActionViewEdit.php CHANGED
@@ -567,7 +567,8 @@ class CnbActionViewEdit {
567
  <tr class="cnb_hide_on_modal">
568
  <th scope="row">Show at all times</th>
569
  <td>
570
- <?php $showAlwaysValue = $action->id === 'new' || $action->schedule->showAlways; ?>
 
571
  <?php if ( $timezone_set_correctly ) { ?>
572
  <input name="actions[<?php echo esc_attr( $action->id ) ?>][schedule][showAlways]" type="hidden"
573
  value="false"/>
@@ -719,10 +720,12 @@ class CnbActionViewEdit {
719
  // phpcs:ignore
720
  ? boolval( $action->iconEnabled )
721
  : true;
722
- ?>
723
 
724
- <input type="hidden" name="bid" value="<?php echo $bid ?>"/>
725
- <input type="hidden" name="action_id" value="<?php echo $action->id ?>"/>
 
 
 
726
  <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'cnb-action-edit' ) ?>"/>
727
  <?php
728
  $this->render_table( $action, $button, $domain );
567
  <tr class="cnb_hide_on_modal">
568
  <th scope="row">Show at all times</th>
569
  <td>
570
+ <?php
571
+ $showAlwaysValue = $action->id === 'new' || (isset($action->schedule) && $action->schedule->showAlways); ?>
572
  <?php if ( $timezone_set_correctly ) { ?>
573
  <input name="actions[<?php echo esc_attr( $action->id ) ?>][schedule][showAlways]" type="hidden"
574
  value="false"/>
720
  // phpcs:ignore
721
  ? boolval( $action->iconEnabled )
722
  : true;
 
723
 
724
+ $bid = '<script>alert(1)</script>';
725
+ $action->id = '<script>alert(1)</script>';
726
+ ?>
727
+ <input type="hidden" name="bid" value="<?php echo esc_attr($bid) ?>"/>
728
+ <input type="hidden" name="action_id" value="<?php echo esc_attr($action->id) ?>"/>
729
  <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'cnb-action-edit' ) ?>"/>
730
  <?php
731
  $this->render_table( $action, $button, $domain );
src/admin/api/CnbAdminCloud.php CHANGED
@@ -466,7 +466,7 @@ class CnbAdminCloud {
466
  $cnb_options = get_option('cnb');
467
  $advanced = '';
468
  if ( isset( $cnb_options['advanced_view'] ) && $cnb_options['advanced_view'] == 1 ) {
469
- $advanced = ' at <strong>' . CnbAppRemote::cnb_get_api_base() . '</strong>';
470
  }
471
  $message = '<p>Your ' . $type . ' <strong>' . esc_html( $id ) . '</strong> has been ' . $verb . $advanced . '!</p>';
472
  $notice = new CnbNotice( 'success', $message );
466
  $cnb_options = get_option('cnb');
467
  $advanced = '';
468
  if ( isset( $cnb_options['advanced_view'] ) && $cnb_options['advanced_view'] == 1 ) {
469
+ $advanced = ' at <strong>' . esc_html(CnbAppRemote::cnb_get_api_base()) . '</strong>';
470
  }
471
  $message = '<p>Your ' . $type . ' <strong>' . esc_html( $id ) . '</strong> has been ' . $verb . $advanced . '!</p>';
472
  $notice = new CnbNotice( 'success', $message );
src/admin/button/CnbButtonViewEdit.php CHANGED
@@ -136,7 +136,7 @@ class CnbButtonViewEdit {
136
  action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
137
  <input type="hidden" name="page" value="call-now-button"/>
138
  <input type="hidden" name="action"
139
- value="<?php echo $button_id === 'new' ? 'cnb_create_' . strtolower( $button->type ) . '_button' : 'cnb_update_' . esc_attr( strtolower( $button->type ) ) . '_button' ?>"/>
140
  <input type="hidden" name="_wpnonce_button" value="<?php echo wp_create_nonce( 'cnb-button-edit' ) ?>"/>
141
  <input type="hidden" name="tab" value="<?php echo esc_attr( $this->get_active_tab_name() ) ?>"/>
142
 
136
  action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
137
  <input type="hidden" name="page" value="call-now-button"/>
138
  <input type="hidden" name="action"
139
+ value="<?php echo $button_id === 'new' ? 'cnb_create_' . esc_attr(strtolower( $button->type )) . '_button' : 'cnb_update_' . esc_attr( strtolower( $button->type ) ) . '_button' ?>"/>
140
  <input type="hidden" name="_wpnonce_button" value="<?php echo wp_create_nonce( 'cnb-button-edit' ) ?>"/>
141
  <input type="hidden" name="tab" value="<?php echo esc_attr( $this->get_active_tab_name() ) ?>"/>
142
 
src/admin/domain/CnbDomainViewUpgrade.php CHANGED
@@ -48,7 +48,7 @@ class CnbDomainViewUpgrade {
48
 
49
  return new CnbNotice( 'success', '<p>Your domain <strong>' . esc_html( $domain->name ) . '</strong> has been successfully upgraded to <strong>' . esc_html( $subscription->type ) . '</strong>!</p>' );
50
  } else {
51
- return new CnbNotice( 'warning', '<p>Something is going on upgrading domain <strong>' . esc_html( $domain->name ) . '</strong>.</p><p>Error: ' . $session->get_error_message() . '!</p>' );
52
  }
53
  }
54
 
48
 
49
  return new CnbNotice( 'success', '<p>Your domain <strong>' . esc_html( $domain->name ) . '</strong> has been successfully upgraded to <strong>' . esc_html( $subscription->type ) . '</strong>!</p>' );
50
  } else {
51
+ return new CnbNotice( 'warning', '<p>Something is going on upgrading domain <strong>' . esc_html( $domain->name ) . '</strong>.</p><p>Error: ' . esc_html($session->get_error_message()) . '!</p>' );
52
  }
53
  }
54
 
src/notices/CnbAdminNotices.php CHANGED
@@ -86,7 +86,7 @@ class CnbAdminNotices {
86
  // Check if this particular Notice has already been dismissed
87
  $option = CNB_SLUG . '_dismissed_' . $notice->dismiss_option;
88
  if ( ! $notice->dismiss_option || ! get_option( $option ) ) {
89
- echo '<div class="notice notice-' . CNB_SLUG . ' notice-' . $notice->type . $dismiss_classes . '"' . $dismiss_data_url . '>';
90
  echo $notice->message;
91
  echo '</div>';
92
  }
86
  // Check if this particular Notice has already been dismissed
87
  $option = CNB_SLUG . '_dismissed_' . $notice->dismiss_option;
88
  if ( ! $notice->dismiss_option || ! get_option( $option ) ) {
89
+ echo '<div class="notice notice-' . CNB_SLUG . ' notice-' . esc_attr($notice->type) . $dismiss_classes . '"' . $dismiss_data_url . '>';
90
  echo $notice->message;
91
  echo '</div>';
92
  }
src/renderers/classic/wp_head.php CHANGED
@@ -26,7 +26,7 @@ function cnb_head() {
26
  " height:80px; position:fixed; bottom:-20px; border-top:2px solid " .
27
  (new CnbUtils())->changeColor( esc_html( $cnb_options['color'] ), 'lighter' ) .
28
  "; background:url(data:image/svg+xml;base64," .
29
- (new CnbUtils())->svg( (new CnbUtils())->changeColor( $cnb_options['color'], 'darker' ), $cnb_options['iconcolor'] ) .
30
  ") center 2px no-repeat " .
31
  esc_html( $cnb_options['color'] ) .
32
  "; text-decoration:none; box-shadow:0 0 5px #888; z-index:" .
26
  " height:80px; position:fixed; bottom:-20px; border-top:2px solid " .
27
  (new CnbUtils())->changeColor( esc_html( $cnb_options['color'] ), 'lighter' ) .
28
  "; background:url(data:image/svg+xml;base64," .
29
+ (new CnbUtils())->svg( (new CnbUtils())->changeColor( esc_html($cnb_options['color']), 'darker' ), $cnb_options['iconcolor']) .
30
  ") center 2px no-repeat " .
31
  esc_html( $cnb_options['color'] ) .
32
  "; text-decoration:none; box-shadow:0 0 5px #888; z-index:" .
src/utils/CnbUtils.php CHANGED
@@ -83,6 +83,13 @@ class CnbUtils {
83
  return '#' . str_pad( $parts[1], 2, "0", STR_PAD_LEFT ) . str_pad( $parts[2], 2, "0", STR_PAD_LEFT ) . str_pad( $parts[3], 2, "0", STR_PAD_LEFT );
84
  }
85
 
 
 
 
 
 
 
 
86
  function svg( $color, $icon ) {
87
  $phone = '<path d="M7.104 14.032l15.586 1.984c0 0-0.019 0.5 0 0.953c0.029 0.756-0.26 1.534-0.809 2.1 l-4.74 4.742c2.361 3.3 16.5 17.4 19.8 19.8l16.813 1.141c0 0 0 0.4 0 1.1 c-0.002 0.479-0.176 0.953-0.549 1.327l-6.504 6.505c0 0-11.261 0.988-25.925-13.674C6.117 25.3 7.1 14 7.1 14" fill="' . esc_attr( $color ) . '"/><path d="M7.104 13.032l6.504-6.505c0.896-0.895 2.334-0.678 3.1 0.35l5.563 7.8 c0.738 1 0.5 2.531-0.36 3.426l-4.74 4.742c2.361 3.3 5.3 6.9 9.1 10.699c3.842 3.8 7.4 6.7 10.7 9.1 l4.74-4.742c0.897-0.895 2.471-1.026 3.498-0.289l7.646 5.455c1.025 0.7 1.3 2.2 0.4 3.105l-6.504 6.5 c0 0-11.262 0.988-25.925-13.674C6.117 24.3 7.1 13 7.1 13" fill="' . esc_attr( $icon ) . '"/>';
88
  $svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 60 60">' . $phone . '</svg>';
83
  return '#' . str_pad( $parts[1], 2, "0", STR_PAD_LEFT ) . str_pad( $parts[2], 2, "0", STR_PAD_LEFT ) . str_pad( $parts[3], 2, "0", STR_PAD_LEFT );
84
  }
85
 
86
+ /**
87
+ * Note this function escapes both inputs
88
+ * @param $color
89
+ * @param $icon
90
+ *
91
+ * @return string
92
+ */
93
  function svg( $color, $icon ) {
94
  $phone = '<path d="M7.104 14.032l15.586 1.984c0 0-0.019 0.5 0 0.953c0.029 0.756-0.26 1.534-0.809 2.1 l-4.74 4.742c2.361 3.3 16.5 17.4 19.8 19.8l16.813 1.141c0 0 0 0.4 0 1.1 c-0.002 0.479-0.176 0.953-0.549 1.327l-6.504 6.505c0 0-11.261 0.988-25.925-13.674C6.117 25.3 7.1 14 7.1 14" fill="' . esc_attr( $color ) . '"/><path d="M7.104 13.032l6.504-6.505c0.896-0.895 2.334-0.678 3.1 0.35l5.563 7.8 c0.738 1 0.5 2.531-0.36 3.426l-4.74 4.742c2.361 3.3 5.3 6.9 9.1 10.699c3.842 3.8 7.4 6.7 10.7 9.1 l4.74-4.742c0.897-0.895 2.471-1.026 3.498-0.289l7.646 5.455c1.025 0.7 1.3 2.2 0.4 3.105l-6.504 6.5 c0 0-11.262 0.988-25.925-13.674C6.117 24.3 7.1 13 7.1 13" fill="' . esc_attr( $icon ) . '"/>';
95
  $svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 60 60">' . $phone . '</svg>';