. * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ class Ai1wm_Feedback_Controller { public static function feedback( $params = array() ) { // Set params if ( empty( $params ) ) { $params = stripslashes_deep( $_POST ); } // Set secret key $secret_key = null; if ( isset( $params['secret_key'] ) ) { $secret_key = trim( $params['secret_key'] ); } // Set type $type = null; if ( isset( $params['ai1wm_type'] ) ) { $type = trim( $params['ai1wm_type'] ); } // Set e-mail $email = null; if ( isset( $params['ai1wm_email'] ) ) { $email = trim( $params['ai1wm_email'] ); } // Set message $message = null; if ( isset( $params['ai1wm_message'] ) ) { $message = trim( $params['ai1wm_message'] ); } // Set terms $terms = false; if ( isset( $params['ai1wm_terms'] ) ) { $terms = (bool) $params['ai1wm_terms']; } try { // Ensure that unauthorized people cannot access feedback action ai1wm_verify_secret_key( $secret_key ); } catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) { exit; } $model = new Ai1wm_Feedback; // Send feedback $errors = $model->add( $type, $email, $message, $terms ); echo json_encode( array( 'errors' => $errors ) ); exit; } }