Completed
Push — master-stable ( 3751a6...e73511 )
by
unknown
40:58 queued 32:02
created

class.wpcom-json-api-get-site-v1-2-endpoint.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 * WARNING: This file is distributed verbatim in Jetpack.
4
 * There should be nothing WordPress.com specific in this file.
5
 *
6
 * @hide-in-jetpack
7
 */
8
9
class WPCOM_JSON_API_GET_Site_V1_2_Endpoint extends WPCOM_JSON_API_GET_Site_Endpoint {
10
11
	public static $site_format = array(
12
 		'ID'                => '(int) Site ID',
13
 		'name'              => '(string) Title of site',
14
 		'description'       => '(string) Tagline or description of site',
15
 		'URL'               => '(string) Full URL to the site',
16
 		'jetpack'           => '(bool)  Whether the site is a Jetpack site or not',
17
 		'post_count'        => '(int) The number of posts the site has',
18
		'subscribers_count' => '(int) The number of subscribers the site has',
19
		'locale'            => '(string) Primary locale code of the site',
20
		'icon'              => '(array) An array of icon formats for the site',
21
		'logo'              => '(array) The site logo, set in the Customizer',
22
		'visible'           => '(bool) If this site is visible in the user\'s site list',
23
		'is_private'        => '(bool) If the site is a private site or not',
24
		'is_following'      => '(bool) If the current user is subscribed to this site in the reader',
25
		'options'           => '(array) An array of options/settings for the blog. Only viewable by users with post editing rights to the site. Note: Post formats is deprecated, please see /sites/$id/post-formats/',
26
		'updates'           => '(array) An array of available updates for plugins, themes, wordpress, and languages.',
27
		'jetpack_modules'   => '(array) A list of active Jetpack modules.',
28
		'meta'              => '(object) Meta data',
29
	);
30
31
	function callback( $path = '', $blog_id = 0 ) {
32
		add_filter( 'sites_site_format', array( $this, 'site_format' ) );
33
34
		return parent::callback( $path, $blog_id );
35
	}
36
37
	//V1.2 renames lang to locale
38 View Code Duplication
	protected function process_locale( $key, $is_user_logged_in ) {
39
		if ( $is_user_logged_in && 'locale' == $key ) {
40
			if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
41
				if ( ! is_jetpack_site() ) {
42
					return (string) get_blog_lang_code();
43
				}
44
			}
45
		}
46
		return false;
47
	}
48
49
	public function site_format( $format ) {
0 ignored issues
show
The parameter $format is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
		return self::$site_format;
51
	}
52
}
53