@@ -4,16 +4,29 @@ |
||
| 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_jetpack_version(); |
| 14 | 24 | |
| 15 | 25 | abstract protected function get_updates(); |
| 16 | 26 | |
| 27 | + /** |
|
| 28 | + * @return string |
|
| 29 | + */ |
|
| 17 | 30 | abstract protected function main_network_site(); |
| 18 | 31 | |
| 19 | 32 | abstract protected function wp_version(); |
@@ -69,11 +69,17 @@ |
||
| 69 | 69 | return $args; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string $taxonomy |
|
| 74 | + */ |
|
| 72 | 75 | function get_found( $taxonomy, $args ) { |
| 73 | 76 | unset( $args['offset'] ); |
| 74 | 77 | return wp_count_terms( $taxonomy, $args ); |
| 75 | 78 | } |
| 76 | 79 | |
| 80 | + /** |
|
| 81 | + * @param string $taxonomy |
|
| 82 | + */ |
|
| 77 | 83 | function get_formatted_terms( $taxonomy, $args ) { |
| 78 | 84 | $terms = get_terms( $taxonomy, $args ); |
| 79 | 85 | |
@@ -44,6 +44,11 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // /sites/%s/taxonomies/%s/terms/new -> $blog_id, $taxonomy |
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @param string $path |
|
| 50 | + * @param string $taxonomy |
|
| 51 | + */ |
|
| 47 | 52 | function new_term( $path, $blog_id, $taxonomy ) { |
| 48 | 53 | $args = $this->query_args(); |
| 49 | 54 | $input = $this->input(); |
@@ -90,6 +95,12 @@ discard block |
||
| 90 | 95 | } |
| 91 | 96 | |
| 92 | 97 | // /sites/%s/taxonomies/%s/terms/slug:%s -> $blog_id, $taxonomy, $slug |
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * @param string $path |
|
| 101 | + * @param integer $slug |
|
| 102 | + * @param string $taxonomy |
|
| 103 | + */ |
|
| 93 | 104 | function update_term( $path, $blog_id, $slug, $taxonomy ) { |
| 94 | 105 | $tax = get_taxonomy( $taxonomy ); |
| 95 | 106 | if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
@@ -134,6 +145,12 @@ discard block |
||
| 134 | 145 | } |
| 135 | 146 | |
| 136 | 147 | // /sites/%s/taxonomies/%s/terms/slug:%s/delete -> $blog_id, $taxonomy, $slug |
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @param string $path |
|
| 151 | + * @param integer $slug |
|
| 152 | + * @param string $taxonomy |
|
| 153 | + */ |
|
| 137 | 154 | function delete_term( $path, $blog_id, $slug, $taxonomy ) { |
| 138 | 155 | $term = get_term_by( 'slug', $slug, $taxonomy ); |
| 139 | 156 | $tax = get_taxonomy( $taxonomy ); |
@@ -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; |
@@ -508,6 +511,9 @@ discard block |
||
| 508 | 511 | return $suggestions; |
| 509 | 512 | } |
| 510 | 513 | |
| 514 | + /** |
|
| 515 | + * @param string $context |
|
| 516 | + */ |
|
| 511 | 517 | private function format_taxonomy( $taxonomy, $taxonomy_type, $context ) { |
| 512 | 518 | // Permissions |
| 513 | 519 | switch ( $context ) { |
@@ -172,6 +172,9 @@ |
||
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | + /** |
|
| 176 | + * @param string $when |
|
| 177 | + */ |
|
| 175 | 178 | private function schedule_sync( $when ) { |
| 176 | 179 | wp_schedule_single_event( strtotime( $when ), 'jetpack_sync_actions' ); |
| 177 | 180 | } |
@@ -36,6 +36,9 @@ |
||
| 36 | 36 | return self::$initialized_modules; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $module_name |
|
| 41 | + */ |
|
| 39 | 42 | public static function get_module( $module_name ) { |
| 40 | 43 | foreach( self::get_modules() as $module ) { |
| 41 | 44 | if ( $module->name() === $module_name ) { |
@@ -165,6 +165,7 @@ |
||
| 165 | 165 | * Sanitize the string of classes used for header text. |
| 166 | 166 | * Limit to A-Z,a-z,0-9,(space),(comma),_,- |
| 167 | 167 | * |
| 168 | + * @param string $classes |
|
| 168 | 169 | * @return string Sanitized string of CSS classes. |
| 169 | 170 | */ |
| 170 | 171 | function jetpack_sanitize_header_text_classes( $classes ) { |
@@ -23,6 +23,9 @@ discard block |
||
| 23 | 23 | return array(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string[] $actions_to_count |
|
| 28 | + */ |
|
| 26 | 29 | protected function count_actions( $action_names, $actions_to_count ) { |
| 27 | 30 | return count( array_intersect( $action_names, $actions_to_count ) ); |
| 28 | 31 | } |
@@ -31,6 +34,9 @@ discard block |
||
| 31 | 34 | return crc32( json_encode( $values ) ); |
| 32 | 35 | } |
| 33 | 36 | |
| 37 | + /** |
|
| 38 | + * @param integer $new_sum |
|
| 39 | + */ |
|
| 34 | 40 | protected function still_valid_checksum( $sums_to_check, $name, $new_sum ) { |
| 35 | 41 | if ( isset( $sums_to_check[ $name ] ) && $sums_to_check[ $name ] === $new_sum ) { |
| 36 | 42 | return true; |
@@ -38,6 +44,11 @@ discard block |
||
| 38 | 44 | return false; |
| 39 | 45 | } |
| 40 | 46 | |
| 47 | + /** |
|
| 48 | + * @param string $action_name |
|
| 49 | + * @param string $id_field |
|
| 50 | + * @param null|string $where_sql |
|
| 51 | + */ |
|
| 41 | 52 | protected function enqueue_all_ids_as_action( $action_name, $table_name, $id_field, $where_sql ) { |
| 42 | 53 | global $wpdb; |
| 43 | 54 | |
@@ -71,6 +82,9 @@ discard block |
||
| 71 | 82 | return $chunk_count; |
| 72 | 83 | } |
| 73 | 84 | |
| 85 | + /** |
|
| 86 | + * @param string $meta_type |
|
| 87 | + */ |
|
| 74 | 88 | protected function get_metadata( $ids, $meta_type ) { |
| 75 | 89 | global $wpdb; |
| 76 | 90 | $table = _get_meta_table( $meta_type ); |