PluginProbe
Parse.ly / 3.14.1
Parse.ly v3.14.1
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
← All changes | src/Endpoints/class-base-endpoint.php +1 -37 3.16.33.14.1 View file →
@@ -10,9 +10,8 @@
10 10
11 11 namespace Parsely\Endpoints;
12 12
13 13 use Parsely\Parsely;
14 -use WP_REST_Request;
15 14
16 15 use function Parsely\Utils\convert_endpoint_to_filter_key;
17 16
18 17 /**
@@ -57,14 +56,12 @@
57 56 * Returns whether the endpoint is available for access by the current
58 57 * user.
59 58 *
60 59 * @since 3.14.0 Replaced `is_public_endpoint`, `user_capability` and `permission_callback()`.
61 - * @since 3.16.0 Added the `$request` parameter.
62 60 *
63 - * @param WP_REST_Request|null $request The request object.
64 61 * @return bool
65 62 */
66 - abstract public function is_available_to_current_user( $request = null ): bool;
63 + abstract public function is_available_to_current_user(): bool;
67 64
68 65 /**
69 66 * Constructor.
70 67 *
@@ -152,41 +149,8 @@
152 149 'methods' => $methods,
153 150 'callback' => array( $this, $callback ),
154 151 'permission_callback' => array( $this, 'is_available_to_current_user' ),
155 152 'args' => $get_items_args,
156 - 'show_in_index' => static::is_available_to_current_user(),
157 - ),
158 - );
159 -
160 - register_rest_route( 'wp-parsely/v1', $endpoint, $rest_route_args );
161 - }
162 -
163 - /**
164 - * Registers the endpoint's WP REST route with arguments.
165 - *
166 - * @since 3.16.0
167 - *
168 - * @param string $endpoint The endpoint's route.
169 - * @param string $callback The callback function to call when the endpoint is hit.
170 - * @param array<string> $methods The HTTP methods to allow for the endpoint.
171 - * @param array<mixed> $args The arguments for the endpoint.
172 - */
173 - public function register_endpoint_with_args(
174 - string $endpoint,
175 - string $callback,
176 - array $methods = array( 'GET' ),
177 - array $args = array()
178 - ): void {
179 - if ( ! apply_filters( 'wp_parsely_enable_' . convert_endpoint_to_filter_key( $endpoint ) . '_api_proxy', true ) ) {
180 - return;
181 - }
182 -
183 - $rest_route_args = array(
184 - array(
185 - 'methods' => $methods,
186 - 'callback' => array( $this, $callback ),
187 - 'permission_callback' => array( $this, 'is_available_to_current_user' ),
188 - 'args' => $args,
189 153 'show_in_index' => static::is_available_to_current_user(),
190 154 ),
191 155 );
192 156