Plugin Directory

Changeset 2911544


Ignore:
Timestamp:
05/12/2023 09:44:55 AM (3 years ago)
Author:
thanhtd
Message:

Update

Location:
exmage-wp-image-links/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • exmage-wp-image-links/trunk/CHANGELOG.txt

    r2846469 r2911544  
     1/**1.0.15 - 2023.05.12**/
     2- Updated: Keep exmage link of product when import product from csv
     3
    14/**1.0.14 - 2023.01.11**/
    25- Updated: If the number of images is greater than threshold(20 by default, able to change via exmage_ajax_handle_url_threshold hook), they will be processed in the background
  • exmage-wp-image-links/trunk/exmage-wp-image-links.php

    r2846469 r2911544  
    44 * Plugin URI: https://villatheme.com/extensions/exmage-wordpress-image-links/
    55 * Description: Save storage by using external image URLs.
    6  * Version: 1.0.14
     6 * Version: 1.0.15
    77 * Author: VillaTheme(villatheme.com)
    88 * Author URI: https://villatheme.com
    99 * Text Domain: exmage-wp-image-links
    10  * Copyright 2021-2022 VillaTheme.com. All rights reserved.
    11  * Tested up to: 6.1
     10 * Copyright 2021-2023 VillaTheme.com. All rights reserved.
     11 * Tested up to: 6.2
    1212 * Requires PHP: 7.0
    1313 **/
     
    1616}
    1717
    18 define( 'EXMAGE_WP_IMAGE_LINKS_VERSION', '1.0.14' );
     18define( 'EXMAGE_WP_IMAGE_LINKS_VERSION', '1.0.15' );
    1919include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    2020define( 'EXMAGE_WP_IMAGE_LINKS_DIR', plugin_dir_path( __FILE__ ) );
     
    6565                'wpml_after_duplicate_attachment'
    6666            ), 10, 2 );
     67
     68            add_action( 'woocommerce_product_import_before_process_item', function () {
     69                remove_action( 'pre_get_posts', [ $this, 'search_exmage_url_when_import_product' ] );
     70                add_action( 'pre_get_posts', [ $this, 'search_exmage_url_when_import_product' ] );
     71            } );
     72
     73            add_action( 'woocommerce_product_import_inserted_product_object', function () {
     74                remove_action( 'pre_get_posts', [ $this, 'search_exmage_url_when_import_product' ] );
     75            } );
    6776        }
    6877
     
    664673                    );
    665674                    if ( class_exists( 'WPML_Media_Attachments_Duplication' ) ) {
    666                         /*Prevent WPML from duplicating this external image*/
     675                        /*Prevent WPML from duplicating this external image*/
    667676                        exmage_remove_filter( 'add_attachment', 'WPML_Media_Attachments_Duplication', 'save_attachment_actions' );
    668677                        exmage_remove_filter( 'add_attachment', 'WPML_Media_Attachments_Duplication', 'save_translated_attachments' );
     
    987996            ) );
    988997        }
     998
     999        public function search_exmage_url_when_import_product( &$q ) {
     1000            if ( ! empty( $q->query_vars['meta_query'] ) ) {
     1001                $file = '';
     1002                foreach ( $q->query_vars['meta_query'] as $key => &$mt_qr ) {
     1003                    if ( ! empty( $mt_qr['key'] ) && $mt_qr['key'] == '_wc_attachment_source' ) {
     1004                        $file = $mt_qr['value'];
     1005                        break;
     1006                    }
     1007                }
     1008                if ( $file ) {
     1009                    $q->query_vars['meta_query'][] = [
     1010                        'key'     => '_exmage_external_url',
     1011                        'value'   => $file,
     1012                        'compare' => 'LIKE',
     1013                    ];
     1014
     1015                    $q->query_vars['meta_query']['relation'] = 'OR';
     1016                }
     1017            }
     1018
     1019        }
    9891020    }
    9901021}
  • exmage-wp-image-links/trunk/readme.txt

    r2887265 r2911544  
    5858### MAY BE YOU NEED
    5959
     60[SUBRE – Product Subscription for WooCommerce](https://bit.ly/subre-product-subscription-for-woo): Convert WooCommerce simple products(physical or downloadable/virtual) to subscription products and allow recurring payments
     61
    6062[Clear Autoptimize Cache Automatically](https://bit.ly/clear-autoptimize-cache-automatically): Clear Autoptimize cache automatically by cache amount or by time interval
    6163
     
    158160
    159161== Changelog ==
     162
     163/**1.0.15 - 2023.05.12**/
     164- Updated: Keep exmage link of product when import product from csv
     165
    160166/**1.0.14 - 2023.01.11**/
    161167- Updated: If the number of images is greater than threshold(20 by default, able to change via exmage_ajax_handle_url_threshold hook), they will be processed in the background
Note: See TracChangeset for help on using the changeset viewer.