PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | json-endpoints/class.wpcom-json-api-get-comment-counts-endpoint.php +7 -1 13.3.316.3-a.1 View file →
@@ -2,8 +2,12 @@
2 2 /**
3 3 * Endpoint: /sites/%s/comment-counts
4 4 */
5 5
6 +if ( ! defined( 'ABSPATH' ) ) {
7 + exit( 0 );
8 +}
9 +
6 10 new WPCOM_JSON_API_GET_Comment_Counts_Endpoint(
7 11 array(
8 12 'description' => 'Get comment counts for each available status',
9 13 'group' => 'comments',
@@ -33,8 +37,10 @@
33 37 );
34 38
35 39 /**
36 40 * GET Comment Counts endpoint class.
41 + *
42 + * @phan-constructor-used-for-side-effects
37 43 */
38 44 class WPCOM_JSON_API_GET_Comment_Counts_Endpoint extends WPCOM_JSON_API_Endpoint {
39 45 /**
40 46 *
@@ -53,9 +59,9 @@
53 59 if ( ! get_current_user_id() ) {
54 60 return new WP_Error( 'authorization_required', 'An active access token must be used to retrieve comment counts.', 403 );
55 61 }
56 62
57 - if ( ! current_user_can_for_blog( $blog_id, 'edit_posts' ) ) {
63 + if ( ! current_user_can_for_site( $blog_id, 'edit_posts' ) ) {
58 64 return new WP_Error( 'authorization_required', 'You are not authorized to view comment counts for this blog.', 403 );
59 65 }
60 66
61 67 $args = $this->query_args();