. * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ class Ai1wm_Report { /** * Submit customer report to ServMask.com * * @param string $email User e-mail * @param string $message User message * @param integer $terms User accept terms * * @return array */ public function add( $email, $message, $terms ) { $errors = array(); // Submit report to ServMask if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { $errors[] = __( 'Your email is not valid.', AI1WM_PLUGIN_NAME ); } else if ( empty( $message ) ) { $errors[] = __( 'Please enter comments in the text area.', AI1WM_PLUGIN_NAME ); } else if ( empty( $terms ) ) { $errors[] = __( 'Please accept report term conditions.', AI1WM_PLUGIN_NAME ); } else { $response = wp_remote_post( AI1WM_REPORT_URL, array( 'body' => array( 'email' => $email, 'message' => $message, ), ) ); if ( is_wp_error( $response ) ) { $errors[] = sprintf( __( 'Something went wrong: %s', AI1WM_PLUGIN_NAME ), $response->get_error_message() ); } } return $errors; } }