@@ -43,7 +43,7 @@ |
||
43 | 43 | /** |
44 | 44 | * This function mirrors Jetpack_Data::is_usable_domain() in the WPCOM codebase. |
45 | 45 | * |
46 | - * @param $domain |
|
46 | + * @param string|false $domain |
|
47 | 47 | * @param array $extra |
48 | 48 | * |
49 | 49 | * @return bool|WP_Error |
@@ -166,6 +166,7 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * Get attachment images for a specified post and return them. Also make sure |
168 | 168 | * their dimensions are at or above a required minimum. |
169 | + * @param integer $post_id |
|
169 | 170 | */ |
170 | 171 | static function from_attachment( $post_id, $width = 200, $height = 200 ) { |
171 | 172 | $images = array(); |
@@ -232,7 +233,7 @@ discard block |
||
232 | 233 | * format to the other images?_from_*() methods. |
233 | 234 | * |
234 | 235 | * @param int $post_id The post ID to check |
235 | - * @return Array containing details of the Featured Image, or empty array if none. |
|
236 | + * @return integer|null containing details of the Featured Image, or empty array if none. |
|
236 | 237 | */ |
237 | 238 | static function from_thumbnail( $post_id, $width = 200, $height = 200 ) { |
238 | 239 | $images = array(); |
@@ -691,7 +692,6 @@ discard block |
||
691 | 692 | * resized and cropped image. |
692 | 693 | * |
693 | 694 | * @param string $src |
694 | - * @param int $dimension |
|
695 | 695 | * @return string Transformed image URL |
696 | 696 | */ |
697 | 697 | static function fit_image_url( $src, $width, $height ) { |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @param mixed $html_or_id The HTML string to parse for images, or a post id. |
747 | 747 | * |
748 | - * @return array $html_info { |
|
748 | + * @return integer $html_info { |
|
749 | 749 | * @type string $html Post content. |
750 | 750 | * @type string $post_url Post URL. |
751 | 751 | * } |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * This is ported over from the manage module, which has been deprecated and baked in here. |
722 | 722 | * |
723 | 723 | * @param $domains |
724 | - * @return array |
|
724 | + * @return string[] |
|
725 | 725 | */ |
726 | 726 | function allow_wpcom_domain( $domains ) { |
727 | 727 | if ( empty( $domains ) ) { |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | /** |
1250 | 1250 | * Does the network allow admins to add new users. |
1251 | 1251 | * |
1252 | - * @return boolian |
|
1252 | + * @return boolean |
|
1253 | 1253 | */ |
1254 | 1254 | static function network_add_new_users( $option = null ) { |
1255 | 1255 | return (bool) get_site_option( 'add_new_users' ); |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | * |
1360 | 1360 | * @param bool $option |
1361 | 1361 | * |
1362 | - * @return boolean |
|
1362 | + * @return string |
|
1363 | 1363 | */ |
1364 | 1364 | public function is_main_network_option( $option ) { |
1365 | 1365 | // return '1' or '' |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | * Return true if we are with multi-site or multi-network false if we are dealing with single site. |
1371 | 1371 | * |
1372 | 1372 | * @param string $option |
1373 | - * @return boolean |
|
1373 | + * @return string |
|
1374 | 1374 | */ |
1375 | 1375 | public function is_multisite( $option ) { |
1376 | 1376 | return (string) (bool) is_multisite(); |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | /** |
1434 | 1434 | * Returns true if the site has file write access false otherwise. |
1435 | 1435 | * |
1436 | - * @return string ( '1' | '0' ) |
|
1436 | + * @return integer ( '1' | '0' ) |
|
1437 | 1437 | **/ |
1438 | 1438 | public static function file_system_write_access() { |
1439 | 1439 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
@@ -2176,6 +2176,7 @@ discard block |
||
2176 | 2176 | * @param int $user_id |
2177 | 2177 | * @param string $token |
2178 | 2178 | * return bool |
2179 | + * @param boolean $is_master_user |
|
2179 | 2180 | */ |
2180 | 2181 | public static function update_user_token( $user_id, $token, $is_master_user ) { |
2181 | 2182 | // not designed for concurrent updates |
@@ -2582,6 +2583,7 @@ discard block |
||
2582 | 2583 | |
2583 | 2584 | /** |
2584 | 2585 | * Like core's get_file_data implementation, but caches the result. |
2586 | + * @param string $file |
|
2585 | 2587 | */ |
2586 | 2588 | public static function get_file_data( $file, $headers ) { |
2587 | 2589 | // Get just the filename from $file (i.e. exclude full path) so that a consistent hash is generated |
@@ -2618,7 +2620,7 @@ discard block |
||
2618 | 2620 | * |
2619 | 2621 | * @param string $tag Tag as it appears in each module heading. |
2620 | 2622 | * |
2621 | - * @return mixed |
|
2623 | + * @return string |
|
2622 | 2624 | */ |
2623 | 2625 | public static function translate_module_tag( $tag ) { |
2624 | 2626 | return jetpack_get_module_i18n_tag( $tag ); |
@@ -2790,8 +2792,8 @@ discard block |
||
2790 | 2792 | * Rewrites ABSPATH (eg `/home/jetpack/wordpress/`) to ABSPATH, and if WP_CONTENT_DIR |
2791 | 2793 | * is located outside of ABSPATH, rewrites that to WP_CONTENT_DIR. |
2792 | 2794 | * |
2793 | - * @param $string |
|
2794 | - * @return mixed |
|
2795 | + * @param string $string |
|
2796 | + * @return string|null |
|
2795 | 2797 | */ |
2796 | 2798 | public static function alias_directories( $string ) { |
2797 | 2799 | // ABSPATH has a trailing slash. |
@@ -3055,6 +3057,9 @@ discard block |
||
3055 | 3057 | return self::update_active_modules( $new ); |
3056 | 3058 | } |
3057 | 3059 | |
3060 | + /** |
|
3061 | + * @param string $module |
|
3062 | + */ |
|
3058 | 3063 | public static function enable_module_configurable( $module ) { |
3059 | 3064 | $module = self::get_module_slug( $module ); |
3060 | 3065 | add_filter( 'jetpack_module_configurable_' . $module, '__return_true' ); |
@@ -3083,6 +3088,10 @@ discard block |
||
3083 | 3088 | } |
3084 | 3089 | |
3085 | 3090 | /* Installation */ |
3091 | + |
|
3092 | + /** |
|
3093 | + * @param string $message |
|
3094 | + */ |
|
3086 | 3095 | public static function bail_on_activation( $message, $deactivate = true ) { |
3087 | 3096 | ?> |
3088 | 3097 | <!doctype html> |
@@ -3837,7 +3846,7 @@ discard block |
||
3837 | 3846 | * Add help to the Jetpack page |
3838 | 3847 | * |
3839 | 3848 | * @since Jetpack (1.2.3) |
3840 | - * @return false if not the Jetpack page |
|
3849 | + * @return false|null if not the Jetpack page |
|
3841 | 3850 | */ |
3842 | 3851 | function admin_help() { |
3843 | 3852 | $current_screen = get_current_screen(); |
@@ -4702,6 +4711,9 @@ discard block |
||
4702 | 4711 | return $url; |
4703 | 4712 | } |
4704 | 4713 | |
4714 | + /** |
|
4715 | + * @return string |
|
4716 | + */ |
|
4705 | 4717 | public static function nonce_url_no_esc( $actionurl, $action = -1, $name = '_wpnonce' ) { |
4706 | 4718 | $actionurl = str_replace( '&', '&', $actionurl ); |
4707 | 4719 | return add_query_arg( $name, wp_create_nonce( $action ), $actionurl ); |
@@ -4762,6 +4774,7 @@ discard block |
||
4762 | 4774 | /** |
4763 | 4775 | * Returns the requested Jetpack API URL |
4764 | 4776 | * |
4777 | + * @param string $relative_url |
|
4765 | 4778 | * @return string |
4766 | 4779 | */ |
4767 | 4780 | public static function api_url( $relative_url ) { |
@@ -4958,6 +4971,7 @@ discard block |
||
4958 | 4971 | * Note these tokens are unique per call, NOT static per site for connecting. |
4959 | 4972 | * |
4960 | 4973 | * @since 2.6 |
4974 | + * @param string $action |
|
4961 | 4975 | * @return array |
4962 | 4976 | */ |
4963 | 4977 | public static function generate_secrets( $action, $user_id = false, $exp = 600 ) { |
@@ -5493,7 +5507,6 @@ discard block |
||
5493 | 5507 | /** |
5494 | 5508 | * Report authentication status to the WP REST API. |
5495 | 5509 | * |
5496 | - * @param WP_Error|mixed $result Error from another authentication handler, null if we should handle it, or another value if not |
|
5497 | 5510 | * @return WP_Error|boolean|null {@see WP_JSON_Server::check_authentication} |
5498 | 5511 | */ |
5499 | 5512 | public function wp_rest_authentication_errors( $value ) { |
@@ -5503,6 +5516,10 @@ discard block |
||
5503 | 5516 | return $this->rest_authentication_status; |
5504 | 5517 | } |
5505 | 5518 | |
5519 | + /** |
|
5520 | + * @param integer $timestamp |
|
5521 | + * @param string $nonce |
|
5522 | + */ |
|
5506 | 5523 | function add_nonce( $timestamp, $nonce ) { |
5507 | 5524 | global $wpdb; |
5508 | 5525 | static $nonces_used_this_request = array(); |
@@ -5648,6 +5665,7 @@ discard block |
||
5648 | 5665 | * @param string $key |
5649 | 5666 | * @param string $value |
5650 | 5667 | * @param bool $restate private |
5668 | + * @return string |
|
5651 | 5669 | */ |
5652 | 5670 | public static function state( $key = null, $value = null, $restate = false ) { |
5653 | 5671 | static $state = array(); |
@@ -5706,6 +5724,9 @@ discard block |
||
5706 | 5724 | self::state( null, null, true ); |
5707 | 5725 | } |
5708 | 5726 | |
5727 | + /** |
|
5728 | + * @param string $file |
|
5729 | + */ |
|
5709 | 5730 | public static function check_privacy( $file ) { |
5710 | 5731 | static $is_site_publicly_accessible = null; |
5711 | 5732 | |
@@ -5788,6 +5809,9 @@ discard block |
||
5788 | 5809 | } |
5789 | 5810 | } |
5790 | 5811 | |
5812 | + /** |
|
5813 | + * @param string $url |
|
5814 | + */ |
|
5791 | 5815 | public static function staticize_subdomain( $url ) { |
5792 | 5816 | |
5793 | 5817 | // Extract hostname from URL |
@@ -6350,9 +6374,7 @@ discard block |
||
6350 | 6374 | * |
6351 | 6375 | * Attached to `style_loader_src` filter. |
6352 | 6376 | * |
6353 | - * @param string $tag The tag that would link to the external asset. |
|
6354 | 6377 | * @param string $handle The registered handle of the script in question. |
6355 | - * @param string $href The url of the asset in question. |
|
6356 | 6378 | */ |
6357 | 6379 | public static function set_suffix_on_min( $src, $handle ) { |
6358 | 6380 | if ( false === strpos( $src, '.min.css' ) ) { |
@@ -6535,8 +6557,8 @@ discard block |
||
6535 | 6557 | * - Absolute URLs `http://domain.com/feh.png` |
6536 | 6558 | * - Domain root relative URLs `/feh.png` |
6537 | 6559 | * |
6538 | - * @param $css string: The raw CSS -- should be read in directly from the file. |
|
6539 | - * @param $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
6560 | + * @param string $css string: The raw CSS -- should be read in directly from the file. |
|
6561 | + * @param string $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
6540 | 6562 | * |
6541 | 6563 | * @return mixed|string |
6542 | 6564 | */ |
@@ -6779,7 +6801,7 @@ discard block |
||
6779 | 6801 | /** |
6780 | 6802 | * Stores and prints out domains to prefetch for page speed optimization. |
6781 | 6803 | * |
6782 | - * @param mixed $new_urls |
|
6804 | + * @param string[] $new_urls |
|
6783 | 6805 | */ |
6784 | 6806 | public static function dns_prefetch( $new_urls = null ) { |
6785 | 6807 | static $prefetch_urls = array(); |
@@ -6834,7 +6856,6 @@ discard block |
||
6834 | 6856 | } |
6835 | 6857 | |
6836 | 6858 | /** |
6837 | - * @param mixed $result Value for the user's option |
|
6838 | 6859 | * @return mixed |
6839 | 6860 | */ |
6840 | 6861 | function get_user_option_meta_box_order_dashboard( $sorted ) { |
@@ -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 ) { |
@@ -347,6 +350,9 @@ discard block |
||
347 | 350 | return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces ); |
348 | 351 | } |
349 | 352 | |
353 | + /** |
|
354 | + * @param integer $status_code |
|
355 | + */ |
|
350 | 356 | function output_early( $status_code, $response = null, $content_type = 'application/json' ) { |
351 | 357 | $exit = $this->exit; |
352 | 358 | $this->exit = false; |
@@ -563,11 +569,18 @@ discard block |
||
563 | 569 | return json_encode( $data ); |
564 | 570 | } |
565 | 571 | |
572 | + /** |
|
573 | + * @param string $needle |
|
574 | + */ |
|
566 | 575 | function ends_with( $haystack, $needle ) { |
567 | 576 | return $needle === substr( $haystack, -strlen( $needle ) ); |
568 | 577 | } |
569 | 578 | |
570 | 579 | // Returns the site's blog_id in the WP.com ecosystem |
580 | + |
|
581 | + /** |
|
582 | + * @return integer |
|
583 | + */ |
|
571 | 584 | function get_blog_id_for_output() { |
572 | 585 | return $this->token_details['blog_id']; |
573 | 586 | } |
@@ -590,6 +603,10 @@ discard block |
||
590 | 603 | } |
591 | 604 | |
592 | 605 | // Returns true if the specified blog ID is a restricted blog |
606 | + |
|
607 | + /** |
|
608 | + * @param integer $blog_id |
|
609 | + */ |
|
593 | 610 | function is_restricted_blog( $blog_id ) { |
594 | 611 | /** |
595 | 612 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -639,7 +656,7 @@ discard block |
||
639 | 656 | /** |
640 | 657 | * Counts the number of comments on a site, excluding certain comment types. |
641 | 658 | * |
642 | - * @param $post_id int Post ID. |
|
659 | + * @param integer $post_id int Post ID. |
|
643 | 660 | * @return array Array of counts, matching the output of https://developer.wordpress.org/reference/functions/get_comment_count/. |
644 | 661 | */ |
645 | 662 | public function wp_count_comments( $post_id ) { |