| @@ -1,0 +1,33 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Jetpack Connection Status. | |
| 4 | + * | |
| 5 | + * Filters the Connection Status API response | |
| 6 | + * | |
| 7 | + * @package jetpack | |
| 8 | + */ | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Filters the Connection Status API response | |
| 12 | + */ | |
| 13 | +class Jetpack_Connection_Status { | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * Initialize the main hooks. | |
| 17 | + */ | |
| 18 | + public static function init() { | |
| 19 | + add_filter( 'jetpack_connection_status', array( __CLASS__, 'filter_connection_status' ) ); | |
| 20 | + } | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Filters the connection status API response of the Connection package and modifies isActive value expected by the UI. | |
| 24 | + * | |
| 25 | + * @param array $status An array containing the connection status data. | |
| 26 | + */ | |
| 27 | + public static function filter_connection_status( $status ) { | |
| 28 | + | |
| 29 | + $status['isActive'] = Jetpack::is_connection_ready(); | |
| 30 | + | |
| 31 | + return $status; | |
| 32 | + } | |
| 33 | +} | |