@@ -120,6 +120,9 @@ discard block |
||
| 120 | 120 | return $response; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | + /** |
|
| 124 | + * @param string $field |
|
| 125 | + */ |
|
| 123 | 126 | protected function get_sal_post_by( $field, $field_value, $context ) { |
| 124 | 127 | global $blog_id; |
| 125 | 128 | |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | return $post; |
| 133 | 136 | } |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $context |
|
| 140 | + */ |
|
| 135 | 141 | private function render_response_keys( $post, $context, $keys ) { |
| 136 | 142 | foreach ( $keys as $key ) { |
| 137 | 143 | switch ( $key ) { |
@@ -27,6 +27,9 @@ |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string $key |
|
| 32 | + */ |
|
| 30 | 33 | protected function get_locale( $key ) { |
| 31 | 34 | if ( 'locale' == $key ) { |
| 32 | 35 | if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { |
@@ -63,6 +63,7 @@ |
||
| 63 | 63 | /** |
| 64 | 64 | * Updates user data |
| 65 | 65 | * |
| 66 | + * @param integer $user_id |
|
| 66 | 67 | * @return array |
| 67 | 68 | */ |
| 68 | 69 | public function update_user( $user_id, $blog_id ) { |
@@ -35,6 +35,12 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // /sites/%s/posts/%d/replies/new -> $blog_id, $post_id |
| 37 | 37 | // /sites/%s/comments/%d/replies/new -> $blog_id, $comment_id |
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @param string $path |
|
| 41 | + * @param integer $post_id |
|
| 42 | + * @param integer $comment_parent_id |
|
| 43 | + */ |
|
| 38 | 44 | function new_comment( $path, $blog_id, $post_id, $comment_parent_id ) { |
| 39 | 45 | if ( !$post_id ) { |
| 40 | 46 | $comment_parent = get_comment( $comment_parent_id ); |
@@ -146,6 +152,11 @@ discard block |
||
| 146 | 152 | } |
| 147 | 153 | |
| 148 | 154 | // /sites/%s/comments/%d -> $blog_id, $comment_id |
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * @param string $path |
|
| 158 | + * @param integer $comment_id |
|
| 159 | + */ |
|
| 149 | 160 | function update_comment( $path, $blog_id, $comment_id ) { |
| 150 | 161 | $comment = get_comment( $comment_id ); |
| 151 | 162 | if ( !$comment || is_wp_error( $comment ) ) { |
@@ -235,6 +246,11 @@ discard block |
||
| 235 | 246 | } |
| 236 | 247 | |
| 237 | 248 | // /sites/%s/comments/%d/delete -> $blog_id, $comment_id |
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * @param string $path |
|
| 252 | + * @param integer $comment_id |
|
| 253 | + */ |
|
| 238 | 254 | function delete_comment( $path, $blog_id, $comment_id ) { |
| 239 | 255 | $comment = get_comment( $comment_id ); |
| 240 | 256 | if ( !$comment || is_wp_error( $comment ) ) { |
@@ -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 | $new = $this->api->ends_with( $path, '/new' ); |
| 33 | 38 | $args = $this->query_args(); |
@@ -610,6 +615,11 @@ discard block |
||
| 610 | 615 | } |
| 611 | 616 | |
| 612 | 617 | // /sites/%s/posts/%d/delete -> $blog_id, $post_id |
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * @param string $path |
|
| 621 | + * @param integer $post_id |
|
| 622 | + */ |
|
| 613 | 623 | function delete_post( $path, $blog_id, $post_id ) { |
| 614 | 624 | $post = get_post( $post_id ); |
| 615 | 625 | if ( !$post || is_wp_error( $post ) ) { |
@@ -645,6 +655,11 @@ discard block |
||
| 645 | 655 | } |
| 646 | 656 | |
| 647 | 657 | // /sites/%s/posts/%d/restore -> $blog_id, $post_id |
| 658 | + |
|
| 659 | + /** |
|
| 660 | + * @param string $path |
|
| 661 | + * @param integer $post_id |
|
| 662 | + */ |
|
| 648 | 663 | function restore_post( $path, $blog_id, $post_id ) { |
| 649 | 664 | $args = $this->query_args(); |
| 650 | 665 | $post = get_post( $post_id ); |
@@ -665,6 +680,10 @@ discard block |
||
| 665 | 680 | return $this->get_post_by( 'ID', $post->ID, $args['context'] ); |
| 666 | 681 | } |
| 667 | 682 | |
| 683 | + /** |
|
| 684 | + * @param boolean $delete_featured_image |
|
| 685 | + * @param string $featured_image |
|
| 686 | + */ |
|
| 668 | 687 | private function parse_and_set_featured_image( $post_id, $delete_featured_image, $featured_image ) { |
| 669 | 688 | if ( $delete_featured_image ) { |
| 670 | 689 | delete_post_thumbnail( $post_id ); |
@@ -214,6 +214,11 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // /sites/%s/posts/new -> $blog_id |
| 216 | 216 | // /sites/%s/posts/%d -> $blog_id, $post_id |
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * @param string $path |
|
| 220 | + * @param integer $post_id |
|
| 221 | + */ |
|
| 217 | 222 | function write_post( $path, $blog_id, $post_id ) { |
| 218 | 223 | global $wpdb; |
| 219 | 224 | |
@@ -890,6 +895,10 @@ discard block |
||
| 890 | 895 | } |
| 891 | 896 | |
| 892 | 897 | // /sites/%s/posts/%d/delete -> $blog_id, $post_id |
| 898 | + |
|
| 899 | + /** |
|
| 900 | + * @param string $path |
|
| 901 | + */ |
|
| 893 | 902 | function delete_post( $path, $blog_id, $post_id ) { |
| 894 | 903 | $post = get_post( $post_id ); |
| 895 | 904 | if ( !$post || is_wp_error( $post ) ) { |
@@ -929,6 +938,10 @@ discard block |
||
| 929 | 938 | } |
| 930 | 939 | |
| 931 | 940 | // /sites/%s/posts/%d/restore -> $blog_id, $post_id |
| 941 | + |
|
| 942 | + /** |
|
| 943 | + * @param string $path |
|
| 944 | + */ |
|
| 932 | 945 | function restore_post( $path, $blog_id, $post_id ) { |
| 933 | 946 | $args = $this->query_args(); |
| 934 | 947 | $post = get_post( $post_id ); |
@@ -949,6 +962,10 @@ discard block |
||
| 949 | 962 | return $this->get_post_by( 'ID', $post->ID, $args['context'] ); |
| 950 | 963 | } |
| 951 | 964 | |
| 965 | + /** |
|
| 966 | + * @param boolean $delete_featured_image |
|
| 967 | + * @param string $featured_image |
|
| 968 | + */ |
|
| 952 | 969 | protected function parse_and_set_featured_image( $post_id, $delete_featured_image, $featured_image ) { |
| 953 | 970 | if ( $delete_featured_image ) { |
| 954 | 971 | delete_post_thumbnail( $post_id ); |
@@ -26,6 +26,11 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // /sites/%s/tags|categories/new -> $blog_id |
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @param string $path |
|
| 32 | + * @param string $taxonomy_type |
|
| 33 | + */ |
|
| 29 | 34 | function new_taxonomy( $path, $blog_id, $taxonomy_type ) { |
| 30 | 35 | $args = $this->query_args(); |
| 31 | 36 | $input = $this->input(); |
@@ -77,6 +82,12 @@ discard block |
||
| 77 | 82 | } |
| 78 | 83 | |
| 79 | 84 | // /sites/%s/tags|categories/slug:%s -> $blog_id, $taxonomy_id |
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @param string $path |
|
| 88 | + * @param integer $object_id |
|
| 89 | + * @param string $taxonomy_type |
|
| 90 | + */ |
|
| 80 | 91 | function update_taxonomy( $path, $blog_id, $object_id, $taxonomy_type ) { |
| 81 | 92 | $taxonomy = get_term_by( 'slug', $object_id, $taxonomy_type ); |
| 82 | 93 | $tax = get_taxonomy( $taxonomy_type ); |
@@ -122,6 +133,12 @@ discard block |
||
| 122 | 133 | } |
| 123 | 134 | |
| 124 | 135 | // /sites/%s/tags|categories/%s/delete -> $blog_id, $taxonomy_id |
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @param string $path |
|
| 139 | + * @param integer $object_id |
|
| 140 | + * @param string $taxonomy_type |
|
| 141 | + */ |
|
| 125 | 142 | function delete_taxonomy( $path, $blog_id, $object_id, $taxonomy_type ) { |
| 126 | 143 | $taxonomy = get_term_by( 'slug', $object_id, $taxonomy_type ); |
| 127 | 144 | $tax = get_taxonomy( $taxonomy_type ); |
@@ -115,6 +115,11 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // /sites/%s/taxonomies/%s/terms/new -> $blog_id, $taxonomy |
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @param string $path |
|
| 121 | + * @param string $taxonomy |
|
| 122 | + */ |
|
| 118 | 123 | function new_term( $path, $blog_id, $taxonomy ) { |
| 119 | 124 | $args = $this->query_args(); |
| 120 | 125 | $input = $this->input(); |
@@ -160,6 +165,12 @@ discard block |
||
| 160 | 165 | } |
| 161 | 166 | |
| 162 | 167 | // /sites/%s/taxonomies/%s/terms/slug:%s -> $blog_id, $taxonomy, $slug |
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * @param string $path |
|
| 171 | + * @param string $slug |
|
| 172 | + * @param string $taxonomy |
|
| 173 | + */ |
|
| 163 | 174 | function update_term( $path, $blog_id, $slug, $taxonomy ) { |
| 164 | 175 | $tax = get_taxonomy( $taxonomy ); |
| 165 | 176 | if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
@@ -208,6 +219,12 @@ discard block |
||
| 208 | 219 | } |
| 209 | 220 | |
| 210 | 221 | // /sites/%s/taxonomies/%s/terms/slug:%s/delete -> $blog_id, $taxonomy, $slug |
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * @param string $path |
|
| 225 | + * @param string $slug |
|
| 226 | + * @param string $taxonomy |
|
| 227 | + */ |
|
| 211 | 228 | function delete_term( $path, $blog_id, $slug, $taxonomy ) { |
| 212 | 229 | $term = get_term_by( 'slug', $slug, $taxonomy ); |
| 213 | 230 | $tax = get_taxonomy( $taxonomy ); |
@@ -24,6 +24,9 @@ discard block |
||
| 24 | 24 | return isset( $args['arguments'] ) ? json_decode( $args['arguments'] ) : array(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param double $gmt_time |
|
| 29 | + */ |
|
| 27 | 30 | protected function is_cron_locked( $gmt_time ) { |
| 28 | 31 | // The cron lock: a unix timestamp from when the cron was spawned. |
| 29 | 32 | $doing_cron_transient = $this->get_cron_lock(); |
@@ -33,6 +36,9 @@ discard block |
||
| 33 | 36 | return $doing_cron_transient; |
| 34 | 37 | } |
| 35 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $doing_wp_cron |
|
| 41 | + */ |
|
| 36 | 42 | protected function maybe_unlock_cron( $doing_wp_cron ) { |
| 37 | 43 | if ( $this->get_cron_lock() == $doing_wp_cron ) { |
| 38 | 44 | delete_transient( 'doing_cron' ); |