Changeset 2742872
- Timestamp:
- 06/15/2022 12:22:12 PM (4 years ago)
- Location:
- wupo-group-attributes/trunk
- Files:
-
- 7 edited
-
CHANGELOG.txt (modified) (1 diff)
-
README.txt (modified) (1 diff)
-
admin/class-wugrat-admin-attributes-in-group.php (modified) (5 diffs)
-
admin/class-wugrat-admin.php (modified) (6 diffs)
-
includes/class-wugrat-activator.php (modified) (1 diff)
-
public/class-wugrat-public.php (modified) (1 diff)
-
wupo-group-attributes.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wupo-group-attributes/trunk/CHANGELOG.txt
r2715389 r2742872 1 ## [2.2.0] - 2022-06-15 2 ### Added 3 - Compatibility with WooCommerce 6.6.x and WordPress 6.0.x 4 1 5 ## [2.1.0] - 2022-04-27 2 6 ### Added -
wupo-group-attributes/trunk/README.txt
r2715389 r2742872 1 1 === WUPO Group Attributes for WooCommerce === 2 Contributors: wupo 2 Contributors: wupo, freemius 3 3 Tags: group, attributes, set, attribute, organize, woocommerce, wupo 4 4 Requires at least: 5.0 5 Tested up to: 5.96 Stable tag: 2. 1.05 Tested up to: 6.0 6 Stable tag: 2.2.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
wupo-group-attributes/trunk/admin/class-wugrat-admin-attributes-in-group.php
r2390309 r2742872 48 48 $term_id = isset( $_GET['term_id'] ) && (int) $_GET['term_id'] ? (int) $_GET['term_id'] : null; 49 49 50 $wpdb->get_results("UPDATE {$wpdb->prefix}term_taxonomy SET children = CONCAT(COALESCE(children,''), 'pa_{$attribute_name},') WHERE term_id = {$term_id}"); 50 $query = $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET children = CONCAT(COALESCE(children,''), %s) WHERE term_id = %d", array("pa_".$attribute_name.",", $term_id)); 51 $wpdb->get_results($query); 51 52 52 53 return true; … … 65 66 check_admin_referer( 'woocommerce-delete-attribute_' . $attribute_name ); 66 67 67 $wpdb->get_results("UPDATE {$wpdb->prefix}term_taxonomy SET children = REPLACE(children, 'pa_{$attribute_name},', '') WHERE term_id = {$term_id};"); 68 69 return true; 68 $query = $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET children = REPLACE(children, %s, '') WHERE term_id = %d", array("pa_".$attribute_name.",", $term_id)); 69 $wpdb->get_results($query); 70 71 return true; 70 72 } 71 73 … … 104 106 105 107 //TODO: Refactor to method 106 $results = $wpdb->get_results("SELECT children FROM {$wpdb->prefix}term_taxonomy WHERE term_id={$term_id}"); 108 $query = $wpdb->prepare("SELECT children FROM $wpdb->term_taxonomy WHERE term_id=%d", array($term_id)); 109 $results = $wpdb->get_results($query); 110 107 111 $attribute_children = explode(',', $results[0]->children); 108 112 109 113 $attribute_taxonomies = array(); 110 114 foreach ($attribute_children as $attribute_child) { 111 $results = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name='".substr($attribute_child, 3)."'"); 115 $query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name=%s", array(substr($attribute_child, 3))); 116 $results = $wpdb->get_results($query); 112 117 113 118 if (!empty($results)) { … … 170 175 </td> 171 176 <td class="handle column-handle ui-sortable-handle" data-colname style="display: table-cell;"> 172 <input type="hidden" name="attribute_name" value="<?php echo $tax->attribute_name; ?>" />177 <input type="hidden" name="attribute_name" value="<?php echo esc_attr($tax->attribute_name); ?>" /> 173 178 </td> 174 179 </tr> … … 219 224 // Get already existing attributes in the group 220 225 $term_id = isset( $_GET['term_id'] ) && (int) $_GET['term_id'] ? (int) $_GET['term_id'] : null; 221 $results = $wpdb->get_results("SELECT children FROM {$wpdb->prefix}term_taxonomy WHERE term_id={$term_id}"); 226 227 $query = $wpdb->prepare("SELECT children FROM $wpdb->term_taxonomy WHERE term_id=%d", array($term_id)); 228 $results = $wpdb->get_results($query); 222 229 $group_children = explode(',', $results[0]->children, -1); 223 230 -
wupo-group-attributes/trunk/admin/class-wugrat-admin.php
r2674325 r2742872 395 395 if ( 'attributes' === $column_name ) { 396 396 //TODO: Refactor to method 397 $results = $wpdb->get_results( "SELECT children FROM {$wpdb->prefix}term_taxonomy WHERE term_id={$term_id}" ); 397 $query = $wpdb->prepare( "SELECT children FROM {$wpdb->term_taxonomy} WHERE term_id=%d", array( $term_id ) ); 398 $results = $wpdb->get_results( $query ); 398 399 $attribute_children = explode( ',', $results[0]->children, -1 ); 399 400 $attribute_taxonomies = array(); 400 401 foreach ( $attribute_children as $attribute_child ) { 401 $results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name='" . substr( $attribute_child, 3 ) . "'" ); 402 $query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name=%s", array( substr( $attribute_child, 3 ) ) ); 403 $results = $wpdb->get_results( $query ); 402 404 if ( !empty($results) ) { 403 405 $attribute_taxonomies[] = $results[0]->attribute_label; … … 508 510 global $wpdb ; 509 511 $new_attribute_name = $attribute['attribute_name']; 510 $wpdb->get_results( "UPDATE {$wpdb->prefix}term_taxonomy SET children = REPLACE(children, '{$old_attribute_name}', '{$new_attribute_name}') WHERE taxonomy = '{$this->taxonomy_group}';" ); 512 $query = $wpdb->prepare( "UPDATE {$wpdb->term_taxonomy} SET children = REPLACE(children, %s, %s) WHERE taxonomy = %s", array( $old_attribute_name, $new_attribute_name, $this->taxonomy_group ) ); 513 $wpdb->get_results( $query ); 511 514 } 512 515 … … 591 594 jQuery(document).ready(function ($) { 592 595 $("div[data-taxonomy='<?php 593 echo $attribute_name;596 echo esc_attr( $attribute_name ) ; 594 597 ?>'] strong.attribute_name").html(function (i, val) { 595 598 return '<?php 596 echo "{$attribute_label} {$attribute_name_in_brackets}";599 echo esc_attr( "{$attribute_label} {$attribute_name_in_brackets}" ) ; 597 600 ?>'; 598 601 }); … … 620 623 $i = absint( $_POST['i'] ); 621 624 //TODO: Refactor to method 622 $results = $wpdb->get_results( "SELECT children FROM {$wpdb->prefix}term_taxonomy WHERE term_id = '" . $group_term_id . "'" ); 625 $query = $wpdb->prepare( "SELECT children FROM {$wpdb->term_taxonomy} WHERE term_id=%d", array( $group_term_id ) ); 626 $results = $wpdb->get_results( $query ); 623 627 $attributes_of_group = explode( ',', $results[0]->children, -1 ); 624 628 wupo_log( 'attributes of group', $attributes_of_group ); … … 696 700 } 697 701 //TODO: refactor to method 698 $results = $wpdb->get_results( "SELECT children FROM {$wpdb->prefix}term_taxonomy WHERE term_id = {$group_term_id}" ); 702 $query = $wpdb->prepare( "SELECT children FROM {$wpdb->term_taxonomy} WHERE term_id=%d", array( $group_term_id ) ); 703 $results = $wpdb->get_results( $query ); 699 704 $attributes_in_group = $results[0]->children; 700 705 $attributes_in_group = str_replace( $attribute_name . ',', '', $attributes_in_group ); … … 714 719 } 715 720 716 $results = $wpdb->get_results( "UPDATE {$wpdb->prefix}term_taxonomy SET children = '{$attributes_in_group}' WHERE term_id = {$group_term_id}" ); 721 $query = $wpdb->prepare( "UPDATE {$wpdb->term_taxonomy} SET children = %s WHERE term_id = %d", array( $attributes_in_group, $group_term_id ) ); 722 $wpdb->get_results( $query ); 717 723 } 718 724 -
wupo-group-attributes/trunk/includes/class-wugrat-activator.php
r2674325 r2742872 23 23 global $wpdb; 24 24 25 $result = $wpdb->get_var("SHOW COLUMNS FROM {$wpdb->prefix}term_taxonomy LIKE 'children';");25 $result = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->term_taxonomy LIKE 'children';"); 26 26 27 27 if (empty($result)) { 28 $wpdb->query("ALTER TABLE {$wpdb->prefix}term_taxonomy ADD COLUMN children VARCHAR(10000) NULL");28 $wpdb->query("ALTER TABLE $wpdb->term_taxonomy ADD COLUMN children VARCHAR(10000) NULL"); 29 29 } 30 30 } -
wupo-group-attributes/trunk/public/class-wugrat-public.php
r2390309 r2742872 82 82 if (!empty($attributes_name)) { 83 83 //TODO: refactor to method 84 $attribute_groups = $wpdb->get_results("SELECT term_id, children FROM {$wpdb->prefix}term_taxonomy WHERE taxonomy = '{$this->taxonomy_group}' AND children rlike '{$attributes_name}'"); 84 $query = $wpdb->prepare("SELECT term_id, children FROM $wpdb->term_taxonomy WHERE taxonomy = %s AND children rlike %s", array($this->taxonomy_group, $attributes_name)); 85 $attribute_groups = $wpdb->get_results($query); 85 86 86 87 $this->option_group_order = explode(',', get_option($this->option_key_group_order), -1); -
wupo-group-attributes/trunk/wupo-group-attributes.php
r2715389 r2742872 10 10 * Plugin URI: https://wupoplugins.com/group-attributes-woocommerce/ 11 11 * Description: Organize product attributes into groups. These will be shown in separate sections on your product pages. Increase readability for your product properties. The plugin works with your existing products and attributes. No need to adapt your products in the backend. 12 * Version: 2. 1.012 * Version: 2.2.0 13 13 * Author: WUPO Plugins 14 14 * Author URI: https://wupoplugins.com … … 18 18 * Domain Path: /languages 19 19 * Requires at least: 5.0.0 20 * Tested up to: 5.920 * Tested up to: 6.0 21 21 * WC requires at least: 3.0.0 22 * WC tested up to: 6. 422 * WC tested up to: 6.6 23 23 * 24 24 * Copyright: (c) 2022 WUPO Plugins - Premium WordPress and WooCommerce Extensions … … 175 175 // drop a custom database table 176 176 global $wpdb ; 177 $result = $wpdb->query( "ALTER TABLE {$wpdb-> prefix}term_taxonomyDROP COLUMN children" );178 $result = $wpdb->query( "DELETE FROM {$wpdb-> prefix}term_taxonomyWHERE taxonomy = 'wugrat_group'" );179 $result = $wpdb->query( "DELETE FROM {$wpdb-> prefix}term_taxonomyWHERE taxonomy = 'wugrat_group_set'" );177 $result = $wpdb->query( "ALTER TABLE {$wpdb->term_taxonomy} DROP COLUMN children" ); 178 $result = $wpdb->query( "DELETE FROM {$wpdb->term_taxonomy} WHERE taxonomy = 'wugrat_group'" ); 179 $result = $wpdb->query( "DELETE FROM {$wpdb->term_taxonomy} WHERE taxonomy = 'wugrat_group_set'" ); 180 180 } 181 181
Note: See TracChangeset
for help on using the changeset viewer.