/** * Check the connection to the pod and return the status for use with AJAX. */ public function check_pod_connection_status_callback() { if (isset($_REQUEST['debugging']) && !defined('WP2D_DEBUGGING')) { define('WP2D_DEBUGGING', true); } $status = $this->_check_pod_connection_status(); $data = array('debug' => esc_textarea(WP2D_Helpers::get_debugging()), 'message' => __('Connection successful.', 'wp-to-diaspora')); if (true === $status) { wp_send_json_success($data); } elseif (false === $status) { $data['message'] = $this->_load_api()->last_error; wp_send_json_error($data); } // If $status === null, do nothing. }