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 current_theme_supports( $feature_name ) { |
21
|
|
|
return current_theme_supports( $feature_name ); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
protected function get_theme_support( $feature_name ) { |
25
|
|
|
return get_theme_support( $feature_name ); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
function get_id() { |
29
|
|
|
return $this->platform->token->blog_id; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
function has_videopress() { |
33
|
|
|
// TODO - this only works on wporg site - need to detect videopress option for remote Jetpack site on WPCOM |
|
|
|
|
34
|
|
|
$videopress = Jetpack_Options::get_option( 'videopress', array() ); |
35
|
|
|
if ( isset( $videopress['blog_id'] ) && $videopress['blog_id'] > 0 ) { |
36
|
|
|
return true; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
return false; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
function upgraded_filetypes_enabled() { |
43
|
|
|
return true; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
function is_mapped_domain() { |
47
|
|
|
return true; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
function is_redirect() { |
51
|
|
|
return false; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
function is_following() { |
55
|
|
|
return false; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
function has_wordads() { |
59
|
|
|
// TODO: any way to detect wordads on the site, or does it need to be modified on the way through? |
|
|
|
|
60
|
|
|
return false; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
function get_frame_nonce() { |
64
|
|
|
return false; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
function allowed_file_types() { |
68
|
|
|
$allowed_file_types = array(); |
69
|
|
|
|
70
|
|
|
// http://codex.wordpress.org/Uploading_Files |
71
|
|
|
$mime_types = get_allowed_mime_types(); |
72
|
|
|
foreach ( $mime_types as $type => $mime_type ) { |
73
|
|
|
$extras = explode( '|', $type ); |
74
|
|
|
foreach ( $extras as $extra ) { |
75
|
|
|
$allowed_file_types[] = $extra; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
return $allowed_file_types; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
function is_private() { |
83
|
|
|
return false; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
function get_plan() { |
87
|
|
|
return false; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
function get_subscribers_count() { |
91
|
|
|
return 0; // special magic fills this in on the WPCOM side |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
function get_capabilities() { |
95
|
|
|
return false; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
function get_locale() { |
99
|
|
|
return get_bloginfo( 'language' ); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
function get_icon() { |
103
|
|
|
if ( function_exists( 'jetpack_site_icon_url' ) && function_exists( 'jetpack_photon_url' ) ) { |
104
|
|
|
return array( |
105
|
|
|
'img' => (string) jetpack_photon_url( jetpack_site_icon_url( get_current_blog_id() , 80 ), array( 'w' => 80 ), 'https' ), |
106
|
|
|
'ico' => (string) jetpack_photon_url( jetpack_site_icon_url( get_current_blog_id() , 16 ), array( 'w' => 16 ), 'https' ), |
107
|
|
|
); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
return null; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
function is_jetpack() { |
114
|
|
|
return true; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
protected function get_jetpack_version() { |
118
|
|
|
return JETPACK__VERSION; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
function get_ak_vp_bundle_enabled() {} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Post functions |
125
|
|
|
*/ |
126
|
|
|
|
127
|
|
|
function wrap_post( $post, $context ) { |
128
|
|
|
return new Jetpack_Post( $this, $post, $context ); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
} |
132
|
|
|
|