@@ -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) { |
@@ -113,6 +113,9 @@ discard block |
||
113 | 113 | wp_enqueue_script( 'a8c_wpcom_masterbar_overrides', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/masterbar-overrides/masterbar.js' ) ); |
114 | 114 | } |
115 | 115 | |
116 | + /** |
|
117 | + * @param string $file |
|
118 | + */ |
|
116 | 119 | function wpcom_static_url( $file ) { |
117 | 120 | if ( ! empty( $this->sandbox_url ) ) { |
118 | 121 | // For testing undeployed changes to remotely enqueued scripts and styles. |
@@ -295,6 +298,9 @@ discard block |
||
295 | 298 | return $primary_anchor . $secondary_anchor; |
296 | 299 | } |
297 | 300 | |
301 | + /** |
|
302 | + * @param string $class |
|
303 | + */ |
|
298 | 304 | public function create_menu_item_anchor( $class, $url, $label, $id ) { |
299 | 305 | return '<a href="' . $url . '" class="' . $class . '" id="' . $id . '">' . $label . '</a>'; |
300 | 306 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * Plugin options getter |
144 | 144 | * |
145 | - * @param string|array $option Option name |
|
145 | + * @param string $option Option name |
|
146 | 146 | * @param mixed $default Default value |
147 | 147 | * |
148 | 148 | * @return mixed Option value |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @param string $url |
171 | 171 | * |
172 | - * @return boolean |
|
172 | + * @return integer |
|
173 | 173 | */ |
174 | 174 | function soundcloud_url_has_tracklist( $url ) { |
175 | 175 | return preg_match( '/^(.+?)\/(sets|groups|playlists)\/(.+?)$/', $url ); |
@@ -153,6 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * Get attachment images for a specified post and return them. Also make sure |
155 | 155 | * their dimensions are at or above a required minimum. |
156 | + * @param integer $post_id |
|
156 | 157 | */ |
157 | 158 | static function from_attachment( $post_id, $width = 200, $height = 200 ) { |
158 | 159 | $images = array(); |
@@ -545,7 +546,6 @@ discard block |
||
545 | 546 | * resized and cropped image. |
546 | 547 | * |
547 | 548 | * @param string $src |
548 | - * @param int $dimension |
|
549 | 549 | * @return string Transformed image URL |
550 | 550 | */ |
551 | 551 | static function fit_image_url( $src, $width, $height ) { |
@@ -129,6 +129,9 @@ |
||
129 | 129 | echo '<p>' . sprintf( _x( 'Learn more about the %s', 'the Internet Defense League', 'jetpack' ), '<a href="https://www.internetdefenseleague.org/">Internet Defense League</a>' ) . '</p>'; |
130 | 130 | } |
131 | 131 | |
132 | + /** |
|
133 | + * @param string $field_name |
|
134 | + */ |
|
132 | 135 | public function select( $field_name, $options, $default = null ) { |
133 | 136 | echo '<select class="widefat" name="' . $this->get_field_name( $field_name ) . '">'; |
134 | 137 | foreach ( $options as $option_slug => $option_name ) { |
@@ -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(); |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | } |
935 | 935 | /** |
936 | 936 | * Does the network allow admins to add new users. |
937 | - * @return boolian |
|
937 | + * @return boolean |
|
938 | 938 | */ |
939 | 939 | static function network_add_new_users( $option = null ) { |
940 | 940 | return (bool) get_site_option( 'add_new_users' ); |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | * database which could be set to anything as opposed to what this function returns. |
1040 | 1040 | * @param bool $option |
1041 | 1041 | * |
1042 | - * @return boolean |
|
1042 | + * @return string |
|
1043 | 1043 | */ |
1044 | 1044 | public function is_main_network_option( $option ) { |
1045 | 1045 | // return '1' or '' |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | * Return true if we are with multi-site or multi-network false if we are dealing with single site. |
1051 | 1051 | * |
1052 | 1052 | * @param string $option |
1053 | - * @return boolean |
|
1053 | + * @return string |
|
1054 | 1054 | */ |
1055 | 1055 | public function is_multisite( $option ) { |
1056 | 1056 | return (string) (bool) is_multisite(); |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | |
1113 | 1113 | /** |
1114 | 1114 | * Returns true if the site has file write access false otherwise. |
1115 | - * @return string ( '1' | '0' ) |
|
1115 | + * @return integer ( '1' | '0' ) |
|
1116 | 1116 | **/ |
1117 | 1117 | public static function file_system_write_access() { |
1118 | 1118 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
@@ -1351,6 +1351,7 @@ discard block |
||
1351 | 1351 | * @access public |
1352 | 1352 | * @static |
1353 | 1353 | * |
1354 | + * @param string $feature |
|
1354 | 1355 | * @return bool True if plan supports feature, false if not |
1355 | 1356 | */ |
1356 | 1357 | public static function active_plan_supports( $feature ) { |
@@ -1887,6 +1888,7 @@ discard block |
||
1887 | 1888 | * @param int $user_id |
1888 | 1889 | * @param string $token |
1889 | 1890 | * return bool |
1891 | + * @param boolean $is_master_user |
|
1890 | 1892 | */ |
1891 | 1893 | public static function update_user_token( $user_id, $token, $is_master_user ) { |
1892 | 1894 | // not designed for concurrent updates |
@@ -2281,6 +2283,7 @@ discard block |
||
2281 | 2283 | |
2282 | 2284 | /** |
2283 | 2285 | * Like core's get_file_data implementation, but caches the result. |
2286 | + * @param string $file |
|
2284 | 2287 | */ |
2285 | 2288 | public static function get_file_data( $file, $headers ) { |
2286 | 2289 | //Get just the filename from $file (i.e. exclude full path) so that a consistent hash is generated |
@@ -2326,7 +2329,7 @@ discard block |
||
2326 | 2329 | * |
2327 | 2330 | * @param string $tag Tag as it appears in each module heading. |
2328 | 2331 | * |
2329 | - * @return mixed |
|
2332 | + * @return string |
|
2330 | 2333 | */ |
2331 | 2334 | public static function translate_module_tag( $tag ) { |
2332 | 2335 | return jetpack_get_module_i18n_tag( $tag ); |
@@ -2339,7 +2342,7 @@ discard block |
||
2339 | 2342 | * |
2340 | 2343 | * @param array $modules |
2341 | 2344 | * |
2342 | - * @return string|void |
|
2345 | + * @return string |
|
2343 | 2346 | */ |
2344 | 2347 | public static function get_translated_modules( $modules ) { |
2345 | 2348 | foreach ( $modules as $index => $module ) { |
@@ -2429,8 +2432,8 @@ discard block |
||
2429 | 2432 | * Rewrites ABSPATH (eg `/home/jetpack/wordpress/`) to ABSPATH, and if WP_CONTENT_DIR |
2430 | 2433 | * is located outside of ABSPATH, rewrites that to WP_CONTENT_DIR. |
2431 | 2434 | * |
2432 | - * @param $string |
|
2433 | - * @return mixed |
|
2435 | + * @param string $string |
|
2436 | + * @return string|null |
|
2434 | 2437 | */ |
2435 | 2438 | public static function alias_directories( $string ) { |
2436 | 2439 | // ABSPATH has a trailing slash. |
@@ -2685,6 +2688,9 @@ discard block |
||
2685 | 2688 | return self::update_active_modules( $new ); |
2686 | 2689 | } |
2687 | 2690 | |
2691 | + /** |
|
2692 | + * @param string $module |
|
2693 | + */ |
|
2688 | 2694 | public static function enable_module_configurable( $module ) { |
2689 | 2695 | $module = Jetpack::get_module_slug( $module ); |
2690 | 2696 | add_filter( 'jetpack_module_configurable_' . $module, '__return_true' ); |
@@ -2695,21 +2701,33 @@ discard block |
||
2695 | 2701 | return Jetpack::admin_url( array( 'page' => 'jetpack', 'configure' => $module ) ); |
2696 | 2702 | } |
2697 | 2703 | |
2704 | + /** |
|
2705 | + * @param string $module |
|
2706 | + */ |
|
2698 | 2707 | public static function module_configuration_load( $module, $method ) { |
2699 | 2708 | $module = Jetpack::get_module_slug( $module ); |
2700 | 2709 | add_action( 'jetpack_module_configuration_load_' . $module, $method ); |
2701 | 2710 | } |
2702 | 2711 | |
2712 | + /** |
|
2713 | + * @param string $module |
|
2714 | + */ |
|
2703 | 2715 | public static function module_configuration_head( $module, $method ) { |
2704 | 2716 | $module = Jetpack::get_module_slug( $module ); |
2705 | 2717 | add_action( 'jetpack_module_configuration_head_' . $module, $method ); |
2706 | 2718 | } |
2707 | 2719 | |
2720 | + /** |
|
2721 | + * @param string $module |
|
2722 | + */ |
|
2708 | 2723 | public static function module_configuration_screen( $module, $method ) { |
2709 | 2724 | $module = Jetpack::get_module_slug( $module ); |
2710 | 2725 | add_action( 'jetpack_module_configuration_screen_' . $module, $method ); |
2711 | 2726 | } |
2712 | 2727 | |
2728 | + /** |
|
2729 | + * @param string $module |
|
2730 | + */ |
|
2713 | 2731 | public static function module_configuration_activation_screen( $module, $method ) { |
2714 | 2732 | $module = Jetpack::get_module_slug( $module ); |
2715 | 2733 | add_action( 'display_activate_module_setting_' . $module, $method ); |
@@ -2717,6 +2735,9 @@ discard block |
||
2717 | 2735 | |
2718 | 2736 | /* Installation */ |
2719 | 2737 | |
2738 | + /** |
|
2739 | + * @param string $message |
|
2740 | + */ |
|
2720 | 2741 | public static function bail_on_activation( $message, $deactivate = true ) { |
2721 | 2742 | ?> |
2722 | 2743 | <!doctype html> |
@@ -3416,7 +3437,7 @@ discard block |
||
3416 | 3437 | * Add help to the Jetpack page |
3417 | 3438 | * |
3418 | 3439 | * @since Jetpack (1.2.3) |
3419 | - * @return false if not the Jetpack page |
|
3440 | + * @return false|null if not the Jetpack page |
|
3420 | 3441 | */ |
3421 | 3442 | function admin_help() { |
3422 | 3443 | $current_screen = get_current_screen(); |
@@ -4421,6 +4442,7 @@ discard block |
||
4421 | 4442 | /** |
4422 | 4443 | * Returns the requested Jetpack API URL |
4423 | 4444 | * |
4445 | + * @param string $relative_url |
|
4424 | 4446 | * @return string |
4425 | 4447 | */ |
4426 | 4448 | public static function api_url( $relative_url ) { |
@@ -4565,7 +4587,8 @@ discard block |
||
4565 | 4587 | * Note these tokens are unique per call, NOT static per site for connecting. |
4566 | 4588 | * |
4567 | 4589 | * @since 2.6 |
4568 | - * @return array |
|
4590 | + * @param string $action |
|
4591 | + * @return boolean |
|
4569 | 4592 | */ |
4570 | 4593 | public static function generate_secrets( $action, $user_id = false, $exp = 600 ) { |
4571 | 4594 | require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-options.php'; |
@@ -5047,7 +5070,6 @@ discard block |
||
5047 | 5070 | /** |
5048 | 5071 | * Report authentication status to the WP REST API. |
5049 | 5072 | * |
5050 | - * @param WP_Error|mixed $result Error from another authentication handler, null if we should handle it, or another value if not |
|
5051 | 5073 | * @return WP_Error|boolean|null {@see WP_JSON_Server::check_authentication} |
5052 | 5074 | */ |
5053 | 5075 | public function wp_rest_authentication_errors( $value ) { |
@@ -5057,6 +5079,10 @@ discard block |
||
5057 | 5079 | return $this->rest_authentication_status; |
5058 | 5080 | } |
5059 | 5081 | |
5082 | + /** |
|
5083 | + * @param integer $timestamp |
|
5084 | + * @param string $nonce |
|
5085 | + */ |
|
5060 | 5086 | function add_nonce( $timestamp, $nonce ) { |
5061 | 5087 | global $wpdb; |
5062 | 5088 | static $nonces_used_this_request = array(); |
@@ -5202,6 +5228,7 @@ discard block |
||
5202 | 5228 | * @param string $key |
5203 | 5229 | * @param string $value |
5204 | 5230 | * @param bool $restate private |
5231 | + * @return string |
|
5205 | 5232 | */ |
5206 | 5233 | public static function state( $key = null, $value = null, $restate = false ) { |
5207 | 5234 | static $state = array(); |
@@ -5258,6 +5285,9 @@ discard block |
||
5258 | 5285 | Jetpack::state( null, null, true ); |
5259 | 5286 | } |
5260 | 5287 | |
5288 | + /** |
|
5289 | + * @param string $file |
|
5290 | + */ |
|
5261 | 5291 | public static function check_privacy( $file ) { |
5262 | 5292 | static $is_site_publicly_accessible = null; |
5263 | 5293 | |
@@ -5990,8 +6020,8 @@ discard block |
||
5990 | 6020 | * - Absolute URLs `http://domain.com/feh.png` |
5991 | 6021 | * - Domain root relative URLs `/feh.png` |
5992 | 6022 | * |
5993 | - * @param $css string: The raw CSS -- should be read in directly from the file. |
|
5994 | - * @param $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
6023 | + * @param string $css string: The raw CSS -- should be read in directly from the file. |
|
6024 | + * @param string $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
5995 | 6025 | * |
5996 | 6026 | * @return mixed|string |
5997 | 6027 | */ |
@@ -6282,7 +6312,7 @@ discard block |
||
6282 | 6312 | * |
6283 | 6313 | * @param string $option_name |
6284 | 6314 | * |
6285 | - * @return bool |
|
6315 | + * @return false|null |
|
6286 | 6316 | */ |
6287 | 6317 | public static function jumpstart_has_updated_module_option( $option_name = '' ) { |
6288 | 6318 | // Bail if Jump Start has already been dismissed |
@@ -6373,7 +6403,6 @@ discard block |
||
6373 | 6403 | } |
6374 | 6404 | |
6375 | 6405 | /** |
6376 | - * @param mixed $result Value for the user's option |
|
6377 | 6406 | * @return mixed |
6378 | 6407 | */ |
6379 | 6408 | 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 ) { |
@@ -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. |