@@ -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 | if ( ! $user_id ) { |
@@ -5038,7 +5061,6 @@ discard block |
||
| 5038 | 5061 | /** |
| 5039 | 5062 | * Report authentication status to the WP REST API. |
| 5040 | 5063 | * |
| 5041 | - * @param WP_Error|mixed $result Error from another authentication handler, null if we should handle it, or another value if not |
|
| 5042 | 5064 | * @return WP_Error|boolean|null {@see WP_JSON_Server::check_authentication} |
| 5043 | 5065 | */ |
| 5044 | 5066 | public function wp_rest_authentication_errors( $value ) { |
@@ -5048,6 +5070,10 @@ discard block |
||
| 5048 | 5070 | return $this->rest_authentication_status; |
| 5049 | 5071 | } |
| 5050 | 5072 | |
| 5073 | + /** |
|
| 5074 | + * @param integer $timestamp |
|
| 5075 | + * @param string $nonce |
|
| 5076 | + */ |
|
| 5051 | 5077 | function add_nonce( $timestamp, $nonce ) { |
| 5052 | 5078 | global $wpdb; |
| 5053 | 5079 | static $nonces_used_this_request = array(); |
@@ -5193,6 +5219,7 @@ discard block |
||
| 5193 | 5219 | * @param string $key |
| 5194 | 5220 | * @param string $value |
| 5195 | 5221 | * @param bool $restate private |
| 5222 | + * @return string |
|
| 5196 | 5223 | */ |
| 5197 | 5224 | public static function state( $key = null, $value = null, $restate = false ) { |
| 5198 | 5225 | static $state = array(); |
@@ -5249,6 +5276,9 @@ discard block |
||
| 5249 | 5276 | Jetpack::state( null, null, true ); |
| 5250 | 5277 | } |
| 5251 | 5278 | |
| 5279 | + /** |
|
| 5280 | + * @param string $file |
|
| 5281 | + */ |
|
| 5252 | 5282 | public static function check_privacy( $file ) { |
| 5253 | 5283 | static $is_site_publicly_accessible = null; |
| 5254 | 5284 | |
@@ -5981,8 +6011,8 @@ discard block |
||
| 5981 | 6011 | * - Absolute URLs `http://domain.com/feh.png` |
| 5982 | 6012 | * - Domain root relative URLs `/feh.png` |
| 5983 | 6013 | * |
| 5984 | - * @param $css string: The raw CSS -- should be read in directly from the file. |
|
| 5985 | - * @param $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
| 6014 | + * @param string $css string: The raw CSS -- should be read in directly from the file. |
|
| 6015 | + * @param string $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
| 5986 | 6016 | * |
| 5987 | 6017 | * @return mixed|string |
| 5988 | 6018 | */ |
@@ -6273,7 +6303,7 @@ discard block |
||
| 6273 | 6303 | * |
| 6274 | 6304 | * @param string $option_name |
| 6275 | 6305 | * |
| 6276 | - * @return bool |
|
| 6306 | + * @return false|null |
|
| 6277 | 6307 | */ |
| 6278 | 6308 | public static function jumpstart_has_updated_module_option( $option_name = '' ) { |
| 6279 | 6309 | // Bail if Jump Start has already been dismissed |
@@ -6364,7 +6394,6 @@ discard block |
||
| 6364 | 6394 | } |
| 6365 | 6395 | |
| 6366 | 6396 | /** |
| 6367 | - * @param mixed $result Value for the user's option |
|
| 6368 | 6397 | * @return mixed |
| 6369 | 6398 | */ |
| 6370 | 6399 | 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. |
@@ -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 | |
@@ -726,7 +726,7 @@ |
||
| 726 | 726 | * |
| 727 | 727 | * @module search |
| 728 | 728 | * |
| 729 | - * @param array $aggregations Array of Aggregations (filters) to add to the Jetpack_WPES_Query_Builder |
|
| 729 | + * @param string $aggregations Array of Aggregations (filters) to add to the Jetpack_WPES_Query_Builder |
|
| 730 | 730 | * |
| 731 | 731 | * @param Jetpack_WPES_Query_Builder $builder The builder instance that is creating the ES query |
| 732 | 732 | */ |
@@ -786,6 +786,9 @@ |
||
| 786 | 786 | $this->options_save_other( 'google_plus' ); |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | + /** |
|
| 790 | + * @param string $service_name |
|
| 791 | + */ |
|
| 789 | 792 | function options_save_other( $service_name ) { |
| 790 | 793 | // Nonce check |
| 791 | 794 | check_admin_referer( 'save_' . $service_name . '_token_' . $_REQUEST['connection'] ); |