Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 117
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
WPCOM_JSON_API_Site_Settings_V1_3_Endpoint
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 get_defaults
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
3if ( ! defined( 'ABSPATH' ) ) {
4    exit( 0 );
5}
6
7new WPCOM_JSON_API_Site_Settings_V1_3_Endpoint(
8    array(
9        'description'      => 'Get detailed settings information about a site.',
10        'group'            => '__do_not_document',
11        'stat'             => 'sites:X',
12        'min_version'      => '1.3',
13        'method'           => 'GET',
14        'path'             => '/sites/%s/settings',
15        'path_labels'      => array(
16            '$site' => '(int|string) Site ID or domain',
17        ),
18
19        'query_parameters' => array(
20            'context' => false,
21        ),
22
23        'response_format'  => WPCOM_JSON_API_Site_Settings_Endpoint::$site_format,
24
25        'example_request'  => 'https://public-api.wordpress.com/rest/v1.3/sites/en.blog.wordpress.com/settings?pretty=1',
26    )
27);
28
29new WPCOM_JSON_API_Site_Settings_V1_3_Endpoint(
30    array(
31        'description'     => 'Update settings for a site.',
32        'group'           => '__do_not_document',
33        'stat'            => 'sites:X',
34        'min_version'     => '1.3',
35        'method'          => 'POST',
36        'path'            => '/sites/%s/settings',
37        'path_labels'     => array(
38            '$site' => '(int|string) Site ID or domain',
39        ),
40
41        'request_format'  => array(
42            'blogname'                                => '(string) Blog name',
43            'blogdescription'                         => '(string) Blog description',
44            'default_pingback_flag'                   => '(bool) Notify blogs linked from article?',
45            'default_ping_status'                     => '(bool) Allow link notifications from other blogs?',
46            'default_comment_status'                  => '(bool) Allow comments on new articles?',
47            'blog_public'                             => '(string) Site visibility; -1: private, 0: discourage search engines, 1: allow search engines',
48            'jetpack_sync_non_public_post_stati'      => '(bool) allow sync of post and pages with non-public posts stati',
49            'jetpack_relatedposts_enabled'            => '(bool) Enable related posts?',
50            'jetpack_relatedposts_show_context'       => '(bool) Show post\'s tags and category in related posts?',
51            'jetpack_relatedposts_show_date'          => '(bool) Show date in related posts?',
52            'jetpack_relatedposts_show_headline'      => '(bool) Show headline in related posts?',
53            'jetpack_relatedposts_show_thumbnails'    => '(bool) Show thumbnails in related posts?',
54            'instant_search_enabled'                  => '(bool) Enable the new Jetpack Instant Search interface',
55            'jetpack_search_enabled'                  => '(bool) Enable Jetpack Search',
56            'jetpack_search_supported'                => '(bool) Jetpack Search supported',
57            'jetpack_protect_whitelist'               => '(array) List of IP addresses to always allow',
58            'infinite_scroll'                         => '(bool) Support infinite scroll of posts?',
59            'default_category'                        => '(int) Default post category',
60            'default_post_format'                     => '(string) Default post format',
61            'require_name_email'                      => '(bool) Require comment authors to fill out name and email?',
62            'comment_registration'                    => '(bool) Require users to be registered and logged in to comment?',
63            'close_comments_for_old_posts'            => '(bool) Automatically close comments on old posts?',
64            'close_comments_days_old'                 => '(int) Age at which to close comments',
65            'thread_comments'                         => '(bool) Enable threaded comments?',
66            'thread_comments_depth'                   => '(int) Depth to thread comments',
67            'page_comments'                           => '(bool) Break comments into pages?',
68            'comments_per_page'                       => '(int) Number of comments to display per page',
69            'default_comments_page'                   => '(string) newest|oldest Which page of comments to display first',
70            'comment_order'                           => '(string) asc|desc Order to display comments within page',
71            'comments_notify'                         => '(bool) Email me when someone comments?',
72            'moderation_notify'                       => '(bool) Email me when a comment is helf for moderation?',
73            'social_notifications_like'               => '(bool) Email me when someone likes my post?',
74            'social_notifications_reblog'             => '(bool) Email me when someone reblogs my post?',
75            'social_notifications_subscribe'          => '(bool) Email me when someone subscribes to my blog?',
76            'comment_moderation'                      => '(bool) Moderate comments for manual approval?',
77            'comment_previously_approved'             => '(bool) Moderate comments unless author has a previously-approved comment?',
78            'comment_max_links'                       => '(int) Moderate comments that contain X or more links',
79            'moderation_keys'                         => '(string) Words or phrases that trigger comment moderation, one per line',
80            'disallowed_keys'                         => '(string) Words or phrases that mark comment spam, one per line',
81            'lang_id'                                 => '(int) ID for language blog is written in',
82            'locale'                                  => '(string) locale code for language blog is written in',
83            'wga'                                     => '(array) Google Analytics Settings',
84            'disabled_likes'                          => '(bool) Are likes globally disabled (they can still be turned on per post)?',
85            'disabled_reblogs'                        => '(bool) Are reblogs disabled on posts?',
86            'jetpack_comment_likes_enabled'           => '(bool) Are comment likes enabled for all comments?',
87            'sharing_button_style'                    => '(string) Style to use for sharing buttons (icon-text, icon, text, or official)',
88            'sharing_label'                           => '(string) Label to use for sharing buttons, e.g. "Share this:"',
89            'sharing_show'                            => '(string|array:string) Post type or array of types where sharing buttons are to be displayed',
90            'sharing_open_links'                      => '(string) Link target for sharing buttons (same or new)',
91            'twitter_via'                             => '(string) Twitter username to include in tweets when people share using the Twitter button',
92            'jetpack-twitter-cards-site-tag'          => '(string) The Twitter username of the owner of the site\'s domain.',
93            'eventbrite_api_token'                    => '(int) The Keyring token ID for an Eventbrite token to associate with the site',
94            'timezone_string'                         => '(string) PHP-compatible timezone string like \'UTC-5\'',
95            'gmt_offset'                              => '(int) Site offset from UTC in hours',
96            'date_format'                             => '(string) PHP Date-compatible date format',
97            'time_format'                             => '(string) PHP Date-compatible time format',
98            'start_of_week'                           => '(int) Starting day of week (0 = Sunday, 6 = Saturday)',
99            'jetpack_testimonial'                     => '(bool) Whether testimonial custom post type is enabled for the site',
100            'jetpack_testimonial_posts_per_page'      => '(int) Number of testimonials to show per page',
101            'jetpack_portfolio'                       => '(bool) Whether portfolio custom post type is enabled for the site',
102            'jetpack_portfolio_posts_per_page'        => '(int) Number of portfolio projects to show per page',
103            Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION => '(string) The SEO meta description for the site.',
104            Jetpack_SEO_Titles::TITLE_FORMATS_OPTION  => '(array) SEO meta title formats. Allowed keys: front_page, posts, pages, groups, archives',
105            'verification_services_codes'             => '(array) Website verification codes. Allowed keys: google, pinterest, bing, yandex, facebook',
106            'podcasting_archive'                      => '(string) The post category, if any, used for publishing podcasts',
107            'site_icon'                               => '(int) Media attachment ID to use as site icon. Set to zero or an otherwise empty value to clear',
108            'api_cache'                               => '(bool) Turn on/off the Jetpack JSON API cache',
109            'posts_per_page'                          => '(int) Number of posts to show on blog pages',
110            'posts_per_rss'                           => '(int) Number of posts to show in the RSS feed',
111            'rss_use_excerpt'                         => '(bool) Whether the RSS feed will use post excerpts',
112            'wpcom_publish_posts_with_markdown'       => '(bool) Whether markdown is enabled for posts',
113            'wpcom_publish_comments_with_markdown'    => '(bool) Whether markdown is enabled for comments',
114        ),
115
116        'response_format' => array(
117            'updated' => '(array)',
118        ),
119
120        'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/settings?pretty=1',
121    )
122);
123
124/**
125 * Site settings v1_3 endpoint class.
126 *
127 * @phan-constructor-used-for-side-effects
128 */
129class WPCOM_JSON_API_Site_Settings_V1_3_Endpoint extends WPCOM_JSON_API_Site_Settings_V1_2_Endpoint {
130
131    /**
132     * Get defaults.
133     *
134     * @return array
135     */
136    protected function get_defaults() {
137        return array(
138            'code'                 => '',
139            'anonymize_ip'         => false,
140            'ec_track_purchases'   => false,
141            'ec_track_add_to_cart' => false,
142        );
143    }
144}