id = 'rtkt_admin_request'; $this->title = __( 'New return request (store)', 'returnkit' ); $this->description = __( 'Sent to the store when a customer submits a return, exchange or withdrawal. Extra recipients can be added in ReturnKit → Settings.', 'returnkit' ); parent::__construct(); } /** * Default subject. * * @return string */ public function get_default_subject() { return __( '[{site_title}] New {request_type} {request_number}', 'returnkit' ); } /** * Default heading. * * @return string */ public function get_default_heading() { return __( 'New {request_type} request', 'returnkit' ); } /** * Send. * * @param Request $request Request. * @return bool */ public function trigger( Request $request ) { if ( ! Settings::get( 'notify_admin' ) ) { return false; } $this->setup( $request ); $recipients = Settings::lines( 'admin_recipients' ); $this->recipient = $recipients ? implode( ',', $recipients ) : get_option( 'admin_email' ); $this->extra = array( 'admin_url' => Admin::request_url( $request->id() ), 'sent_to_admin' => true, ); return $this->dispatch(); } /** * Reply-to the customer. * * @return string */ public function get_headers() { $headers = parent::get_headers(); if ( $this->request && is_email( $this->request->email() ) ) { $name = str_replace( array( "\r", "\n", '"' ), '', $this->request->name() ); $headers .= 'Reply-to: ' . ( '' !== $name ? '"' . $name . '" ' : '' ) . '<' . $this->request->email() . ">\r\n"; } return $headers; } }