@@ -80,6 +80,8 @@ |
||
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Maybe output or return, depending on the context |
83 | + * @param string $val |
|
84 | + * @param boolean $maybe |
|
83 | 85 | */ |
84 | 86 | private function _output_or_return( $val, $maybe ) { |
85 | 87 | if ( $maybe ) { |
@@ -294,6 +294,9 @@ discard block |
||
294 | 294 | return $this->_options; |
295 | 295 | } |
296 | 296 | |
297 | + /** |
|
298 | + * @param string $option_name |
|
299 | + */ |
|
297 | 300 | public function get_option( $option_name ) { |
298 | 301 | $options = $this->get_options(); |
299 | 302 | |
@@ -1428,6 +1431,8 @@ discard block |
||
1428 | 1431 | * Enqueues assets needed to do async loading of related posts. |
1429 | 1432 | * |
1430 | 1433 | * @uses wp_enqueue_script, wp_enqueue_style, plugins_url |
1434 | + * @param boolean $script |
|
1435 | + * @param boolean $style |
|
1431 | 1436 | * @return null |
1432 | 1437 | */ |
1433 | 1438 | protected function _enqueue_assets( $script, $style ) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * Get Stats Options. |
247 | 247 | * |
248 | 248 | * @access public |
249 | - * @param mixed $option Option. |
|
249 | + * @param string $option Option. |
|
250 | 250 | * @return mixed|null. |
251 | 251 | */ |
252 | 252 | function stats_get_option( $option ) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | * Stats Convert Chart URLs. |
652 | 652 | * |
653 | 653 | * @access public |
654 | - * @param mixed $html HTML. |
|
654 | + * @param string $html HTML. |
|
655 | 655 | * @return string |
656 | 656 | */ |
657 | 657 | function stats_convert_chart_urls( $html ) { |
@@ -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,11 +532,18 @@ 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 | } |
532 | 541 | |
533 | 542 | // Returns the site's blog_id in the WP.com ecosystem |
543 | + |
|
544 | + /** |
|
545 | + * @return integer |
|
546 | + */ |
|
534 | 547 | function get_blog_id_for_output() { |
535 | 548 | return $this->token_details['blog_id']; |
536 | 549 | } |
@@ -553,6 +566,10 @@ discard block |
||
553 | 566 | } |
554 | 567 | |
555 | 568 | // Returns true if the specified blog ID is a restricted blog |
569 | + |
|
570 | + /** |
|
571 | + * @param integer $blog_id |
|
572 | + */ |
|
556 | 573 | function is_restricted_blog( $blog_id ) { |
557 | 574 | /** |
558 | 575 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * Return an array of allowed mime_type items used to upload a media file. |
89 | 89 | * |
90 | - * @return array mime_type array |
|
90 | + * @return string[] mime_type array |
|
91 | 91 | */ |
92 | 92 | static function get_allowed_mime_types( $default_mime_types ) { |
93 | 93 | return array_unique( array_merge( $default_mime_types, array( |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param object $media_item - media post object |
255 | 255 | * @param file $file - file recently added |
256 | 256 | * @param bool $has_original_media - condition is the original media has been already added |
257 | - * @return bool `true` if the item has been added. Otherwise `false`. |
|
257 | + * @return false|null `true` if the item has been added. Otherwise `false`. |
|
258 | 258 | */ |
259 | 259 | public static function register_revision( $media_item, $file, $has_original_media ) { |
260 | 260 | if ( is_wp_error( $file ) || ! $has_original_media ) { |
@@ -282,6 +282,9 @@ discard block |
||
282 | 282 | return $original; |
283 | 283 | } |
284 | 284 | |
285 | + /** |
|
286 | + * @param string $pathname |
|
287 | + */ |
|
285 | 288 | public static function delete_file( $pathname ) { |
286 | 289 | if ( ! file_exists( $pathname ) || ! is_file( $pathname ) ) { |
287 | 290 | // let's touch a fake file to try to `really` remove the media file |
@@ -297,7 +300,7 @@ discard block |
||
297 | 300 | * |
298 | 301 | * @param number $media_id - media post ID |
299 | 302 | * @param string $filename - basename of the file ( name-of-file.ext ) |
300 | - * @return bool `true` is the file has been removed, `false` if not. |
|
303 | + * @return boolean|null `true` is the file has been removed, `false` if not. |
|
301 | 304 | */ |
302 | 305 | private static function delete_media_history_file( $media_id, $filename ) { |
303 | 306 | $attached_path = get_attached_file( $media_id ); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * Update the media post grabbing the post values from |
8 | 8 | * the `attrs` parameter |
9 | 9 | * |
10 | - * @param {Number} $media_id - post media ID |
|
10 | + * @param integer $media_id - post media ID |
|
11 | 11 | * @param {Object} $attrs - `attrs` parameter sent from the client in the request body |
12 | 12 | * @return bool|WP_Error `WP_Error` on failure. `true` on success. |
13 | 13 | */ |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Get the image from a remote url and then save it locally. |
66 | 66 | * |
67 | - * @param {Number} $media_id - media post ID |
|
67 | + * @param integer $media_id - media post ID |
|
68 | 68 | * @param {String} $url - image URL to save locally |
69 | 69 | * @return {Array|WP_Error} An array with information about the new file saved or a WP_Error is something went wrong. |
70 | 70 | */ |
@@ -536,7 +536,6 @@ discard block |
||
536 | 536 | * @uses Jetpack::disconnect(); |
537 | 537 | * @since 4.3.0 |
538 | 538 | * |
539 | - * @param WP_REST_Request $request The request sent to the WP REST API. |
|
540 | 539 | * |
541 | 540 | * @return string|WP_Error A raw URL if the connection URL could be built; error message otherwise. |
542 | 541 | */ |
@@ -556,7 +555,6 @@ discard block |
||
556 | 555 | * |
557 | 556 | * @since 4.3.0 |
558 | 557 | * |
559 | - * @param WP_REST_Request $request The request sent to the WP REST API. |
|
560 | 558 | * |
561 | 559 | * @return object |
562 | 560 | */ |
@@ -1973,7 +1971,7 @@ discard block |
||
1973 | 1971 | * |
1974 | 1972 | * @param string $route Regular expression for the endpoint with the module slug to return. |
1975 | 1973 | * |
1976 | - * @return array |
|
1974 | + * @return string |
|
1977 | 1975 | */ |
1978 | 1976 | public static function get_module_requested( $route = '/module/(?P<slug>[a-z\-]+)' ) { |
1979 | 1977 | |
@@ -1998,7 +1996,7 @@ discard block |
||
1998 | 1996 | * @param string $modules Can be a single module or a list of modules. |
1999 | 1997 | * @param null|string $slug Slug of the module in the first parameter. |
2000 | 1998 | * |
2001 | - * @return array |
|
1999 | + * @return string |
|
2002 | 2000 | */ |
2003 | 2001 | public static function prepare_modules_for_response( $modules = '', $slug = null ) { |
2004 | 2002 | global $wp_rewrite; |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | } |
901 | 901 | /** |
902 | 902 | * Does the network allow admins to add new users. |
903 | - * @return boolian |
|
903 | + * @return boolean |
|
904 | 904 | */ |
905 | 905 | static function network_add_new_users( $option = null ) { |
906 | 906 | return (bool) get_site_option( 'add_new_users' ); |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | * database which could be set to anything as opposed to what this function returns. |
1006 | 1006 | * @param bool $option |
1007 | 1007 | * |
1008 | - * @return boolean |
|
1008 | + * @return string |
|
1009 | 1009 | */ |
1010 | 1010 | public function is_main_network_option( $option ) { |
1011 | 1011 | // return '1' or '' |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | * Return true if we are with multi-site or multi-network false if we are dealing with single site. |
1017 | 1017 | * |
1018 | 1018 | * @param string $option |
1019 | - * @return boolean |
|
1019 | + * @return string |
|
1020 | 1020 | */ |
1021 | 1021 | public function is_multisite( $option ) { |
1022 | 1022 | return (string) (bool) is_multisite(); |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | |
1079 | 1079 | /** |
1080 | 1080 | * Returns true if the site has file write access false otherwise. |
1081 | - * @return string ( '1' | '0' ) |
|
1081 | + * @return integer ( '1' | '0' ) |
|
1082 | 1082 | **/ |
1083 | 1083 | public static function file_system_write_access() { |
1084 | 1084 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
@@ -1314,6 +1314,7 @@ discard block |
||
1314 | 1314 | * @access public |
1315 | 1315 | * @static |
1316 | 1316 | * |
1317 | + * @param string $feature |
|
1317 | 1318 | * @return bool True if plan supports feature, false if not |
1318 | 1319 | */ |
1319 | 1320 | public static function active_plan_supports( $feature ) { |
@@ -1812,6 +1813,7 @@ discard block |
||
1812 | 1813 | * Stores two secrets and a timestamp so WordPress.com can make a request back and verify an action |
1813 | 1814 | * Does some extra verification so urls (such as those to public-api, register, etc) can't just be crafted |
1814 | 1815 | * $name must be a registered option name. |
1816 | + * @param string $name |
|
1815 | 1817 | */ |
1816 | 1818 | public static function create_nonce( $name ) { |
1817 | 1819 | $secret = wp_generate_password( 32, false ) . ':' . wp_generate_password( 32, false ) . ':' . ( time() + 600 ); |
@@ -1869,6 +1871,7 @@ discard block |
||
1869 | 1871 | * @param int $user_id |
1870 | 1872 | * @param string $token |
1871 | 1873 | * return bool |
1874 | + * @param boolean $is_master_user |
|
1872 | 1875 | */ |
1873 | 1876 | public static function update_user_token( $user_id, $token, $is_master_user ) { |
1874 | 1877 | // not designed for concurrent updates |
@@ -2263,6 +2266,7 @@ discard block |
||
2263 | 2266 | |
2264 | 2267 | /** |
2265 | 2268 | * Like core's get_file_data implementation, but caches the result. |
2269 | + * @param string $file |
|
2266 | 2270 | */ |
2267 | 2271 | public static function get_file_data( $file, $headers ) { |
2268 | 2272 | //Get just the filename from $file (i.e. exclude full path) so that a consistent hash is generated |
@@ -2291,7 +2295,7 @@ discard block |
||
2291 | 2295 | * |
2292 | 2296 | * @param string $tag Tag as it appears in each module heading. |
2293 | 2297 | * |
2294 | - * @return mixed |
|
2298 | + * @return string |
|
2295 | 2299 | */ |
2296 | 2300 | public static function translate_module_tag( $tag ) { |
2297 | 2301 | return jetpack_get_module_i18n_tag( $tag ); |
@@ -2304,7 +2308,7 @@ discard block |
||
2304 | 2308 | * |
2305 | 2309 | * @param array $modules |
2306 | 2310 | * |
2307 | - * @return string|void |
|
2311 | + * @return string |
|
2308 | 2312 | */ |
2309 | 2313 | public static function get_translated_modules( $modules ) { |
2310 | 2314 | foreach ( $modules as $index => $module ) { |
@@ -2394,8 +2398,8 @@ discard block |
||
2394 | 2398 | * Rewrites ABSPATH (eg `/home/jetpack/wordpress/`) to ABSPATH, and if WP_CONTENT_DIR |
2395 | 2399 | * is located outside of ABSPATH, rewrites that to WP_CONTENT_DIR. |
2396 | 2400 | * |
2397 | - * @param $string |
|
2398 | - * @return mixed |
|
2401 | + * @param string $string |
|
2402 | + * @return string|null |
|
2399 | 2403 | */ |
2400 | 2404 | public static function alias_directories( $string ) { |
2401 | 2405 | // ABSPATH has a trailing slash. |
@@ -2650,6 +2654,9 @@ discard block |
||
2650 | 2654 | return self::update_active_modules( $new ); |
2651 | 2655 | } |
2652 | 2656 | |
2657 | + /** |
|
2658 | + * @param string $module |
|
2659 | + */ |
|
2653 | 2660 | public static function enable_module_configurable( $module ) { |
2654 | 2661 | $module = Jetpack::get_module_slug( $module ); |
2655 | 2662 | add_filter( 'jetpack_module_configurable_' . $module, '__return_true' ); |
@@ -2660,21 +2667,33 @@ discard block |
||
2660 | 2667 | return Jetpack::admin_url( array( 'page' => 'jetpack', 'configure' => $module ) ); |
2661 | 2668 | } |
2662 | 2669 | |
2670 | + /** |
|
2671 | + * @param string $module |
|
2672 | + */ |
|
2663 | 2673 | public static function module_configuration_load( $module, $method ) { |
2664 | 2674 | $module = Jetpack::get_module_slug( $module ); |
2665 | 2675 | add_action( 'jetpack_module_configuration_load_' . $module, $method ); |
2666 | 2676 | } |
2667 | 2677 | |
2678 | + /** |
|
2679 | + * @param string $module |
|
2680 | + */ |
|
2668 | 2681 | public static function module_configuration_head( $module, $method ) { |
2669 | 2682 | $module = Jetpack::get_module_slug( $module ); |
2670 | 2683 | add_action( 'jetpack_module_configuration_head_' . $module, $method ); |
2671 | 2684 | } |
2672 | 2685 | |
2686 | + /** |
|
2687 | + * @param string $module |
|
2688 | + */ |
|
2673 | 2689 | public static function module_configuration_screen( $module, $method ) { |
2674 | 2690 | $module = Jetpack::get_module_slug( $module ); |
2675 | 2691 | add_action( 'jetpack_module_configuration_screen_' . $module, $method ); |
2676 | 2692 | } |
2677 | 2693 | |
2694 | + /** |
|
2695 | + * @param string $module |
|
2696 | + */ |
|
2678 | 2697 | public static function module_configuration_activation_screen( $module, $method ) { |
2679 | 2698 | $module = Jetpack::get_module_slug( $module ); |
2680 | 2699 | add_action( 'display_activate_module_setting_' . $module, $method ); |
@@ -2682,6 +2701,9 @@ discard block |
||
2682 | 2701 | |
2683 | 2702 | /* Installation */ |
2684 | 2703 | |
2704 | + /** |
|
2705 | + * @param string $message |
|
2706 | + */ |
|
2685 | 2707 | public static function bail_on_activation( $message, $deactivate = true ) { |
2686 | 2708 | ?> |
2687 | 2709 | <!doctype html> |
@@ -3378,7 +3400,7 @@ discard block |
||
3378 | 3400 | * Add help to the Jetpack page |
3379 | 3401 | * |
3380 | 3402 | * @since Jetpack (1.2.3) |
3381 | - * @return false if not the Jetpack page |
|
3403 | + * @return false|null if not the Jetpack page |
|
3382 | 3404 | */ |
3383 | 3405 | function admin_help() { |
3384 | 3406 | $current_screen = get_current_screen(); |
@@ -4376,6 +4398,7 @@ discard block |
||
4376 | 4398 | /** |
4377 | 4399 | * Returns the requested Jetpack API URL |
4378 | 4400 | * |
4401 | + * @param string $relative_url |
|
4379 | 4402 | * @return string |
4380 | 4403 | */ |
4381 | 4404 | public static function api_url( $relative_url ) { |
@@ -4520,7 +4543,8 @@ discard block |
||
4520 | 4543 | * Note these tokens are unique per call, NOT static per site for connecting. |
4521 | 4544 | * |
4522 | 4545 | * @since 2.6 |
4523 | - * @return array |
|
4546 | + * @param string $action |
|
4547 | + * @return string |
|
4524 | 4548 | */ |
4525 | 4549 | public function generate_secrets( $action, $exp = 600 ) { |
4526 | 4550 | $secret = wp_generate_password( 32, false ) // secret_1 |
@@ -4953,7 +4977,6 @@ discard block |
||
4953 | 4977 | /** |
4954 | 4978 | * Report authentication status to the WP REST API. |
4955 | 4979 | * |
4956 | - * @param WP_Error|mixed $result Error from another authentication handler, null if we should handle it, or another value if not |
|
4957 | 4980 | * @return WP_Error|boolean|null {@see WP_JSON_Server::check_authentication} |
4958 | 4981 | */ |
4959 | 4982 | public function wp_rest_authentication_errors( $value ) { |
@@ -4963,6 +4986,10 @@ discard block |
||
4963 | 4986 | return $this->rest_authentication_status; |
4964 | 4987 | } |
4965 | 4988 | |
4989 | + /** |
|
4990 | + * @param integer $timestamp |
|
4991 | + * @param string $nonce |
|
4992 | + */ |
|
4966 | 4993 | function add_nonce( $timestamp, $nonce ) { |
4967 | 4994 | global $wpdb; |
4968 | 4995 | static $nonces_used_this_request = array(); |
@@ -5108,6 +5135,7 @@ discard block |
||
5108 | 5135 | * @param string $key |
5109 | 5136 | * @param string $value |
5110 | 5137 | * @param bool $restate private |
5138 | + * @return string |
|
5111 | 5139 | */ |
5112 | 5140 | public static function state( $key = null, $value = null, $restate = false ) { |
5113 | 5141 | static $state = array(); |
@@ -5164,6 +5192,9 @@ discard block |
||
5164 | 5192 | Jetpack::state( null, null, true ); |
5165 | 5193 | } |
5166 | 5194 | |
5195 | + /** |
|
5196 | + * @param string $file |
|
5197 | + */ |
|
5167 | 5198 | public static function check_privacy( $file ) { |
5168 | 5199 | static $is_site_publicly_accessible = null; |
5169 | 5200 | |
@@ -5896,8 +5927,8 @@ discard block |
||
5896 | 5927 | * - Absolute URLs `http://domain.com/feh.png` |
5897 | 5928 | * - Domain root relative URLs `/feh.png` |
5898 | 5929 | * |
5899 | - * @param $css string: The raw CSS -- should be read in directly from the file. |
|
5900 | - * @param $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
5930 | + * @param string $css string: The raw CSS -- should be read in directly from the file. |
|
5931 | + * @param string $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
5901 | 5932 | * |
5902 | 5933 | * @return mixed|string |
5903 | 5934 | */ |
@@ -6188,7 +6219,7 @@ discard block |
||
6188 | 6219 | * |
6189 | 6220 | * @param string $option_name |
6190 | 6221 | * |
6191 | - * @return bool |
|
6222 | + * @return false|null |
|
6192 | 6223 | */ |
6193 | 6224 | public static function jumpstart_has_updated_module_option( $option_name = '' ) { |
6194 | 6225 | // Bail if Jump Start has already been dismissed |
@@ -6279,7 +6310,6 @@ discard block |
||
6279 | 6310 | } |
6280 | 6311 | |
6281 | 6312 | /** |
6282 | - * @param mixed $result Value for the user's option |
|
6283 | 6313 | * @return mixed |
6284 | 6314 | */ |
6285 | 6315 | function get_user_option_meta_box_order_dashboard( $sorted ) { |
@@ -391,8 +391,8 @@ |
||
391 | 391 | * |
392 | 392 | * @param $width int Width of the image |
393 | 393 | * @param $height int Height of the image |
394 | -* @param $req_width int Required width to pass validation |
|
395 | -* @param $req_height int Required height to pass validation |
|
394 | +* @param integer $req_width int Required width to pass validation |
|
395 | +* @param integer $req_height int Required height to pass validation |
|
396 | 396 | * @return bool - True if the image passed the required size validation |
397 | 397 | */ |
398 | 398 | function _jetpack_og_get_image_validate_size($width, $height, $req_width, $req_height) { |