Changeset 2841634
- Timestamp:
- 12/30/2022 06:31:41 PM (3 years ago)
- Location:
- agecheckernet
- Files:
-
- 4 added
- 3 edited
-
tags/1.14.0 (added)
-
tags/1.14.0/agechecker.php (added)
-
tags/1.14.0/class-wc-integration-agechecker-integration.php (added)
-
tags/1.14.0/readme.txt (added)
-
trunk/agechecker.php (modified) (1 diff)
-
trunk/class-wc-integration-agechecker-integration.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
agecheckernet/trunk/agechecker.php
r2815496 r2841634 4 4 Plugin URI: https://agechecker.net 5 5 Description: AgeChecker.Net seamlessly and securely verifies the age of your customers directly on your website during the checkout process. Keep your site up to date on the latest age regulations for your industry while ensuring that purchasing is frustration-free for your site users. 6 Version: 1.1 3.46 Version: 1.14.0 7 7 Author: AgeChecker.Net 8 8 Author URI: https://agechecker.net -
agecheckernet/trunk/class-wc-integration-agechecker-integration.php
r2815493 r2841634 495 495 } 496 496 497 public function product_name_from_value($value, $product_categories) { 498 if (substr($value, 0, 6) == "\$_ID_=") { 499 $id = substr($value, 6, strlen($value)); 500 foreach ($product_categories as $c) { 501 if($c->term_id == $id) { 502 return $c->name; 503 } 504 } 505 } else { 506 return $value; 507 } 508 } 509 497 510 public function generate_listbox_html($key, $data) { 498 511 $field = $this->plugin_id . $this->id . '_' . $key; 499 512 $product_categories = get_terms('product_cat'); 500 501 513 502 514 $roles = array(); … … 539 551 if ($this->get_option($key) != "" && sizeof(explode(",", $this->get_option($key))) != 0) { 540 552 foreach (explode(",", $this->get_option($key)) as $c) { 541 echo '<option value="' . $c . '">' . $c . '</option>'; 553 if ($data['list'] == "categories") { 554 echo '<option value="' . $c . '">' . $this->product_name_from_value($c, $product_categories) . '</option>'; 555 } 556 else { 557 echo '<option value="' . $c . '">' . $c . '</option>'; 558 } 542 559 } 543 560 } … … 555 572 if ($data['list'] == "categories") { 556 573 foreach ($product_categories as $c) { 557 echo '<option value=" ' . $c->name. '">' . $c->name . '</option>';574 echo '<option value="$_ID_=' . $c->term_id . '">' . $c->name . '</option>'; 558 575 } 559 576 } else if($data['list'] == "roles") { … … 572 589 ?> 573 590 </select> 574 <button onclick="var exists = false; for(var i=0;i<document.getElementById('<?php echo esc_attr($field); ?>').options.length;i++) if(!document.getElementById('<?php echo $data['list']; ?>Input').value || document.getElementById('<?php echo esc_attr($field); ?>').options[i].value == document.getElementById('<?php echo $data['list']; ?>Input').value) exists = true; if(!exists) { var x = document.createElement('option'); x. text =document.getElementById('<?php echo $data['list']; ?>Input').value; document.getElementById('<?php echo esc_attr($field); ?>').add(x); } var data = ''; for(var i=0;i<document.getElementById('<?php echo esc_attr($field); ?>').options.length;i++) data += (i != 0 ? ',' : '') + document.getElementById('<?php echo esc_attr($field); ?>').options[i].value; document.getElementById('<?php echo $data['list']; ?>ListData').value = data;"591 <button onclick="var exists = false; for(var i=0;i<document.getElementById('<?php echo esc_attr($field); ?>').options.length;i++) if(!document.getElementById('<?php echo $data['list']; ?>Input').value || document.getElementById('<?php echo esc_attr($field); ?>').options[i].value == document.getElementById('<?php echo $data['list']; ?>Input').value) exists = true; if(!exists) { var x = document.createElement('option'); x.value = document.getElementById('<?php echo $data['list']; ?>Input').value; x.text = document.getElementById('<?php echo $data['list']; ?>Input').value.indexOf('$_ID_') != -1 ? document.getElementById('<?php echo $data['list']; ?>Input').options[document.getElementById('<?php echo $data['list']; ?>Input').selectedIndex].textContent : document.getElementById('<?php echo $data['list']; ?>Input').value; document.getElementById('<?php echo esc_attr($field); ?>').add(x); } var data = ''; for(var i=0;i<document.getElementById('<?php echo esc_attr($field); ?>').options.length;i++) data += (i != 0 ? ',' : '') + document.getElementById('<?php echo esc_attr($field); ?>').options[i].value; document.getElementById('<?php echo $data['list']; ?>ListData').value = data;" 575 592 class="button-secondary" type="button" 576 593 style="<?php if(array_key_exists("css", $data)) echo esc_attr($data['css']); ?>" <?php echo $this->get_custom_attribute_html($data); ?>> … … 1677 1694 $categories = explode(",", $this->excluded_categories); 1678 1695 1696 $product_categories = get_terms('product_cat'); 1697 1679 1698 if (!(sizeof($categories) == 1 && $categories[0] == "")) { 1680 1699 $cart_items = $order_items; … … 1689 1708 $noExclude = true; 1690 1709 foreach ($categories as $c) { 1691 if (has_term($c, 'product_cat', $prod_id)) { 1710 $cat = $this->product_name_from_value($c, $product_categories); 1711 if (has_term($cat, 'product_cat', $prod_id)) { 1692 1712 $noExclude = false; 1693 1713 break; … … 1705 1725 $noExclude = false; 1706 1726 foreach ($categories as $c) { 1707 if (has_term($c, 'product_cat', $prod_id)) { 1727 $cat = $this->product_name_from_value($c, $product_categories); 1728 if (has_term($cat, 'product_cat', $prod_id)) { 1708 1729 $noExclude = true; 1709 1730 break; -
agecheckernet/trunk/readme.txt
r2815496 r2841634 4 4 Requires at least: 4.4 5 5 Tested up to: 6.1 6 Stable tag: 1.1 3.46 Stable tag: 1.14.0 7 7 8 8 AgeChecker.Net seamlessly and securely verifies the age of your customers directly on your website during the checkout process. … … 63 63 == Changelog == 64 64 65 = 1.14.0 = 66 *Release Date - 30 December 2022* 67 68 * Updates how product categories are stored internally in the "Exclude/Include Categories" section. Although the old internal format is backwards compatible with this version, it is recommended to do the following so the categories are stored in the new format: 69 70 1. Take a screenshot or write down every product category you have added to "Exclude/Include Categories" 71 2. Remove all categories from the "Exclude/Include Categories" list 72 3. Add back the categories 73 4. Save settings 74 65 75 = 1.13.4 = 66 76 *Release Date - 9 November 2022*
Note: See TracChangeset
for help on using the changeset viewer.