@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html |
| 79 | 79 | * |
| 80 | - * @param $function string name of the function |
|
| 80 | + * @param string $function string name of the function |
|
| 81 | 81 | * @param $params array functions parameters |
| 82 | 82 | * |
| 83 | 83 | * @return void |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @see https://www.elastic.co/guide/en/elasticsearch/guide/current/decay-functions.html |
| 96 | 96 | * |
| 97 | - * @param $function string name of the decay function - linear, exp, or gauss |
|
| 97 | + * @param string $function string name of the decay function - linear, exp, or gauss |
|
| 98 | 98 | * @param $params array The decay functions parameters, passed to ES directly |
| 99 | 99 | * |
| 100 | 100 | * @return void |
@@ -124,6 +124,9 @@ discard block |
||
| 124 | 124 | $this->query_bool_boost = $boost; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $aggs_name |
|
| 129 | + */ |
|
| 127 | 130 | public function add_aggs( $aggs_name, $aggs ) { |
| 128 | 131 | $this->aggs_query = true; |
| 129 | 132 | $this->aggs[$aggs_name] = $aggs; |
@@ -646,7 +646,7 @@ |
||
| 646 | 646 | * handlers should be copied when the theme context is loaded by the REST API. |
| 647 | 647 | * |
| 648 | 648 | * @param array $copy_dirs Copy paths with actions to be copied |
| 649 | - * @return array Copy paths with featured content plugin |
|
| 649 | + * @return string[] Copy paths with featured content plugin |
|
| 650 | 650 | */ |
| 651 | 651 | function wpcom_rest_api_featured_content_copy_plugin_actions( $copy_dirs ) { |
| 652 | 652 | $copy_dirs[] = __FILE__; |
@@ -28,6 +28,11 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // /sites/%s/posts/new -> $blog_id |
| 30 | 30 | // /sites/%s/posts/%d -> $blog_id, $post_id |
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @param string $path |
|
| 34 | + * @param integer $post_id |
|
| 35 | + */ |
|
| 31 | 36 | function write_post( $path, $blog_id, $post_id ) { |
| 32 | 37 | global $wpdb; |
| 33 | 38 | |
@@ -704,6 +709,11 @@ discard block |
||
| 704 | 709 | } |
| 705 | 710 | |
| 706 | 711 | // /sites/%s/posts/%d/delete -> $blog_id, $post_id |
| 712 | + |
|
| 713 | + /** |
|
| 714 | + * @param string $path |
|
| 715 | + * @param integer $post_id |
|
| 716 | + */ |
|
| 707 | 717 | function delete_post( $path, $blog_id, $post_id ) { |
| 708 | 718 | $post = get_post( $post_id ); |
| 709 | 719 | if ( !$post || is_wp_error( $post ) ) { |
@@ -743,6 +753,11 @@ discard block |
||
| 743 | 753 | } |
| 744 | 754 | |
| 745 | 755 | // /sites/%s/posts/%d/restore -> $blog_id, $post_id |
| 756 | + |
|
| 757 | + /** |
|
| 758 | + * @param string $path |
|
| 759 | + * @param integer $post_id |
|
| 760 | + */ |
|
| 746 | 761 | function restore_post( $path, $blog_id, $post_id ) { |
| 747 | 762 | $args = $this->query_args(); |
| 748 | 763 | $post = get_post( $post_id ); |
@@ -763,6 +778,10 @@ discard block |
||
| 763 | 778 | return $this->get_post_by( 'ID', $post->ID, $args['context'] ); |
| 764 | 779 | } |
| 765 | 780 | |
| 781 | + /** |
|
| 782 | + * @param boolean $delete_featured_image |
|
| 783 | + * @param string $featured_image |
|
| 784 | + */ |
|
| 766 | 785 | protected function parse_and_set_featured_image( $post_id, $delete_featured_image, $featured_image ) { |
| 767 | 786 | if ( $delete_featured_image ) { |
| 768 | 787 | delete_post_thumbnail( $post_id ); |
@@ -91,6 +91,9 @@ discard block |
||
| 91 | 91 | $this->data = apply_filters( 'amp_post_template_data', $this->data, $this->post ); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | + /** |
|
| 95 | + * @param string $property |
|
| 96 | + */ |
|
| 94 | 97 | public function get( $property, $default = null ) { |
| 95 | 98 | if ( isset( $this->data[ $property ] ) ) { |
| 96 | 99 | return $this->data[ $property ]; |
@@ -114,6 +117,9 @@ discard block |
||
| 114 | 117 | $this->load_parts( array( 'single' ) ); |
| 115 | 118 | } |
| 116 | 119 | |
| 120 | + /** |
|
| 121 | + * @param string[] $templates |
|
| 122 | + */ |
|
| 117 | 123 | public function load_parts( $templates ) { |
| 118 | 124 | foreach ( $templates as $template ) { |
| 119 | 125 | $file = $this->get_template_path( $template ); |
@@ -133,6 +139,9 @@ discard block |
||
| 133 | 139 | $this->data[ $key ] = $value; |
| 134 | 140 | } |
| 135 | 141 | |
| 142 | + /** |
|
| 143 | + * @param string $key |
|
| 144 | + */ |
|
| 136 | 145 | private function merge_data_for_key( $key, $value ) { |
| 137 | 146 | if ( is_array( $this->data[ $key ] ) ) { |
| 138 | 147 | $this->data[ $key ] = array_merge( $this->data[ $key ], $value ); |
@@ -373,6 +382,9 @@ discard block |
||
| 373 | 382 | $this->add_data_by_key( 'html_tag_attributes', $attributes ); |
| 374 | 383 | } |
| 375 | 384 | |
| 385 | + /** |
|
| 386 | + * @param string $file |
|
| 387 | + */ |
|
| 376 | 388 | private function verify_and_include( $file, $template_type ) { |
| 377 | 389 | $located_file = $this->locate_template( $file ); |
| 378 | 390 | if ( $located_file ) { |
@@ -78,6 +78,9 @@ |
||
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | + /** |
|
| 82 | + * @param string $url |
|
| 83 | + */ |
|
| 81 | 84 | private function get_instagram_id_from_url( $url ) { |
| 82 | 85 | $found = preg_match( self::URL_PATTERN, $url, $matches ); |
| 83 | 86 | |
@@ -90,6 +90,9 @@ |
||
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $url |
|
| 95 | + */ |
|
| 93 | 96 | private function get_video_id_from_url( $url ) { |
| 94 | 97 | $video_id = false; |
| 95 | 98 | $parsed_url = parse_url( $url ); |
@@ -197,6 +197,9 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
| 200 | + /** |
|
| 201 | + * @param integer $n |
|
| 202 | + */ |
|
| 200 | 203 | private function getChars($n) |
| 201 | 204 | { |
| 202 | 205 | $response = null; |
@@ -238,6 +241,9 @@ discard block |
||
| 238 | 241 | } |
| 239 | 242 | |
| 240 | 243 | |
| 244 | + /** |
|
| 245 | + * @param false|string $str |
|
| 246 | + */ |
|
| 241 | 247 | private function readInt($str) |
| 242 | 248 | { |
| 243 | 249 | $size = unpack("C*", $str); |