1 | <?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
||
16 | class Jetpack_Plan { |
||
17 | /** |
||
18 | * A cache variable to hold the active plan for the current request. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | private static $active_plan_cache; |
||
23 | |||
24 | const PLAN_OPTION = 'jetpack_active_plan'; |
||
25 | |||
26 | const PLAN_DATA = array( |
||
27 | 'free' => array( |
||
28 | 'plans' => array( |
||
29 | 'jetpack_free', |
||
30 | ), |
||
31 | 'supports' => array( |
||
32 | 'opentable', |
||
33 | 'calendly', |
||
34 | ), |
||
35 | ), |
||
36 | 'personal' => array( |
||
37 | 'plans' => array( |
||
38 | 'jetpack_personal', |
||
39 | 'jetpack_personal_monthly', |
||
40 | 'personal-bundle', |
||
41 | 'personal-bundle-monthly', |
||
42 | 'personal-bundle-2y', |
||
43 | ), |
||
44 | 'supports' => array( |
||
45 | 'akismet', |
||
46 | 'recurring-payments', |
||
47 | ), |
||
48 | ), |
||
49 | 'premium' => array( |
||
50 | 'plans' => array( |
||
51 | 'jetpack_premium', |
||
52 | 'jetpack_premium_monthly', |
||
53 | 'value_bundle', |
||
54 | 'value_bundle-monthly', |
||
55 | 'value_bundle-2y', |
||
56 | ), |
||
57 | 'supports' => array( |
||
58 | 'simple-payments', |
||
59 | 'vaultpress', |
||
60 | 'videopress', |
||
61 | ), |
||
62 | ), |
||
63 | 'business' => array( |
||
64 | 'plans' => array( |
||
65 | 'jetpack_business', |
||
66 | 'jetpack_business_monthly', |
||
67 | 'business-bundle', |
||
68 | 'business-bundle-monthly', |
||
69 | 'business-bundle-2y', |
||
70 | 'ecommerce-bundle', |
||
71 | 'ecommerce-bundle-monthly', |
||
72 | 'ecommerce-bundle-2y', |
||
73 | 'vip', |
||
74 | ), |
||
75 | 'supports' => array(), |
||
76 | ), |
||
77 | ); |
||
78 | |||
79 | /** |
||
80 | * Given a response to the `/sites/%d` endpoint, will parse the response and attempt to set the |
||
81 | * plan from the response. |
||
82 | * |
||
83 | * @param array $response The response from `/sites/%d`. |
||
84 | * @return bool Was the plan successfully updated? |
||
85 | */ |
||
86 | public static function update_from_sites_response( $response ) { |
||
121 | |||
122 | /** |
||
123 | * Make an API call to WordPress.com for plan status |
||
124 | * |
||
125 | * @uses Jetpack_Options::get_option() |
||
126 | * @uses Client::wpcom_json_api_request_as_blog() |
||
127 | * @uses update_option() |
||
128 | * |
||
129 | * @access public |
||
130 | * @static |
||
131 | * |
||
132 | * @return bool True if plan is updated, false if no update |
||
133 | */ |
||
134 | public static function refresh_from_wpcom() { |
||
141 | |||
142 | /** |
||
143 | * Get the plan that this Jetpack site is currently using. |
||
144 | * |
||
145 | * @uses get_option() |
||
146 | * |
||
147 | * @access public |
||
148 | * @static |
||
149 | * |
||
150 | * @return array Active Jetpack plan details |
||
151 | */ |
||
152 | public static function get() { |
||
191 | |||
192 | /** |
||
193 | * Get the class of plan and a list of features it supports |
||
194 | * |
||
195 | * @param string $plan_slug The plan that we're interested in. |
||
196 | * @return array Two item array, the plan class and the an array of features. |
||
197 | */ |
||
198 | private static function get_class_and_features( $plan_slug ) { |
||
208 | |||
209 | /** |
||
210 | * Gets the minimum plan slug that supports the given feature |
||
211 | * |
||
212 | * @param string $feature The name of the feature. |
||
213 | * @return string|bool The slug for the minimum plan that supports. |
||
214 | * the feature or false if not found |
||
215 | */ |
||
216 | public static function get_minimum_plan_for_feature( $feature ) { |
||
224 | |||
225 | /** |
||
226 | * Determine whether the active plan supports a particular feature |
||
227 | * |
||
228 | * @uses Jetpack_Plan::get() |
||
229 | * |
||
230 | * @access public |
||
231 | * @static |
||
232 | * |
||
233 | * @param string $feature The module or feature to check. |
||
234 | * |
||
235 | * @return bool True if plan supports feature, false if not |
||
236 | */ |
||
237 | public static function supports( $feature ) { |
||
266 | } |
||
267 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..