Changeset 3450805
- Timestamp:
- 01/31/2026 04:52:20 AM (3 weeks ago)
- Location:
- different-shipping-and-billing-address-for-woocommerce/trunk
- Files:
-
- 8 edited
-
dsabafw-multiple-address.php (modified) (3 diffs)
-
main/backend/dsabafw-backend.php (modified) (25 diffs)
-
main/block/block.php (modified) (1 diff)
-
main/block/class-blocks-integration.php (modified) (4 diffs)
-
main/frontend/dsabafw-ajax.php (modified) (1 diff)
-
main/frontend/dsabafw-front.php (modified) (48 diffs)
-
main/resources/dsabafw-installation-require.php (modified) (1 diff)
-
main/resources/dsabafw-load-js-css.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
different-shipping-and-billing-address-for-woocommerce/trunk/dsabafw-multiple-address.php
r3262513 r3450805 6 6 * Copyright: 2023 7 7 * Text Domain: different-shipping-and-billing-address-for-woocommerce 8 * Domain Path: /languages 8 * 9 * License: GPL-2.0+ 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 11 */ 10 12 … … 39 41 include_once('main/backend/dsabafw-backend.php'); 40 42 include_once('main/resources/dsabafw-installation-require.php'); 41 include_once('main/resources/dsabafw-language.php');42 43 include_once('main/block/block.php'); 43 44 include_once('main/frontend/dsabafw-front.php'); … … 52 53 if ( strpos( $plugin_file_name, basename(__FILE__) ) ) { 53 54 // You can still use `array_unshift()` to add links at the beginning. 54 $links_array[] = '<a href="https://www.plugin999.com/support/">'. __('Support', 'different-shipping-and-billing-address-for-woocommerce -pro') .'</a>';55 $links_array[] = '<a href="https://wordpress.org/support/plugin/different-shipping-and-billing-address-for-woocommerce/reviews/ ?filter=5">'. __('Rate the plugin ★★★★★', 'different-shipping-and-billing-address-for-woocommerce-pro') .'</a>';55 $links_array[] = '<a href="https://www.plugin999.com/support/">'. __('Support', 'different-shipping-and-billing-address-for-woocommerce') .'</a>'; 56 $links_array[] = '<a href="https://wordpress.org/support/plugin/different-shipping-and-billing-address-for-woocommerce/reviews/">'. __('Rate the plugin ★★★★★', 'different-shipping-and-billing-address-for-woocommerce') .'</a>'; 56 57 } 57 58 return $links_array; -
different-shipping-and-billing-address-for-woocommerce/trunk/main/backend/dsabafw-backend.php
r3445958 r3450805 21 21 <p> 22 22 <a class="button-primary button" title="Support Different Shipping And Billing Address" target="_blank" href="https://www.plugin999.com/support/">Support</a> 23 <a class="button-primary button" title="Rate WP Reset" target="_blank" href="https://wordpress.org/support/plugin/different-shipping-and-billing-address-for-woocommerce/reviews/ ?filter=5">Rate the plugin ★★★★★</a>23 <a class="button-primary button" title="Rate WP Reset" target="_blank" href="https://wordpress.org/support/plugin/different-shipping-and-billing-address-for-woocommerce/reviews/">Rate the plugin ★★★★★</a> 24 24 </p> 25 25 </div> … … 345 345 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 346 346 if( isset($_REQUEST['action']) && $_REQUEST['action']=="delete_dsabafw_admin"){ 347 if(!isset( $_REQUEST['delete_nonce'] ) || !wp_verify_nonce( $_REQUEST['delete_nonce'], 'delete_address_admin' ) ){ 348 print 'Sorry, your nonce did not verify.'; 347 $delete_nonce = isset( $_REQUEST['delete_nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['delete_nonce'] ) ) : ''; 348 if ( !isset( $_REQUEST['delete_nonce'] ) || !wp_verify_nonce( $delete_nonce, 'delete_address_admin' ) ) { 349 wp_die( esc_html__( 'Security check failed.', 'different-shipping-and-billing-address-for-woocommerce' ) ); 349 350 exit; 350 351 }else{ 351 $delete_id = sanitize_text_field($_REQUEST['did']);352 $delete_id = isset( $_REQUEST['did'] ) ? absint( wp_unslash( $_REQUEST['did'] ) ) : 0; 352 353 // $sql = "DELETE FROM {$tablename} WHERE id='".$delete_id."'" ; 353 $sql = $wpdb->prepare("DELETE FROM {$tablename} WHERE id = %d", $delete_id); 354 $wpdb->query($sql); 355 wp_redirect( admin_url( '/user-edit.php?user_id='.sanitize_text_field($_REQUEST['user_id']) ) ); 354 $wpdb->query( 355 $wpdb->prepare( 356 "DELETE FROM {$tablename} WHERE id = %d", 357 $delete_id 358 ) 359 ); 360 $user_id = isset( $_REQUEST['user_id'] ) ? absint( wp_unslash( $_REQUEST['user_id'] ) ) : 0; 361 wp_redirect( admin_url( '/user-edit.php?user_id='.$user_id ) ); 356 362 exit; 357 363 } 358 364 } 359 365 if(isset($_REQUEST['action']) && $_REQUEST['action']=="delete-ship"){ 360 if(!isset( $_REQUEST['delete_nonce'] ) || !wp_verify_nonce( $_REQUEST['delete_nonce'], 'delete_address_admin' ) ){ 361 print 'Sorry, your nonce did not verify.'; 366 $delete_nonce = isset( $_REQUEST['delete_nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['delete_nonce'] ) ) : ''; 367 if(!isset( $_REQUEST['delete_nonce'] ) || !wp_verify_nonce( $delete_nonce, 'delete_address_admin') ){ 368 wp_die( esc_html__( 'Security check failed', 'different-shipping-and-billing-address-for-woocommerce' ) ); 362 369 exit; 363 370 }else{ 364 $delete_id =sanitize_text_field($_REQUEST['did-ship']);371 $delete_id = isset( $_REQUEST['did-ship'] ) ? absint( wp_unslash( $_REQUEST['did-ship'] ) ) : 0; 365 372 // $sql = "DELETE FROM {$tablename} WHERE id='".$delete_id."'" ; 366 $sql = $wpdb->prepare("DELETE FROM {$tablename} WHERE id = %d", $delete_id); 367 $wpdb->query($sql); 368 wp_redirect( admin_url( '/user-edit.php?user_id='.sanitize_text_field($_REQUEST['user_id']) ) ); 373 $wpdb->query( 374 $wpdb->prepare( 375 "DELETE FROM {$tablename} WHERE id = %d", 376 $delete_id 377 ) 378 ); 379 $user_id = isset( $_REQUEST['user_id'] ) ? absint( wp_unslash( $_REQUEST['user_id'] ) ) : 0; 380 wp_redirect( admin_url( '/user-edit.php?user_id='.$user_id ) ); 369 381 exit; 370 382 } … … 373 385 if( current_user_can('administrator') ) { 374 386 if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'dsabafw_save_option'){ 375 if(!isset( $_POST['dsabafw_nonce_field'] ) || !wp_verify_nonce( $_POST['dsabafw_nonce_field'], 'dsabafw_nonce_action' ) ){ 376 print 'Sorry, your nonce did not verify.'; 387 $delete_nonce = isset( $_REQUEST['dsabafw_nonce_field'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['dsabafw_nonce_field'] ) ) : ''; 388 if(!isset( $_REQUEST['dsabafw_nonce_field'] ) || !wp_verify_nonce( $delete_nonce, 'dsabafw_nonce_action') ){ 389 wp_die( esc_html__( 'Security check failed.', 'different-shipping-and-billing-address-for-woocommerce' ) ); 377 390 exit; 378 391 }else{ … … 390 403 } 391 404 392 if( !empty($_REQUEST['different_roles_select'])){393 $different_roles_select = DSABAFW_recursive_sanitize_text_field( $_REQUEST['different_roles_select']);405 if(isset($_REQUEST['different_roles_select']) && !empty($_REQUEST['different_roles_select'])){ 406 $different_roles_select = DSABAFW_recursive_sanitize_text_field( wp_unslash( $_REQUEST['different_roles_select'] ) ); 394 407 update_option('different_roles_select', $different_roles_select, 'yes'); 395 408 } else { … … 427 440 add_action('wp_ajax_nopriv_dsabafw_validate_edit_billing_form_fields', 'dsabafw_validate_edit_billing_form_fields_func'); 428 441 function dsabafw_validate_edit_billing_form_fields_func() { 429 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 442 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 443 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 430 444 die ( 'Busted!'); 431 445 } … … 433 447 global $wpdb; 434 448 435 $user_id = $_REQUEST['userid'];449 $user_id = isset( $_REQUEST['userid'] ) ? absint( wp_unslash( $_REQUEST['userid'] ) ) : 0; 436 450 $tablename = $wpdb->prefix.'dsabafw_billingadress'; 437 $country = isset($_REQUEST['billing_country']) && !empty($_REQUEST['billing_country']) ? $_REQUEST['billing_country']: get_user_meta($user_id, 'billing_country', true);451 $country = isset($_REQUEST['billing_country']) && !empty($_REQUEST['billing_country']) ? sanitize_text_field( wp_unslash( $_REQUEST['billing_country'] ) ) : get_user_meta($user_id, 'billing_country', true); 438 452 $address_fields = wc()->countries->get_address_fields($country); 439 $edit_id = sanitize_text_field($_REQUEST['edit_id']);453 $edit_id = isset( $_REQUEST['edit_id'] ) ? absint( wp_unslash( $_REQUEST['edit_id'] ) ) : 0; 440 454 $dsabafw_userid= $user_id; 441 455 $billing_data = array(); 442 456 $field_errors = array(); 443 $billing_data['reference_field'] = sanitize_text_field($_REQUEST['reference_field']); 457 $billing_data['reference_field'] = isset( $_REQUEST['reference_field'] ) 458 ? sanitize_text_field( wp_unslash( $_REQUEST['reference_field'] ) ) 459 : ''; 444 460 if($_REQUEST['reference_field'] == '') { 445 461 $field_errors['dsabafw_refname'] = '1'; … … 447 463 448 464 foreach ($address_fields as $key => $field) { 449 $billing_data[$key] = sanitize_text_field($_REQUEST[$key]);465 $billing_data[$key] = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : ''; 450 466 if($_REQUEST[$key] == '') { 451 467 if($field['required'] == 1) { … … 462 478 'id'=>$edit_id, 463 479 'userid' =>$dsabafw_userid, 464 'type' => sanitize_text_field($_REQUEST['type'])480 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 465 481 ); 466 482 … … 480 496 481 497 // Add New Section For User Addresses In User Edit Page 482 add_action( 'show_user_profile', ' yoursite_extra_user_profile_fields', 999 );483 add_action( 'edit_user_profile', ' yoursite_extra_user_profile_fields', 999 );484 function yoursite_extra_user_profile_fields( $user ) {485 global $wpdb ;498 add_action( 'show_user_profile', 'dsabafw_extra_user_profile_fields', 999 ); 499 add_action( 'edit_user_profile', 'dsabafw_extra_user_profile_fields', 999 ); 500 function dsabafw_extra_user_profile_fields( $user ) { 501 global $wpdb, $dsabafw_comman; 486 502 $delete_nonce = wp_create_nonce('delete_address_admin'); 487 503 $user_data = $user->data; … … 489 505 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 490 506 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='billing' AND userid=".$user_id); 491 $query = $wpdb->prepare( 492 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 493 'billing', 494 $user_id 507 $user = $wpdb->get_results( 508 $wpdb->prepare( 509 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 510 'billing', 511 $user_id 512 ) 495 513 ); 496 $user = $wpdb->get_results($query);497 514 498 515 // $user_shipping = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='shipping' AND userid=".$user_id); 499 $shipping_query = $wpdb->prepare( 500 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 501 'shipping', 502 $user_id 516 $user_shipping = $wpdb->get_results( 517 $wpdb->prepare( 518 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 519 'shipping', 520 $user_id 521 ) 503 522 ); 504 $user_shipping = $wpdb->get_results($shipping_query);505 523 ?> 506 524 <div class="bil_ship_address_user"> … … 519 537 <div class="billing_address"> 520 538 <button class="form_option_edit_admin" data-id="<?php echo esc_attr($user_id);?>" data-eid-bil="<?php echo esc_attr($row->id);?>"><?php echo esc_html($dsabafw_comman['dsabafw_billing_edit_txt']); ?></button> 521 <span class="delete_bill_address"><a href="?user_id=<?php echo esc_attr($user_id);?>&action=delete_dsabafw_admin&delete_nonce=<?php echo $delete_nonce; ?>&did=<?php echo esc_attr($row->id);?>"><?php echo esc_html($dsabafw_comman['dsabafw_billing_delete_txt']); ?></a></span><br>539 <span class="delete_bill_address"><a href="?user_id=<?php echo esc_attr($user_id);?>&action=delete_dsabafw_admin&delete_nonce=<?php echo esc_attr($delete_nonce); ?>&did=<?php echo esc_attr($row->id);?>"><?php echo esc_html($dsabafw_comman['dsabafw_billing_delete_txt']); ?></a></span><br> 522 540 <span class="billing_address_inner"> 523 541 <?php echo (isset($user_data['reference_field']) && !empty($user_data['reference_field']) ? esc_html($user_data['reference_field'])."<br>" : ''). … … 541 559 ?> 542 560 <div class="billing_address_empty"> 543 <p class="billing_empty_message"><?php echo esc_html __($dsabafw_comman['dsabafw_no_billing_address_txt'],'different-shipping-and-billing-address-for-woocommerce'); ?></p>561 <p class="billing_empty_message"><?php echo esc_html( $dsabafw_comman['dsabafw_no_billing_address_txt'] ); ?></p> 544 562 </div> 545 563 <?php … … 562 580 <div class="shipping_address"> 563 581 <button class="form_option_ship_edit_admin" data-id="<?php echo esc_attr($user_id);?>" data-eid-ship="<?php echo esc_attr($row->id);?>"><?php echo esc_html($dsabafw_comman['dsabafw_shipping_edit_txt']); ?></button> 564 <span class="delete_ship_address"><a href="?user_id=<?php echo esc_attr($user_id);?>&action=delete-ship&delete_nonce=<?php echo $delete_nonce; ?>&did-ship=<?php echo esc_attr($row->id);?>"><?php echo esc_html($dsabafw_comman['dsabafw_shipping_delete_txt']);?></a></span><br>582 <span class="delete_ship_address"><a href="?user_id=<?php echo esc_attr($user_id);?>&action=delete-ship&delete_nonce=<?php echo esc_attr($delete_nonce); ?>&did-ship=<?php echo esc_attr($row->id);?>"><?php echo esc_html($dsabafw_comman['dsabafw_shipping_delete_txt']);?></a></span><br> 565 583 <span class="shipping_address_inner"> 566 584 <?php echo (isset($user_data['reference_field']) && !empty($user_data['reference_field']) ? esc_html($user_data['reference_field'])."<br>" : ''). … … 597 615 598 616 // For Popup Html 599 add_action('admin_footer', ' my_admin_footer_function');600 function my_admin_footer_function($data) {617 add_action('admin_footer', 'dsabafw_admin_footer_function'); 618 function dsabafw_admin_footer_function($data) { 601 619 ?> 602 620 <div id="dsabafw_billing_popup_admin" class="dsabafw_billing_popup_classadmin"> … … 611 629 add_action('wp_ajax_nopriv_dsabafw_validate_edit_shipping_form_fields', 'dsabafw_validate_edit_shipping_form_fields_func'); 612 630 function dsabafw_validate_edit_shipping_form_fields_func() { 613 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 631 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 632 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 614 633 die ( 'Busted!'); 615 634 } … … 617 636 global $wpdb; 618 637 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 619 $edit_id = sanitize_text_field($_REQUEST['edit_id']);638 $edit_id = isset( $_REQUEST['edit_id'] ) ? absint( wp_unslash( $_REQUEST['edit_id'] ) ) : 0; 620 639 $countries = new WC_Countries(); 621 $country = isset($_REQUEST['shipping_country']) && !empty($_REQUEST['shipping_country']) ? $_REQUEST['shipping_country']: $countries->get_base_country();622 $address_fields = WC()->countries->get_address_fields( $country, 'shipping_' ); 623 $dsabafw_userid = sanitize_text_field($_REQUEST['userid']);640 $country = isset($_REQUEST['shipping_country']) && !empty($_REQUEST['shipping_country']) ? sanitize_text_field(wp_unslash($_REQUEST['shipping_country'])) : $countries->get_base_country(); 641 $address_fields = WC()->countries->get_address_fields( $country, 'shipping_' ); 642 $dsabafw_userid = isset( $_REQUEST['userid'] ) ? absint( wp_unslash( $_REQUEST['userid'] ) ) : 0; 624 643 $billing_data = array(); 625 644 $field_errors = array(); 626 $billing_data['reference_field'] = sanitize_text_field($_REQUEST['reference_field']); 645 $billing_data['reference_field'] = isset( $_REQUEST['reference_field'] ) 646 ? sanitize_text_field( wp_unslash( $_REQUEST['reference_field'] ) ) 647 : ''; 627 648 628 649 if($_REQUEST['reference_field'] == '') { … … 631 652 632 653 foreach ($address_fields as $key => $field) { 633 $billing_data[$key] = sanitize_text_field($_REQUEST[$key]);654 $billing_data[$key] = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : ''; 634 655 if($_REQUEST[$key] == '') { 635 656 if($field['required'] == 1) { … … 646 667 'id'=>$edit_id, 647 668 'userid' =>$dsabafw_userid, 648 'type' => sanitize_text_field($_REQUEST['type'])669 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 649 670 ); 650 671 $wpdb->update($tablename, array( 'userdata' =>$billing_data_serlized), $condition); … … 666 687 add_action('wp_ajax_nopriv_productscommentsbilling_admin', 'dsabafw_billing_popup_open_admin'); 667 688 function dsabafw_billing_popup_open_admin() { 668 global $wpdb; 669 670 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 689 global $wpdb, $dsabafw_comman; 690 691 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 692 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 671 693 die ( 'Busted!'); 672 } 673 674 $user_id = sanitize_text_field($_REQUEST['popup_id_pro_admin']); 675 $edit_id = sanitize_text_field($_REQUEST['eid-bil-admin']); 694 } 695 696 $user_id = isset( $_REQUEST['popup_id_pro_admin'] ) ? absint( wp_unslash( $_REQUEST['popup_id_pro_admin'] ) ) : 0; 697 $edit_id = isset( $_REQUEST['eid-bil-admin'] ) ? absint( wp_unslash( $_REQUEST['eid-bil-admin'] ) ) : 0; 698 676 699 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 677 700 // echo $edit_id; … … 682 705 <?php 683 706 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='billing' AND userid=".$user_id." AND id=".$edit_id); 684 $query = $wpdb->prepare( 685 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %d", 686 'billing', 687 $user_id, 688 $edit_id 707 $user = $wpdb->get_results( 708 $wpdb->prepare( 709 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %d", 710 'billing', 711 $user_id, 712 $edit_id 713 ) 689 714 ); 690 $user = $wpdb->get_results($query);691 715 $user_data = unserialize($user[0]->userdata); 692 716 $country = isset($user_data['billing_country']) ? $user_data['billing_country'] : ''; … … 728 752 $return_arr[] = array("html" => $edit_html); 729 753 echo json_encode($return_arr); 730 die(); 754 die(); 731 755 } 732 756 … … 735 759 add_action('wp_ajax_nopriv_productscommentsshipping_admin', 'dsabafw_shipping_popup_open_admin'); 736 760 function dsabafw_shipping_popup_open_admin() { 737 global $wpdb; 738 739 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 761 global $wpdb, $dsabafw_comman; 762 763 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 764 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 740 765 die ( 'Busted!'); 741 } 742 743 $user_id = sanitize_text_field( $_REQUEST['popup_id_pro_ship']);744 $edit_id = sanitize_text_field($_REQUEST['eid-ship-popup']);766 } 767 768 $user_id = isset( $_REQUEST['popup_id_pro_ship'] ) ? absint( wp_unslash( $_REQUEST['popup_id_pro_ship'] ) ) : 0; 769 $edit_id = isset( $_REQUEST['eid-ship-popup'] ) ? absint( wp_unslash( $_REQUEST['eid-ship-popup'] ) ) : 0; 745 770 //echo $edit_id; 746 771 $tablename=$wpdb->prefix.'dsabafw_billingadress'; … … 748 773 echo '<span class="dsabafw_closeship">×</span>'; 749 774 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='shipping' AND userid=".$user_id." AND id=".$edit_id); 750 $query = $wpdb->prepare( 751 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %s", 752 'shipping', 753 $user_id, 754 $edit_id 775 $user = $wpdb->get_results( 776 $wpdb->prepare( 777 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %d", 778 'shipping', 779 $user_id, 780 $edit_id 781 ) 755 782 ); 756 $user = $wpdb->get_results($query);757 783 $user_data = unserialize($user[0]->userdata); 758 784 $countries = new WC_Countries(); … … 808 834 <?php 809 835 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='billing' AND userid=".$user_id); 810 $query = $wpdb->prepare( 811 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 812 'billing', 813 $user_id 814 ); 815 $user = $wpdb->get_results($query); 836 $user = $wpdb->get_results( 837 $wpdb->prepare( 838 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 839 'billing', 840 $user_id 841 ) 842 ); 816 843 ?> 817 844 … … 844 871 <?php 845 872 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='shipping' AND userid=".$user_id); 846 $query = $wpdb->prepare( 847 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 848 'shipping', 849 $user_id 850 ); 851 $user = $wpdb->get_results($query); 873 $user = $wpdb->get_results( 874 $wpdb->prepare( 875 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 876 'shipping', 877 $user_id 878 ) 879 ); 852 880 ?> 853 881 -
different-shipping-and-billing-address-for-woocommerce/trunk/main/block/block.php
r3208335 r3450805 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { 3 exit; 4 } 5 2 6 add_action( 3 7 'woocommerce_blocks_loaded', -
different-shipping-and-billing-address-for-woocommerce/trunk/main/block/class-blocks-integration.php
r3262513 r3450805 35 35 plugins_url( 'build/backend.js', __FILE__ ), 36 36 array('react', 'wc-blocks-checkout', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 37 '1.0.0', 38 true 37 39 ); 38 39 40 } 40 41 41 42 42 public function register_block_frontend_scripts() { … … 45 45 plugins_url('build/frontend.js', __FILE__), 46 46 array('react', 'wc-blocks-checkout', 'wp-element', 'wp-i18n'), 47 false,47 '1.0.0', 48 48 true 49 49 ); … … 52 52 $current_user_id = get_current_user_id(); 53 53 54 if(is_user_logged_in()){ 55 $ query =$wpdb->prepare(54 if(is_user_logged_in()){ 55 $address_rows = $wpdb->get_results($wpdb->prepare( 56 56 "SELECT * FROM {$wpdb->prefix}dsabafw_billingadress WHERE userid = %d", 57 57 $current_user_id 58 ); 59 $address_rows = $wpdb->get_results($query, ARRAY_A); 58 ), ARRAY_A); 60 59 } else { 61 60 $address_rows = []; … … 87 86 if(is_user_logged_in()){ 88 87 // Query to count billing and shipping addresses 89 $query = $wpdb->prepare( 90 "SELECT type, COUNT(*) as count 91 FROM {$wpdb->prefix}dsabafw_billingadress 92 WHERE userid = %d 93 GROUP BY type", 94 $current_user_id 88 $user = $wpdb->get_results( 89 $wpdb->prepare( 90 "SELECT type, COUNT(*) as count 91 FROM {$wpdb->prefix}dsabafw_billingadress 92 WHERE userid = %d 93 GROUP BY type", 94 $current_user_id 95 ) 95 96 ); 96 $user = $wpdb->get_results($query);97 97 98 98 $save_address = !empty($user) ? intval($user[0]->count) : 0; -
different-shipping-and-billing-address-for-woocommerce/trunk/main/frontend/dsabafw-ajax.php
r3246992 r3450805 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { 3 exit; 4 } 5 2 6 // Load All Actions 3 7 add_action( 'init', 'DSABAFW_add_action_and_filters_load'); -
different-shipping-and-billing-address-for-woocommerce/trunk/main/frontend/dsabafw-front.php
r3445958 r3450805 30 30 31 31 // Change Addresses Tab End Point My Account Page 32 function get_adress_book_endpoint_url( $address_book ) {32 function dsabafw_get_adress_book_endpoint_url( $address_book ) { 33 33 $url = wc_get_endpoint_url( 'edit-address', 'shipping', get_permalink() ); 34 34 return add_query_arg( 'address-book', $address_book, $url ); … … 39 39 foreach ( $items as $key => $value ) { 40 40 if ( 'edit-address' === $key ) { 41 $items[ $key ] = __( 'Address Book', ' woo-address-book' );41 $items[ $key ] = __( 'Address Book', 'different-shipping-and-billing-address-for-woocommerce' ); 42 42 } 43 43 } … … 169 169 if($dsabafw_comman['dsabafw_enable_different_billing_adress'] == 'yes'){ 170 170 echo '<div class="dsabafw_table_bill">'; 171 ?>171 ?> 172 172 <div class="billling-button"> 173 173 <button class="form_option_billing " data-id="<?php echo esc_attr($user_id); ?>" style="background-color: <?php echo esc_attr($dsabafw_comman['dsabafw_btn_bg_clr']);?>; color: <?php echo esc_attr($dsabafw_comman['dsabafw_font_clr']);?>; padding: <?php echo esc_attr($dsabafw_comman['dsabafw_btn_padding']);?>; font-size: <?php echo esc_attr($dsabafw_comman['dsabafw_font_size'])."px" ?>;"><?php echo esc_html($dsabafw_comman['dsabafw_head_title']);?></button> 174 174 </div> 175 175 <?php 176 echo '<h3>' . esc_html __( $dsabafw_comman['dsabafw_modify_billing_address_txt'], 'different-shipping-and-billing-address-for-woocommerce') . '</h3>';176 echo '<h3>' . esc_html( $dsabafw_comman['dsabafw_modify_billing_address_txt'] ) . '</h3>'; 177 177 if(!empty($user)){ 178 178 echo '<div class="billing_addresses">'; … … 196 196 <?php 197 197 echo isset($user_data['reference_field']) && !empty($user_data['reference_field']) ? esc_attr($user_data['reference_field'])."<br>" : ""; 198 echo ((isset($user_data['billing_first_name']) && !empty($user_data['billing_first_name'])) || (isset($user_data['billing_last_name']) && !empty($user_data['billing_last_name']))) 199 ? esc_attr($user_data['billing_first_name']) .' '.esc_attr($user_data['billing_last_name'])."<br>" : ""; 198 echo ((isset($user_data['billing_first_name']) && !empty($user_data['billing_first_name'])) || (isset($user_data['billing_last_name']) && !empty($user_data['billing_last_name']))) ? esc_attr($user_data['billing_first_name']) .' '.esc_attr($user_data['billing_last_name'])."<br>" : ""; 200 199 echo isset($user_data['billing_company']) && !empty($user_data['billing_company']) ? esc_attr($user_data['billing_company'])."<br>" : ""; 201 200 echo isset($user_data['billing_address_1']) && !empty($user_data['billing_address_1']) ? esc_attr($user_data['billing_address_1'])."<br>" : ""; … … 237 236 </div> 238 237 <?php 239 echo '<h3>' . esc_html __( $dsabafw_comman['dsabafw_modify_shipping_address_txt'], 'different-shipping-and-billing-address-for-woocommerce') . '</h3>';238 echo '<h3>' . esc_html( $dsabafw_comman['dsabafw_modify_shipping_address_txt'] ) . '</h3>'; 240 239 if(!empty($user_shipping)){ 241 240 echo '<div class="shipping_addresses">'; … … 272 271 </div> 273 272 <?php 274 } 273 } 275 274 echo "</div>"; 276 275 }else{ 277 276 ?> 278 277 <div class="shipping_address_empty"> 279 <p class="shipping_empty_message"><?php echo esc_html($dsabafw_comman['dsabafw_no_shipping_address_txt']); ?></p>278 <p class="shipping_empty_message"><?php echo esc_html($dsabafw_comman['dsabafw_no_shipping_address_txt']); ?></p> 280 279 </div> 281 280 <?php 282 281 } 283 282 ?> 284 <div class="cus_menu"> 285 <?php 286 if($dsabafw_comman['dsabafw_enable_different_shipping_adress'] == 'yes'){ 287 288 } 289 ?> 290 </div> 283 <div class="cus_menu"></div> 291 284 <?php 292 285 echo '</div>'; … … 297 290 // For Billing Popup Ajax Html Return 298 291 function dsabafw_billing_popup_open() { 299 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 292 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 293 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 300 294 die ( 'Busted!'); 301 295 } … … 303 297 global $wpdb,$dsabafw_comman; 304 298 305 $user_id = sanitize_text_field($_REQUEST['popup_id_pro']); 306 $edit_id = sanitize_text_field( $_REQUEST['eid-bil']); 299 $user_id = isset( $_REQUEST['popup_id_pro'] ) ? absint( wp_unslash( $_REQUEST['popup_id_pro'] ) ) : 0; 300 $edit_id = isset( $_REQUEST['eid-bil'] ) ? absint( wp_unslash( $_REQUEST['eid-bil'] ) ) : 0; 301 307 302 $tablename = $wpdb->prefix.'dsabafw_billingadress'; 308 303 if(empty($edit_id)){ … … 344 339 </button> 345 340 </div> 346 347 341 </div> 348 342 </form> … … 359 353 <?php 360 354 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='billing' AND userid=".$user_id." AND id=".$edit_id); 361 $query = $wpdb->prepare( 355 $user = $wpdb->get_results( 356 $wpdb->prepare( 362 357 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %d", 363 358 'billing', 364 359 $user_id, 365 360 $edit_id 366 );367 $user = $wpdb->get_results($query);361 ) 362 ); 368 363 $user_data = unserialize($user[0]->userdata); 369 364 $address_fields = wc()->countries->get_address_fields(get_user_meta(get_current_user_id(), 'billing_country', true)); … … 385 380 </p> 386 381 <?php 387 foreach ($address_fields as $key => $field) { 382 foreach ($address_fields as $key => $field) { 388 383 woocommerce_form_field($key, $field, $user_data[$key]); 389 384 } 390 385 ?> 391 <button type="button" name="add_billing_edit" id="dsabafw_edit_billing_form_submit" class="button wp-element-button wp-block-button__link" value="dsabafw_billpp_save_option"><?php echo esc_html($dsabafw_comman['dsabafw_billing_update_address_btntxt']); ?></button> 392 386 <button type="button" name="add_billing_edit" id="dsabafw_edit_billing_form_submit" class="button wp-element-button wp-block-button__link" value="dsabafw_billpp_save_option"><?php echo esc_html($dsabafw_comman['dsabafw_billing_update_address_btntxt']); ?></button> 393 387 </div> 394 388 </div> … … 406 400 // For Shipping Popup Ajax Html Return 407 401 function dsabafw_shipping_popup_open() { 408 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 409 die ( 'Busted!'); 402 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 403 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 404 die ( 'Busted!'); 410 405 } 411 406 … … 413 408 414 409 // Sanitize and validate input 415 $user_id = i ntval($_REQUEST['popup_id_pro']);416 $edit_id = i ntval($_REQUEST['eid-ship']);410 $user_id = isset( $_REQUEST['popup_id_pro'] ) ? absint( wp_unslash( $_REQUEST['popup_id_pro'] ) ) : 0; 411 $edit_id = isset( $_REQUEST['eid-ship'] ) ? absint( wp_unslash( $_REQUEST['eid-ship'] ) ) : 0; 417 412 $tablename = $wpdb->prefix . 'dsabafw_billingadress'; 418 413 419 414 // If editing an address 420 415 if (!empty($edit_id)) { 421 echo '<div class="dsabafw_modal-content">'; 422 echo '<span class="dsabafw_close">×</span>'; 423 424 // Fetch existing address details 425 $query = $wpdb->prepare( 426 "SELECT * FROM {$tablename} WHERE type = %s AND userid = %d AND id = %d", 427 'shipping', 428 $user_id, 429 $edit_id 430 ); 431 $user = $wpdb->get_results($query); 432 433 if (!empty($user)) { 434 $user_data = unserialize($user[0]->userdata); 435 $countries = new WC_Countries(); 436 $country = $countries->get_base_country(); 437 $address_fields = WC()->countries->get_address_fields($country, 'shipping_'); 438 ?> 439 440 <form method="post" id="dsabafw_edit_shipping_form"> 441 <div class="dsabafw_woocommerce-address-fields"> 442 <div class="dsabafw_woocommerce-address-fields_field-wrapper"> 443 <input type="hidden" name="type" value="shipping"> 444 <input type="hidden" name="userid" value="<?php echo esc_attr($user_id); ?>"> 445 <input type="hidden" name="edit_id" value="<?php echo esc_attr($edit_id); ?>"> 446 <p class="form-row form-row-wide" id="reference_field" data-priority="30"> 447 <label for="reference_field" class=""> 448 <b><?php echo esc_html($dsabafw_comman['dsabafw_shipping_refname_txt']); ?></b> 449 <abbr class="required" title="required">*</abbr> 450 </label> 451 <span class="woocommerce-input-wrapper"> 452 <input type="text" class="input-text" id="dsabafw_refname" name="reference_field" 453 value="<?php echo esc_attr($user_data['reference_field']); ?>"> 454 </span> 455 </p> 456 <?php 457 foreach ($address_fields as $key => $field) { 458 woocommerce_form_field($key, $field, $user_data[$key]); 459 } 460 ?> 461 <button type="button" name="add_shipping_edit" class="button wp-element-button wp-block-button__link" 462 id="dsabafw_edit_shipping_form_submit" value="dsabafw_shippp_save_optionn"> 463 <?php echo esc_html($dsabafw_comman['dsabafw_shipping_update_address_btntxt']); ?> 464 </button> 465 </div> 466 </div> 467 </form> 468 <?php 469 } else { 470 echo '<h3 class="dsabafw_border">Error: Address not found.</h3>'; 471 } 472 echo '</div>'; 473 die(); 416 echo '<div class="dsabafw_modal-content">'; 417 echo '<span class="dsabafw_close">×</span>'; 418 419 // Fetch existing address details 420 $user = $wpdb->get_results( 421 $wpdb->prepare( 422 "SELECT * FROM {$tablename} WHERE type = %s AND userid = %d AND id = %d", 423 'shipping', 424 $user_id, 425 $edit_id 426 ) 427 ); 428 429 if (!empty($user)) { 430 $user_data = unserialize($user[0]->userdata); 431 $countries = new WC_Countries(); 432 $country = $countries->get_base_country(); 433 $address_fields = WC()->countries->get_address_fields($country, 'shipping_'); 434 ?> 435 <form method="post" id="dsabafw_edit_shipping_form"> 436 <div class="dsabafw_woocommerce-address-fields"> 437 <div class="dsabafw_woocommerce-address-fields_field-wrapper"> 438 <input type="hidden" name="type" value="shipping"> 439 <input type="hidden" name="userid" value="<?php echo esc_attr($user_id); ?>"> 440 <input type="hidden" name="edit_id" value="<?php echo esc_attr($edit_id); ?>"> 441 <p class="form-row form-row-wide" id="reference_field" data-priority="30"> 442 <label for="reference_field" class=""> 443 <b><?php echo esc_html($dsabafw_comman['dsabafw_shipping_refname_txt']); ?></b> 444 <abbr class="required" title="required">*</abbr> 445 </label> 446 <span class="woocommerce-input-wrapper"> 447 <input type="text" class="input-text" id="dsabafw_refname" name="reference_field" value="<?php echo esc_attr($user_data['reference_field']); ?>"> 448 </span> 449 </p> 450 <?php 451 foreach ($address_fields as $key => $field) { 452 woocommerce_form_field($key, $field, $user_data[$key]); 453 } 454 ?> 455 <button type="button" name="add_shipping_edit" class="button wp-element-button wp-block-button__link" 456 id="dsabafw_edit_shipping_form_submit" value="dsabafw_shippp_save_optionn"> 457 <?php echo esc_html($dsabafw_comman['dsabafw_shipping_update_address_btntxt']); ?> 458 </button> 459 </div> 460 </div> 461 </form> 462 <?php 463 } else { 464 echo '<h3 class="dsabafw_border">Error: Address not found.</h3>'; 465 } 466 echo '</div>'; 467 die(); 474 468 } 475 469 476 470 // If adding a new address 477 $query = $wpdb->prepare( 471 $user = $wpdb->get_results( 472 $wpdb->prepare( 478 473 "SELECT count(*) as count FROM {$tablename} WHERE type = %s AND userid = %d", 479 474 'shipping', 480 475 $user_id 476 ) 481 477 ); 482 $user = $wpdb->get_results($query);483 478 484 479 $save_address = !empty($user) ? intval($user[0]->count) : 0; … … 486 481 487 482 if ($save_address >= $max_count) { 488 echo '<div class="dsabafw_modal-content">';489 echo '<span class="dsabafw_close">×</span>';490 echo "<h3 class='dsabafw_border'>You can add maximum " . esc_html($max_count) . " addresses!</h3>";491 echo '</div>';492 die();483 echo '<div class="dsabafw_modal-content">'; 484 echo '<span class="dsabafw_close">×</span>'; 485 echo "<h3 class='dsabafw_border'>You can add maximum " . esc_html($max_count) . " addresses!</h3>"; 486 echo '</div>'; 487 die(); 493 488 } else { 494 echo '<div class="dsabafw_modal-content">'; 495 echo '<span class="dsabafw_close">×</span>'; 496 $countries = new WC_Countries(); 497 $country = $countries->get_base_country(); 498 $address_fields = WC()->countries->get_address_fields($country, 'shipping_'); 499 ?> 500 501 <form method="post" id="dsabafw_add_shipping_form"> 502 <div class="dsabafw_woocommerce-address-fields"> 503 <div class="dsabafw_woocommerce-address-fields_field-wrapper"> 504 <input type="hidden" name="type" value="shipping"> 505 <p class="form-row form-row-wide" id="reference_field" data-priority="30"> 506 <label for="reference_field" class=""> 507 <b><?php echo esc_html($dsabafw_comman['dsabafw_shipping_refname_txt']); ?></b> 508 <abbr class="required" title="required">*</abbr> 509 </label> 510 <span class="woocommerce-input-wrapper"> 511 <input type="text" class="input-text" id="dsabafw_refname" name="reference_field"> 512 </span> 513 </p> 514 <?php 515 foreach ($address_fields as $key => $field) { 516 woocommerce_form_field($key, $field, wc_get_post_data_by_key($key)); 517 } 518 ?> 519 <button type="button" name="add_shipping" id="dsabafw_add_shipping_form_submit" class="button wp-element-button wp-block-button__link" value="dsabafw_shippp_save_optionn"> <?php echo esc_html($dsabafw_comman['dsabafw_shipping_save_address_btntxt']); ?> </button> 520 </div> 521 </div> 522 </form> 523 <?php 524 echo '</div>'; 525 die(); 489 echo '<div class="dsabafw_modal-content">'; 490 echo '<span class="dsabafw_close">×</span>'; 491 $countries = new WC_Countries(); 492 $country = $countries->get_base_country(); 493 $address_fields = WC()->countries->get_address_fields($country, 'shipping_'); 494 ?> 495 <form method="post" id="dsabafw_add_shipping_form"> 496 <div class="dsabafw_woocommerce-address-fields"> 497 <div class="dsabafw_woocommerce-address-fields_field-wrapper"> 498 <input type="hidden" name="type" value="shipping"> 499 <p class="form-row form-row-wide" id="reference_field" data-priority="30"> 500 <label for="reference_field" class=""> 501 <b><?php echo esc_html($dsabafw_comman['dsabafw_shipping_refname_txt']); ?></b> 502 <abbr class="required" title="required">*</abbr> 503 </label> 504 <span class="woocommerce-input-wrapper"> 505 <input type="text" class="input-text" id="dsabafw_refname" name="reference_field"> 506 </span> 507 </p> 508 <?php 509 foreach ($address_fields as $key => $field) { 510 woocommerce_form_field($key, $field, wc_get_post_data_by_key($key)); 511 } 512 ?> 513 <button type="button" name="add_shipping" id="dsabafw_add_shipping_form_submit" class="button wp-element-button wp-block-button__link" value="dsabafw_shippp_save_optionn"> <?php echo esc_html($dsabafw_comman['dsabafw_shipping_save_address_btntxt']); ?> </button> 514 </div> 515 </div> 516 </form> 517 <?php 518 echo '</div>'; 519 die(); 526 520 } 527 521 } … … 531 525 global $wpdb; 532 526 $user_id = get_current_user_id(); 533 $ select_id = sanitize_text_field($_REQUEST['sid']);527 $edit_id = isset( $_REQUEST['sid'] ) ? absint( wp_unslash( $_REQUEST['sid'] ) ) : 0; 534 528 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 535 529 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='billing' AND userid=".$user_id." AND id=".$select_id); 536 $query = $wpdb->prepare( 530 $user = $wpdb->get_results( 531 $wpdb->prepare( 537 532 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %d", 538 533 'billing', 539 534 $user_id, 540 535 $edit_id 541 );542 $user = $wpdb->get_results($query);536 ) 537 ); 543 538 $user_data = unserialize($user[0]->userdata); 544 539 echo json_encode($user_data); … … 549 544 function dsabafw_shipping_data_select(){ 550 545 $user_id = get_current_user_id(); 551 $ select_id = sanitize_text_field($_REQUEST['sid']);546 $edit_id = isset( $_REQUEST['sid'] ) ? absint( wp_unslash( $_REQUEST['sid'] ) ) : 0; 552 547 global $wpdb; 553 548 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 554 549 // $user = $wpdb->get_results( "SELECT * FROM {$tablename} WHERE type='shipping' AND userid=".$user_id." AND id=".$select_id); 555 $query = $wpdb->prepare( 550 $user = $wpdb->get_results( 551 $wpdb->prepare( 556 552 "SELECT * FROM $tablename WHERE type = %s AND userid = %d AND id = %d", 557 553 'shipping', 558 554 $user_id, 559 555 $edit_id 560 );561 $user = $wpdb->get_results($query);556 ) 557 ); 562 558 $user_data = unserialize($user[0]->userdata); 563 559 echo json_encode($user_data); … … 572 568 573 569 // Check if the user is logged in 574 575 if ($dsabafw_comman['dsabafw_enable_different_billing_adress'] == 'yes') { 576 ?> 577 <div class="dsabafw_selectt"> 578 <select class="dsabafw_select"> 579 <option value=""><?php echo esc_html($dsabafw_comman['dsabafw_billing_choose_address_txt']); ?></option> 580 <?php 581 if (is_user_logged_in()) { 582 // $user = $wpdb->get_results("SELECT * FROM {$tablename} WHERE type='billing' AND userid=" . $user_id); 583 584 $query = $wpdb->prepare( 585 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 586 'billing', 587 $user_id 588 ); 589 $user = $wpdb->get_results($query); 590 591 foreach ($user as $row) { 592 $userdata_bil = $row->userdata; 570 if ($dsabafw_comman['dsabafw_enable_different_billing_adress'] == 'yes') { 571 ?> 572 <div class="dsabafw_selectt"> 573 <select class="dsabafw_select"> 574 <option value=""><?php echo esc_html($dsabafw_comman['dsabafw_billing_choose_address_txt']); ?></option> 575 <?php 576 if (is_user_logged_in()) { 577 // $user = $wpdb->get_results("SELECT * FROM {$tablename} WHERE type='billing' AND userid=" . $user_id); 578 $user = $wpdb->get_results( 579 $wpdb->prepare( 580 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 581 'billing', 582 $user_id 583 ) 584 ); 585 586 foreach ($user as $row) { 587 $userdata_bil = $row->userdata; 588 $user_data = unserialize($userdata_bil); 589 $valid = ($row->Defalut == 1) ? "selected" : ""; 590 ?> 591 <option value="<?php echo esc_attr($row->id); ?>" <?php echo esc_attr($valid); ?> 592 data-first-name="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_first_name'] : ''); ?>" 593 data-last-name="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_last_name'] : ''); ?>" 594 data-company="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_company'] : ''); ?>" 595 data-country="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_country'] : ''); ?>" 596 data-address1="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_address_1'] : ''); ?>" 597 data-address2="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_address_2'] : ''); ?>" 598 data-city="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_city'] : ''); ?>" 599 data-state="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_state'] : ''); ?>" 600 data-postcode="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_postcode'] : ''); ?>" 601 data-phone="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_phone'] : ''); ?>" 602 data-email="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_email'] : ''); ?>"> 603 <?php echo esc_html(isset($user_data['reference_field']) ? $user_data['reference_field'] : ''); ?> 604 </option> 605 <?php 606 } 607 } else { 608 $user = []; 609 if (function_exists('WC') && WC()->session && WC()->session->get('dsabafw_guest_user_data', '{}')) { 610 // Decode the existing session value 611 $guest_user_session_data = WC()->session->get('dsabafw_guest_user_data', '{}'); 612 $user = json_decode($guest_user_session_data, true); 613 614 foreach ($user as $key => $row) { 615 if($row['type'] === 'billing') { 616 $userdata_bil = $row['userdata']; 593 617 $user_data = unserialize($userdata_bil); 594 $valid = ($row->Defalut == 1) ? "selected" : "";595 618 ?> 596 <option value="<?php echo esc_attr($row->id); ?>" <?php echo esc_attr($valid); ?> 597 data-first-name="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_first_name'] : ''); ?>" 598 data-last-name="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_last_name'] : ''); ?>" 599 data-company="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_company'] : ''); ?>" 600 data-country="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_country'] : ''); ?>" 601 data-address1="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_address_1'] : ''); ?>" 602 data-address2="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_address_2'] : ''); ?>" 603 data-city="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_city'] : ''); ?>" 604 data-state="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_state'] : ''); ?>" 605 data-postcode="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_postcode'] : ''); ?>" 606 data-phone="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_phone'] : ''); ?>" 607 data-email="<?php echo esc_attr(isset($user_data['billing_first_name']) ? $user_data['billing_email'] : ''); ?>"> 608 <?php echo esc_html(isset($user_data['reference_field']) ? $user_data['reference_field'] : ''); ?> 619 <option value="<?php echo esc_attr($key); ?>" 620 data-first-name="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_first_name'] : ''); ?>" 621 data-last-name="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_last_name'] : ''); ?>" 622 data-company="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_company'] : ''); ?>" 623 data-country="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_country'] : ''); ?>" 624 data-address1="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_address_1'] : ''); ?>" 625 data-address2="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_address_2'] : ''); ?>" 626 data-city="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_city'] : ''); ?>" 627 data-state="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_state'] : ''); ?>" 628 data-postcode="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_postcode'] : ''); ?>"> 629 <?php echo esc_html(isset($user_data['reference_field']) ? $user_data['reference_field'] : ''); ?> 609 630 </option> 610 <?php631 <?php 611 632 } 612 } else { 613 $user = []; 614 if (function_exists('WC') && WC()->session && WC()->session->get('dsabafw_guest_user_data', '{}')) { 615 // Decode the existing session value 616 $guest_user_session_data = WC()->session->get('dsabafw_guest_user_data', '{}'); 617 $user = json_decode($guest_user_session_data, true); 618 619 foreach ($user as $key => $row) { 620 if($row['type'] === 'billing') { 621 $userdata_bil = $row['userdata']; 622 $user_data = unserialize($userdata_bil); 623 ?> 624 <option value="<?php echo esc_attr($key); ?>" 625 data-first-name="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_first_name'] : ''); ?>" 626 data-last-name="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_last_name'] : ''); ?>" 627 data-company="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_company'] : ''); ?>" 628 data-country="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_country'] : ''); ?>" 629 data-address1="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_address_1'] : ''); ?>" 630 data-address2="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_address_2'] : ''); ?>" 631 data-city="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_city'] : ''); ?>" 632 data-state="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_state'] : ''); ?>" 633 data-postcode="<?php echo esc_attr(isset($user_data['reference_field']) ? $user_data['shipping_postcode'] : ''); ?>"> 634 <?php echo esc_html(isset($user_data['reference_field']) ? $user_data['reference_field'] : ''); ?> 635 </option> 636 <?php 637 } 638 639 } 640 } 633 641 634 } 642 ?> 643 </select> 644 <button class="form_option_billing" data-id="<?php echo esc_attr($user_id); ?>" 645 style="background-color: <?php echo esc_attr($dsabafw_comman['dsabafw_btn_bg_clr']);?>; 646 color: <?php echo esc_attr($dsabafw_comman['dsabafw_font_clr']);?>; 647 padding: <?php echo esc_attr($dsabafw_comman['dsabafw_btn_padding']);?>; 648 font-size: <?php echo esc_attr($dsabafw_comman['dsabafw_font_size'])."px"; ?>;"> 649 <?php echo esc_html($dsabafw_comman['dsabafw_head_title']); ?> 650 </button> 651 </div> 652 <?php 653 } 635 } 636 } 637 ?> 638 </select> 639 <button class="form_option_billing" data-id="<?php echo esc_attr($user_id); ?>" 640 style="background-color: <?php echo esc_attr($dsabafw_comman['dsabafw_btn_bg_clr']);?>; 641 color: <?php echo esc_attr($dsabafw_comman['dsabafw_font_clr']);?>; 642 padding: <?php echo esc_attr($dsabafw_comman['dsabafw_btn_padding']);?>; 643 font-size: <?php echo esc_attr($dsabafw_comman['dsabafw_font_size'])."px"; ?>;"> 644 <?php echo esc_html($dsabafw_comman['dsabafw_head_title']); ?> 645 </button> 646 </div> 647 <?php 648 } 654 649 655 650 } … … 669 664 if (is_user_logged_in()) { 670 665 // $user = $wpdb->get_results("SELECT * FROM {$tablename} WHERE type='shipping' AND userid=" . $user_id); 671 672 $query =$wpdb->prepare(666 $user = $wpdb->get_results( 667 $wpdb->prepare( 673 668 "SELECT * FROM $tablename WHERE type = %s AND userid = %d", 674 669 'shipping', 675 670 $user_id 676 );677 $user = $wpdb->get_results($query);671 ) 672 ); 678 673 679 674 foreach ($user as $row) { … … 722 717 <?php 723 718 } 724 725 719 } 726 720 } … … 740 734 741 735 if( isset($_REQUEST['action']) && $_REQUEST['action']=="delete_dsabafw"){ 742 if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'delete_address' ) ) { 736 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 737 if ( !isset( $_REQUEST['nonce'] ) || !wp_verify_nonce( $nonce, 'delete_address') ) { 743 738 die ( 'Busted!'); 744 739 } 745 $delete_id=sanitize_text_field($_REQUEST['did']); 740 741 $delete_id=isset( $_REQUEST['did'] ) ? absint( wp_unslash( $_REQUEST['did'] ) ) : 0; 746 742 //$sql = "DELETE FROM {$tablename} WHERE id='".$delete_id."'" ; 747 743 dsabafw_delete_Query_get($tablename,$delete_id); … … 752 748 753 749 if(isset($_REQUEST['action']) && $_REQUEST['action']=="delete_ship"){ 754 if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'delete_address' ) ) { 750 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 751 if ( !isset( $_REQUEST['nonce'] ) || !wp_verify_nonce( $nonce, 'delete_address') ) { 755 752 die ( 'Busted!'); 756 753 } 757 $delete_id=sanitize_text_field($_REQUEST['did-ship']); 754 755 $delete_id=isset( $_REQUEST['did-ship'] ) ? absint( wp_unslash( $_REQUEST['did-ship'] ) ) : 0; 758 756 dsabafw_delete_Query_get($tablename,$delete_id); 759 757 //$sql = "DELETE FROM {$tablename} WHERE id='".$delete_id."'" ; … … 767 765 // For Validation Billing Form Fields Popup 768 766 function dsabafw_validate_billing_form_fields_func() { 769 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 767 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 768 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 770 769 die ( 'Busted!'); 771 770 } … … 774 773 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 775 774 776 $country = isset($_REQUEST['billing_country']) && !empty($_REQUEST['billing_country']) ? $_REQUEST['billing_country']: get_user_meta(get_current_user_id(), 'billing_country', true);775 $country = isset($_REQUEST['billing_country']) && !empty($_REQUEST['billing_country']) ? sanitize_text_field(wp_unslash($_REQUEST['billing_country'])) : get_user_meta(get_current_user_id(), 'billing_country', true); 777 776 778 777 $address_fields = wc()->countries->get_address_fields($country); … … 783 782 $field_errors = array(); 784 783 785 $billing_data['reference_field'] = sanitize_text_field($_REQUEST['reference_field']); 784 $billing_data['reference_field'] = isset( $_REQUEST['reference_field'] ) 785 ? sanitize_text_field( wp_unslash( $_REQUEST['reference_field'] ) ) 786 : ''; 786 787 787 788 if($_REQUEST['reference_field'] == '') { … … 790 791 791 792 foreach ($address_fields as $key => $field) { 792 $billing_data[$key] = sanitize_text_field($_REQUEST[$key]);793 $billing_data[$key] = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : ''; 793 794 if($_REQUEST[$key] == '') { 794 795 if($field['required'] == 1) { … … 800 801 // unset($field_errors['billing_state']); 801 802 802 803 804 803 if (empty($field_errors)) { 805 804 $billing_data_serlized = serialize($billing_data); 806 805 807 806 if (is_user_logged_in()) { 808 $wpdb->insert(809 $tablename,810 array(811 'userid' => $dsabafw_userid,812 'userdata' => $billing_data_serlized,813 'type' => sanitize_text_field($_REQUEST['type'])814 )815 );807 $wpdb->insert( 808 $tablename, 809 array( 810 'userid' => $dsabafw_userid, 811 'userdata' => $billing_data_serlized, 812 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 813 ) 814 ); 816 815 } else { 817 816 // Check if the session exists … … 825 824 'userid' => $dsabafw_userid, 826 825 'userdata' => $billing_data_serlized, 827 'type' => sanitize_text_field($_REQUEST['type'])826 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 828 827 ); 829 828 … … 841 840 'userid' => $dsabafw_userid, 842 841 'userdata' => $billing_data_serlized, 843 'type' => sanitize_text_field($_REQUEST['type'])842 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 844 843 ); 845 844 … … 864 863 } 865 864 866 867 868 865 // For Validation Shipping Form Fields Popup 869 866 function dsabafw_validate_shipping_form_fields_func() { 870 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 867 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 868 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 871 869 die ( 'Busted!'); 872 870 } … … 876 874 $tablename = $wpdb->prefix . 'dsabafw_billingadress'; 877 875 $countries = new WC_Countries(); 878 $country = isset($_REQUEST['shipping_country']) && !empty($_REQUEST['shipping_country']) ? $_REQUEST['shipping_country']: $countries->get_base_country();876 $country = isset($_REQUEST['shipping_country']) && !empty($_REQUEST['shipping_country']) ? sanitize_text_field(wp_unslash($_REQUEST['shipping_country'])) : $countries->get_base_country(); 879 877 $address_fields = WC()->countries->get_address_fields( $country, 'shipping_' ); 880 878 … … 883 881 $field_errors = array(); 884 882 885 $billing_data['reference_field'] = sanitize_text_field($_REQUEST['reference_field']); 883 $billing_data['reference_field'] = isset( $_REQUEST['reference_field'] ) 884 ? sanitize_text_field( wp_unslash( $_REQUEST['reference_field'] ) ) 885 : ''; 886 886 887 887 if ($_REQUEST['reference_field'] == '') { … … 890 890 891 891 foreach ($address_fields as $key => $field) { 892 $billing_data[$key] = sanitize_text_field($_REQUEST[$key]);892 $billing_data[$key] = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : ''; 893 893 894 894 if ($_REQUEST[$key] == '') { … … 912 912 'userid' => $dsabafw_userid, 913 913 'userdata' => $billing_data_serlized, 914 'type' => sanitize_text_field($_REQUEST['type'])914 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 915 915 ) 916 916 ); … … 939 939 'userid' => $dsabafw_userid, 940 940 'userdata' => $billing_data_serlized, 941 'type' => sanitize_text_field($_REQUEST['type'])941 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 942 942 ); 943 943 … … 956 956 'userid' => $dsabafw_userid, 957 957 'userdata' => $billing_data_serlized, 958 'type' => sanitize_text_field($_REQUEST['type'])958 'type' => isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' 959 959 ); 960 960 … … 981 981 // For Validation Edit Billing Form Fields 982 982 function dsabafw_validate_edit_billing_form_fields_funccc() { 983 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 984 die ( 'Busted!'); 983 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 984 if ( !isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 985 die ( 'Busted!'); 985 986 } 986 987 … … 988 989 $tablename = $wpdb->prefix.'dsabafw_billingadress'; 989 990 990 $country = isset($_REQUEST['billing_country']) && !empty($_REQUEST['billing_country']) ? $_REQUEST['billing_country']: get_user_meta(get_current_user_id(), 'billing_country', true);991 $country = isset($_REQUEST['billing_country']) && !empty($_REQUEST['billing_country']) ? sanitize_text_field(wp_unslash($_REQUEST['billing_country'])) : get_user_meta(get_current_user_id(), 'billing_country', true); 991 992 992 993 $address_fields = wc()->countries->get_address_fields($country); 993 994 994 $edit_id = sanitize_text_field($_REQUEST['edit_id']);995 $edit_id = isset( $_REQUEST['edit_id'] ) ? absint( wp_unslash( $_REQUEST['edit_id'] ) ) : 0; 995 996 996 997 $dsabafw_userid= get_current_user_id(); … … 999 1000 $field_errors = array(); 1000 1001 1001 $billing_data['reference_field'] = sanitize_text_field($_REQUEST['reference_field']); 1002 $billing_data['reference_field'] = isset( $_REQUEST['reference_field'] ) 1003 ? sanitize_text_field( wp_unslash( $_REQUEST['reference_field'] ) ) 1004 : ''; 1002 1005 1003 1006 if($_REQUEST['reference_field'] == '') { … … 1006 1009 1007 1010 foreach ($address_fields as $key => $field) { 1008 $billing_data[$key] = sanitize_text_field($_REQUEST[$key]);1011 $billing_data[$key] = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : ''; 1009 1012 1010 1013 if($_REQUEST[$key] == '') { … … 1018 1021 if(empty($field_errors)) { 1019 1022 $billing_data_serlized=serialize( $billing_data ); 1020 $condition = array( 'id'=>$edit_id, 'userid' =>$dsabafw_userid, 'type' => sanitize_text_field($_REQUEST['type']));1023 $condition = array( 'id'=>$edit_id, 'userid' =>$dsabafw_userid, 'type' =>isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' ); 1021 1024 $wpdb->update($tablename, array( 'userdata' =>$billing_data_serlized),$condition); 1022 1025 $added = 'true'; … … 1032 1035 // For Validation Edit Shipping Form Fields 1033 1036 function dsabafw_validate_edit_shipping_form_fields_funcssss() { 1034 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 1035 die ( 'Busted!'); 1037 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 1038 if ( !isset( $_POST['nonce'] ) || ! wp_verify_nonce( $nonce, 'ajax-nonce') ) { 1039 die ( 'Busted!'); 1036 1040 } 1037 1041 … … 1039 1043 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 1040 1044 1041 $edit_id = sanitize_text_field($_REQUEST['edit_id']);1045 $edit_id = isset( $_REQUEST['edit_id'] ) ? absint( wp_unslash( $_REQUEST['edit_id'] ) ) : 0; 1042 1046 1043 1047 $countries = new WC_Countries(); 1044 $country = isset($_REQUEST['shipping_country']) && !empty($_REQUEST['shipping_country']) ? $_REQUEST['shipping_country']: $countries->get_base_country();1048 $country = isset($_REQUEST['shipping_country']) && !empty($_REQUEST['shipping_country']) ? sanitize_text_field(wp_unslash($_REQUEST['shipping_country'])) : $countries->get_base_country(); 1045 1049 1046 1050 $address_fields = WC()->countries->get_address_fields( $country, 'shipping_' ); … … 1051 1055 $field_errors = array(); 1052 1056 1053 $billing_data['reference_field'] = sanitize_text_field($_REQUEST['reference_field']); 1057 $billing_data['reference_field'] = isset( $_REQUEST['reference_field'] ) 1058 ? sanitize_text_field( wp_unslash( $_REQUEST['reference_field'] ) ) 1059 : ''; 1054 1060 1055 1061 if($_REQUEST['reference_field'] == '') { … … 1058 1064 1059 1065 foreach ($address_fields as $key => $field) { 1060 $billing_data[$key] = sanitize_text_field($_REQUEST[$key]);1066 $billing_data[$key] = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : ''; 1061 1067 1062 1068 if($_REQUEST[$key] == '') { … … 1071 1077 $billing_data_serlized=serialize( $billing_data ); 1072 1078 1073 $condition=array( 'id'=>$edit_id, 'userid' =>$dsabafw_userid, 'type' => sanitize_text_field($_REQUEST['type']));1079 $condition=array( 'id'=>$edit_id, 'userid' =>$dsabafw_userid, 'type' =>isset( $_REQUEST['type'] ) ? sanitize_text_field( wp_unslash($_REQUEST['type']) ) : '' ); 1074 1080 $wpdb->update($tablename,array( 'userdata' =>$billing_data_serlized),$condition); 1075 1081 $added = 'true'; … … 1087 1093 global $wpdb; 1088 1094 1089 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 1090 die ( 'Busted!'); 1095 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 1096 if ( !isset( $_REQUEST['nonce'] ) || !wp_verify_nonce( $nonce, 'ajax-nonce') ) { 1097 die ( 'Busted!'); 1091 1098 } 1092 1099 1093 1100 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 1094 $defaltadd_id = sanitize_text_field($_REQUEST['defalteaddd_id']);1095 $dealteadd_type = sanitize_text_field($_REQUEST['dealteadd_type']);1101 $defaltadd_id = isset( $_REQUEST['defalteaddd_id'] ) ? absint( wp_unslash( $_REQUEST['defalteaddd_id'] ) ) : 0;; 1102 $dealteadd_type = isset( $_REQUEST['dealteadd_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['dealteadd_type'] ) ) : ''; 1096 1103 $dsabafw_userid= get_current_user_id(); 1097 1104 … … 1110 1117 global $wpdb; 1111 1118 1112 if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' ) ) { 1113 die ( 'Busted!'); 1119 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; 1120 if ( !isset( $_REQUEST['nonce'] ) || !wp_verify_nonce( $nonce, 'ajax-nonce') ) { 1121 die ( 'Busted!'); 1114 1122 } 1115 1123 1116 1124 $tablename=$wpdb->prefix.'dsabafw_billingadress'; 1117 $defaltadd_id = sanitize_text_field($_REQUEST['defalteaddd_id']);1118 $dealteadd_type = sanitize_text_field($_REQUEST['dealteadd_type']);1125 $defaltadd_id = isset( $_REQUEST['defalteaddd_id'] ) ? absint( wp_unslash( $_REQUEST['defalteaddd_id'] ) ) : 0;; 1126 $dealteadd_type = isset( $_REQUEST['dealteadd_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['dealteadd_type'] ) ) : ''; 1119 1127 $dsabafw_userid= get_current_user_id(); 1120 1128 … … 1125 1133 exit; 1126 1134 } 1127 1128 -
different-shipping-and-billing-address-for-woocommerce/trunk/main/resources/dsabafw-installation-require.php
r3208335 r3450805 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { 3 exit; 4 } 2 5 3 6 // Check If Woocommerce Is Install Or Not -
different-shipping-and-billing-address-for-woocommerce/trunk/main/resources/dsabafw-load-js-css.php
r3445958 r3450805 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { 3 exit; 4 } 2 5 3 6 //Add JS and CSS on Backend … … 8 11 wp_enqueue_style( 'wp-color-picker' ); 9 12 wp_enqueue_script( 'wp-color-picker-alpha', DSABAFW_PLUGIN_DIR . '/assets/js/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '1.0.0', true ); 10 wp_enqueue_script( 'DSABAFW_admin_js',DSABAFW_PLUGIN_DIR . '/assets/js/back.js', array( 'jquery', 'select2'), false,'1.0.0', true );13 wp_enqueue_script( 'DSABAFW_admin_js',DSABAFW_PLUGIN_DIR . '/assets/js/back.js', array( 'jquery', 'select2'), '1.0.0', true ); 11 14 12 15 $translation_arrayimg = DSABAFW_PLUGIN_DIR; … … 30 33 31 34 wp_enqueue_style( 'DSABAFW_front_css',DSABAFW_PLUGIN_DIR . '/assets/css/front_style.css', false, '1.1.0' ); 32 wp_enqueue_script( 'DSABAFW_front_js',DSABAFW_PLUGIN_DIR . '/assets/js/front.js', array("jquery"), false,'1.0.0', true );35 wp_enqueue_script( 'DSABAFW_front_js',DSABAFW_PLUGIN_DIR . '/assets/js/front.js', array("jquery"), '1.0.0', true ); 33 36 $translation_array_img = DSABAFW_PLUGIN_DIR; 34 37 wp_localize_script( 'DSABAFW_front_js', 'DSABAFWscript',
Note: See TracChangeset
for help on using the changeset viewer.