@@ -33,6 +33,9 @@ discard block |
||
| 33 | 33 | public $extra_headers = array(); |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | + * @param string $method |
|
| 37 | + * @param string $url |
|
| 38 | + * @param string $post_body |
|
| 36 | 39 | * @return WPCOM_JSON_API instance |
| 37 | 40 | */ |
| 38 | 41 | static function init( $method = null, $url = null, $post_body = null ) { |
@@ -335,6 +338,9 @@ discard block |
||
| 335 | 338 | return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces ); |
| 336 | 339 | } |
| 337 | 340 | |
| 341 | + /** |
|
| 342 | + * @param integer $status_code |
|
| 343 | + */ |
|
| 338 | 344 | function output_early( $status_code, $response = null, $content_type = 'application/json' ) { |
| 339 | 345 | $exit = $this->exit; |
| 340 | 346 | $this->exit = false; |
@@ -543,11 +549,18 @@ discard block |
||
| 543 | 549 | return json_encode( $data ); |
| 544 | 550 | } |
| 545 | 551 | |
| 552 | + /** |
|
| 553 | + * @param string $needle |
|
| 554 | + */ |
|
| 546 | 555 | function ends_with( $haystack, $needle ) { |
| 547 | 556 | return $needle === substr( $haystack, -strlen( $needle ) ); |
| 548 | 557 | } |
| 549 | 558 | |
| 550 | 559 | // Returns the site's blog_id in the WP.com ecosystem |
| 560 | + |
|
| 561 | + /** |
|
| 562 | + * @return integer |
|
| 563 | + */ |
|
| 551 | 564 | function get_blog_id_for_output() { |
| 552 | 565 | return $this->token_details['blog_id']; |
| 553 | 566 | } |
@@ -570,6 +583,10 @@ discard block |
||
| 570 | 583 | } |
| 571 | 584 | |
| 572 | 585 | // Returns true if the specified blog ID is a restricted blog |
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * @param integer $blog_id |
|
| 589 | + */ |
|
| 573 | 590 | function is_restricted_blog( $blog_id ) { |
| 574 | 591 | /** |
| 575 | 592 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -619,7 +636,7 @@ discard block |
||
| 619 | 636 | /** |
| 620 | 637 | * Counts the number of comments on a site, excluding certain comment types. |
| 621 | 638 | * |
| 622 | - * @param $post_id int Post ID. |
|
| 639 | + * @param integer $post_id int Post ID. |
|
| 623 | 640 | * @return array Array of counts, matching the output of https://developer.wordpress.org/reference/functions/get_comment_count/. |
| 624 | 641 | */ |
| 625 | 642 | public function wp_count_comments( $post_id ) { |