Changeset 2142981
- Timestamp:
- 08/21/2019 08:37:10 AM (7 years ago)
- Location:
- tawkto-live-chat/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (3 diffs)
-
tawkto.php (modified) (5 diffs)
-
templates/settings.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tawkto-live-chat/trunk/readme.txt
r2111964 r2142981 4 4 Requires at least: 2.7 5 5 Tested up to: 5.2.2 6 Stable tag: 0. 3.86 Stable tag: 0.4.0 7 7 8 8 (OFFICIAL tawk.to plugin) Instantly chat with visitors on your website with the free tawk.to chat widget. … … 99 99 * modified plugin settings page interface 100 100 101 = 0.2.5 = 101 = 0.2.5 = 102 102 * Fixed include url warning message thrown 103 103 104 = 0.2.6 = 104 = 0.2.6 = 105 105 * wrapped all hard-coded text in plugin settings with gettext functions 106 106 107 = 0.2.7 = 107 = 0.2.7 = 108 108 * added woocommerce support 109 109 110 = 0.2.8 = 111 * added updated plugin admin interface 110 = 0.2.8 = 111 * added updated plugin admin interface 112 112 113 = 0.2.9 = 114 * fixed issue with assets folder 113 = 0.2.9 = 114 * fixed issue with assets folder 115 115 116 = 0.3.0 = 116 = 0.3.0 = 117 117 * fixed issues with visibility filters 118 118 119 = 0.3.0 = 119 = 0.3.0 = 120 120 * fixed issues with visibility filters 121 121 122 = 0.3.1 = 122 = 0.3.1 = 123 123 * plugin notifications update 124 124 * logged in user recognition 125 125 If user is logged in, the widget will fill the pre-chat form automatically 126 127 = 0.3.2 = 126 127 = 0.3.2 = 128 128 * fixed issues on widget settings on fresh install 129 129 130 = 0.3.3 = 130 = 0.3.3 = 131 131 * fixed user recognition vulnerability 132 132 * updated admin page texts … … 148 148 * supported version bump 5.2.2 149 149 150 ## Frequently Asked Questions 150 = 0.4.0 = 151 * Added support for wildcard url match for include URL and exclude URL 152 153 ## Frequently Asked Questions 151 154 152 155 = How much does this cost? = -
tawkto-live-chat/trunk/tawkto.php
r2111964 r2142981 56 56 57 57 wp_enqueue_script( 'tawk_admin_script', plugins_url( 'assets/tawk.admin.js' , __FILE__ ) ); 58 58 59 59 } 60 60 … … 79 79 update_option(self::TAWK_WIDGET_ID_VARIABLE, $_POST['widgetId']); 80 80 81 81 82 82 echo json_encode(array('success' => TRUE)); 83 83 die(); … … 86 86 function tawk_admin_notice() { 87 87 88 if( isset($_GET["settings-updated"]) ) 88 if( isset($_GET["settings-updated"]) ) 89 89 { 90 90 ?> … … 139 139 .form-table th.tawksetting { 140 140 width: 350px; 141 } 141 } 142 142 .tawknotice{ 143 143 font-size:14px; … … 226 226 } 227 227 228 public function embed_code() 229 { 228 public function embed_code() { 230 229 $page_id = get_option('tawkto-embed-widget-page-id'); 231 230 $widget_id = get_option('tawkto-embed-widget-widget-id'); 232 231 233 $customer_details = $this->getCurrentCustomerDetails(); 234 235 if(!empty($page_id) && !empty($widget_id)) 236 { 232 $customer_details = $this->getCurrentCustomerDetails(); 233 234 if (!empty($page_id) && !empty($widget_id)) { 237 235 include(sprintf("%s/templates/widget.php", dirname(__FILE__))); 238 236 } 239 237 } 240 238 241 public function print_embed_code() 242 { 243 $vsibility = get_option( 'tawkto-visibility-options' ); 244 245 $display = FALSE; 246 247 if(($vsibility['show_onfrontpage'] == 1) && (is_home() || is_front_page()) ){ $display = TRUE; } 248 if(($vsibility['show_oncategory'] == 1) && is_category() ){ $display = TRUE; } 249 if(($vsibility['show_ontagpage'] == 1) && is_tag() ){ $display = TRUE; } 250 if($vsibility['always_display'] == 1){ $display = TRUE; } 251 if(($vsibility['show_onarticlepages'] == 1) && is_single() ){ $display = TRUE; } 252 253 if(($vsibility['exclude_url'] == 1)){ 239 private function get_current_url() { 240 $current_url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 241 $current_url = urldecode($current_url); 242 243 $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; 244 245 return strtolower($protocol . $current_url); 246 } 247 248 private function match_url($url, $url_pattern) { 249 // do partial match if wildcard character matched at the end pattern 250 if (substr($url_pattern, -1) === '*') { 251 $url_pattern = substr($url_pattern, 0, -1); 252 253 return (strpos($url, $url_pattern) === 0); 254 } 255 256 // do extact match if wildcard character not matched at the end pattern 257 return (strcmp($url, $url_pattern) === 0); 258 } 259 260 public function print_embed_code() { 261 $vsibility = get_option('tawkto-visibility-options'); 262 $display = false; 263 264 if ($vsibility['always_display'] == 1) { 265 $display = true; 266 } 267 268 if (($vsibility['show_onfrontpage'] == 1) && (is_home() || is_front_page())) { 269 $display = true; 270 } 271 272 if (($vsibility['show_oncategory'] == 1) && is_category()) { 273 $display = true; 274 } 275 276 if (($vsibility['show_ontagpage'] == 1) && is_tag()) { 277 $display = true; 278 } 279 280 if (($vsibility['show_onarticlepages'] == 1) && is_single()) { 281 $display = true; 282 } 283 284 if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { 285 if (($vsibility['display_on_shop'] == 1) && is_shop()) { 286 $display = true; 287 } 288 289 if (($vsibility['display_on_productcategory'] == 1) && is_product_category()) { 290 $display = true; 291 } 292 293 if (($vsibility['display_on_productpage'] == 1) && is_product()) { 294 $display = true; 295 } 296 297 if (($vsibility['display_on_producttag'] == 1) && is_product_tag()) { 298 $display = true; 299 } 300 } 301 302 if (isset($vsibility['include_url']) && $vsibility['include_url'] == 1) { 303 $current_url = $this->get_current_url(); 304 305 $included_url_list = $vsibility['included_url_list']; 306 $included_url_list = preg_split("/,/", $included_url_list); 307 308 foreach ($included_url_list as $include_url) { 309 $include_url = strtolower(urldecode(trim($include_url))); 310 311 if (!empty($include_url) && $this->match_url($current_url, $include_url)) { 312 $display = true; 313 } 314 } 315 } 316 317 if (isset($vsibility['exclude_url']) && ($vsibility['exclude_url'] == 1)) { 318 $current_url = $this->get_current_url(); 319 254 320 $excluded_url_list = $vsibility['excluded_url_list']; 255 256 $current_url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];257 $current_url = urldecode($current_url);258 259 $ssl = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' );260 $sp = strtolower( $_SERVER['SERVER_PROTOCOL'] );261 $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );262 263 $current_url = $protocol.'://'.$current_url;264 $current_url = strtolower($current_url);265 266 321 $excluded_url_list = preg_split("/,/", $excluded_url_list); 267 foreach($excluded_url_list as $exclude_url) 268 {322 323 foreach ($excluded_url_list as $exclude_url) { 269 324 $exclude_url = strtolower(urldecode(trim($exclude_url))); 270 if(!empty($exclude_url)) 271 { 272 if (strpos($current_url, $exclude_url) !== false) 273 { 274 if(strcmp($current_url, $exclude_url) === 0) 275 { 276 $display = false; 277 } 278 } 325 326 if (!empty($exclude_url) && $this->match_url($current_url, $exclude_url)) { 327 $display = false; 279 328 } 280 329 } 281 330 } 282 331 283 if(isset($vsibility['include_url']) && $vsibility['include_url'] == 1){ 284 $included_url_list = $vsibility['included_url_list']; 285 $current_url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; 286 $current_url = urldecode($current_url); 287 288 $ssl = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ); 289 $sp = strtolower( $_SERVER['SERVER_PROTOCOL'] ); 290 $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' ); 291 292 $current_url = $protocol.'://'.$current_url; 293 $current_url = strtolower($current_url); 294 295 $included_url_list = preg_split("/,/", $included_url_list); 296 foreach($included_url_list as $include_url) 297 { 298 $include_url = strtolower(urldecode(trim($include_url))); 299 if(!empty($include_url)) 300 { 301 if (strpos($current_url, $include_url) !== false) 302 { 303 if(strcmp($current_url, $include_url) === 0) 304 { 305 $display = TRUE; 306 } 307 } 308 } 309 } 310 } 311 312 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) 313 { 314 if(($vsibility['display_on_shop'] == 1) && is_shop() ){ $display = TRUE; } 315 if(($vsibility['display_on_productcategory'] == 1) && is_product_category() ){ $display = TRUE; } 316 if(($vsibility['display_on_productpage'] == 1) && is_product() ){ $display = TRUE; } 317 if(($vsibility['display_on_producttag'] == 1) && is_product_tag() ){ $display = TRUE; } 318 } 319 320 if($display == TRUE) 321 { 332 if ($display) { 322 333 $this->embed_code(); 323 334 } -
tawkto-live-chat/trunk/templates/settings.php
r1700707 r2142981 7 7 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html 8 8 **/ 9 if ( ! defined( 'ABSPATH' ) ) { 9 if ( ! defined( 'ABSPATH' ) ) { 10 10 exit; // Exit if accessed directly 11 11 } … … 27 27 <button class="tawktablinks" onclick="opentab(event, 'account')" id="defaultOpen">Account Settings</button> 28 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' ) ) ) ) 29 <?php 30 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) 31 31 { 32 32 ?> … … 36 36 37 37 <div id="account" class="tawktabcontent" > 38 <?php 38 <?php 39 39 $page_id = get_option(self::TAWK_PAGE_ID_VARIABLE); 40 40 $widget_id = get_option(self::TAWK_WIDGET_ID_VARIABLE); … … 49 49 } 50 50 if($override == TRUE){ 51 $display_widgetsettings = true; 51 $display_widgetsettings = true; 52 52 } 53 53 if ($display_widgetsettings == TRUE){ … … 83 83 widgetId : e.data.widgetId 84 84 }, function(r) { 85 if(r.success) { 85 if(r.success) { 86 86 e.source.postMessage({action: 'setDone'}, '<?php echo $base_url ?>'); 87 87 } else { … … 141 141 <BR> 142 142 <?php _e('on any page independent of these visibility options by simply using the <b>[tawkto]</b> shortcode in','tawk-to-live-chat'); ?> 143 <BR> 143 <BR> 144 144 <?php _e('the post or page.','tawk-to-live-chat'); ?> 145 145 </p> … … 199 199 <div id="exlucded_urls_container" style="display:none;"> 200 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'); ?> 202 <BR> 201 <?php _e('Enter the url where you <b>DO NOT</b> want the widget to display.','tawk-to-live-chat'); ?><BR> 203 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 204 </div> 205 205 </td> … … 216 216 <?php _e('Enter the url where you <b>WANT</b> the widget to display.','tawk-to-live-chat'); ?><BR> 217 217 <?php _e('Separate entries with comma ','tawk-to-live-chat'); ?>(,).<BR> 218 <?php _e('Add (*) at the end of the entry to match wildcard url.','tawk-to-live-chat'); ?><BR> 218 219 </div> 219 220 </td> … … 224 225 225 226 <div id="woocommerce" class="tawktabcontent"> 226 <?php 227 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) 227 <?php 228 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) 228 229 { 229 230
Note: See TracChangeset
for help on using the changeset viewer.