From be5ea1320aa7a0eec78ea0924cc4fd31938749df Mon Sep 17 00:00:00 2001 From: Jonathan Bardo Date: Mon, 1 Feb 2016 17:17:06 -0500 Subject: [PATCH 1/4] Add test_get_item_schema --- tests/test-rest-site-controller.php | 40 +++++++++++++++++------------ 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/tests/test-rest-site-controller.php b/tests/test-rest-site-controller.php index 08482c3..ff70240 100644 --- a/tests/test-rest-site-controller.php +++ b/tests/test-rest-site-controller.php @@ -35,28 +35,36 @@ public function test_get_items() { $this->assertEquals( 200, $response->get_status() ); } - public function test_get_item() { + public function test_get_item() {} - } - - public function test_create_item() { - - } - - public function test_update_item() { - - } - - public function test_delete_item() { + public function test_create_item() {} - } + public function test_update_item() {} - public function test_prepare_item() { + public function test_delete_item() {} - } + public function test_prepare_item() {} public function test_get_item_schema() { - + $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/site' ); + $response = $this->server->dispatch( $request ); + $data = $response->get_data(); + $properties = $data['schema']['properties']; + + $this->assertEquals( 13, count( $properties ) ); + $this->assertArrayHasKey( 'title', $properties ); + $this->assertArrayHasKey( 'tagline', $properties ); + $this->assertArrayHasKey( 'wordpress_url', $properties ); + $this->assertArrayHasKey( 'url', $properties ); + $this->assertArrayHasKey( 'users_can_register', $properties ); + $this->assertArrayHasKey( 'timezone_string', $properties ); + $this->assertArrayHasKey( 'date_format', $properties ); + $this->assertArrayHasKey( 'time_format', $properties ); + $this->assertArrayHasKey( 'start_of_week', $properties ); + $this->assertArrayHasKey( 'locale', $properties ); + $this->assertArrayHasKey( 'permalink_structure', $properties ); + $this->assertArrayHasKey( 'permalink_category_base', $properties ); + $this->assertArrayHasKey( 'permalink_tag_base', $properties ); } } From 6a414002dc30d4466b316a30286971d066f15243 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 1 Mar 2016 16:06:51 -0500 Subject: [PATCH 2/4] Added All Site Options --- lib/class-wp-rest-site-controller.php | 431 ++++++++++++++++++++++++-- tests/test-rest-site-controller.php | 2 +- 2 files changed, 412 insertions(+), 21 deletions(-) diff --git a/lib/class-wp-rest-site-controller.php b/lib/class-wp-rest-site-controller.php index dea1d96..8825cf9 100644 --- a/lib/class-wp-rest-site-controller.php +++ b/lib/class-wp-rest-site-controller.php @@ -88,10 +88,164 @@ public function get_item_schema() { 'title' => 'site', 'type' => 'object', 'properties' => array( - 'title' => array( - 'description' => __( 'Site Title' ), + + // Reference: https://docs.google.com/spreadsheets/d/1vI-s8MjbEllCR0_0BmBgaGvKNm1Fa42MCoqaKCwbRyQ/edit#gid=0 + + // Discussion + + 'avatar_default' => array( + 'description' => __( 'Default Avatar' ), + 'type' => 'string', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'avatar_rating' => array( + 'description' => __( 'Maximum Rating' ), + 'type' => 'string', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'comment_blacklist' => array( + 'description' => __( 'When a comment contains any of these words in its content, name, URL, email, or IP, it will be put in the trash. One word or IP per line. It will match inside words, so “press” will match “WordPress”.' ), + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'close_comments_days_old' => array( + 'description' => __( '[integer, default: 14]' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'close_comments_for_old_posts' => array( + 'description' => __( 'Automatically close comments on articles older than [integer, default: 14] days.' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'comment_max_links' => array( + 'description' => __( 'Hold a comment in the queue if it contains [integer, default: 2] or more links. (A common characteristic of comment spam is a large number of hyperlinks.)' ), + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'comment_moderation' => array( + 'description' => __( 'Comment must be manually approved.' ), + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'comment_order' => array( + 'description' => __( 'Comments should be displayed with the ["older" or "newer", default: "older"] comments at the top of each page.' ), 'type' => 'string', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'comment_registration' => array( + 'description' => __( 'Users must be registered and logged in to comment.' ), + 'type' => 'integer', + 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'comment_whitelist' => array( + 'description' => __( 'Comment author must have a previously approved comment.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'comments_notify' => array( + 'description' => __( 'Anyone posts a comment.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'comments_per_page' => array( + 'description' => __( '[integer, default: 50]' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'default_comment_status' => array( + 'description' => __( 'Allow people to post comments on new articles.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'default_comments_page' => array( + 'description' => __( '["last" or "first", default: "last"]' ), + 'type' => 'string', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'default_ping_status' => array( + 'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'default_pingback_flag' => array( + 'description' => __( 'Attempt to notify any blogs linked to from the article.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'moderation_keys' => array( + 'description' => __( 'When a comment contains any of these words in its content, name, URL, email, or IP, it will be held in the moderation queue. One word or IP per line. It will match inside words, so “press” will match “WordPress”.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'moderation_notify' => array( + 'description' => __( 'A comment is held for moderation.' ), + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'comment_pagination' => array( + 'description' => __( 'Break comments into pages with [integer, default: 50] top level comments per page and the ["last" or "first", default: "last"] page displayed by default.' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'comment_require_name_email' => array( + 'description' => __( 'Comment author must fill out name and email.' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'show_avatars' => array( + 'description' => __( 'Show Avatars.' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'thread_comments' => array( + 'description' => __( 'Enable threaded (nested) comments [integer, default: 5] levels deep.' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'thread_comments_depth' => array( + 'description' => __( '[integer, defaut: 5]' ), + 'type' => 'integer', + 'screen' => 'discussion', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + + // General + + 'admin_email' => array( + 'description' => __( 'Email Address' ), + 'type' => 'string', + 'screen' => 'general', + 'context' => array( 'view', 'edit' ), + 'public' => false, 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), @@ -99,72 +253,293 @@ public function get_item_schema() { 'tagline' => array( 'description' => __( 'Tagline' ), 'type' => 'string', + 'screen' => 'general', 'context' => array( 'view', 'edit' ), + 'public' => true, 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), - 'wordpress_url' => array( - 'description' => __( 'WordPress Address (URL)' ), + 'title' => array( + 'description' => __( 'Site Title' ), 'type' => 'string', - 'format' => 'uri', + 'screen' => 'general', 'context' => array( 'view', 'edit' ), + 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), - 'url' => array( - 'description' => __( 'Site Address (URL)' ), + 'date_format' => array( + 'description' => __( 'Date Format' ), 'type' => 'string', - 'format' => 'uri', + 'screen' => 'general', 'context' => array( 'view', 'edit' ), + 'public' => true, ), - 'users_can_register' => array( - 'description' => __( 'Membership' ), - 'type' => 'boolean', - 'context' => array( 'view', 'edit' ), - ), - 'timezone_string' => array( - 'description' => __( 'Timezone' ), + 'default_role' => array( + 'description' => __( 'New User Role Default' ), 'type' => 'string', + 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'default' => 'UTC', + 'public' => false, ), - 'date_format' => array( - 'description' => __( 'Date Format' ), + 'url' => array( + 'description' => __( 'Site Address (URL)' ), 'type' => 'string', + 'screen' => 'general', + 'format' => 'uri', 'context' => array( 'view', 'edit' ), + 'public' => true, ), - 'time_format' => array( - 'description' => __( 'Time Format' ), + 'wordpress_url' => array( + 'description' => __( 'WordPress Address (URL)' ), 'type' => 'string', + 'screen' => 'general', + 'format' => 'uri', 'context' => array( 'view', 'edit' ), + 'public' => true, ), 'start_of_week' => array( 'description' => __( 'Week Starts On' ), 'type' => 'integer', + 'screen' => 'general', 'context' => array( 'view', 'edit' ), + 'public' => true, 'arg_options' => array( 'sanitize_callback' => 'absint', ), ), + 'time_format' => array( + 'description' => __( 'Time Format' ), + 'type' => 'string', + 'screen' => 'general', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'timezone_string' => array( + 'description' => __( 'Timezone' ), + 'type' => 'string', + 'screen' => 'general', + 'context' => array( 'view', 'edit' ), + 'public' => true, + 'default' => 'UTC', + ), + 'users_can_register' => array( + 'description' => __( 'Membership' ), + 'type' => 'boolean', + 'screen' => 'general', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), 'locale' => array( 'description' => __( 'Site Language' ), 'type' => 'string', + 'screen' => 'general', 'context' => array( 'view', 'edit' ), + 'public' => true, 'default' => 'en_US', ), + + // Media + + 'large_size_h' => array( + 'description' => __( 'Large size height' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'large_size_w' => array( + 'description' => __( 'Large size width' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'medium_size_h' => array( + 'description' => __( 'Meduim size height' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'medium_size_w' => array( + 'description' => __( 'Meduim size width' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'thumbnail_crop' => array( + 'description' => __( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'thumbnail_size_h' => array( + 'description' => __( 'Thumbnail size height' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'thumbnail_size_w' => array( + 'description' => __( 'Thumbnail size width' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'uploads_use_yearmonth_folders' => array( + 'description' => __( 'Organize my uploads into month- and year-based folders' ), + 'type' => 'integer', + 'screen' => 'media', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + + // Permalinks + 'permalink_structure' => array( 'description' => __( 'Permalink Settings' ), 'type' => 'string', + 'screen' => 'permalinks', 'context' => array( 'view', 'edit' ), + 'public' => true, ), 'permalink_category_base' => array( 'description' => __( 'Category base' ), 'type' => 'string', + 'screen' => 'permalinks', 'context' => array( 'view', 'edit' ), + 'public' => true, ), 'permalink_tag_base' => array( 'description' => __( 'Tag base' ), 'type' => 'string', + 'screen' => 'permalinks', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + + // Reading + + 'robots_can_index' => array( + 'description' => __( 'It is up to search engines to honor this request.' ), + 'type' => 'integer', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'page_for_posts' => array( + 'description' => __( 'Posts page' ), + 'type' => 'integer', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'page_on_front' => array( + 'description' => __( 'Front page' ), + 'type' => 'integer', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'posts_per_page' => array( + 'description' => __( 'Blog pages show at most.' ), + 'type' => 'integer', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'posts_per_rss' => array( + 'description' => __( 'Syndication feeds show the most recent.' ), + 'type' => 'integer', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'rss_use_excerpt' => array( + 'description' => __( 'For each article in a feed, show.' ), + 'type' => 'integer', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'show_on_front' => array( + 'description' => __( '(radio) Front page displays.' ), + 'type' => 'string', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + 'show_on_front' => array( + 'description' => __( '(radio) Front page displays.' ), + 'type' => 'string', + 'screen' => 'reading', + 'context' => array( 'view', 'edit' ), + 'public' => true, + ), + + // Writing + + 'default_category' => array( + 'description' => __( 'Default Post Category.' ), + 'type' => 'integer', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'default_email_category' => array( + 'description' => __( 'Default Mail Category.' ), + 'type' => 'integer', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'default_post_format' => array( + 'description' => __( 'Default Post Format.' ), + 'type' => 'string', + 'screen' => 'writing', 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'mailserver_login' => array( + 'description' => __( 'Login Name.' ), + 'type' => 'string', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'mailserver_pass' => array( + 'description' => __( 'Password.' ), + 'type' => 'string', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'mailserver_port' => array( + 'description' => __( 'Port.' ), + 'type' => 'integer', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'mailserver_url' => array( + 'description' => __( 'Mail Server.' ), + 'type' => 'string', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, + ), + 'ping_sites' => array( + 'description' => __( 'When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see Update Services on the Codex. Separate multiple service URLs with line breaks.' ), + 'type' => 'string', + 'screen' => 'writing', + 'context' => array( 'view', 'edit' ), + 'public' => false, ), ), ); @@ -190,6 +565,15 @@ public function get_collection_params() { */ public function get_item_mappings() { return array( + + // Discussion + + 'comment_blacklist' => 'blacklist_keys', + 'comment_pagination' => 'page_comments', + 'comment_require_name_email' => 'require_name_email', + + // General + 'title' => 'blogname', 'tagline' => 'blogdescription', 'wordpress_url' => 'siteurl', @@ -200,9 +584,16 @@ public function get_item_mappings() { 'time_format' => 'time_format', 'start_of_week' => 'start_of_week', 'locale' => 'WPLANG', + + // Permalinks + 'permalink_structure' => 'permalink_structure', 'permalink_category_base' => 'category_base', 'permalink_tag_base' => 'tag_base', + + // Reading + + 'robots_can_index' => 'blog_public', ); } diff --git a/tests/test-rest-site-controller.php b/tests/test-rest-site-controller.php index ff70240..6d4d07a 100644 --- a/tests/test-rest-site-controller.php +++ b/tests/test-rest-site-controller.php @@ -51,7 +51,7 @@ public function test_get_item_schema() { $data = $response->get_data(); $properties = $data['schema']['properties']; - $this->assertEquals( 13, count( $properties ) ); + //$this->assertEquals( 13, count( $properties ) ); $this->assertArrayHasKey( 'title', $properties ); $this->assertArrayHasKey( 'tagline', $properties ); $this->assertArrayHasKey( 'wordpress_url', $properties ); From 1ec65af4c3e10ec69176ba140c788db22aab204b Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 2 Mar 2016 10:01:46 -0500 Subject: [PATCH 3/4] Removed Comment and Updated Unit Test * UPDATED: The unit test to check for the item schema has been updated to account for all the site options --- lib/class-wp-rest-site-controller.php | 2 -- tests/test-rest-site-controller.php | 20 ++++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/class-wp-rest-site-controller.php b/lib/class-wp-rest-site-controller.php index 8825cf9..e9db0b1 100644 --- a/lib/class-wp-rest-site-controller.php +++ b/lib/class-wp-rest-site-controller.php @@ -89,8 +89,6 @@ public function get_item_schema() { 'type' => 'object', 'properties' => array( - // Reference: https://docs.google.com/spreadsheets/d/1vI-s8MjbEllCR0_0BmBgaGvKNm1Fa42MCoqaKCwbRyQ/edit#gid=0 - // Discussion 'avatar_default' => array( diff --git a/tests/test-rest-site-controller.php b/tests/test-rest-site-controller.php index 6d4d07a..90e78ac 100644 --- a/tests/test-rest-site-controller.php +++ b/tests/test-rest-site-controller.php @@ -50,21 +50,13 @@ public function test_get_item_schema() { $response = $this->server->dispatch( $request ); $data = $response->get_data(); $properties = $data['schema']['properties']; + $schema = $this->endpoint->get_item_schema(); - //$this->assertEquals( 13, count( $properties ) ); - $this->assertArrayHasKey( 'title', $properties ); - $this->assertArrayHasKey( 'tagline', $properties ); - $this->assertArrayHasKey( 'wordpress_url', $properties ); - $this->assertArrayHasKey( 'url', $properties ); - $this->assertArrayHasKey( 'users_can_register', $properties ); - $this->assertArrayHasKey( 'timezone_string', $properties ); - $this->assertArrayHasKey( 'date_format', $properties ); - $this->assertArrayHasKey( 'time_format', $properties ); - $this->assertArrayHasKey( 'start_of_week', $properties ); - $this->assertArrayHasKey( 'locale', $properties ); - $this->assertArrayHasKey( 'permalink_structure', $properties ); - $this->assertArrayHasKey( 'permalink_category_base', $properties ); - $this->assertArrayHasKey( 'permalink_tag_base', $properties ); + $this->assertEquals( count( $schema['properties'] ), count( $properties ) ); + + foreach ( $schema['properties'] as $key => $option ) { + $this->assertArrayHasKey( $key, $properties ); + } } } From 46f04886d340e07bc0fbe343e9705c4e050eeb37 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 2 Mar 2016 11:57:26 -0500 Subject: [PATCH 4/4] Schema: Removed Un-needed Attributes * REMOVED: Screen and public attribute from each property --- lib/class-wp-rest-site-controller.php | 199 ++++++++------------------ 1 file changed, 62 insertions(+), 137 deletions(-) diff --git a/lib/class-wp-rest-site-controller.php b/lib/class-wp-rest-site-controller.php index e9db0b1..564fdb4 100644 --- a/lib/class-wp-rest-site-controller.php +++ b/lib/class-wp-rest-site-controller.php @@ -94,146 +94,107 @@ public function get_item_schema() { 'avatar_default' => array( 'description' => __( 'Default Avatar' ), 'type' => 'string', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'avatar_rating' => array( 'description' => __( 'Maximum Rating' ), 'type' => 'string', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'comment_blacklist' => array( 'description' => __( 'When a comment contains any of these words in its content, name, URL, email, or IP, it will be put in the trash. One word or IP per line. It will match inside words, so “press” will match “WordPress”.' ), - 'screen' => 'discussion', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'close_comments_days_old' => array( 'description' => __( '[integer, default: 14]' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'close_comments_for_old_posts' => array( 'description' => __( 'Automatically close comments on articles older than [integer, default: 14] days.' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'comment_max_links' => array( 'description' => __( 'Hold a comment in the queue if it contains [integer, default: 2] or more links. (A common characteristic of comment spam is a large number of hyperlinks.)' ), - 'screen' => 'discussion', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'comment_moderation' => array( 'description' => __( 'Comment must be manually approved.' ), - 'screen' => 'discussion', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'comment_order' => array( 'description' => __( 'Comments should be displayed with the ["older" or "newer", default: "older"] comments at the top of each page.' ), 'type' => 'string', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'comment_registration' => array( 'description' => __( 'Users must be registered and logged in to comment.' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'comment_whitelist' => array( 'description' => __( 'Comment author must have a previously approved comment.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'comments_notify' => array( 'description' => __( 'Anyone posts a comment.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'comments_per_page' => array( 'description' => __( '[integer, default: 50]' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'default_comment_status' => array( 'description' => __( 'Allow people to post comments on new articles.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'default_comments_page' => array( 'description' => __( '["last" or "first", default: "last"]' ), 'type' => 'string', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'default_ping_status' => array( 'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'default_pingback_flag' => array( 'description' => __( 'Attempt to notify any blogs linked to from the article.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'moderation_keys' => array( 'description' => __( 'When a comment contains any of these words in its content, name, URL, email, or IP, it will be held in the moderation queue. One word or IP per line. It will match inside words, so “press” will match “WordPress”.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'moderation_notify' => array( 'description' => __( 'A comment is held for moderation.' ), - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'comment_pagination' => array( 'description' => __( 'Break comments into pages with [integer, default: 50] top level comments per page and the ["last" or "first", default: "last"] page displayed by default.' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'comment_require_name_email' => array( 'description' => __( 'Comment author must fill out name and email.' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'show_avatars' => array( 'description' => __( 'Show Avatars.' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'thread_comments' => array( 'description' => __( 'Enable threaded (nested) comments [integer, default: 5] levels deep.' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'thread_comments_depth' => array( 'description' => __( '[integer, defaut: 5]' ), 'type' => 'integer', - 'screen' => 'discussion', 'context' => array( 'view', 'edit' ), - 'public' => true, ), // General @@ -241,9 +202,7 @@ public function get_item_schema() { 'admin_email' => array( 'description' => __( 'Email Address' ), 'type' => 'string', - 'screen' => 'general', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), @@ -251,9 +210,7 @@ public function get_item_schema() { 'tagline' => array( 'description' => __( 'Tagline' ), 'type' => 'string', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), @@ -261,9 +218,7 @@ public function get_item_schema() { 'title' => array( 'description' => __( 'Site Title' ), 'type' => 'string', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), @@ -271,39 +226,32 @@ public function get_item_schema() { 'date_format' => array( 'description' => __( 'Date Format' ), 'type' => 'string', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'default_role' => array( 'description' => __( 'New User Role Default' ), 'type' => 'string', - 'screen' => 'general', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'url' => array( 'description' => __( 'Site Address (URL)' ), 'type' => 'string', - 'screen' => 'general', 'format' => 'uri', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'wordpress_url' => array( 'description' => __( 'WordPress Address (URL)' ), 'type' => 'string', - 'screen' => 'general', 'format' => 'uri', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'start_of_week' => array( 'description' => __( 'Week Starts On' ), 'type' => 'integer', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, 'arg_options' => array( 'sanitize_callback' => 'absint', ), @@ -311,32 +259,33 @@ public function get_item_schema() { 'time_format' => array( 'description' => __( 'Time Format' ), 'type' => 'string', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'timezone_string' => array( 'description' => __( 'Timezone' ), 'type' => 'string', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, 'default' => 'UTC', + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'users_can_register' => array( 'description' => __( 'Membership' ), 'type' => 'boolean', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'locale' => array( 'description' => __( 'Site Language' ), 'type' => 'string', - 'screen' => 'general', 'context' => array( 'view', 'edit' ), - 'public' => true, 'default' => 'en_US', + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), // Media @@ -344,58 +293,42 @@ public function get_item_schema() { 'large_size_h' => array( 'description' => __( 'Large size height' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'large_size_w' => array( 'description' => __( 'Large size width' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'medium_size_h' => array( 'description' => __( 'Meduim size height' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'medium_size_w' => array( 'description' => __( 'Meduim size width' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'thumbnail_crop' => array( 'description' => __( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'thumbnail_size_h' => array( 'description' => __( 'Thumbnail size height' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'thumbnail_size_w' => array( 'description' => __( 'Thumbnail size width' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'uploads_use_yearmonth_folders' => array( 'description' => __( 'Organize my uploads into month- and year-based folders' ), 'type' => 'integer', - 'screen' => 'media', 'context' => array( 'view', 'edit' ), - 'public' => true, ), // Permalinks @@ -403,23 +336,26 @@ public function get_item_schema() { 'permalink_structure' => array( 'description' => __( 'Permalink Settings' ), 'type' => 'string', - 'screen' => 'permalinks', 'context' => array( 'view', 'edit' ), - 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'permalink_category_base' => array( 'description' => __( 'Category base' ), 'type' => 'string', - 'screen' => 'permalinks', 'context' => array( 'view', 'edit' ), - 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'permalink_tag_base' => array( 'description' => __( 'Tag base' ), 'type' => 'string', - 'screen' => 'permalinks', 'context' => array( 'view', 'edit' ), - 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), // Reading @@ -427,58 +363,48 @@ public function get_item_schema() { 'robots_can_index' => array( 'description' => __( 'It is up to search engines to honor this request.' ), 'type' => 'integer', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'page_for_posts' => array( 'description' => __( 'Posts page' ), 'type' => 'integer', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'page_on_front' => array( 'description' => __( 'Front page' ), 'type' => 'integer', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'posts_per_page' => array( 'description' => __( 'Blog pages show at most.' ), 'type' => 'integer', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'posts_per_rss' => array( 'description' => __( 'Syndication feeds show the most recent.' ), 'type' => 'integer', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'rss_use_excerpt' => array( 'description' => __( 'For each article in a feed, show.' ), 'type' => 'integer', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, ), 'show_on_front' => array( 'description' => __( '(radio) Front page displays.' ), 'type' => 'string', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'show_on_front' => array( 'description' => __( '(radio) Front page displays.' ), 'type' => 'string', - 'screen' => 'reading', 'context' => array( 'view', 'edit' ), - 'public' => true, + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), // Writing @@ -486,58 +412,57 @@ public function get_item_schema() { 'default_category' => array( 'description' => __( 'Default Post Category.' ), 'type' => 'integer', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'default_email_category' => array( 'description' => __( 'Default Mail Category.' ), 'type' => 'integer', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'default_post_format' => array( 'description' => __( 'Default Post Format.' ), 'type' => 'string', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'mailserver_login' => array( 'description' => __( 'Login Name.' ), 'type' => 'string', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'mailserver_pass' => array( 'description' => __( 'Password.' ), 'type' => 'string', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'mailserver_port' => array( 'description' => __( 'Port.' ), 'type' => 'integer', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), ), 'mailserver_url' => array( 'description' => __( 'Mail Server.' ), 'type' => 'string', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), 'ping_sites' => array( 'description' => __( 'When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see Update Services on the Codex. Separate multiple service URLs with line breaks.' ), 'type' => 'string', - 'screen' => 'writing', - 'context' => array( 'view', 'edit' ), - 'public' => false, + 'context' => array( 'edit' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), ), ), );