PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 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 All 506 releases
← All changes | _inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-following.php +6 -11 12.8.3 → 16.3-a.7 View file →
@@ -8,8 +8,12 @@
8 8
9 9 use Automattic\Jetpack\Connection\Client;
10 10 use Automattic\Jetpack\Status\Visitor;
11 11
12 +if ( ! defined( 'ABSPATH' ) ) {
13 + exit( 0 );
14 +}
15 +
12 16 /**
13 17 * Class WPCOM_REST_API_V2_Endpoint_Following
14 18 */
15 19 class WPCOM_REST_API_V2_Endpoint_Following extends WP_REST_Controller {
@@ -47,9 +51,9 @@
47 51 array(
48 52 array(
49 53 'methods' => WP_REST_Server::READABLE,
50 54 'callback' => array( $this, 'get_following' ),
51 - 'permission_callback' => array( $this, 'permission_check' ),
55 + 'permission_callback' => 'is_user_logged_in',
52 56 'args' => array(
53 57 'ignore_user_blogs' => array(
54 58 'type' => 'boolean',
55 59 ),
@@ -64,9 +68,9 @@
64 68 array(
65 69 array(
66 70 'methods' => WP_REST_Server::READABLE,
67 71 'callback' => array( $this, 'get_recommendations' ),
68 - 'permission_callback' => array( $this, 'permission_check' ),
72 + 'permission_callback' => 'is_user_logged_in',
69 73 'args' => array(
70 74 'number' => array(
71 75 'type' => 'number',
72 76 'default' => 5,
@@ -77,17 +81,8 @@
77 81 ),
78 82 ),
79 83 )
80 84 );
81 - }
82 -
83 - /**
84 - * Check if user has edit post permission.
85 - *
86 - * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise.
87 - */
88 - public function permission_check() {
89 - return current_user_can( 'edit_posts' );
90 85 }
91 86
92 87 /**
93 88 * Gets the sites the user is following