@@ -8,6 +8,9 @@ |
||
| 8 | 8 | * - wp-content/rest-api-plugins/jetpack-endpoints/ |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +/** |
|
| 12 | + * @param string $file_pattern |
|
| 13 | + */ |
|
| 11 | 14 | function wpcom_rest_api_v2_load_plugin_files( $file_pattern ) { |
| 12 | 15 | $plugins = glob( dirname( __FILE__ ) . '/' . $file_pattern ); |
| 13 | 16 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * Return a hosting provider using a set of known constants. |
| 183 | 183 | * |
| 184 | - * @return mixed A host identifier string or false. |
|
| 184 | + * @return string|false A host identifier string or false. |
|
| 185 | 185 | */ |
| 186 | 186 | public function get_hosting_provider_by_known_constant() { |
| 187 | 187 | $hosting_provider_constants = array( |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * Return a hosting provider using a set of known classes. |
| 211 | 211 | * |
| 212 | - * @return mixed A host identifier string or false. |
|
| 212 | + * @return string|false A host identifier string or false. |
|
| 213 | 213 | */ |
| 214 | 214 | public function get_hosting_provider_by_known_class() { |
| 215 | 215 | $hosting_provider = false; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | /** |
| 227 | 227 | * Return a hosting provider using a set of known functions. |
| 228 | 228 | * |
| 229 | - * @return mixed A host identifier string or false. |
|
| 229 | + * @return string|false A host identifier string or false. |
|
| 230 | 230 | */ |
| 231 | 231 | public function get_hosting_provider_by_known_function() { |
| 232 | 232 | $hosting_provider = false; |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * |
| 442 | 442 | * @param string $option Option value from the site. |
| 443 | 443 | * @param callable $url_function Function retrieving the URL to normalize. |
| 444 | - * @return mixed|string URL. |
|
| 444 | + * @return callable URL. |
|
| 445 | 445 | */ |
| 446 | 446 | public static function normalize_www_in_url( $option, $url_function ) { |
| 447 | 447 | $url = wp_parse_url( call_user_func( $url_function ) ); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * Prevent adding items to the queue if it hasn't sent an item for 15 mins |
| 158 | 158 | * AND the queue is over 1000 items long (by default). |
| 159 | 159 | * |
| 160 | - * @param object $queue Sync queue. |
|
| 160 | + * @param string $queue Sync queue. |
|
| 161 | 161 | * @return bool |
| 162 | 162 | */ |
| 163 | 163 | public function can_add_to_queue( $queue ) { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * Sync Data Loss Handler |
| 361 | 361 | * |
| 362 | 362 | * @param Queue $queue Sync queue. |
| 363 | - * @return boolean was send successful |
|
| 363 | + * @return null|Items was send successful |
|
| 364 | 364 | */ |
| 365 | 365 | public function sync_data_loss( $queue ) { |
| 366 | 366 | if ( ! Settings::is_sync_enabled() ) { |
@@ -35,6 +35,9 @@ discard block |
||
| 35 | 35 | public $amp_source_origin = null; |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | + * @param string $method |
|
| 39 | + * @param string $url |
|
| 40 | + * @param string $post_body |
|
| 38 | 41 | * @return WPCOM_JSON_API instance |
| 39 | 42 | */ |
| 40 | 43 | static function init( $method = null, $url = null, $post_body = null ) { |
@@ -348,6 +351,9 @@ discard block |
||
| 348 | 351 | return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces ); |
| 349 | 352 | } |
| 350 | 353 | |
| 354 | + /** |
|
| 355 | + * @param integer $status_code |
|
| 356 | + */ |
|
| 351 | 357 | function output_early( $status_code, $response = null, $content_type = 'application/json' ) { |
| 352 | 358 | $exit = $this->exit; |
| 353 | 359 | $this->exit = false; |
@@ -572,11 +578,18 @@ discard block |
||
| 572 | 578 | return wp_json_encode( $data ); |
| 573 | 579 | } |
| 574 | 580 | |
| 581 | + /** |
|
| 582 | + * @param string $needle |
|
| 583 | + */ |
|
| 575 | 584 | function ends_with( $haystack, $needle ) { |
| 576 | 585 | return $needle === substr( $haystack, -strlen( $needle ) ); |
| 577 | 586 | } |
| 578 | 587 | |
| 579 | 588 | // Returns the site's blog_id in the WP.com ecosystem |
| 589 | + |
|
| 590 | + /** |
|
| 591 | + * @return integer |
|
| 592 | + */ |
|
| 580 | 593 | function get_blog_id_for_output() { |
| 581 | 594 | return $this->token_details['blog_id']; |
| 582 | 595 | } |
@@ -599,6 +612,10 @@ discard block |
||
| 599 | 612 | } |
| 600 | 613 | |
| 601 | 614 | // Returns true if the specified blog ID is a restricted blog |
| 615 | + |
|
| 616 | + /** |
|
| 617 | + * @param integer $blog_id |
|
| 618 | + */ |
|
| 602 | 619 | function is_restricted_blog( $blog_id ) { |
| 603 | 620 | /** |
| 604 | 621 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -648,7 +665,7 @@ discard block |
||
| 648 | 665 | /** |
| 649 | 666 | * Counts the number of comments on a site, excluding certain comment types. |
| 650 | 667 | * |
| 651 | - * @param $post_id int Post ID. |
|
| 668 | + * @param integer $post_id int Post ID. |
|
| 652 | 669 | * @return array Array of counts, matching the output of https://developer.wordpress.org/reference/functions/get_comment_count/. |
| 653 | 670 | */ |
| 654 | 671 | public function wp_count_comments( $post_id ) { |
@@ -1540,6 +1540,7 @@ discard block |
||
| 1540 | 1540 | * timezone set in the options table for the blog or the GMT offset. |
| 1541 | 1541 | * |
| 1542 | 1542 | * @param datetime string $date_string Date to parse. |
| 1543 | + * @param string $date_string |
|
| 1543 | 1544 | * |
| 1544 | 1545 | * @return array( $local_time_string, $gmt_time_string ) |
| 1545 | 1546 | */ |
@@ -1649,6 +1650,10 @@ discard block |
||
| 1649 | 1650 | do_action( 'restapi_theme_init' ); |
| 1650 | 1651 | } |
| 1651 | 1652 | |
| 1653 | + /** |
|
| 1654 | + * @param string $from_hook |
|
| 1655 | + * @param string $to_hook |
|
| 1656 | + */ |
|
| 1652 | 1657 | function copy_hooks( $from_hook, $to_hook, $base_paths ) { |
| 1653 | 1658 | global $wp_filter; |
| 1654 | 1659 | foreach ( $wp_filter as $hook => $actions ) { |
@@ -2073,7 +2078,7 @@ discard block |
||
| 2073 | 2078 | * Get an array of all valid AMP origins for a blog's siteurl. |
| 2074 | 2079 | * |
| 2075 | 2080 | * @param string $siteurl Origin url of the API request. |
| 2076 | - * @return array |
|
| 2081 | + * @return string[] |
|
| 2077 | 2082 | */ |
| 2078 | 2083 | public function get_amp_cache_origins( $siteurl ) { |
| 2079 | 2084 | $host = parse_url( $siteurl, PHP_URL_HOST ); |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | * Only enqueue block assets when needed. |
| 519 | 519 | * |
| 520 | 520 | * @param string $type Slug of the block. |
| 521 | - * @param array $script_dependencies Script dependencies. Will be merged with automatically |
|
| 521 | + * @param string[] $script_dependencies Script dependencies. Will be merged with automatically |
|
| 522 | 522 | * detected script dependencies from the webpack build. |
| 523 | 523 | * |
| 524 | 524 | * @return void |
@@ -866,10 +866,10 @@ discard block |
||
| 866 | 866 | * @since 8.3.0 |
| 867 | 867 | * |
| 868 | 868 | * @param string $url URL saved as an attribute in block. |
| 869 | - * @param array $allowed Array of allowed hosts for that block, or regexes to check against. |
|
| 869 | + * @param string[] $allowed Array of allowed hosts for that block, or regexes to check against. |
|
| 870 | 870 | * @param bool $is_regex Array of regexes matching the URL that could be used in block. |
| 871 | 871 | * |
| 872 | - * @return bool|string |
|
| 872 | + * @return false|string |
|
| 873 | 873 | */ |
| 874 | 874 | public static function validate_block_embed_url( $url, $allowed = array(), $is_regex = false ) { |
| 875 | 875 | if ( |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | * Loads an RSS feed using `fetch_feed`. |
| 59 | 59 | * |
| 60 | 60 | * @param string $feed The RSS feed URL to load. |
| 61 | - * @return SimplePie|WP_Error The RSS object or error. |
|
| 61 | + * @return string The RSS object or error. |
|
| 62 | 62 | */ |
| 63 | 63 | private static function load_feed( $feed ) { |
| 64 | 64 | $rss = fetch_feed( esc_url_raw( $feed ) ); |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | * |
| 150 | 150 | * @access public |
| 151 | 151 | * |
| 152 | - * @return int|null |
|
| 152 | + * @return null|double |
|
| 153 | 153 | */ |
| 154 | 154 | public function get_sync_progress_percentage() { |
| 155 | 155 | if ( ! $this->is_started() || $this->is_finished() ) { |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * |
| 412 | 412 | * @access public |
| 413 | 413 | * |
| 414 | - * @return int|null |
|
| 414 | + * @return null|double |
|
| 415 | 415 | */ |
| 416 | 416 | public function get_sync_progress_percentage() { |
| 417 | 417 | if ( ! $this->is_started() || $this->is_finished() ) { |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | * @access private |
| 626 | 626 | * |
| 627 | 627 | * @param string $name Name of the option. |
| 628 | - * @param mixed $default Default value of the option. |
|
| 628 | + * @param integer $default Default value of the option. |
|
| 629 | 629 | * @return mixed Option value. |
| 630 | 630 | */ |
| 631 | 631 | private function get_status_option( $name, $default = null ) { |