@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
| 2 | + exit; |
|
| 3 | +} |
|
| 2 | 4 | class wps_orders_in_back_office { |
| 3 | 5 | |
| 4 | 6 | function __construct() { |
@@ -31,8 +33,9 @@ discard block |
||
| 31 | 33 | */ |
| 32 | 34 | function wps_orders_scripts() { |
| 33 | 35 | global $current_screen; |
| 34 | - if( ! in_array( $current_screen->post_type, array( WPSHOP_NEWTYPE_IDENTIFIER_ORDER ), true ) ) |
|
| 35 | - return; |
|
| 36 | + if( ! in_array( $current_screen->post_type, array( WPSHOP_NEWTYPE_IDENTIFIER_ORDER ), true ) ) { |
|
| 37 | + return; |
|
| 38 | + } |
|
| 36 | 39 | |
| 37 | 40 | wp_enqueue_style( 'wps_orders_backend', WPS_ORDERS_URL . WPS_ORDERS_DIR . '/assets/backend/css/wps_orders.backend.css' ); |
| 38 | 41 | wp_enqueue_script( 'wps_orders_backend', WPS_ORDERS_URL . WPS_ORDERS_DIR . '/assets/backend/js/wps_orders.js' ); |
@@ -308,8 +311,7 @@ discard block |
||
| 308 | 311 | 'order_shipping_address' => '' |
| 309 | 312 | ) |
| 310 | 313 | ); |
| 311 | - } |
|
| 312 | - else { |
|
| 314 | + } else { |
|
| 313 | 315 | $wps_message->wpshop_prepared_email( |
| 314 | 316 | $email, |
| 315 | 317 | 'WPSHOP_ORDER_UPDATE_MESSAGE', |
@@ -334,8 +336,9 @@ discard block |
||
| 334 | 336 | function wpshop_add_private_comment_to_order() { |
| 335 | 337 | $_wpnonce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : ''; |
| 336 | 338 | |
| 337 | - if ( !wp_verify_nonce( $_wpnonce, 'wpshop_add_private_comment_to_order' ) ) |
|
| 338 | - wp_die(); |
|
| 339 | + if ( !wp_verify_nonce( $_wpnonce, 'wpshop_add_private_comment_to_order' ) ) { |
|
| 340 | + wp_die(); |
|
| 341 | + } |
|
| 339 | 342 | |
| 340 | 343 | $status = false; $result = ''; |
| 341 | 344 | $order_id = ( !empty($_POST['oid']) ) ? intval($_POST['oid']) : null; |
@@ -355,8 +358,7 @@ discard block |
||
| 355 | 358 | ob_end_clean(); |
| 356 | 359 | $status = true; |
| 357 | 360 | } |
| 358 | - } |
|
| 359 | - else { |
|
| 361 | + } else { |
|
| 360 | 362 | $result = __('An error was occured', 'wpshop'); |
| 361 | 363 | } |
| 362 | 364 | |
@@ -373,8 +375,9 @@ discard block |
||
| 373 | 375 | $letter = ( !empty($_POST['letter']) ) ? sanitize_title( $_POST['letter'] ) : ''; |
| 374 | 376 | $research = !empty( $_POST['research'] ) ? sanitize_text_field( $_POST['research'] ) : ''; |
| 375 | 377 | |
| 376 | - if ( !wp_verify_nonce( $_wpnonce, 'refresh_product_list_'.strtolower($letter) ) ) |
|
| 377 | - wp_die(); |
|
| 378 | + if ( !wp_verify_nonce( $_wpnonce, 'refresh_product_list_'.strtolower($letter) ) ) { |
|
| 379 | + wp_die(); |
|
| 380 | + } |
|
| 378 | 381 | |
| 379 | 382 | $status = false; $response = ''; |
| 380 | 383 | $oid = !empty( $_POST['oid'] ) ? (int) $_POST['oid'] : 0; |
@@ -419,8 +422,7 @@ discard block |
||
| 419 | 422 | $have_variations_checking = wpshop_products::get_variation( $product_id ); |
| 420 | 423 | if( !empty($have_variations_checking) ) { |
| 421 | 424 | $product_have_variations = true; |
| 422 | - } |
|
| 423 | - else { |
|
| 425 | + } else { |
|
| 424 | 426 | // Get Metadatas |
| 425 | 427 | $order_metadata = get_post_meta( $order_id, '_order_postmeta', true ); |
| 426 | 428 | // Calcul cart informations |
@@ -505,8 +507,9 @@ discard block |
||
| 505 | 507 | function wps_order_load_product_variations() { |
| 506 | 508 | $_wpnonce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : ''; |
| 507 | 509 | |
| 508 | - if ( !wp_verify_nonce( $_wpnonce, 'wps_order_load_product_variations' ) ) |
|
| 509 | - wp_die(); |
|
| 510 | + if ( !wp_verify_nonce( $_wpnonce, 'wps_order_load_product_variations' ) ) { |
|
| 511 | + wp_die(); |
|
| 512 | + } |
|
| 510 | 513 | |
| 511 | 514 | $product_id = ( !empty($_GET['pid']) ) ? intval( $_GET['pid']) : null; |
| 512 | 515 | $order_id = ( !empty($_GET['oid']) ) ? intval( $_GET['oid']) : null; |
@@ -521,8 +524,9 @@ discard block |
||
| 521 | 524 | function wps_orders_update_cart_informations() { |
| 522 | 525 | $_wpnonce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : ''; |
| 523 | 526 | |
| 524 | - if ( !wp_verify_nonce( $_wpnonce, 'wps_orders_update_cart_informations' ) ) |
|
| 525 | - wp_die(); |
|
| 527 | + if ( !wp_verify_nonce( $_wpnonce, 'wps_orders_update_cart_informations' ) ) { |
|
| 528 | + wp_die(); |
|
| 529 | + } |
|
| 526 | 530 | |
| 527 | 531 | $status = false; |
| 528 | 532 | $order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : ''; |
@@ -553,14 +557,16 @@ discard block |
||
| 553 | 557 | function wps_reverify_payment_invoice_ref() { |
| 554 | 558 | $_wpnonce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : ''; |
| 555 | 559 | |
| 556 | - if ( !wp_verify_nonce( $_wpnonce, 'wps_reverify_payment_invoice_ref' ) ) |
|
| 557 | - wp_die(); |
|
| 560 | + if ( !wp_verify_nonce( $_wpnonce, 'wps_reverify_payment_invoice_ref' ) ) { |
|
| 561 | + wp_die(); |
|
| 562 | + } |
|
| 558 | 563 | |
| 559 | 564 | $status = true; |
| 560 | 565 | $inputs = !empty( $_POST['inputs'] ) ? (array) $_POST['inputs'] : false; |
| 561 | 566 | |
| 562 | - if (!$inputs) |
|
| 563 | - $status = false; |
|
| 567 | + if (!$inputs) { |
|
| 568 | + $status = false; |
|
| 569 | + } |
|
| 564 | 570 | |
| 565 | 571 | if( $status ) { |
| 566 | 572 | $inputs_clone = $inputs; |