Completed
Push — feature/sync-json-endpoints ( bf1919...f7fa9b )
by
unknown
33:49 queued 21:50
created

Jetpack_Site::is_multi_site()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
require_once dirname( __FILE__ ) . '/class.json-api-site-jetpack-base.php';
4
require_once dirname( __FILE__ ) . '/class.json-api-post-jetpack.php';
5
6
// this code runs on Jetpack (.org) sites
7
class Jetpack_Site extends Abstract_Jetpack_Site {
8
9
	protected function get_mock_option( $name ) {
10
		return get_option( 'jetpack_'.$name );
11
	}
12
13
	protected function get_constant( $name ) {
14
		if ( defined( $name) ) {
15
			return constant( $name );
16
		}
17
		return null;
18
	}
19
20
	protected function main_network_site() {
21
		return network_site_url();
22
	}
23
24
	protected function wp_version() {
25
		global $wp_version;
26
		return $wp_version;
27
	}
28
29
	protected function max_upload_size() {
30
		return wp_max_upload_size();
31
	}
32
33
	protected function is_main_network() {
34
		return Jetpack::is_multi_network();
35
	}
36
37
	public function is_multisite() {
38
		return (bool) is_multisite();
39
	}
40
41
	public function is_single_user_site() {
42
		return (bool) Jetpack::is_single_user_site();
43
	}
44
45
	protected function is_version_controlled() {
46
		return Jetpack_Sync_Functions::is_version_controlled();
47
	}
48
49
	protected function file_system_write_access() {
50
		return Jetpack_Sync_Functions::file_system_write_access();
51
	}
52
53
	protected function current_theme_supports( $feature_name ) {
54
		return current_theme_supports( $feature_name );
55
	}
56
57
	protected function get_theme_support( $feature_name ) {
58
		return get_theme_support( $feature_name );
59
	}
60
61
	public function get_updates() {
62
		return (array) Jetpack::get_updates();
63
	}
64
65
	function get_id() {
66
		return $this->platform->token->blog_id;
67
	}
68
69
	function has_videopress() {
70
		// TODO - this only works on wporg site - need to detect videopress option for remote Jetpack site on WPCOM
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
71
		$videopress = Jetpack_Options::get_option( 'videopress', array() );
72
		if ( isset( $videopress['blog_id'] ) && $videopress['blog_id'] > 0 ) {
73
			return true;
74
		}
75
76
		return false;
77
	}
78
79
	function upgraded_filetypes_enabled() {
80
		return true;
81
	}
82
83
	function is_mapped_domain() {
84
		return true;
85
	}
86
87
	function is_redirect() {
88
		return false;
89
	}
90
91
	function is_following() {
92
		return false;
93
	}
94
95
	function has_wordads() {
96
		// TODO: any way to detect wordads on the site, or does it need to be modified on the way through?
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
97
		return false;
98
	}
99
100
	function get_frame_nonce() {
101
		return false;
102
	}
103
104
	function is_headstart_fresh() {
105
		return false;
106
	}
107
108
	function allowed_file_types() {
109
		$allowed_file_types = array();
110
111
		// http://codex.wordpress.org/Uploading_Files
112
		$mime_types = get_allowed_mime_types();
113
		foreach ( $mime_types as $type => $mime_type ) {
114
			$extras = explode( '|', $type );
115
			foreach ( $extras as $extra ) {
116
				$allowed_file_types[] = $extra;
117
			}
118
		}
119
120
		return $allowed_file_types;
121
	}
122
123
	function is_private() {
124
		return false;
125
	}
126
127
	function get_plan() {
128
		return false;
129
	}
130
131
	function get_subscribers_count() {
132
		return 0; // special magic fills this in on the WPCOM side
133
	}
134
135
	function get_capabilities() {
136
		return false;
137
	}
138
139
	function get_locale() {
140
		return get_bloginfo( 'language' );
141
	}
142
143
	function is_jetpack() {
144
		return true;
145
	}
146
147
	public function get_jetpack_version() {
148
		return JETPACK__VERSION;
149
	}
150
151
	function get_ak_vp_bundle_enabled() {}
152
153
	function get_jetpack_seo_front_page_description() {
154
		return Jetpack_SEO_Utils::get_front_page_meta_description();
155
	}
156
157
	function get_jetpack_seo_title_formats() {
158
		return Jetpack_SEO_Titles::get_custom_title_formats();
159
	}
160
161
	function get_verification_services_codes() {
162
		return get_option( 'verification_services_codes', null );
163
	}
164
165
	function get_podcasting_archive() {
166
		return null;
167
	}
168
169
	/**
170
	 * Post functions
171
	 */
172
173
	function wrap_post( $post, $context ) {
174
		return new Jetpack_Post( $this, $post, $context );
175
	}
176
177
}
178