← All changes
|
jetpack_vendor/automattic/jetpack-stats-admin/src/class-odyssey-config-data.php
+12
-0
16.2
→
16.3
View file →
| @@ -159,8 +159,9 @@ | ||
| 159 | 159 | 'jetpack_version' => defined( 'JETPACK__VERSION' ) ? JETPACK__VERSION : '', |
| 160 | 160 | 'stats_admin_version' => Main::VERSION, |
| 161 | 161 | 'software_version' => $wp_version, |
| 162 | 162 | 'can_blaze' => $can_blaze, |
| 163 | + 'has_stats_settings' => ! $host->is_wpcom_simple(), | |
| 163 | 164 | ), |
| 164 | 165 | ), |
| 165 | 166 | ), |
| 166 | 167 | 'features' => array( "$blog_id" => array( 'data' => $this->get_plan_features() ) ), |
| @@ -233,10 +234,21 @@ | ||
| 233 | 234 | } |
| 234 | 235 | |
| 235 | 236 | /** |
| 236 | 237 | * Get the features of the current plan. |
| 238 | + * | |
| 239 | + * The app cannot refresh what it paywalls on, so a WordPress.com-hosted site is asked | |
| 240 | + * directly; a plan cached before an upgrade gates a feature the site has already paid for. | |
| 237 | 241 | */ |
| 238 | 242 | protected function get_plan_features() { |
| 243 | + // method_exists guard: an older plans package may win the autoloader on another plugin. | |
| 244 | + if ( method_exists( Jetpack_Plan::class, 'get_wpcom_site_specific_features' ) ) { | |
| 245 | + $features = Jetpack_Plan::get_wpcom_site_specific_features(); | |
| 246 | + if ( null !== $features ) { | |
| 247 | + return $features; | |
| 248 | + } | |
| 249 | + } | |
| 250 | + | |
| 239 | 251 | $plan = Jetpack_Plan::get(); |
| 240 | 252 | if ( empty( $plan['features'] ) ) { |
| 241 | 253 | return array(); |
| 242 | 254 | } |