Completed
Push — merge/class.wpcom-json-api-lis... ( cd80b1...e9e807 )
by
unknown
79:57 queued 70:23
created

Jetpack_Site::get_plan()   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 wp_memory_limit() {
34
		return wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
35
	}
36
37
	protected function wp_max_memory_limit() {
38
		return wp_convert_hr_to_bytes( WP_MAX_MEMORY_LIMIT );
39
	}
40
41
	protected function is_main_network() {
42
		return Jetpack::is_multi_network();
43
	}
44
45
	public function is_multisite() {
46
		return (bool) is_multisite();
47
	}
48
49
	public function is_single_user_site() {
50
		return (bool) Jetpack::is_single_user_site();
51
	}
52
53
	protected function is_version_controlled() {
54
		return Jetpack_Sync_Functions::is_version_controlled();
55
	}
56
57
	protected function file_system_write_access() {
58
		return Jetpack_Sync_Functions::file_system_write_access();
59
	}
60
61
	protected function current_theme_supports( $feature_name ) {
62
		return current_theme_supports( $feature_name );
63
	}
64
65
	protected function get_theme_support( $feature_name ) {
66
		return get_theme_support( $feature_name );
67
	}
68
69
	public function get_updates() {
70
		return (array) Jetpack::get_updates();
71
	}
72
73
	function get_id() {
74
		return $this->platform->token->blog_id;
75
	}
76
77
	function has_videopress() {
78
		// 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...
79
		$videopress = Jetpack_Options::get_option( 'videopress', array() );
80
		if ( isset( $videopress['blog_id'] ) && $videopress['blog_id'] > 0 ) {
81
			return true;
82
		}
83
84
		return false;
85
	}
86
87
	function upgraded_filetypes_enabled() {
88
		return true;
89
	}
90
91
	function is_mapped_domain() {
92
		return true;
93
	}
94
95
	function is_redirect() {
96
		return false;
97
	}
98
99
	function is_following() {
100
		return false;
101
	}
102
103
	function has_wordads() {
104
		return Jetpack::is_module_active( 'wordads' );
105
	}
106
107
	function get_frame_nonce() {
108
		return false;
109
	}
110
111
	function is_headstart_fresh() {
112
		return false;
113
	}
114
115
	function allowed_file_types() {
116
		$allowed_file_types = array();
117
118
		// http://codex.wordpress.org/Uploading_Files
119
		$mime_types = get_allowed_mime_types();
120
		foreach ( $mime_types as $type => $mime_type ) {
121
			$extras = explode( '|', $type );
122
			foreach ( $extras as $extra ) {
123
				$allowed_file_types[] = $extra;
124
			}
125
		}
126
127
		return $allowed_file_types;
128
	}
129
130
	function is_private() {
131
		return false;
132
	}
133
134
	function get_plan() {
135
		return false;
136
	}
137
138
	function get_subscribers_count() {
139
		return 0; // special magic fills this in on the WPCOM side
140
	}
141
142
	function get_capabilities() {
143
		return false;
144
	}
145
146
	function get_locale() {
147
		return get_bloginfo( 'language' );
148
	}
149
150
	function is_jetpack() {
151
		return true;
152
	}
153
154
	public function get_jetpack_version() {
155
		return JETPACK__VERSION;
156
	}
157
158
	function get_ak_vp_bundle_enabled() {}
159
160
	function get_jetpack_seo_front_page_description() {
161
		return Jetpack_SEO_Utils::get_front_page_meta_description();
162
	}
163
164
	function get_jetpack_seo_title_formats() {
165
		return Jetpack_SEO_Titles::get_custom_title_formats();
166
	}
167
168
	function get_verification_services_codes() {
169
		return get_option( 'verification_services_codes', null );
170
	}
171
172
	function get_podcasting_archive() {
173
		return null;
174
	}
175
176
	function is_connected_site() {
177
		return true;
178
	}
179
180
	function current_user_can( $role ) {
181
		return current_user_can( $role );
182
	}
183
184
	/**
185
	 * Post functions
186
	 */
187
188
	function wrap_post( $post, $context ) {
189
		return new Jetpack_Post( $this, $post, $context );
190
	}
191
192
}
193