PluginProbe
Parse.ly / 3.8.4
Parse.ly v3.8.4
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/RemoteAPI/class-analytics-posts-api.php +8 -33 3.16.03.8.4 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 - * Class for Analytics Posts API (`/analytics/posts`).
3 + * Class for Analytics Posts API (`/analytics/post`).
4 4 *
5 5 * @package Parsely
6 6 * @since 3.4.0
7 7 */
@@ -9,15 +9,13 @@
9 9 declare(strict_types=1);
10 10
11 11 namespace Parsely\RemoteAPI;
12 12
13 -use Parsely\Endpoints\Base_Endpoint;
14 13 use Parsely\Parsely;
15 14 use WP_Error;
16 -use WP_REST_Request;
17 15
18 16 /**
19 - * Class for Analytics Posts API (`/analytics/posts`).
17 + * Class for Analytics Posts API (`/analytics/post`).
20 18 *
21 19 * @since 3.4.0
22 20 *
23 21 * @phpstan-type Analytics_Post_API_Params array{
@@ -52,34 +50,23 @@
52 50 * views?: int,
53 51 * visitors?: int,
54 52 * }
55 53 */
56 -class Analytics_Posts_API extends Base_Endpoint_Remote {
54 +class Analytics_Posts_API extends Remote_API_Base {
57 55 public const MAX_RECORDS_LIMIT = 2000;
58 56 public const ANALYTICS_API_DAYS_LIMIT = 7;
59 57
60 - protected const API_BASE_URL = Parsely::PUBLIC_API_BASE_URL;
61 58 protected const ENDPOINT = '/analytics/posts';
62 59 protected const QUERY_FILTER = 'wp_parsely_analytics_posts_endpoint_args';
63 60
64 61 /**
65 - * Returns whether the endpoint is available for access by the current
66 - * user.
62 + * Indicates whether the endpoint is public or protected behind permissions.
67 63 *
68 - * @since 3.14.0
69 - * @since 3.16.0 Added the `$request` parameter.
64 + * @since 3.7.0
70 65 *
71 - * @param WP_REST_Request|null $request The request object.
72 - * @return bool
66 + * @var bool
73 67 */
74 - public function is_available_to_current_user( $request = null ): bool {
75 - return current_user_can(
76 - // phpcs:ignore WordPress.WP.Capabilities.Undetermined
77 - $this->apply_capability_filters(
78 - Base_Endpoint::DEFAULT_ACCESS_CAPABILITY
79 - )
80 - );
81 - }
68 + protected $is_public_endpoint = false;
82 69
83 70 /**
84 71 * Calls Parse.ly Analytics API to get posts info.
85 72 *
@@ -85,23 +72,11 @@
85 72 *
86 73 * Main purpose of this function is to enforce typing.
87 74 *
88 75 * @param Analytics_Post_API_Params $api_params Parameters of the API.
76 + *
89 77 * @return Analytics_Post[]|WP_Error|null
90 78 */
91 79 public function get_posts_analytics( $api_params ) {
92 80 return $this->get_items( $api_params, true ); // @phpstan-ignore-line
93 - }
94 -
95 - /**
96 - * Returns the request's options for the remote API call.
97 - *
98 - * @since 3.9.0
99 - *
100 - * @return array<string, mixed> The array of options.
101 - */
102 - public function get_request_options(): array {
103 - return array(
104 - 'timeout' => 30, // phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout
105 - );
106 81 }
107 82 }