Completed
Push — fix/inline-docs-410 ( f96891...63b75c )
by
unknown
43:24 queued 33:40
created

Jetpack_Site::is_following()   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_constant( $name ) {
10
		if ( defined( $name) ) {
11
			return constant( $name );
12
		}
13
		return null;
14
	}
15
16
	protected function main_network_site() {
17
		return network_site_url();
18
	}
19
20
	protected function wp_version() {
21
		global $wp_version;
22
		return $wp_version;
23
	}
24
25
	protected function max_upload_size() {
26
		return wp_max_upload_size();
27
	}
28
29
	protected function is_main_network() {
30
		return Jetpack::is_multi_network();
31
	}
32
33
	protected function is_multi_site() {
34
		return is_multisite();
35
	}
36
37
	protected function is_version_controlled() {
38
		return Jetpack_Sync_Functions::is_version_controlled();
39
	}
40
41
	protected function file_system_write_access() {
42
		return Jetpack_Sync_Functions::file_system_write_access();
43
	}
44
45
	protected function current_theme_supports( $feature_name ) {
46
		return current_theme_supports( $feature_name );
47
	}
48
49
	protected function get_theme_support( $feature_name ) {
50
		return get_theme_support( $feature_name );
51
	}
52
53
	protected function get_updates() {
54
		return (array) Jetpack::get_updates();
55
	}
56
57
	function get_id() {
58
		return $this->platform->token->blog_id;	
59
	}
60
61
	function has_videopress() {
62
		// 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...
63
		$videopress = Jetpack_Options::get_option( 'videopress', array() );
64
		if ( isset( $videopress['blog_id'] ) && $videopress['blog_id'] > 0 ) {
65
			return true;
66
		}
67
68
		return false;
69
	}
70
71
	function upgraded_filetypes_enabled() {
72
		return true;
73
	}
74
75
	function is_mapped_domain() {
76
		return true;
77
	}
78
79
	function is_redirect() {
80
		return false;
81
	}
82
83
	function is_following() {
84
		return false;
85
	}
86
87
	function has_wordads() {
88
		// 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...
89
		return false;
90
	}
91
92
	function get_frame_nonce() {
93
		return false;
94
	}
95
96
	function allowed_file_types() {
97
		$allowed_file_types = array();
98
99
		// http://codex.wordpress.org/Uploading_Files
100
		$mime_types = get_allowed_mime_types();
101
		foreach ( $mime_types as $type => $mime_type ) {
102
			$extras = explode( '|', $type );
103
			foreach ( $extras as $extra ) {
104
				$allowed_file_types[] = $extra;
105
			}
106
		}
107
108
		return $allowed_file_types;
109
	}
110
111
	function is_private() {
112
		return false;
113
	}
114
115
	function get_plan() {
116
		return false;
117
	}
118
119
	function get_subscribers_count() {
120
		return 0; // special magic fills this in on the WPCOM side
121
	}
122
123
	function get_capabilities() {
124
		return false;
125
	}
126
127
	function get_locale() {
128
		return get_bloginfo( 'language' );
129
	}
130
131
	function get_icon() {
132
		if ( function_exists( 'jetpack_site_icon_url' ) && function_exists( 'jetpack_photon_url' ) ) {
133
			return array(
134
				'img' => (string) jetpack_photon_url( jetpack_site_icon_url( get_current_blog_id() , 80 ), array( 'w' => 80 ), 'https' ),
135
				'ico' => (string) jetpack_photon_url( jetpack_site_icon_url( get_current_blog_id() , 16 ), array( 'w' => 16 ), 'https' ),
136
			);
137
		}
138
139
		return null;
140
	}
141
142
	function is_jetpack() {
143
		return true;
144
	}
145
146
	protected function get_jetpack_version() {
147
		return JETPACK__VERSION;
148
	}
149
150
	function get_ak_vp_bundle_enabled() {}
151
152
	/**
153
	 * Post functions
154
	 */
155
156
	function wrap_post( $post, $context ) {
157
		return new Jetpack_Post( $this, $post, $context );
158
	}
159
160
}
161