← All changes
|
json-endpoints/class.wpcom-json-api-bulk-update-comments-endpoint.php
+8
-1
12.2.3
→
16.3-a.1
View file →
| @@ -2,8 +2,13 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Endpoints: /sites/%s/comments/status |
| 4 | 4 | * /sites/%s/comments/delete |
| 5 | 5 | */ |
| 6 | + | |
| 7 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 8 | + exit( 0 ); | |
| 9 | +} | |
| 10 | + | |
| 6 | 11 | new WPCOM_JSON_API_Bulk_Update_Comments_Endpoint( |
| 7 | 12 | array( |
| 8 | 13 | 'description' => 'Update multiple comment\'s status.', |
| 9 | 14 | 'group' => 'comments', |
| @@ -67,8 +72,10 @@ | ||
| 67 | 72 | ); |
| 68 | 73 | |
| 69 | 74 | /** |
| 70 | 75 | * Bulk update comments endpoint class. |
| 76 | + * | |
| 77 | + * @phan-constructor-used-for-side-effects | |
| 71 | 78 | */ |
| 72 | 79 | class WPCOM_JSON_API_Bulk_Update_Comments_Endpoint extends WPCOM_JSON_API_Endpoint { |
| 73 | 80 | /** |
| 74 | 81 | * API callback. |
| @@ -104,9 +111,9 @@ | ||
| 104 | 111 | } else { |
| 105 | 112 | $result['results'] = $this->bulk_delete_comments( $comment_ids ); |
| 106 | 113 | } |
| 107 | 114 | } else { |
| 108 | - $status = isset( $input['status'] ) ? $input['status'] : ''; | |
| 115 | + $status = $input['status'] ?? ''; | |
| 109 | 116 | $result['results'] = $this->bulk_update_comments_status( $comment_ids, $status ); |
| 110 | 117 | } |
| 111 | 118 | |
| 112 | 119 | wp_defer_comment_counting( false ); |