Completed
Push — add/jetpack-frame-nonce ( 3bbb54 )
by Kirk
53:16 queued 46:18
created

Jetpack_Site::get_jetpack_frame_nonce()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 3
c 0
b 0
f 0
cc 1
nop 0
rs 10
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
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 get_jetpack_frame_nonce() {
112
		return false;
113
	}
114
115
	function is_headstart_fresh() {
116
		return false;
117
	}
118
119
	function allowed_file_types() {
120
		$allowed_file_types = array();
121
122
		// http://codex.wordpress.org/Uploading_Files
123
		$mime_types = get_allowed_mime_types();
124
		foreach ( $mime_types as $type => $mime_type ) {
125
			$extras = explode( '|', $type );
126
			foreach ( $extras as $extra ) {
127
				$allowed_file_types[] = $extra;
128
			}
129
		}
130
131
		return $allowed_file_types;
132
	}
133
134
	function is_private() {
135
		return false;
136
	}
137
138
	function get_plan() {
139
		return false;
140
	}
141
142
	function get_subscribers_count() {
143
		return 0; // special magic fills this in on the WPCOM side
144
	}
145
146
	function get_capabilities() {
147
		return false;
148
	}
149
150
	function get_locale() {
151
		return get_bloginfo( 'language' );
152
	}
153
154
	function is_jetpack() {
155
		return true;
156
	}
157
158
	public function get_jetpack_version() {
159
		return JETPACK__VERSION;
160
	}
161
162
	function get_ak_vp_bundle_enabled() {}
163
164
	function get_jetpack_seo_front_page_description() {
165
		return Jetpack_SEO_Utils::get_front_page_meta_description();
166
	}
167
168
	function get_jetpack_seo_title_formats() {
169
		return Jetpack_SEO_Titles::get_custom_title_formats();
170
	}
171
172
	function get_verification_services_codes() {
173
		return get_option( 'verification_services_codes', null );
174
	}
175
176
	function get_podcasting_archive() {
177
		return null;
178
	}
179
180
	function is_connected_site() {
181
		return true;
182
	}
183
184
	function current_user_can( $role ) {
185
		return current_user_can( $role );
186
	}
187
188
	/**
189
	 * Post functions
190
	 */
191
192
	function wrap_post( $post, $context ) {
193
		return new Jetpack_Post( $this, $post, $context );
194
	}
195
196
}
197