Changeset 2242119
- Timestamp:
- 02/10/2020 11:06:00 PM (6 years ago)
- Location:
- wc-remove-bg/trunk
- Files:
-
- 4 edited
-
admin/class-wc-remove-bg-admin.php (modified) (6 diffs)
-
admin/js/wc-remove-bg-admin.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
wc-remove-bg.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wc-remove-bg/trunk/admin/class-wc-remove-bg-admin.php
r2234477 r2242119 10 10 * @subpackage wc-remove-bg/admin 11 11 */ 12 12 13 13 14 /** … … 101 102 global $wpdb; 102 103 103 104 104 if( wp_verify_nonce( sanitize_text_field($_POST['_nonce']), 'update-options' ) && user_can(intval($_POST['schk']), 'edit_pages') ) { 105 105 106 $process = sanitize_text_field($_POST['process']); 106 107 $sql = "SELECT * FROM `" . $wpdb->prefix . "wc_remove_bg`"; 107 108 $res = $wpdb->get_results( $sql ); 108 109 if ( $process == 'start_queue' || $process == 'save' ) { 109 update_option( 'RemoveBG_ApiKey', sanitize_text_field( $_POST['RemoveBG_ApiKey']) );110 update_option( 'RemoveBG_ApiKey', sanitize_text_field(trim($_POST['RemoveBG_ApiKey'])) ); 110 111 update_option( 'RemoveBG_products', sanitize_text_field($_POST['RemoveBG_products']) ); 111 112 update_option( 'RemoveBG_products_IDs', sanitize_text_field($_POST['RemoveBG_products_IDs']) ); … … 522 523 if ( $img_thumbnail == 'yes' ) { 523 524 set_post_thumbnail( $post_id, $new_img_id ); 524 } elseif ( $img_gallery == 'yes' ) { 525 } 526 if ( $img_gallery == 'yes' ) { 525 527 $galleryIds = get_post_meta( $post_id, '_product_image_gallery' ); 526 528 if ( isset( $galleryIds[0] ) && ! empty( $galleryIds[0] ) ) { … … 639 641 unlink( $tmp_img ); 640 642 641 if ( is_wp_error( $response ) ) { 643 if ( $this->isJSON($response['body']) ) { 644 $errorResponseArray = json_decode($response['body']); 645 $errorResponseSelected = []; 646 if(!empty($errorResponseArray->errors)){ 647 foreach ($errorResponseArray->errors as $error){ 648 $errorResponseSelected[] = ['title' => $error->title]; 649 } 650 } 651 642 652 return array( 643 653 'errors' => true, 644 654 'code' => 400, 645 655 'img_id' => $old_img, 646 'errors_msg' => $ response->get_error_message()656 'errors_msg' => $errorResponseSelected 647 657 ); 648 658 } … … 702 712 } 703 713 } 714 715 function isJSON($string) { 716 return ((is_string($string) && (is_object(json_decode($string)) || is_array(json_decode($string))))) ? true : false; 717 } 704 718 705 719 public function Remove_BG_Restore_Backup() … … 844 858 { 845 859 if( wp_verify_nonce( sanitize_text_field($_POST['_nonce']), 'update-options' ) ) { 846 update_option( 'RemoveBG_ApiKey', sanitize_text_field( $_POST['RemoveBG_ApiKey']) );860 update_option( 'RemoveBG_ApiKey', sanitize_text_field(trim($_POST['RemoveBG_ApiKey'])) ); 847 861 update_option( 'RemoveBG_Background', sanitize_text_field($_POST['RemoveBG_Background']) ); 848 862 update_option( 'RemoveBG_Background_Color', sanitize_text_field($_POST['RemoveBG_Background_Color']) ); -
wc-remove-bg/trunk/admin/js/wc-remove-bg-admin.js
r2164019 r2242119 67 67 if(data.hasErrors == true) { 68 68 $('.wc_remove_bg').hide(); 69 $('.wc_remove_bg#status_ e').show();70 $('.wc_remove_bg#status_ e p').html(data.error_msg+' ('+$('.wc_remove_bg-log').html()+')');69 $('.wc_remove_bg#status_restore_e').show(); 70 $('.wc_remove_bg#status_restore_e p').html(data.error_msg+' ('+$('.wc_remove_bg-log').html()+')'); 71 71 $("html, body").animate({ scrollTop: 0 }, "slow"); 72 72 -
wc-remove-bg/trunk/readme.txt
r2234496 r2242119 101 101 = 1.1 = 102 102 * minor bug fix 103 = 1.2 = 104 * minor bug fix 103 105 104 106 == Upgrade Notice == -
wc-remove-bg/trunk/wc-remove-bg.php
r2234509 r2242119 7 7 * Description: Remove/change background of WooCommerce product images. 8 8 * Plugin URI: http://fresh-d.biz/wocommerce-remove-background.html 9 * Version: 1. 19 * Version: 1.2 10 10 * Author: Fresh-d 11 11 * Author URI: https://fresh-d.biz/about-us.html … … 27 27 28 28 29 define( 'Remove_BG_VERSION', '1. 1' );29 define( 'Remove_BG_VERSION', '1.2' ); 30 30 31 31 /**
Note: See TracChangeset
for help on using the changeset viewer.