@@ -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 ) { |
@@ -337,6 +340,9 @@ discard block |
||
| 337 | 340 | return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces ); |
| 338 | 341 | } |
| 339 | 342 | |
| 343 | + /** |
|
| 344 | + * @param integer $status_code |
|
| 345 | + */ |
|
| 340 | 346 | function output_early( $status_code, $response = null, $content_type = 'application/json' ) { |
| 341 | 347 | $exit = $this->exit; |
| 342 | 348 | $this->exit = false; |
@@ -545,11 +551,18 @@ discard block |
||
| 545 | 551 | return wp_json_encode( $data ); |
| 546 | 552 | } |
| 547 | 553 | |
| 554 | + /** |
|
| 555 | + * @param string $needle |
|
| 556 | + */ |
|
| 548 | 557 | function ends_with( $haystack, $needle ) { |
| 549 | 558 | return $needle === substr( $haystack, -strlen( $needle ) ); |
| 550 | 559 | } |
| 551 | 560 | |
| 552 | 561 | // Returns the site's blog_id in the WP.com ecosystem |
| 562 | + |
|
| 563 | + /** |
|
| 564 | + * @return integer |
|
| 565 | + */ |
|
| 553 | 566 | function get_blog_id_for_output() { |
| 554 | 567 | return $this->token_details['blog_id']; |
| 555 | 568 | } |
@@ -572,6 +585,10 @@ discard block |
||
| 572 | 585 | } |
| 573 | 586 | |
| 574 | 587 | // Returns true if the specified blog ID is a restricted blog |
| 588 | + |
|
| 589 | + /** |
|
| 590 | + * @param integer $blog_id |
|
| 591 | + */ |
|
| 575 | 592 | function is_restricted_blog( $blog_id ) { |
| 576 | 593 | /** |
| 577 | 594 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -621,7 +638,7 @@ discard block |
||
| 621 | 638 | /** |
| 622 | 639 | * Counts the number of comments on a site, excluding certain comment types. |
| 623 | 640 | * |
| 624 | - * @param $post_id int Post ID. |
|
| 641 | + * @param integer $post_id int Post ID. |
|
| 625 | 642 | * @return array Array of counts, matching the output of https://developer.wordpress.org/reference/functions/get_comment_count/. |
| 626 | 643 | */ |
| 627 | 644 | public function wp_count_comments( $post_id ) { |