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