Skip to content

Commit

Permalink
Merge branch 'develop' into release/3.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Waldstein committed Jul 17, 2024
2 parents 2f0b601 + 0c9bc54 commit 031fb45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/DonationForms/V2/Endpoints/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ public function validateInt($value)
return filter_var($value, FILTER_VALIDATE_INT);
}

/**
* @unreleased
* @param string $id
* @return bool
*/
public function validatePostType(string $id)
{
return get_post_type($id) === 'give_forms';
}

/**
* Check user permissions
* @return bool|WP_Error
Expand Down
3 changes: 2 additions & 1 deletion src/DonationForms/V2/Endpoints/FormActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use WP_REST_Response;

/**
* @unreleased updated to validate form id is a donation form post type
* @since 2.19.0
*/
class FormActions extends Endpoint
Expand Down Expand Up @@ -47,7 +48,7 @@ public function registerRoute()
'required' => true,
'validate_callback' => function ($ids) {
foreach ($this->splitString($ids) as $id) {
if ( ! $this->validateInt($id)) {
if ( ! $this->validateInt($id) || !$this->validatePostType($id)) {
return false;
}
}
Expand Down

0 comments on commit 031fb45

Please sign in to comment.