Tawk.To Live Chat - Version 0.5.1

Version Description

  • Supported version bump 5.7.
  • Fixed undefined index issue of the enable/disable visitor recognition feature.
  • Fixed default value for enable/disable visitor recognition feature after updating plugin.

Frequently Asked Questions

Download this release

Release Info

Developer alvinsotawk
Plugin Icon 128x128 Tawk.To Live Chat
Version 0.5.1
Comparing to
See all releases

Code changes from version 0.4.1 to 0.5.1

Files changed (4) hide show
  1. readme.txt +25 -3
  2. tawkto.php +28 -13
  3. templates/settings.php +51 -30
  4. templates/widget.php +5 -5
readme.txt CHANGED
@@ -2,14 +2,16 @@
2
  Contributors: tawkto
3
  Tags: tawk,tawk.to,tawkto,chat,free chat,livechat,chat widget,plugin,chat for web,chat online,chat software,free live chat,IM Chat,,live chat,live support,live web chat,online chat,online support,snapengage,wordpress chat,wordpress live chat
4
  Requires at least: 2.7
5
- Tested up to: 5.2.2
6
- Stable tag: 0.4.1
7
 
8
  (OFFICIAL tawk.to plugin) Instantly chat with visitors on your website with the free tawk.to chat widget.
9
  Website: [http://tawk.to](http://tawk.to)
10
  == Description ==
11
 
12
- Over 2,200,000+ business users use the tawk.to FREE live chat app that lets you monitor and chat with visitors on your Wordpress site. No catch. No spam. No Ads. It's truly free and always will be.
 
 
13
 
14
  * Gain valuable insight when you monitor your website visitors in real time.
15
  * Stay connected anywhere, be in touch with your customers from your computer, or your mobile.
@@ -31,6 +33,8 @@ tawk.to is a free live chat app which integrates seamlessly with Wordpress! More
31
 
32
  This tawk.to app is completely free.
33
 
 
 
34
  = Support =
35
 
36
  tawk.to offers 24x7-365 live support, visit https://www.tawk.to and initiate a chat or send us an email at support@tawk.to.
@@ -153,6 +157,24 @@ Note: You will need a free tawk.to account : [Create one for free here!](https:/
153
  = 0.4.1 =
154
  * Fixed plugin version mismatch in readme and plugin file
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  ## Frequently Asked Questions
157
 
158
  = How much does this cost? =
2
  Contributors: tawkto
3
  Tags: tawk,tawk.to,tawkto,chat,free chat,livechat,chat widget,plugin,chat for web,chat online,chat software,free live chat,IM Chat,,live chat,live support,live web chat,online chat,online support,snapengage,wordpress chat,wordpress live chat
4
  Requires at least: 2.7
5
+ Tested up to: 5.7
6
+ Stable tag: 0.5.1
7
 
8
  (OFFICIAL tawk.to plugin) Instantly chat with visitors on your website with the free tawk.to chat widget.
9
  Website: [http://tawk.to](http://tawk.to)
10
  == Description ==
11
 
12
+ Over 3,800,000+ business users use the tawk.to FREE live chat app that lets you monitor and chat with visitors on your Wordpress site. No catch. No spam. No Ads. It's truly free and always will be.
13
+
14
+ tawk.to is the #1 most widely used chat applicationin the world.
15
 
16
  * Gain valuable insight when you monitor your website visitors in real time.
17
  * Stay connected anywhere, be in touch with your customers from your computer, or your mobile.
33
 
34
  This tawk.to app is completely free.
35
 
36
+ To learn why tawk.to is free visit [https://www.tawk.to/why-free/](https://www.tawk.to/why-free/)
37
+
38
  = Support =
39
 
40
  tawk.to offers 24x7-365 live support, visit https://www.tawk.to and initiate a chat or send us an email at support@tawk.to.
157
  = 0.4.1 =
158
  * Fixed plugin version mismatch in readme and plugin file
159
 
160
+ = 0.4.2 =
161
+ * supported version bump 5.4
162
+
163
+ = 0.4.3 =
164
+ * supported version bumbp 5.5.1
165
+
166
+ = 0.4.4 =
167
+ * supported version bump 5.6.2
168
+
169
+ = 0.5.0 =
170
+ * Added option to enable/disable visitor recognition
171
+ * Escaped widget embed URL to prevent possible XSS issues
172
+
173
+ = 0.5.1 =
174
+ * Supported version bump 5.7.
175
+ * Fixed undefined index issue of the enable/disable visitor recognition feature.
176
+ * Fixed default value for enable/disable visitor recognition feature after updating plugin.
177
+
178
  ## Frequently Asked Questions
179
 
180
  = How much does this cost? =
tawkto.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Tawk.to Live Chat
4
  Plugin URI: https://www.tawk.to
5
  Description: Embeds Tawk.to live chat widget to your site
6
- Version: 0.4.1
7
  Author: Tawkto
8
  Text Domain: tawk-to-live-chat
9
  */
@@ -31,7 +31,8 @@ if(!class_exists('TawkTo_Settings')){
31
  'display_on_shop' => 0,
32
  'display_on_productcategory' => 0,
33
  'display_on_productpage' => 0,
34
- 'display_on_producttag' => 0
 
35
  );
36
  update_option( 'tawkto-visibility-options', $visibility);
37
  }
@@ -85,13 +86,13 @@ if(!class_exists('TawkTo_Settings')){
85
 
86
  function tawk_admin_notice() {
87
 
88
- if( isset($_GET["settings-updated"]) )
89
- {
90
- ?>
91
- <div class="notice notice-warning is-dismissible">
92
- <p><?php _e( 'You might need to clear cache if your using a cache plugin to see your updates', 'tawk-to-live-chat' ); ?></p>
93
- </div>
94
- <?php
95
  }
96
  }
97
 
@@ -120,6 +121,7 @@ if(!class_exists('TawkTo_Settings')){
120
  $input['display_on_productcategory'] = ($input['display_on_productcategory'] != '1')? 0 : 1;
121
  $input['display_on_productpage'] = ($input['display_on_productpage'] != '1')? 0 : 1;
122
  $input['display_on_producttag'] = ($input['display_on_producttag'] != '1')? 0 : 1;
 
123
 
124
  return $input;
125
  }
@@ -195,7 +197,8 @@ if(!class_exists('TawkTo')){
195
  'display_on_shop' => 0,
196
  'display_on_productcategory' => 0,
197
  'display_on_productpage' => 0,
198
- 'display_on_producttag' => 0
 
199
  );
200
 
201
  add_option(TawkTo_Settings::TAWK_PAGE_ID_VARIABLE, '', '', 'yes');
@@ -225,11 +228,15 @@ if(!class_exists('TawkTo')){
225
  return NULL;
226
  }
227
 
228
- public function embed_code() {
229
  $page_id = get_option('tawkto-embed-widget-page-id');
230
  $widget_id = get_option('tawkto-embed-widget-widget-id');
231
 
232
- $customer_details = $this->getCurrentCustomerDetails();
 
 
 
 
233
 
234
  if (!empty($page_id) && !empty($widget_id)) {
235
  include(sprintf("%s/templates/widget.php", dirname(__FILE__)));
@@ -330,7 +337,15 @@ if(!class_exists('TawkTo')){
330
  }
331
 
332
  if ($display) {
333
- $this->embed_code();
 
 
 
 
 
 
 
 
334
  }
335
  }
336
 
3
  Plugin Name: Tawk.to Live Chat
4
  Plugin URI: https://www.tawk.to
5
  Description: Embeds Tawk.to live chat widget to your site
6
+ Version: 0.5.1
7
  Author: Tawkto
8
  Text Domain: tawk-to-live-chat
9
  */
31
  'display_on_shop' => 0,
32
  'display_on_productcategory' => 0,
33
  'display_on_productpage' => 0,
34
+ 'display_on_producttag' => 0,
35
+ 'enable_visitor_recognition' => 1
36
  );
37
  update_option( 'tawkto-visibility-options', $visibility);
38
  }
86
 
87
  function tawk_admin_notice() {
88
 
89
+ if( isset($_GET["settings-updated"]) )
90
+ {
91
+ ?>
92
+ <div class="notice notice-warning is-dismissible">
93
+ <p><?php _e( 'You might need to clear cache if your using a cache plugin to see your updates', 'tawk-to-live-chat' ); ?></p>
94
+ </div>
95
+ <?php
96
  }
97
  }
98
 
121
  $input['display_on_productcategory'] = ($input['display_on_productcategory'] != '1')? 0 : 1;
122
  $input['display_on_productpage'] = ($input['display_on_productpage'] != '1')? 0 : 1;
123
  $input['display_on_producttag'] = ($input['display_on_producttag'] != '1')? 0 : 1;
124
+ $input['enable_visitor_recognition'] = ($input['enable_visitor_recognition'] != '1')? 0 : 1;
125
 
126
  return $input;
127
  }
197
  'display_on_shop' => 0,
198
  'display_on_productcategory' => 0,
199
  'display_on_productpage' => 0,
200
+ 'display_on_producttag' => 0,
201
+ 'enable_visitor_recognition' => 1
202
  );
203
 
204
  add_option(TawkTo_Settings::TAWK_PAGE_ID_VARIABLE, '', '', 'yes');
228
  return NULL;
229
  }
230
 
231
+ public function embed_code($options) {
232
  $page_id = get_option('tawkto-embed-widget-page-id');
233
  $widget_id = get_option('tawkto-embed-widget-widget-id');
234
 
235
+ $enable_visitor_recognition = $options['enable_visitor_recognition'];
236
+
237
+ if ($enable_visitor_recognition) {
238
+ $customer_details = $this->getCurrentCustomerDetails();
239
+ }
240
 
241
  if (!empty($page_id) && !empty($widget_id)) {
242
  include(sprintf("%s/templates/widget.php", dirname(__FILE__)));
337
  }
338
 
339
  if ($display) {
340
+ $options = array(
341
+ 'enable_visitor_recognition' => true // default value
342
+ );
343
+
344
+ if (isset($vsibility['enable_visitor_recognition'])) {
345
+ $options['enable_visitor_recognition'] = $vsibility['enable_visitor_recognition'] == 1;
346
+ }
347
+
348
+ $this->embed_code($options);
349
  }
350
  }
351
 
templates/settings.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * @package Tawk.to Widget for Wordpress
5
  * @author Tawk.to
6
- * @copyright (C) 2014- Tawk.to
7
  * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
8
  **/
9
  if ( ! defined( 'ABSPATH' ) ) {
@@ -23,18 +23,19 @@ if ( ! defined( 'ABSPATH' ) ) {
23
  <?php submit_button(); ?>
24
  </div>
25
  <div class="tawksettingsbody">
26
- <div class="tawktabs">
27
- <button class="tawktablinks" onclick="opentab(event, 'account')" id="defaultOpen">Account Settings</button>
28
- <button class="tawktablinks" onclick="opentab(event, 'visibility')">Visibility Options</button>
29
- <?php
30
- if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
31
- {
32
- ?>
33
- <button class="tawktablinks" onclick="opentab(event, 'woocommerce')">Woocomerce Options</button>
34
- <?php } ?>
35
- </div>
 
36
 
37
- <div id="account" class="tawktabcontent" >
38
  <?php
39
  $page_id = get_option(self::TAWK_PAGE_ID_VARIABLE);
40
  $widget_id = get_option(self::TAWK_WIDGET_ID_VARIABLE);
@@ -52,18 +53,18 @@ if ( ! defined( 'ABSPATH' ) ) {
52
  }
53
  if ($display_widgetsettings == TRUE){
54
  ?>
55
- <iframe
56
- id="tawkIframe"
57
- src=""
58
- style="min-height: 295px; width : 100%; border: none; margin-top: 20px">
59
- </iframe>
60
- <script>
61
- var currentHost = window.location.protocol + "//" + window.location.host;
62
- var url = "<?php echo $iframe_url ?>&parentDomain=" + currentHost;
63
- jQuery('#tawkIframe').attr('src', url);
64
- var iframe = jQuery('#tawk_widget_customization')[0];
65
 
66
- window.addEventListener('message', function(e) {
67
  if(e.origin === '<?php echo $base_url ?>') {
68
 
69
  if(e.data.action === 'setWidget') {
@@ -100,15 +101,15 @@ if ( ! defined( 'ABSPATH' ) ) {
100
  }
101
  });
102
  }
103
- </script>
104
  <?php
105
- }else{
106
  echo "<h2>Property and widget is already set.</h2>";
107
  $tawk_admin_url = admin_url('options-general.php?page=tawkto_plugin&override=1');
108
  echo 'if you wish to reselect property or widget <a href="'.$tawk_admin_url.'">click here</a>';
109
  }
110
  ?>
111
- </div>
112
  <form method="post" action="options.php">
113
  <?php
114
  settings_fields( 'tawk_options' );
@@ -129,9 +130,14 @@ if ( ! defined( 'ABSPATH' ) ) {
129
  'display_on_shop' => 0,
130
  'display_on_productcategory' => 0,
131
  'display_on_productpage' => 0,
132
- 'display_on_producttag' => 0
 
133
  );
134
  }
 
 
 
 
135
  ?>
136
  <div id="visibility" class="tawktabcontent">
137
  <div id="tawkvisibilitysettings">
@@ -198,8 +204,8 @@ if ( ! defined( 'ABSPATH' ) ) {
198
  </label>
199
  <div id="exlucded_urls_container" style="display:none;">
200
  <textarea id="excluded_url_list" name="tawkto-visibility-options[excluded_url_list]" cols="50" rows="10"><?php echo $visibility['excluded_url_list']; ?></textarea><BR>
201
- <?php _e('Enter the url where you <b>DO NOT</b> want the widget to display.','tawk-to-live-chat'); ?><BR>
202
- <?php _e('Separate entries with comma','tawk-to-live-chat'); ?>(,).<BR>
203
  <?php _e('Add (*) at the end of the entry to match wildcard url.','tawk-to-live-chat'); ?><BR>
204
  </div>
205
  </td>
@@ -283,7 +289,22 @@ if ( ! defined( 'ABSPATH' ) ) {
283
  ?>
284
  </div>
285
 
286
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  <div class="tawkaction">
288
  <div class="tawkfootaction">
289
  <?php submit_button(); ?>
3
  /**
4
  * @package Tawk.to Widget for Wordpress
5
  * @author Tawk.to
6
+ * @copyright (C) 2014-2021 Tawk.to
7
  * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
8
  **/
9
  if ( ! defined( 'ABSPATH' ) ) {
23
  <?php submit_button(); ?>
24
  </div>
25
  <div class="tawksettingsbody">
26
+ <div class="tawktabs">
27
+ <button class="tawktablinks" onclick="opentab(event, 'account')" id="defaultOpen">Account Settings</button>
28
+ <button class="tawktablinks" onclick="opentab(event, 'visibility')">Visibility Options</button>
29
+ <button class="tawktablinks" onclick="opentab(event, 'privacy')">Privacy Options</button>
30
+ <?php
31
+ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
32
+ {
33
+ ?>
34
+ <button class="tawktablinks" onclick="opentab(event, 'woocommerce')">Woocomerce Options</button>
35
+ <?php } ?>
36
+ </div>
37
 
38
+ <div id="account" class="tawktabcontent" >
39
  <?php
40
  $page_id = get_option(self::TAWK_PAGE_ID_VARIABLE);
41
  $widget_id = get_option(self::TAWK_WIDGET_ID_VARIABLE);
53
  }
54
  if ($display_widgetsettings == TRUE){
55
  ?>
56
+ <iframe
57
+ id="tawkIframe"
58
+ src=""
59
+ style="min-height: 295px; width : 100%; border: none; margin-top: 20px">
60
+ </iframe>
61
+ <script>
62
+ var currentHost = window.location.protocol + "//" + window.location.host;
63
+ var url = "<?php echo $iframe_url ?>&parentDomain=" + currentHost;
64
+ jQuery('#tawkIframe').attr('src', url);
65
+ var iframe = jQuery('#tawk_widget_customization')[0];
66
 
67
+ window.addEventListener('message', function(e) {
68
  if(e.origin === '<?php echo $base_url ?>') {
69
 
70
  if(e.data.action === 'setWidget') {
101
  }
102
  });
103
  }
104
+ </script>
105
  <?php
106
+ }else{
107
  echo "<h2>Property and widget is already set.</h2>";
108
  $tawk_admin_url = admin_url('options-general.php?page=tawkto_plugin&override=1');
109
  echo 'if you wish to reselect property or widget <a href="'.$tawk_admin_url.'">click here</a>';
110
  }
111
  ?>
112
+ </div>
113
  <form method="post" action="options.php">
114
  <?php
115
  settings_fields( 'tawk_options' );
130
  'display_on_shop' => 0,
131
  'display_on_productcategory' => 0,
132
  'display_on_productpage' => 0,
133
+ 'display_on_producttag' => 0,
134
+ 'enable_visitor_recognition' => 1
135
  );
136
  }
137
+
138
+ if (!isset($visibility['enable_visitor_recognition'])) {
139
+ $visibility['enable_visitor_recognition'] = 1; // default value
140
+ }
141
  ?>
142
  <div id="visibility" class="tawktabcontent">
143
  <div id="tawkvisibilitysettings">
204
  </label>
205
  <div id="exlucded_urls_container" style="display:none;">
206
  <textarea id="excluded_url_list" name="tawkto-visibility-options[excluded_url_list]" cols="50" rows="10"><?php echo $visibility['excluded_url_list']; ?></textarea><BR>
207
+ <?php _e('Enter the url where you <b>DO NOT</b> want the widget to display.','tawk-to-live-chat'); ?><BR>
208
+ <?php _e('Separate entries with comma','tawk-to-live-chat'); ?>(,).<BR>
209
  <?php _e('Add (*) at the end of the entry to match wildcard url.','tawk-to-live-chat'); ?><BR>
210
  </div>
211
  </td>
289
  ?>
290
  </div>
291
 
292
+ <div id="privacy" class="tawktabcontent">
293
+ <h2><?php _e('Privacy Options','tawk-to-live-chat'); ?></h2>
294
+ <table class="form-table">
295
+ <tr valign="top">
296
+ <th class="tawksetting" scope="row">
297
+ <?php _e('Enable Visitor Recognition', 'tawk-to-live-chat'); ?>
298
+ </th>
299
+ <td>
300
+ <label class="switch">
301
+ <input type="checkbox" class="slider round" id="enable_visitor_recognition" name="tawkto-visibility-options[enable_visitor_recognition]" value="1" <?php echo checked( 1, $visibility['enable_visitor_recognition'], false ); ?> />
302
+ <div class="slider round"></div>
303
+ </label>
304
+ </td>
305
+ </tr>
306
+ </table>
307
+ </div>
308
  <div class="tawkaction">
309
  <div class="tawkfootaction">
310
  <?php submit_button(); ?>
templates/widget.php CHANGED
@@ -1,8 +1,8 @@
1
- <!--Start of Tawk.to Script (0.3.3)-->
2
  <script type="text/javascript">
3
  var Tawk_API=Tawk_API||{};
4
- <?php
5
- if(!is_null($customer_details)) {
6
  echo 'Tawk_API.visitor = '. $customer_details.';';
7
  }
8
  ?>
@@ -10,10 +10,10 @@ var Tawk_LoadStart=new Date();
10
  (function(){
11
  var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
12
  s1.async=true;
13
- s1.src='https://embed.tawk.to/<?php echo $page_id ?>/<?php echo $widget_id ?>';
14
  s1.charset='UTF-8';
15
  s1.setAttribute('crossorigin','*');
16
  s0.parentNode.insertBefore(s1,s0);
17
  })();
18
  </script>
19
- <!--End of Tawk.to Script (0.3.3)-->
1
+ <!--Start of Tawk.to Script (0.5.1)-->
2
  <script type="text/javascript">
3
  var Tawk_API=Tawk_API||{};
4
+ <?php
5
+ if(!is_null($customer_details) && $enable_visitor_recognition) {
6
  echo 'Tawk_API.visitor = '. $customer_details.';';
7
  }
8
  ?>
10
  (function(){
11
  var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
12
  s1.async=true;
13
+ s1.src='<?php echo esc_url('https://embed.tawk.to/'.$page_id.'/'.$widget_id); ?>';
14
  s1.charset='UTF-8';
15
  s1.setAttribute('crossorigin','*');
16
  s0.parentNode.insertBefore(s1,s0);
17
  })();
18
  </script>
19
+ <!--End of Tawk.to Script (0.5.1)-->