@@ -29,7 +29,6 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * Used to construct meta links in API responses |
| 31 | 31 | * |
| 32 | - * @param mixed $args Optional arguments to be appended to URL |
|
| 33 | 32 | * @return string Endpoint URL |
| 34 | 33 | **/ |
| 35 | 34 | function get_link() { |
@@ -129,7 +128,7 @@ discard block |
||
| 129 | 128 | * This method is used in get_link() to construct meta links for API responses. |
| 130 | 129 | * |
| 131 | 130 | * @param $template_path string The generic endpoint path, e.g. /sites/%s |
| 132 | - * @param $path string The current endpoint path, relative to the version, e.g. /sites/12345 |
|
| 131 | + * @param string $path string The current endpoint path, relative to the version, e.g. /sites/12345 |
|
| 133 | 132 | * @param $request_method string Request method used to access the endpoint path |
| 134 | 133 | * @return string The current version, or otherwise the maximum version available |
| 135 | 134 | */ |
@@ -4,10 +4,20 @@ discard block |
||
| 4 | 4 | require_once dirname( __FILE__ ) . '/class.json-api-site-base.php'; |
| 5 | 5 | |
| 6 | 6 | abstract class Abstract_Jetpack_Site extends SAL_Site { |
| 7 | + |
|
| 8 | + /** |
|
| 9 | + * @param string $name |
|
| 10 | + */ |
|
| 7 | 11 | abstract protected function get_constant( $name ); |
| 8 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $feature_name |
|
| 15 | + */ |
|
| 9 | 16 | abstract protected function current_theme_supports( $feature_name ); |
| 10 | 17 | |
| 18 | + /** |
|
| 19 | + * @param string $feature_name |
|
| 20 | + */ |
|
| 11 | 21 | abstract protected function get_theme_support( $feature_name ); |
| 12 | 22 | |
| 13 | 23 | abstract protected function get_mock_option( $name ); |
@@ -16,6 +26,9 @@ discard block |
||
| 16 | 26 | |
| 17 | 27 | abstract public function get_updates(); |
| 18 | 28 | |
| 29 | + /** |
|
| 30 | + * @return string |
|
| 31 | + */ |
|
| 19 | 32 | abstract protected function main_network_site(); |
| 20 | 33 | |
| 21 | 34 | abstract protected function wp_version(); |
@@ -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; |
@@ -533,11 +539,18 @@ discard block |
||
| 533 | 539 | return json_encode( $data ); |
| 534 | 540 | } |
| 535 | 541 | |
| 542 | + /** |
|
| 543 | + * @param string $needle |
|
| 544 | + */ |
|
| 536 | 545 | function ends_with( $haystack, $needle ) { |
| 537 | 546 | return $needle === substr( $haystack, -strlen( $needle ) ); |
| 538 | 547 | } |
| 539 | 548 | |
| 540 | 549 | // Returns the site's blog_id in the WP.com ecosystem |
| 550 | + |
|
| 551 | + /** |
|
| 552 | + * @return integer |
|
| 553 | + */ |
|
| 541 | 554 | function get_blog_id_for_output() { |
| 542 | 555 | return $this->token_details['blog_id']; |
| 543 | 556 | } |
@@ -560,6 +573,10 @@ discard block |
||
| 560 | 573 | } |
| 561 | 574 | |
| 562 | 575 | // Returns true if the specified blog ID is a restricted blog |
| 576 | + |
|
| 577 | + /** |
|
| 578 | + * @param integer $blog_id |
|
| 579 | + */ |
|
| 563 | 580 | function is_restricted_blog( $blog_id ) { |
| 564 | 581 | /** |
| 565 | 582 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | /** |
| 246 | 246 | * A work-around / hack to make it possible to go to the media library with the add new box open. |
| 247 | 247 | * |
| 248 | - * @return bool |
|
| 248 | + * @return false|null |
|
| 249 | 249 | */ |
| 250 | 250 | public function print_in_footer_open_media_add_new() { |
| 251 | 251 | global $pagenow; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | /** |
| 340 | 340 | * @param array $extensions |
| 341 | 341 | * |
| 342 | - * @return array |
|
| 342 | + * @return string[] |
|
| 343 | 343 | */ |
| 344 | 344 | public function add_videopress_extenstion( $extensions ) { |
| 345 | 345 | $extensions[] = 'videopress'; |
@@ -283,6 +283,9 @@ |
||
| 283 | 283 | $listener->get_full_sync_queue()->reset(); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | + /** |
|
| 287 | + * @param integer $default |
|
| 288 | + */ |
|
| 286 | 289 | private function get_status_option( $name, $default = null ) { |
| 287 | 290 | $value = Jetpack_Options::get_raw_option( self::STATUS_OPTION_PREFIX . "_$name", $default ); |
| 288 | 291 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html |
| 79 | 79 | * |
| 80 | - * @param $function string name of the function |
|
| 80 | + * @param string $function string name of the function |
|
| 81 | 81 | * @param $params array functions parameters |
| 82 | 82 | * |
| 83 | 83 | * @return void |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @see https://www.elastic.co/guide/en/elasticsearch/guide/current/decay-functions.html |
| 96 | 96 | * |
| 97 | - * @param $function string name of the decay function - linear, exp, or gauss |
|
| 97 | + * @param string $function string name of the decay function - linear, exp, or gauss |
|
| 98 | 98 | * @param $params array The decay functions parameters, passed to ES directly |
| 99 | 99 | * |
| 100 | 100 | * @return void |
@@ -124,6 +124,9 @@ discard block |
||
| 124 | 124 | $this->query_bool_boost = $boost; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $aggs_name |
|
| 129 | + */ |
|
| 127 | 130 | public function add_aggs( $aggs_name, $aggs ) { |
| 128 | 131 | $this->aggs_query = true; |
| 129 | 132 | $this->aggs[$aggs_name] = $aggs; |
@@ -646,7 +646,7 @@ |
||
| 646 | 646 | * handlers should be copied when the theme context is loaded by the REST API. |
| 647 | 647 | * |
| 648 | 648 | * @param array $copy_dirs Copy paths with actions to be copied |
| 649 | - * @return array Copy paths with featured content plugin |
|
| 649 | + * @return string[] Copy paths with featured content plugin |
|
| 650 | 650 | */ |
| 651 | 651 | function wpcom_rest_api_featured_content_copy_plugin_actions( $copy_dirs ) { |
| 652 | 652 | $copy_dirs[] = __FILE__; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * Allows custom post types to be used by REST API. |
| 30 | 30 | * @param $post_types |
| 31 | 31 | * @see hook 'rest_api_allowed_post_types' |
| 32 | - * @return array |
|
| 32 | + * @return string[] |
|
| 33 | 33 | */ |
| 34 | 34 | function allow_rest_api_types( $post_types ) { |
| 35 | 35 | $post_types[] = self::$post_type_order; |
@@ -148,6 +148,7 @@ discard block |
||
| 148 | 148 | * Helper function that is used when getting home or siteurl values. Decides |
| 149 | 149 | * whether to get the raw or filtered value. |
| 150 | 150 | * |
| 151 | + * @param string $url_type |
|
| 151 | 152 | * @return string |
| 152 | 153 | */ |
| 153 | 154 | public static function get_raw_or_filtered_url( $url_type ) { |
@@ -197,6 +198,9 @@ discard block |
||
| 197 | 198 | return self::get_protocol_normalized_url( 'main_network_site_url', network_site_url() ); |
| 198 | 199 | } |
| 199 | 200 | |
| 201 | + /** |
|
| 202 | + * @param string $callable |
|
| 203 | + */ |
|
| 200 | 204 | public static function get_protocol_normalized_url( $callable, $new_value ) { |
| 201 | 205 | $option_key = self::HTTPS_CHECK_OPTION_PREFIX . $callable; |
| 202 | 206 | |
@@ -236,6 +240,9 @@ discard block |
||
| 236 | 240 | return $value; |
| 237 | 241 | } |
| 238 | 242 | |
| 243 | + /** |
|
| 244 | + * @param string $url_function |
|
| 245 | + */ |
|
| 239 | 246 | public static function normalize_www_in_url( $option, $url_function ) { |
| 240 | 247 | $url = wp_parse_url( call_user_func( $url_function ) ); |
| 241 | 248 | $option_url = wp_parse_url( get_option( $option ) ); |