remove trim()s. was used twice
This commit is contained in:
@@ -279,15 +279,6 @@ function handle_postcode_modal($data)
|
||||
], 200);
|
||||
}
|
||||
|
||||
function register_modal_api()
|
||||
{
|
||||
register_rest_route("postcode-modal/v1", "submit", [
|
||||
"methods" => "POST",
|
||||
"callback" => "handle_postcode_modal",
|
||||
"permission_callback" => "__return_true",
|
||||
]);
|
||||
}
|
||||
|
||||
function verify_postcode($postcode)
|
||||
{
|
||||
if (!preg_match('/^[0-9]{4}\s?[A-Za-z]{2}$/', $postcode) === 1) {
|
||||
@@ -384,9 +375,9 @@ function modify_checkout_with_js() {
|
||||
return;
|
||||
}
|
||||
|
||||
$city = trim(esc_js( $data['city'] ));
|
||||
$postcode = trim(esc_js( preg_replace( '/(\d+)([A-Z]+)/', '$1 $2', strtoupper( $data['postcode']))));
|
||||
$address = trim(esc_js( $data['street'] . ' ' . strtoupper( $data['house_number'])));
|
||||
$city = esc_js( $data['city'] );
|
||||
$postcode = esc_js( preg_replace( '/(\d+)([A-Z]+)/', '$1 $2', strtoupper( $data['postcode'])));
|
||||
$address = esc_js( $data['street'] . ' ' . strtoupper( $data['house_number']));
|
||||
|
||||
// Enqueue script properly to handle dependencies and nonces
|
||||
wp_enqueue_script( 'jquery' );
|
||||
@@ -554,6 +545,15 @@ function load_assets_reset_postcode_on_checkout()
|
||||
}
|
||||
}
|
||||
|
||||
function register_modal_api()
|
||||
{
|
||||
register_rest_route("postcode-modal/v1", "submit", [
|
||||
"methods" => "POST",
|
||||
"callback" => "handle_postcode_modal",
|
||||
"permission_callback" => "__return_true",
|
||||
]);
|
||||
}
|
||||
|
||||
function handle_unset_session_fetch()
|
||||
{
|
||||
// Verify the nonce for security
|
||||
|
||||
Reference in New Issue
Block a user