1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
require_once dirname( __FILE__ ) . '/class.json-api-site-jetpack-base.php'; |
4
|
|
|
|
5
|
|
|
// this code runs on Jetpack (.org) sites |
6
|
|
|
class Jetpack_Site extends Abstract_Jetpack_Site { |
7
|
|
|
|
8
|
|
|
protected function get_mock_option( $name ) { |
9
|
|
|
return get_option( 'jetpack_'.$name ); |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
protected function get_constant( $name ) { |
13
|
|
|
if ( defined( $name) ) { |
14
|
|
|
return constant( $name ); |
15
|
|
|
} |
16
|
|
|
return null; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
protected function current_theme_supports( $feature_name ) { |
20
|
|
|
return current_theme_supports( $feature_name ); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
protected function get_theme_support( $feature_name ) { |
24
|
|
|
return get_theme_support( $feature_name ); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
function has_videopress() { |
28
|
|
|
// TODO - this only works on wporg site - need to detect videopress option for remote Jetpack site on WPCOM |
|
|
|
|
29
|
|
|
$videopress = Jetpack_Options::get_option( 'videopress', array() ); |
30
|
|
|
if ( isset( $videopress['blog_id'] ) && $videopress['blog_id'] > 0 ) { |
31
|
|
|
return true; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
return false; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
function upgraded_filetypes_enabled() { |
38
|
|
|
return true; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
function is_mapped_domain() { |
42
|
|
|
return true; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
function is_redirect() { |
46
|
|
|
return false; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
function is_following() { |
50
|
|
|
return false; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
function has_wordads() { |
54
|
|
|
// TODO: any way to detect wordads on the site, or does it need to be modified on the way through? |
|
|
|
|
55
|
|
|
return false; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
function get_frame_nonce() { |
59
|
|
|
return false; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
function allowed_file_types() { |
63
|
|
|
$allowed_file_types = array(); |
64
|
|
|
|
65
|
|
|
// http://codex.wordpress.org/Uploading_Files |
66
|
|
|
$mime_types = get_allowed_mime_types(); |
67
|
|
|
foreach ( $mime_types as $type => $mime_type ) { |
68
|
|
|
$extras = explode( '|', $type ); |
69
|
|
|
foreach ( $extras as $extra ) { |
70
|
|
|
$allowed_file_types[] = $extra; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
return $allowed_file_types; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
function is_private() { |
78
|
|
|
return false; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
function get_plan() { |
82
|
|
|
return false; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
function get_subscribers_count() { |
86
|
|
|
return 0; // special magic fills this in on the WPCOM side |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
function get_capabilities() { |
90
|
|
|
return false; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
function get_locale() { |
94
|
|
|
return get_bloginfo( 'language' ); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
function get_icon() { |
98
|
|
|
if ( function_exists( 'jetpack_site_icon_url' ) && function_exists( 'jetpack_photon_url' ) ) { |
99
|
|
|
return array( |
100
|
|
|
'img' => (string) jetpack_photon_url( jetpack_site_icon_url( get_current_blog_id() , 80 ), array( 'w' => 80 ), 'https' ), |
101
|
|
|
'ico' => (string) jetpack_photon_url( jetpack_site_icon_url( get_current_blog_id() , 16 ), array( 'w' => 16 ), 'https' ), |
102
|
|
|
); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
return null; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
function is_jetpack() { |
109
|
|
|
return true; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
protected function get_jetpack_version() { |
113
|
|
|
return JETPACK__VERSION; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
function get_ak_vp_bundle_enabled() {} |
117
|
|
|
|
118
|
|
|
} |
119
|
|
|
|