Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php defined( 'ABSPATH' ) || exit; use Automattic\WooCommerce\Admin\RemoteSpecs\RulePro..

Decoded Output download

<?php

defined( 'ABSPATH' ) || exit;

use Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\RuleEvaluator;

register_woocommerce_admin_test_helper_rest_route(
	'/remote-spec-validator/validate',
	'wca_test_helper_validate_remote_spec',
	array(
		'methods' => 'POST',
		'args'    => array(
			'spec' => array(
				'description'       => 'The remote spec to validate.',
				'type'              => 'string',
				'required'          => true,
				'sanitize_callback' => 'sanitize_text_field',
			),
		),
	)
);

/**
 * Test the spec.
 *
 * @param WP_REST_Request $request The full request data.
 */
function wca_test_helper_validate_remote_spec( $request ) {
	$spec           = json_decode( $request->get_param( 'spec' ) );
	$rule_evaluator = new RuleEvaluator();
	$result         = array(
		'valid' => $rule_evaluator->evaluate( $spec ),
	);

	return new WP_REST_Response( $result, 200 );
}
 ?>

Did this file decode correctly?

Original Code

<?php

defined( 'ABSPATH' ) || exit;

use Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\RuleEvaluator;

register_woocommerce_admin_test_helper_rest_route(
	'/remote-spec-validator/validate',
	'wca_test_helper_validate_remote_spec',
	array(
		'methods' => 'POST',
		'args'    => array(
			'spec' => array(
				'description'       => 'The remote spec to validate.',
				'type'              => 'string',
				'required'          => true,
				'sanitize_callback' => 'sanitize_text_field',
			),
		),
	)
);

/**
 * Test the spec.
 *
 * @param WP_REST_Request $request The full request data.
 */
function wca_test_helper_validate_remote_spec( $request ) {
	$spec           = json_decode( $request->get_param( 'spec' ) );
	$rule_evaluator = new RuleEvaluator();
	$result         = array(
		'valid' => $rule_evaluator->evaluate( $spec ),
	);

	return new WP_REST_Response( $result, 200 );
}

Function Calls

defined 1

Variables

None

Stats

MD5 b45b35f8470ee81d6aecae6f49b9099c
Eval Count 0
Decode Time 92 ms