/**
  * Get a value not saved locally.
  *
  * @since 4.3.0
  *
  * @param string $module Module slug.
  * @param string $option Option name.
  *
  * @return bool Whether user is receiving notifications or not.
  */
 public static function get_remote_value($module, $option)
 {
     if (in_array($module, array('post-by-email'), true)) {
         $option .= get_current_user_id();
     }
     // If option doesn't exist, 'does_not_exist' will be returned.
     $value = get_option($option, 'does_not_exist');
     // If option exists, just return it.
     if ('does_not_exist' !== $value) {
         return $value;
     }
     // Only check a remote option if Jetpack is connected.
     if (!Jetpack::is_active()) {
         return false;
     }
     // If the module is inactive, load the class to use the method.
     if (!did_action('jetpack_module_loaded_' . $module)) {
         // Class can't be found so do nothing.
         if (!@(include Jetpack::get_module_path($module))) {
             return false;
         }
     }
     // Do what is necessary for each module.
     switch ($module) {
         case 'monitor':
             $monitor = new Jetpack_Monitor();
             $value = $monitor->user_receives_notifications(false);
             break;
         case 'post-by-email':
             $post_by_email = new Jetpack_Post_By_Email();
             $value = $post_by_email->get_post_by_email_address();
             if ($value === null) {
                 $value = 'NULL';
                 // sentinel value so it actually gets set
             }
             break;
     }
     // Normalize value to boolean.
     if (is_wp_error($value) || is_null($value)) {
         $value = false;
     }
     // Save option to use it next time.
     update_option($option, $value);
     return $value;
 }
 /**
  * Get date of last downtime.
  *
  * @since 4.3.0
  *
  * @return mixed|WP_Error Number of days since last downtime. Otherwise, a WP_Error instance with the corresponding error.
  */
 public function get_monitor_data()
 {
     if (!Jetpack::is_module_active('monitor')) {
         return new WP_Error('not_active', esc_html__('The requested Jetpack module is not active.', 'jetpack'), array('status' => 404));
     }
     $monitor = new Jetpack_Monitor();
     $last_downtime = $monitor->monitor_get_last_downtime();
     if (is_wp_error($last_downtime)) {
         return $last_downtime;
     } else {
         if (false === strtotime($last_downtime)) {
             return rest_ensure_response(array('code' => 'success', 'date' => null));
         } else {
             return rest_ensure_response(array('code' => 'success', 'date' => human_time_diff(strtotime($last_downtime), strtotime('now'))));
         }
     }
 }