Submit
Path:
~
/
home
/
getwphos
/
public_html
/
ppine
/
wp-content
/
plugins
/
woocommerce
/
includes
/
File Content:
wc-order-step-logger-functions.php
<?php /** * WooCommerce Order Step Logging Functions * * Tracks the steps of the checkout process for place order debugging. * * @package WooCommerce\Functions * @version 9.7.0 */ declare( strict_types=1 ); defined( 'ABSPATH' ) || exit; /** * Log an order-related message. This is not public API and should not be used by plugins or themes. * * @param string $message Message to log. * @param array|null $context Optional. Additional information for log handlers. * @param bool $final_step Optional. Whether this is the final step of the order logging, and should clear the log. * @param bool $first_step Optional. Whether this is declared the first step in order to start a new log. * * @internal This function is intended for internal use only. * @since 9.9.0 */ function wc_log_order_step( string $message, ?array $context = null, bool $final_step = false, bool $first_step = false ): void { try { if ( empty( $message ) ) { return; // Nothing to log. } static $logging_active; if ( $first_step ) { $logging_active = true; } if ( ! $logging_active ) { return; // Whenever the method is called without a started logging session, it will be ignored. } static $logger, $order_uid, $order_uid_short, $store_url; static $steps = array(); // Static array to store the messages and validate against unique messages before clearing the log. // Generate a static place order unique ID for logging purposes. When this is called multiple times in the same request, // the same UID will be used, enabling us to track recursion and race-condition issues on order processing methods // or other problems related to third-party plugins and filters. $order_uid = $order_uid ? $order_uid : wp_generate_uuid4(); $order_uid_short = $order_uid_short ? $order_uid_short : substr( $order_uid, 0, 8 ); $store_url = $store_url ? $store_url : get_site_url(); $context['order_uid'] = $order_uid; $context['source'] = 'place-order-debug-' . $order_uid_short; // Source is segmented per order unique id. $context['store_url'] = $store_url; // Extract safe data from order object. if ( isset( $context['order_object'] ) && $context['order_object'] instanceof WC_Order ) { $context = array_merge( extract_order_safe_data( $context['order_object'] ), $context ); unset( $context['order_object'] ); // This is super-important to avoid logging sensitive data. } if ( ! $logger ) { // Use a static logger instance to avoid unnecessary instantiations. $logger = new WC_Logger( null, WC_Log_Levels::DEBUG ); } if ( ! is_null( error_get_last() ) ) { $context['last_error'] = error_get_last(); } $context['backtrace'] = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 3 ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace $context['remote-logging'] = false; // forcing disable on remote logging. $steps[] = $message; // Logging the place order flow step. Log files are grouped per order to make is easier to navigate. $logger->log( WC_Log_Levels::DEBUG, $message, $context ); // Clears the log if instructed and all steps are unique. if ( $final_step && count( array_unique( $steps ) ) === count( $steps ) ) { $logger->clear( $context['source'], true ); } } catch ( Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch // Since this runs in a critical path, we need to catch any exceptions and ignore them. } } /** * Extract safe data from order object for debug temporary logging. * * @param WC_Order $order Order object. * * @internal This function is intended for internal use only. * @since 9.9.0 */ function extract_order_safe_data( WC_Order $order ) { $order_data = array( 'order_id' => $order->get_id(), 'payment_method' => $order->get_payment_method_title(), 'billing' => array( 'country' => $order->get_billing_country(), 'state' => $order->get_billing_state(), ), 'shipping' => array( 'country' => $order->get_shipping_country(), 'state' => $order->get_shipping_state(), ), 'used_coupons' => $order->get_coupon_codes(), 'totals' => array( 'subtotal' => $order->get_subtotal(), 'shipping' => $order->get_shipping_total(), 'tax' => $order->get_total_tax(), 'discount' => $order->get_discount_total(), 'total' => $order->get_total(), ), ); // Add tax breakdown. foreach ( $order->get_tax_totals() as $tax ) { $order_data['totals']['tax_breakdown'][ $tax->label ] = $tax->amount; } // Add cart items and quantities. foreach ( $order->get_items() as $item_id => $item ) { $order_data['cart_items'][] = array( 'id' => $item_id, 'product_id' => $item->get_product_id(), 'variation_id' => $item->get_variation_id(), 'quantity' => $item->get_quantity(), ); } // Add Shipping methods used. foreach ( $order->get_shipping_methods() as $method ) { $order_data['shipping_methods'][] = array( 'id' => $method->get_method_id(), 'label' => $method->get_method_title(), ); } return $order_data; }
Submit
FILE
FOLDER
Name
Size
Permission
Action
abstracts
---
0755
admin
---
0755
blocks
---
0755
cli
---
0755
customizer
---
0755
data-stores
---
0755
emails
---
0755
export
---
0755
gateways
---
0755
import
---
0755
integrations
---
0755
interfaces
---
0755
legacy
---
0755
libraries
---
0755
log-handlers
---
0755
payment-tokens
---
0755
product-usage
---
0755
queue
---
0755
react-admin
---
0755
rest-api
---
0755
shipping
---
0755
shortcodes
---
0755
theme-support
---
0755
tracks
---
0755
traits
---
0755
walkers
---
0755
wccom-site
---
0755
widgets
---
0755
class-wc-ajax.php
122567 bytes
0644
class-wc-auth.php
12995 bytes
0644
class-wc-autoloader.php
3401 bytes
0644
class-wc-background-emailer.php
4685 bytes
0644
class-wc-background-updater.php
3535 bytes
0644
class-wc-brands-brand-settings-manager.php
1826 bytes
0644
class-wc-brands-coupons.php
7059 bytes
0644
class-wc-brands.php
34095 bytes
0644
class-wc-breadcrumb.php
9722 bytes
0644
class-wc-cache-helper.php
11438 bytes
0644
class-wc-cart-fees.php
3448 bytes
0644
class-wc-cart-session.php
20140 bytes
0644
class-wc-cart-totals.php
29166 bytes
0644
class-wc-cart.php
72605 bytes
0644
class-wc-checkout.php
51349 bytes
0644
class-wc-cli.php
2935 bytes
0644
class-wc-comments.php
23066 bytes
0644
class-wc-countries.php
50342 bytes
0644
class-wc-coupon.php
40825 bytes
0644
class-wc-customer-download-log.php
3452 bytes
0644
class-wc-customer-download.php
10587 bytes
0644
class-wc-customer.php
33300 bytes
0644
class-wc-data-exception.php
1321 bytes
0644
class-wc-data-store.php
6752 bytes
0644
class-wc-datetime.php
2310 bytes
0644
class-wc-deprecated-action-hooks.php
6746 bytes
0644
class-wc-deprecated-filter-hooks.php
7518 bytes
0644
class-wc-discounts.php
37476 bytes
0644
class-wc-download-handler.php
29053 bytes
0644
class-wc-emails.php
34457 bytes
0644
class-wc-embed.php
4342 bytes
0644
class-wc-form-handler.php
46932 bytes
0644
class-wc-frontend-scripts.php
28511 bytes
0644
class-wc-geo-ip.php
31139 bytes
0644
class-wc-geolite-integration.php
2036 bytes
0644
class-wc-geolocation.php
11594 bytes
0644
class-wc-https.php
4439 bytes
0644
class-wc-install.php
109669 bytes
0644
class-wc-integrations.php
1308 bytes
0644
class-wc-log-levels.php
3992 bytes
0644
class-wc-logger.php
9601 bytes
0644
class-wc-meta-data.php
2260 bytes
0644
class-wc-order-factory.php
8728 bytes
0644
class-wc-order-item-coupon.php
4175 bytes
0644
class-wc-order-item-fee.php
9431 bytes
0644
class-wc-order-item-meta.php
5942 bytes
0644
class-wc-order-item-shipping.php
9013 bytes
0644
class-wc-order-item-tax.php
6644 bytes
0644
class-wc-order-item.php
18990 bytes
0644
class-wc-order-query.php
2615 bytes
0644
class-wc-order-refund.php
6135 bytes
0644
class-wc-order.php
76529 bytes
0644
class-wc-payment-gateways.php
16110 bytes
0644
class-wc-payment-tokens.php
6390 bytes
0644
class-wc-post-data.php
22246 bytes
0644
class-wc-post-types.php
32771 bytes
0644
class-wc-privacy-background-process.php
1833 bytes
0644
class-wc-privacy-erasers.php
13935 bytes
0644
class-wc-privacy-exporters.php
15044 bytes
0644
class-wc-privacy.php
17629 bytes
0644
class-wc-product-download.php
12547 bytes
0644
class-wc-query.php
34161 bytes
0644
class-wc-rate-limiter.php
4100 bytes
0644
class-wc-regenerate-images-request.php
7923 bytes
0644
class-wc-regenerate-images.php
15806 bytes
0644
class-wc-register-wp-admin-settings.php
5171 bytes
0644
class-wc-rest-authentication.php
22068 bytes
0644
class-wc-rest-exception.php
276 bytes
0644
class-wc-session-handler.php
21358 bytes
0644
class-wc-shipping-rate.php
9566 bytes
0644
class-wc-shipping-zone.php
13392 bytes
0644
class-wc-shipping-zones.php
4106 bytes
0644
class-wc-shipping.php
13160 bytes
0644
class-wc-shortcodes.php
19274 bytes
0644
class-wc-structured-data.php
24367 bytes
0644
class-wc-tax.php
37969 bytes
0644
class-wc-template-loader.php
21893 bytes
0644
class-wc-tracker.php
50557 bytes
0644
class-wc-validation.php
5929 bytes
0644
class-wc-webhook.php
30111 bytes
0644
class-woocommerce.php
51138 bytes
0644
wc-account-functions.php
14449 bytes
0644
wc-attribute-functions.php
21687 bytes
0644
wc-brands-functions.php
4270 bytes
0644
wc-cart-functions.php
21080 bytes
0644
wc-conditional-functions.php
14916 bytes
0644
wc-core-functions.php
88756 bytes
0644
wc-coupon-functions.php
3169 bytes
0644
wc-deprecated-functions.php
39030 bytes
0644
wc-formatting-functions.php
50031 bytes
0644
wc-notice-functions.php
8277 bytes
0644
wc-order-functions.php
41609 bytes
0644
wc-order-item-functions.php
5153 bytes
0644
wc-order-step-logger-functions.php
5135 bytes
0644
wc-page-functions.php
9657 bytes
0644
wc-product-functions.php
59920 bytes
0644
wc-stock-functions.php
17544 bytes
0644
wc-template-functions.php
135937 bytes
0644
wc-template-hooks.php
12957 bytes
0644
wc-term-functions.php
24381 bytes
0644
wc-update-functions.php
95221 bytes
0644
wc-webhook-functions.php
5905 bytes
0644
wc-widget-functions.php
2063 bytes
0644
N4ST4R_ID | Naxtarrr