Skip to content

Commit

Permalink
Adds vendor directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ivande committed Apr 1, 2024
1 parent 8eeca1a commit 62c5d0b
Show file tree
Hide file tree
Showing 412 changed files with 69,435 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "zeek/piwa",
"description": "",
"description": "Enables a smooth Amazon Pay integration using the WordPress block editor. Accept payments using Amazon Pay, providing a seamless experience for your customers.",
"license": "GPLv3",
"type": "project",
"type": "wordpress-plugin",
"require": {
"php": "^5.6 || ^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2",
"amzn/amazon-pay-api-sdk-php": "2.6.3",
Expand Down
17 changes: 9 additions & 8 deletions src/class-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ public function rest_get_keys( \WP_REST_Request $request ) {
'https://payments.amazon.com',
'https://sellercentral.amazon.com',
];
if ( in_array( $_SERVER['HTTP_ORIGIN'], $valid_origins, true ) ) {
$origin = $_SERVER['HTTP_ORIGIN'];
} else {

$origin = sanitize_url( $_SERVER['HTTP_ORIGIN']);

if ( !in_array( $origin, $valid_origins, true ) ) {
return new \WP_REST_Response( [ 'result' => 'error' ], 400 );
}

header( sprintf( 'Access-Control-Allow-Origin: %s', $origin ) );
header( 'Access-Control-Allow-Methods: POST' );
header( 'Access-Control-Allow-Headers: Content-Type' );
Expand Down Expand Up @@ -526,17 +528,16 @@ public function admin_menu() {
],
];

$this->register_option_sanitization_callbacks();

if (
isset( $_POST['action'] )
&& 'update' === $_POST['action']
&& wp_verify_nonce( sanitize_text_field( wp_unslash ($_POST['_wpnonce'] ) ), sprintf( '%s-options', $this->option_key ) )
&& ! empty( $_POST['piwa'] )
) {
// Before calling update_option we are calling register_option_sanitization_callbacks() to ensure the sanitize callback is registered.
// The sanitize method on this class is used to sanitize the options by data type before saving them to the database
update_option( $this->option_key, $_POST['piwa'] );

// Before saving options with run them through the sanitize method to ensure they are sanitized by data type.
$sanitizedOptionsArray = $this->sanitize($_POST['piwa']);
update_option( $this->option_key, $sanitizedOptionsArray );
}

add_menu_page(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Loading

0 comments on commit 62c5d0b

Please sign in to comment.