Changeset 3341185
- Timestamp:
- 08/07/2025 04:46:39 PM (8 months ago)
- Location:
- transfer-brands-for-woocommerce
- Files:
-
- 20 added
- 7 edited
-
tags/2.7.0 (added)
-
tags/2.7.0/CHANGELOG.md (added)
-
tags/2.7.0/INSTALLATION.md (added)
-
tags/2.7.0/assets (added)
-
tags/2.7.0/assets/css (added)
-
tags/2.7.0/assets/css/admin.css (added)
-
tags/2.7.0/assets/js (added)
-
tags/2.7.0/assets/js/admin.js (added)
-
tags/2.7.0/assets/js/taxonomy-refresh.js (added)
-
tags/2.7.0/includes (added)
-
tags/2.7.0/includes/class-admin.php (added)
-
tags/2.7.0/includes/class-ajax.php (added)
-
tags/2.7.0/includes/class-backup.php (added)
-
tags/2.7.0/includes/class-core.php (added)
-
tags/2.7.0/includes/class-transfer.php (added)
-
tags/2.7.0/includes/class-utils.php (added)
-
tags/2.7.0/languages (added)
-
tags/2.7.0/languages/transfer-brands-for-woocommerce.pot (added)
-
tags/2.7.0/readme.txt (added)
-
tags/2.7.0/transfer-brands-for-woocommerce.php (added)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/includes/class-ajax.php (modified) (11 diffs)
-
trunk/includes/class-backup.php (modified) (1 diff)
-
trunk/includes/class-transfer.php (modified) (3 diffs)
-
trunk/includes/class-utils.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/transfer-brands-for-woocommerce.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
transfer-brands-for-woocommerce/trunk/CHANGELOG.md
r3294781 r3341185 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [2.7.0] - 2025-08-07 9 10 ### Added 11 - Full compatibility with WordPress 6.8.2 12 - Full compatibility with WooCommerce 10.0.4 13 - Support for both 'thumbnail_id' and 'brand_image_id' meta keys for brand images 14 - Enhanced security with capability checks in all AJAX handlers 15 - Stores brand images in both meta keys for maximum compatibility 16 17 ### Changed 18 - Updated minimum PHP requirement to 7.4 19 - Updated minimum WordPress requirement to 6.0 20 - Updated minimum WooCommerce requirement to 8.0.0 21 - Improved SQL queries with proper placeholder handling 22 - Enhanced error handling and debugging capabilities 23 24 ### Fixed 25 - Fixed critical brand images transfer issue preventing images from migrating properly 26 - Fixed duplicate code in product batch processing 27 - Fixed SQL query security issues with proper prepared statements 28 - Added missing permission checks in AJAX handlers 7 29 8 30 ## [2.6.3] - 2025-05-16 -
transfer-brands-for-woocommerce/trunk/includes/class-ajax.php
r3294781 r3341185 47 47 public function ajax_transfer() { 48 48 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 49 50 if (!current_user_can('manage_woocommerce')) { 51 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 52 } 53 49 54 $step = isset($_POST['step']) ? sanitize_text_field($_POST['step']) : 'backup'; 50 55 $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0; … … 115 120 public function ajax_check_brands() { 116 121 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 122 123 if (!current_user_can('manage_woocommerce')) { 124 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 125 } 117 126 118 127 $source_terms = get_terms([ … … 181 190 182 191 // Check if term has image 192 // Check both possible image meta keys 183 193 $image_id = get_term_meta($term->term_id, 'thumbnail_id', true); 194 if (!$image_id) { 195 $image_id = get_term_meta($term->term_id, 'brand_image_id', true); 196 } 184 197 if ($image_id) { 185 198 $terms_with_images++; … … 316 329 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 317 330 331 if (!current_user_can('manage_woocommerce')) { 332 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 333 } 334 318 335 $result = $this->core->get_backup()->rollback_transfer(); 319 336 … … 332 349 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 333 350 351 if (!current_user_can('manage_woocommerce')) { 352 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 353 } 354 334 355 $result = $this->core->get_backup()->rollback_deleted_brands(); 335 356 … … 349 370 public function ajax_init_delete() { 350 371 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 372 373 if (!current_user_can('manage_woocommerce')) { 374 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 375 } 351 376 352 377 // Make sure we completely remove previous data … … 373 398 public function ajax_delete_old_brands() { 374 399 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 400 401 if (!current_user_can('manage_woocommerce')) { 402 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 403 } 375 404 376 405 $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0; … … 530 559 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 531 560 561 if (!current_user_can('manage_woocommerce')) { 562 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 563 } 564 532 565 $result = $this->core->get_backup()->cleanup_backups(); 533 566 … … 545 578 public function ajax_refresh_counts() { 546 579 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 580 581 if (!current_user_can('manage_woocommerce')) { 582 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 583 } 547 584 548 585 // Clear object cache … … 590 627 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 591 628 629 if (!current_user_can('manage_woocommerce')) { 630 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 631 } 632 592 633 if (isset($_POST['clear']) && $_POST['clear']) { 593 634 delete_option('tbfw_brands_debug_log'); … … 605 646 public function ajax_refresh_destination_taxonomy() { 606 647 check_ajax_referer('tbfw_transfer_brands_nonce', 'nonce'); 648 649 if (!current_user_can('manage_woocommerce')) { 650 wp_die(__('You do not have permission to perform this action.', 'transfer-brands-for-woocommerce')); 651 } 607 652 608 653 // Refresh the destination taxonomy -
transfer-brands-for-woocommerce/trunk/includes/class-backup.php
r3294781 r3341185 47 47 if (!is_wp_error($dest_terms)) { 48 48 foreach ($dest_terms as $term) { 49 // Check both possible image meta keys 49 50 $image_id = get_term_meta($term->term_id, 'thumbnail_id', true); 51 if (!$image_id) { 52 $image_id = get_term_meta($term->term_id, 'brand_image_id', true); 53 } 50 54 $backup['terms'][$term->term_id] = [ 51 55 'name' => $term->name, -
transfer-brands-for-woocommerce/trunk/includes/class-transfer.php
r3294781 r3341185 75 75 $new_id = is_array($new) ? $new['term_id'] : $new; 76 76 77 // Transfer image if exists 77 // Transfer image if exists - support both old and new meta keys 78 78 $image_id = get_term_meta($term->term_id, 'thumbnail_id', true); 79 if (!$image_id) { 80 $image_id = get_term_meta($term->term_id, 'brand_image_id', true); 81 } 79 82 if ($image_id) { 83 // Store in both keys for maximum compatibility 80 84 update_term_meta($new_id, 'thumbnail_id', $image_id); 85 update_term_meta($new_id, 'brand_image_id', $image_id); 81 86 $log_message .= ' (with image)'; 82 87 } … … 129 134 130 135 // Create exclusion placeholders for already processed products 131 $exclude_condition = ''; 132 $query_args = [ 133 '%' . $wpdb->esc_like($this->core->get_option('source_taxonomy')) . '%', 134 $this->core->get_batch_size() 135 ]; 136 if (!empty($processed_products)) { 137 $placeholders = implode(',', array_fill(0, count($processed_products), '%d')); 138 $exclude_condition = " AND post_id NOT IN ($placeholders)"; 139 $query_args = array_merge([$query_args[0]], $processed_products, [$query_args[1]]); 140 } 141 142 // Find products with brand attribute that haven't been processed yet 143 $query = "SELECT DISTINCT post_id 144 FROM {$wpdb->postmeta} 145 WHERE meta_key = '_product_attributes' 146 AND meta_value LIKE %s 147 AND post_id IN (SELECT ID FROM {$wpdb->posts} WHERE post_type = 'product' AND post_status = 'publish') 148 {$exclude_condition} 149 LIMIT %d"; 150 151 $product_ids = $wpdb->get_col( 152 $wpdb->prepare($query, $query_args) 153 ); 154 $product_ids = $wpdb->get_col( 155 $wpdb->prepare( 156 "SELECT DISTINCT post_id 136 $exclude_condition = ''; 137 $query_args = [ 138 '%' . $wpdb->esc_like($this->core->get_option('source_taxonomy')) . '%' 139 ]; 140 141 if (!empty($processed_products)) { 142 $placeholders = implode(',', array_fill(0, count($processed_products), '%d')); 143 $exclude_condition = " AND post_id NOT IN ($placeholders)"; 144 $query_args = array_merge($query_args, $processed_products); 145 } 146 147 $query_args[] = $this->core->get_batch_size(); 148 149 // Find products with brand attribute that haven't been processed yet 150 $query = "SELECT DISTINCT post_id 157 151 FROM {$wpdb->postmeta} 158 152 WHERE meta_key = '_product_attributes' … … 160 154 AND post_id IN (SELECT ID FROM {$wpdb->posts} WHERE post_type = 'product' AND post_status = 'publish') 161 155 {$exclude_condition} 162 LIMIT %d" ,163 '%' . $wpdb->esc_like($this->core->get_option('source_taxonomy')) . '%',164 $this->core->get_batch_size()165 )156 LIMIT %d"; 157 158 $product_ids = $wpdb->get_col( 159 $wpdb->prepare($query, $query_args) 166 160 ); 167 161 -
transfer-brands-for-woocommerce/trunk/includes/class-utils.php
r3294781 r3341185 190 190 $result = []; 191 191 foreach ($terms as $term) { 192 // Check both possible image meta keys 192 193 $image_id = get_term_meta($term->term_id, 'thumbnail_id', true); 194 if (!$image_id) { 195 $image_id = get_term_meta($term->term_id, 'brand_image_id', true); 196 } 193 197 if ($image_id) { 194 198 $result[] = [ -
transfer-brands-for-woocommerce/trunk/readme.txt
r3294819 r3341185 1 1 === Transfer Brands for WooCommerce === 2 2 Contributors: malakontask 3 Tags: woocommerce, brand s, taxonomy, attribute,transfer4 Requires at least: 5.65 Tested up to: 6.8 6 Stable tag: 2. 6.37 Requires PHP: 7. 23 Tags: woocommerce, brand, taxonomy, attribute, transfer, woocommerce 9.6, woocommerce brands, product brands, brand migration, brand transfer 4 Requires at least: 6.0 5 Tested up to: 6.8.2 6 Stable tag: 2.7.0 7 Requires PHP: 7.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 WC requires at least: 5.0.011 WC tested up to: 8.0.012 13 Migrate product brand attributes to WooCommerce's brand taxonomy with image support, backup protection, and real-time progress tracking.10 WC requires at least: 8.0.0 11 WC tested up to: 10.0.4 12 13 Easily migrate your existing brand attributes to WooCommerce 9.6's new brand taxonomy with complete backup, image transfer, and real-time progress tracking. 14 14 15 15 == Description == … … 116 116 117 117 == Changelog == 118 = 2.7.0 = 119 * Full compatibility with WordPress 6.8.2 and WooCommerce 10.0.4 120 * Fixed brand images transfer issue - now supports both 'thumbnail_id' and 'brand_image_id' meta keys 121 * Enhanced security with proper capability checks in all AJAX handlers 122 * Updated minimum PHP requirement to 7.4 for better performance and security 123 * Updated minimum WordPress requirement to 6.0 124 * Improved SQL queries with proper placeholder handling 125 * Fixed duplicate code in product batch processing 126 * Added support for WooCommerce's new brand taxonomy structure 127 * Stores brand images in both meta keys for maximum compatibility 128 * Enhanced error handling and debugging capabilities 129 118 130 = 2.6.3 = 119 131 * Updated textdomain loading to follow WordPress best practices … … 180 192 == Upgrade Notice == 181 193 194 = 2.7.0 = 195 Critical update for WooCommerce 10.0.4 compatibility. Fixes brand image transfer issues and adds full support for WordPress 6.8.2. This update is required for proper brand migration with the latest WooCommerce version. 196 182 197 = 2.6.3 = 183 This update optimizes the plugin for WooCommerce brand compatibility and improves overall security and performance. Recommended for all users.198 This update optimizes the plugin for WooCommerce 9.6 compatibility and improves overall security and performance. 184 199 185 200 = 2.6.1 = -
transfer-brands-for-woocommerce/trunk/transfer-brands-for-woocommerce.php
r3294802 r3341185 4 4 * Plugin URI: https://pluginatlas.com/transfer-brands-for-woocommerce 5 5 * Description: Official migration tool for WooCommerce 9.6 Brands. Safely transfer your product brand attributes to the new brand taxonomy with image support, batch processing, and full backup capabilities. 6 * Version: 2. 6.37 * Requires at least: 5.68 * Requires PHP: 7. 26 * Version: 2.7.0 7 * Requires at least: 6.0 8 * Requires PHP: 7.4 9 9 * Requires Plugins: woocommerce 10 10 * Author: Kostas Malakontas … … 14 14 * Text Domain: transfer-brands-for-woocommerce 15 15 * Domain Path: /languages 16 * WC requires at least: 5.0.017 * WC tested up to: 8.0.016 * WC requires at least: 8.0.0 17 * WC tested up to: 10.0.4 18 18 * 19 19 * This program is free software: you can redistribute it and/or modify … … 36 36 37 37 // Define plugin constants 38 define('TBFW_VERSION', '2. 6.3');38 define('TBFW_VERSION', '2.7.0'); 39 39 define('TBFW_PLUGIN_DIR', plugin_dir_path(__FILE__)); 40 40 define('TBFW_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 144 144 } 145 145 } 146 // Create necessary folders if they don't exist147 if (!file_exists(TBFW_PLUGIN_DIR . 'includes/')) {148 wp_mkdir_p(TBFW_PLUGIN_DIR . 'includes/');149 }150 151 if (!file_exists(TBFW_PLUGIN_DIR . 'assets/css/')) {152 wp_mkdir_p(TBFW_PLUGIN_DIR . 'assets/css/');153 }154 155 if (!file_exists(TBFW_PLUGIN_DIR . 'assets/js/')) {156 wp_mkdir_p(TBFW_PLUGIN_DIR . 'assets/js/');157 }158 146 159 147 // Add default options
Note: See TracChangeset
for help on using the changeset viewer.