@@ -31,6 +31,9 @@ discard block |
||
| 31 | 31 | public $did_output = false; |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | + * @param string $method |
|
| 35 | + * @param string $url |
|
| 36 | + * @param string $post_body |
|
| 34 | 37 | * @return WPCOM_JSON_API instance |
| 35 | 38 | */ |
| 36 | 39 | static function init( $method = null, $url = null, $post_body = null ) { |
@@ -332,6 +335,9 @@ discard block |
||
| 332 | 335 | return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces ); |
| 333 | 336 | } |
| 334 | 337 | |
| 338 | + /** |
|
| 339 | + * @param integer $status_code |
|
| 340 | + */ |
|
| 335 | 341 | function output_early( $status_code, $response = null, $content_type = 'application/json' ) { |
| 336 | 342 | $exit = $this->exit; |
| 337 | 343 | $this->exit = false; |
@@ -526,6 +532,9 @@ discard block |
||
| 526 | 532 | return json_encode( $data ); |
| 527 | 533 | } |
| 528 | 534 | |
| 535 | + /** |
|
| 536 | + * @param string $needle |
|
| 537 | + */ |
|
| 529 | 538 | function ends_with( $haystack, $needle ) { |
| 530 | 539 | return $needle === substr( $haystack, -strlen( $needle ) ); |
| 531 | 540 | } |
@@ -553,6 +562,10 @@ discard block |
||
| 553 | 562 | } |
| 554 | 563 | |
| 555 | 564 | // Returns true if the specified blog ID is a restricted blog |
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * @param integer $blog_id |
|
| 568 | + */ |
|
| 556 | 569 | function is_restricted_blog( $blog_id ) { |
| 557 | 570 | /** |
| 558 | 571 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |