@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Verifies that a user answered the math problem correctly while logging in. |
28 | 28 | * |
29 | - * @return bool Returns true if the math is correct |
|
29 | + * @return boolean|null Returns true if the math is correct |
|
30 | 30 | * @throws Error if insuffient $_POST variables are present. |
31 | 31 | * @throws Error message if the math is wrong |
32 | 32 | */ |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * Requires a user to solve a simple equation. Added to any WordPress login form. |
111 | 111 | * |
112 | - * @return VOID outputs html |
|
112 | + * @return string|null outputs html |
|
113 | 113 | */ |
114 | 114 | static function math_form() { |
115 | 115 | // Check if jpp_math_pass cookie is set and it matches valid transient |
@@ -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; |
@@ -543,11 +549,18 @@ discard block |
||
543 | 549 | return json_encode( $data ); |
544 | 550 | } |
545 | 551 | |
552 | + /** |
|
553 | + * @param string $needle |
|
554 | + */ |
|
546 | 555 | function ends_with( $haystack, $needle ) { |
547 | 556 | return $needle === substr( $haystack, -strlen( $needle ) ); |
548 | 557 | } |
549 | 558 | |
550 | 559 | // Returns the site's blog_id in the WP.com ecosystem |
560 | + |
|
561 | + /** |
|
562 | + * @return integer |
|
563 | + */ |
|
551 | 564 | function get_blog_id_for_output() { |
552 | 565 | return $this->token_details['blog_id']; |
553 | 566 | } |
@@ -570,6 +583,10 @@ discard block |
||
570 | 583 | } |
571 | 584 | |
572 | 585 | // Returns true if the specified blog ID is a restricted blog |
586 | + |
|
587 | + /** |
|
588 | + * @param integer $blog_id |
|
589 | + */ |
|
573 | 590 | function is_restricted_blog( $blog_id ) { |
574 | 591 | /** |
575 | 592 | * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs. |
@@ -619,7 +636,7 @@ discard block |
||
619 | 636 | /** |
620 | 637 | * Counts the number of comments on a site, excluding certain comment types. |
621 | 638 | * |
622 | - * @param $post_id int Post ID. |
|
639 | + * @param integer $post_id int Post ID. |
|
623 | 640 | * @return array Array of counts, matching the output of https://developer.wordpress.org/reference/functions/get_comment_count/. |
624 | 641 | */ |
625 | 642 | public function wp_count_comments( $post_id ) { |
@@ -300,6 +300,9 @@ discard block |
||
300 | 300 | return Grunion_Contact_Form::parse( $atts, do_blocks( $content ) ); |
301 | 301 | } |
302 | 302 | |
303 | + /** |
|
304 | + * @param string $type |
|
305 | + */ |
|
303 | 306 | public static function block_attributes_to_shortcode_attributes( $atts, $type ) { |
304 | 307 | $atts['type'] = $type; |
305 | 308 | if ( isset( $atts['className'] ) ) { |
@@ -1918,7 +1921,6 @@ discard block |
||
1918 | 1921 | * |
1919 | 1922 | * @see ::style() |
1920 | 1923 | * @internal |
1921 | - * @param bool $style |
|
1922 | 1924 | */ |
1923 | 1925 | static function _style_on() { |
1924 | 1926 | return self::style( true ); |
@@ -2086,6 +2088,7 @@ discard block |
||
2086 | 2088 | * |
2087 | 2089 | * @param int $feedback_id |
2088 | 2090 | * @param object Grunion_Contact_Form $form |
2091 | + * @param Grunion_Contact_Form $form |
|
2089 | 2092 | * |
2090 | 2093 | * @return string $message |
2091 | 2094 | */ |
@@ -2210,7 +2213,7 @@ discard block |
||
2210 | 2213 | * |
2211 | 2214 | * @param array $attributes Key => Value pairs as parsed by shortcode_parse_atts() |
2212 | 2215 | * @param string|null $content The shortcode's inner content: [contact-field]$content[/contact-field] |
2213 | - * @return HTML for the contact form field |
|
2216 | + * @return string for the contact form field |
|
2214 | 2217 | */ |
2215 | 2218 | static function parse_contact_field( $attributes, $content ) { |
2216 | 2219 | // Don't try to parse contact form fields if not inside a contact form |
@@ -3233,6 +3236,9 @@ discard block |
||
3233 | 3236 | |
3234 | 3237 | } |
3235 | 3238 | |
3239 | + /** |
|
3240 | + * @param string $type |
|
3241 | + */ |
|
3236 | 3242 | function render_input_field( $type, $id, $value, $class, $placeholder, $required ) { |
3237 | 3243 | return "<input |
3238 | 3244 | type='". esc_attr( $type ) ."' |
@@ -3244,24 +3250,40 @@ discard block |
||
3244 | 3250 | />\n"; |
3245 | 3251 | } |
3246 | 3252 | |
3253 | + /** |
|
3254 | + * @param string $class |
|
3255 | + * @param string $placeholder |
|
3256 | + */ |
|
3247 | 3257 | function render_email_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder ) { |
3248 | 3258 | $field = $this->render_label( 'email', $id, $label, $required, $required_field_text ); |
3249 | 3259 | $field .= $this->render_input_field( 'email', $id, $value, $class, $placeholder, $required ); |
3250 | 3260 | return $field; |
3251 | 3261 | } |
3252 | 3262 | |
3263 | + /** |
|
3264 | + * @param string $class |
|
3265 | + * @param string $placeholder |
|
3266 | + */ |
|
3253 | 3267 | function render_telephone_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder ) { |
3254 | 3268 | $field = $this->render_label( 'telephone', $id, $label, $required, $required_field_text ); |
3255 | 3269 | $field .= $this->render_input_field( 'tel', $id, $value, $class, $placeholder, $required ); |
3256 | 3270 | return $field; |
3257 | 3271 | } |
3258 | 3272 | |
3273 | + /** |
|
3274 | + * @param string $class |
|
3275 | + * @param string $placeholder |
|
3276 | + */ |
|
3259 | 3277 | function render_url_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder ) { |
3260 | 3278 | $field = $this->render_label( 'url', $id, $label, $required, $required_field_text ); |
3261 | 3279 | $field .= $this->render_input_field( 'url', $id, $value, $class, $placeholder, $required ); |
3262 | 3280 | return $field; |
3263 | 3281 | } |
3264 | 3282 | |
3283 | + /** |
|
3284 | + * @param string $class |
|
3285 | + * @param string $placeholder |
|
3286 | + */ |
|
3265 | 3287 | function render_textarea_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder ) { |
3266 | 3288 | $field = $this->render_label( 'textarea', 'contact-form-comment-' . $id, $label, $required, $required_field_text ); |
3267 | 3289 | $field .= "<textarea |
@@ -3276,6 +3298,9 @@ discard block |
||
3276 | 3298 | return $field; |
3277 | 3299 | } |
3278 | 3300 | |
3301 | + /** |
|
3302 | + * @param string $class |
|
3303 | + */ |
|
3279 | 3304 | function render_radio_field( $id, $label, $value, $class, $required, $required_field_text ) { |
3280 | 3305 | $field = $this->render_label( '', $id, $label, $required, $required_field_text ); |
3281 | 3306 | foreach ( (array) $this->get_attribute( 'options' ) as $optionIndex => $option ) { |
@@ -3297,6 +3322,9 @@ discard block |
||
3297 | 3322 | return $field; |
3298 | 3323 | } |
3299 | 3324 | |
3325 | + /** |
|
3326 | + * @param string $class |
|
3327 | + */ |
|
3300 | 3328 | function render_checkbox_field( $id, $label, $value, $class, $required, $required_field_text ) { |
3301 | 3329 | $field = "<label class='grunion-field-label checkbox" . ( $this->is_error() ? ' form-error' : '' ) . "'>"; |
3302 | 3330 | $field .= "\t\t<input type='checkbox' name='" . esc_attr( $id ) . "' value='" . esc_attr__( 'Yes', 'jetpack' ) . "' " . $class . checked( (bool) $value, true, false ) . ' ' . ( $required ? "required aria-required='true'" : '' ) . "/> \n"; |
@@ -3306,6 +3334,9 @@ discard block |
||
3306 | 3334 | return $field; |
3307 | 3335 | } |
3308 | 3336 | |
3337 | + /** |
|
3338 | + * @param string $class |
|
3339 | + */ |
|
3309 | 3340 | function render_checkbox_multiple_field( $id, $label, $value, $class, $required, $required_field_text ) { |
3310 | 3341 | $field = $this->render_label( '', $id, $label, $required, $required_field_text ); |
3311 | 3342 | foreach ( (array) $this->get_attribute( 'options' ) as $optionIndex => $option ) { |
@@ -3321,6 +3352,9 @@ discard block |
||
3321 | 3352 | return $field; |
3322 | 3353 | } |
3323 | 3354 | |
3355 | + /** |
|
3356 | + * @param string $class |
|
3357 | + */ |
|
3324 | 3358 | function render_select_field( $id, $label, $value, $class, $required, $required_field_text ) { |
3325 | 3359 | $field = $this->render_label( 'select', $id, $label, $required, $required_field_text ); |
3326 | 3360 | $field .= "\t<select name='" . esc_attr( $id ) . "' id='" . esc_attr( $id ) . "' " . $class . ( $required ? "required aria-required='true'" : '' ) . ">\n"; |
@@ -3338,6 +3372,10 @@ discard block |
||
3338 | 3372 | return $field; |
3339 | 3373 | } |
3340 | 3374 | |
3375 | + /** |
|
3376 | + * @param string $class |
|
3377 | + * @param string $placeholder |
|
3378 | + */ |
|
3341 | 3379 | function render_date_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder ) { |
3342 | 3380 | $field = $this->render_label( 'date', $id, $label, $required, $required_field_text ); |
3343 | 3381 | $field .= $this->render_input_field( 'text', $id, $value, $class, $placeholder, $required ); |
@@ -3357,6 +3395,10 @@ discard block |
||
3357 | 3395 | return $field; |
3358 | 3396 | } |
3359 | 3397 | |
3398 | + /** |
|
3399 | + * @param string $class |
|
3400 | + * @param string $placeholder |
|
3401 | + */ |
|
3360 | 3402 | function render_default_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder, $type ) { |
3361 | 3403 | $field = $this->render_label( $type, $id, $label, $required, $required_field_text ); |
3362 | 3404 | $field .= $this->render_input_field( 'text', $id, $value, $class, $placeholder, $required ); |
@@ -415,7 +415,7 @@ |
||
415 | 415 | * |
416 | 416 | * @param array $connections_data |
417 | 417 | * |
418 | - * @return array { |
|
418 | + * @return string { |
|
419 | 419 | * Array of content for generating connection form. |
420 | 420 | * |
421 | 421 | * @type string HTML content of form |
@@ -213,7 +213,6 @@ discard block |
||
213 | 213 | /** |
214 | 214 | * Inject image sizes to Jetpack REST API responses. This wraps the filter_photon_norezise_maybe_inject_sizes function. |
215 | 215 | * |
216 | - * @param array $data Attachment sizes data. |
|
217 | 216 | * @param int $attachment_id Attachment's post ID. |
218 | 217 | * |
219 | 218 | * @return array Attachment sizes array. |
@@ -1257,7 +1256,7 @@ discard block |
||
1257 | 1256 | * after ourselves without breaking anyone else's filters. |
1258 | 1257 | * |
1259 | 1258 | * @internal |
1260 | - * @return true |
|
1259 | + * @return boolean |
|
1261 | 1260 | */ |
1262 | 1261 | public function _override_image_downsize_in_rest_edit_context() { |
1263 | 1262 | return true; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** |
53 | 53 | * Helper function to look up the expected master user and return the local WP_User. |
54 | 54 | * |
55 | - * @return WP_User Jetpack's expected master user. |
|
55 | + * @return string Jetpack's expected master user. |
|
56 | 56 | */ |
57 | 57 | protected function helper_retrieve_local_master_user() { |
58 | 58 | $master_user = Jetpack_Options::get_option( 'master_user' ); |
@@ -162,6 +162,7 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * Get attachment images for a specified post and return them. Also make sure |
164 | 164 | * their dimensions are at or above a required minimum. |
165 | + * @param integer $post_id |
|
165 | 166 | */ |
166 | 167 | static function from_attachment( $post_id, $width = 200, $height = 200 ) { |
167 | 168 | $images = array(); |
@@ -224,7 +225,7 @@ discard block |
||
224 | 225 | * Check if a Featured Image is set for this post, and return it in a similar |
225 | 226 | * format to the other images?_from_*() methods. |
226 | 227 | * @param int $post_id The post ID to check |
227 | - * @return Array containing details of the Featured Image, or empty array if none. |
|
228 | + * @return integer|null containing details of the Featured Image, or empty array if none. |
|
228 | 229 | */ |
229 | 230 | static function from_thumbnail( $post_id, $width = 200, $height = 200 ) { |
230 | 231 | $images = array(); |
@@ -668,7 +669,6 @@ discard block |
||
668 | 669 | * resized and cropped image. |
669 | 670 | * |
670 | 671 | * @param string $src |
671 | - * @param int $dimension |
|
672 | 672 | * @return string Transformed image URL |
673 | 673 | */ |
674 | 674 | static function fit_image_url( $src, $width, $height ) { |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | * |
716 | 716 | * @param mixed $html_or_id The HTML string to parse for images, or a post id. |
717 | 717 | * |
718 | - * @return array $html_info { |
|
718 | + * @return integer $html_info { |
|
719 | 719 | * @type string $html Post content. |
720 | 720 | * @type string $post_url Post URL. |
721 | 721 | * } |
@@ -682,6 +682,9 @@ |
||
682 | 682 | $this->options_save_other( 'linkedin' ); |
683 | 683 | } |
684 | 684 | |
685 | + /** |
|
686 | + * @param string $service_name |
|
687 | + */ |
|
685 | 688 | function options_save_other( $service_name ) { |
686 | 689 | // Nonce check |
687 | 690 | check_admin_referer( 'save_' . $service_name . '_token_' . $_REQUEST['connection'] ); |
@@ -244,6 +244,9 @@ |
||
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | + /** |
|
248 | + * @param string $capability |
|
249 | + */ |
|
247 | 250 | protected function current_user_can( $capability, $plugin = null ) { |
248 | 251 | if ( $plugin ) { |
249 | 252 | return current_user_can( $capability, $plugin ); |