PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.10
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.10
4.4.10 4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 All 142 releases
← All changes | inc/MCP/Auth/ApiKeyAuthenticator.php +11 -8 4.4.8 → 4.4.10 View file →
@@ -324,16 +324,19 @@
324 324 if ( '' === $request_uri ) {
325 325 return false;
326 326 }
327 327
328 - $rest_prefix = trailingslashit( rest_get_url_prefix() );
329 - $is_mcp_target = false;
330 - foreach ( $this->get_target_routes() as $route ) {
331 - $target_path = $rest_prefix . ltrim( $route, '/' );
332 - if ( false !== strpos( $request_uri, $target_path ) ) {
333 - $is_mcp_target = true;
334 - break;
335 - }
328 + $request_path = wp_parse_url( $request_uri, PHP_URL_PATH );
329 + if ( ! is_string( $request_path ) ) {
330 + return false;
331 + }
332 +
333 + $rest_prefix = '/' . trailingslashit( rest_get_url_prefix() );
334 + $prefix_position = strpos( $request_path, $rest_prefix );
335 + $is_mcp_target = false;
336 + if ( false !== $prefix_position ) {
337 + $route = '/' . ltrim( substr( $request_path, $prefix_position + strlen( $rest_prefix ) ), '/' );
338 + $is_mcp_target = $this->route_matches_mcp_target( $route );
336 339 }
337 340
338 341 return (bool) apply_filters( 'learn-press/mcp/api-keys/is-target-rest-request', $is_mcp_target, $request_uri, self::MCP_ROUTE );
339 342 }