Skip to content

Commit

Permalink
liner fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriipavlov committed Jun 20, 2024
1 parent 1de3bf1 commit 15c7383
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Base/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function initHooks(): void
add_action('init', [Handlers\Optimization\CleanAttributes::class, 'init']);
add_action('init', [Handlers\Optimization\DisableDefaultBlocks::class, 'init']);
add_action('init', [Handlers\Security\Xmlrpc::class, 'disableXmlrpcTrackbacks']);
add_filter('rest_pre_dispatch', [Handlers\Security\RestApiFilter::class, 'restrictRestApiToWhitelistOnly'], 10, 3);
add_filter('rest_pre_dispatch', [Handlers\Security\RestApiFilter::class, 'restApiWhitelistOnly'], 10, 3);

/************************************
* Contact Form 7
Expand Down
9 changes: 5 additions & 4 deletions src/Handlers/Security/RestApiFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ class RestApiFilter
* @throws NotFoundException
* @throws NotFoundExceptionInterface
*/
public static function restrictRestApiToWhitelistOnly(mixed $result, WP_REST_Server $server, WP_REST_Request $request): mixed
{
public static function restApiWhitelistOnly(
mixed $result,
WP_REST_Server $server,
WP_REST_Request $request
): mixed {
if (!defined('REST_REQUEST') || !Config::get('security/restrictRestApiToWhitelistOnly')) {
return $result;
}
Expand Down Expand Up @@ -72,6 +75,4 @@ public static function restrictRestApiToWhitelistOnly(mixed $result, WP_REST_Ser
// ToDo return 404 template
exit;
}


}

0 comments on commit 15c7383

Please sign in to comment.