@@ -4,12 +4,27 @@ |
||
| 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 | |
| 23 | + /** |
|
| 24 | + * @param string $name |
|
| 25 | + * |
|
| 26 | + * @return string |
|
| 27 | + */ |
|
| 13 | 28 | abstract protected function get_mock_option( $name ); |
| 14 | 29 | |
| 15 | 30 | abstract protected function get_jetpack_version(); |
@@ -16,6 +16,9 @@ discard block |
||
| 16 | 16 | public $context; |
| 17 | 17 | public $site; |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param Jetpack_Site $site |
|
| 21 | + */ |
|
| 19 | 22 | function __construct( $site, $post, $context ) { |
| 20 | 23 | $this->post = $post; |
| 21 | 24 | $this->context = $context; |
@@ -487,6 +490,10 @@ discard block |
||
| 487 | 490 | return $suggestions; |
| 488 | 491 | } |
| 489 | 492 | |
| 493 | + /** |
|
| 494 | + * @param string $taxonomy_type |
|
| 495 | + * @param string $context |
|
| 496 | + */ |
|
| 490 | 497 | private function format_taxonomy( $taxonomy, $taxonomy_type, $context ) { |
| 491 | 498 | // Permissions |
| 492 | 499 | switch ( $context ) { |
@@ -16,6 +16,9 @@ discard block |
||
| 16 | 16 | public $blog_id; |
| 17 | 17 | public $platform; |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param WPORG_Platform $platform |
|
| 21 | + */ |
|
| 19 | 22 | public function __construct( $blog_id, $platform ) { |
| 20 | 23 | $this->blog_id = $blog_id; |
| 21 | 24 | $this->platform = $platform; |
@@ -92,6 +95,9 @@ discard block |
||
| 92 | 95 | abstract public function wrap_post( $post, $context ); |
| 93 | 96 | |
| 94 | 97 | |
| 98 | + /** |
|
| 99 | + * @param string $context |
|
| 100 | + */ |
|
| 95 | 101 | public function get_post_by_id( $post_id, $context ) { |
| 96 | 102 | $post = get_post( $post_id, OBJECT, $context ); |
| 97 | 103 | |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | } |
| 1027 | 1027 | /** |
| 1028 | 1028 | * Does the network allow admins to add new users. |
| 1029 | - * @return boolian |
|
| 1029 | + * @return boolean |
|
| 1030 | 1030 | */ |
| 1031 | 1031 | static function network_add_new_users( $option = null ) { |
| 1032 | 1032 | return (bool) get_site_option( 'add_new_users' ); |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | * database which could be set to anything as opposed to what this function returns. |
| 1075 | 1075 | * @param bool $option |
| 1076 | 1076 | * |
| 1077 | - * @return boolean |
|
| 1077 | + * @return string |
|
| 1078 | 1078 | */ |
| 1079 | 1079 | public function is_main_network_option( $option ) { |
| 1080 | 1080 | // return '1' or '' |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | * Return true if we are with multi-site or multi-network false if we are dealing with single site. |
| 1086 | 1086 | * |
| 1087 | 1087 | * @param string $option |
| 1088 | - * @return boolean |
|
| 1088 | + * @return string |
|
| 1089 | 1089 | */ |
| 1090 | 1090 | public function is_multisite( $option ) { |
| 1091 | 1091 | return (string) (bool) is_multisite(); |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | * Returns the requested option. Looks in jetpack_options or jetpack_$name as appropriate. |
| 1725 | 1725 | * |
| 1726 | 1726 | * @param string $name Option name |
| 1727 | - * @param mixed $default (optional) |
|
| 1727 | + * @param boolean $default (optional) |
|
| 1728 | 1728 | */ |
| 1729 | 1729 | public static function get_option( $name, $default = false ) { |
| 1730 | 1730 | return Jetpack_Options::get_option( $name, $default ); |
@@ -1734,6 +1734,7 @@ discard block |
||
| 1734 | 1734 | * Stores two secrets and a timestamp so WordPress.com can make a request back and verify an action |
| 1735 | 1735 | * Does some extra verification so urls (such as those to public-api, register, etc) can't just be crafted |
| 1736 | 1736 | * $name must be a registered option name. |
| 1737 | + * @param string $name |
|
| 1737 | 1738 | */ |
| 1738 | 1739 | public static function create_nonce( $name ) { |
| 1739 | 1740 | $secret = wp_generate_password( 32, false ) . ':' . wp_generate_password( 32, false ) . ':' . ( time() + 600 ); |
@@ -1791,6 +1792,7 @@ discard block |
||
| 1791 | 1792 | * @param int $user_id |
| 1792 | 1793 | * @param string $token |
| 1793 | 1794 | * return bool |
| 1795 | + * @param boolean $is_master_user |
|
| 1794 | 1796 | */ |
| 1795 | 1797 | public static function update_user_token( $user_id, $token, $is_master_user ) { |
| 1796 | 1798 | // not designed for concurrent updates |
@@ -2185,6 +2187,7 @@ discard block |
||
| 2185 | 2187 | |
| 2186 | 2188 | /** |
| 2187 | 2189 | * Like core's get_file_data implementation, but caches the result. |
| 2190 | + * @param string $file |
|
| 2188 | 2191 | */ |
| 2189 | 2192 | public static function get_file_data( $file, $headers ) { |
| 2190 | 2193 | //Get just the filename from $file (i.e. exclude full path) so that a consistent hash is generated |
@@ -2213,7 +2216,7 @@ discard block |
||
| 2213 | 2216 | * |
| 2214 | 2217 | * @param string $tag Tag as it appears in each module heading. |
| 2215 | 2218 | * |
| 2216 | - * @return mixed |
|
| 2219 | + * @return string |
|
| 2217 | 2220 | */ |
| 2218 | 2221 | public static function translate_module_tag( $tag ) { |
| 2219 | 2222 | return jetpack_get_module_i18n_tag( $tag ); |
@@ -2529,6 +2532,9 @@ discard block |
||
| 2529 | 2532 | do_action( "jetpack_activate_module_$module", $module ); |
| 2530 | 2533 | } |
| 2531 | 2534 | |
| 2535 | + /** |
|
| 2536 | + * @return string |
|
| 2537 | + */ |
|
| 2532 | 2538 | public static function deactivate_module( $module ) { |
| 2533 | 2539 | /** |
| 2534 | 2540 | * Fires when a module is deactivated. |
@@ -2567,6 +2573,9 @@ discard block |
||
| 2567 | 2573 | return Jetpack_Options::update_option( 'active_modules', array_unique( $new ) ); |
| 2568 | 2574 | } |
| 2569 | 2575 | |
| 2576 | + /** |
|
| 2577 | + * @param string $module |
|
| 2578 | + */ |
|
| 2570 | 2579 | public static function enable_module_configurable( $module ) { |
| 2571 | 2580 | $module = Jetpack::get_module_slug( $module ); |
| 2572 | 2581 | add_filter( 'jetpack_module_configurable_' . $module, '__return_true' ); |
@@ -2577,21 +2586,33 @@ discard block |
||
| 2577 | 2586 | return Jetpack::admin_url( array( 'page' => 'jetpack', 'configure' => $module ) ); |
| 2578 | 2587 | } |
| 2579 | 2588 | |
| 2589 | + /** |
|
| 2590 | + * @param string $module |
|
| 2591 | + */ |
|
| 2580 | 2592 | public static function module_configuration_load( $module, $method ) { |
| 2581 | 2593 | $module = Jetpack::get_module_slug( $module ); |
| 2582 | 2594 | add_action( 'jetpack_module_configuration_load_' . $module, $method ); |
| 2583 | 2595 | } |
| 2584 | 2596 | |
| 2597 | + /** |
|
| 2598 | + * @param string $module |
|
| 2599 | + */ |
|
| 2585 | 2600 | public static function module_configuration_head( $module, $method ) { |
| 2586 | 2601 | $module = Jetpack::get_module_slug( $module ); |
| 2587 | 2602 | add_action( 'jetpack_module_configuration_head_' . $module, $method ); |
| 2588 | 2603 | } |
| 2589 | 2604 | |
| 2605 | + /** |
|
| 2606 | + * @param string $module |
|
| 2607 | + */ |
|
| 2590 | 2608 | public static function module_configuration_screen( $module, $method ) { |
| 2591 | 2609 | $module = Jetpack::get_module_slug( $module ); |
| 2592 | 2610 | add_action( 'jetpack_module_configuration_screen_' . $module, $method ); |
| 2593 | 2611 | } |
| 2594 | 2612 | |
| 2613 | + /** |
|
| 2614 | + * @param string $module |
|
| 2615 | + */ |
|
| 2595 | 2616 | public static function module_configuration_activation_screen( $module, $method ) { |
| 2596 | 2617 | $module = Jetpack::get_module_slug( $module ); |
| 2597 | 2618 | add_action( 'display_activate_module_setting_' . $module, $method ); |
@@ -2599,6 +2620,9 @@ discard block |
||
| 2599 | 2620 | |
| 2600 | 2621 | /* Installation */ |
| 2601 | 2622 | |
| 2623 | + /** |
|
| 2624 | + * @param string $message |
|
| 2625 | + */ |
|
| 2602 | 2626 | public static function bail_on_activation( $message, $deactivate = true ) { |
| 2603 | 2627 | ?> |
| 2604 | 2628 | <!doctype html> |
@@ -3185,7 +3209,7 @@ discard block |
||
| 3185 | 3209 | * Add help to the Jetpack page |
| 3186 | 3210 | * |
| 3187 | 3211 | * @since Jetpack (1.2.3) |
| 3188 | - * @return false if not the Jetpack page |
|
| 3212 | + * @return false|null if not the Jetpack page |
|
| 3189 | 3213 | */ |
| 3190 | 3214 | function admin_help() { |
| 3191 | 3215 | $current_screen = get_current_screen(); |
@@ -4480,6 +4504,7 @@ discard block |
||
| 4480 | 4504 | /** |
| 4481 | 4505 | * Returns the requested Jetpack API URL |
| 4482 | 4506 | * |
| 4507 | + * @param string $relative_url |
|
| 4483 | 4508 | * @return string |
| 4484 | 4509 | */ |
| 4485 | 4510 | public static function api_url( $relative_url ) { |
@@ -4906,6 +4931,10 @@ discard block |
||
| 4906 | 4931 | return new WP_User( $token_details['user_id'] ); |
| 4907 | 4932 | } |
| 4908 | 4933 | |
| 4934 | + /** |
|
| 4935 | + * @param integer $timestamp |
|
| 4936 | + * @param string $nonce |
|
| 4937 | + */ |
|
| 4909 | 4938 | function add_nonce( $timestamp, $nonce ) { |
| 4910 | 4939 | global $wpdb; |
| 4911 | 4940 | static $nonces_used_this_request = array(); |
@@ -5111,6 +5140,9 @@ discard block |
||
| 5111 | 5140 | Jetpack::state( null, null, true ); |
| 5112 | 5141 | } |
| 5113 | 5142 | |
| 5143 | + /** |
|
| 5144 | + * @param string $file |
|
| 5145 | + */ |
|
| 5114 | 5146 | public static function check_privacy( $file ) { |
| 5115 | 5147 | static $is_site_publicly_accessible = null; |
| 5116 | 5148 | |
@@ -5438,7 +5470,7 @@ discard block |
||
| 5438 | 5470 | /** |
| 5439 | 5471 | * Pings the WordPress.com Mirror Site for the specified options. |
| 5440 | 5472 | * |
| 5441 | - * @param string|array $option_names The option names to request from the WordPress.com Mirror Site |
|
| 5473 | + * @param string[] $option_names The option names to request from the WordPress.com Mirror Site |
|
| 5442 | 5474 | * |
| 5443 | 5475 | * @return array An associative array of the option values as stored in the WordPress.com Mirror Site |
| 5444 | 5476 | */ |
@@ -5462,7 +5494,7 @@ discard block |
||
| 5462 | 5494 | /** |
| 5463 | 5495 | * Fetch the filtered array of options that we should compare to determine an identity crisis. |
| 5464 | 5496 | * |
| 5465 | - * @return array An array of options to check. |
|
| 5497 | + * @return string[] An array of options to check. |
|
| 5466 | 5498 | */ |
| 5467 | 5499 | public static function identity_crisis_options_to_check() { |
| 5468 | 5500 | return array( |
@@ -6133,8 +6165,8 @@ discard block |
||
| 6133 | 6165 | * - Absolute URLs `http://domain.com/feh.png` |
| 6134 | 6166 | * - Domain root relative URLs `/feh.png` |
| 6135 | 6167 | * |
| 6136 | - * @param $css string: The raw CSS -- should be read in directly from the file. |
|
| 6137 | - * @param $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
| 6168 | + * @param string $css string: The raw CSS -- should be read in directly from the file. |
|
| 6169 | + * @param string $css_file_url : The URL that the file can be accessed at, for calculating paths from. |
|
| 6138 | 6170 | * |
| 6139 | 6171 | * @return mixed|string |
| 6140 | 6172 | */ |
@@ -6530,7 +6562,6 @@ discard block |
||
| 6530 | 6562 | } |
| 6531 | 6563 | |
| 6532 | 6564 | /** |
| 6533 | - * @param mixed $result Value for the user's option |
|
| 6534 | 6565 | * @return mixed |
| 6535 | 6566 | */ |
| 6536 | 6567 | function get_user_option_meta_box_order_dashboard( $sorted ) { |
@@ -30,6 +30,9 @@ discard block |
||
| 30 | 30 | public $id; |
| 31 | 31 | private $checkout_size; |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $id |
|
| 35 | + */ |
|
| 33 | 36 | function __construct( $id, $checkout_size = 10 ) { |
| 34 | 37 | $this->id = str_replace( '-', '_', $id); // necessary to ensure we don't have ID collisions in the SQL |
| 35 | 38 | $this->checkout_size = $checkout_size; |
@@ -127,6 +130,9 @@ discard block |
||
| 127 | 130 | return get_option( "jetpack_sync_queue_{$this->id}-checkout", false ); |
| 128 | 131 | } |
| 129 | 132 | |
| 133 | + /** |
|
| 134 | + * @param string $checkout_id |
|
| 135 | + */ |
|
| 130 | 136 | private function set_checkout_id( $checkout_id ) { |
| 131 | 137 | return add_option( "jetpack_sync_queue_{$this->id}-checkout", $checkout_id, null, true ); // this one we should autoload |
| 132 | 138 | } |
@@ -145,6 +151,9 @@ discard block |
||
| 145 | 151 | return 'jetpack_sync_queue_'.$this->id.'-'.$timestamp.'-'.getmypid(); |
| 146 | 152 | } |
| 147 | 153 | |
| 154 | + /** |
|
| 155 | + * @param integer $limit |
|
| 156 | + */ |
|
| 148 | 157 | private function fetch_items( $limit = null ) { |
| 149 | 158 | global $wpdb; |
| 150 | 159 | |
@@ -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 |
@@ -467,6 +467,9 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | + /** |
|
| 471 | + * @param string $action_name |
|
| 472 | + */ |
|
| 470 | 473 | private function buffer_includes_action( $buffer, $action_name ) { |
| 471 | 474 | foreach( $buffer->get_items() as $item ) { |
| 472 | 475 | if ( $item[0] === $action_name ) { |
@@ -476,6 +479,9 @@ discard block |
||
| 476 | 479 | return false; |
| 477 | 480 | } |
| 478 | 481 | |
| 482 | + /** |
|
| 483 | + * @param string $when |
|
| 484 | + */ |
|
| 479 | 485 | private function schedule_sync( $when ) { |
| 480 | 486 | wp_schedule_single_event( strtotime( $when ), 'jetpack_sync_actions' ); |
| 481 | 487 | } |
@@ -188,6 +188,9 @@ discard block |
||
| 188 | 188 | ); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | + /** |
|
| 192 | + * @param string $meta_type |
|
| 193 | + */ |
|
| 191 | 194 | private function get_metadata( $ids, $meta_type ) { |
| 192 | 195 | global $wpdb; |
| 193 | 196 | $table = _get_meta_table( $meta_type ); |
@@ -214,6 +217,10 @@ discard block |
||
| 214 | 217 | $this->set_status("updates", 100); |
| 215 | 218 | } |
| 216 | 219 | |
| 220 | + /** |
|
| 221 | + * @param string $name |
|
| 222 | + * @param integer $percent |
|
| 223 | + */ |
|
| 217 | 224 | private function set_status( $name, $percent, $count = 1, $total =1 ) { |
| 218 | 225 | set_transient( self::$status_transient_name.'_'.$name, |
| 219 | 226 | array( |