Tawk.To Live Chat - Version 0.5.2

Version Description

  • Fixed checking of $customer_details variable.
  • Fixed undefined index issues on validating visibility options.
Download this release

Release Info

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

Code changes from version 0.5.1 to 0.5.2

Files changed (3) hide show
  1. readme.txt +86 -82
  2. tawkto.php +44 -15
  3. templates/widget.php +3 -3
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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)
@@ -55,125 +55,129 @@ Note: You will need a free tawk.to account : [Create one for free here!](https:/
55
 
56
  == Changelog ==
57
 
58
- = 0.1.0 =
59
- * Add the tawk.to live chat widget to your site!
 
60
 
61
- = 0.1.1 =
62
- * No more manual embed code copying, choose desired widget and it will be inserted in your site
 
 
63
 
64
- = 0.1.2 =
65
- * Supported version bump
 
66
 
67
- = 0.1.3 =
68
- * Supported version bump
69
 
70
- = 0.1.4 =
71
- * Supported version bump
72
 
73
- = 0.1.5 =
74
- * Implemented visibility options, you can now choose to Always show the script, show it only on the front page, only on category pages or only on pages tagged with a shortcode.
75
 
76
- = 0.1.6 =
77
- * Modified visibility options to fix a bug, and implemented a better shortcode.
78
 
79
- = 0.1.7 =
80
- * Fixed naming convention causing a conflict with another plugin
81
 
82
- = 0.1.8 =
83
- * Fixed bug causing conflict with another plugin, and tested on 4.5
84
 
85
- = 0.1.9 =
86
- * Added the ability to exclude a specific url slug
87
 
88
- = 0.2.0 =
89
- * Added multisite support *
90
 
91
- = 0.2.1 =
92
- * Supported version bump
93
 
94
- = 0.2.2 =
95
- * Supported version bump to 4.7
96
 
97
- = 0.2.3 =
98
- * Updating widget code due to known conflict
 
 
99
 
100
- = 0.2.4 =
101
- * updated session handling
102
- * Added the ability to include a specific url slug
103
- * modified plugin settings page interface
104
 
105
- = 0.2.5 =
106
- * Fixed include url warning message thrown
 
 
107
 
108
- = 0.2.6 =
109
- * wrapped all hard-coded text in plugin settings with gettext functions
110
 
111
- = 0.2.7 =
112
- * added woocommerce support
 
 
 
113
 
114
  = 0.2.8 =
115
  * added updated plugin admin interface
116
 
117
- = 0.2.9 =
118
- * fixed issue with assets folder
119
 
120
- = 0.3.0 =
121
- * fixed issues with visibility filters
122
 
123
- = 0.3.0 =
124
- * fixed issues with visibility filters
125
 
126
- = 0.3.1 =
127
- * plugin notifications update
128
- * logged in user recognition
129
- If user is logged in, the widget will fill the pre-chat form automatically
130
 
131
- = 0.3.2 =
132
- * fixed issues on widget settings on fresh install
133
 
134
- = 0.3.3 =
135
- * fixed user recognition vulnerability
136
- * updated admin page texts
137
- * moved wp_footer hook to last item
138
 
139
- = 0.3.4 =
140
- * supported version bump
141
 
142
- = 0.3.5 =
143
- * supported version bump
144
 
145
- = 0.3.6 =
146
- * supported version bump 5.1
147
 
148
- = 0.3.7 =
149
- * supported version bump 5.2.1
150
 
151
- = 0.3.8 =
152
- * supported version bump 5.2.2
153
 
154
- = 0.4.0 =
155
- * Added support for wildcard url match for include URL and exclude URL
156
 
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
 
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.2
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)
55
 
56
  == Changelog ==
57
 
58
+ = 0.5.2 =
59
+ * Fixed checking of $customer_details variable.
60
+ * Fixed undefined index issues on validating visibility options.
61
 
62
+ = 0.5.1 =
63
+ * Supported version bump 5.7.
64
+ * Fixed undefined index issue of the enable/disable visitor recognition feature.
65
+ * Fixed default value for enable/disable visitor recognition feature after updating plugin.
66
 
67
+ = 0.5.0 =
68
+ * Added option to enable/disable visitor recognition
69
+ * Escaped widget embed URL to prevent possible XSS issues
70
 
71
+ = 0.4.4 =
72
+ * supported version bump 5.6.2
73
 
74
+ = 0.4.3 =
75
+ * supported version bumbp 5.5.1
76
 
77
+ = 0.4.2 =
78
+ * supported version bump 5.4
79
 
80
+ = 0.4.1 =
81
+ * Fixed plugin version mismatch in readme and plugin file
82
 
83
+ = 0.4.0 =
84
+ * Added support for wildcard url match for include URL and exclude URL
85
 
86
+ = 0.3.8 =
87
+ * supported version bump 5.2.2
88
 
89
+ = 0.3.7 =
90
+ * supported version bump 5.2.1
91
 
92
+ = 0.3.6 =
93
+ * supported version bump 5.1
94
 
95
+ = 0.3.5 =
96
+ * supported version bump
97
 
98
+ = 0.3.4 =
99
+ * supported version bump
100
 
101
+ = 0.3.3 =
102
+ * fixed user recognition vulnerability
103
+ * updated admin page texts
104
+ * moved wp_footer hook to last item
105
 
106
+ = 0.3.2 =
107
+ * fixed issues on widget settings on fresh install
 
 
108
 
109
+ = 0.3.1 =
110
+ * plugin notifications update
111
+ * logged in user recognition
112
+ If user is logged in, the widget will fill the pre-chat form automatically
113
 
114
+ = 0.3.0 =
115
+ * fixed issues with visibility filters
116
 
117
+ = 0.3.0 =
118
+ * fixed issues with visibility filters
119
+
120
+ = 0.2.9 =
121
+ * fixed issue with assets folder
122
 
123
  = 0.2.8 =
124
  * added updated plugin admin interface
125
 
126
+ = 0.2.7 =
127
+ * added woocommerce support
128
 
129
+ = 0.2.6 =
130
+ * wrapped all hard-coded text in plugin settings with gettext functions
131
 
132
+ = 0.2.5 =
133
+ * Fixed include url warning message thrown
134
 
135
+ = 0.2.4 =
136
+ * updated session handling
137
+ * Added the ability to include a specific url slug
138
+ * modified plugin settings page interface
139
 
140
+ = 0.2.3 =
141
+ * Updating widget code due to known conflict
142
 
143
+ = 0.2.2 =
144
+ * Supported version bump to 4.7
 
 
145
 
146
+ = 0.2.1 =
147
+ * Supported version bump
148
 
149
+ = 0.2.0 =
150
+ * Added multisite support *
151
 
152
+ = 0.1.9 =
153
+ * Added the ability to exclude a specific url slug
154
 
155
+ = 0.1.8 =
156
+ * Fixed bug causing conflict with another plugin, and tested on 4.5
157
 
158
+ = 0.1.7 =
159
+ * Fixed naming convention causing a conflict with another plugin
160
 
161
+ = 0.1.6 =
162
+ * Modified visibility options to fix a bug, and implemented a better shortcode.
163
 
164
+ = 0.1.0 =
165
+ * Add the tawk.to live chat widget to your site!
166
 
167
+ = 0.1.5 =
168
+ * Implemented visibility options, you can now choose to Always show the script, show it only on the front page, only on category pages or only on pages tagged with a shortcode.
169
 
170
+ = 0.1.4 =
171
+ * Supported version bump
172
 
173
+ = 0.1.3 =
174
+ * Supported version bump
175
 
176
+ = 0.1.2 =
177
+ * Supported version bump
 
178
 
179
+ = 0.1.1 =
180
+ * No more manual embed code copying, choose desired widget and it will be inserted in your site
 
 
181
 
182
  ## Frequently Asked Questions
183
 
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.5.1
7
  Author: Tawkto
8
  Text Domain: tawk-to-live-chat
9
  */
@@ -107,21 +107,24 @@ if(!class_exists('TawkTo_Settings')){
107
  }
108
 
109
  public function validate_options($input){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
- $input['always_display'] = ($input['always_display'] != '1')? 0 : 1;
112
- $input['show_onfrontpage'] = ($input['show_onfrontpage'] != '1')? 0 : 1;
113
- $input['show_oncategory'] = ($input['show_oncategory'] != '1')? 0 : 1;
114
- $input['show_ontagpage'] = ($input['show_ontagpage'] != '1')? 0 : 1;
115
- $input['show_onarticlepages'] = ($input['show_onarticlepages'] != '1')? 0 : 1;
116
- $input['exclude_url'] = ($input['exclude_url'] != '1')? 0 : 1;
117
- $input['excluded_url_list'] = sanitize_text_field($input['excluded_url_list']);
118
- $input['include_url'] = ($input['include_url'] != '1')? 0 : 1;
119
- $input['included_url_list'] = sanitize_text_field($input['included_url_list']);
120
- $input['display_on_shop'] = ($input['display_on_shop'] != '1')? 0 : 1;
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
  }
@@ -171,6 +174,32 @@ if(!class_exists('TawkTo_Settings')){
171
  public static function ids_are_correct($page_id, $widget_id) {
172
  return preg_match('/^[0-9A-Fa-f]{24}$/', $page_id) === 1 && preg_match('/^[a-z0-9]{1,50}$/i', $widget_id) === 1;
173
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
  }
176
 
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.2
7
  Author: Tawkto
8
  Text Domain: tawk-to-live-chat
9
  */
107
  }
108
 
109
  public function validate_options($input){
110
+ $visibility_toggle_fields = array(
111
+ 'always_display',
112
+ 'show_onfrontpage',
113
+ 'show_oncategory',
114
+ 'show_ontagpage',
115
+ 'show_onarticlepages',
116
+ 'exclude_url',
117
+ 'include_url',
118
+ 'display_on_shop',
119
+ 'display_on_productcategory',
120
+ 'display_on_productpage',
121
+ 'display_on_producttag',
122
+ 'enable_visitor_recognition'
123
+ );
124
+ $visibility_text_fields = array('excluded_url_list', 'included_url_list');
125
 
126
+ self::validate_visibility_toggle_fields($input, $visibility_toggle_fields);
127
+ self::validate_text_fields($input, $visibility_text_fields);
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
  return $input;
130
  }
174
  public static function ids_are_correct($page_id, $widget_id) {
175
  return preg_match('/^[0-9A-Fa-f]{24}$/', $page_id) === 1 && preg_match('/^[a-z0-9]{1,50}$/i', $widget_id) === 1;
176
  }
177
+
178
+ private static function validate_text_fields(&$fields, $field_names) {
179
+ foreach ($field_names as $field_name) {
180
+ if (isset($fields[$field_name])) {
181
+ $fields[$field_name] = sanitize_text_field($fields[$field_name]);
182
+ continue;
183
+ }
184
+
185
+ $fields[$field_name] = '';
186
+ }
187
+
188
+ return;
189
+ }
190
+
191
+ private static function validate_visibility_toggle_fields(&$fields, $field_names) {
192
+ foreach ($field_names as $field_name) {
193
+ if (isset($fields[$field_name]) && $fields[$field_name] == '1') {
194
+ $fields[$field_name] = 1;
195
+ continue;
196
+ }
197
+
198
+ $fields[$field_name] = 0;
199
+ }
200
+
201
+ return;
202
+ }
203
  }
204
  }
205
 
templates/widget.php CHANGED
@@ -1,8 +1,8 @@
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
  ?>
@@ -16,4 +16,4 @@ s1.setAttribute('crossorigin','*');
16
  s0.parentNode.insertBefore(s1,s0);
17
  })();
18
  </script>
19
- <!--End of Tawk.to Script (0.5.1)-->
1
+ <!--Start of Tawk.to Script (0.5.2)-->
2
  <script type="text/javascript">
3
  var Tawk_API=Tawk_API||{};
4
  <?php
5
+ if(isset($customer_details) && $enable_visitor_recognition) {
6
  echo 'Tawk_API.visitor = '. $customer_details.';';
7
  }
8
  ?>
16
  s0.parentNode.insertBefore(s1,s0);
17
  })();
18
  </script>
19
+ <!--End of Tawk.to Script (0.5.2)-->